From 12f417edbd21b322a8eaa8feb0ab238f13fa83c6 Mon Sep 17 00:00:00 2001 From: Matt Kraai Date: Thu, 18 Jan 2001 02:57:08 +0000 Subject: Eliminate calls of the form "fprintf(stdout,". Thanks for the idea to Vladimir N. Oleynik. --- cmdedit.c | 2 +- coreutils/du.c | 4 ++-- coreutils/head.c | 4 ++-- coreutils/ls.c | 46 +++++++++++++++++++++++----------------------- du.c | 4 ++-- find.c | 4 ++-- findutils/find.c | 4 ++-- head.c | 4 ++-- ls.c | 46 +++++++++++++++++++++++----------------------- more.c | 12 ++++++------ networking/telnet.c | 4 ++-- procps/ps.c | 19 ++++++++----------- procps/uptime.c | 8 ++++---- ps.c | 19 ++++++++----------- rdate.c | 2 +- shell/cmdedit.c | 2 +- telnet.c | 4 ++-- uptime.c | 8 ++++---- util-linux/more.c | 12 ++++++------ util-linux/rdate.c | 2 +- 20 files changed, 102 insertions(+), 108 deletions(-) diff --git a/cmdedit.c b/cmdedit.c index 0765ca3ce..722a36a50 100644 --- 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); } 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; 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 6e05eded5..a0ca453de 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 e44bd9b93..fa3e5424d 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; ifullname); + 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<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 a04dba6d3..8628732d8 100644 --- 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 c82b509b6..32d7db7ab 100644 --- 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); } diff --git a/findutils/find.c b/findutils/find.c index c82b509b6..32d7db7ab 100644 --- a/findutils/find.c +++ b/findutils/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); } diff --git a/head.c b/head.c index 6e05eded5..a0ca453de 100644 --- 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 e44bd9b93..fa3e5424d 100644 --- 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; ifullname); + 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<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 9310cf930..538708caa 100644 --- 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 diff --git a/networking/telnet.c b/networking/telnet.c index fff8c06b5..54f25c4bc 100644 --- a/networking/telnet.c +++ b/networking/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(); } } diff --git a/procps/ps.c b/procps/ps.c index 2b41a495f..ec63bb548 100644 --- a/procps/ps.c +++ b/procps/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 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/procps/uptime.c b/procps/uptime.c index 159f24baa..fb3d347c3 100644 --- a/procps/uptime.c +++ b/procps/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]), diff --git a/ps.c b/ps.c index 2b41a495f..ec63bb548 100644 --- 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 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 03f7f2de3..bb5392746 100644 --- 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; diff --git a/shell/cmdedit.c b/shell/cmdedit.c index 0765ca3ce..722a36a50 100644 --- a/shell/cmdedit.c +++ b/shell/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); } diff --git a/telnet.c b/telnet.c index fff8c06b5..54f25c4bc 100644 --- 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(); } } diff --git a/uptime.c b/uptime.c index 159f24baa..fb3d347c3 100644 --- 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]), diff --git a/util-linux/more.c b/util-linux/more.c index 9310cf930..538708caa 100644 --- a/util-linux/more.c +++ b/util-linux/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 diff --git a/util-linux/rdate.c b/util-linux/rdate.c index 03f7f2de3..bb5392746 100644 --- a/util-linux/rdate.c +++ b/util-linux/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; -- cgit v1.2.3