xref: /onnv-gate/usr/src/cmd/sendmail/aux/mailstats.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
3*0Sstevel@tonic-gate  *	All rights reserved.
4*0Sstevel@tonic-gate  * Copyright (c) 1983 Eric P. Allman.  All rights reserved.
5*0Sstevel@tonic-gate  * Copyright (c) 1988, 1993
6*0Sstevel@tonic-gate  *	The Regents of the University of California.  All rights reserved.
7*0Sstevel@tonic-gate  *
8*0Sstevel@tonic-gate  * By using this file, you agree to the terms and conditions set
9*0Sstevel@tonic-gate  * forth in the LICENSE file which can be found at the top level of
10*0Sstevel@tonic-gate  * the sendmail distribution.
11*0Sstevel@tonic-gate  *
12*0Sstevel@tonic-gate  *
13*0Sstevel@tonic-gate  */
14*0Sstevel@tonic-gate 
15*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
16*0Sstevel@tonic-gate 
17*0Sstevel@tonic-gate #include <sm/gen.h>
18*0Sstevel@tonic-gate 
19*0Sstevel@tonic-gate SM_IDSTR(copyright,
20*0Sstevel@tonic-gate "@(#) Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.\n\
21*0Sstevel@tonic-gate 	All rights reserved.\n\
22*0Sstevel@tonic-gate      Copyright (c) 1988, 1993\n\
23*0Sstevel@tonic-gate 	The Regents of the University of California.  All rights reserved.\n")
24*0Sstevel@tonic-gate 
25*0Sstevel@tonic-gate SM_IDSTR(id, "@(#)$Id: mailstats.c,v 8.100 2002/06/27 23:24:06 gshapiro Exp $")
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #include <unistd.h>
28*0Sstevel@tonic-gate #include <stddef.h>
29*0Sstevel@tonic-gate #include <stdlib.h>
30*0Sstevel@tonic-gate #include <ctype.h>
31*0Sstevel@tonic-gate #include <string.h>
32*0Sstevel@tonic-gate #include <time.h>
33*0Sstevel@tonic-gate #ifdef EX_OK
34*0Sstevel@tonic-gate # undef EX_OK		/* unistd.h may have another use for this */
35*0Sstevel@tonic-gate #endif /* EX_OK */
36*0Sstevel@tonic-gate #include <sysexits.h>
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate #include <sm/errstring.h>
39*0Sstevel@tonic-gate #include <sm/limits.h>
40*0Sstevel@tonic-gate #include <sendmail/sendmail.h>
41*0Sstevel@tonic-gate #include <sendmail/mailstats.h>
42*0Sstevel@tonic-gate #include <sendmail/pathnames.h>
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate 
45*0Sstevel@tonic-gate #define MNAMELEN	20	/* max length of mailer name */
46*0Sstevel@tonic-gate 
47*0Sstevel@tonic-gate int
48*0Sstevel@tonic-gate main(argc, argv)
49*0Sstevel@tonic-gate 	int argc;
50*0Sstevel@tonic-gate 	char **argv;
51*0Sstevel@tonic-gate {
52*0Sstevel@tonic-gate 	register int i;
53*0Sstevel@tonic-gate 	int mno;
54*0Sstevel@tonic-gate 	int save_errno;
55*0Sstevel@tonic-gate 	int ch, fd;
56*0Sstevel@tonic-gate 	char *sfile;
57*0Sstevel@tonic-gate 	char *cfile;
58*0Sstevel@tonic-gate 	SM_FILE_T *cfp;
59*0Sstevel@tonic-gate 	bool mnames;
60*0Sstevel@tonic-gate 	bool progmode;
61*0Sstevel@tonic-gate 	bool trunc;
62*0Sstevel@tonic-gate 	long frmsgs = 0, frbytes = 0, tomsgs = 0, tobytes = 0, rejmsgs = 0;
63*0Sstevel@tonic-gate 	long dismsgs = 0;
64*0Sstevel@tonic-gate 	long quarmsgs = 0;
65*0Sstevel@tonic-gate 	time_t now;
66*0Sstevel@tonic-gate 	char mtable[MAXMAILERS][MNAMELEN + 1];
67*0Sstevel@tonic-gate 	char sfilebuf[MAXPATHLEN];
68*0Sstevel@tonic-gate 	char buf[MAXLINE];
69*0Sstevel@tonic-gate 	struct statistics stats;
70*0Sstevel@tonic-gate 	extern char *ctime();
71*0Sstevel@tonic-gate 	extern char *optarg;
72*0Sstevel@tonic-gate 	extern int optind;
73*0Sstevel@tonic-gate 
74*0Sstevel@tonic-gate 	cfile = getcfname(0, 0, SM_GET_SENDMAIL_CF, NULL);
75*0Sstevel@tonic-gate 	sfile = NULL;
76*0Sstevel@tonic-gate 	mnames = true;
77*0Sstevel@tonic-gate 	progmode = false;
78*0Sstevel@tonic-gate 	trunc = false;
79*0Sstevel@tonic-gate 	while ((ch = getopt(argc, argv, "cC:f:opP")) != -1)
80*0Sstevel@tonic-gate 	{
81*0Sstevel@tonic-gate 		switch (ch)
82*0Sstevel@tonic-gate 		{
83*0Sstevel@tonic-gate 		  case 'c':
84*0Sstevel@tonic-gate 			cfile = getcfname(0, 0, SM_GET_SUBMIT_CF, NULL);
85*0Sstevel@tonic-gate 			break;
86*0Sstevel@tonic-gate 
87*0Sstevel@tonic-gate 		  case 'C':
88*0Sstevel@tonic-gate 			cfile = optarg;
89*0Sstevel@tonic-gate 			break;
90*0Sstevel@tonic-gate 
91*0Sstevel@tonic-gate 		  case 'f':
92*0Sstevel@tonic-gate 			sfile = optarg;
93*0Sstevel@tonic-gate 			break;
94*0Sstevel@tonic-gate 
95*0Sstevel@tonic-gate 		  case 'o':
96*0Sstevel@tonic-gate 			mnames = false;
97*0Sstevel@tonic-gate 			break;
98*0Sstevel@tonic-gate 
99*0Sstevel@tonic-gate 		  case 'p':
100*0Sstevel@tonic-gate 			trunc = true;
101*0Sstevel@tonic-gate 			/* FALLTHROUGH */
102*0Sstevel@tonic-gate 
103*0Sstevel@tonic-gate 		  case 'P':
104*0Sstevel@tonic-gate 			progmode = true;
105*0Sstevel@tonic-gate 			break;
106*0Sstevel@tonic-gate 
107*0Sstevel@tonic-gate 		  case '?':
108*0Sstevel@tonic-gate 		  default:
109*0Sstevel@tonic-gate   usage:
110*0Sstevel@tonic-gate 			(void) sm_io_fputs(smioerr, SM_TIME_DEFAULT,
111*0Sstevel@tonic-gate 			    "usage: mailstats [-C cffile] [-c] [-P] [-f stfile] [-o] [-p]\n");
112*0Sstevel@tonic-gate 			exit(EX_USAGE);
113*0Sstevel@tonic-gate 		}
114*0Sstevel@tonic-gate 	}
115*0Sstevel@tonic-gate 	argc -= optind;
116*0Sstevel@tonic-gate 	argv += optind;
117*0Sstevel@tonic-gate 
118*0Sstevel@tonic-gate 	if (argc != 0)
119*0Sstevel@tonic-gate 		goto usage;
120*0Sstevel@tonic-gate 
121*0Sstevel@tonic-gate 	if ((cfp = sm_io_open(SmFtStdio, SM_TIME_DEFAULT, cfile, SM_IO_RDONLY,
122*0Sstevel@tonic-gate 			      NULL)) == NULL)
123*0Sstevel@tonic-gate 	{
124*0Sstevel@tonic-gate 		save_errno = errno;
125*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "mailstats: ");
126*0Sstevel@tonic-gate 		errno = save_errno;
127*0Sstevel@tonic-gate 		sm_perror(cfile);
128*0Sstevel@tonic-gate 		exit(EX_NOINPUT);
129*0Sstevel@tonic-gate 	}
130*0Sstevel@tonic-gate 
131*0Sstevel@tonic-gate 	mno = 0;
132*0Sstevel@tonic-gate 	(void) sm_strlcpy(mtable[mno++], "prog", MNAMELEN + 1);
133*0Sstevel@tonic-gate 	(void) sm_strlcpy(mtable[mno++], "*file*", MNAMELEN + 1);
134*0Sstevel@tonic-gate 	(void) sm_strlcpy(mtable[mno++], "*include*", MNAMELEN + 1);
135*0Sstevel@tonic-gate 
136*0Sstevel@tonic-gate 	while (sm_io_fgets(cfp, SM_TIME_DEFAULT, buf, sizeof(buf)) != NULL)
137*0Sstevel@tonic-gate 	{
138*0Sstevel@tonic-gate 		register char *b;
139*0Sstevel@tonic-gate 		char *s;
140*0Sstevel@tonic-gate 		register char *m;
141*0Sstevel@tonic-gate 
142*0Sstevel@tonic-gate 		b = strchr(buf, '#');
143*0Sstevel@tonic-gate 		if (b == NULL)
144*0Sstevel@tonic-gate 			b = strchr(buf, '\n');
145*0Sstevel@tonic-gate 		if (b == NULL)
146*0Sstevel@tonic-gate 			b = &buf[strlen(buf)];
147*0Sstevel@tonic-gate 		while (isascii(*--b) && isspace(*b))
148*0Sstevel@tonic-gate 			continue;
149*0Sstevel@tonic-gate 		*++b = '\0';
150*0Sstevel@tonic-gate 
151*0Sstevel@tonic-gate 		b = buf;
152*0Sstevel@tonic-gate 		switch (*b++)
153*0Sstevel@tonic-gate 		{
154*0Sstevel@tonic-gate 		  case 'M':		/* mailer definition */
155*0Sstevel@tonic-gate 			break;
156*0Sstevel@tonic-gate 
157*0Sstevel@tonic-gate 		  case 'O':		/* option -- see if .st file */
158*0Sstevel@tonic-gate 			if (sm_strncasecmp(b, " StatusFile", 11) == 0 &&
159*0Sstevel@tonic-gate 			    !(isascii(b[11]) && isalnum(b[11])))
160*0Sstevel@tonic-gate 			{
161*0Sstevel@tonic-gate 				/* new form -- find value */
162*0Sstevel@tonic-gate 				b = strchr(b, '=');
163*0Sstevel@tonic-gate 				if (b == NULL)
164*0Sstevel@tonic-gate 					continue;
165*0Sstevel@tonic-gate 				while (isascii(*++b) && isspace(*b))
166*0Sstevel@tonic-gate 					continue;
167*0Sstevel@tonic-gate 			}
168*0Sstevel@tonic-gate 			else if (*b++ != 'S')
169*0Sstevel@tonic-gate 			{
170*0Sstevel@tonic-gate 				/* something else boring */
171*0Sstevel@tonic-gate 				continue;
172*0Sstevel@tonic-gate 			}
173*0Sstevel@tonic-gate 
174*0Sstevel@tonic-gate 			/* this is the S or StatusFile option -- save it */
175*0Sstevel@tonic-gate 			if (sm_strlcpy(sfilebuf, b, sizeof sfilebuf) >=
176*0Sstevel@tonic-gate 			    sizeof sfilebuf)
177*0Sstevel@tonic-gate 			{
178*0Sstevel@tonic-gate 				(void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
179*0Sstevel@tonic-gate 						     "StatusFile filename too long: %.30s...\n",
180*0Sstevel@tonic-gate 						     b);
181*0Sstevel@tonic-gate 				exit(EX_CONFIG);
182*0Sstevel@tonic-gate 			}
183*0Sstevel@tonic-gate 			if (sfile == NULL)
184*0Sstevel@tonic-gate 				sfile = sfilebuf;
185*0Sstevel@tonic-gate 
186*0Sstevel@tonic-gate 		  default:
187*0Sstevel@tonic-gate 			continue;
188*0Sstevel@tonic-gate 		}
189*0Sstevel@tonic-gate 
190*0Sstevel@tonic-gate 		if (mno >= MAXMAILERS)
191*0Sstevel@tonic-gate 		{
192*0Sstevel@tonic-gate 			(void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
193*0Sstevel@tonic-gate 					     "Too many mailers defined, %d max.\n",
194*0Sstevel@tonic-gate 					     MAXMAILERS);
195*0Sstevel@tonic-gate 			exit(EX_SOFTWARE);
196*0Sstevel@tonic-gate 		}
197*0Sstevel@tonic-gate 		m = mtable[mno];
198*0Sstevel@tonic-gate 		s = m + MNAMELEN;		/* is [MNAMELEN + 1] */
199*0Sstevel@tonic-gate 		while (*b != ',' && !(isascii(*b) && isspace(*b)) &&
200*0Sstevel@tonic-gate 		       *b != '\0' && m < s)
201*0Sstevel@tonic-gate 			*m++ = *b++;
202*0Sstevel@tonic-gate 		*m = '\0';
203*0Sstevel@tonic-gate 		for (i = 0; i < mno; i++)
204*0Sstevel@tonic-gate 		{
205*0Sstevel@tonic-gate 			if (strcmp(mtable[i], mtable[mno]) == 0)
206*0Sstevel@tonic-gate 				break;
207*0Sstevel@tonic-gate 		}
208*0Sstevel@tonic-gate 		if (i == mno)
209*0Sstevel@tonic-gate 			mno++;
210*0Sstevel@tonic-gate 	}
211*0Sstevel@tonic-gate 	(void) sm_io_close(cfp, SM_TIME_DEFAULT);
212*0Sstevel@tonic-gate 	for (; mno < MAXMAILERS; mno++)
213*0Sstevel@tonic-gate 		mtable[mno][0] = '\0';
214*0Sstevel@tonic-gate 
215*0Sstevel@tonic-gate 	if (sfile == NULL)
216*0Sstevel@tonic-gate 	{
217*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
218*0Sstevel@tonic-gate 				     "mailstats: no statistics file located\n");
219*0Sstevel@tonic-gate 		exit(EX_OSFILE);
220*0Sstevel@tonic-gate 	}
221*0Sstevel@tonic-gate 
222*0Sstevel@tonic-gate 	fd = open(sfile, O_RDONLY, 0600);
223*0Sstevel@tonic-gate 	if ((fd < 0) || (i = read(fd, &stats, sizeof stats)) < 0)
224*0Sstevel@tonic-gate 	{
225*0Sstevel@tonic-gate 		save_errno = errno;
226*0Sstevel@tonic-gate 		(void) sm_io_fputs(smioerr, SM_TIME_DEFAULT, "mailstats: ");
227*0Sstevel@tonic-gate 		errno = save_errno;
228*0Sstevel@tonic-gate 		sm_perror(sfile);
229*0Sstevel@tonic-gate 		exit(EX_NOINPUT);
230*0Sstevel@tonic-gate 	}
231*0Sstevel@tonic-gate 	if (i == 0)
232*0Sstevel@tonic-gate 	{
233*0Sstevel@tonic-gate 		(void) sleep(1);
234*0Sstevel@tonic-gate 		if ((i = read(fd, &stats, sizeof stats)) < 0)
235*0Sstevel@tonic-gate 		{
236*0Sstevel@tonic-gate 			save_errno = errno;
237*0Sstevel@tonic-gate 			(void) sm_io_fputs(smioerr, SM_TIME_DEFAULT,
238*0Sstevel@tonic-gate 					   "mailstats: ");
239*0Sstevel@tonic-gate 			errno = save_errno;
240*0Sstevel@tonic-gate 			sm_perror(sfile);
241*0Sstevel@tonic-gate 			exit(EX_NOINPUT);
242*0Sstevel@tonic-gate 		}
243*0Sstevel@tonic-gate 		else if (i == 0)
244*0Sstevel@tonic-gate 		{
245*0Sstevel@tonic-gate 			memset((ARBPTR_T) &stats, '\0', sizeof stats);
246*0Sstevel@tonic-gate 			(void) time(&stats.stat_itime);
247*0Sstevel@tonic-gate 		}
248*0Sstevel@tonic-gate 	}
249*0Sstevel@tonic-gate 	if (i != 0)
250*0Sstevel@tonic-gate 	{
251*0Sstevel@tonic-gate 		if (stats.stat_magic != STAT_MAGIC)
252*0Sstevel@tonic-gate 		{
253*0Sstevel@tonic-gate 			(void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
254*0Sstevel@tonic-gate 					     "mailstats: incorrect magic number in %s\n",
255*0Sstevel@tonic-gate 					     sfile);
256*0Sstevel@tonic-gate 			exit(EX_OSERR);
257*0Sstevel@tonic-gate 		}
258*0Sstevel@tonic-gate 		else if (stats.stat_version != STAT_VERSION)
259*0Sstevel@tonic-gate 		{
260*0Sstevel@tonic-gate 			(void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
261*0Sstevel@tonic-gate 					     "mailstats version (%d) incompatible with %s version (%d)\n",
262*0Sstevel@tonic-gate 					     STAT_VERSION, sfile,
263*0Sstevel@tonic-gate 					     stats.stat_version);
264*0Sstevel@tonic-gate 
265*0Sstevel@tonic-gate 			exit(EX_OSERR);
266*0Sstevel@tonic-gate 		}
267*0Sstevel@tonic-gate 		else if (i != sizeof stats || stats.stat_size != sizeof(stats))
268*0Sstevel@tonic-gate 		{
269*0Sstevel@tonic-gate 			(void) sm_io_fputs(smioerr, SM_TIME_DEFAULT,
270*0Sstevel@tonic-gate 					   "mailstats: file size changed.\n");
271*0Sstevel@tonic-gate 			exit(EX_OSERR);
272*0Sstevel@tonic-gate 		}
273*0Sstevel@tonic-gate 	}
274*0Sstevel@tonic-gate 
275*0Sstevel@tonic-gate 	if (progmode)
276*0Sstevel@tonic-gate 	{
277*0Sstevel@tonic-gate 		(void) time(&now);
278*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "%ld %ld\n",
279*0Sstevel@tonic-gate 				     (long) stats.stat_itime, (long) now);
280*0Sstevel@tonic-gate 	}
281*0Sstevel@tonic-gate 	else
282*0Sstevel@tonic-gate 	{
283*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
284*0Sstevel@tonic-gate 				     "Statistics from %s",
285*0Sstevel@tonic-gate 				     ctime(&stats.stat_itime));
286*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
287*0Sstevel@tonic-gate 				     " M   msgsfr  bytes_from   msgsto    bytes_to  msgsrej msgsdis");
288*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, " msgsqur");
289*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "%s\n",
290*0Sstevel@tonic-gate 				     mnames ? "  Mailer" : "");
291*0Sstevel@tonic-gate 	}
292*0Sstevel@tonic-gate 	for (i = 0; i < MAXMAILERS; i++)
293*0Sstevel@tonic-gate 	{
294*0Sstevel@tonic-gate 		if (stats.stat_nf[i] || stats.stat_nt[i] ||
295*0Sstevel@tonic-gate 		    stats.stat_nq[i] ||
296*0Sstevel@tonic-gate 		    stats.stat_nr[i] || stats.stat_nd[i])
297*0Sstevel@tonic-gate 		{
298*0Sstevel@tonic-gate 			char *format;
299*0Sstevel@tonic-gate 
300*0Sstevel@tonic-gate 			if (progmode)
301*0Sstevel@tonic-gate 				format = "%2d %8ld %10ld %8ld %10ld   %6ld  %6ld";
302*0Sstevel@tonic-gate 			else
303*0Sstevel@tonic-gate 				format = "%2d %8ld %10ldK %8ld %10ldK   %6ld  %6ld";
304*0Sstevel@tonic-gate 			(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
305*0Sstevel@tonic-gate 					     format, i,
306*0Sstevel@tonic-gate 					     stats.stat_nf[i],
307*0Sstevel@tonic-gate 					     stats.stat_bf[i],
308*0Sstevel@tonic-gate 					     stats.stat_nt[i],
309*0Sstevel@tonic-gate 					     stats.stat_bt[i],
310*0Sstevel@tonic-gate 					     stats.stat_nr[i],
311*0Sstevel@tonic-gate 					     stats.stat_nd[i]);
312*0Sstevel@tonic-gate 			(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
313*0Sstevel@tonic-gate 					     "  %6ld", stats.stat_nq[i]);
314*0Sstevel@tonic-gate 			if (mnames)
315*0Sstevel@tonic-gate 				(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
316*0Sstevel@tonic-gate 						     "  %s",
317*0Sstevel@tonic-gate 						      mtable[i]);
318*0Sstevel@tonic-gate 			(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "\n");
319*0Sstevel@tonic-gate 			frmsgs += stats.stat_nf[i];
320*0Sstevel@tonic-gate 			frbytes += stats.stat_bf[i];
321*0Sstevel@tonic-gate 			tomsgs += stats.stat_nt[i];
322*0Sstevel@tonic-gate 			tobytes += stats.stat_bt[i];
323*0Sstevel@tonic-gate 			rejmsgs += stats.stat_nr[i];
324*0Sstevel@tonic-gate 			dismsgs += stats.stat_nd[i];
325*0Sstevel@tonic-gate 			quarmsgs += stats.stat_nq[i];
326*0Sstevel@tonic-gate 		}
327*0Sstevel@tonic-gate 	}
328*0Sstevel@tonic-gate 	if (progmode)
329*0Sstevel@tonic-gate 	{
330*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
331*0Sstevel@tonic-gate 				     " T %8ld %10ld %8ld %10ld   %6ld  %6ld",
332*0Sstevel@tonic-gate 				     frmsgs, frbytes, tomsgs, tobytes, rejmsgs,
333*0Sstevel@tonic-gate 				     dismsgs);
334*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
335*0Sstevel@tonic-gate 				     "  %6ld", quarmsgs);
336*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "\n");
337*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
338*0Sstevel@tonic-gate 				     " C %8ld %8ld %6ld\n",
339*0Sstevel@tonic-gate 				     stats.stat_cf, stats.stat_ct,
340*0Sstevel@tonic-gate 				     stats.stat_cr);
341*0Sstevel@tonic-gate 		(void) close(fd);
342*0Sstevel@tonic-gate 		if (trunc)
343*0Sstevel@tonic-gate 		{
344*0Sstevel@tonic-gate 			fd = open(sfile, O_RDWR | O_TRUNC, 0600);
345*0Sstevel@tonic-gate 			if (fd >= 0)
346*0Sstevel@tonic-gate 				(void) close(fd);
347*0Sstevel@tonic-gate 		}
348*0Sstevel@tonic-gate 	}
349*0Sstevel@tonic-gate 	else
350*0Sstevel@tonic-gate 	{
351*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
352*0Sstevel@tonic-gate 				     "=============================================================");
353*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "========");
354*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "\n");
355*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
356*0Sstevel@tonic-gate 				     " T %8ld %10ldK %8ld %10ldK   %6ld  %6ld",
357*0Sstevel@tonic-gate 				     frmsgs, frbytes, tomsgs, tobytes, rejmsgs,
358*0Sstevel@tonic-gate 				     dismsgs);
359*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
360*0Sstevel@tonic-gate 				     "  %6ld", quarmsgs);
361*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "\n");
362*0Sstevel@tonic-gate 		(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
363*0Sstevel@tonic-gate 				     " C %8ld %10s  %8ld %10s    %6ld\n",
364*0Sstevel@tonic-gate 				     stats.stat_cf, "", stats.stat_ct, "",
365*0Sstevel@tonic-gate 				     stats.stat_cr);
366*0Sstevel@tonic-gate 	}
367*0Sstevel@tonic-gate 	exit(EX_OK);
368*0Sstevel@tonic-gate 	/* NOTREACHED */
369*0Sstevel@tonic-gate 	return EX_OK;
370*0Sstevel@tonic-gate }
371