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

Defined variables

zzstructs defined in line 4; never used

Defined struct's

descr_f defined in line 272; used 18 times
dsply_f defined in line 232; used 6 times
io_f defined in line 313; used 178 times
note_f defined in line 257; used 98 times
txtbuf_f defined in line 227; used 8 times
when_f defined in line 194; used 120 times

Defined macros

ACCHLP defined in line 38; used 1 times
ADDID defined in line 163; used 3 times
ARCHALIAS defined in line 42; used 1 times
ARCHIVE defined in line 48; never used
ARCHLOCK defined in line 52; never used
ARCHRESPOK defined in line 118; never used
ARCHWRITOK defined in line 117; never used
AVAILHLP defined in line 40; used 2 times
COMPRESS defined in line 49; used 3 times
CONTINUED defined in line 104; never used
COPYID defined in line 161; used 2 times
DETAIL defined in line 167; used 5 times
DFLTPERMS defined in line 119; used 3 times
DIRHLP defined in line 39; used 1 times
DMLEN defined in line 83; used 14 times
EXTSEQ defined in line 142; used 3 times
GIDMASK defined in line 26; used 1 times
GRIPES defined in line 30; used 2 times
HARDMAX defined in line 74; used 2 times
INDXHLP defined in line 35; used 1 times
KEEPNO defined in line 184; used 2 times
LIMHLP defined in line 37; used 1 times
LOCKS defined in line 32; used 4 times
LOGLOCK defined in line 51; never used
NEVER defined in line 17; used 2 times
NFCOMMENT defined in line 41; never used
NOCOPYID defined in line 162; never used
NOEDIT defined in line 19; used 1 times
NOREADSEQ defined in line 140; used 1 times
NOWRITESEQ defined in line 137; used 1 times
PAGELEN defined in line 95; never used
PAGESAV defined in line 76; used 4 times
PASSWDLEN defined in line 87; used 1 times
POLICY defined in line 157; used 1 times
QUITBAD defined in line 151; used 5 times
QUITNEX defined in line 150; used 1 times
RDMHLP defined in line 36; used 1 times
RESPSZ defined in line 56; used 13 times
SEQ defined in line 34; used 1 times
SEQLOCK defined in line 50; used 2 times
SEQUENCER defined in line 33; used 2 times
UNIQPLEX defined in line 78; used 4 times
USERSEQ defined in line 135; used 1 times

Usage of this include

structs.h used 84 times
Last modified: 1985-10-30
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2322
Valid CSS Valid XHTML 1.0 Strict