From 76cd8d66fedd20f3abd12e0c15b01f75db2fefcc Mon Sep 17 00:00:00 2001 From: Philippe Charnier Date: Wed, 28 Jan 1998 07:36:25 +0000 Subject: Add rcsid. RU#. Use err(3) instead of local redefinition. Convert man page to mdoc format. Add usage(). Remove rcs $ Log $ -> use cvs log instead. --- usr.bin/file/print.c | 76 ++++++---------------------------------------------- 1 file changed, 8 insertions(+), 68 deletions(-) (limited to 'usr.bin/file/print.c') diff --git a/usr.bin/file/print.c b/usr.bin/file/print.c index 09c3fc8d7207..758027ab4c93 100644 --- a/usr.bin/file/print.c +++ b/usr.bin/file/print.c @@ -25,7 +25,12 @@ * 4. This notice may not be removed or altered. */ -#include +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + +#include #include #include #if __STDC__ @@ -33,16 +38,9 @@ #else # include #endif -#include -#include #include #include "file.h" -#ifndef lint -static char *moduleid = - "@(#)$Id: print.c,v 1.1.1.3 1997/03/18 17:58:49 mpp Exp $"; -#endif /* lint */ - #define SZOF(a) (sizeof(a) / sizeof(a[0])) void @@ -117,7 +115,7 @@ ckfputs(str, fil) FILE *fil; { if (fputs(str,fil) == EOF) - error("write failed.\n"); + errx(1, "write failed"); } /*VARARGS*/ @@ -141,64 +139,6 @@ ckfprintf(va_alist) #endif (void) vfprintf(f, fmt, va); if (ferror(f)) - error("write failed.\n"); - va_end(va); -} - -/* - * error - print best error message possible and exit - */ -/*VARARGS*/ -void -#if __STDC__ -error(const char *f, ...) -#else -error(va_alist) - va_dcl -#endif -{ - va_list va; -#if __STDC__ - va_start(va, f); -#else - const char *f; - va_start(va); - f = va_arg(va, const char *); -#endif - /* cuz we use stdout for most, stderr here */ - (void) fflush(stdout); - - if (progname != NULL) - (void) fprintf(stderr, "%s: ", progname); - (void) vfprintf(stderr, f, va); - va_end(va); - exit(1); -} - -/*VARARGS*/ -void -#if __STDC__ -magwarn(const char *f, ...) -#else -magwarn(va_alist) - va_dcl -#endif -{ - va_list va; -#if __STDC__ - va_start(va, f); -#else - const char *f; - va_start(va); - f = va_arg(va, const char *); -#endif - /* cuz we use stdout for most, stderr here */ - (void) fflush(stdout); - - if (progname != NULL) - (void) fprintf(stderr, "%s: %s, %d: ", - progname, magicfile, lineno); - (void) vfprintf(stderr, f, va); + errx(1, "write failed"); va_end(va); - fputc('\n', stderr); } -- cgit v1.2.3