]> Zhao Yanbai Git Server - acecode.git/commitdiff
...
authorAce <Ace@AcedeMacBook-Pro.local>
Sat, 3 Jan 2015 09:45:13 +0000 (17:45 +0800)
committerAce <Ace@AcedeMacBook-Pro.local>
Sat, 3 Jan 2015 09:45:13 +0000 (17:45 +0800)
tools/comm/Makefile
tools/comm/countc.c

index 4cd3efb062b707cf4d2d42185f00e25f2c35e911..e3acbf2281ada8dab1b00fcc9c78fe7407d731c9 100644 (file)
@@ -2,7 +2,7 @@ CC      = gcc
 CPP    = g++
 BINS   = countc htc
 SCRIPTS = cls cs
-DST    = /usr/local/bin/
+DST    = $(HOME)/sys/bin/ 
 
 %.o : %.c
        $(CC) $< -o $@
@@ -13,8 +13,8 @@ DST   = /usr/local/bin/
 every: $(BINS)
        cp $(BINS) $(DST)
        cp $(SCRIPTS) $(DST)
-       rm $(BINS) -f
+       rm -f $(BINS)
 .PHONY:clean
 clean:
-       rm $(BINS) -f
+       rm -f $(BINS)
 
index ff0da3bd8ed30263fc76de4769f451ca5484b054..e71f771ec242d6960f7b998d9f2c1c0ed11bfc40 100644 (file)
@@ -35,12 +35,12 @@ long        total_bytes     = 0;
 int    main(int argc,char *argv[])
 {
        int     i;
-       if(argc <= 2){printf("parameter error\n");return;}
+       if(argc <= 2){printf("parameter error\n");return -1;}
        ++argv;
        printf("[line] [ byte ] path\n");
        if(!strcmp(*argv,"-d"))         count_dir(*++argv);
        else if(!strcmp(*argv,"-f"))    count_file(*++argv);
-       else{printf("parameter error\n");return;}
+       else{printf("parameter error\n");return -1;}
        printf("+-------------------------------+\n");
        printf("| %10d Files.             |\n",file_num);
        printf("| %10ld Lines.             |\n",total_line);
@@ -112,7 +112,7 @@ void        count_file(char *path)
                        ch      = fgetc(fp);
                        if(ch == '\n'){total_line++;line++;}
                }
-               printf("[%4d] [%6d] %-50s\n",line, st.st_size, path);
+               printf("[%4d] [%6lld] %-50s\n",line, st.st_size, path);
                file_num++;
                fclose(fp);
        }