Eliminate calls of the form "fprintf(stdout,". Thanks for the idea to
authorMatt Kraai <kraai@debian.org>
Thu, 18 Jan 2001 02:57:08 +0000 (02:57 -0000)
committerMatt Kraai <kraai@debian.org>
Thu, 18 Jan 2001 02:57:08 +0000 (02:57 -0000)
Vladimir N. Oleynik.

20 files changed:
cmdedit.c
coreutils/du.c
coreutils/head.c
coreutils/ls.c
du.c
find.c
findutils/find.c
head.c
ls.c
more.c
networking/telnet.c
procps/ps.c
procps/uptime.c
ps.c
rdate.c
shell/cmdedit.c
telnet.c
uptime.c
util-linux/more.c
util-linux/rdate.c

index 0765ca3ce29cf3e2c14191c835de807e5d41d58a..722a36a505614e93b73d3443f69d9e3266b17633 100644 (file)
--- a/cmdedit.c
+++ b/cmdedit.c
@@ -147,7 +147,7 @@ static void cmdedit_reset_term(void)
 static void clean_up_and_die(int sig)
 {
        cmdedit_reset_term();
-       fprintf(stdout, "\n");
+       printf("\n");
        if (sig!=SIGINT)
                exit(EXIT_SUCCESS);
 }
index a04dba6d3677befedd5add3c2ed4ccb974f32cf5..8628732d8f1292a0159c4d7c6a913d0b9b8f45f0 100644 (file)
@@ -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"
index 6e05eded543977eb55d226631af35373c1bc319b..a0ca453deb1690f955e5a42e5c2af23a93385db3 100644 (file)
@@ -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);
                }
index e44bd9b9358e00f6a2be4f9370ae0f8859f8ee8b..fa3e5424d831a90c22bcebd5e239fa23b5d4c3fc 100644 (file)
@@ -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;
diff --git a/du.c b/du.c
index a04dba6d3677befedd5add3c2ed4ccb974f32cf5..8628732d8f1292a0159c4d7c6a913d0b9b8f45f0 100644 (file)
--- a/du.c
+++ b/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/find.c b/find.c
index c82b509b6c9f88845b661c7d9aabe3a18fe30448..32d7db7ab99396fa61054a2dd75191ca3351def8 100644 (file)
--- a/find.c
+++ b/find.c
@@ -35,7 +35,7 @@ static int dereferenceFlag = FALSE;
 static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
 {
        if (pattern == NULL)
-               fprintf(stdout, "%s\n", fileName);
+               puts(fileName);
        else {
                char *tmp = strrchr(fileName, '/');
 
@@ -44,7 +44,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
                else
                        tmp++;
                if (check_wildcard_match(tmp, pattern) == TRUE)
-                       fprintf(stdout, "%s\n", fileName);
+                       puts(fileName);
        }
        return (TRUE);
 }
index c82b509b6c9f88845b661c7d9aabe3a18fe30448..32d7db7ab99396fa61054a2dd75191ca3351def8 100644 (file)
@@ -35,7 +35,7 @@ static int dereferenceFlag = FALSE;
 static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
 {
        if (pattern == NULL)
-               fprintf(stdout, "%s\n", fileName);
+               puts(fileName);
        else {
                char *tmp = strrchr(fileName, '/');
 
@@ -44,7 +44,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
                else
                        tmp++;
                if (check_wildcard_match(tmp, pattern) == TRUE)
-                       fprintf(stdout, "%s\n", fileName);
+                       puts(fileName);
        }
        return (TRUE);
 }
