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