summaryrefslogtreecommitdiffhomepage
path: root/src/internal/argv
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-05-01 17:56:02 -0400
committermidipix <writeonce@midipix.org>2016-05-01 18:08:57 -0400
commitb78670fb3de87ee4779e79189e773fd42fdb89e4 (patch)
treeed81b081fb10f21c8a28a44941783942f32e7e4f /src/internal/argv
parentdf1c7b97fb2e65a121339984c44f8c64be9d5911 (diff)
downloadapimagic-b78670fb3de87ee4779e79189e773fd42fdb89e4.tar.bz2
apimagic-b78670fb3de87ee4779e79189e773fd42fdb89e4.tar.xz
argv.h: usage screen generator: use the 'file' parameter rather than 'stdout'.
Diffstat (limited to 'src/internal/argv')
-rw-r--r--src/internal/argv/argv.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/internal/argv/argv.h b/src/internal/argv/argv.h
index 78d55d3..cdf47f1 100644
--- a/src/internal/argv/argv.h
+++ b/src/internal/argv/argv.h
@@ -760,13 +760,13 @@ static void argv_usage(
fshort = mode ? !strcmp(mode,"short") : 0;
flong = fshort ? 0 : mode && !strcmp(mode,"long");
fboth = !fshort && !flong;
- fcolor = isatty(STDOUT_FILENO);
+ fcolor = isatty(fileno(file));
if (fcolor)
- fprintf(stdout,"%s%s",cbold,cgreen);
+ fprintf(file,"%s%s",cbold,cgreen);
if (header)
- fprintf(stdout,"%s",header);
+ fprintf(file,"%s",header);
option = options;
optlen = 0;
@@ -806,7 +806,7 @@ static void argv_usage(
/* color */
if (fcolor) {
color = (color == ccyan) ? cblue : ccyan;
- fputs(color,stdout);
+ fputs(color,file);
}
/* description, using either paradigm or argname if applicable */
@@ -847,7 +847,7 @@ static void argv_usage(
/* single line? */
if (optlen + strlen(description) < width) {
- fprintf(stdout,"%s%s\n",optstr,description);
+ fprintf(file,"%s%s\n",optstr,description);
} else {
desc = description;
@@ -879,9 +879,9 @@ static void argv_usage(
/* first line? */
if (desc == description)
- fprintf(stdout,"%s%s\n",optstr,desc);
+ fprintf(file,"%s%s\n",optstr,desc);
else
- fprintf(stdout,"%-*c %s\n",
+ fprintf(file,"%-*c %s\n",
(*desc == '|')
? (int)(optlen+1)
: (int)optlen,
@@ -898,7 +898,7 @@ static void argv_usage(
}
if (fcolor)
- fputs(creset,stdout);
+ fputs(creset,file);
}
#endif