diff options
author | charnier <charnier@FreeBSD.org> | 1997-07-31 06:54:45 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1997-07-31 06:54:45 +0000 |
commit | 7364d57a33f05735b331f030725be112b17635e5 (patch) | |
tree | d686598fc059b1d80562eb8b86e214f809409191 /usr.bin/nohup | |
parent | 7714fda3a9641058c32a360d1fc998bd43a9bcb3 (diff) | |
download | FreeBSD-src-7364d57a33f05735b331f030725be112b17635e5.zip FreeBSD-src-7364d57a33f05735b331f030725be112b17635e5.tar.gz |
Use err(3).
Diffstat (limited to 'usr.bin/nohup')
-rw-r--r-- | usr.bin/nohup/nohup.1 | 10 | ||||
-rw-r--r-- | usr.bin/nohup/nohup.c | 24 |
2 files changed, 17 insertions, 17 deletions
diff --git a/usr.bin/nohup/nohup.1 b/usr.bin/nohup/nohup.1 index d04e486..35b99f6 100644 --- a/usr.bin/nohup/nohup.1 +++ b/usr.bin/nohup/nohup.1 @@ -41,12 +41,12 @@ .Nm nohup .Nd invoke a command immune to hangups .Sh SYNOPSIS -.Nm nohup +.Nm .Ar command .Op Ar arg ... .Sh DESCRIPTION The -.Nm nohup +.Nm utility invokes .Ar command with @@ -75,7 +75,7 @@ The following variable is utilized by If the output file .Pa nohup.out cannot be created in the current directory, the -.Nm nohup +.Nm utility uses the directory named by .Ev HOME to create the file. @@ -84,7 +84,7 @@ to create the file. .Xr signal 3 .Sh STANDARDS The -.Nm nohup -command is expected to be +.Nm +utility is expected to be .St -p1003.2 compatible. diff --git a/usr.bin/nohup/nohup.c b/usr.bin/nohup/nohup.c index d469a13..7b32e2f 100644 --- a/usr.bin/nohup/nohup.c +++ b/usr.bin/nohup/nohup.c @@ -32,18 +32,23 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1989, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint +#if 0 static char sccsid[] = "@(#)nohup.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include <sys/param.h> #include <sys/stat.h> +#include <err.h> #include <errno.h> #include <fcntl.h> #include <signal.h> @@ -53,7 +58,7 @@ static char sccsid[] = "@(#)nohup.c 8.1 (Berkeley) 6/6/93"; #include <unistd.h> void dofile __P((void)); -void usage __P((void)); +static void usage __P((void)); int main(argc, argv) @@ -75,9 +80,7 @@ main(argc, argv) (void)signal(SIGQUIT, SIG_IGN); execvp(argv[1], &argv[1]); - (void)fprintf(stderr, - "nohup: %s: %s\n", argv[1], strerror(errno)); - exit(1); + err(1, "%s", argv[1]); } void @@ -90,7 +93,7 @@ dofile() p = FILENAME; if ((fd = open(p, O_RDWR|O_CREAT, S_IRUSR | S_IWUSR)) >= 0) goto dupit; - if (p = getenv("HOME")) { + if ((p = getenv("HOME"))) { (void)strcpy(path, p); (void)strcat(path, "/"); (void)strcat(path, FILENAME); @@ -98,14 +101,11 @@ dofile() O_RDWR|O_CREAT, S_IRUSR | S_IWUSR)) >= 0) goto dupit; } - (void)fprintf(stderr, "nohup: can't open a nohup.out file.\n"); - exit(1); + errx(1, "can't open a nohup.out file"); dupit: (void)lseek(fd, (off_t)0, SEEK_END); - if (dup2(fd, STDOUT_FILENO) == -1) { - (void)fprintf(stderr, "nohup: %s\n", strerror(errno)); - exit(1); - } + if (dup2(fd, STDOUT_FILENO) == -1) + err(1, NULL); (void)fprintf(stderr, "sending output to %s\n", p); } |