fputs instead of fprintf

This commit is contained in:
albert 2005-10-30 23:45:47 +00:00
parent 3fca0261e0
commit 29cbc63561
4 changed files with 8 additions and 8 deletions

View File

@ -338,7 +338,7 @@ do_regcomp (void)
re_err = regcomp (preg, re, REG_EXTENDED | REG_NOSUB); re_err = regcomp (preg, re, REG_EXTENDED | REG_NOSUB);
if (re_err) { if (re_err) {
regerror (re_err, preg, errbuf, sizeof(errbuf)); regerror (re_err, preg, errbuf, sizeof(errbuf));
fprintf (stderr, errbuf); fputs(errbuf,stderr);
exit (2); exit (2);
} }
} }

View File

@ -52,7 +52,7 @@ static char buf[1024];
#define FILE_TO_BUF(filename, fd) do{ \ #define FILE_TO_BUF(filename, fd) do{ \
static int local_n; \ static int local_n; \
if (fd == -1 && (fd = open(filename, O_RDONLY)) == -1) { \ if (fd == -1 && (fd = open(filename, O_RDONLY)) == -1) { \
fprintf(stderr, BAD_OPEN_MESSAGE); \ fputs(BAD_OPEN_MESSAGE, stderr); \
fflush(NULL); \ fflush(NULL); \
_exit(102); \ _exit(102); \
} \ } \
@ -79,7 +79,7 @@ int uptime(double *restrict uptime_secs, double *restrict idle_secs) {
setlocale(LC_NUMERIC,"C"); setlocale(LC_NUMERIC,"C");
if (sscanf(buf, "%lf %lf", &up, &idle) < 2) { if (sscanf(buf, "%lf %lf", &up, &idle) < 2) {
setlocale(LC_NUMERIC,savelocale); setlocale(LC_NUMERIC,savelocale);
fprintf(stderr, "bad data in " UPTIME_FILE "\n"); fputs("bad data in " UPTIME_FILE "\n", stderr);
return 0; return 0;
} }
setlocale(LC_NUMERIC,savelocale); setlocale(LC_NUMERIC,savelocale);
@ -222,7 +222,7 @@ static void init_libproc(void){
if(linux_version_code > LINUX_VERSION(2, 4, 0)){ if(linux_version_code > LINUX_VERSION(2, 4, 0)){
Hertz = find_elf_note(AT_CLKTCK); Hertz = find_elf_note(AT_CLKTCK);
if(Hertz!=NOTE_NOT_FOUND) return; if(Hertz!=NOTE_NOT_FOUND) return;
fprintf(stderr, "2.4+ kernel w/o ELF notes? -- report this\n"); fputs("2.4+ kernel w/o ELF notes? -- report this\n", stderr);
} }
old_Hertz_hack(); old_Hertz_hack();
} }
@ -300,7 +300,7 @@ void loadavg(double *restrict av1, double *restrict av5, double *restrict av15)
savelocale = setlocale(LC_NUMERIC, NULL); savelocale = setlocale(LC_NUMERIC, NULL);
setlocale(LC_NUMERIC, "C"); setlocale(LC_NUMERIC, "C");
if (sscanf(buf, "%lf %lf %lf", &avg_1, &avg_5, &avg_15) < 3) { if (sscanf(buf, "%lf %lf %lf", &avg_1, &avg_5, &avg_15) < 3) {
fprintf(stderr, "bad data in " LOADAVG_FILE "\n"); fputs("bad data in " LOADAVG_FILE "\n", stderr);
exit(1); exit(1);
} }
setlocale(LC_NUMERIC, savelocale); setlocale(LC_NUMERIC, savelocale);

2
pwdx.c
View File

@ -22,7 +22,7 @@
static void die(const char *msg) NORETURN; static void die(const char *msg) NORETURN;
static void die(const char *msg) static void die(const char *msg)
{ {
fprintf(stderr, msg); fputs(msg, stderr);
exit(1); exit(1);
} }

View File

@ -395,7 +395,7 @@ static void diskformat(void){
free(partitions); free(partitions);
} }
}else{ }else{
fprintf(stderr, "Your kernel doesn't support diskstat (2.5.70 or above required)"); fprintf(stderr, "Your kernel doesn't support diskstat (2.5.70 or above required)\n");
exit(0); exit(0);
} }
} }
@ -416,7 +416,7 @@ static void slabformat (void){
fSlab=fopen("/proc/slabinfo", "rb"); fSlab=fopen("/proc/slabinfo", "rb");
if(!fSlab){ if(!fSlab){
fprintf(stderr, "Your kernel doesn't support slabinfo"); fprintf(stderr, "Your kernel doesn't support slabinfo.\n");
return; return;
} }