[hackers] [sbase] Update putword() to accept a FILE * || sin
commit c914a2fecadabb560ff5692154f31d8bfa20959f
Author: sin <sin_AT_2f30.org>
Date: Tue Apr 21 17:40:57 2015 +0100
Update putword() to accept a FILE *
diff --git a/echo.c b/echo.c
index 44941d1..1906133 100644
--- a/echo.c
+++ b/echo.c
_AT_@ -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
index c460703..41d748c 100644
--- a/libutil/putword.c
+++ b/libutil/putword.c
_AT_@ -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
index 2fa3960..ede818e 100644
--- a/uname.c
+++ b/uname.c
_AT_@ -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
index 7dd5713..6bc37ee 100644
--- a/util.h
+++ b/util.h
_AT_@ -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);
Received on Tue Apr 21 2015 - 19:00:52 CEST
This archive was generated by hypermail 2.3.0
: Tue Apr 21 2015 - 19:12:24 CEST