diff options
author | charnier <charnier@FreeBSD.org> | 1997-08-11 07:21:08 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1997-08-11 07:21:08 +0000 |
commit | db6e9b0f817fc362dc74d8b4273dfb5eb5a65a12 (patch) | |
tree | ad568dde487c13cc2ad821266aecea23ab068b46 /usr.bin/sed/misc.c | |
parent | 5555a73810e96888231ea397c55ee788055ab6c7 (diff) | |
download | FreeBSD-src-db6e9b0f817fc362dc74d8b4273dfb5eb5a65a12.zip FreeBSD-src-db6e9b0f817fc362dc74d8b4273dfb5eb5a65a12.tar.gz |
Remove local redefinition for err(). Add usage().
Diffstat (limited to 'usr.bin/sed/misc.c')
-rw-r--r-- | usr.bin/sed/misc.c | 49 |
1 files changed, 7 insertions, 42 deletions
diff --git a/usr.bin/sed/misc.c b/usr.bin/sed/misc.c index 444b7a8..237f67a 100644 --- a/usr.bin/sed/misc.c +++ b/usr.bin/sed/misc.c @@ -36,12 +36,16 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include <sys/types.h> -#include <errno.h> +#include <err.h> #include <regex.h> #include <stdio.h> #include <stdlib.h> @@ -60,7 +64,7 @@ xmalloc(size) void *p; if ((p = malloc(size)) == NULL) - err(FATAL, "%s", strerror(errno)); + err(1, "malloc"); return (p); } @@ -76,7 +80,7 @@ xrealloc(p, size) return (xmalloc(size)); if ((p = realloc(p, size)) == NULL) - err(FATAL, "%s", strerror(errno)); + err(1, "realloc"); return (p); } @@ -100,42 +104,3 @@ strregerror(errcode, preg) (void)regerror(errcode, preg, oe, s); return (oe); } - -#if __STDC__ -#include <stdarg.h> -#else -#include <varargs.h> -#endif -/* - * Error reporting function - */ -void -#if __STDC__ -err(int severity, const char *fmt, ...) -#else -err(severity, fmt, va_alist) - int severity; - char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - (void)fprintf(stderr, "sed: "); - switch (severity) { - case WARNING: - case COMPILE: - (void)fprintf(stderr, "%lu: %s: ", linenum, fname); - } - (void)vfprintf(stderr, fmt, ap); - va_end(ap); - (void)fprintf(stderr, "\n"); - if (severity == WARNING) - return; - exit(1); - /* NOTREACHED */ -} |