Skip to content

Commit

Permalink
Fix oddity with OSX and Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgiven committed Dec 8, 2024
1 parent c1c1d14 commit c25cd39
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions util/ack/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ extern int w_flag;
extern int n_error;

#ifdef DEBUG
#define stdout stdout
#define OUTF stdout
#else
#define stdout stderr
#define OUTF stderr
#endif

char* ack_basename(const char* string)
Expand Down Expand Up @@ -91,9 +91,9 @@ void fatal(const char* fmt, ...)
/* Fatal internal error */
va_list ap;
va_start(ap, fmt);
fprintf(stdout, "%s: fatal internal error, ", progname);
vfprintf(stdout, fmt, ap);
fprintf(stdout, "\n");
fprintf(OUTF, "%s: fatal internal error, ", progname);
vfprintf(OUTF, fmt, ap);
fprintf(OUTF, "\n");
quit(-2);
}

Expand All @@ -103,7 +103,7 @@ void vprint(const char* fmt, ...)
/* Diagnostic print, no auto NL */
va_list ap;
va_start(ap, fmt);
vfprintf(stdout, fmt, ap);
vfprintf(OUTF, fmt, ap);
va_end(ap);
}

Expand All @@ -113,9 +113,9 @@ void fuerror(const char* fmt, ...)
/* Fatal user error */
va_list ap;
va_start(ap, fmt);
fprintf(stdout, "%s: ", progname);
vfprintf(stdout, fmt, ap);
fprintf(stdout, "\n");
fprintf(OUTF, "%s: ", progname);
vfprintf(OUTF, fmt, ap);
fprintf(OUTF, "\n");
quit(-1);
}

Expand All @@ -127,9 +127,9 @@ void werror(const char* fmt, ...)
if (w_flag)
return;
va_start(ap, fmt);
fprintf(stdout, "%s: warning, ", progname);
vfprintf(stdout, fmt, ap);
fprintf(stdout, "\n");
fprintf(OUTF, "%s: warning, ", progname);
vfprintf(OUTF, fmt, ap);
fprintf(OUTF, "\n");
va_end(ap);
}

Expand All @@ -139,9 +139,9 @@ void error(const char* fmt, ...)
/* User error, it is the callers responsibility to quit */
va_list ap;
va_start(ap, fmt);
fprintf(stdout, "%s: ", progname);
vfprintf(stdout, fmt, ap);
fprintf(stdout, "\n");
fprintf(OUTF, "%s: ", progname);
vfprintf(OUTF, fmt, ap);
fprintf(OUTF, "\n");
n_error++;
va_end(ap);
}
Expand Down

0 comments on commit c25cd39

Please sign in to comment.