1: /* $Header: common.h,v 4.3.1.3 85/05/23 17:19:32 lwall Exp $
   2:  *
   3:  * $Log:	common.h,v $
   4:  * Revision 4.3.1.3  85/05/23  17:19:32  lwall
   5:  * Now allows 'r' and 'f' on null articles.
   6:  *
   7:  * Revision 4.3.1.2  85/05/13  09:30:39  lwall
   8:  * Added CUSTOMLINES option.
   9:  *
  10:  * Revision 4.3.1.1  85/05/10  11:32:04  lwall
  11:  * Branch for patches.
  12:  *
  13:  * Revision 4.3  85/05/01  11:37:11  lwall
  14:  * Baseline for release with 4.3bsd.
  15:  *
  16:  */
  17: 
  18: #include "config.h" /* generated by installation script */
  19: #ifdef WHOAMI
  20: #    include <whoami.h>
  21: #endif
  22: 
  23: #include <stdio.h>
  24: #include <sys/types.h>
  25: #include <sys/stat.h>
  26: #include <ctype.h>
  27: 
  28: #ifndef isalnum
  29: #   define isalnum(c) (isalpha(c) || isdigit(c))
  30: #endif
  31: 
  32: #include <errno.h>
  33: #include <signal.h>
  34: #ifdef IOCTL
  35: #include <sys/ioctl.h>
  36: #endif IOCTL
  37: 
  38: #ifdef FCNTL
  39: #   include <fcntl.h>
  40: #endif
  41: 
  42: #ifdef TERMIO
  43: #   include <termio.h>
  44: #else
  45: #   include <sgtty.h>
  46: #endif
  47: 
  48: #ifdef GETPWENT
  49: #   include <pwd.h>
  50: #endif
  51: 
  52: #define BITSPERBYTE 8
  53: #define LBUFLEN 512 /* line buffer length */
  54:             /* (don't worry, .newsrc lines can exceed this) */
  55: #ifdef pdp11
  56: #   define CBUFLEN 256  /* command buffer length */
  57: #   define PUSHSIZE 128
  58: #else
  59: #   define CBUFLEN 512  /* command buffer length */
  60: #   define PUSHSIZE 256
  61: #endif
  62: #ifdef pdp11
  63: #   define MAXFILENAME 128
  64: #else
  65: #   define MAXFILENAME 512
  66: #endif
  67: #define LONGKEY 15  /* longest keyword: currently "posting-version" */
  68: #define FINISHCMD 0177
  69: 
  70: /* some handy defs */
  71: 
  72: #define bool char
  73: #define TRUE (1)
  74: #define FALSE (0)
  75: #define Null(t) ((t)0)
  76: #define Nullch Null(char *)
  77: #define Nullfp Null(FILE *)
  78: 
  79: #define Ctl(ch) (ch & 037)
  80: 
  81: #define strNE(s1,s2) (strcmp(s1,s2))
  82: #define strEQ(s1,s2) (!strcmp(s1,s2))
  83: #define strnNE(s1,s2,l) (strncmp(s1,s2,l))
  84: #define strnEQ(s1,s2,l) (!strncmp(s1,s2,l))
  85: 
  86: /* Things we can figure out ourselves */
  87: 
  88: #ifdef SIGTSTP
  89: #   define BERKELEY     /* include job control signals? */
  90: #endif
  91: 
  92: #ifdef SIGPROF
  93: #   define BSD42        /* do we have Berkeley 4.2? */
  94: #endif
  95: 
  96: #ifdef FIONREAD
  97: #   define PENDING
  98: #else
  99: #   ifdef O_NDELAY
 100: #	define PENDING
 101: #   endif
 102: #endif
 103: 
 104: #ifdef EUNICE
 105: #   define LINKART      /* add 1 level of possible indirection */
 106: #   define UNLINK(victim) while (!unlink(victim))
 107: #else
 108: #   define UNLINK(victim) unlink(victim)
 109: #endif
 110: 
 111: /* Valid substitutions for strings marked with % comment are:
 112:  *	%a	Current article number
 113:  *	%A	Full name of current article (%P/%c/%a)
 114:  *		(if LINKART defined, is the name of the real article)
 115:  *	%b	Destination of a save command, a mailbox or command
 116:  *	%B	The byte offset to the beginning of the article for saves
 117:  *		with or without the header
 118:  *	%c	Current newsgroup, directory form
 119:  *	%C	Current newsgroup, dot form
 120:  *	%d	%P/%c
 121:  *	%D	Old Distribution: line
 122:  *	%f	Old From: line or Reply-To: line
 123:  *	%F	Newsgroups to followup to from Newsgroups: and Followup-To:
 124:  *	%h	Name of header file to pass to mail or news poster
 125:  *	%H	Host name (yours)
 126:  *	%i	Old Message-I.D.: line, with <>
 127:  *	%I	Inclusion indicator
 128:  *	%l	News administrator login name
 129:  *	%L	Login name (yours)
 130:  *	%M	Number of articles markd with M
 131:  *	%n	Newsgroups from source article
 132:  *	%N	Full name (yours)
 133:  *	%o	Organization (yours)
 134:  *	%O	Original working directory (where you ran rn from)
 135:  *	%p	Your private news directory (-d switch)
 136:  *	%P	Public news spool directory (SPOOLDIR)
 137:  *	%r	Last reference (parent article id)
 138:  *	%R	New references list
 139:  *	%s	Subject, with all Re's and (nf)'s stripped off
 140:  *	%S	Subject, with one Re stripped off
 141:  *	%t	New To: line derived from From: and Reply-To (Internet always)
 142:  *	%T	New To: line derived from Path:
 143:  *	%u	Number of unread articles
 144:  *	%U	Number of unread articles disregarding current article
 145:  *	%x	News library directory, usually /usr/lib/news
 146:  *	%X	Rn library directory, usually %x/rn
 147:  *	%z	Size of current article in bytes.
 148:  *	%~	Home directory
 149:  *	%.	Directory containing . files
 150:  *	%$	current process number
 151:  *	%{name} Environment variable "name".  %{name-default} form allowed.
 152:  *	%[name]	Header line beginning with "Name: ", without "Name: "
 153:  *	%"prompt"
 154:  *		Print prompt and insert what is typed.
 155:  *	%`command`
 156:  *		Insert output of command.
 157:  *	%(test_text=pattern?if_text:else_text)
 158:  *		Substitute if_text if test_text matches pattern, otherwise
 159:  *		substitute else_text.  Use != for negated match.
 160:  *		% substitutions are done on test_text, if_text, and else_text.
 161:  *		(Note: %() only works if CONDSUB defined.)
 162:  *	%digit	Substitute the text matched by the nth bracket in the last
 163:  *		pattern that had brackets.  %0 matches the last bracket
 164:  *		matched, in case you had alternatives.
 165:  *
 166:  *	Put ^ in the middle to capitalize the first letter: %^C = Net.jokes
 167:  *	Put _ in the middle to capitalize last component: %_c = net/Jokes
 168:  *
 169:  *	~ interpretation in filename expansion happens after % expansion, so
 170:  *	you could put ~%{NEWSLOGNAME-news} and it will expand correctly.
 171:  */
 172: 
 173: /* *** System Dependent Stuff *** */
 174: 
 175: /* NOTE: many of these are defined in the config.h file */
 176: 
 177: /* name of organization */
 178: #ifndef ORGNAME
 179: #   define ORGNAME "ACME Widget Company, Widget Falls, Southern North Dakota"
 180: #endif
 181: 
 182: #ifndef MBOXCHAR
 183: #   define MBOXCHAR 'F' /* how to recognize a mailbox by 1st char */
 184: #endif
 185: 
 186: #ifndef ROOTID
 187: #   define ROOTID 0        /* uid of superuser */
 188: #endif
 189: 
 190: #ifdef NORMSIG
 191: #   define sigset signal
 192: #   define sigignore(sig) signal(sig,SIG_IGN)
 193: #endif
 194: 
 195: #ifndef LOGDIRFIELD
 196: #   define LOGDIRFIELD 6        /* Which field (origin 1) is the */
 197:                     /* login directory in /etc/passwd? */
 198:                     /* (If it is not kept in passwd, */
 199:                     /* but getpwnam() returns it, */
 200:                     /* define the symbol GETPWENT) */
 201: #endif
 202: #ifndef GCOSFIELD
 203: #   define GCOSFIELD 5
 204: #endif
 205: 
 206: #ifndef NEGCHAR
 207: #   define NEGCHAR '!'
 208: #endif
 209: 
 210: /* Space conservation section */
 211: 
 212: /* To save D space, cut down size of MAXRCLINE, NGMAX, VARYSIZE. */
 213: #define MAXRCLINE 500   /* number of lines allowed in .newsrc */
 214:             /* several parallel arrays affected. */
 215:             /* (You can have more lines in the active file, */
 216:             /* just not in the .newsrc) */
 217: #define HASHSIZ 547 /* should be prime, and at least MAXRCLINE + 10% */
 218: #define NGMAX 100   /* number of newsgroups allowed on command line */
 219:             /* undefine ONLY symbol to disable "only" feature */
 220: #define VARYSIZE 256    /* this makes a block 1024 bytes long in DECville */
 221:             /* (used by virtual array routines) */
 222: 
 223: /* Undefine any of the following features to save both I and D space */
 224: /* In general, earlier ones are easier to get along without */
 225: /* Pdp11's without split I and D may have to undefine them all */
 226: #define DEBUGGING   /* include debugging code */
 227: #define CUSTOMLINES /* include code for HIDELINE and PAGESTOP */
 228: #define PUSHBACK    /* macros and keymaps using pushback buffer */
 229: #define SPEEDOVERMEM    /* use more memory to run faster */
 230: #define WORDERASE   /* enable ^W to erase a word */
 231: #define MAILCALL    /* check periodically for mail */
 232: #define CLEAREOL    /* use clear to end-of-line instead of clear screen */
 233: #define NOFIREWORKS /* keep whole screen from flashing on certain */
 234:             /* terminals such as older Televideos */
 235: #define VERIFY      /* echo the command they just typed */
 236: #define HASHNG      /* hash newsgroup lines for fast lookup-- */
 237:             /* linear search used if not defined */
 238: #define CONDSUB     /* allow %(cond?text:text) */
 239: #define BACKTICK    /* allow %`command` */
 240: #define PROMPTTTY   /* allow %"prompt" */
 241: #define ULSMARTS    /* catch _^H in text and do underlining */
 242: #define TERMMOD     /* allow terminal type modifier on switches */
 243: #define BAUDMOD     /* allow baudrate modifier on switches */
 244: #define GETLOGIN    /* use getlogin() routine as backup to environment */
 245:             /* variables USER or LOGNAME */
 246: #define ORGFILE     /* if organization begins with /, look up in file */
 247: #define TILDENAME   /* allow ~logname expansion */
 248: #define SETENV      /* allow command line environment variable setting */
 249: #define GETWD       /* use our getwd() instead of piped in pwd */
 250: #ifndef BSD42       /* 4.2 sites should just use groups for this */
 251: #define SETUIDGID   /* substitute eaccess() for access() so that rn */
 252:             /* can run setuid or setgid */
 253:             /* if not setuid or setgid, you don't need it */
 254: #endif
 255: #define MAKEDIR     /* use our makedir() instead of shell script */
 256: #define MEMHELP     /* keep help messages in memory */
 257: #define VERBOSE     /* compile in more informative messages */
 258: #define TERSE       /* compile in shorter messages */
 259:             /* (Note: both VERBOSE and TERSE can be defined; -t
 260: 			 * sets terse mode.  One or the other MUST be defined.
 261: 			 */
 262: #ifndef pdp11
 263: #   define CACHESUBJ    /* cache subject lines in memory */
 264:             /* without this ^N still works but runs really slow */
 265:             /* but you save lots and lots of D space */
 266: #   define CACHEFIRST   /* keep absolute first article numbers in memory */
 267:             /* cost: about 2k */
 268: #endif
 269: #define ROTATION    /* enable x, X and ^X commands to work */
 270: #define DELBOGUS    /* ask if bogus newsgroups should be deleted */
 271: #define RELOCATE    /* allow newsgroup rearranging */
 272: #define ESCSUBS     /* escape substitutions in multi-character commands */
 273: #define DELAYMARK   /* allow articles to be temporarily marked as read */
 274:             /* until exit from current newsgroup or Y command */
 275: #define MCHASE      /* unmark xrefed articles on m or M */
 276: #define MUNGHEADER  /* allow alternate header formatting via */
 277:             /* environment variable ALTHEADER (not impl) */
 278: #define ASYNC_PARSE /* allow parsing headers asyncronously to reading */
 279:             /* used by MCHASE and MUNGHEADER */
 280: #define FINDNEWNG   /* check for new newsgroups on startup */
 281: #define FASTNEW     /* do optimizations on FINDNEWNG for faster startup */
 282:             /* (this optimization can make occasional mistakes */
 283:             /* if a group is removed and another group of the */
 284:             /* same length is added, and if no softpointers are */
 285:             /* affected by said change.) */
 286: #define INNERSEARCH /* search command 'g' with article */
 287: #define CATCHUP     /* catchup command at newsgroup level */
 288: #define NGSEARCH    /* newsgroup pattern matching */
 289: #define ONLY        /* newsgroup restrictions by pattern */
 290: #define KILLFILES   /* automatic article killer files */
 291: #define ARTSEARCH   /* pattern searches among articles */
 292:             /* /, ?, ^N, ^P, k, K */
 293: 
 294: /* some dependencies among options */
 295: 
 296: #ifndef ARTSEARCH
 297: #   undef KILLFILES
 298: #   undef INNERSEARCH
 299: #   undef CACHESUBJ
 300: #endif
 301: 
 302: #ifndef DELAYMARK
 303: #   ifndef MCHASE
 304: #	ifndef MUNGHEADER
 305: #	    undef ASYNC_PARSE
 306: #	endif
 307: #   endif
 308: #endif
 309: 
 310: #ifndef SETUIDGID
 311: #   define eaccess access
 312: #endif
 313: 
 314: #ifdef ONLY             /* idiot lint doesn't grok #if */
 315: #   define NGSORONLY
 316: #else
 317: #   ifdef NGSEARCH
 318: #	define NGSORONLY
 319: #   endif
 320: #endif
 321: 
 322: #ifdef VERBOSE
 323: #   ifdef TERSE
 324: #	define IF(c) if (c)
 325: #	define ELSE else
 326: #   else !TERSE
 327: #	define IF(c)
 328: #	define ELSE
 329: #   endif
 330: #else !VERBOSE
 331: #   ifndef TERSE
 332: #	define TERSE
 333: #   endif
 334: #   define IF(c) "IF" outside of VERBOSE???
 335: #   define ELSE "ELSE" outside of VERBOSE???
 336: #endif
 337: 
 338: #ifdef DEBUGGING
 339: #   define assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__, __LINE__);sig_catcher(0);}}
 340: #else
 341: #   define assert(ex) ;
 342: #endif
 343: 
 344: #ifdef SPEEDOVERMEM
 345: #   define OFFSET(x) (x)
 346: #else
 347: #   define OFFSET(x) ((x)-absfirst)
 348: #endif
 349: 
 350: /* If you're strapped for space use the help messages in shell scripts */
 351: /* if {NG,ART,PAGER,SUBS}HELP is undefined, help messages are in memory */
 352: #ifdef MEMHELP  /* undef MEMHELP above to get them all as sh scripts */
 353: #   undef NGHELP
 354: #   undef ARTHELP
 355: #   undef PAGERHELP
 356: #   undef SUBSHELP
 357: #else
 358: #   ifndef NGHELP           /* % and ~ */
 359: #	define NGHELP "%X/ng.help"
 360: #   endif
 361: #   ifndef ARTHELP          /* % and ~ */
 362: #	define ARTHELP "%X/art.help"
 363: #   endif
 364: #   ifndef PAGERHELP        /* % and ~ */
 365: #	define PAGERHELP "%X/pager.help"
 366: #   endif
 367: #   ifndef SUBSHELP     /* % and ~ */
 368: #	define SUBSHELP "%X/subs.help"
 369: #   endif
 370: #endif
 371: 
 372: #ifdef CLEAREOL
 373: #   define TCSIZE 512   /* capacity for termcap strings */
 374: #else
 375: #   ifdef pdp11
 376: #	define TCSIZE 256 /* capacity for termcap strings */
 377: #   else
 378: #	define TCSIZE 512 /* capacity for termcap srings */
 379: #   endif
 380: #endif
 381: 
 382: /* Additional ideas:
 383:  *	Make the do_newsgroup() routine a separate process.
 384:  *	Keep .newsrc on disk instead of in memory.
 385:  *	Overlays, if you have them.
 386:  *	Get a bigger machine.
 387:  */
 388: 
 389: /* End of Space Conservation Section */
 390: 
 391: /* More System Dependencies */
 392: 
 393: /* news library */
 394: #ifndef LIB     /* ~ and %l only ("~%l" is permissable) */
 395: #   define LIB "/usr/lib/news"
 396: #endif
 397: 
 398: /* path to private executables */
 399: #ifndef RNLIB       /* ~, %x and %l only */
 400: #   define RNLIB "%x/rn"
 401: #endif
 402: 
 403: /* system-wide RNINIT switches */
 404: #ifndef GLOBINIT
 405: #   define GLOBINIT "%X/INIT"
 406: #endif
 407: 
 408: /* where to find news files */
 409: #ifndef SPOOL           /* % and ~ */
 410: #   define SPOOL "/usr/spool/news"
 411: #endif
 412: 
 413: /* file containing list of active newsgroups and max article numbers */
 414: #ifndef ACTIVE          /* % and ~ */
 415: #   define ACTIVE "%x/active"
 416: #endif
 417: 
 418: /* location of history file */
 419: #ifndef ARTFILE         /* % and ~ */
 420: #    define ARTFILE "%x/history"
 421: #endif
 422: 
 423: /* command to setup a new .newsrc */
 424: #ifndef NEWSETUP        /* % and ~ */
 425: #   define NEWSETUP "newsetup"
 426: #endif
 427: 
 428: /* command to display a list of un-subscribed-to newsgroups */
 429: #ifndef NEWSGROUPS      /* % and ~ */
 430: #   define NEWSGROUPS "newsgroups"
 431: #endif
 432: 
 433: /* preferred shell for use in doshell routine */
 434: /*  ksh or sh would be okay here */
 435: #ifndef PREFSHELL
 436: #   define PREFSHELL "/bin/csh"
 437: #endif
 438: 
 439: /* path to fastest starting shell */
 440: #ifndef SH
 441: #   define SH "/bin/sh"
 442: #endif
 443: 
 444: /* path to default editor */
 445: #ifndef DEFEDITOR
 446: #   define DEFEDITOR "/usr/ucb/vi"
 447: #endif
 448: 
 449: /* location of macro file */
 450: #ifndef RNMACRO
 451: #   ifdef PUSHBACK
 452: #	define RNMACRO "%./.rnmac"
 453: #   endif
 454: #endif
 455: 
 456: /* location of full name */
 457: #ifndef FULLNAMEFILE
 458: #   ifndef PASSNAMES
 459: #	define FULLNAMEFILE "%./.fullname"
 460: #   endif
 461: #endif
 462: 
 463: /* virtual array file name template */
 464: #ifndef VARYNAME        /* % and ~ */
 465: #   define VARYNAME "/tmp/rnvary.%$"
 466: #endif
 467: 
 468: /* file to pass header to followup article poster */
 469: #ifndef HEADNAME        /* % and ~ */
 470: #   define HEADNAME "%./.rnhead"
 471: /* or alternately #define HEADNAME "/tmp/rnhead.%$" */
 472: #endif
 473: 
 474: #ifndef MAKEDIR
 475: /* shell script to make n-deep subdirectories */
 476: #   ifndef DIRMAKER     /* % and ~ */
 477: #	define DIRMAKER "%X/makedir"
 478: #   endif
 479: #endif
 480: 
 481: /* location of newsrc file */
 482: #ifndef RCNAME      /* % and ~ */
 483: #   define RCNAME "%./.newsrc"
 484: #endif
 485: 
 486: /* temporary newsrc file in case we crash while writing out */
 487: #ifndef RCTNAME     /* % and ~ */
 488: #   define RCTNAME "%./.newnewsrc"
 489: #endif
 490: 
 491: /* newsrc file at the beginning of this session */
 492: #ifndef RCBNAME     /* % and ~ */
 493: #   define RCBNAME "%./.oldnewsrc"
 494: #endif
 495: 
 496: /* if existent, contains process number of current or crashed rn */
 497: #ifndef LOCKNAME        /* % and ~ */
 498: #   define LOCKNAME "%./.rnlock"
 499: #endif
 500: 
 501: /* information from last invocation of rn */
 502: #ifndef LASTNAME        /* % and ~ */
 503: #   define LASTNAME "%./.rnlast"
 504: #endif
 505: 
 506: /* file with soft pointers into the active file */
 507: #ifndef SOFTNAME        /* % and ~ */
 508: #   define SOFTNAME "%./.rnsoft"
 509: #endif
 510: 
 511: /* list of article numbers to mark as unread later (see M and Y cmmands) */
 512: #ifndef RNDELNAME       /* % and ~ */
 513: #   define RNDELNAME "%./.rndelay"
 514: #endif
 515: 
 516: /* a motd-like file for rn */
 517: #ifndef NEWSNEWSNAME        /* % and ~ */
 518: #   define NEWSNEWSNAME "%X/newsnews"
 519: #endif
 520: 
 521: /* command to send a reply */
 522: #ifndef MAILPOSTER      /* % and ~ */
 523: #   define MAILPOSTER "Rnmail -h %h"
 524: #endif
 525: 
 526: #ifdef INTERNET
 527: #   ifndef MAILHEADER       /* % */
 528: #	ifdef CONDSUB
 529: #	    define MAILHEADER "To: %t\nSubject: Re: %S\nNewsgroups: %n\nIn-Reply-To: %i\n%(%[references]!=^$?References\\: %[references]\n)Organization: %o\nCc: \nBcc: \n\n"
 530: #	else
 531: #	    define MAILHEADER "To: %t\nSubject: Re: %S\nNewsgroups: %n\nIn-Reply-To: %i\nReferences: %[references]\nCc: \nBcc: \n\n"
 532: #	endif
 533: #   endif
 534: #else
 535: #   ifndef MAILHEADER       /* % */
 536: #	ifdef CONDSUB
 537: #	    define MAILHEADER "To: %T\nSubject: %(%i=^$?:Re: %S\nNewsgroups: %n\nIn-Reply-To: %i)\n%(%[references]!=^$?References\\: %[references]\n)Organization: %o\nCc: \nBcc: \n\n"
 538: #	else
 539: #	    define MAILHEADER "To: %T\nSubject: Re: %S\nNewsgroups: %n\nIn-Reply-To: %i\nReferences: %[references]\nCc: \nBcc: \n\n"
 540: #	endif
 541: #   endif
 542: #endif
 543: 
 544: #ifndef YOUSAID         /* % */
 545: #   define YOUSAID "In article %i you write:"
 546: #endif
 547: 
 548: /* command to submit a followup article */
 549: #ifndef NEWSPOSTER      /* % and ~ */
 550: #   define NEWSPOSTER "Pnews -h %h"
 551: #endif
 552: 
 553: #ifndef NEWSHEADER      /* % */
 554: #   ifdef CONDSUB
 555: #	define NEWSHEADER "Newsgroups: %(%F=^$?%C:%F)\nSubject: %(%S=^$?%\"\n\nSubject: \":Re: %S)\nSummary: \nExpires: \n%(%R=^$?:References: %R\n)Sender: \nReply-To: %L@%H.UUCP (%N)\nFollowup-To: \nDistribution: %(%i=^$?%\"Distribution: \":%D)\nOrganization: %o\nKeywords: %[keywords]\n\n"
 556: #   else
 557: #	define NEWSHEADER "Newsgroups: %F\nSubject: Re: %S\nSummary: \nExpires: \nReferences: %R\nSender: \nReply-To: %L@%H.UUCP (%N)\nFollowup-To: \nDistribution: %D\nOrganization: %o\nKeywords: %[keywords]\n\n"
 558: #   endif
 559: #endif
 560: 
 561: #ifndef ATTRIBUTION     /* % */
 562: #   define ATTRIBUTION "In article %i %f writes:"
 563: #endif
 564: 
 565: #ifndef PIPESAVER       /* % */
 566: #   ifdef CONDSUB
 567: #	define PIPESAVER "%(%B=^0$?<%A:tail +%Bc %A |) %b"
 568: #   else
 569: #	define PIPESAVER "tail +%Bc %A | %b"
 570: #   endif
 571: #endif
 572: 
 573: #ifndef NORMSAVER       /* % and ~ */
 574: #   define NORMSAVER "%X/norm.saver %A %P %c %a %B %C \"%b\""
 575: #endif
 576: 
 577: #ifndef MBOXSAVER       /* % and ~ */
 578: #   ifdef MININACT      /* 2.10.2 site? */
 579: #	define MBOXSAVER "%X/mbox.saver %A %P %c %a %B %C \"%b\" \"From %T %`date`\""
 580: #   else
 581: #	ifdef CONDSUB
 582: #	    define MBOXSAVER "%X/mbox.saver %A %P %c %a %B %C \"%b\" \"From %T %(%[date]=^\\(\\w*\\), \\(\\w*\\)-\\(\\w*\\)-\\(\\w*\\) \\([^ ]*\\)?%1 %3 %(%2=..?%2: %2) %5 19%4)\""
 583:                     /* header munging with a vengeance */
 584: #	else
 585: #	    define MBOXSAVER "%X/mbox.saver %A %P %c %a %B %C \"%b\" \"From %T %[posted]\""
 586: #	endif
 587: #   endif
 588: #endif
 589: 
 590: #ifdef MKDIRS
 591: 
 592: #   ifndef SAVEDIR          /* % and ~ */
 593: #	define SAVEDIR "%p/%c"
 594: #   endif
 595: #   ifndef SAVENAME     /* % */
 596: #	define SAVENAME "%a"
 597: #   endif
 598: 
 599: #else
 600: 
 601: #   ifndef SAVEDIR          /* % and ~ */
 602: #	define SAVEDIR "%p"
 603: #   endif
 604: #   ifndef SAVENAME     /* % */
 605: #	define SAVENAME "%^C"
 606: #   endif
 607: 
 608: #endif
 609: 
 610: #ifndef KILLGLOBAL      /* % and ~ */
 611: #   define KILLGLOBAL "%p/KILL"
 612: #endif
 613: 
 614: #ifndef KILLLOCAL       /* % and ~ */
 615: #   define KILLLOCAL "%p/%c/KILL"
 616: #endif
 617: 
 618: /* how to cancel an article */
 619: #ifndef CANCEL
 620: #   ifdef MININACT          /* 2.10.2 ? */
 621: #	define CANCEL "%x/inews -h < %h"
 622: #   else
 623: #	define CANCEL "inews -h < %h"
 624: #   endif
 625: #endif
 626: 
 627: /* how to cancel an article, continued */
 628: #ifndef CANCELHEADER
 629: #   define CANCELHEADER "Newsgroups: %n\nSubject: cmsg cancel %i\nReferences: %R\nReply-To: %L@%H.UUCP (%N)\nDistribution: %D\nOrganization: %o\n"
 630: #endif
 631: 
 632: /* where to find the mail file */
 633: #ifndef MAILFILE
 634: #   define MAILFILE "/usr/spool/mail/%L"
 635: #endif
 636: 
 637: /* some important types */
 638: 
 639: typedef int     NG_NUM;     /* newsgroup number */
 640: typedef long        ART_NUM;    /* article number */
 641: #ifdef pdp11
 642:     typedef short   ART_UNREAD; /* ordinarily this should be long */
 643:                     /* like ART_NUM, but assuming that */
 644:                     /* we stay less than 32767 articles */
 645:                     /* behind saves a lot of space. */
 646:                     /* NOTE: do not make unsigned. */
 647: #else
 648:     typedef long    ART_UNREAD;
 649: #endif
 650: typedef long        ART_POS;    /* char position in article file */
 651: typedef int     ART_LINE;   /* line position in article file */
 652: typedef short       ACT_POS;    /* char position in active file */
 653: typedef unsigned int    MEM_SIZE;   /* for passing to malloc */
 654: 
 655: /* *** end of the machine dependent stuff *** */
 656: 
 657: /* GLOBAL THINGS */
 658: 
 659: /* file statistics area */
 660: 
 661: EXT struct stat filestat;
 662: 
 663: /* various things of type char */
 664: 
 665: char    *index();
 666: char    *rindex();
 667: char    *getenv();
 668: char    *strcat();
 669: char    *strcpy();
 670: char    *sprintf();
 671: 
 672: EXT char buf[LBUFLEN+1];    /* general purpose line buffer */
 673: EXT char cmd_buf[CBUFLEN];  /* buffer for formatting system commands */
 674: 
 675: EXT char *indstr INIT(">"); /* indent for old article embedded in followup */
 676: 
 677: EXT char *cwd INIT(Nullch);     /* current working directory */
 678: EXT char *dfltcmd INIT(Nullch); /* 1st char is default command */
 679: 
 680: /* switches */
 681: 
 682: #ifdef DEBUGGING
 683:     EXT int debug INIT(0);              /* -D */
 684: #   define DEB_INNERSRCH 32
 685: #   define DEB_FILEXP 64
 686: #   define DEB_HASH 128
 687: #   define DEB_XREF_MARKER 256
 688: #   define DEB_CTLAREA_BITMAP 512
 689: #   define DEB_SOFT_POINTERS 1024
 690: #   define DEB_NEWSRC_LINE 2048
 691: #   define DEB_SEARCH_AHEAD 4096
 692: #   define DEB_CHECKPOINTING 8192
 693: #   define DEB_FEED_XREF 16384
 694: #endif
 695: 
 696: #ifdef ARTSEARCH
 697:     EXT int scanon INIT(0);             /* -S */
 698: #endif
 699: 
 700: EXT bool mbox_always INIT(FALSE);           /* -M */
 701: EXT bool norm_always INIT(FALSE);           /* -N */
 702: EXT bool checkflag INIT(FALSE);         /* -c */
 703: EXT bool suppress_cn INIT(FALSE);           /* -s */
 704: EXT int countdown INIT(5);  /* how many lines to list before invoking -s */
 705: EXT bool muck_up_clear INIT(FALSE);         /* -loco */
 706: EXT bool erase_screen INIT(FALSE);          /* -e */
 707: #ifdef CLEAREOL
 708: EXT bool can_home_clear INIT(FALSE);        /* fancy -e -- PWP */
 709: #endif CLEAREOL
 710: EXT bool findlast INIT(FALSE);          /* -r */
 711: EXT bool typeahead INIT(FALSE);         /* -T */
 712: #ifdef VERBOSE
 713: #   ifdef TERSE
 714:     EXT bool verbose INIT(TRUE);            /* +t */
 715: #   endif
 716: #endif
 717: #ifdef VERIFY
 718:     EXT bool verify INIT(FALSE);            /* -v */
 719: #endif
 720: 
 721: #define NOMARKING 0
 722: #define STANDOUT 1
 723: #define UNDERLINE 2
 724: EXT int marking INIT(NOMARKING);            /* -m */
 725: 
 726: EXT ART_LINE initlines INIT(0);     /* -i */
 727: 
 728: /* miscellania */
 729: 
 730: long atol(), fseek(), ftell();
 731: EXT bool in_ng INIT(FALSE);     /* current state of rn */
 732: EXT char mode INIT('i');        /* current state of rn */
 733: 
 734: EXT FILE *tmpfp INIT(Nullfp);   /* scratch fp used for .rnlock, .rnlast, etc. */
 735: 
 736: EXT NG_NUM nextrcline INIT(0);  /* 1st unused slot in rcline array */
 737:             /* startup to avoid checking twice in a row */
 738: 
 739: extern errno;
 740: 
 741: /* Factored strings */
 742: 
 743: EXT char nullstr[] INIT("");
 744: EXT char sh[] INIT(SH);
 745: EXT char defeditor[] INIT(DEFEDITOR);
 746: EXT char hforhelp[] INIT("Type h for help.\n");
 747: #ifdef STRICTCR
 748: EXT char badcr[] INIT("\nUnnecessary CR ignored.\n");
 749: #endif
 750: EXT char readerr[] INIT("rn read error");
 751: EXT char unsubto[] INIT("\n\nUnsubscribed to newsgroup %s\n");
 752: EXT char cantopen[] INIT("Can't open %s\n");
 753: EXT char cantcreate[] INIT("Can't create %s\n");
 754: 
 755: #ifdef VERBOSE
 756:     EXT char nocd[] INIT("Can't chdir to directory %s\n");
 757: #else
 758:     EXT char nocd[] INIT("Can't find %s\n");
 759: #endif
 760: 
 761: #ifdef NOLINEBUF
 762: #define FLUSH ,fflush(stdout)
 763: #else
 764: #define FLUSH
 765: #endif
 766: 
 767: #ifdef lint
 768: #undef FLUSH
 769: #define FLUSH
 770: #undef putchar
 771: #define putchar(c)
 772: #endif

