diff options
| author | jtc <jtc@NetBSD.org> | 1994-12-22 06:17:28 +0000 |
|---|---|---|
| committer | jtc <jtc@NetBSD.org> | 1994-12-22 06:17:28 +0000 |
| commit | 7f8ee3fcb6f9098a04e1d2ca15a8dcacd0797c27 (patch) | |
| tree | 5152d2be3ae2a12134f0e982d4ab9f30dfd36a61 /usr.bin/logger | |
| parent | 33cf3304f6537f7fccc48c79a0b64018d3318c2e (diff) | |
Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.
Diffstat (limited to 'usr.bin/logger')
| -rw-r--r-- | usr.bin/logger/Makefile | 4 | ||||
| -rw-r--r-- | usr.bin/logger/logger.1 | 11 | ||||
| -rw-r--r-- | usr.bin/logger/logger.c | 67 |
3 files changed, 47 insertions, 35 deletions
diff --git a/usr.bin/logger/Makefile b/usr.bin/logger/Makefile index 523b277be89..eb7388b1b5b 100644 --- a/usr.bin/logger/Makefile +++ b/usr.bin/logger/Makefile @@ -1,5 +1,5 @@ -# from: @(#)Makefile 5.3 (Berkeley) 5/11/90 -# $Id: Makefile,v 1.2 1993/07/31 15:20:35 mycroft Exp $ +# $NetBSD: Makefile,v 1.3 1994/12/22 06:26:57 jtc Exp $ +# @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= logger diff --git a/usr.bin/logger/logger.1 b/usr.bin/logger/logger.1 index f91b41f4811..21e5f478dba 100644 --- a/usr.bin/logger/logger.1 +++ b/usr.bin/logger/logger.1 @@ -1,5 +1,7 @@ -.\" Copyright (c) 1983, 1990 The Regents of the University of California. -.\" All rights reserved. +.\" $NetBSD: logger.1,v 1.4 1994/12/22 06:26:59 jtc Exp $ +.\" +.\" Copyright (c) 1983, 1990, 1993 +.\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -29,10 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)logger.1 6.8 (Berkeley) 7/27/91 -.\" $Id: logger.1,v 1.3 1993/08/28 04:57:17 jtc Exp $ +.\" @(#)logger.1 8.1 (Berkeley) 6/6/93 .\" -.Dd July 27, 1991 +.Dd June 6, 1993 .Dt LOGGER 1 .Os BSD 4.3 .Sh NAME diff --git a/usr.bin/logger/logger.c b/usr.bin/logger/logger.c index 0d848eba2e6..967d49506fe 100644 --- a/usr.bin/logger/logger.c +++ b/usr.bin/logger/logger.c @@ -1,6 +1,8 @@ +/* $NetBSD: logger.c,v 1.4 1994/12/22 06:27:00 jtc Exp $ */ + /* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,39 +34,49 @@ */ #ifndef lint -char copyright[] = -"@(#) Copyright (c) 1983 Regents of the University of California.\n\ - All rights reserved.\n"; +static char copyright[] = +"@(#) Copyright (c) 1983, 1993\n\ + The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint -/*static char sccsid[] = "from: @(#)logger.c 6.15 (Berkeley) 3/1/91";*/ -static char rcsid[] = "$Id: logger.c,v 1.3 1993/08/01 18:13:37 mycroft Exp $"; +#if 0 +static char sccsid[] = "@(#)logger.c 8.1 (Berkeley) 6/6/93"; +#endif +static char rcsid[] = "$NetBSD: logger.c,v 1.4 1994/12/22 06:27:00 jtc Exp $"; #endif /* not lint */ +#include <errno.h> +#include <unistd.h> +#include <stdlib.h> #include <stdio.h> +#include <ctype.h> +#include <string.h> + #define SYSLOG_NAMES #include <syslog.h> -#include <ctype.h> -/* -** LOGGER -- read and log utility -** -** This routine reads from an input and arranges to write the -** result on the system log, along with a useful tag. -*/ +int decode __P((char *, CODE *)); +int pencode __P((char *)); +void usage __P((void)); +/* + * logger -- read and log utility + * + * Reads from an input and arranges to write the result on the system + * log. + */ +int main(argc, argv) int argc; - char **argv; + char *argv[]; { - extern char *optarg; - extern int errno, optind; - int pri = LOG_NOTICE; - int ch, logflags = 0; - char *tag, buf[1024], *getlogin(), *strerror(); + int ch, logflags, pri; + char *tag, buf[1024]; tag = NULL; + pri = LOG_NOTICE; + logflags = 0; while ((ch = getopt(argc, argv, "f:ip:st:")) != EOF) switch((char)ch) { case 'f': /* file to log */ @@ -119,19 +131,16 @@ main(argc, argv) } if (p != buf) syslog(pri, "%s", buf); - exit(0); - } - - /* main loop */ - while (fgets(buf, sizeof(buf), stdin) != NULL) - syslog(pri, "%s", buf); - + } else + while (fgets(buf, sizeof(buf), stdin) != NULL) + syslog(pri, "%s", buf); exit(0); } /* * Decode a symbolic name to a numeric value */ +int pencode(s) register char *s; { @@ -162,6 +171,7 @@ pencode(s) return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK)); } +int decode(name, codetab) char *name; CODE *codetab; @@ -178,9 +188,10 @@ decode(name, codetab) return (-1); } +void usage() { (void)fprintf(stderr, - "logger: [-i] [-f file] [-p pri] [-t tag] [ message ... ]\n"); + "logger: [-is] [-f file] [-p pri] [-t tag] [ message ... ]\n"); exit(1); } |
