1: #include <stdio.h>
   2: #include <sys/param.h>
   3: 
   4: #if defined(RCSIDENT) && defined(MAINLINE)
   5: static char zzstructs[] = "$Header: src/usenet/notes/src/RCS/structs.h,v 1.9.1 96/3/21 21:48:27 paul Exp $";
   6: #endif	defined(RCSIDENT) && defined(MAINLINE)
   7: 
   8: /*
   9:  *	structure definitions for the notesfile program.
  10:  *
  11:  *	Constants/definitions likely to change with different
  12:  *	kernels are included in the file "parms.h".
  13:  */
  14: 
  15: 
  16: #define TRUE    1                   /* pretty euphemisms */
  17: #define FALSE   0
  18: #define NEVER   (-1)                    /* expiration stuff */
  19: #define EDIT    TRUE                    /* whether to edit or */
  20: #define NOEDIT  FALSE                   /* not to edit */
  21: 
  22: #ifdef  UID8                        /* 8 bit uids */
  23: #define     UIDMASK 0377                /* mask 8 bit uids */
  24: #define     GIDMASK 0377                /* mask 8 bit gids */
  25: #else   ! defined(UID8)                 /* 16 bit uids */
  26: #define     UIDMASK 0177777             /* mask out high UID bits */
  27: #define     GIDMASK 0177777             /* mask out high GID bits */
  28: #endif	! defined(UID8)
  29: 
  30: #define     NETLOG  "net.log"           /* network logfile */
  31: #define     GRIPES  "nfgripes"          /* gripe notesfile */
  32: #define     UTILITY ".utilities"            /* utility directory */
  33: #define     LOCKS   ".locks"            /* lock directory */
  34: #define     SEQUENCER ".sequencer"          /* sequencer files */
  35: #define     SEQ ".SEQ"              /* next d_nfnum */
  36: #define     INDXHLP "index.help"            /* index page help */
  37: #define     RDMHLP  "read.help"         /* readem page help file */
  38: #define     LIMHLP  "lim.help"          /* help for limited index */
  39: #define     ACCHLP  "access.help"           /* for access editor */
  40: #define     DIRHLP  "dir.help"          /* for director options */
  41: #define     AVAILHLP "avail.notes"          /* list of public notefiles */
  42: #define     NFCOMMENT "nfcomment"           /* nfcomment routine */
  43: #define     ARCHALIAS "Archive-into"        /* archive mapping */
  44: 
  45: #define     TEXT    "text"              /* name of text file */
  46: #define     INDEXN  "note.indx"         /* master index */
  47: #define     INDEXR  "resp.indx"         /* response chains */
  48: #define     ACCESS  "access"            /* access lists here */
  49: #define     ARCHIVE "archive"           /* archive sub-dir */
  50: #define     COMPRESS "comp."            /* compress names */
  51: #define     SEQLOCK     's'         /* .SEQ lock */
  52: #define     LOGLOCK     'l'         /* log file locking */
  53: #define     ARCHLOCK    'a'         /* archiving */
  54: #define     TXTLOCK     't'         /* text file */
  55: #define     DSCRLOCK    'n'         /* index file */
  56: 
  57: #define     RESPSZ  5               /* number responses/response record */
  58: #define     NAMESZ  17              /* longest user name */
  59: #define     HOMESYSSZ   33          /* user home system */
  60: #define     SYSSZ   33              /* system name length */
  61:                             /* above hold null byte also */
  62: #define     BUFSIZE 1024                /* chars in core */
  63: 
  64: /*
  65:  *	pick an appropriate default for the maximum message length
  66:  *	(MAXMSG). Also pick an appropriate hard limit. (HARDMAX)
  67:  *	HARDMAX must leave room for a one line message of up to 50
  68:  *	bytes of the form "ignoring %ld excess bytes"
  69:  */
  70: #ifdef  BIGTEXT
  71: #define     MAXMSG  100000              /* can be larger */
  72: #define     HARDMAX 3000000             /* 3 Mbytes */
  73: #else   NOT BIGTEXT
  74: #define     MAXMSG  65000               /* not much larger */
  75: #define     HARDMAX 65000               /* room for mesage */
  76: #endif	NOT BIGTEXT
  77: #define     PAGESAV 50              /* display stack */
  78:                             /* using unsigned short */
  79: #define     UNIQPLEX 100000             /* multiplex nfid into noteid */
  80:                             /* see putnote and putresp */
  81: 
  82: #define     TITLEN  36              /* note title length */
  83: #define     NNLEN   40              /* Notesfile Name length */
  84: #define     DMLEN   40              /* director message length */
  85: #define     NOT ~               /* tilde, prints wrong on hazeltines */
  86: #define     WDLEN   128             /* longest file name */
  87: #define     CMDLEN  512             /* build-a-command */
  88: #define     PASSWDLEN 128               /* longest line in /etc/passwd */
  89: #define     DATELEN 24              /* length of formatted date */
  90: #define     NPERMS  35              /* max access list */
  91: /*
  92:  *	NPERMS can be increased as desired. However, a static array is
  93:  *	allocated based on this constant. Watch it if you are running in
  94:  *	a memory starved environment (like an 11/60).
  95:  */
  96: #define     PAGELEN 56              /* pagelength for 'S' */
  97: 
  98: #define     ANONOK     01               /* permit anon notes */
  99: #define     FRMNEWS    01               /* non-nf article */
 100: #define     OPEN       02               /* open for public */
 101: #define     DIRMES     04               /* director msg on */
 102: #define     DELETED    010              /* is deleted */
 103: #define     NFINVALID  010              /* got bad copy */
 104: #define     NETWRKD    020              /* networking OK */
 105: #define     CONTINUED  040              /* was auto-split */
 106: #define     WRITONLY   0100             /* writeonly access when written */
 107: #define     ORPHND     0200             /* foster parent */
 108: #define     ISARCH     0400             /* is an archive */
 109: #define     MODERATED 01000             /* mail to moderator */
 110: #define     LOCAL     02000             /* no signature */
 111: 
 112: /*	change these only after modifying the table in access.c		*/
 113: #define     READOK  01              /* allow user to read */
 114: #define     WRITOK  02              /* allow user to write */
 115: #define     DRCTOK  04              /* allow user to be director */
 116: #define     RESPOK  010             /* ok to respond */
 117: /*
 118:  *	archive writing keyed on director status for now...
 119:  */
 120: #define     ARCHWRITOK  020             /* archive write */
 121: #define     ARCHRESPOK 040              /* archive response */
 122: #define     DFLTPERMS (READOK+WRITOK+RESPOK)    /* default permissions */
 123: 
 124: #define     PERMUSER    00          /* perm_f entry type */
 125: #define     PERMGROUP   01          /* ORDER IS IMPORTANT */
 126: #define     PERMSYSTEM  02
 127: 
 128: 
 129: /*
 130:  *	Sequencer modes.
 131:  *	modes < NOREADSEQ cause the time to be taken from "Basetime"
 132:  *	modes < NOWRITESEQ cause no update when leaving the notesfile.
 133:  *	There is currently no way to read from the sequencer file
 134:  *		and not update -- it's a wierd case anyway.
 135:  */
 136: 
 137: #define     NOSEQ       0           /* no sequencer */
 138: #define     USERSEQ     1           /* usertime noupdate */
 139: 
 140: #define     NOWRITESEQ  10          /* < this no write */
 141: #define     BASESEQ     11          /* usertime & update */
 142: 
 143: #define     NOREADSEQ   100         /* use Basetime if < */
 144: #define     NORMSEQ     101         /* normal sequencer */
 145: #define     EXTSEQ      102         /* enter anyway */
 146: #define     INDXSEQ     103         /* index sequencer */
 147:                             /*  from harpo!mmp */
 148: 
 149: #define     QUITSEQ     -2          /* quit, update sequencer */
 150: #define     QUITNOSEQ   -3          /* quit, no seq update */
 151: #define     QUITFAST    -4          /* quit almost abort */
 152: #define     QUITUPD     -5          /* like quitfast */
 153: #define     QUITNEX     -6          /* no notesfile */
 154: #define     QUITBAD     -7          /* bad notesfile */
 155: 
 156: #define     GOOD        0           /* good exit status */
 157: #define     BAD     1           /* bad exit status */
 158: #define     NONF        2           /* no notefile */
 159: 
 160: #define     POLICY      1           /* mnemonics */
 161: #define     NOPOLICY    0           /* used in calls */
 162: #define     LOCKIT      1           /* Do not change */
 163: #define     NOLOCKIT    0
 164: #define     COPYID      1
 165: #define     NOCOPYID    0
 166: #define     ADDID       1
 167: #define     NOADDID     0
 168: #define     ADDTIME     1
 169: #define     NOADDTIME   0
 170: #define     DETAIL      1           /* dump extra info */
 171: #define     NODETAIL    0           /* used for generic form */
 172: 
 173: /*
 174:  *	These defines are for the archiver. They are used for determining
 175:  *	eligibility for archival along with the age of the note.
 176:  *	DFLT means to use whatever value was supplied on the archive
 177:  *	command line.  The others mean the notesfile is configured
 178:  *	for a specific archival setup.
 179:  */
 180: 
 181: #define     DIRDFLT     0           /* use cmd line */
 182: #define     DIRNOCARE   1           /* don't check dir */
 183: #define     DIRON       2           /* only if dir on */
 184: #define     DIROFF      3           /* only if dir off */
 185: #define     DIRANYON    4           /* note or resp on */
 186: 
 187: #define     KEEPDFLT    0           /* use cmd line */
 188: #define     KEEPNO      1           /* delete 'em */
 189: #define     KEEPYES     2           /* archive 'em */
 190: 
 191: struct auth_f                       /* how we id author */
 192: {
 193:     char    aname[NAMESZ];              /* his name */
 194:     char    asystem[HOMESYSSZ];             /* his system */
 195:     int     aid;                    /* uid (if local) */
 196: };
 197: 
 198: struct when_f                       /* standard date structure */
 199: {
 200:     short   w_year;
 201:     short   w_month;
 202:     short   w_day;
 203:     short   w_hours;
 204:     short   w_mins;
 205:     long    w_gmttime;                  /* stock unix time */
 206: };
 207: 
 208: struct id_f                     /* unique id for notes */
 209: {
 210:     char    sys[SYSSZ];
 211:     long    uniqid;
 212: };
 213: 
 214: struct perm_f                       /* permission tables */
 215: {
 216:     short   ptype;                  /* user, group, system */
 217:     char    name[NAMESZ];               /* name of such */
 218:     short   perms;                  /* what he is allowed */
 219: };
 220: 
 221: struct daddr_f                      /* save a disk address */
 222: {
 223:     long    addr;                   /* for lseeks */
 224: #ifdef  BIGTEXT
 225:     u_long   textlen;               /* how long is text */
 226: #else   NOT BIGTEXT
 227:     unsigned short  textlen;                /* how long the text is */
 228: #endif	NOT BIGTEXT
 229: };
 230: 
 231: struct txtbuf_f
 232: {
 233:     char    txtbuf[BUFSIZE];                /* hold a bunch of characters */
 234: };
 235: 
 236: struct dsply_f
 237: {
 238:     struct daddr_f  d_head;             /* text start */
 239:     struct txtbuf_f d_buf;
 240:     int     optr,
 241:             olim;                   /* output index and end of buffer */
 242:     long    outcount;                   /* number of characters dumped */
 243: };
 244: 
 245: struct resp_f                       /* for each response: */
 246: {
 247:     short   r_first,                    /* bounds of this */
 248:             r_last;                 /* resp_f block */
 249:     struct id_f r_id[RESPSZ];               /* system/id for each response */
 250:     struct daddr_f  r_addr[RESPSZ];         /* where the response is */
 251:     struct when_f   r_when[RESPSZ];         /* date/time of response */
 252:     char    r_from[RESPSZ][SYSSZ];          /* system that sent this to us */
 253:     struct when_f   r_rcvd[RESPSZ];         /* date/time for sequencer */
 254:     struct auth_f   r_auth[RESPSZ];
 255:     char    r_stat[RESPSZ];             /* director/status flag */
 256:     int     r_next;                 /* index of next response_ind */
 257:     int     r_previous;                 /* backlinks */
 258:                             /* [currently unused */
 259: };
 260: 
 261: struct note_f                       /* standard note structure: */
 262: {
 263:     struct id_f n_id;                   /* unique id for this note */
 264:     short   n_nresp;                    /* number of responses */
 265:     char    ntitle[TITLEN];             /* title of note */
 266:     struct auth_f   n_auth;             /* note's author */
 267:     struct when_f   n_date;             /* note's date */
 268:     struct when_f   n_rcvd;             /* date we got it */
 269:     struct when_f   n_lmod;             /* date of last mod */
 270:     char    n_from[SYSSZ];              /* system that handed us the note */
 271:     int     n_rindx;                    /* where the first set of responses lies */
 272:     struct daddr_f  n_addr;             /* address of note's text on disk */
 273:     char    n_stat;                 /* director/status flag */
 274: };
 275: 
 276: struct descr_f                      /* for the notesfile: */
 277: {
 278:     long    d_format;                   /* nf's format */
 279:     char    d_title[NNLEN];             /* nf's name */
 280:     char    d_drmes[DMLEN];             /* director message */
 281:     short   d_plcy;                 /* ==0 if no message */
 282:     struct when_f   d_lastm;                /* last modified time */
 283:     short   d_stat;                 /* open/closed/etc */
 284:     short   d_nnote;                    /* how many notes in file */
 285:     struct id_f d_id;                   /* sys name & unique id counter */
 286:     struct when_f   d_lstxmit;              /* last network transmit */
 287:     struct when_f   d_created;              /* creation date */
 288:     struct when_f   d_lastuse;              /* last day used */
 289:     long    d_daysused;                 /* count those days */
 290:     long    d_rspwrit;                  /* number of responses ever written */
 291:     long    d_notwrit;                  /* number of notes ever written */
 292:     long    entries;                    /* number of entries into the notefile */
 293:     long    walltime;                   /* man-seconds (?) spent in notefile */
 294:     long    d_rspread;                  /* number of responses read */
 295:     long    d_notread;                  /* and number of notes */
 296:     long    d_rsprcvd;                  /* network in stats */
 297:     long    d_notrcvd;
 298:     long    d_rspxmit;                  /* network out stats */
 299:     long    d_notxmit;
 300:     long    d_notdrop;                  /* duplicate notes recieved */
 301:     long    d_rspdrop;                  /* and dropped on ground */
 302:     long    d_orphans;                  /* orphaned responses */
 303:     long    netwrkouts;                 /* number of times networked out */
 304:     long    netwrkins;                  /* and number of networked in */
 305:     short   d_nfnum;                    /* unique to this notesfile */
 306:     long    d_archtime;                 /* archive after X days */
 307:     long    d_workset;                  /* working set size */
 308:     long    d_delnote;                  /* count deletes */
 309:     long    d_delresp;                  /* count resp dels */
 310:     long    d_dmesgstat;                /* use dirmsg for archive */
 311:     long    d_archkeep;                 /* keep/delete */
 312:     long    d_adopted;                  /* orphans adopted */
 313:     long    d_longnote;                 /* max per article */
 314:     char    d_filler[20];               /* future use ... */
 315: };
 316: 
 317: struct io_f                     /* master i/o form */
 318: {
 319:     int     fidtxt;                 /* text */
 320:     int     fidndx;                 /* note.indx */
 321:     int     fidrdx;                 /* resp.indx */
 322:     struct descr_f  descr;              /* current descr */
 323:                             /* updated by critical sections */
 324:     char    nf[NNLEN];                  /* last part of name */
 325:     char    basedir[WDLEN];             /* its directory */
 326:     char    fullname[WDLEN];                /* full pathname */
 327:     char    xstring[TITLEN + 1];            /* search string */
 328:     char    xauthor[NAMESZ + SYSSZ + 2];        /* author search */
 329:                             /* site!user\0 */
 330:     struct when_f   stime;              /* read notes/responses more recent than this */
 331:     short   access;                 /* what sort of access user has */
 332:     int     nrspwrit;                   /* number of responses written this entry */
 333:     int     nnotwrit;                   /* num of notes written */
 334:     long    entered;                    /* when started so can figure time in */
 335:     int     nrspread;                   /* how many responses he read */
 336:     int     nnotread;                   /* how many notes he read */
 337:                             /* num read may be tough */
 338:     int     nnotxmit;                   /* network out stats */
 339:     int     nrspxmit;
 340:     int     nnotrcvd;                   /* network in stats */
 341:     int     nrsprcvd;
 342:     int     nnotdrop;                   /* duplicates rom the network */
 343:     int     nrspdrop;
 344:     int     norphans;                   /* orphans rcvd */
 345:     int     adopted;                    /* adoptions handled */
 346: };
 347: 
 348: struct seq_f                        /* sequencer entry list form */
 349: {
 350:     char    nfname[NNLEN];              /* name of notefile */
 351:     struct when_f   lastin;             /* last entry time */
 352: };
 353: 
 354: struct nflist_f                     /* nf's to scan */
 355: {
 356:     char   *nf_name;
 357:     short   nf_active;                  /* !'ed or not */
 358:     short   nf_seqmode;                 /* sequencer mode */
 359: };
 360: 
 361: /*
 362:  *	Declare global variables. The actual instantiation of these
 363:  *	variables is in the file startup.c
 364:  *
 365:  */
 366: 
 367: extern char *hised;                 /* preferred editor */
 368: extern char *hisshell;                  /* preferred shell */
 369: extern char *hispager;                  /* paging program */
 370: extern char *hismailer;                 /* mail program */
 371: extern int  nrows;                  /* rows on screen */
 372: extern int  ncols;                  /* screen width */
 373: extern char *histty;                    /* tty on command */
 374: extern int  intflag;                    /* DEL hit recently */
 375: extern int  globuid;                    /* his true user id */
 376: extern int  Notesuid;                   /* who's god */
 377: extern int  Anonuid;                    /* who's not allowed */
 378: extern int  Nindex;                 /* index page rows */
 379: extern int  ignoresigs;                 /* critical section */
 380: extern char *Mstdir;                    /* default nf place */
 381: extern char *System;                    /* point to it */
 382: extern char *Authsystem;                /* author's system */
 383: extern char *Invokedas;                 /* argv[0] */
 384: extern char Seqname[];                  /* sequencing name */
 385: extern struct when_f    Basetime;           /* zero time */
 386: 
 387: /*
 388:  *	Various definitions that help keep things portable.
 389:  *	Types that various functions return, etc.
 390:  */
 391: 
 392: #if defined(USG)
 393: extern char *strchr ();                 /* UNIX4.0 index() */
 394: extern char *strrchr ();                /* UNIX4.0 rindex() */
 395: #else
 396: extern char *index ();                  /* for lint */
 397: extern char *rindex ();
 398: #endif	defined(USG)
 399: 
 400: /*
 401:  *	Standard library routines that return other than "int".
 402:  */
 403: 
 404: extern int  errno;                  /* syscall errors */
 405: #if BSD < 43
 406: extern char *sprintf ();                /* satisfy lint */
 407: #endif
 408: extern char *getenv ();
 409: extern long lseek ();                   /* for lint */
 410: extern char *malloc ();
 411: 
 412: /*
 413:  *	routines in the notesfile system that return other than
 414:  *	"int".
 415:  */
 416: 
 417: extern char *strsave ();                /* in misc.c */
 418: extern struct nflist_f *nextgroup ();           /* in expand.c */
 419: extern long pagein ();                  /* in pagein.c */
 420: extern long gettext ();                 /* in gtext.c */
 421: extern long puttrec ();                 /* in recsio.c */

