summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorMatt Kraai2001-01-18 02:57:08 +0000
committerMatt Kraai2001-01-18 02:57:08 +0000
commit12f417edbd21b322a8eaa8feb0ab238f13fa83c6 (patch)
tree06f9de2e4c7d33d29a448fb1c42ed1beafe18e6e /coreutils
parentc9acf8c766a9a2cc00449db5dea506d7663ad26b (diff)
downloadbusybox-12f417edbd21b322a8eaa8feb0ab238f13fa83c6.zip
busybox-12f417edbd21b322a8eaa8feb0ab238f13fa83c6.tar.gz
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 a04dba6..8628732 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -42,7 +42,7 @@ static Display *print;
static void print_normal(long size, char *filename)
{
- fprintf(stdout, "%ld\t%s\n", size, filename);
+ printf("%ld\t%s\n", size, filename);
}
static void print_summary(long size, char *filename)
@@ -165,7 +165,7 @@ int du_main(int argc, char **argv)
return status;
}
-/* $Id: du.c,v 1.32 2000/12/12 23:17:26 andersen Exp $ */
+/* $Id: du.c,v 1.33 2001/01/18 02:57:08 kraai Exp $ */
/*
Local Variables:
c-file-style: "linux"
diff --git a/coreutils/head.c b/coreutils/head.c
index 6e05ede..a0ca453 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -76,7 +76,7 @@ int head_main(int argc, char **argv)
}
if (fp) {
if (need_headers) {
- fprintf(stdout, "==> %s <==\n", argv[optind]);
+ printf("==> %s <==\n", argv[optind]);
}
head(len, fp);
if (errno) {
@@ -85,7 +85,7 @@ int head_main(int argc, char **argv)
errno = 0;
}
if (optind < argc - 1)
- fprintf(stdout, "\n");
+ putchar('\n');
if (fp != stdin)
fclose(fp);
}
diff --git a/coreutils/ls.c b/coreutils/ls.c
index e44bd9b..fa3e542 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -202,7 +202,7 @@ static int my_stat(struct dnode *cur)
static void newline(void)
{
if (column > 0) {
- fprintf(stdout, "\n");
+ putchar('\n');
column = 0;
}
}
@@ -229,7 +229,7 @@ static void nexttabstop( void )
n= nexttab - column;
if (n < 1) n= 1;
while (n--) {
- fprintf(stdout, " ");
+ putchar(' ');
column++;
}
}
@@ -468,7 +468,7 @@ void showdirs(struct dnode **dn, int ndirs)
for (i=0; i<ndirs; i++) {
if (disp_opts & (DISP_DIRNAME | DISP_RECURSIVE)) {
- fprintf(stdout, "\n%s:\n", dn[i]->fullname);
+ printf("\n%s:\n", dn[i]->fullname);
}
subdnp= list_dir(dn[i]->fullname);
nfiles= countfiles(subdnp);
@@ -579,53 +579,53 @@ int list_single(struct dnode *dn)
for (i=0; i<=31; i++) {
switch (list_fmt & (1<<i)) {
case LIST_INO:
- fprintf(stdout, "%7ld ", dn->dstat.st_ino);
+ printf("%7ld ", dn->dstat.st_ino);
column += 8;
break;
case LIST_BLOCKS:
#if _FILE_OFFSET_BITS == 64
- fprintf(stdout, "%4lld ", dn->dstat.st_blocks>>1);
+ printf("%4lld ", dn->dstat.st_blocks>>1);
#else
- fprintf(stdout, "%4ld ", dn->dstat.st_blocks>>1);
+ printf("%4ld ", dn->dstat.st_blocks>>1);
#endif
column += 5;
break;
case LIST_MODEBITS:
- fprintf(stdout, "%10s", (char *)mode_string(dn->dstat.st_mode));
+ printf("%10s", (char *)mode_string(dn->dstat.st_mode));
column += 10;
break;
case LIST_NLINKS:
- fprintf(stdout, "%4d ", dn->dstat.st_nlink);
+ printf("%4d ", dn->dstat.st_nlink);
column += 10;
break;
case LIST_ID_NAME:
#ifdef BB_FEATURE_LS_USERNAME
my_getpwuid(scratch, dn->dstat.st_uid);
if (*scratch)
- fprintf(stdout, "%-8.8s ", scratch);
+ printf("%-8.8s ", scratch);
else
- fprintf(stdout, "%-8d ", dn->dstat.st_uid);
+ printf("%-8d ", dn->dstat.st_uid);
my_getgrgid(scratch, dn->dstat.st_gid);
if (*scratch)
- fprintf(stdout, "%-8.8s", scratch);
+ printf("%-8.8s", scratch);
else
- fprintf(stdout, "%-8d", dn->dstat.st_gid);
+ printf("%-8d", dn->dstat.st_gid);
column += 17;
break;
#endif
case LIST_ID_NUMERIC:
- fprintf(stdout, "%-8d %-8d", dn->dstat.st_uid, dn->dstat.st_gid);
+ printf("%-8d %-8d", dn->dstat.st_uid, dn->dstat.st_gid);
column += 17;
break;
case LIST_SIZE:
case LIST_DEV:
if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) {
- fprintf(stdout, "%4d, %3d ", (int)MAJOR(dn->dstat.st_rdev), (int)MINOR(dn->dstat.st_rdev));
+ printf("%4d, %3d ", (int)MAJOR(dn->dstat.st_rdev), (int)MINOR(dn->dstat.st_rdev));
} else {
#if _FILE_OFFSET_BITS == 64
- fprintf(stdout, "%9lld ", dn->dstat.st_size);
+ printf("%9lld ", dn->dstat.st_size);
#else
- fprintf(stdout, "%9ld ", dn->dstat.st_size);
+ printf("%9ld ", dn->dstat.st_size);
#endif
}
column += 10;
@@ -634,23 +634,23 @@ int list_single(struct dnode *dn)
case LIST_FULLTIME:
case LIST_DATE_TIME:
if (list_fmt & LIST_FULLTIME) {
- fprintf(stdout, "%24.24s ", filetime);
+ printf("%24.24s ", filetime);
column += 25;
break;
}
age = time(NULL) - ttime;
- fprintf(stdout, "%6.6s ", filetime+4);
+ printf("%6.6s ", filetime+4);
if (age < 3600L * 24 * 365 / 2 && age > -15 * 60) {
/* hh:mm if less than 6 months old */
- fprintf(stdout, "%5.5s ", filetime+11);
+ printf("%5.5s ", filetime+11);
} else {
- fprintf(stdout, " %4.4s ", filetime+20);
+ printf(" %4.4s ", filetime+20);
}
column += 13;
break;
#endif
case LIST_FILENAME:
- fprintf(stdout, "%s", dn->name);
+ printf("%s", dn->name);
column += strlen(dn->name);
break;
case LIST_SYMLINK:
@@ -658,7 +658,7 @@ int list_single(struct dnode *dn)
len= readlink(dn->fullname, scratch, (sizeof scratch)-1);
if (len > 0) {
scratch[len]= '\0';
- fprintf(stdout, " -> %s", scratch);
+ printf(" -> %s", scratch);
#ifdef BB_FEATURE_LS_FILETYPES
if (!stat(dn->fullname, &info)) {
append = append_char(info.st_mode);
@@ -671,7 +671,7 @@ int list_single(struct dnode *dn)
#ifdef BB_FEATURE_LS_FILETYPES
case LIST_FILETYPE:
if (append != '\0') {
- fprintf(stdout, "%1c", append);
+ printf("%1c", append);
column++;
}
break;