Update putword() to accept a FILE *

This commit is contained in:
sin 2015-04-21 17:40:57 +01:00
parent 504855ff96
commit c914a2feca
4 changed files with 9 additions and 9 deletions

2
echo.c
View File

@ -14,7 +14,7 @@ main(int argc, char *argv[])
}
for (; *argv; argc--, argv++)
putword(*argv);
putword(stdout, *argv);
if (!nflag)
putchar('\n');

View File

@ -4,13 +4,13 @@
#include "../util.h"
void
putword(const char *s)
putword(FILE *fp, const char *s)
{
static int first = 1;
if (!first)
putchar(' ');
fputs(s, stdout);
fputs(s, fp);
first = 0;
}

10
uname.c
View File

@ -44,15 +44,15 @@ main(int argc, char *argv[])
eprintf("uname:");
if (sflag || !(nflag || rflag || vflag || mflag))
putword(u.sysname);
putword(stdout, u.sysname);
if (nflag)
putword(u.nodename);
putword(stdout, u.nodename);
if (rflag)
putword(u.release);
putword(stdout, u.release);
if (vflag)
putword(u.version);
putword(stdout, u.version);
if (mflag)
putword(u.machine);
putword(stdout, u.machine);
putchar('\n');
return fshut(stdout, "<stdout>");

2
util.h
View File

@ -68,7 +68,7 @@ void fnck(const char *, const char *, int (*)(const char *, const char *, int),
mode_t getumask(void);
char *humansize(double);
mode_t parsemode(const char *, mode_t, mode_t);
void putword(const char *);
void putword(FILE *, const char *);
#undef strtonum
long long strtonum(const char *, long long, long long, const char **);
long long enstrtonum(int, const char *, long long, long long);