Defined variables

zzstructs defined in line 5; never used

Defined struct's

descr_f defined in line 276; used 18 times
dsply_f defined in line 236; used 6 times
io_f defined in line 317; used 182 times
note_f defined in line 261; used 96 times
seq_f defined in line 348; used 12 times
txtbuf_f defined in line 231; used 8 times
when_f defined in line 198; used 124 times

Defined macros

ACCHLP defined in line 39; used 1 times
ADDID defined in line 166; used 3 times
ARCHALIAS defined in line 43; used 1 times
ARCHIVE defined in line 49; never used
ARCHLOCK defined in line 53; never used
ARCHRESPOK defined in line 121; never used
ARCHWRITOK defined in line 120; never used
AVAILHLP defined in line 41; used 3 times
COMPRESS defined in line 50; used 3 times
CONTINUED defined in line 105; never used
COPYID defined in line 164; used 2 times
DETAIL defined in line 170; used 5 times
DFLTPERMS defined in line 122; used 3 times
DIRHLP defined in line 40; used 1 times
DMLEN defined in line 84; used 14 times
EXTSEQ defined in line 145; used 3 times
GIDMASK defined in line 27; used 1 times
GRIPES defined in line 31; used 2 times
HARDMAX defined in line 75; used 2 times
INDXHLP defined in line 36; used 1 times
LIMHLP defined in line 38; used 1 times
LOCKS defined in line 33; used 4 times
LOGLOCK defined in line 52; never used
MAXMSG defined in line 74; used 1 times
NEVER defined in line 18; used 2 times
NFCOMMENT defined in line 42; never used
NOCOPYID defined in line 165; never used
NOEDIT defined in line 20; used 1 times
NOREADSEQ defined in line 143; used 1 times
NOWRITESEQ defined in line 140; used 1 times
PAGELEN defined in line 96; never used
PAGESAV defined in line 77; used 4 times
PASSWDLEN defined in line 88; never used
POLICY defined in line 160; used 1 times
QUITBAD defined in line 154; used 5 times
QUITNEX defined in line 153; used 1 times
RDMHLP defined in line 37; used 1 times
RESPSZ defined in line 57; used 13 times
SEQ defined in line 35; used 1 times
SEQLOCK defined in line 51; used 2 times
SEQUENCER defined in line 34; used 2 times
UNIQPLEX defined in line 79; used 4 times
USERSEQ defined in line 138; used 1 times

Usage of this include

structs.h used 82 times
Last modified: 1996-03-22
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 7760
Valid CSS Valid XHTML 1.0 Strict