From 1971be2b5beb653493a4e0a8d7e5c51abe4dbeb5 Mon Sep 17 00:00:00 2001 From: Michael Shalayeff Date: Sun, 9 Feb 1997 16:37:14 +0000 Subject: use library err/warn --- usr.bin/strip/strip.c | 42 ++++++++---------------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) (limited to 'usr.bin/strip') diff --git a/usr.bin/strip/strip.c b/usr.bin/strip/strip.c index fcc78488f98..792eba72d05 100644 --- a/usr.bin/strip/strip.c +++ b/usr.bin/strip/strip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strip.c,v 1.6 1997/01/15 23:43:15 millert Exp $ */ +/* $OpenBSD: strip.c,v 1.7 1997/02/09 16:37:13 mickey Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. @@ -41,7 +41,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)strip.c 5.8 (Berkeley) 11/6/91";*/ -static char rcsid[] = "$OpenBSD: strip.c,v 1.6 1997/01/15 23:43:15 millert Exp $"; +static char rcsid[] = "$OpenBSD: strip.c,v 1.7 1997/02/09 16:37:13 mickey Exp $"; #endif /* not lint */ #include @@ -55,13 +55,13 @@ static char rcsid[] = "$OpenBSD: strip.c,v 1.6 1997/01/15 23:43:15 millert Exp $ #include #include #include +#include typedef struct exec EXEC; typedef struct nlist NLIST; #define strx n_un.n_strx -void err __P((const char *fmt, ...)); int s_stab __P((const char *, int, EXEC *, struct stat *)); int s_sym __P((const char *, int, EXEC *, struct stat *)); void usage __P((void)); @@ -96,7 +96,7 @@ main(argc, argv) argv += optind; errors = 0; -#define ERROR(x) errors |= 1; err("%s: %s", fn, strerror(x)); continue; +#define ERROR(x) errors |= 1; warn(fn); continue; while (fn = *argv++) { if ((fd = open(fn, O_RDWR)) < 0) { ERROR(errno); @@ -193,7 +193,7 @@ s_sym(fn, fd, ep, sp) /* Truncate the file. */ if (ftruncate(fd, neweof - (char *)ep)) { - err("%s: %s", fn, strerror(errno)); + warn(fn); return 1; } @@ -217,7 +217,7 @@ s_stab(fn, fd, ep, sp) return 0; if (N_SYMOFF(*ep) >= sp->st_size) { - err("%s: bad symbol table", fn); + warnx("%s: bad symbol table", fn); return 1; } @@ -235,7 +235,7 @@ s_stab(fn, fd, ep, sp) */ strbase = (char *)ep + N_STROFF(*ep); if ((nstrbase = malloc((u_int)*(u_long *)strbase)) == NULL) { - err("%s", strerror(ENOMEM)); + warnx("%s", strerror(ENOMEM)); return 1; } nstr = nstrbase + sizeof(u_long); @@ -279,7 +279,7 @@ s_stab(fn, fd, ep, sp) /* Truncate to the current length. */ if (ftruncate(fd, (char *)nsym + len - (char *)ep)) { - err("%s: %s", fn, strerror(errno)); + warn(fn); return 1; } @@ -293,29 +293,3 @@ usage() exit(1); } -#if __STDC__ -#include -#else -#include -#endif - -void -#if __STDC__ -err(const char *fmt, ...) -#else -err(fmt, va_alist) - char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - (void)fprintf(stderr, "strip: "); - (void)vfprintf(stderr, fmt, ap); - va_end(ap); - (void)fprintf(stderr, "\n"); -} -- cgit v1.2.3