home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / asm_programming / MJRDEVEL.ARC / TYPAUDIT.C < prev    next >
Text File  |  1988-09-07  |  4KB  |  111 lines

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *   TYPAUDIT.C                                                            *
  4.  *                                                                         *
  5.  *   Copyright (C) 1986, 1987 by GALACTICOMM, Inc.  All Rights Reserved.   *
  6.  *                                                                         *
  7.  *   This is the Major BBS audit trail output utility.                     *
  8.  *                                                                         *
  9.  *                                            - T. Stryker 03/31/87        *
  10.  *                                                                         *
  11.  ***************************************************************************/
  12.  
  13. #include "stdio.h"
  14. #include "setjmp.h"
  15. #include "btvstf.h"
  16. #include "majorbbs.h"
  17. #include "portable.h"
  18. #include "fkcode.h"
  19.  
  20. extern jmp_buf disaster;      /* master error-recovery longjmp save block  */
  21.  
  22. main(argc,argv)
  23. int argc;
  24. char *argv[];
  25. {
  26.      BTVFILE *fp;
  27.      char audrec[AUDSIZ];
  28.      static char *filnam={"auditrai.dat"};
  29.      static FILE *outf=stdout;
  30.      static int pagbrk=0,line=-1;
  31.      static char outnam[129]={""};
  32.      static char repnam[]={"Audit Trail Report"};
  33.      char c;
  34.  
  35.      fprintf(stderr,"%s for The Major BBS\n",repnam);
  36.      fprintf(stderr,"(C) Copyright 1988, Galacticomm Inc.\n\n");
  37.      if (setjmp(ADDR_OFdisaster)) {
  38.           exit(1);
  39.      }
  40.      if (argc > 1 && strcmp(argv[1],"?") == 0) {
  41.           fprintf(stderr,"Where do you want to send the %s?\n",repnam);
  42.           fprintf(stderr,"\n");
  43.           fprintf(stderr,"   (1) to your Screen\n");
  44.           fprintf(stderr,"   (2) to your Printer\n");
  45.           fprintf(stderr,"   (3) to a Disk File\n");
  46.           fprintf(stderr,"\n");
  47.           fprintf(stderr,"Please choose a number (or 0 to exit):  ");
  48.           while (1) {
  49.                switch (getchc()) {
  50.                case F1:
  51.                case '1':
  52.                     pagbrk=22;
  53.                     fprintf(stderr,"1\n\n");
  54.                     break;
  55.                case F2:
  56.                case '2':
  57.                     strcpy(outnam,"PRN");
  58.                     fprintf(stderr,"2\n\nPrinting the %s...",repnam);
  59.                     break;
  60.                case F3:
  61.                case '3':
  62.                     fprintf(stderr,"3\nFile name:  ");
  63.                     scanf("%s",outnam);
  64.                     fprintf(stderr,"\nWriting the %s to \"%s\"...",repnam,outnam);
  65.                     break;
  66.                case F10:
  67.                case '0':
  68.                     fprintf(stderr,"\n");
  69.                     exit(0);
  70.                default:
  71.                     continue;
  72.                }
  73.                break;
  74.           }
  75.      }
  76.      if (outnam[0] != '\0') {
  77.           if ((outf=fopen(outnam,FOPWA)) == NULL) {
  78.                catastro("CANNOT OPEN OUTPUT FILE \"%s\"",outnam);
  79.           }
  80.      }
  81.      fp=opnbtv(filnam,AUDSIZ);
  82.      setbtv(fp);
  83.      if (!qlobtv(0)) {
  84.           catastro("Audit trail file is empty!");
  85.      }
  86.      do {
  87.           if (pagbrk > 0 && ++line >= pagbrk) {
  88.                fprintf(stderr,"<< hit any key to continue >>");
  89.                getchc();
  90.                fprintf(stderr,"\n");
  91.                line=0;
  92.           }
  93.           gcrbtv(audrec,0);
  94.           fprintf(outf,"%s\n",audrec);
  95.      } while (qnxbtv());
  96.      clsbtv(fp);
  97.      fclose(outf);
  98.      fprintf(stderr,"\n\nEnd of report.\n");
  99.      exit(0);
  100. }
  101.  
  102. char *catfix1()
  103. {
  104.      return("");
  105. }
  106.  
  107. char *catfix2()
  108. {
  109.      return("");
  110. }
  111.