1: #ifdef  RCSIDENT
   2: static char rcsid[] = "$Header: mknf.c,v 1.7 85/01/18 15:19:42 notes Rel $";
   3: #endif	RCSIDENT
   4: 
   5: 
   6: /*
   7:  *	This program will initialize an empty notefile. It leaves the
   8:  *	caller as sole director of the notefile and also as the only
   9:  *	person with access to the notefile.
  10:  *
  11:  *	Since a notefile does suck up a little disk space, the use of
  12:  *	this program is limited to the user whose uid matches the
  13:  *	Notesuid constant.
  14:  *
  15:  *	Original coding:	Rob Kolstad	Winter 1980
  16:  *	Modified:		Ray Essick	November 1981
  17:  */
  18: 
  19: #define MAINLINE
  20: #include    "parms.h"
  21: #include    "structs.h"
  22: 
  23: main (argc, argv)
  24: char  **argv;                       /* create a new notesfile */
  25: {
  26: 
  27:     char   *q;
  28:     int     k;                      /* arg counter */
  29:     int     j,
  30:             Aflag,
  31:             Oflag,
  32:             Nflag;                  /* option flags */
  33:     char    basedir[WDLEN];
  34:     char    endname[WDLEN];
  35: 
  36:     startup (argc, argv);               /* common initialization */
  37: 
  38:     if (globuid != Notesuid)
  39:     {
  40:     printf ("You are not allowed to build notefiles\n");
  41:     exit (BAD);
  42:     }
  43: 
  44:     if (argc == 1)
  45:     {
  46:     printf ("Usage: %s [-aon] topic1 [...]\n", argv[0]);
  47:     exit (BAD);
  48:     }
  49: 
  50:     Aflag = 0;
  51:     Oflag = 0;
  52:     Nflag = 0;
  53: 
  54:     for (k = 1; k < argc; k++)
  55:     {
  56: 
  57:     if (argv[k][0] == '-')              /* options!!! */
  58:     {
  59:         j = 1;
  60:         while (argv[k][j])
  61:         switch (argv[k][j++])
  62:         {
  63:             case 'a':               /* anon notes ok */
  64:             Aflag = 1;
  65:             break;
  66: 
  67:             case 'o':               /* open notesfile */
  68:             Oflag = 1;
  69:             break;
  70: 
  71:             case 'n':               /* network available */
  72:             Nflag = 1;
  73:             break;
  74: 
  75:             default:                /* bad news */
  76:             fprintf (stderr, "Bad switch: `%c'\n", argv[k][--j]);
  77:             exit (BAD);
  78:         }
  79:         continue;                   /* on to the next arguement */
  80:     }
  81: 
  82:     printf ("%s:\t", argv[k]);
  83:     if (argv[k][0] == '/')              /* absolute path */
  84:     {
  85:         q = rindex (argv[k], '/');          /* find trailing slash */
  86:         *q++ = '\0';                /* break into pieces */
  87:         strcpy (basedir, argv[k]);
  88:         strcpy (endname, q);
  89:         *--q = '/';                 /* reconnect */
  90:     }
  91:     else
  92:     {
  93:         strcpy (basedir, Mstdir);           /* default */
  94:         strcpy (endname, argv[k]);
  95:     }
  96: 
  97: /*
  98:  *	Actually make the notesfile in buildnf()
  99:  */
 100:     switch (buildnf (endname, basedir, Aflag, Oflag, Nflag))
 101:     {
 102:         case 0:                     /* success */
 103:         printf ("complete\n");
 104:         break;
 105: 
 106:         case (-1):                  /* invalid name */
 107:         case (-2):                  /* exists */
 108:         default:                    /* should be like this */
 109:         break;                  /* buildnf does newline */
 110:     }
 111: 
 112:     }
 113:     exit (GOOD);
 114: }

Defined functions

main defined in line 23; never used

Defined variables

rcsid defined in line 2; never used

Defined macros

MAINLINE defined in line 19; never used
Last modified: 1985-01-19
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2058
Valid CSS Valid XHTML 1.0 Strict