sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit c914a2fecadabb560ff5692154f31d8bfa20959f
parent 504855ff96389b02fd92197792a7b26069cde593
Author: sin <sin@2f30.org>
Date:   Tue, 21 Apr 2015 17:40:57 +0100

Update putword() to accept a FILE *

Diffstat:
Mecho.c | 2+-
Mlibutil/putword.c | 4++--
Muname.c | 10+++++-----
Mutil.h | 2+-
4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/echo.c b/echo.c @@ -14,7 +14,7 @@ main(int argc, char *argv[]) } for (; *argv; argc--, argv++) - putword(*argv); + putword(stdout, *argv); if (!nflag) putchar('\n'); diff --git a/libutil/putword.c b/libutil/putword.c @@ -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; } diff --git a/uname.c b/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>"); diff --git a/util.h b/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);