17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5f48205beScasper * Common Development and Distribution License (the "License").
6f48205beScasper * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate *
87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate * and limitations under the License.
127c478bd9Sstevel@tonic-gate *
137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate *
197c478bd9Sstevel@tonic-gate * CDDL HEADER END
207c478bd9Sstevel@tonic-gate */
217c478bd9Sstevel@tonic-gate /*
22*ba91f08bSGary Mills * Copyright (c) 2013 Gary Mills
23f48205beScasper * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
247c478bd9Sstevel@tonic-gate * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate */
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
287c478bd9Sstevel@tonic-gate /* All Rights Reserved */
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988
327c478bd9Sstevel@tonic-gate * The Regents of the University of California
337c478bd9Sstevel@tonic-gate * All Rights Reserved
347c478bd9Sstevel@tonic-gate *
357c478bd9Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from
367c478bd9Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its
377c478bd9Sstevel@tonic-gate * contributors.
387c478bd9Sstevel@tonic-gate */
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gate #include <sys/types.h>
427c478bd9Sstevel@tonic-gate #include <unistd.h>
437c478bd9Sstevel@tonic-gate #include <stdio.h>
447c478bd9Sstevel@tonic-gate #include <syslog.h>
457c478bd9Sstevel@tonic-gate #include <ctype.h>
467c478bd9Sstevel@tonic-gate #include <stdlib.h>
477c478bd9Sstevel@tonic-gate #include <string.h>
487c478bd9Sstevel@tonic-gate #include <locale.h>
497c478bd9Sstevel@tonic-gate #include <limits.h>
507c478bd9Sstevel@tonic-gate #include <pwd.h>
517c478bd9Sstevel@tonic-gate #include <errno.h>
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gate #define LOG_MARK (LOG_NFACILITIES << 3) /* mark "facility" */
547c478bd9Sstevel@tonic-gate #define LOGGER_BUFLEN 1024
557c478bd9Sstevel@tonic-gate
567c478bd9Sstevel@tonic-gate struct code {
577c478bd9Sstevel@tonic-gate char *c_name;
587c478bd9Sstevel@tonic-gate int c_val;
597c478bd9Sstevel@tonic-gate };
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gate static struct code PriNames[] = {
627c478bd9Sstevel@tonic-gate "panic", LOG_EMERG,
637c478bd9Sstevel@tonic-gate "emerg", LOG_EMERG,
647c478bd9Sstevel@tonic-gate "alert", LOG_ALERT,
657c478bd9Sstevel@tonic-gate "crit", LOG_CRIT,
667c478bd9Sstevel@tonic-gate "err", LOG_ERR,
677c478bd9Sstevel@tonic-gate "error", LOG_ERR,
687c478bd9Sstevel@tonic-gate "warn", LOG_WARNING,
697c478bd9Sstevel@tonic-gate "warning", LOG_WARNING,
707c478bd9Sstevel@tonic-gate "notice", LOG_NOTICE,
717c478bd9Sstevel@tonic-gate "info", LOG_INFO,
727c478bd9Sstevel@tonic-gate "debug", LOG_DEBUG,
737c478bd9Sstevel@tonic-gate NULL, -1
747c478bd9Sstevel@tonic-gate };
757c478bd9Sstevel@tonic-gate
767c478bd9Sstevel@tonic-gate static struct code FacNames[] = {
777c478bd9Sstevel@tonic-gate "kern", LOG_KERN,
787c478bd9Sstevel@tonic-gate "user", LOG_USER,
797c478bd9Sstevel@tonic-gate "mail", LOG_MAIL,
807c478bd9Sstevel@tonic-gate "daemon", LOG_DAEMON,
817c478bd9Sstevel@tonic-gate "auth", LOG_AUTH,
827c478bd9Sstevel@tonic-gate "security", LOG_AUTH,
837c478bd9Sstevel@tonic-gate "mark", LOG_MARK,
847c478bd9Sstevel@tonic-gate "syslog", LOG_SYSLOG,
857c478bd9Sstevel@tonic-gate "lpr", LOG_LPR,
867c478bd9Sstevel@tonic-gate "news", LOG_NEWS,
877c478bd9Sstevel@tonic-gate "uucp", LOG_UUCP,
88*ba91f08bSGary Mills "altcron", LOG_ALTCRON,
89*ba91f08bSGary Mills "authpriv", LOG_AUTHPRIV,
90*ba91f08bSGary Mills "ftp", LOG_FTP,
91*ba91f08bSGary Mills "ntp", LOG_NTP,
927c478bd9Sstevel@tonic-gate "audit", LOG_AUDIT,
93*ba91f08bSGary Mills "console", LOG_CONSOLE,
94*ba91f08bSGary Mills "cron", LOG_CRON,
957c478bd9Sstevel@tonic-gate "local0", LOG_LOCAL0,
967c478bd9Sstevel@tonic-gate "local1", LOG_LOCAL1,
977c478bd9Sstevel@tonic-gate "local2", LOG_LOCAL2,
987c478bd9Sstevel@tonic-gate "local3", LOG_LOCAL3,
997c478bd9Sstevel@tonic-gate "local4", LOG_LOCAL4,
1007c478bd9Sstevel@tonic-gate "local5", LOG_LOCAL5,
1017c478bd9Sstevel@tonic-gate "local6", LOG_LOCAL6,
1027c478bd9Sstevel@tonic-gate "local7", LOG_LOCAL7,
1037c478bd9Sstevel@tonic-gate NULL, -1
1047c478bd9Sstevel@tonic-gate };
1057c478bd9Sstevel@tonic-gate
1067c478bd9Sstevel@tonic-gate static int pencode(register char *);
1077c478bd9Sstevel@tonic-gate static int decode(char *, struct code *);
1087c478bd9Sstevel@tonic-gate static void bailout(char *, char *);
1097c478bd9Sstevel@tonic-gate static void usage(void);
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gate /*
1127c478bd9Sstevel@tonic-gate * LOGGER -- read and log utility
1137c478bd9Sstevel@tonic-gate *
1147c478bd9Sstevel@tonic-gate * This routine reads from an input and arranges to write the
1157c478bd9Sstevel@tonic-gate * result on the system log, along with a useful tag.
1167c478bd9Sstevel@tonic-gate */
1177c478bd9Sstevel@tonic-gate
11878eb75caSchin int
main(int argc,char ** argv)11978eb75caSchin main(int argc, char **argv)
1207c478bd9Sstevel@tonic-gate {
1217c478bd9Sstevel@tonic-gate char tmp[23];
1227c478bd9Sstevel@tonic-gate char *tag = NULL;
1237c478bd9Sstevel@tonic-gate char *infile = NULL;
1247c478bd9Sstevel@tonic-gate char *buf = NULL;
1257c478bd9Sstevel@tonic-gate size_t buflen;
1267c478bd9Sstevel@tonic-gate int pri = LOG_NOTICE;
1277c478bd9Sstevel@tonic-gate int logflags = 0;
1287c478bd9Sstevel@tonic-gate int opt;
1297c478bd9Sstevel@tonic-gate int pid_len = 0;
1307c478bd9Sstevel@tonic-gate struct passwd *pw;
1317c478bd9Sstevel@tonic-gate uid_t u;
1327c478bd9Sstevel@tonic-gate char fmt_uid[16];
1337c478bd9Sstevel@tonic-gate char *p, *endp;
1347c478bd9Sstevel@tonic-gate size_t len;
1357c478bd9Sstevel@tonic-gate ptrdiff_t offset = 0;
1367c478bd9Sstevel@tonic-gate int status = 0;
1377c478bd9Sstevel@tonic-gate
1387c478bd9Sstevel@tonic-gate (void) setlocale(LC_ALL, "");
1397c478bd9Sstevel@tonic-gate #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
1407c478bd9Sstevel@tonic-gate #define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */
1417c478bd9Sstevel@tonic-gate #endif
1427c478bd9Sstevel@tonic-gate (void) textdomain(TEXT_DOMAIN);
1437c478bd9Sstevel@tonic-gate /* initialize */
1447c478bd9Sstevel@tonic-gate
1457c478bd9Sstevel@tonic-gate while ((opt = getopt(argc, argv, "it:p:f:")) != EOF)
1467c478bd9Sstevel@tonic-gate switch (opt) {
1477c478bd9Sstevel@tonic-gate
1487c478bd9Sstevel@tonic-gate case 't': /* tag */
1497c478bd9Sstevel@tonic-gate tag = optarg;
1507c478bd9Sstevel@tonic-gate break;
1517c478bd9Sstevel@tonic-gate
1527c478bd9Sstevel@tonic-gate case 'p': /* priority */
1537c478bd9Sstevel@tonic-gate pri = pencode(optarg);
1547c478bd9Sstevel@tonic-gate break;
1557c478bd9Sstevel@tonic-gate
1567c478bd9Sstevel@tonic-gate case 'i': /* log process id also */
1577c478bd9Sstevel@tonic-gate logflags |= LOG_PID;
1587c478bd9Sstevel@tonic-gate pid_len = sprintf(tmp, "%ld", (long)getpid());
1597c478bd9Sstevel@tonic-gate pid_len = (pid_len <= 0) ? 0 : pid_len +2;
1607c478bd9Sstevel@tonic-gate break;
1617c478bd9Sstevel@tonic-gate
1627c478bd9Sstevel@tonic-gate case 'f': /* file to log */
1637c478bd9Sstevel@tonic-gate if (strcmp(optarg, "-") == 0)
1647c478bd9Sstevel@tonic-gate break;
1657c478bd9Sstevel@tonic-gate infile = optarg;
16678eb75caSchin if (freopen(infile, "r", stdin) == NULL) {
1677c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext("logger: "));
1687c478bd9Sstevel@tonic-gate perror(infile);
1697c478bd9Sstevel@tonic-gate exit(1);
1707c478bd9Sstevel@tonic-gate }
1717c478bd9Sstevel@tonic-gate break;
1727c478bd9Sstevel@tonic-gate
1737c478bd9Sstevel@tonic-gate default:
1747c478bd9Sstevel@tonic-gate usage();
1757c478bd9Sstevel@tonic-gate }
1767c478bd9Sstevel@tonic-gate
1777c478bd9Sstevel@tonic-gate argc -= optind;
1787c478bd9Sstevel@tonic-gate argv = &argv[optind];
1797c478bd9Sstevel@tonic-gate
1807c478bd9Sstevel@tonic-gate if ((tag == NULL) && ((tag = getlogin()) == NULL)) {
1817c478bd9Sstevel@tonic-gate u = getuid();
1827c478bd9Sstevel@tonic-gate if ((pw = getpwuid(u)) == NULL) {
183f48205beScasper (void) sprintf(fmt_uid, "%u", u);
1847c478bd9Sstevel@tonic-gate tag = fmt_uid;
1857c478bd9Sstevel@tonic-gate } else
1867c478bd9Sstevel@tonic-gate tag = pw->pw_name;
1877c478bd9Sstevel@tonic-gate }
1887c478bd9Sstevel@tonic-gate
1897c478bd9Sstevel@tonic-gate /* setup for logging */
1907c478bd9Sstevel@tonic-gate openlog(tag, logflags, 0);
1917c478bd9Sstevel@tonic-gate (void) fclose(stdout);
1927c478bd9Sstevel@tonic-gate
1937c478bd9Sstevel@tonic-gate /* log input line if appropriate */
1947c478bd9Sstevel@tonic-gate if (argc > 0) {
1957c478bd9Sstevel@tonic-gate /*
1967c478bd9Sstevel@tonic-gate * Log arguments from command line
1977c478bd9Sstevel@tonic-gate */
1987c478bd9Sstevel@tonic-gate int i;
1997c478bd9Sstevel@tonic-gate
2007c478bd9Sstevel@tonic-gate len = 0;
2017c478bd9Sstevel@tonic-gate for (i = 0; i < argc; i++) {
2027c478bd9Sstevel@tonic-gate len += strlen(argv[i]) + 1; /* add 1 for <space> */
2037c478bd9Sstevel@tonic-gate }
2047c478bd9Sstevel@tonic-gate if ((buf = malloc(len + 1)) == NULL) {
2057c478bd9Sstevel@tonic-gate perror("logger");
2067c478bd9Sstevel@tonic-gate exit(1);
2077c478bd9Sstevel@tonic-gate }
2087c478bd9Sstevel@tonic-gate buf[0] = '\0';
2097c478bd9Sstevel@tonic-gate for (i = 0; i < argc; i++) {
2107c478bd9Sstevel@tonic-gate if (i != 0) {
2117c478bd9Sstevel@tonic-gate (void) strcat(buf, " ");
2127c478bd9Sstevel@tonic-gate }
2137c478bd9Sstevel@tonic-gate (void) strcat(buf, argv[i]);
2147c478bd9Sstevel@tonic-gate }
2157c478bd9Sstevel@tonic-gate #ifdef DEBUG
2167c478bd9Sstevel@tonic-gate (void) fprintf(stderr, "len=%d, buf >%s<\n", len, buf);
2177c478bd9Sstevel@tonic-gate #endif
2187c478bd9Sstevel@tonic-gate syslog(pri, "%s", buf);
2197c478bd9Sstevel@tonic-gate } else {
2207c478bd9Sstevel@tonic-gate /*
2217c478bd9Sstevel@tonic-gate * Log arguments from stdin (or input file).
2227c478bd9Sstevel@tonic-gate * When reading from stdin, logger grows its buffer if
2237c478bd9Sstevel@tonic-gate * needed, to handle long lines.
2247c478bd9Sstevel@tonic-gate */
2257c478bd9Sstevel@tonic-gate if ((buf = malloc(LOGGER_BUFLEN)) == NULL) {
2267c478bd9Sstevel@tonic-gate perror("logger");
2277c478bd9Sstevel@tonic-gate exit(1);
2287c478bd9Sstevel@tonic-gate }
2297c478bd9Sstevel@tonic-gate buflen = LOGGER_BUFLEN;
2307c478bd9Sstevel@tonic-gate p = buf;
2317c478bd9Sstevel@tonic-gate endp = buf + buflen;
2327c478bd9Sstevel@tonic-gate offset = 0;
2337c478bd9Sstevel@tonic-gate while (fgets(p, endp - p, stdin) != NULL) {
2347c478bd9Sstevel@tonic-gate len = strlen(p);
2357c478bd9Sstevel@tonic-gate if (p[len - 1] == '\n') {
2367c478bd9Sstevel@tonic-gate #ifdef DEBUG
2377c478bd9Sstevel@tonic-gate (void) fprintf(stderr,
2387c478bd9Sstevel@tonic-gate "p-buf =%d, len=%d, buflen=%d, buf >%s<\n",
2397c478bd9Sstevel@tonic-gate p-buf, len, buflen, buf);
2407c478bd9Sstevel@tonic-gate #endif
2417c478bd9Sstevel@tonic-gate syslog(pri, "%s", buf);
2427c478bd9Sstevel@tonic-gate p = buf;
2437c478bd9Sstevel@tonic-gate offset = 0;
2447c478bd9Sstevel@tonic-gate } else if (len < endp - p - 1) {
2457c478bd9Sstevel@tonic-gate /* short read or line with no <newline> */
2467c478bd9Sstevel@tonic-gate p += len;
2477c478bd9Sstevel@tonic-gate offset += len;
2487c478bd9Sstevel@tonic-gate #ifdef DEBUG
2497c478bd9Sstevel@tonic-gate (void) fprintf(stderr,
2507c478bd9Sstevel@tonic-gate "p-buf=%d, len=%d, buflen=%d, buf >%s<\n",
2517c478bd9Sstevel@tonic-gate p-buf, len, buflen, buf);
2527c478bd9Sstevel@tonic-gate #endif
2537c478bd9Sstevel@tonic-gate continue;
2547c478bd9Sstevel@tonic-gate } else {
2557c478bd9Sstevel@tonic-gate /* line longer than buflen, so get larger buf */
2567c478bd9Sstevel@tonic-gate buflen += LOGGER_BUFLEN;
2577c478bd9Sstevel@tonic-gate offset += len;
2587c478bd9Sstevel@tonic-gate #ifdef DEBUG
2597c478bd9Sstevel@tonic-gate (void) fprintf(stderr,
2607c478bd9Sstevel@tonic-gate "Realloc endp-p=%d, len=%d, offset=%d, "
2617c478bd9Sstevel@tonic-gate "buflen %d\n",
2627c478bd9Sstevel@tonic-gate endp - p, len, offset, buflen);
2637c478bd9Sstevel@tonic-gate #endif
2647c478bd9Sstevel@tonic-gate if ((buf = realloc(buf, buflen)) == NULL) {
2657c478bd9Sstevel@tonic-gate perror("logger");
2667c478bd9Sstevel@tonic-gate exit(1);
2677c478bd9Sstevel@tonic-gate }
2687c478bd9Sstevel@tonic-gate p = buf + offset;
2697c478bd9Sstevel@tonic-gate endp = buf + buflen;
2707c478bd9Sstevel@tonic-gate }
2717c478bd9Sstevel@tonic-gate } /* while */
2727c478bd9Sstevel@tonic-gate
2737c478bd9Sstevel@tonic-gate if (feof(stdin)) {
2747c478bd9Sstevel@tonic-gate if (p > buf) {
2757c478bd9Sstevel@tonic-gate /* the last line did not end with newline */
2767c478bd9Sstevel@tonic-gate #ifdef DEBUG
2777c478bd9Sstevel@tonic-gate (void) fprintf(stderr,
2787c478bd9Sstevel@tonic-gate "(2) p-buf=%d, len=%d, buflen=%d, "
2797c478bd9Sstevel@tonic-gate "buf >%s<\n",
2807c478bd9Sstevel@tonic-gate p-buf, len, buflen, buf);
2817c478bd9Sstevel@tonic-gate #endif
2827c478bd9Sstevel@tonic-gate syslog(pri, "%s", buf);
2837c478bd9Sstevel@tonic-gate }
2847c478bd9Sstevel@tonic-gate } else {
2857c478bd9Sstevel@tonic-gate /*
2867c478bd9Sstevel@tonic-gate * fgets() encountered an error. Log unlogged data
2877c478bd9Sstevel@tonic-gate * from earlier fgets() (if any). Write null byte
2887c478bd9Sstevel@tonic-gate * after last full read, in case the fgets() that
2897c478bd9Sstevel@tonic-gate * encountered error removed it and failed to null
2907c478bd9Sstevel@tonic-gate * terminate.
2917c478bd9Sstevel@tonic-gate */
2927c478bd9Sstevel@tonic-gate perror("logger");
2937c478bd9Sstevel@tonic-gate if (p > buf) {
2947c478bd9Sstevel@tonic-gate *p = '\0';
2957c478bd9Sstevel@tonic-gate syslog(pri, "%s", buf);
2967c478bd9Sstevel@tonic-gate }
2977c478bd9Sstevel@tonic-gate status = 1;
2987c478bd9Sstevel@tonic-gate }
2997c478bd9Sstevel@tonic-gate } /* else !(argc > 0) */
3007c478bd9Sstevel@tonic-gate free(buf);
3017c478bd9Sstevel@tonic-gate return (status);
3027c478bd9Sstevel@tonic-gate }
3037c478bd9Sstevel@tonic-gate
3047c478bd9Sstevel@tonic-gate /*
3057c478bd9Sstevel@tonic-gate * Decode a symbolic name to a numeric value
3067c478bd9Sstevel@tonic-gate */
3077c478bd9Sstevel@tonic-gate
3087c478bd9Sstevel@tonic-gate
3097c478bd9Sstevel@tonic-gate static int
pencode(s)3107c478bd9Sstevel@tonic-gate pencode(s)
3117c478bd9Sstevel@tonic-gate register char *s;
3127c478bd9Sstevel@tonic-gate {
3137c478bd9Sstevel@tonic-gate register char *p;
3147c478bd9Sstevel@tonic-gate int lev;
3157c478bd9Sstevel@tonic-gate int fac = 0;
3167c478bd9Sstevel@tonic-gate
3177c478bd9Sstevel@tonic-gate for (p = s; *s && *s != '.'; s++);
3187c478bd9Sstevel@tonic-gate if (*s) {
3197c478bd9Sstevel@tonic-gate *s = '\0';
3207c478bd9Sstevel@tonic-gate fac = decode(p, FacNames);
3217c478bd9Sstevel@tonic-gate if (fac < 0)
3227c478bd9Sstevel@tonic-gate bailout("unknown facility name: ", p);
3237c478bd9Sstevel@tonic-gate *s++ = '.';
3247c478bd9Sstevel@tonic-gate } else
3257c478bd9Sstevel@tonic-gate s = p;
3267c478bd9Sstevel@tonic-gate lev = decode(s, PriNames);
3277c478bd9Sstevel@tonic-gate if (lev < 0)
3287c478bd9Sstevel@tonic-gate bailout("unknown priority name: ", s);
3297c478bd9Sstevel@tonic-gate
3307c478bd9Sstevel@tonic-gate return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK));
3317c478bd9Sstevel@tonic-gate }
3327c478bd9Sstevel@tonic-gate
3337c478bd9Sstevel@tonic-gate
3347c478bd9Sstevel@tonic-gate static int
decode(name,codetab)3357c478bd9Sstevel@tonic-gate decode(name, codetab)
3367c478bd9Sstevel@tonic-gate char *name;
3377c478bd9Sstevel@tonic-gate struct code *codetab;
3387c478bd9Sstevel@tonic-gate {
3397c478bd9Sstevel@tonic-gate register struct code *c;
3407c478bd9Sstevel@tonic-gate
3417c478bd9Sstevel@tonic-gate if (isdigit(*name))
3427c478bd9Sstevel@tonic-gate return (atoi(name));
3437c478bd9Sstevel@tonic-gate
3447c478bd9Sstevel@tonic-gate for (c = codetab; c->c_name; c++)
3457c478bd9Sstevel@tonic-gate if (strcasecmp(name, c->c_name) == 0)
3467c478bd9Sstevel@tonic-gate return (c->c_val);
3477c478bd9Sstevel@tonic-gate
3487c478bd9Sstevel@tonic-gate return (-1);
3497c478bd9Sstevel@tonic-gate }
3507c478bd9Sstevel@tonic-gate
3517c478bd9Sstevel@tonic-gate
3527c478bd9Sstevel@tonic-gate static void
bailout(a,b)3537c478bd9Sstevel@tonic-gate bailout(a, b)
3547c478bd9Sstevel@tonic-gate char *a, *b;
3557c478bd9Sstevel@tonic-gate {
3567c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext("logger: %s%s\n"), a, b);
3577c478bd9Sstevel@tonic-gate exit(1);
3587c478bd9Sstevel@tonic-gate }
3597c478bd9Sstevel@tonic-gate
3607c478bd9Sstevel@tonic-gate
3617c478bd9Sstevel@tonic-gate static void
usage(void)3627c478bd9Sstevel@tonic-gate usage(void)
3637c478bd9Sstevel@tonic-gate {
3647c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext(
3657c478bd9Sstevel@tonic-gate "Usage:\tlogger string\n"
3667c478bd9Sstevel@tonic-gate "\tlogger [-i] [-f filename] [-p priority] [-t tag] "
3677c478bd9Sstevel@tonic-gate "[message] ...\n"));
3687c478bd9Sstevel@tonic-gate exit(1);
3697c478bd9Sstevel@tonic-gate }
370