diff options
author | charnier <charnier@FreeBSD.org> | 1998-01-28 07:36:25 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1998-01-28 07:36:25 +0000 |
commit | 50e896a2ce3aa254a01a635c50a50e1b0f460a25 (patch) | |
tree | 304a7c9272ec586a700a38b030c5e8d7e35174da /usr.bin/file/compress.c | |
parent | e62c8eeed612e7824cd8927a88e670fbc08ea8df (diff) | |
download | FreeBSD-src-50e896a2ce3aa254a01a635c50a50e1b0f460a25.zip FreeBSD-src-50e896a2ce3aa254a01a635c50a50e1b0f460a25.tar.gz |
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.
Diffstat (limited to 'usr.bin/file/compress.c')
-rw-r--r-- | usr.bin/file/compress.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/usr.bin/file/compress.c b/usr.bin/file/compress.c index 95b3f9a..fba9c91 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 <stdio.h> + +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + +#include <err.h> #include <stdlib.h> -#include <unistd.h> -#include <string.h> #include <sys/wait.h> +#include <unistd.h> #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]); |