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/compress.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'usr.bin/file/compress.c') diff --git a/usr.bin/file/compress.c b/usr.bin/file/compress.c index 95b3f9a3e47d..fba9c9119319 100644 --- a/usr.bin/file/compress.c +++ b/usr.bin/file/compress.c @@ -4,13 +4,17 @@ * information if recognized * uncompress(method, old, n, newch) - uncompress old into new, * using method, return sizeof new - * $Id$ */ -#include + +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + +#include #include -#include -#include #include +#include #include "file.h" @@ -73,7 +77,7 @@ int n; int fdin[2], fdout[2]; if (pipe(fdin) == -1 || pipe(fdout) == -1) { - error("cannot create pipe (%s).\n", strerror(errno)); + err(1, "cannot create pipe"); /*NOTREACHED*/ } switch (fork()) { @@ -91,28 +95,27 @@ int n; (void) close(2); execvp(compr[method].argv[0], compr[method].argv); - error("could not execute `%s' (%s).\n", - compr[method].argv[0], strerror(errno)); + err(1, "could not execute `%s'", compr[method].argv[0]); /*NOTREACHED*/ case -1: - error("could not fork (%s).\n", strerror(errno)); + err(1, "could not fork"); /*NOTREACHED*/ default: /* parent */ (void) close(fdin[0]); (void) close(fdout[1]); if (write(fdin[1], old, n) != n) { - error("write failed (%s).\n", strerror(errno)); + err(1, "write failed"); /*NOTREACHED*/ } (void) close(fdin[1]); if ((*newch = (unsigned char *) malloc(n)) == NULL) { - error("out of memory.\n"); + errx(1, "out of memory"); /*NOTREACHED*/ } if ((n = read(fdout[0], *newch, n)) <= 0) { free(*newch); - error("read failed (%s).\n", strerror(errno)); + err(1, "read failed"); /*NOTREACHED*/ } (void) close(fdout[0]); -- cgit v1.2.3