diff --git a/head.c b/head.c
index 6e05eded543977eb55d226631af35373c1bc319b..a0ca453deb1690f955e5a42e5c2af23a93385db3 100644 (file)
--- a/head.c
+++ b/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/ls.c b/ls.c
index e44bd9b9358e00f6a2be4f9370ae0f8859f8ee8b..fa3e5424d831a90c22bcebd5e239fa23b5d4c3fc 100644 (file)
--- a/ls.c
+++ b/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;
diff --git a/more.c b/more.c
index 9310cf930fc9dc79487c0088ce5bc14e6fa14acb..538708caac1b9c9fa8c3a22e46ed8e8d351b271c 100644 (file)
--- a/more.c
+++ b/more.c
@@ -54,8 +54,8 @@ static struct termios initial_settings, new_settings;
 static void gotsig(int sig)
 {
        setTermSettings(fileno(cin), &initial_settings);
-       fprintf(stdout, "\n");
-       exit(TRUE);
+       putchar('\n');
+       exit(EXIT_FAILURE);
 }
 #endif /* BB_FEATURE_USE_TERMIOS */
 
@@ -117,19 +117,19 @@ extern int more_main(int argc, char **argv)
 
                                please_display_more_prompt = 0;
                                lines = 0;
-                               len = fprintf(stdout, "--More-- ");
+                               len = printf("--More-- ");
                                if (file != stdin) {
 #if _FILE_OFFSET_BITS == 64
-                                       len += fprintf(stdout, "(%d%% of %lld bytes)",
+                                       len += printf("(%d%% of %lld bytes)",
 #else
-                                       len += fprintf(stdout, "(%d%% of %ld bytes)",
+                                       len += printf("(%d%% of %ld bytes)",
 #endif
                                                                   (int) (100 *
                                                                                  ((double) ftell(file) /
                                                                                   (double) st.st_size)),
                                                                   st.st_size);
                                }
-                               len += fprintf(stdout, "%s",
+                               len += printf("%s",
 #ifdef BB_FEATURE_USE_TERMIOS
                                                           ""
 #else
index fff8c06b54da3e274ab9c152f630850b0bdce460..54f25c4bcec774556bcd2e13a4f086318d7be5b9 100644 (file)
@@ -332,7 +332,7 @@ static void setConMode()
        {
                if (G.charmode == CHM_TRY) {
                        G.charmode = CHM_ON;
-                       fprintf(stdout, "\r\nEntering character mode%s'^]'.\r\n", escapecharis);
+                       printf("\r\nEntering character mode%s'^]'.\r\n", escapecharis);
                        rawmode();
                }
        }
@@ -340,7 +340,7 @@ static void setConMode()
        {
                if (G.charmode != CHM_OFF) {
                        G.charmode = CHM_OFF;
-                       fprintf(stdout, "\r\nEntering line mode%s'^C'.\r\n", escapecharis);
+                       printf("\r\nEntering line mode%s'^C'.\r\n", escapecharis);
                        cookmode();
                }
        }
index 2b41a495f8b8fac8e14261ff170281b9e72a0435..ec63bb548b7ce5005419d70598beb81f709b32ce 100644 (file)
@@ -143,8 +143,7 @@ extern int ps_main(int argc, char **argv)
                        terminal_width = win.ws_col - 1;
 #endif
 
-       fprintf(stdout, "%5s  %-8s %-3s %5s %s\n", "PID", "Uid", "Gid",
-                       "State", "Command");
+       printf("%5s  %-8s %-3s %5s %s\n", "PID", "Uid", "Gid", "State", "Command");
        while ((entry = readdir(dir)) != NULL) {
                if (!isdigit(*entry->d_name))
                        continue;
@@ -166,8 +165,7 @@ extern int ps_main(int argc, char **argv)
                if (file == NULL)
                        continue;
                i = 0;
-               len = fprintf(stdout, "%5d %-8s %-8s %c ", p.pid, uidName, groupName,
-                               p.state);
+               len = printf("%5d %-8s %-8s %c ", p.pid, uidName, groupName, p.state);
                while (((c = getc(file)) != EOF) && (i < (terminal_width-len))) {
                        i++;
                        if (c == '\0')
@@ -176,8 +174,8 @@ extern int ps_main(int argc, char **argv)
                }
                fclose(file);
                if (i == 0)
-                       fprintf(stdout, "[%s]", p.cmd);
-               fprintf(stdout, "\n");
+                       printf("[%s]", p.cmd);
+               putchar('\n');
        }
        closedir(dir);
        return EXIT_SUCCESS;
@@ -240,8 +238,7 @@ extern int ps_main(int argc, char **argv)
 #endif
 
        /* Print up a ps listing */
-       fprintf(stdout, "%5s  %-8s %-3s %5s %s\n", "PID", "Uid", "Gid",
-                       "State", "Command");
+       printf("%5s  %-8s %-3s %5s %s\n", "PID", "Uid", "Gid", "State", "Command");
 
        for (i=1; i<pid_array[0] ; i++) {
            info.pid = pid_array[i];
@@ -257,7 +254,7 @@ extern int ps_main(int argc, char **argv)
                if (*groupName == '\0')
                        sprintf(groupName, "%ld", info.egid);
 
-               len = fprintf(stdout, "%5d %-8s %-8s %c ", info.pid, uidName, groupName, info.state);
+               len = printf("%5d %-8s %-8s %c ", info.pid, uidName, groupName, info.state);
 
                if (strlen(info.command_line) > 1) {
                        for( j=0; j<(sizeof(info.command_line)-1) && j < (terminal_width-len); j++) {
@@ -266,9 +263,9 @@ extern int ps_main(int argc, char **argv)
                                }
                        }
                        *(info.command_line+j) = '\0';
-                       fprintf(stdout, "%s\n", info.command_line);
+                       puts(info.command_line);
                } else {
-                       fprintf(stdout, "[%s]\n", info.name);
+                       printf("[%s]\n", info.name);
                }
        }
 
index 159f24baa8c722e756176a4b5fb90aade956e2d2..fb3d347c31f440c44e09de48d681c5fd07781ef7 100644 (file)
@@ -51,19 +51,19 @@ extern int uptime_main(int argc, char **argv)
 
        sysinfo(&info);
 
-       fprintf(stdout, " %2d:%02d%s  up ", 
+       printf(" %2d:%02d%s  up ", 
                        current_time->tm_hour%12 ? current_time->tm_hour%12 : 12, 
                        current_time->tm_min, current_time->tm_hour > 11 ? "pm" : "am");
        updays = (int) info.uptime / (60*60*24);
        if (updays)
-               fprintf(stdout, "%d day%s, ", updays, (updays != 1) ? "s" : "");
+               printf("%d day%s, ", updays, (updays != 1) ? "s" : "");
        upminutes = (int) info.uptime / 60;
        uphours = (upminutes / 60) % 24;
        upminutes %= 60;
        if(uphours)
-               fprintf(stdout, "%2d:%02d, ", uphours, upminutes);
+               printf("%2d:%02d, ", uphours, upminutes);
        else
-               fprintf(stdout, "%d min, ", upminutes);
+               printf("%d min, ", upminutes);
 
        printf("load average: %ld.%02ld, %ld.%02ld, %ld.%02ld\n", 
                        LOAD_INT(info.loads[0]), LOAD_FRAC(info.loads[0]), 
diff --git a/ps.c b/ps.c
index 2b41a495f8b8fac8e14261ff170281b9e72a0435..ec63bb548b7ce5005419d70598beb81f709b32ce 100644 (file)
--- a/ps.c
+++ b/ps.c
@@ -143,8 +143,7 @@ extern int ps_main(int argc, char **argv)
                        terminal_width = win.ws_col - 1;
 #endif
 
-       fprintf(stdout, "%5s  %-8s %-3s %5s %s\n", "PID", "Uid", "Gid",
-                       "State", "Command");
+       printf("%5s  %-8s %-3s %5s %s\n", "PID", "Uid", "Gid", "State", "Command");
        while ((entry = readdir(dir)) != NULL) {
                if (!isdigit(*entry->d_name))
                        continue;
@@ -166,8 +165,7 @@ extern int ps_main(int argc, char **argv)
                if (file == NULL)
                        continue;
                i = 0;
-               len = fprintf(stdout, "%5d %-8s %-8s %c ", p.pid, uidName, groupName,
-                               p.state);
+               len = printf("%5d %-8s %-8s %c ", p.pid, uidName, groupName, p.state);
                while (((c = getc(file)) != EOF) && (i < (terminal_width-len))) {
                        i++;
                        if (c == '\0')
@@ -176,8 +174,8 @@ extern int ps_main(int argc, char **argv)
                }
                fclose(file);
                if (i == 0)
-                       fprintf(stdout, "[%s]", p.cmd);
-               fprintf(stdout, "\n");
+                       printf("[%s]", p.cmd);
+               putchar('\n');
        }
        closedir(dir);
        return EXIT_SUCCESS;
@@ -240,8 +238,7 @@ extern int ps_main(int argc, char **argv)
 #endif
 
        /* Print up a ps listing */
-       fprintf(stdout, "%5s  %-8s %-3s %5s %s\n", "PID", "Uid", "Gid",
-                       "State", "Command");
+       printf("%5s  %-8s %-3s %5s %s\n", "PID", "Uid", "Gid", "State", "Command");
 
        for (i=1; i<pid_array[0] ; i++) {
            info.pid = pid_array[i];
@@ -257,7 +254,7 @@ extern int ps_main(int argc, char **argv)
                if (*groupName == '\0')
                        sprintf(groupName, "%ld", info.egid);
 
-               len = fprintf(stdout, "%5d %-8s %-8s %c ", info.pid, uidName, groupName, info.state);
+               len = printf("%5d %-8s %-8s %c ", info.pid, uidName, groupName, info.state);
 
                if (strlen(info.command_line) > 1) {
                        for( j=0; j<(sizeof(info.command_line)-1) && j < (terminal_width-len); j++) {
@@ -266,9 +263,9 @@ extern int ps_main(int argc, char **argv)
                                }
                        }
                        *(info.command_line+j) = '\0';
-                       fprintf(stdout, "%s\n", info.command_line);
+                       puts(info.command_line);
                } else {
-                       fprintf(stdout, "[%s]\n", info.name);
+                       printf("[%s]\n", info.name);
                }
        }
 
diff --git a/rdate.c b/rdate.c
index 03f7f2de3c55950ce03c54fbba99c7ce6006fc1e..bb5392746ce1078b19f235dbbd0ce8caf8169f77 100644 (file)
--- a/rdate.c
+++ b/rdate.c
@@ -126,7 +126,7 @@ int rdate_main(int argc, char **argv)
                        perror_msg_and_die("Could not set time of day");
        }
        if (printdate) {
-               fprintf(stdout, "%s", ctime(&time));
+               printf("%s", ctime(&time));
        }
 
        return EXIT_SUCCESS;
index 0765ca3ce29cf3e2c14191c835de807e5d41d58a..722a36a505614e93b73d3443f69d9e3266b17633 100644 (file)
@@ -147,7 +147,7 @@ static void cmdedit_reset_term(void)
 static void clean_up_and_die(int sig)
 {
        cmdedit_reset_term();
-       fprintf(stdout, "\n");
+       printf("\n");
        if (sig!=SIGINT)
                exit(EXIT_SUCCESS);
 }
index fff8c06b54da3e274ab9c152f630850b0bdce460..54f25c4bcec774556bcd2e13a4f086318d7be5b9 100644 (file)
--- a/telnet.c
+++ b/telnet.c
@@ -332,7 +332,7 @@ static void setConMode()
        {
                if (G.charmode == CHM_TRY) {
                        G.charmode = CHM_ON;
-                       fprintf(stdout, "\r\nEntering character mode%s'^]'.\r\n", escapecharis);
+                       printf("\r\nEntering character mode%s'^]'.\r\n", escapecharis);
                        rawmode();
                }
        }
@@ -340,7 +340,7 @@ static void setConMode()
        {
                if (G.charmode != CHM_OFF) {
                        G.charmode = CHM_OFF;
-                       fprintf(stdout, "\r\nEntering line mode%s'^C'.\r\n", escapecharis);
+                       printf("\r\nEntering line mode%s'^C'.\r\n", escapecharis);
                        cookmode();
                }
        }
index 159f24baa8c722e756176a4b5fb90aade956e2d2..fb3d347c31f440c44e09de48d681c5fd07781ef7 100644 (file)
--- a/uptime.c
+++ b/uptime.c
@@ -51,19 +51,19 @@ extern int uptime_main(int argc, char **argv)
 
        sysinfo(&info);
 
-       fprintf(stdout, " %2d:%02d%s  up ", 
+       printf(" %2d:%02d%s  up ", 
                        current_time->tm_hour%12 ? current_time->tm_hour%12 : 12, 
                        current_time->tm_min, current_time->tm_hour > 11 ? "pm" : "am");
        updays = (int) info.uptime / (60*60*24);
        if (updays)
-               fprintf(stdout, "%d day%s, ", updays, (updays != 1) ? "s" : "");
+               printf("%d day%s, ", updays, (updays != 1) ? "s" : "");
        upminutes = (int) info.uptime / 60;
        uphours = (upminutes / 60) % 24;
        upminutes %= 60;
        if(uphours)
-               fprintf(stdout, "%2d:%02d, ", uphours, upminutes);
+               printf("%2d:%02d, ", uphours, upminutes);
        else
-               fprintf(stdout, "%d min, ", upminutes);
+               printf("%d min, ", upminutes);
 
        printf("load average: %ld.%02ld, %ld.%02ld, %ld.%02ld\n", 
                        LOAD_INT(info.loads[0]), LOAD_FRAC(info.loads[0]), 
index 9310cf930fc9dc79487c0088ce5bc14e6fa14acb..538708caac1b9c9fa8c3a22e46ed8e8d351b271c 100644 (file)
@@ -54,8 +54,8 @@ static struct termios initial_settings, new_settings;
 static void gotsig(int sig)
 {
        setTermSettings(fileno(cin), &initial_settings);
-       fprintf(stdout, "\n");
-       exit(TRUE);
+       putchar('\n');
+       exit(EXIT_FAILURE);
 }
 #endif /* BB_FEATURE_USE_TERMIOS */
 
@@ -117,19 +117,19 @@ extern int more_main(int argc, char **argv)
 
                                please_display_more_prompt = 0;
                                lines = 0;
-                               len = fprintf(stdout, "--More-- ");
+                               len = printf("--More-- ");
                                if (file != stdin) {
 #if _FILE_OFFSET_BITS == 64
-                                       len += fprintf(stdout, "(%d%% of %lld bytes)",
+                                       len += printf("(%d%% of %lld bytes)",
 #else
-                                       len += fprintf(stdout, "(%d%% of %ld bytes)",
+                                       len += printf("(%d%% of %ld bytes)",
 #endif
                                                                   (int) (100 *
                                                                                  ((double) ftell(file) /
                                                                                   (double) st.st_size)),
                                                                   st.st_size);
                                }
-                               len += fprintf(stdout, "%s",
+                               len += printf("%s",
 #ifdef BB_FEATURE_USE_TERMIOS
                                                           ""
 #else
index 03f7f2de3c55950ce03c54fbba99c7ce6006fc1e..bb5392746ce1078b19f235dbbd0ce8caf8169f77 100644 (file)
@@ -126,7 +126,7 @@ int rdate_main(int argc, char **argv)
                        perror_msg_and_die("Could not set time of day");
        }
        if (printdate) {
-               fprintf(stdout, "%s", ctime(&time));
+               printf("%s", ctime(&time));
        }
 
        return EXIT_SUCCESS;