Update putword() to accept a FILE *
This commit is contained in:
parent
504855ff96
commit
c914a2feca
2
echo.c
2
echo.c
|
@ -14,7 +14,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
for (; *argv; argc--, argv++)
|
||||
putword(*argv);
|
||||
putword(stdout, *argv);
|
||||
if (!nflag)
|
||||
putchar('\n');
|
||||
|
||||
|
|
|
@ -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
10
uname.c
|
@ -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
2
util.h
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user