From: Alan Cox Date: Thu, 21 May 2015 22:32:40 +0000 (+0100) Subject: chgrp: remove stdio X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=f23a5c5db291f9713095d86d308bee2cea083a63;p=FUZIX.git chgrp: remove stdio --- diff --git a/Applications/util/chgrp.c b/Applications/util/chgrp.c index fd54d0dc..4051dbd0 100644 --- a/Applications/util/chgrp.c +++ b/Applications/util/chgrp.c @@ -2,14 +2,21 @@ * Copyright (c) 1993 by David I. Bell * Permission is granted to use, distribute, or modify this source, * provided that this copyright notice remains intact. + * + * stdio use removed, Alan Cox 2015 */ #include #include #include -#include +#include #include +int writes(const char *p) +{ + write(2, p, strlen(p)); +} + int main(int argc, char *argv[]) { char *cp; @@ -19,7 +26,7 @@ int main(int argc, char *argv[]) cp = argv[1]; if (!cp) { - fprintf(stderr, "chgrp: too few arguments\n"); + writes("chgrp: too few arguments\n"); return 1; } if (isdigit(*cp)) { @@ -28,13 +35,13 @@ int main(int argc, char *argv[]) gid = gid * 10 + (*cp++ - '0'); if (*cp) { - fprintf(stderr, "chgrp: bad gid value\n"); + writes("chgrp: bad gid value\n"); return 1; } } else { grp = getgrnam(cp); if (grp == NULL) { - fprintf(stderr, "chgrp: unknown group name\n"); + writes("chgrp: unknown group name\n"); return 1; } gid = grp->gr_gid;