Defined variables

badcr defined in line 748; used 2 times
buf defined in line 672; used 268 times
countdown defined in line 704; used 7 times
cwd defined in line 677; used 21 times
defeditor defined in line 745; used 1 times
dfltcmd defined in line 678; used 15 times
indstr defined in line 675; used 5 times
initlines defined in line 726; used 9 times
marking defined in line 724; used 13 times
mode defined in line 732; used 18 times
nextrcline defined in line 736; used 70 times
nocd defined in line 758; used 10 times
readerr defined in line 750; used 1 times
scanon defined in line 697; used 7 times
unsubto defined in line 751; used 2 times

Defined typedef's

ACT_POS defined in line 652; used 8 times
ART_LINE defined in line 651; used 9 times
ART_UNREAD defined in line 642; used 7 times
NG_NUM defined in line 639; used 25 times

Defined macros

ACTIVE defined in line 415; used 3 times
ARTFILE defined in line 420; used 3 times
ARTHELP defined in line 362; used 4 times
ARTSEARCH defined in line 291; used 22 times
ATTRIBUTION defined in line 562; used 2 times
BACKTICK defined in line 239; used 2 times
BAUDMOD defined in line 243; used 1 times
BERKELEY defined in line 89; never used
BITSPERBYTE defined in line 52; used 12 times
BSD42 defined in line 93; used 2 times
CACHEFIRST defined in line 266; used 15 times
CACHESUBJ defined in line 263; used 15 times
CANCEL defined in line 623; used 2 times
CANCELHEADER defined in line 629; used 2 times
CATCHUP defined in line 287; used 3 times
CBUFLEN defined in line 59; used 5 times
CLEAREOL defined in line 232; used 15 times
CONDSUB defined in line 238; used 10 times
CUSTOMLINES defined in line 227; used 7 times
Ctl defined in line 79; used 35 times
DEB_CHECKPOINTING defined in line 692; used 3 times
DEB_CTLAREA_BITMAP defined in line 688; used 3 times
DEB_FEED_XREF defined in line 693; used 1 times
DEB_FILEXP defined in line 685; used 8 times
DEB_HASH defined in line 686; used 3 times
DEB_INNERSRCH defined in line 684; used 9 times
DEB_NEWSRC_LINE defined in line 690; used 2 times
DEB_SEARCH_AHEAD defined in line 691; used 2 times
DEB_SOFT_POINTERS defined in line 689; used 3 times
DEB_XREF_MARKER defined in line 687; used 9 times
DEFEDITOR defined in line 446; used 2 times
DELBOGUS defined in line 270; used 1 times
DIRMAKER defined in line 477; used 2 times
ESCSUBS defined in line 272; used 2 times
FASTNEW defined in line 281; used 3 times
FINDNEWNG defined in line 280; used 6 times
FINISHCMD defined in line 68; used 5 times
FLUSH defined in line 769; used 296 times
FULLNAMEFILE defined in line 459; used 2 times
GCOSFIELD defined in line 203; used 2 times
GETLOGIN defined in line 244; used 1 times
GETWD defined in line 249; used 1 times
GLOBINIT defined in line 405; used 2 times
HASHNG defined in line 236; used 8 times
HASHSIZ defined in line 217; used 9 times
HEADNAME defined in line 470; used 2 times
INNERSEARCH defined in line 286; used 18 times
KILLFILES defined in line 290; used 9 times
KILLGLOBAL defined in line 611; used 2 times
KILLLOCAL defined in line 615; used 2 times
LASTNAME defined in line 503; used 2 times
LIB defined in line 395; used 2 times
LINKART defined in line 105; used 3 times
LOCKNAME defined in line 498; used 2 times
LOGDIRFIELD defined in line 196; used 2 times
LONGKEY defined in line 67; used 2 times
MAILCALL defined in line 231; used 4 times
MAILFILE defined in line 634; used 2 times
MAILHEADER defined in line 539; used 3 times
MAILPOSTER defined in line 523; used 2 times
MAKEDIR defined in line 255; used 2 times
MAXFILENAME defined in line 65; used 1 times
MAXRCLINE defined in line 213; used 2 times
MBOXCHAR defined in line 183; used 3 times
MBOXSAVER defined in line 585; used 2 times
MCHASE defined in line 275; used 5 times
MEMHELP defined in line 256; used 1 times
MUNGHEADER defined in line 276; used 1 times
NEWSETUP defined in line 425; used 2 times
NEWSGROUPS defined in line 430; used 2 times
NEWSHEADER defined in line 557; used 2 times
NEWSNEWSNAME defined in line 518; used 2 times
NEWSPOSTER defined in line 550; used 2 times
NGHELP defined in line 359; used 4 times
NGMAX defined in line 218; used 1 times
NGSEARCH defined in line 288; used 3 times
NGSORONLY defined in line 318; used 2 times
NOFIREWORKS defined in line 233; used 7 times
NOMARKING defined in line 721; used 35 times
NORMSAVER defined in line 574; used 2 times
Null defined in line 75; used 24 times
OFFSET defined in line 347; used 16 times
ONLY defined in line 289; used 8 times
ORGFILE defined in line 246; used 1 times
ORGNAME defined in line 179; used 2 times
PAGERHELP defined in line 365; used 4 times
PENDING defined in line 100; used 8 times
PIPESAVER defined in line 569; used 2 times
PREFSHELL defined in line 436; used 2 times
PROMPTTTY defined in line 240; used 2 times
PUSHBACK defined in line 228; used 13 times
PUSHSIZE defined in line 60; used 5 times
RCBNAME defined in line 493; used 2 times
RCNAME defined in line 483; used 2 times
RCTNAME defined in line 488; used 2 times
RELOCATE defined in line 271; used 6 times
RNDELNAME defined in line 513; used 2 times
RNLIB defined in line 400; used 2 times
RNMACRO defined in line 452; used 2 times
ROOTID defined in line 187; used 3 times
ROTATION defined in line 269; used 9 times
SAVEDIR defined in line 602; used 4 times
SAVENAME defined in line 605; used 3 times
SETENV defined in line 248; used 3 times
SETUIDGID defined in line 251; used 2 times
SH defined in line 441; used 3 times
SOFTNAME defined in line 508; used 2 times
SPEEDOVERMEM defined in line 229; used 4 times
SPOOL defined in line 410; used 2 times
SUBSHELP defined in line 368; used 4 times
TCSIZE defined in line 378; used 1 times
TERMMOD defined in line 242; used 1 times
TILDENAME defined in line 247; used 3 times
ULSMARTS defined in line 241; used 4 times
UNDERLINE defined in line 723; used 4 times
VARYNAME defined in line 465; used 2 times
VARYSIZE defined in line 220; used 2 times
WORDERASE defined in line 230; used 1 times
YOUSAID defined in line 545; used 2 times
assert defined in line 341; used 5 times
eaccess defined in line 311; used 4 times
isalnum defined in line 29; used 1 times
  • in line 28
putchar defined in line 771; used 1 times
sigignore defined in line 192; used 2 times
sigset defined in line 191; used 23 times
strEQ defined in line 82; used 10 times
strNE defined in line 81; used 5 times
strnNE defined in line 83; used 3 times

Usage of this include

Last modified: 1985-06-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3061
Valid CSS Valid XHTML 1.0 Strict