From: Ace Date: Sat, 3 Jan 2015 09:45:13 +0000 (+0800) Subject: ... X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=c14f0ef1c1f4a65f37981cdf24073beba383abf8;p=acecode.git ... --- diff --git a/tools/comm/Makefile b/tools/comm/Makefile index 4cd3efb..e3acbf2 100644 --- a/tools/comm/Makefile +++ b/tools/comm/Makefile @@ -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) diff --git a/tools/comm/countc.c b/tools/comm/countc.c index ff0da3b..e71f771 100644 --- a/tools/comm/countc.c +++ b/tools/comm/countc.c @@ -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); }