summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-01-18 02:57:08 +0000
committerMatt Kraai <kraai@debian.org>2001-01-18 02:57:08 +0000
commit12f417edbd21b322a8eaa8feb0ab238f13fa83c6 (patch)
tree06f9de2e4c7d33d29a448fb1c42ed1beafe18e6e /coreutils
parentc9acf8c766a9a2cc00449db5dea506d7663ad26b (diff)
downloadbusybox-w32-12f417edbd21b322a8eaa8feb0ab238f13fa83c6.tar.gz
busybox-w32-12f417edbd21b322a8eaa8feb0ab238f13fa83c6.tar.bz2
busybox-w32-12f417edbd21b322a8eaa8feb0ab238f13fa83c6.zip
Eliminate calls of the form "fprintf(stdout,". Thanks for the idea to
Vladimir N. Oleynik.
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/du.c4
-rw-r--r--coreutils/head.c4
-rw-r--r--coreutils/ls.c46
3 files changed, 27 insertions, 27 deletions
diff --git a/coreutils/du.c b/coreutils/du.c
index a04dba6d3..8628732d8 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -42,7 +42,7 @@ static Display *print;
42 42
43static void print_normal(long size, char *filename) 43static void print_normal(long size, char *filename)
44{ 44{
45 fprintf(stdout, "%ld\t%s\n", size, filename); 45 printf("%ld\t%s\n", size, filename);
46} 46}
47 47
48static void print_summary(long size, char *filename) 48static void print_summary(long size, char *filename)
@@ -165,7 +165,7 @@ int du_main(int argc, char **argv)
165 return status; 165 return status;
166} 166}
167 167
168/* $Id: du.c,v 1.32 2000/12/12 23:17:26 andersen Exp $ */ 168/* $Id: du.c,v 1.33 2001/01/18 02:57:08 kraai Exp $ */
169/* 169/*
170Local Variables: 170Local Variables:
171c-file-style: "linux" 171c-file-style: "linux"
diff --git a/coreutils/head.c b/coreutils/head.c
index 6e05eded5..a0ca453de 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -76,7 +76,7 @@ int head_main(int argc, char **argv)
76 } 76 }
77 if (fp) { 77 if (fp) {
78 if (need_headers) { 78 if (need_headers) {
79 fprintf(stdout, "==> %s <==\n", argv[optind]); 79 printf("==> %s <==\n", argv[optind]);
80 } 80 }
81 head(len, fp); 81 head(len, fp);
82 if (errno) { 82 if (errno) {
@@ -85,7 +85,7 @@ int head_main(int argc, char **argv)
85 errno = 0; 85 errno = 0;
86 } 86 }
87 if (optind < argc - 1) 87 if (optind < argc - 1)
88 fprintf(stdout, "\n"); 88 putchar('\n');
89 if (fp != stdin) 89 if (fp != stdin)
90 fclose(fp); 90 fclose(fp);
91 } 91 }
diff --git a/coreutils/ls.c b/coreutils/ls.c
index e44bd9b93..fa3e5424d 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -202,7 +202,7 @@ static int my_stat(struct dnode *cur)
202static void newline(void) 202static void newline(void)
203{ 203{
204 if (column > 0) { 204 if (column > 0) {
205 fprintf(stdout, "\n"); 205 putchar('\n');
206 column = 0; 206 column = 0;
207 } 207 }
208} 208}
@@ -229,7 +229,7 @@ static void nexttabstop( void )
229 n= nexttab - column; 229 n= nexttab - column;
230 if (n < 1) n= 1; 230 if (n < 1) n= 1;
231 while (n--) { 231 while (n--) {
232 fprintf(stdout, " "); 232 putchar(' ');
233 column++; 233 column++;
234 } 234 }
235 } 235 }
@@ -468,7 +468,7 @@ void showdirs(struct dnode **dn, int ndirs)
468 468
469 for (i=0; i<ndirs; i++) { 469 for (i=0; i<ndirs; i++) {
470 if (disp_opts & (DISP_DIRNAME | DISP_RECURSIVE)) { 470 if (disp_opts & (DISP_DIRNAME | DISP_RECURSIVE)) {
471 fprintf(stdout, "\n%s:\n", dn[i]->fullname); 471 printf("\n%s:\n", dn[i]->fullname);
472 } 472 }
473 subdnp= list_dir(dn[i]->fullname); 473 subdnp= list_dir(dn[i]->fullname);
474 nfiles= countfiles(subdnp); 474 nfiles= countfiles(subdnp);
@@ -579,53 +579,53 @@ int list_single(struct dnode *dn)
579 for (i=0; i<=31; i++) { 579 for (i=0; i<=31; i++) {
580 switch (list_fmt & (1<<i)) { 580 switch (list_fmt & (1<<i)) {
581 case LIST_INO: 581 case LIST_INO:
582 fprintf(stdout, "%7ld ", dn->dstat.st_ino); 582 printf("%7ld ", dn->dstat.st_ino);
583 column += 8; 583 column += 8;
584 break; 584 break;
585 case LIST_BLOCKS: 585 case LIST_BLOCKS:
586#if _FILE_OFFSET_BITS == 64 586#if _FILE_OFFSET_BITS == 64
587 fprintf(stdout, "%4lld ", dn->dstat.st_blocks>>1); 587 printf("%4lld ", dn->dstat.st_blocks>>1);
588#else 588#else
589 fprintf(stdout, "%4ld ", dn->dstat.st_blocks>>1); 589 printf("%4ld ", dn->dstat.st_blocks>>1);
590#endif 590#endif
591 column += 5; 591 column += 5;
592 break; 592 break;
593 case LIST_MODEBITS: 593 case LIST_MODEBITS:
594 fprintf(stdout, "%10s", (char *)mode_string(dn->dstat.st_mode)); 594 printf("%10s", (char *)mode_string(dn->dstat.st_mode));
595 column += 10; 595 column += 10;
596 break; 596 break;
597 case LIST_NLINKS: 597 case LIST_NLINKS:
598 fprintf(stdout, "%4d ", dn->dstat.st_nlink); 598 printf("%4d ", dn->dstat.st_nlink);
599 column += 10; 599 column += 10;
600 break; 600 break;
601 case LIST_ID_NAME: 601 case LIST_ID_NAME:
602#ifdef BB_FEATURE_LS_USERNAME 602#ifdef BB_FEATURE_LS_USERNAME
603 my_getpwuid(scratch, dn->dstat.st_uid); 603 my_getpwuid(scratch, dn->dstat.st_uid);
604 if (*scratch) 604 if (*scratch)
605 fprintf(stdout, "%-8.8s ", scratch); 605 printf("%-8.8s ", scratch);
606 else 606 else
607 fprintf(stdout, "%-8d ", dn->dstat.st_uid); 607 printf("%-8d ", dn->dstat.st_uid);
608 my_getgrgid(scratch, dn->dstat.st_gid); 608 my_getgrgid(scratch, dn->dstat.st_gid);
609 if (*scratch) 609 if (*scratch)
610 fprintf(stdout, "%-8.8s", scratch); 610 printf("%-8.8s", scratch);
611 else 611 else
612 fprintf(stdout, "%-8d", dn->dstat.st_gid); 612 printf("%-8d", dn->dstat.st_gid);
613 column += 17; 613 column += 17;
614 break; 614 break;
615#endif 615#endif
616 case LIST_ID_NUMERIC: 616 case LIST_ID_NUMERIC:
617 fprintf(stdout, "%-8d %-8d", dn->dstat.st_uid, dn->dstat.st_gid); 617 printf("%-8d %-8d", dn->dstat.st_uid, dn->dstat.st_gid);
618 column += 17; 618 column += 17;
619 break; 619 break;
620 case LIST_SIZE: 620 case LIST_SIZE:
621 case LIST_DEV: 621 case LIST_DEV:
622 if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) { 622 if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) {
623 fprintf(stdout, "%4d, %3d ", (int)MAJOR(dn->dstat.st_rdev), (int)MINOR(dn->dstat.st_rdev)); 623 printf("%4d, %3d ", (int)MAJOR(dn->dstat.st_rdev), (int)MINOR(dn->dstat.st_rdev));
624 } else { 624 } else {
625#if _FILE_OFFSET_BITS == 64 625#if _FILE_OFFSET_BITS == 64
626 fprintf(stdout, "%9lld ", dn->dstat.st_size); 626 printf("%9lld ", dn->dstat.st_size);
627#else 627#else
628 fprintf(stdout, "%9ld ", dn->dstat.st_size); 628 printf("%9ld ", dn->dstat.st_size);
629#endif 629#endif
630 } 630 }
631 column += 10; 631 column += 10;
@@ -634,23 +634,23 @@ int list_single(struct dnode *dn)
634 case LIST_FULLTIME: 634 case LIST_FULLTIME:
635 case LIST_DATE_TIME: 635 case LIST_DATE_TIME:
636 if (list_fmt & LIST_FULLTIME) { 636 if (list_fmt & LIST_FULLTIME) {
637 fprintf(stdout, "%24.24s ", filetime); 637 printf("%24.24s ", filetime);
638 column += 25; 638 column += 25;
639 break; 639 break;
640 } 640 }
641 age = time(NULL) - ttime; 641 age = time(NULL) - ttime;
642 fprintf(stdout, "%6.6s ", filetime+4); 642 printf("%6.6s ", filetime+4);
643 if (age < 3600L * 24 * 365 / 2 && age > -15 * 60) { 643 if (age < 3600L * 24 * 365 / 2 && age > -15 * 60) {
644 /* hh:mm if less than 6 months old */ 644 /* hh:mm if less than 6 months old */
645 fprintf(stdout, "%5.5s ", filetime+11); 645 printf("%5.5s ", filetime+11);
646 } else { 646 } else {
647 fprintf(stdout, " %4.4s ", filetime+20); 647 printf(" %4.4s ", filetime+20);
648 } 648 }
649 column += 13; 649 column += 13;
650 break; 650 break;
651#endif 651#endif
652 case LIST_FILENAME: 652 case LIST_FILENAME:
653 fprintf(stdout, "%s", dn->name); 653 printf("%s", dn->name);
654 column += strlen(dn->name); 654 column += strlen(dn->name);
655 break; 655 break;
656 case LIST_SYMLINK: 656 case LIST_SYMLINK:
@@ -658,7 +658,7 @@ int list_single(struct dnode *dn)
658 len= readlink(dn->fullname, scratch, (sizeof scratch)-1); 658 len= readlink(dn->fullname, scratch, (sizeof scratch)-1);
659 if (len > 0) { 659 if (len > 0) {
660 scratch[len]= '\0'; 660 scratch[len]= '\0';
661 fprintf(stdout, " -> %s", scratch); 661 printf(" -> %s", scratch);
662#ifdef BB_FEATURE_LS_FILETYPES 662#ifdef BB_FEATURE_LS_FILETYPES
663 if (!stat(dn->fullname, &info)) { 663 if (!stat(dn->fullname, &info)) {
664 append = append_char(info.st_mode); 664 append = append_char(info.st_mode);
@@ -671,7 +671,7 @@ int list_single(struct dnode *dn)
671#ifdef BB_FEATURE_LS_FILETYPES 671#ifdef BB_FEATURE_LS_FILETYPES
672 case LIST_FILETYPE: 672 case LIST_FILETYPE:
673 if (append != '\0') { 673 if (append != '\0') {
674 fprintf(stdout, "%1c", append); 674 printf("%1c", append);
675 column++; 675 column++;
676 } 676 }
677 break; 677 break;