Annotation of 43BSDTahoe/new/rn/common.h, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.