lwall@sdcrdcf.UUCP (Larry Wall) (10/03/84)
#! /bin/sh # Make a new directory for the rn sources, cd to it, and run kits 1 thru 8 # through sh. When all 8 kits have been run, read README. echo "This is rn kit 7 (of 8). If kit 7 is complete, the line" echo '"'"End of kit 7 (of 8)"'" will echo at the end.' echo "" export PATH || (echo "You didn't use sh, you clunch." ; kill $$) echo Extracting final.c cat >final.c <<'!STUFFY!FUNK!' /* $Header: final.c,v 4.1 84/09/24 11:46:35 lwall Exp $ * * $Log: final.c,v $ * Revision 4.1 84/09/24 11:46:35 lwall * Real baseline. * * Revision 4.0.1.3 84/09/19 11:23:00 lwall * SIGTTOU not ignored til sig_catcher(). * * Revision 4.0.1.2 84/09/13 12:04:45 lwall * UNLINK for Eunice. * * Revision 4.0.1.1 84/09/10 15:10:50 lwall * Delinted. * * Revision 4.0 84/09/04 09:50:14 lwall * Baseline for netwide release * */ #include "EXTERN.h" #include "common.h" #include "util.h" #include "term.h" #include "ng.h" #include "init.h" #include "bits.h" #include "last.h" #include "rcstuff.h" #include "INTERN.h" #include "final.h" void final_init() { #ifdef SIGTSTP sigset(SIGTSTP, stop_catcher); /* job control signals */ sigset(SIGCONT, cont_catcher); /* job control signals */ #endif sigset(SIGINT, int_catcher); /* always catch interrupts */ sigset(SIGHUP, sig_catcher); /* and hangups */ sigignore(SIGEMT); sigset(SIGILL, sig_catcher); sigset(SIGTRAP, sig_catcher); sigset(SIGFPE, sig_catcher); sigset(SIGBUS, sig_catcher); sigset(SIGSEGV, sig_catcher); sigset(SIGSYS, sig_catcher); sigset(SIGTERM, sig_catcher); #ifdef SIGXCPU sigset(SIGXCPU, sig_catcher); #endif #ifdef SIGXFSZ sigset(SIGXFSZ, sig_catcher); #endif } void /* very much void */ finalize(status) int status; { if (bizarre) resetty(); UNLINK(lockname); if (status < 0) { chdir("/usr/tmp"); sigset(SIGILL,SIG_DFL); abort(); } exit(status); } /* come here on interrupt */ void int_catcher() { sigset(SIGINT,int_catcher); #ifdef DEBUGGING if (debug) write(2,"int_catcher\n",12); #endif if (!waiting) { if (int_count) { /* was there already an interrupt? */ write(2,"\nBye-bye.\n",10); sig_catcher(0); /* emulate the other signals */ } int_count++; } } /* come here on signal other than interrupt, stop, or cont */ void sig_catcher(signo) { #ifdef VERBOSE static char *signame[] = { "???", "HUP", "INT", "QUIT", "ILL", "TRAP", "IOT", "EMT", "FPE", "KILL", "BUS", "SEGV", "SYS", "PIPE", "ALRM", "TERM", "???" #ifdef SIGTSTP ,"STOP", "TSTP", "CONT", "CHLD", "TTIN", "TTOU", "TINT", "XCPU", "XFSZ" #ifdef SIGPROF ,"VTALARM", "PROF" #endif #endif }; #endif #ifdef SIGTTOU sigignore(SIGTTOU); #endif #ifdef DEBUGGING if (debug) { printf("\nSIG%s--.newsrc not restored in debug\n",signame[signo]); finalize(-1); } #endif panic = TRUE; /* disable terminal I/O */ if (doing_ng) { /* need we reconstitute rc line? */ yankback(); restore_ng(); /* then do so (hope this works) */ } doing_ng = FALSE; if (rc_changed) /* need we write .newsrc out? */ write_rc(); /* then do so */ rc_changed = FALSE; if (signo && signo != SIGHUP) #ifdef VERBOSE IF(verbose) printf("\nCaught a SIG%s--.newsrc restored\n",signame[signo]); ELSE #endif #ifdef TERSE printf("\nSignal %d--bye bye\n",signo); #endif switch (signo) { case SIGBUS: case SIGILL: case SIGSEGV: finalize(-signo); } finalize(1); /* and blow up */ } #ifdef SIGTSTP /* come here on stop signal */ void stop_catcher() { if (!waiting) { checkpoint_rc(); /* good chance of crash while stopped */ resetty(); /* this is the point of all this */ #ifdef DEBUGGING if (debug) write(2,"stop_catcher\n",13); #endif sigset(SIGTSTP,SIG_DFL); /* enable stop */ #ifdef BSD42 sigsetmask(sigblock(0) & ~(1 << (SIGTSTP-1))); #endif kill(0,SIGTSTP); /* and do the stop */ } sigset(SIGTSTP,stop_catcher); /* unenable the stop */ } /* come here on cont signal */ void cont_catcher() { sigset(SIGCONT,cont_catcher); #ifdef MAILCALL; mailcount = 0; /* force recheck */ #endif if (!panic) { if (!waiting) { #ifdef DEBUGGING if (debug) write(2,"cont_catcher\n",13); #endif noecho(); /* set no echo */ crmode(); /* set cbreak mode */ forceme("\f"); /* cause a refresh */ /* (defined only if TIOCSTI defined) */ } } } #endif !STUFFY!FUNK! echo Extracting ngdata.c cat >ngdata.c <<'!STUFFY!FUNK!' /* $Header: ngdata.c,v 4.1 84/09/24 12:02:49 lwall Exp $ * * $Log: ngdata.c,v $ * Revision 4.1 84/09/24 12:02:49 lwall * Real baseline. * * Revision 4.0.1.3 84/09/12 17:16:13 lwall * Ndir stuff. * * Revision 4.0.1.2 84/09/10 15:20:07 lwall * Delinted. * * Revision 4.0.1.1 84/09/06 08:10:18 lwall * Getngmin now uses correct Null for directory stuff. * * Revision 4.0 84/09/04 09:51:45 lwall * Baseline for netwide release * */ #include "EXTERN.h" #include "common.h" #include "ndir.h" #include "rcstuff.h" #include "rn.h" #include "intrp.h" #include "final.h" #include "rcln.h" #include "INTERN.h" #include "ngdata.h" void ngdata_init() { /* The following is only for systems that do not zero globals properly */ #ifdef ZEROGLOB # ifdef CACHEFIRST for (i=0; i<MAXRCLINE; i++) abs1st[i] = 0; # endif #endif /* ZEROGLOB */ /* open the active file */ actfp = fopen(filexp(ACTIVE),"r"); if (actfp == Nullfp) { fputs("Can't find active file.\n",stdout); finalize(1); } } /* find the maximum article number of a newsgroup */ ART_NUM getngsize(num) register NG_NUM num; { register int len; register char *nam; char tmpbuf[80]; nam = rcline[num]; len = rcnums[num] - 1; softtries++; fseek(actfp,1024L,1); /* hopefully this forces a reread */ #ifdef DEBUGGING if (debug & DEB_SOFT_POINTERS) printf("Softptr = %ld\n",(long)softptr[num]); #endif if (fseek(actfp,(long)softptr[num],0) < 0 || fgets(tmpbuf,80,actfp) == Nullch || tmpbuf[len] != ' ' || strnNE(tmpbuf,nam,len)) { #ifdef DEBUGGING if (debug & DEB_SOFT_POINTERS) printf("Missed, looking for %s in %sLen = %d\n",nam,tmpbuf,len); #endif softmisses++; fseek(actfp,0L,0); softptr[num] = 0; while (fgets(tmpbuf,80,actfp) != Nullch) { if (tmpbuf[len] != ' ' || strnNE(tmpbuf,nam,len)) { /*NOSTRICT*/ softptr[num] = (ACT_POS) ftell(actfp); continue; } writesoft = TRUE; /* force update on .rnsoft */ goto foundit; } if (rcchar[num] == ':') /* unsubscribe quietly */ rcchar[num] = NEGCHAR; return TR_BOGUS; /* well, not so quietly, actually */ } foundit: #ifdef DEBUGGING if (debug & DEB_SOFT_POINTERS) { printf("Should be %ld\n",(long)softptr[num]); } #endif #ifdef MININACT { char *s; int tmp; for (s=tmpbuf+len+1; isdigit(*s); s++) ; if (tmp = atol(s)) #ifdef CACHEFIRST abs1st[num] = tmp; #else abs1st = tmp; #endif } #endif return atol(tmpbuf+len+1); } /* determine the absolutely first existing article number */ ART_NUM getabsfirst(ngnum,ngsize) register NG_NUM ngnum; ART_NUM ngsize; { register ART_NUM a1st; char dirname[MAXFILENAME]; #ifdef CACHEFIRST if (a1st = abs1st[ngnum]) return a1st; #endif #ifdef MININACT getngsize(ngnum); # ifdef CACHEFIRST return abs1st[ngnum]; # else return abs1st; # endif #else sprintf(dirname,"%s/%s",spool,getngdir(rcline[ngnum])); a1st = getngmin(dirname,0L); if (!a1st) /* nothing there at all? */ a1st = ngsize+1; /* aim them at end of newsgroup */ # ifdef CACHEFIRST abs1st[ngnum] = a1st; # endif return a1st; #endif MININACT } /* scan a directory for minimum article number greater than floor */ ART_NUM getngmin(dirname,floor) char *dirname; ART_NUM floor; { register DIR *dirp; register struct direct *dp; register ART_NUM min = 1000000; register ART_NUM maybe; register char *p; char tmpbuf[128]; dirp = opendir(dirname); if (!dirp) return 0; while ((dp = readdir(dirp)) != Null(struct direct *)) { if ((maybe = atoi(dp->d_name)) < min && maybe > floor) { for (p = dp->d_name; *p; p++) if (!isdigit(*p)) goto nope; if (*dirname == '.' && !dirname[1]) stat(dp->d_name, &filestat); else { sprintf(tmpbuf,"%s/%s",dirname,dp->d_name); stat(tmpbuf, &filestat); } if (! (filestat.st_mode & S_IFDIR)) min = maybe; } nope: ; } closedir(dirp); return min==1000000 ? 0 : min; } !STUFFY!FUNK! echo Extracting newsetup.SH cat >newsetup.SH <<'!STUFFY!FUNK!' case $CONFIG in '') . config.sh ;; esac echo "Extracting newsetup (with variable substitutions)" $spitshell >newsetup <<!GROK!THIS! $startsh # $Header: newsetup.SH,v 4.1 84/09/24 12:01:10 lwall Exp $ # # $Log: newsetup.SH,v $ # Revision 4.1 84/09/24 12:01:10 lwall # Real baseline. # # Revision 4.0.1.2 84/09/12 15:21:47 lwall # Check for sh interpretation. # # Revision 4.0.1.1 84/09/05 10:36:13 lwall # Now removes n.tmp file. # # Revision 4.0 84/09/04 09:51:30 lwall # Baseline for netwide release # export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$) : syntax: newsetup : System dependencies : You will want to change the definitions below to reflect the distribution : areas around you. If you have more areas than this you will need to modify : the sed below. locorg="$locpref" organization="$orgpref" city="$citypref" state="$statepref" cntry="$cntrypref" cont="$contpref" active="${active-/usr/lib/news/active}" dotdir="\${DOTDIR-\${HOME-\$LOGDIR}}" $echo "Creating .newsrc in \$dotdir to used by news programs." case \$active in ~*) active=\`$filexp \$active\` ;; esac : NOTE: SED WILL NOT TAKE MORE THAN 10 WFILES, SO BEWARE $sort <\$active | $sed >/tmp/n.tmp\$\$ \\ -e 's/^\([^ ]*\) .*\$/\1:/' \\ -e '/^control:/{' \\ -e " w /tmp/n.test\$\$" \\ -e ' d' \\ -e '}' \\ -e '/^junk:/{' \\ -e " w /tmp/n.test\$\$" \\ -e ' d' \\ -e '}' \\ -e '/test:/{' \\ -e " w /tmp/n.test\$\$" \\ -e ' d' \\ -e '}' \\ -e "/^net\./{" \\ -e " w /tmp/n.net\$\$" \\ -e ' d' \\ -e '}' \\ -e "/^mod\./{" \\ -e " w /tmp/n.mod\$\$" \\ -e ' d' \\ -e '}' \\ -e "/^\$locorg\./{" \\ -e " w /tmp/n.\$locorg\$\$" \\ -e ' d' \\ -e '}' \\ -e "/^\$organization\./{" \\ -e " w /tmp/n.\$organization\$\$" \\ -e ' d' \\ -e '}' \\ -e "/^\$city\./{" \\ -e " w /tmp/n.\$city\$\$" \\ -e ' d' \\ -e '}' \\ -e "/^\$state\./{" \\ -e " w /tmp/n.\$state\$\$" \\ -e ' d' \\ -e '}' \\ -e "/^fa\./{" \\ -e " w /tmp/n.fa\$\$" \\ -e ' d' \\ -e '}' $sed </tmp/n.tmp\$\$ >/tmp/n.local\$\$ \\ -e "/^\$cntry\./{" \\ -e " w /tmp/n.\$cntry\$\$" \\ -e ' d' \\ -e '}' \\ -e "/^\$cont\./{" \\ -e " w /tmp/n.\$cont\$\$" \\ -e ' d' \\ -e '}' \\ -e "/^to\./{" \\ -e " w /tmp/n.to\$\$" \\ -e ' d' \\ -e '}' \\ -e "/\./{" \\ -e " w /tmp/n.misc\$\$" \\ -e ' d' \\ -e '}' if $test -s \$dotdir/.newsrc ; then $echo "Saving your current .newsrc as .oldnewsrc..." $mv -f \$dotdir/.newsrc \$dotdir/.oldnewsrc fi : newsrc order determined here $cat \\ /tmp/n.local\$\$ \\ /tmp/n.\$locorg\$\$ \\ /tmp/n.\$organization\$\$ \\ /tmp/n.\$city\$\$ \\ /tmp/n.\$state\$\$ \\ /tmp/n.\$cntry\$\$ \\ /tmp/n.\$cont\$\$ \\ /tmp/n.mod\$\$ \\ /tmp/n.net\$\$ \\ /tmp/n.fa\$\$ \\ /tmp/n.misc\$\$ \\ /tmp/n.test\$\$ \\ | $uniq >\$dotdir/.newsrc $rm -f /tmp/n.to\$\$ \\ /tmp/n.tmp\$\$ \\ /tmp/n.local\$\$ \\ /tmp/n.\$locorg\$\$ \\ /tmp/n.\$organization\$\$ \\ /tmp/n.\$city\$\$ \\ /tmp/n.\$state\$\$ \\ /tmp/n.\$cntry\$\$ \\ /tmp/n.\$cont\$\$ \\ /tmp/n.mod\$\$ \\ /tmp/n.net\$\$ \\ /tmp/n.fa\$\$ \\ /tmp/n.misc\$\$ \\ /tmp/n.test\$\$ $cat <<'EOH' Done. If you have never used the news system before, you may find the articles in net.announce.newuser to be helpful. There is also a manual entry for rn. To get rid of newsgroups you aren't interested in, use the 'u' command. Type h for help at any time while running rn. EOH !GROK!THIS! $eunicefix newsetup chmod 755 newsetup !STUFFY!FUNK! echo Extracting head.h cat >head.h <<'!STUFFY!FUNK!' /* $Header: head.h,v 4.1 84/09/24 11:47:47 lwall Exp $ * * $Log: head.h,v $ * Revision 4.1 84/09/24 11:47:47 lwall * Real baseline. * * Revision 4.0.1.1 84/09/10 15:11:28 lwall * Delinted. * * Revision 4.0 84/09/04 09:50:20 lwall * Baseline for netwide release * */ #define HEAD_FIRST 1 /* types of header lines (if only C really believed in enums) * (These must stay in alphabetic order at least in the first letter. * Within each letter it helps to arrange in increasing likelihood.) */ #define PAST_HEADER 0 /* body */ #define SOME_LINE 1 /* unrecognized */ #define ARTID_LINE 2 /* article-i.d. */ #define DIST_LINE 3 /* distribution */ #define DATE_LINE 4 /* date */ #define RECEIVED_LINE 5 /* date-received */ #define EXPIR_LINE 6 /* expires */ #define FOLLOW_LINE 7 /* followup-to */ #define FROM_LINE 8 /* from */ #define KEYW_LINE 9 /* keywords */ #define LINES_LINE 10 /* lines */ #define MESSID_LINE 11 /* message-id */ #define NFFR_LINE 12 /* nf-from */ #define NFID_LINE 13 /* nf-id */ #define NGS_LINE 14 /* newsgroups */ #define ORG_LINE 15 /* organization */ #define PATH_LINE 16 /* path */ #define POSTED_LINE 17 /* posted */ #define PVER_LINE 18 /* posting-version */ #define REPLY_LINE 19 /* reply-to */ #define REFS_LINE 20 /* references */ #define RVER_LINE 21 /* relay-version */ #define SENDER_LINE 22 /* sender */ #define SUMRY_LINE 23 /* summary */ #define SUBJ_LINE 24 /* subject */ #define XREF_LINE 25 /* xref */ #define HEAD_LAST 26 /* one more than the last one above */ struct headtype { char *ht_name; /* header line identifier */ #ifdef pdp11 short ht_minpos; short ht_maxpos; #else ART_POS ht_minpos; /* pointer to beginning of line in article */ ART_POS ht_maxpos; /* pointer to end of line in article */ #endif char ht_length; /* could make these into nybbles but */ char ht_flags; /* it wouldn't save space normally */ }; /* due to alignment considerations */ #define HT_HIDE 1 /* -h on this line */ #define HT_MAGIC 2 /* do any special processing on this line */ /* This array must stay in the same order as the list above */ #ifndef DOINIT EXT struct headtype htype[HEAD_LAST]; #else struct headtype htype[HEAD_LAST] = { /* name minpos maxpos length flag */ {"BODY", 0, 0, 4, 0 }, {"unrecognized", 0, 0, 12, 0 }, {"article-i.d.", 0, 0, 12, HT_HIDE }, {"distribution", 0, 0, 12, 0 }, {"date", 0, 0, 4, 0 }, {"date-received", 0, 0, 13, 0 }, {"expires", 0, 0, 7, HT_HIDE|HT_MAGIC}, {"followup-to", 0, 0, 11, 0 }, {"from", 0, 0, 4, 0 }, {"keywords", 0, 0, 8, 0 }, {"lines", 0, 0, 5, 0 }, {"message-id", 0, 0, 10, 0 }, {"nf-from", 0, 0, 7, HT_HIDE }, {"nf-id", 0, 0, 5, HT_HIDE }, {"newsgroups", 0, 0, 10, HT_MAGIC|HT_HIDE}, {"organization", 0, 0, 12, 0 }, {"path", 0, 0, 4, HT_HIDE }, {"posted", 0, 0, 6, HT_HIDE }, {"posting-version", 0, 0, 15, HT_HIDE }, {"reply-to", 0, 0, 8, 0 }, {"references", 0, 0, 10, 0 }, {"relay-version", 0, 0, 13, HT_HIDE }, {"sender", 0, 0, 6, 0 }, {"summary", 0, 0, 7, 0 }, {"subject", 0, 0, 7, HT_MAGIC }, {"xref", 0, 0, 4, HT_HIDE } }; #endif #ifdef ASYNC_PARSE EXT ART_NUM parsed_art INIT(0); #endif EXT char in_header INIT(0); /* are we decoding the header? */ #ifdef CACHESUBJ EXT char **subj_list INIT(Null(char **)); #endif void head_init(); int set_line_type(); void start_header(); bool parseline(); #ifdef ASYNC_PARSE int parse_maybe(); #endif char *fetchsubj(); char *fetchlines(); !STUFFY!FUNK! echo Extracting cheat.c cat >cheat.c <<'!STUFFY!FUNK!' /* $Header: cheat.c,v 4.1 84/09/24 11:44:08 lwall Exp $ * * $Log: cheat.c,v $ * Revision 4.1 84/09/24 11:44:08 lwall * Real baseline. * * Revision 4.0.1.2 84/09/10 15:08:12 lwall * Delinted. * * Revision 4.0.1.1 84/09/05 11:35:12 lwall * Fixed ifdefs so makedepend would not complain. * * Revision 4.0 84/09/04 09:49:59 lwall * Baseline for netwide release * */ #include "EXTERN.h" #include "common.h" #include "intrp.h" #include "search.h" #include "ng.h" #include "bits.h" #include "artio.h" #include "term.h" #include "artsrch.h" #include "head.h" #include "INTERN.h" #include "cheat.h" /* see what we can do while they are reading */ #ifdef PENDING # ifdef ARTSEARCH COMPEX srchcompex; /* compiled regex for searchahead */ # endif #endif void cheat_init() { ; } #ifdef PENDING void look_ahead() { #ifdef ARTSEARCH register char *h, *s; #ifdef DEBUGGING if (debug && srchahead) { printf("(%ld)",(long)srchahead); fflush(stdout); } #endif if (srchahead && srchahead < art) { /* in ^N mode? */ char *pattern; pattern = buf+1; strcpy(pattern,": *"); h = pattern + strlen(pattern); interp(h,"%s"); h[24] = '\0'; /* compensate for notesfiles */ while (*h) { if (index("\\[.^*$'\"",*h) != Nullch) *h++ = '.'; else h++; } #ifdef DEBUGGING if (debug & DEB_SEARCH_AHEAD) { fputs("(hit CR)",stdout); fflush(stdout); gets(buf+128); printf("\npattern = %s\n",pattern); } #endif if ((s = compile(&srchcompex,pattern,TRUE,TRUE)) != Nullch) { /* compile regular expression */ printf("\n%s\n",s); srchahead = 0; } if (srchahead) { srchahead = art; for (;;) { srchahead++; /* go forward one article */ if (srchahead > lastart) { /* out of articles? */ #ifdef DEBUGGING if (debug) fputs("(not found)",stdout); #endif break; } /*NOSTRICT*/ if (!was_read(srchahead) && wanted(&srchcompex,srchahead,0)) { /* does the shoe fit? */ #ifdef DEBUGGING if (debug) printf("(%ld)",(long)srchahead); #endif artopen(srchahead); break; } /*NOSTRICT*/ if (input_pending()) break; } fflush(stdout); } } else #endif { if (art+1 <= lastart)/* how about a pre-fetch? */ artopen(art+1); /* look for the next article */ } } #endif /* see what else we can do while they are reading */ void collect_subjects() { #ifdef PENDING # ifdef CACHESUBJ ART_NUM oldart = openart; ART_POS oldartpos; if (!in_ng || !srchahead) return; if (oldart) /* remember where we were in art */ oldartpos = ftell(artfp); if (srchahead >= subj_to_get) subj_to_get = srchahead+1; while (!input_pending() && subj_to_get <= lastart) fetchsubj(subj_to_get++,FALSE,FALSE); if (oldart) { artopen(oldart); fseek(artfp,oldartpos,0); /* do not screw the pager */ } # endif #endif } !STUFFY!FUNK! echo Extracting ngsrch.c cat >ngsrch.c <<'!STUFFY!FUNK!' /* $Header: ngsrch.c,v 4.1 84/09/24 12:03:06 lwall Exp $ * * $Log: ngsrch.c,v $ * Revision 4.1 84/09/24 12:03:06 lwall * Real baseline. * * Revision 4.0.1.1 84/09/10 15:20:42 lwall * Delinted. * * Revision 4.0 84/09/04 09:51:48 lwall * Baseline for netwide release * */ #include "EXTERN.h" #include "common.h" #include "rcstuff.h" #include "final.h" #include "search.h" #include "rn.h" #include "util.h" #include "term.h" #include "rcln.h" #include "INTERN.h" #include "ngsrch.h" #ifdef NGSORONLY COMPEX ngcompex; #endif void ngsrch_init() { #ifdef ZEROGLOB init_compex(&ngcompex); #endif /* ZEROGLOB */ ; } #ifdef NGSEARCH int ng_search(patbuf,get_cmd) char *patbuf; /* if patbuf != buf, get_cmd must */ int get_cmd; /* be set to FALSE!!! */ { char *pattern; /* unparsed pattern */ register char cmdchr = *patbuf; /* what kind of search? */ register char *s; bool backward = cmdchr == '?'; /* direction of search */ int_count = 0; if (get_cmd && buf == patbuf) if (!finish_command(FALSE)) /* get rest of command */ return NGS_ABORT; for (pattern = patbuf+1; *pattern == ' '; pattern++) ; if (*pattern) { ng_doread = FALSE; } s = rindex(pattern,cmdchr); if (s != Nullch && *(s-1) != '\\') { *s++ = '\0'; if (index(s,'r') != Nullch) ng_doread = TRUE; } if ((s = ng_comp(&ngcompex,pattern,TRUE,TRUE)) != Nullch) { /* compile regular expression */ printf("\n%s\n",s); return NGS_ABORT; } fputs("\nSearching...",stdout); /* give them something to read */ fflush(stdout); for (;;) { if (int_count) { int_count = 0; return NGS_INTR; } if (backward) { if (ng > 0) --ng; else ng = nextrcline; } else { if (ng >= nextrcline) ng = 0; else ++ng; } if (ng == current_ng) return NGS_NOTFOUND; if (ng == nextrcline || toread[ng] < TR_NONE || !ng_wanted()) continue; if (toread[ng] == TR_NONE) set_toread(ng); if (toread[ng] > TR_NONE) return NGS_FOUND; else if (toread[ng] == TR_NONE) if (ng_doread) return NGS_FOUND; else printf("\n[0 unread in %s--skipping]",rcline[ng]); } } bool ng_wanted() { return execute(&ngcompex,rcline[ng]) != Nullch; } #endif #ifdef NGSORONLY char * ng_comp(compex,pattern,RE,fold) COMPEX *compex; char *pattern; bool RE; bool fold; { char ng_pattern[128]; register char *s = pattern, *d = ng_pattern; if (!*s) return Nullch; /* reuse old pattern */ for (; *s; s++) { if (*s == '.') { *d++ = '\\'; *d++ = *s; } else if (*s == '?') { *d++ = '.'; } else if (*s == '*') { *d++ = '.'; *d++ = *s; } else if (strnEQ(s,"all",3)) { *d++ = '.'; *d++ = '*'; s += 2; } else *d++ = *s; } *d = '\0'; return compile(compex,ng_pattern,RE,fold); } #endif !STUFFY!FUNK! echo Extracting addng.c cat >addng.c <<'!STUFFY!FUNK!' /* $Header: addng.c,v 4.1 84/09/24 11:39:46 lwall Exp $ * * $Log: addng.c,v $ * Revision 4.1 84/09/24 11:39:46 lwall * Real baseline. * * Revision 4.0.1.2 84/09/13 12:00:52 lwall * UNLINK for Eunice. * * Revision 4.0.1.1 84/09/10 14:48:35 lwall * Delinted. * * Revision 4.0 84/09/04 09:49:17 lwall * Baseline for netwide release * */ #include "EXTERN.h" #include "common.h" #include "rn.h" #include "ngdata.h" #include "last.h" #include "util.h" #include "intrp.h" #include "only.h" #include "rcstuff.h" #include "INTERN.h" #include "addng.h" void addng_init() { ; } #ifdef FINDNEWNG /* generate a list of new newsgroups from active file */ bool newlist(munged,checkinlist) bool munged; /* are we scanning the whole file? */ bool checkinlist; { char *tmpname; register char *s; long birthof(); tmpname = savestr(filexp("/tmp/rnew.%$")); tmpfp = fopen(tmpname,"w"); while (fgets(buf,LBUFLEN,actfp) != Nullch) { if (s = index(buf,' ')) { *s++ = '\0'; if (strnEQ(buf,"to.",3)) continue; if (find_ng(buf) == nextrcline && (checkinlist ? (inlist(buf)) : (birthof(buf,(ART_NUM)atol(s)) > lasttime) ) ) { /* if not in .newsrc and younger */ /* than the last time we checked */ fprintf(tmpfp,"%s\n",buf); /* then remember said newsgroup */ } #ifdef FASTNEW else { /* not really a new group */ if (!munged) { /* did we assume not munged? */ fclose(tmpfp); /* then go back, knowing that */ UNLINK(tmpname); free(tmpname); return TRUE; /* active file was indeed munged */ } } #endif } #ifdef DEBUGGING else printf("Bad active record: %s\n",buf); #endif } /* we have successfully generated the list */ fclose(tmpfp); tmpfp = fopen(tmpname,"r"); UNLINK(tmpname); /* be nice to the world */ while (fgets(buf,LBUFLEN,tmpfp) != Nullch) { buf[strlen(buf)-1] = '\0'; get_ng(buf,TRUE); /* add newsgroup, maybe */ } fclose(tmpfp); /* be nice to ourselves */ free(tmpname); return FALSE; /* do not call us again */ } /* return creation time of newsgroup */ long birthof(ngnam,ngsize) char *ngnam; ART_NUM ngsize; { char tst[128]; sprintf(tst, ngsize ? "%s/%s/1" : "%s/%s" ,spool,getngdir(ngnam)); if (stat(tst,&filestat) < 0) return 0L; /* not there, assume ancient */ else return filestat.st_mtime; } bool scanactive() { NG_NUM oldnext = nextrcline; /* remember # lines in newsrc */ fseek(actfp,0L,0); newlist(TRUE,TRUE); if (nextrcline != oldnext) { /* did we add any new groups? */ return TRUE; } return FALSE; } #endif !STUFFY!FUNK! echo Extracting Pnews.man cat >Pnews.man <<'!STUFFY!FUNK!' ''' $Header: Pnews.man,v 4.1 84/09/24 11:38:14 lwall Exp $ ''' ''' $Log: Pnews.man,v $ ''' Revision 4.1 84/09/24 11:38:14 lwall ''' Real baseline. ''' ''' Revision 4.0 84/09/04 09:48:58 lwall ''' Baseline for netwide release ''' ''' .de Sh .br .ne 5 .PP \fB\\$1\fR .PP .. .de Sp .if t .sp .5v .if n .sp .. ''' ''' Set up \*(-- to give an unbreakable dash; ''' string Tr holds user defined translation string. ''' Bell System Logo is used as a dummy character. ''' .ie n \{\ .tr \(bs-\*(Tr .ds -- \(bs- .if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch .if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch .ds L" " .ds R" " .ds L' ' .ds R' ' 'br\} .el\{\ .ds -- \(em\| .tr \*(Tr .ds L" `` .ds R" '' .ds L' ` .ds R' ' 'br\} .TH PNEWS 1 LOCAL .SH NAME Pnews - a program for posting news articles .SH SYNOPSIS .B Pnews newsgroup title .br or .br .B Pnews -h headerfile [oldarticle] .br or .br .B Pnews .SH DESCRIPTION Pnews is a friendly interface for posting news articles. It will ask several questions, then allow you to enter your article, and then post it using the inews(1) program. If you type h and a carriage return at any point, .I Pnews will tell you what it wants to know. .PP The -h form is used when invoked from .IR rn . If your editor can edit multiple files, and you want the article to which you are replying to show up as an alternate file, define the environment variable MAILPOSTER as \*(L"Rnmail -h %h %a\*(R". You can also modify the the MAILHEADER environment variable to change the header file that .I rn passes to Rnmail. .SH ENVIRONMENT .IP DOTDIR 8 Where to find your dot files, if they aren't in your home directory. .Sp Default: $HOME .IP EDITOR 8 The editor you want to use, if VISUAL is undefined. .Sp Default: whatever your news administrator installed, usually vi. .IP HOME 8 Your home directory. .Sp Default: $LOGDIR .IP LOGDIR 8 Your home directory if HOME is undefined. .IP LOGNAME 8 Your login name, if USER is undefined. .Sp Default: value of \*(L"whoami\*(R". .IP NAME 8 Your full name. .Sp Default: name from /etc/passwd, or ~/.fullname. .IP ORGANIZATION 8 Either the name of your organization, or the name of a file containing the name of your organization. .Sp Default: whatever your news administrator chose. .IP USER 8 Your login name. .Sp Default: $LOGNAME .IP VISUAL 8 The editor you want to use. .Sp Default: $EDITOR .SH FILES /tmp/article$$ .br ~/dead.article .SH SEE ALSO rn(1), Rnmail(1), inews(1) .SH DIAGNOSTICS .SH BUGS Not the speediest program in the world, but maybe that's a blessing to the net. !STUFFY!FUNK! echo Extracting Rnmail.man cat >Rnmail.man <<'!STUFFY!FUNK!' ''' $Header: Rnmail.man,v 4.1 84/09/24 11:39:16 lwall Exp $ ''' ''' $Log: Rnmail.man,v $ ''' Revision 4.1 84/09/24 11:39:16 lwall ''' Real baseline. ''' ''' Revision 4.0 84/09/04 09:49:12 lwall ''' Baseline for netwide release ''' ''' .de Sh .br .ne 5 .PP \fB\\$1\fR .PP .. .de Sp .if t .sp .5v .if n .sp .. ''' ''' Set up \*(-- to give an unbreakable dash; ''' string Tr holds user defined translation string. ''' Bell System Logo is used as a dummy character. ''' .ie n \{\ .tr \(bs-\*(Tr .ds -- \(bs- .if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch .if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch .ds L" " .ds R" " .ds L' ' .ds R' ' 'br\} .el\{\ .ds -- \(em\| .tr \*(Tr .ds L" `` .ds R" '' .ds L' ` .ds R' ' 'br\} .TH RNMAIL 1 LOCAL .SH NAME Rnmail - a program for replying via mail .SH SYNOPSIS .B Rnmail destination_list .br or .br .B Rnmail -h headerfile [oldarticle] .br or .br .B Rnmail .SH DESCRIPTION Rnmail is a friendly interface for mailing replies to news articles. It will ask several questions, then allow you to enter your letter, and then mail it off. If you type h and a carriage return at any point, .I Rnmail will tell you what it wants to know. .PP The -h form is used when invoked from .IR rn . If your editor can edit multiple files, and you want the article to which you are replying to show up as an alternate file, define the environment variable MAILPOSTER as \*(L"Rnmail -h %h %a\*(R". You can also modify the the MAILHEADER environment variable to change the header file that .I rn passes to Rnmail. .SH ENVIRONMENT .IP EDITOR 8 The editor you want to use, if VISUAL is undefined. .Sp Default: whatever your news administrator installed, usually vi. .IP HOME 8 Your home directory. .Sp Default: $LOGDIR .IP LOGDIR 8 Your home directory if HOME is undefined. .IP LOGNAME 8 Your login name, if USER is undefined. .Sp Default: value of \*(L"whoami\*(R". .IP ORGANIZATION 8 Either the name of your organization, or the name of a file containing the name of your organization. .Sp Default: whatever your news administrator chose. .IP USER 8 Your login name. .Sp Default: $LOGNAME .IP VISUAL 8 The editor you want to use. .Sp Default: $EDITOR .SH FILES /tmp/rnmail$$ .br ~/dead.letter .SH SEE ALSO rn(1), Pnews(1), mail(1) .SH DIAGNOSTICS .SH BUGS Uses /bin/mail in the absence of sendmail. !STUFFY!FUNK! echo Extracting only.c cat >only.c <<'!STUFFY!FUNK!' /* $Header: only.c,v 4.1 84/09/24 12:04:06 lwall Exp $ * * $Log: only.c,v $ * Revision 4.1 84/09/24 12:04:06 lwall * Real baseline. * * Revision 4.0.1.1 84/09/10 15:22:17 lwall * Delinted. * * Revision 4.0 84/09/04 09:51:56 lwall * Baseline for netwide release * */ #include "EXTERN.h" #include "common.h" #include "search.h" #include "util.h" #include "final.h" #include "ngsrch.h" #include "INTERN.h" #include "only.h" void only_init() { ; } void setngtodo(pat) char *pat; { char *s; #ifdef ONLY if (!*pat) return; if (maxngtodo < NGMAX) { ngtodo[maxngtodo] = savestr(pat); #ifdef SPEEDOVERMEM compextodo[maxngtodo] = (COMPEX*)safemalloc(sizeof(COMPEX)); init_compex(compextodo[maxngtodo]); compile(compextodo[maxngtodo],pat,TRUE,TRUE); if ((s = ng_comp(compextodo[maxngtodo],pat,TRUE,TRUE)) != Nullch) { /* compile regular expression */ printf("\n%s\n",s); finalize(1); } #endif maxngtodo++; } #else notincl("o"); #endif } /* if command line list is non-null, is this newsgroup wanted? */ bool inlist(ngnam) char *ngnam; { #ifdef ONLY register int i; #ifdef SPEEDOVERMEM if (maxngtodo == 0) return TRUE; for (i=0; i<maxngtodo; i++) { if (execute(compextodo[i],ngnam)) return TRUE; } return FALSE; #else COMPEX ilcompex; char *s; if (maxngtodo == 0) return TRUE; init_compex(&ilcompex); for (i=0; i<maxngtodo; i++) { if ((s = ng_comp(&ilcompex,ngtodo[i],TRUE,TRUE)) != Nullch) { /* compile regular expression */ printf("\n%s\n",s); finalize(1); } if (execute(&ilcompex,ngnam) != Nullch) { free_compex(&ilcompex); return TRUE; } } free_compex(&ilcompex); return FALSE; #endif #else return TRUE; #endif } #ifdef ONLY void end_only() { if (maxngtodo) { /* did they specify newsgroup(s) */ int whicharg; #ifdef VERBOSE IF(verbose) printf("\nRestriction %s%s removed.\n",ngtodo[0], maxngtodo > 1 ? ", etc." : nullstr); ELSE #endif #ifdef TERSE fputs("\nExiting \"only\".\n",stdout); #endif for (whicharg = 0; whicharg < maxngtodo; whicharg++) { free(ngtodo[whicharg]); #ifdef SPEEDOVERMEM free_compex(compextodo[whicharg]); free((char*)compextodo[whicharg]); #endif } maxngtodo = 0; } } #endif !STUFFY!FUNK! echo Extracting makedepend.SH cat >makedepend.SH <<'!STUFFY!FUNK!' case $CONFIG in '') . config.sh ;; esac echo "Extracting makedepend (with variable substitutions)" $spitshell >makedepend <<!GROK!THIS! $startsh # $Header: makedepend.SH,v 4.1 84/09/24 11:59:28 lwall Exp $ # # $Log: makedepend.SH,v $ # Revision 4.1 84/09/24 11:59:28 lwall # Real baseline. # # Revision 4.0.1.4 84/09/14 15:55:49 lwall # Made less interrupt sensitive. # # Revision 4.0.1.3 84/09/12 15:20:16 lwall # Check for sh interpretation. # # Revision 4.0.1.2 84/09/05 17:02:52 lwall # More efficient. # # Revision 4.0.1.1 84/09/05 16:02:25 lwall # Now makes use of cpp as determined by Configure. # # Revision 4.0 84/09/04 09:51:17 lwall # Baseline for netwide release # export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$) $cat /dev/null >.deptmp $echo "(Note: this is going to take a while.)" $rm -f X*.c for file in *.c; do filebase=\`basename \$file .c\` $echo "Finding dependencies for \$filebase.o." $sed -n <\$file >X\$file \\ -e "/^\${filebase}_init(/q" \\ -e '/^#/{' \\ -e 's|/\*.*$||' \\ -e p \\ -e '}' $cpp X\$file | $sed \\ -e '/^# *[0-9]/!d' \\ -e 's/^.*"\(.*\)".*\$/'\$filebase'.o: \1/' \\ -e 's|: \./|: |' \\ -e 's|: X|: |' | \\ $uniq | $sort | $uniq >> .deptmp done $sed <Makefile >Makefile.new -e '1,/^# AUTOMATICALLY/!d' if $test -s .deptmp; then echo "Updating Makefile..." echo "# If this runs make out of memory, delete /usr/include lines." >>Makefile.new $cat .deptmp >>Makefile.new else $echo "You don't seem to have a proper C preprocessor. Using grep instead." $egrep '^#include ' *.c *.h >.deptmp echo "Updating Makefile..." <.deptmp $sed -n 's|c:#include "\(.*\)".*\$\$|o: \1|p' >> Makefile.new <.deptmp $sed -n 's|c:#include <\(.*\)>.*\$\$|o: /usr/include/\1|p' >> Makefile.new <.deptmp $sed -n 's|h:#include "\(.*\)".*\$\$|h: \1|p' >> Makefile.new <.deptmp $sed -n 's|h:#include <\(.*\)>.*\$\$|h: /usr/include/\1|p' >> Makefile.new fi $mv Makefile Makefile.old $mv Makefile.new Makefile $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> Makefile rm .deptmp X*.c !GROK!THIS! $eunicefix makedepend chmod 755 makedepend !STUFFY!FUNK! echo Extracting ndir.c cat >ndir.c <<'!STUFFY!FUNK!' /* $Header: ndir.c,v 4.1 84/09/24 12:01:00 lwall Exp $ * * $Log: ndir.c,v $ * Revision 4.1 84/09/24 12:01:00 lwall * Real baseline. * * Revision 4.0.1.2 84/09/14 11:36:30 lwall * Include ndir.h even when USENDIR not defined. * * Revision 4.0.1.1 84/09/12 17:08:32 lwall * Rn-ized. * * Revision 4.0 84/09/12 17:07:44 lwall * *** empty log message *** * */ #include "EXTERN.h" #include "common.h" #include "INTERN.h" #include "ndir.h" #ifdef USENDIR /* * support for Berkeley directory reading routine on a V7 file system */ /* * open a directory. */ DIR * opendir(name) char *name; { register DIR *dirp; register int fd; if ((fd = open(name, 0)) == -1) return NULL; if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) { close (fd); return NULL; } dirp->dd_fd = fd; dirp->dd_loc = 0; return dirp; } /* * read an old stlye directory entry and present it as a new one */ #define ODIRSIZ 14 struct olddirect { short od_ino; char od_name[ODIRSIZ]; }; /* * get next entry in a directory. */ struct direct * readdir(dirp) register DIR *dirp; { register struct olddirect *dp; static struct direct dir; for (;;) { if (dirp->dd_loc == 0) { dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ); if (dirp->dd_size <= 0) return NULL; } if (dirp->dd_loc >= dirp->dd_size) { dirp->dd_loc = 0; continue; } dp = (struct olddirect *)(dirp->dd_buf + dirp->dd_loc); dirp->dd_loc += sizeof(struct olddirect); if (dp->od_ino == 0) continue; dir.d_ino = dp->od_ino; strncpy(dir.d_name, dp->od_name, ODIRSIZ); dir.d_name[ODIRSIZ] = '\0'; /* insure null termination */ dir.d_namlen = strlen(dir.d_name); dir.d_reclen = DIRSIZ(&dir); return (&dir); } } /* * close a directory. */ void closedir(dirp) register DIR *dirp; { close(dirp->dd_fd); dirp->dd_fd = -1; dirp->dd_loc = 0; free(dirp); } #endif USENDIR !STUFFY!FUNK! echo Extracting subs.help.SH cat >subs.help.SH <<'!STUFFY!FUNK!' case $CONFIG in '') . config.sh ;; esac echo "Extracting subs.help (with variable substitutions)" $spitshell >subs.help <<!GROK!THIS! $startsh # $Header: subs.help.SH,v 4.1 84/09/24 12:10:16 lwall Exp $ # # $Log: subs.help.SH,v $ # Revision 4.1 84/09/24 12:10:16 lwall # Real baseline. # # Revision 4.0.1.1 84/09/12 15:26:07 lwall # Housekeeping. # # Revision 4.0 84/09/04 09:52:44 lwall # Baseline for netwide release # $pager <<'EOT' Valid substitutions are: a Current article number A Full name of current article (%P/%c/%a) b Destination of last save command, often a mailbox B Bytes to ignore at beginning of last saved article c Current newsgroup, directory form C Current newsgroup, dot form d Full name of newsgroup directory (%P/%c) D Distribution line from current article\ f Who the current article is from F Newsgroups to followup to (from Newsgroups and Followup-To) h (This help message) H Host name (yours) i Message-I.D. line from current article, with <> l News administrator's login name, if any L Login name (yours) M Number of article marked with M n Newsgroups from current article N Full name (yours) o Organization (yours) O Original working directory (where you ran rn from) p Your private news directory (from -d) P Public news spool directory r Last reference (parent article id) R References list for followup article s Subject, with all Re's and (nf)'s stripped off S Subject, with one Re stripped off\ t New To line derived from From and Reply-To (Internet format) T New To line derived from Path u Number of unread articles U Number of unread articles not counting current article x News library directory X Rn library directory ~ Your home directory . Directory containing . files $ Current process number / Last search string ESC Run preceding command through % interpretation EOT !GROK!THIS! $eunicefix subs.help chmod 755 subs.help !STUFFY!FUNK! echo Extracting ng.help.SH cat >ng.help.SH <<'!STUFFY!FUNK!' case $CONFIG in '') . config.sh ;; esac echo "Extracting ng.help (with variable substitutions)" $spitshell >ng.help <<!GROK!THIS! $startsh # $Header: ng.help.SH,v 4.1 84/09/24 12:02:44 lwall Exp $ # # $Log: ng.help.SH,v $ # Revision 4.1 84/09/24 12:02:44 lwall # Real baseline. # # Revision 4.0.1.1 84/09/12 15:23:47 lwall # Housekeeping. # # Revision 4.0 84/09/04 09:51:43 lwall # Baseline for netwide release # $pager <<'EOT' Newsgroup Selection commands: y,SP Do this newsgroup now. .cmd Do this newsgroup, executing cmd as first command. = Equivalent to .=<carriage return>. u Unsubscribe from this newsgroup. c Catch up (mark this newsgroup all read). n Go to the next newsgroup with unread news. N Go to the next newsgroup. p Go to the previous newsgroup with unread news. P Go to the previous newsgroup. - Go to the previously displayed newsgroup. 1 Go to the first newsgroup. ^ Go to the first newsgroup with unread news. $ Go to the last newsgroup. g name Go to the named newsgroup. Subscribe to new newsgroups this way too. /pat Search forward for newsgroup matching pattern. ?pat Search backward for newsgroup matching pattern. (Use * and ? style patterns. Append r to include read newsgroups.) l pat List unsubscribed newsgroups containing pattern. m name Move named newsgroup elsewhere (no name moves current newsgroup). o pat Only display newsgroups matching pattern. Omit pat to unrestrict. a pat Like o, but also scans for unsubscribed newsgroups matching pattern. L List current .newsrc. & Print current command-line switch settings. &switch {switch} Set (or unset) more command-line switches. !cmd Shell escape. q Quit rn. ^K Edit the global KILL file. Use commands like /pattern/j to suppress pattern in every newsgroup. v Print version. EOT !GROK!THIS! $eunicefix ng.help chmod 755 ng.help !STUFFY!FUNK! echo Extracting header.c.pat cat >header.c.pat <<'!STUFFY!FUNK!' NOTE: the preceding context may be different under 2.10.2, but you should be able to figure it out anyway. *** header.old.c Fri Apr 27 11:30:49 1984 --- header.c Mon Feb 27 10:44:03 1984 *************** *** 107,112 #define NUMLINES 19 #define KEYWORDS 20 #define APPROVED 21 #define OTHER 99 char *malloc(); --- 107,115 ----- #define NUMLINES 19 #define KEYWORDS 20 #define APPROVED 21 + #ifdef DOXREFS + #define XREF 98 + #endif DOXREFS #define OTHER 99 char *malloc(); *************** *** 201,206 seenrelay = 1; } break; case OTHER: if (unreccnt < NUNREC) { hp->unrec[unreccnt] = malloc(strlen(bfr) + 1); --- 204,214 ----- seenrelay = 1; } break; + #ifdef DOXREFS + case XREF: + getfield(hp->xref); + break; + #endif DOXREFS case OTHER: if (unreccnt < NUNREC) { hp->unrec[unreccnt] = malloc(strlen(bfr) + 1); *************** *** 398,403 return KEYWORDS; if (its("Approved: ")) return APPROVED; return OTHER; } --- 406,415 ----- return KEYWORDS; if (its("Approved: ")) return APPROVED; + #ifdef DOXREFS + if (its("Xref: ")) + return XREF; + #endif DOXREFS return OTHER; } *************** *** 507,512 fprintf(fp, "Keywords: %s\n", hp->keywords); if (*hp->approved) fprintf(fp, "Approved: %s\n", hp->approved); for (iu = 0; iu < NUNREC; iu++) { if (hp->unrec[iu]) fprintf(fp, "%s", &hp->unrec[iu][0]); --- 519,528 ----- fprintf(fp, "Keywords: %s\n", hp->keywords); if (*hp->approved) fprintf(fp, "Approved: %s\n", hp->approved); + #ifdef DOXREFS + if (wr == 1 && *hp->xref) + fprintf(fp, "Xref: %s\n", hp->xref); + #endif DOXREFS for (iu = 0; iu < NUNREC; iu++) { if (hp->unrec[iu]) fprintf(fp, "%s", &hp->unrec[iu][0]); !STUFFY!FUNK! echo Extracting artio.c cat >artio.c <<'!STUFFY!FUNK!' /* $Header: artio.c,v 4.1 84/09/24 11:41:57 lwall Exp $ * * $Log: artio.c,v $ * Revision 4.1 84/09/24 11:41:57 lwall * Real baseline. * * Revision 4.0.1.2 84/09/10 15:05:12 lwall * Delinted. * * Revision 4.0.1.1 84/09/04 15:14:02 lwall * LINKART option for Eunice sites. * * Revision 4.0 84/09/04 09:49:31 lwall * Baseline for netwide release * */ #include "EXTERN.h" #include "common.h" #include "INTERN.h" #include "artio.h" void artio_init() { ; } /* open an article, unless it's already open */ FILE * artopen(artnum) ART_NUM artnum; { char artname[8]; /* filename of current article */ if (openart == artnum) { /* this article is already open? */ fseek(artfp,0L,0); /* just get to the beginning */ return artfp; /* and say we succeeded */ } if (artfp != Nullfp) { /* it was somebody else? */ fclose(artfp); /* put them out of their misery */ openart = 0; /* and remember them no more */ } sprintf(artname,"%ld",(long)artnum); /* produce the name of the article */ if (artfp = fopen(artname,"r")) /* if we can open it */ openart = artnum; /* remember what we did here */ #ifdef LINKART { char tmpbuf[256]; char *s; if (fstat(artfp->_file,&filestat)) return artfp; if (filestat.st_size < (sizeof tmpbuf)) { fgets(tmpbuf,(sizeof tmpbuf),artfp); if (*tmpbuf == '/') { /* is a "link" to another article */ fclose(artfp); if (s=index(tmpbuf,'\n')) *s = '\0'; if (!(artfp = fopen(tmpbuf,"r"))) openart = 0; else { if (*linkartname) free(linkartname); linkartname = savestr(tmpbuf); } } else fseek(artfp,0L,0); /* get back to the beginning */ } } #endif return artfp; /* and return either fp or NULL */ } !STUFFY!FUNK! echo Extracting newsgroups.man cat >newsgroups.man <<'!STUFFY!FUNK!' ''' $Header: newsgroups.man,v 4.1 84/09/24 12:01:37 lwall Exp $ ''' ''' $Log: newsgroups.man,v $ ''' Revision 4.1 84/09/24 12:01:37 lwall ''' Real baseline. ''' ''' Revision 4.0 84/09/04 09:51:36 lwall ''' Baseline for netwide release ''' ''' .de Sh .br .ne 5 .PP \fB\\$1\fR .PP .. .de Sp .if t .sp .5v .if n .sp .. ''' ''' Set up \*(-- to give an unbreakable dash; ''' string Tr holds user defined translation string. ''' Bell System Logo is used as a dummy character. ''' .ie n \{\ .tr \(bs-\*(Tr .ds -- \(bs- .if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch .if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch .ds L" " .ds R" " .ds L' ' .ds R' ' 'br\} .el\{\ .ds -- \(em\| .tr \*(Tr .ds L" `` .ds R" '' .ds L' ` .ds R' ' 'br\} .TH NEWSGROUPS 1 LOCAL .SH NAME newsgroups - a program to list unsubscribed newsgroups. .SH SYNOPSIS .B newsgroups pattern flag .SH DESCRIPTION The .I newsgroups program compares your .newsrc file with the file of active newsgroups, and prints a list of unsubscribed newsgroups matching pattern. If the second argument \*(L"flag\*(R" is present, only newsgroups not found in your .newsrc are listed, and the display is not paged. If the second argument is missing, the display is paged, and an additional list of unsubscribed newsgroups occurring in your .newsrc is printed. .SH ENVIRONMENT .IP DOTDIR 8 Where to find your .newsrc, if not in your home directory. .Sp Default: $HOME .IP HOME 8 Your home directory. .Sp Default: $LOGDIR .IP LOGDIR 8 Your home directory if HOME is undefined. .SH FILES /usr/lib/news/active or a reasonable facsimile .br ${DOTDIR-{$HOME-$LOGDIR}}/.newsrc .SH SEE ALSO rn(1), newsrc(5) .SH DIAGNOSTICS .SH BUGS The flag argument is a kludge. !STUFFY!FUNK! echo Extracting newsgroups.SH cat >newsgroups.SH <<'!STUFFY!FUNK!' case $CONFIG in '') . config.sh ;; esac echo "Extracting newsgroups (with variable substitutions)" $spitshell >newsgroups <<!GROK!THIS! $startsh # $Header: newsgroups.SH,v 4.1 84/09/24 12:01:31 lwall Exp $ # # $Log: newsgroups.SH,v $ # Revision 4.1 84/09/24 12:01:31 lwall # Real baseline. # # Revision 4.0.1.1 84/09/12 15:22:25 lwall # Check for sh interpretation. # # Revision 4.0 84/09/04 09:51:34 lwall # Baseline for netwide release # export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$) : syntax: newsgroups [pattern] [pipeflag] : System Dependencies : You might want to change pager to a "make column" program if you have one. : On the other hand, if your kernel does paging, cat would probably do. pager="${pager-/usr/ucb/more}" active="${active-/usr/lib/news/active}" : End of system dependencies, hopefully case \$active in ~*) active=\`$filexp \$active\` ;; esac if $test \$# -ge 2 ; then pager=$cat else $echo "Completely unsubscribed newsgroups:" fi : Throwing .newsrc into the pot twice is a lovely hack to prevent : bogus newsgroups from showing up as unsubscribed. $cat \$HOME/.newsrc \$HOME/.newsrc \$active | \\ $sed -e '/^options/d' \\ -e '/^[ ]/d' \\ -e '/^control/d' \\ -e '/^to\./d' \\ -e 's/^\([^ !:]*\)[ !:].*\$/\1/' \\ -e "/.*\$1/p" \\ -e 'd' | \\ $sort | $uniq -u | \$pager if $test \$# -ge 2 ; then exit fi $echo $n "[Type return to continue] $c" read tmp $echo "" $echo "Unsubscribed but mentioned in .newsrc:" $sed < \$HOME/.newsrc \\ -e "/\$1.*!/"'s/^\([^!]*\)!.*\$/\1/p' \\ -e 'd' | \\ $sort | \$pager !GROK!THIS! $eunicefix newsgroups chmod 755 newsgroups !STUFFY!FUNK! echo Extracting pager.help.SH cat >pager.help.SH <<'!STUFFY!FUNK!' case $CONFIG in '') . config.sh ;; esac echo "Extracting pager.help (with variable substitutions)" $spitshell >pager.help <<!GROK!THIS! $startsh # $Header: pager.help.SH,v 4.1 84/09/24 12:04:24 lwall Exp $ # # $Log: pager.help.SH,v $ # Revision 4.1 84/09/24 12:04:24 lwall # Real baseline. # # Revision 4.0.1.1 84/09/12 15:25:26 lwall # Housekeeping. # # Revision 4.0 84/09/04 09:51:59 lwall # Baseline for netwide release # $pager <<'EOT' Paging commands: SP Display the next page. x Display the next page decrypted (rot13). d Display half a page more. CR Display one more line. ^R,v,^X Restart the current article (v=verbose header, ^X=rot13). ^B Back up one page. ^L,X Refresh the screen (X=rot13). g pat Go to (search forward within article for) pattern. G Search again for current pattern within article. ^G Search for next line beginning with \"Subject:\". q Quit the pager, go to end of article. Leave article read or unread. j Junk this article (mark it read). Goes to end of article. The following commands skip the rest of the current article, then behave just as if typed to the 'What next?' prompt at the end of the article: n Scan forward for next unread article. N Go to next article. ^N Scan forward for next unread article with same title. p,P,^P Same as n,N,^N, only going backwards. - Go to previously displayed article. The following commands also take you to the end of the article. Type h at end of article for a description of these commands: # $ & / = ? c C f F k K ^K m M number r R ^R s S u v w W Y ^ | (To return to the middle of the article after one of these commands, type ^L.) EOT !GROK!THIS! $eunicefix pager.help chmod 755 pager.help !STUFFY!FUNK! echo Extracting newsetup.man cat >newsetup.man <<'!STUFFY!FUNK!' ''' $Header: newsetup.man,v 4.1 84/09/24 12:01:16 lwall Exp $ ''' ''' $Log: newsetup.man,v $ ''' Revision 4.1 84/09/24 12:01:16 lwall ''' Real baseline. ''' ''' Revision 4.0 84/09/04 09:51:32 lwall ''' Baseline for netwide release ''' ''' .de Sh .br .ne 5 .PP \fB\\$1\fR .PP .. .de Sp .if t .sp .5v .if n .sp .. ''' ''' Set up \*(-- to give an unbreakable dash; ''' string Tr holds user defined translation string. ''' Bell System Logo is used as a dummy character. ''' .ie n \{\ .tr \(bs-\*(Tr .ds -- \(bs- .if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch .if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch .ds L" " .ds R" " .ds L' ' .ds R' ' 'br\} .el\{\ .ds -- \(em\| .tr \*(Tr .ds L" `` .ds R" '' .ds L' ` .ds R' ' 'br\} .TH NEWSETUP 1 LOCAL .SH NAME newsetup - a program to set up a .newsrc file .SH SYNOPSIS .B newsetup .SH DESCRIPTION The .I newsetup program creates a new .newsrc file containing all of the currently active newsgroups. It tries to put them in a reasonable order, i.e. local newsgroups earlier, but you'll probably want to change the ordering anyway (if you use .IR rn ) in order to put interesting newsgroups first. If you already have a .newsrc, it will be backed up with the name \*(L".oldnewsrc\*(R". .SH ENVIRONMENT .IP DOTDIR 8 Where to put your .newsrc, if not in your home directory. .Sp Default: $HOME .IP HOME 8 Your home directory. .Sp Default: $LOGDIR .IP LOGDIR 8 Your home directory if HOME is undefined. .SH FILES /usr/lib/news/active or a reasonable facsimile .br ${DOTDIR-{$HOME-$LOGDIR}}/.newsrc .SH SEE ALSO rn(1), newsrc(5) .SH DIAGNOSTICS .SH BUGS !STUFFY!FUNK! echo Extracting bits.h cat >bits.h <<'!STUFFY!FUNK!' /* $Header: bits.h,v 4.1 84/09/24 11:43:58 lwall Exp $ * * $Log: bits.h,v $ * Revision 4.1 84/09/24 11:43:58 lwall * Real baseline. * * Revision 4.0.1.1 84/09/10 15:08:05 lwall * Delinted. * * Revision 4.0 84/09/04 09:49:56 lwall * Baseline for netwide release * */ EXT char *ctlarea INIT(Nullch); /* one bit for each article in current newsgroup */ /* with the following interpretation: */ /* 0 => unread */ /* 1 => read */ /* if subscripting is faster than shifting on your machine, define this */ #undef USESUBSCRIPT #ifdef USESUBSCRIPT EXT char powerof2[] INIT({1,2,4,8,16,32,64,128}); #define pow2(x) powerof2[x] #else #define pow2(x) (1 << (x)) #endif #define ctl_set(a) (ctlarea[(OFFSET(a)) / BITSPERBYTE] |= pow2((OFFSET(a)) % BITSPERBYTE)) #define ctl_clear(a) (ctlarea[(OFFSET(a)) / BITSPERBYTE] &= ~pow2((OFFSET(a)) % BITSPERBYTE)) #define ctl_read(a) ((ctlarea[(OFFSET(a)) / BITSPERBYTE] & pow2((OFFSET(a)) % BITSPERBYTE)) != 0) #define was_read(a) ((a)<firstart || ctl_read(a)) EXT ART_NUM absfirst INIT(0); /* 1st real article in current newsgroup */ EXT ART_NUM firstart INIT(0); /* minimum unread article number in newsgroup */ EXT ART_NUM lastart INIT(0); /* maximum article number in newsgroup */ #ifdef DELAYMARK EXT FILE *dmfp INIT(Nullfp); EXT char *dmname INIT(Nullch); EXT int dmcount INIT(0); #endif void bits_init(); void checkpoint_rc(); void restore_ng(); void onemore(); void oneless(); void unmark_as_read(); void delay_unmark(); void mark_as_read(); void check_first(); #ifdef DELAYMARK void yankback(); #endif int chase_xrefs(); int init_ctl(); void grow_ctl(); !STUFFY!FUNK! echo Extracting ndir.h cat >ndir.h <<'!STUFFY!FUNK!' /* $Header: ndir.h,v 4.1 84/09/24 12:01:06 lwall Exp $ * * $Log: ndir.h,v $ * Revision 4.1 84/09/24 12:01:06 lwall * Real baseline. * * Revision 4.0.1.1 84/09/12 17:09:03 lwall * Rn-ized. * * Revision 4.0 84/09/12 17:07:28 lwall * *** empty log message *** * */ #ifdef LIBNDIR # include <ndir.h> #else # ifndef USENDIR # include <sys/dir.h> # else #ifndef DEV_BSIZE #define DEV_BSIZE 512 #endif #define DIRBLKSIZ DEV_BSIZE #define MAXNAMLEN 255 struct direct { long d_ino; /* inode number of entry */ short d_reclen; /* length of this record */ short d_namlen; /* length of string in d_name */ char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */ }; /* * The DIRSIZ macro gives the minimum record length which will hold * the directory entry. This requires the amount of space in struct direct * without the d_name field, plus enough space for the name with a terminating * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary. */ #undef DIRSIZ #define DIRSIZ(dp) \ ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) /* * Definitions for library routines operating on directories. */ typedef struct _dirdesc { int dd_fd; long dd_loc; long dd_size; char dd_buf[DIRBLKSIZ]; } DIR; #ifndef NULL #define NULL 0 #endif extern DIR *opendir(); extern struct direct *readdir(); extern long telldir(); extern void seekdir(); #define rewinddir(dirp) seekdir((dirp), (long)0) extern void closedir(); # endif #endif !STUFFY!FUNK! echo Extracting rcstuff.h cat >rcstuff.h <<'!STUFFY!FUNK!' /* $Header: rcstuff.h,v 4.1 84/09/24 12:06:21 lwall Exp $ * * $Log: rcstuff.h,v $ * Revision 4.1 84/09/24 12:06:21 lwall * Real baseline. * * Revision 4.0.1.1 84/09/10 15:28:24 lwall * Delinted. * * Revision 4.0 84/09/04 09:52:11 lwall * Baseline for netwide release * */ EXT char *rcline[MAXRCLINE];/* pointers to lines of .newsrc */ EXT ART_UNREAD toread[MAXRCLINE]; /* number of articles to be read in newsgroup */ /* <0 => invalid or unsubscribed newsgroup */ #define TR_ONE ((ART_UNREAD) 1) #define TR_NONE ((ART_UNREAD) 0) #define TR_UNSUB ((ART_UNREAD) -1) /* keep this one as -1, some tests use >= TR_UNSUB */ #define TR_BOGUS ((ART_UNREAD) -2) #define TR_JUNK ((ART_UNREAD) -3) EXT char rcchar[MAXRCLINE]; /* holds the character : or ! while spot is \0 */ EXT char rcnums[MAXRCLINE]; /* offset from rcline to numbers on line */ EXT ACT_POS softptr[MAXRCLINE]; /* likely ptr to active file entry for newsgroup */ EXT bool paranoid INIT(FALSE); /* did we detect some inconsistency in .newsrc? */ bool rcstuff_init(); bool get_ng(); /* return TRUE if newsgroup can be found or added */ NG_NUM add_newsgroup(); #ifdef RELOCATE NG_NUM relocate_newsgroup(); /* move newsgroup around */ #endif void list_newsgroups(); NG_NUM find_ng(); /* return index of newsgroup */ void cleanup_rc(); void sethash(); int hash(); void newsrc_check(); void write_rc(); !STUFFY!FUNK! echo Extracting newsnews.SH cat >newsnews.SH <<'!STUFFY!FUNK!' case $CONFIG in '') . config.sh ;; esac echo "Extracting newsnews (with variable substitutions)" cat >newsnews <<!GROK!THIS! *** NEWS NEWS *** Welcome to rn. There are more options to rn than you want to think about, so we won't list them here. If you want to find out about them, read the manual page(s). There are some important things to remember, though: * Rn is not a modified readnews. Don't expect the commands to be identical. * Rn runs in cbreak mode. This means you don't have to type carriage return on single character commands. (There are some multi-character commands.) * At ANY prompt in rn, you may type 'h' for help. There are many different help menus, depending on where you are in rn. Typing <esc>h in the middle of a multi-character command will list escape substitutions. * Typing a space to any prompt means to do the normal thing. You could spend all day reading news and never hit anything but the space bar. This particular message comes from $rnlib/newsnews. You will only see it once. You news administrator should feel free to substitute his or her own message whenever something new happens to rn, and then the file will again be displayed, just once for each person. Larry Wall sdcrdcf!lwall !GROK!THIS! $eunicefix newsnews !STUFFY!FUNK! echo Extracting makedir.SH cat >makedir.SH <<'!STUFFY!FUNK!' case $CONFIG in '') . config.sh ;; esac echo "Extracting makedir (with variable substitutions)" $spitshell >makedir <<!GROK!THIS! $startsh # $Header: makedir.SH,v 4.1 84/09/24 11:59:35 lwall Exp $ # # $Log: makedir.SH,v $ # Revision 4.1 84/09/24 11:59:35 lwall # Real baseline. # # Revision 4.0.1.1 84/09/12 15:20:48 lwall # Check for sh interpretation. # # Revision 4.0 84/09/04 09:51:21 lwall # Baseline for netwide release # export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$) case \$# in 0) $echo "makedir pathname filenameflag" exit 1 ;; esac : guarantee one slash before 1st component case \$1 in /*) ;; *) set ./\$1 \$2 ;; esac : strip last component if it is to be a filename case X\$2 in X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;; *) set \$1 ;; esac : return reasonable status if nothing to be created if $test -d "\$1" ; then exit 0 fi list='' while true ; do case \$1 in */*) list="\$1 \$list" set \`echo \$1 | $sed 's:\(.*\)/:\1 :'\` ;; *) break ;; esac done set \$list for dir do $mkdir \$dir >/dev/null 2>&1 done !GROK!THIS! $eunicefix makedir chmod 755 makedir !STUFFY!FUNK! echo Extracting search.h cat >search.h <<'!STUFFY!FUNK!' /* $Header: search.h,v 4.1 84/09/24 12:10:12 lwall Exp $ * * $Log: search.h,v $ * Revision 4.1 84/09/24 12:10:12 lwall * Real baseline. * * Revision 4.0.1.1 84/09/10 15:31:38 lwall * Delinted. * * Revision 4.0 84/09/04 09:52:42 lwall * Baseline for netwide release * */ #ifndef NBRA #define NBRA 10 /* the maximum number of meta-brackets in an RE -- \( \) */ #define NALTS 10 /* the maximum number of \|'s */ typedef struct { char *expbuf; /* The compiled search string */ int eblen; /* Length of above buffer */ char *alternatives[NALTS]; /* The list of \| seperated alternatives */ char *braslist[NBRA]; /* RE meta-bracket start list */ char *braelist[NBRA]; /* RE meta-bracket end list */ char *brastr; /* saved match string after execute() */ char nbra; /* The number of meta-brackets int the most recenlty compiled RE */ bool do_folding; /* fold upper and lower case? */ } COMPEX; void search_init(); void init_compex(); void free_compex(); char *getbracket(); void case_fold(); char *compile(); void grow_eb(); char *execute(); bool advance(); bool backref(); bool cclass(); #endif !STUFFY!FUNK! echo Extracting kitlists.c cat >kitlists.c <<'!STUFFY!FUNK!' /* $Header: kitlists.c,v 4.1 84/09/24 11:58:44 lwall Exp $ * * $Log: kitlists.c,v $ * Revision 4.1 84/09/24 11:58:44 lwall * Real baseline. * * Revision 4.0 84/09/04 09:51:03 lwall * Baseline for netwide release * */ #include <stdio.h> #define MAXKIT 100 #define MAXKITSIZE 63000 #define KITOVERHEAD 700 #define FILEOVERHEAD 80 long tot[MAXKIT]; FILE *outfp[MAXKIT]; /* of course, not this many file descriptors */ main(argc,argv) int argc; char **argv; { FILE *inp, *popen(); char buf[1024], filnam[128]; char *index(); register char *s; register int i, newtot; sprintf(buf,"\ ls -l `awk '{print $1}' <%s'` | awk '{print $8 \" \" $4}' | sort +1nr\ ", argc > 1 ? argv[1] : "MANIFEST.new"); inp = popen(buf,"r"); while (fgets(buf,1024,inp) != Nullch) { s = index(buf,' '); *s++ = '\0'; for (i=1; (newtot = tot[i] + atol(s) + FILEOVERHEAD) > MAXKITSIZE-KITOVERHEAD; i++) ; if (!tot[i]) { sprintf(filnam,"kit%d.list",i); outfp[i] = fopen(filnam,"w"); } tot[i] = newtot; printf("Adding %s to kit %d giving %d bytes\n",buf,i,newtot); fprintf(outfp[i],"%s\n",buf); } } !STUFFY!FUNK! echo Extracting last.c cat >last.c <<'!STUFFY!FUNK!' /* $Header: last.c,v 4.1 84/09/24 11:59:07 lwall Exp $ * * $Log: last.c,v $ * Revision 4.1 84/09/24 11:59:07 lwall * Real baseline. * * Revision 4.0.1.1 84/09/10 15:16:19 lwall * Delinted. * * Revision 4.0 84/09/04 09:51:11 lwall * Baseline for netwide release * */ #include "EXTERN.h" #include "common.h" #include "rn.h" #include "util.h" #include "intrp.h" #include "INTERN.h" #include "last.h" char *lastname = Nullch; /* path name of .rnlast file */ void last_init(tcbuf) char *tcbuf; { lastname = savestr(filexp(LASTNAME)); if ((tmpfp = fopen(lastname,"r")) != Nullfp) { fgets(tcbuf,1024,tmpfp); tcbuf[strlen(tcbuf)-1] = '\0'; lastngname = savestr(tcbuf); fgets(tcbuf,1024,tmpfp); lasttime = atoi(tcbuf); fgets(tcbuf,1024,tmpfp); lastactsiz = atoi(tcbuf); fclose(tmpfp); } else { lastngname = nullstr; lasttime = 0; lastactsiz = 0; } } /* put out certain values for next run of rn */ void writelast() { if ((tmpfp = fopen(lastname,"w")) != Nullfp) { fprintf(tmpfp,"%s\n%ld\n%ld\n",ngname,(long)lasttime,(long)lastactsiz); fclose(tmpfp); } } !STUFFY!FUNK! echo "" echo "End of kit 7 (of 8)" cat /dev/null >kit7isdone config=true for iskit in 1 2 3 4 5 6 7 8; do if test -f kit${iskit}isdone; then echo "You have run kit ${iskit}." else echo "You still need to run kit ${iskit}." config=false fi done case $config in true) echo "You have run all your kits. Please read README and then type Configure." chmod 755 Configure ;; esac : I do not append .signature, but someone might mail this. exit