1: /*
   2: **  Sendmail
   3: **  Copyright (c) 1983  Eric P. Allman
   4: **  Berkeley, California
   5: **
   6: **  Copyright (c) 1983 Regents of the University of California.
   7: **  All rights reserved.  The Berkeley software License Agreement
   8: **  specifies the terms and conditions for redistribution.
   9: */
  10: 
  11: #if !defined(lint) && defined(DOSCCS)
  12: char copyright[] =
  13: "@(#) Copyright (c) 1980 Regents of the University of California.\n\
  14:  All rights reserved.\n";
  15: 
  16: static char SccsId[] = "@(#)mailstats.c	5.3.1 (2.11BSD) 1996/10/24";
  17: #endif
  18: 
  19: # include "../src/sendmail.h"
  20: # include "../src/mailstats.h"
  21: 
  22: /*
  23: **  MAILSTATS -- print mail statistics.
  24: **
  25: **	Flags:
  26: **		-Ffile		Name of statistics file.
  27: **
  28: **	Exit Status:
  29: **		zero.
  30: */
  31: 
  32: main(argc, argv)
  33:     char  **argv;
  34: {
  35:     register int fd;
  36:     struct statistics stat;
  37:     char *sfile = "/var/log/sendmail.st";
  38:     register int i;
  39:     extern char *ctime();
  40: 
  41:     fd = open(sfile, 0);
  42:     if (fd < 0)
  43:     {
  44:         perror(sfile);
  45:         exit(EX_NOINPUT);
  46:     }
  47:     if (read(fd, &stat, sizeof stat) != sizeof stat ||
  48:         stat.stat_size != sizeof stat)
  49:     {
  50:         (void) fprintf(stderr, "File size change\n");
  51:         exit(EX_OSERR);
  52:     }
  53: 
  54:     printf("Statistics from %s", ctime(&stat.stat_itime));
  55:     printf(" M msgsfr bytes_from  msgsto   bytes_to\n");
  56:     for (i = 0; i < MAXMAILERS; i++)
  57:     {
  58:         if (stat.stat_nf[i] == 0 && stat.stat_nt[i] == 0)
  59:             continue;
  60:         printf("%2d ", i);
  61:         printf("%6ld %10ldK ", stat.stat_nf[i], stat.stat_bf[i]);
  62:         printf("%6ld %10ldK\n", stat.stat_nt[i], stat.stat_bt[i]);
  63:     }
  64: }

Defined functions

main defined in line 32; never used

Defined variables

SccsId defined in line 16; never used
copyright defined in line 12; never used
Last modified: 1996-10-25
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2295
Valid CSS Valid XHTML 1.0 Strict