Apply this patch in your trn 3 source directory with the command: patch -p /tmp/c1$$ <> ../UU/config.sh + elif $test X$ans = X -o X$ans = Xnone ; then + : else echo "$file.sh does not exist -- ignored" @@ -1484,16 +1485,4 @@ esac -: determine where manual pages are on this system -echo " " -case "$sysman" in -'') sysman=`./loc . /local/man/man1 /usr/man/man1 /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/share/man/man1 /usr/catman/u_man/man1 /usr/man/l_man/man1 /usr/local/man/u_man/man1 /usr/local/man/l_man/man1 /usr/man/man.L1 /usr/man/man.L` - ;; -esac -if $test -d "$sysman"; then - echo "System manual is in $sysman." >&4 -else - echo "Could not find manual pages in source form." >&4 -fi - : make some quick guesses about what we are up against echo " " @@ -1576,4 +1565,88 @@ $rm -f foo +: find out how to find out full name +case "$d_berknames" in +"$define") + dflt=y;; +"$undef") + dflt=n;; +*) + if bsd; then + dflt=y + elif xenix; then + dflt=y + else + dflt=n + fi + ;; +esac +$cat <<'EOM' + +Does your /etc/passwd file keep full names in Berkeley/V7 format (name first +thing after ':' in GCOS field)? In that case, a typical entry in the password +file looks like this: + + guest:**paswword**:10:100:Mister Guest User:/usr/users:/bin/sh + ^^^^^^^^^^^^^^^^^ +EOM +rp="Berkeley/V7 format for full name in /etc/password?" +. ./myread +case "$ans" in +y*) d_passnames="$define" + d_berknames="$define" + d_usgnames="$undef" + nametype=bsd + ;; +*) + case "$d_usgnames" in + "$define") dflt=y;; + "$undef") dflt=n;; + *) + if usg; then + dflt=y + else + dflt=n + fi + ;; + esac +$cat <<'EOM' + +Does your passwd file keep full names in USG format (name sandwiched between a +'-' and a '(')? In that case, a typical entry in the password file looks like +this: + + guest:**paswword**:10:100:000-Mister Guest User(000):/usr/users:/bin/sh + ^^^^^^^^^^^^^^^^^ +EOM + rp="USG format for full name in /etc/passwd?" + . ./myread + case "$ans" in + n*) echo "Full name will be taken from ~/.fullname" + d_passnames="$undef" + d_berknames="$undef" + d_usgnames="$undef" + nametype=other + ;; + *) + d_passnames="$define" + d_berknames="$undef" + d_usgnames="$define" + nametype=usg + ;; + esac;; +esac + +: determine where manual pages are on this system +echo " " +case "$sysman" in +'') sysman=`./loc . /local/man/man1 /usr/man/man1 /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/share/man/man1 /usr/catman/u_man/man1 /usr/man/l_man/man1 /usr/local/man/u_man/man1 /usr/local/man/l_man/man1 /usr/man/man.L1 /usr/man/man.L` + ;; +esac +if $test -d "$sysman"; then + echo "System manual is in $sysman." >&4 +else + echo "Could not find manual pages in source form." >&4 +fi + : see if we need a special compiler echo " " @@ -2010,10 +2083,7 @@ case "$ccflags" in -'') case "$cc" in - *gcc*) dflt='-fpcc-struct-return';; - *) dflt='';; - esac - case "$optimize" in - *-g*) dflt="$dflt -DDEBUG";; +'') case "$optimize" in + *-g*) dflt="-DDEBUG";; + *) dflt='';; esac case "$cc" in @@ -2199,88 +2269,4 @@ esac' -: see if memcmp exists -set memcmp d_bcmp -eval $inlibc - -: see if memcpy exists -set memcpy d_bcopy -eval $inlibc - -: find out how to find out full name -case "$d_berknames" in -"$define") - dflt=y;; -"$undef") - dflt=n;; -*) - if bsd; then - dflt=y - elif xenix; then - dflt=y - else - dflt=n - fi - ;; -esac -$cat <<'EOM' - -Does your /etc/passwd file keep full names in Berkeley/V7 format (name first -thing after ':' in GCOS field)? In that case, a typical entry in the password -file looks like this: - - guest:**paswword**:10:100:Mister Guest User:/usr/users:/bin/sh - ^^^^^^^^^^^^^^^^^ -EOM -rp="Berkeley/V7 format for full name in /etc/password?" -. ./myread -case "$ans" in -y*) d_passnames="$define" - d_berknames="$define" - d_usgnames="$undef" - nametype=bsd - ;; -*) - case "$d_usgnames" in - "$define") dflt=y;; - "$undef") dflt=n;; - *) - if usg; then - dflt=y - else - dflt=n - fi - ;; - esac -$cat <<'EOM' - -Does your passwd file keep full names in USG format (name sandwiched between a -'-' and a '(')? In that case, a typical entry in the password file looks like -this: - - guest:**paswword**:10:100:000-Mister Guest User(000):/usr/users:/bin/sh - ^^^^^^^^^^^^^^^^^ -EOM - rp="USG format for full name in /etc/passwd?" - . ./myread - case "$ans" in - n*) echo "Full name will be taken from ~/.fullname" - d_passnames="$undef" - d_berknames="$undef" - d_usgnames="$undef" - nametype=other - ;; - *) - d_passnames="$define" - d_berknames="$undef" - d_usgnames="$define" - nametype=usg - ;; - esac;; -esac - -: see if memset exists -set memset d_bzero -eval $inlibc - : function used to set $1 to $val setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef; @@ -2840,4 +2826,16 @@ fi +: see if memcmp exists +set memcmp d_memcmp +eval $inlibc + +: see if memcpy exists +set memcpy d_memcpy +eval $inlibc + +: see if memset exists +set memset d_memset +eval $inlibc + : get news administrator name case "$newsadmin" in @@ -3015,13 +3013,13 @@ : see which of string.h or strings.h is needed echo " " -strings=`./findhdr strings.h` +strings=`./findhdr string.h` if $test "$strings" && $test -r "$strings"; then - echo "Using instead of ." >&4 - val="$undef" -else + echo "Using instead of ." >&4 val="$define" - strings=`./findhdr string.h` +else + val="$undef" + strings=`./findhdr strings.h` if $test "$strings" && $test -r "$strings"; then - echo "Using instead of ." >&4 + echo "Using instead of ." >&4 else echo "No string header found -- You'll surely have problems." >&4 @@ -3030,4 +3028,8 @@ set i_string eval $setvar +case "$i_string" in +"$undef") strings=`./findhdr strings.h`;; +*) strings=`./findhdr string.h`;; +esac : index or strchr @@ -3059,4 +3061,8 @@ : see if strftime exists +case "$strftimec" in +'') ;; +*) d_strftime="$undef";; +esac set strftime d_strftime eval $inlibc @@ -3064,4 +3070,5 @@ "$undef") case "$strftimec" in + ' ') dflt='none';; '') dflt="./strftime.c";; *) dflt="$strftimec";; @@ -3077,5 +3084,5 @@ . ./getfile case "$ans" in - none) strftimec='' + '') strftimec=' ' strftimeo='' ;; @@ -3086,4 +3093,7 @@ esac ;; +*) strftimec='' + strftimeo='' + ;; esac @@ -3103,5 +3113,42 @@ fi -: check on .thread/.overview file placement +: find out what database support they want and any file placement details +case "$d_useov$d_usemt" in +"$undef$undef") dflt=none;; +"$undef$define") dflt=threads;; +"$define$undef") dflt=overviews;; +*) dflt=both;; +esac +$cat < Makefile ;; +''|' ') sed < Makefile.new -e '/^#STRFTIME/d' > Makefile ;; *) sed < Makefile.new -e '/^#STRFTIME/s/^#STRFTIME//' > Makefile ;; esac Index:Pnews.SH @@ -104,10 +104,10 @@ news_sig=${NEWSSIGNATURE-$dotdir/.news_sig} -if $test ! -f $newsgroups -a -x $rnlib/getactive; then +if $test ! -f "$newsgroups" -a -r "$rnlib/getactive"; then newsgroups="$tmp/Pnng.$$"; rmlist="$newsgroups"; cmdlist="$rnlib/getactive newsgroups $tmp/Pnng.$$ ; "; fi -if $test ! -f $active -a -x $rnlib/getactive; then +if $test ! -f "$active" -a -r "$rnlib/getactive"; then active="$tmp/Pnact.$$"; rmlist="$rmlist $active"; Index:Speller.SH @@ -15,5 +15,4 @@ export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$) -tmpdir="${TMPDIR-/tmp}" # what pager you use--if you have kernal paging use cat pager="\${PAGER-$pager}" @@ -33,4 +32,6 @@ $spitshell >>Speller <<'!NO!SUBS!' +tmpdir="${TMPDIR-/tmp}" + # get us some temporary files. hdrs=$tmpdir/sp$$hdr Index:art.c @@ -183,6 +183,4 @@ interp(art_buf, (sizeof art_buf), firstline); linenum += tree_puts(art_buf,linenum+topline,0); - artopen(art); /* rewind article in case interp */ - /* forced a header parse */ } else { Index:bits.c @@ -466,5 +466,5 @@ char tmpbuf[128]; - xref_buf = fetchcache(artnum, XREF_LINE); + xref_buf = fetchcache(artnum, XREF_LINE, FILL_CACHE); if (!xref_buf || !*xref_buf) return 0; @@ -586,5 +586,5 @@ char tmpbuf[128]; - xref_buf = fetchcache(artnum, NGS_LINE); + xref_buf = fetchcache(artnum, NGS_LINE, FILL_CACHE); if (!xref_buf || !*xref_buf) return 0; Index:cache.c @@ -288,7 +288,8 @@ char * -fetchcache(artnum,which_line) +fetchcache(artnum,which_line,fill_cache) ART_NUM artnum; int which_line; +bool_int fill_cache; { register char *s; @@ -301,8 +302,10 @@ if (cached && (s=get_cached_line(ap,which_line,untrim_cache)) != Nullch) return s; + if (!fill_cache) + return Nullch; if (!parseheader(artnum)) return nullstr; - if (cached && (s=get_cached_line(ap,which_line,untrim_cache)) != Nullch) - return s; + if (cached) + return get_cached_line(ap,which_line,untrim_cache); return Nullch; } @@ -357,10 +360,13 @@ HASHDATUM data; SUBJECT *sp; - char *newsubj, *subj_start = get_subject_start(subj); + char *newsubj, *subj_start; char *t, *f; int i; - if (subj != subj_start) { - size -= subj_start - subj; + while (*subj && *subj != '\n' && (unsigned char)*subj <= ' ') + subj++; + if (subj != (subj_start = get_subject_start(subj))) { + if ((size -= subj_start - subj) < 0) + size = 0; ap->flags |= AF_HAS_RE; } @@ -642,9 +648,7 @@ } if (first_cached > absfirst) { -#ifdef USE_OV if (ov_opened) ov_data(absfirst, first_cached-1, TRUE); else -#endif art_data(absfirst, first_cached-1, TRUE, TRUE); /* If we got interrupted, make a quick exit */ @@ -746,12 +750,9 @@ if (first < first_cached) { -#ifdef USE_OV if (ov_opened) { ov_data(absfirst,first_cached-1,FALSE); if ((success = (first_cached == absfirst)) != FALSE) ov_close(); - } else -#endif - { + } else { success = art_data(first, first_cached-1, FALSE, all_arts); cached_all_in_range = (all_arts && success); Index:cache.h @@ -90,5 +90,5 @@ #define Nullsubj Null(SUBJECT*) -#define was_read(a) (article_ptr(a)->flags & AF_READ) +#define was_read(a) ((a) >= absfirst && (article_ptr(a)->flags & AF_READ)) /* These must never use their args more than once in the definition */ @@ -113,4 +113,7 @@ EXT ARTICLE *sentinel_artp; +#define DONT_FILL_CACHE 0 +#define FILL_CACHE 1 + EXT struct rt_subj *first_subject INIT(0); EXT struct rt_subj *last_subject INIT(0); @@ -130,5 +133,5 @@ void check_poster _((ARTICLE*)); void uncache_article _((ARTICLE*,bool_int)); -char *fetchcache _((ART_NUM,int)); /* return actual cache ptr */ +char *fetchcache _((ART_NUM,int,bool_int)); char *get_cached_line _((ARTICLE*, int, bool_int)); void set_subj_line _((ARTICLE*, char*, int)); Index:common.h @@ -63,4 +63,5 @@ char *malloc(); char *realloc(); +char *getenv(); #endif @@ -734,5 +735,5 @@ typedef unsigned int MEM_SIZE; /* for passing to malloc */ -/* index/strchr slight-of-hand */ +/* some slight-of-hand for compatibility issues */ #ifdef HAS_STRCHR @@ -740,4 +741,13 @@ # define rindex strrchr #endif +#ifdef HAS_MEMCMP +# define bcmp(s,d,l) memcmp((s),(d),(l)) +#endif +#ifdef HAS_MEMCPY +# define bcopy(s,d,l) memcpy((d),(s),(l)) +#endif +#ifdef HAS_MEMSET +# define bzero(s,l) memset((s),0,(l)) +#endif /* *** end of the machine dependent stuff *** */ @@ -754,5 +764,4 @@ char *index(); char *rindex(); -char *getenv(); char *strcat(); char *strcpy(); @@ -838,4 +847,16 @@ INIT(0); #endif +EXT bool try_ov /* -Z */ +#ifdef USE_OV + INIT(TRUE); +#else + INIT(FALSE); +#endif +EXT bool try_mt +#ifdef USE_MT + INIT(TRUE); +#else + INIT(FALSE); +#endif #define NOMARKING 0 Index:config.h.SH @@ -41,22 +41,4 @@ #$d_eunice VMS /**/ -/* bcmp: - * This symbol is maped to memcmp if the memcmp() routine is - * available to compare byte sequences. - */ -#$d_bcmp bcmp(s,d,l) memcmp((s),(d),(l)) /* mapped to memcmp */ - -/* bcopy: - * This symbol is maped to memcpy if the bcopy() routine is not - * available to copy strings. - */ -#$d_bcopy bcopy(s,d,l) memcpy((d),(s),(l)) /* mapped to memcpy */ - -/* bzero: - * This symbol is maped to memset if the bzero() routine is not - * available to set memory to 0. - */ -#$d_bzero bzero(s,l) memset((s),0,(l)) /* mapped to memset */ - /* HAS_GETPWENT * This symbol, if defined, indicates that the getpwent() routine @@ -71,4 +53,22 @@ #$d_havetlib HAS_TERMLIB /**/ +/* HAS_MEMCMP + * This symbol, if defined, indicates that the memcmp routine is available + * to compare blocks of memory. + */ +#$d_memcmp HAS_MEMCMP /**/ + +/* HAS_MEMCPY + * This symbol, if defined, indicates that the memcpy routine is available + * to copy blocks of memory. + */ +#$d_memcpy HAS_MEMCPY /**/ + +/* HAS_MEMSET + * This symbol, if defined, indicates that the memset routine is available + * to set blocks of memory. + */ +#$d_memset HAS_MEMSET /**/ + /* NEWS_ADMIN * This symbol, if defined, contains the login name of the news @@ -412,14 +412,14 @@ /* THREAD_DIR: - * This symbol indicates where the .thread files go. + * This symbol indicates where the thread files go. */ /* OVERVIEW_DIR: - * This symbol indicates where the .overview files go. + * This symbol indicates where the overview files go. */ /* USE_MT: - * This symbol indicates if .thread file support is desired. + * This symbol indicates if thread file support is desired. */ /* USE_OV: - * This symbol indicates if .overview file support is desired. + * This symbol indicates if overview file support is desired. */ #define THREAD_DIR "$threaddir" /**/ Index:head.c @@ -300,5 +300,5 @@ /* Only return a cached subject line if it isn't the current article */ if (which_line != SUBJ_LINE || parsed_art != artnum) { - s = fetchcache(artnum,which_line); + s = fetchcache(artnum,which_line,FILL_CACHE); if (s) return savestr(s); @@ -326,114 +326,111 @@ /* prefetch a header line from one or more articles */ -#ifdef USE_NNTP char * -prefetchlines(artnum,which_line,copy) /* NNTP version */ +prefetchlines(artnum,which_line,copy) ART_NUM artnum; /* article to get line from */ int which_line; /* type of line desired */ bool_int copy; /* do you want it savestr()ed? */ { - register ARTICLE *ap; - register char *s, *t; + char *s, *t; + register ART_POS firstpos; + register ART_POS lastpos; int size; - register ART_NUM num, priornum, lastnum; - bool cached = (htype[which_line].ht_flags & HT_CACHED); - /* find_article() returns a Nullart if the artnum value is invalid */ - if (!(ap = find_article(artnum)) || (ap->flags & AF_MISSING)) - s = nullstr; - else if (cached && (which_line != SUBJ_LINE || parsed_art != artnum)) - s = get_cached_line(ap, which_line, untrim_cache); - else - s = Nullch; - if (s) { - if (copy) - s = savestr(s); - return s; - } +#ifdef USE_NNTP + if (parsed_art != artnum) { + ARTICLE *ap; + int size; + register ART_NUM num, priornum, lastnum; + bool cached; + + s = fetchcache(artnum,which_line,DONT_FILL_CACHE); + if (s) { + if (copy) + s = savestr(s); + return s; + } - spin(20); - if (copy) - s = safemalloc((MEM_SIZE)(size = LBUFLEN)); - else { - s = cmd_buf; - size = sizeof cmd_buf; - } - *s = '\0'; - priornum = artnum-1; - lastnum = artnum + PREFETCH_SIZE - 1; - if (lastnum > lastart) - lastnum = lastart; - if (cached) - sprintf(ser_line,"XHDR %s %ld-%ld",htype[which_line].ht_name, + spin(20); + if (copy) + s = safemalloc((MEM_SIZE)(size = LBUFLEN)); + else { + s = cmd_buf; + size = sizeof cmd_buf; + } + *s = '\0'; + priornum = artnum-1; + lastnum = artnum + PREFETCH_SIZE - 1; + if (lastnum > lastart) + lastnum = lastart; + if ((cached = (htype[which_line].ht_flags & HT_CACHED)) != 0) + sprintf(ser_line,"XHDR %s %ld-%ld",htype[which_line].ht_name, artnum,lastnum); - else - sprintf(ser_line,"XHDR %s %ld",htype[which_line].ht_name,artnum); - nntp_command(ser_line); - if (nntp_check(TRUE) == NNTP_CLASS_OK) { - for (;;) { - nntp_gets(ser_line, sizeof ser_line); + else + sprintf(ser_line,"XHDR %s %ld",htype[which_line].ht_name,artnum); + nntp_command(ser_line); + if (nntp_check(TRUE) == NNTP_CLASS_OK) { + for (ap = find_article(artnum); ; ) { + nntp_gets(ser_line, sizeof ser_line); # ifdef DEBUG - if (debug & DEB_NNTP) - printf("<%s\n", ser_line) FLUSH; + if (debug & DEB_NNTP) + printf("<%s\n", ser_line) FLUSH; # endif - if (ser_line[0] == '.') - break; - if ((t = index(ser_line, '\r')) != Nullch) - *t = '\0'; - if (!(t = index(ser_line, ' '))) - continue; - t++; - num = atol(ser_line); - if (num < artnum || num > lastnum) - continue; - while (++priornum < num) - uncache_article(ap++,FALSE); - if (which_line == SUBJ_LINE) - set_subj_line(ap++, t, strlen(t)); - else if (cached) - set_cached_line(ap++, which_line, savestr(t)); - if (num == artnum) - safecat(s,t,size); + if (ser_line[0] == '.') + break; + if ((t = index(ser_line, '\r')) != Nullch) + *t = '\0'; + if (!(t = index(ser_line, ' '))) + continue; + t++; + num = atol(ser_line); + if (num < artnum || num > lastnum) + continue; + while (++priornum < num) + uncache_article(ap++,FALSE); + if (which_line == SUBJ_LINE) + set_subj_line(ap++, t, strlen(t)); + else if (cached) + set_cached_line(ap++, which_line, savestr(t)); + if (num == artnum) + safecat(s,t,size); + } + } else { + fprintf(stderr,"\nUnexpected close of server socket.\n"); + finalize(1); } - } else { - fprintf(stderr,"\nUnexpected close of server socket.\n"); - finalize(1); + while (priornum++ < lastnum) + uncache_article(ap++,FALSE); + if (copy) + s = saferealloc(s, (MEM_SIZE)strlen(s)+1); + return s; } - while (priornum++ < lastnum) - uncache_article(ap++,FALSE); - if (copy) - s = saferealloc(s, (MEM_SIZE)strlen(s)+1); - return s; -} - -#else /* !USE_NNTP */ -char * -prefetchlines(artnum,which_line,copy) -ART_NUM artnum; /* article to get line from */ -int which_line; /* type of line desired */ -bool_int copy; /* do you want it savestr()ed? */ -{ - char *s, *t; - register ART_POS firstpos; - register ART_POS lastpos; - int size; - - if (copy) - return fetchlines(artnum,which_line); +#endif - s = fetchcache(artnum,which_line); - if (s) - return s; + /* Only return a cached subject line if it isn't the current article */ + s = Nullch; + if (which_line != SUBJ_LINE || parsed_art != artnum) + s = fetchcache(artnum,which_line,FILL_CACHE); if ((firstpos = htype[which_line].ht_minpos) < 0) - return nullstr; + s = nullstr; + if (s) { + if (copy) + s = savestr(s); + return s; + } firstpos += htype[which_line].ht_length + 1; lastpos = htype[which_line].ht_maxpos; size = lastpos - firstpos; + if (copy) + s = safemalloc((MEM_SIZE)size); + else { /* hope this is okay--we're */ + s = cmd_buf; /* really scraping for space here */ + if (size > sizeof cmd_buf) + size = sizeof cmd_buf; + } t = headbuf + firstpos; while (*t == ' ' || *t == '\t') t++; - *cmd_buf = '\0'; - safecat(cmd_buf,t,CBUFLEN); /* hope this is okay--we're */ - return cmd_buf; /* really scraping for space here */ + *s = '\0'; + safecat(s,t,size); + return s; } -#endif /* !USE_NNTP */ Index:hints/sco_xenix @@ -1,2 +0,0 @@ -i_dirent=undef -libswanted=`echo $libswanted | sed 's/ x//'` Index:hints/sco_xenix.sh @@ -0,0 +1,2 @@ +i_dirent=undef +libswanted=`echo $libswanted | sed 's/ x//'` Index:hints/solaris_2_2.sh @@ -0,0 +1,4 @@ +d_sigblock='undef' +d_getcwd='define' +d_getwd='undef' +libs='-lmalloc -lsocket -lnls -lnsl -lintl' Index:hints/sunos_4_1.sh @@ -1,3 +1,2 @@ i_sgtty=define i_termios=undef -i_string=define Index:init.c @@ -78,4 +78,7 @@ /* we have to know rnlib to look up global switches in %X/INIT */ + homedir = getenv("HOME"); + if (homedir == Nullch) + homedir = getenv("LOGDIR"); lib = savestr(filexp(NEWSLIB)); rnlib = savestr(filexp(PRIVLIB)); Index:kfile.c @@ -90,4 +90,5 @@ int thread_kill_cnt = 0; int thread_select_cnt = 0; + char *cp; art = lastart+1; @@ -95,5 +96,6 @@ fseek(kfp,0L,0); /* rewind file */ while (fgets(buf,LBUFLEN,kfp) != Nullch) { - buf[strlen(buf)-1] = '\0'; + if (*(cp = buf + strlen(buf) - 1) == '\n') + *cp = '\0'; if (strnEQ(buf,"THRU",4)) { killfirst = atol(buf+4)+1; @@ -154,5 +156,5 @@ else if (first_time && *buf == '<') { register ARTICLE *ap; - char *cp = index(buf,' '); + cp = index(buf,' '); if (!cp) cp = "T,"; Index:rcstuff.c @@ -192,5 +192,5 @@ #ifdef HASHNG - rc_hash = hashcreate((int)nextrcline, rcline_cmp); + rc_hash = hashcreate((int)nextrcline+50, rcline_cmp); for (i = 0; i < nextrcline; i++) if (toread[i] >= TR_UNSUB) Index:respond.c @@ -169,4 +169,5 @@ #ifdef METAMAIL if (mime_article) { + char oldmode = mode; if (!custom_extract) { printf("Extracting MIME article into %s:\n", s) FLUSH; @@ -180,4 +181,5 @@ getval("EXMIMESAVER",EXMIMESAVER)); termlib_reset(); + mode = 'x'; resetty(); /* restore tty state */ doshell(SH,cmd_buf); @@ -185,4 +187,5 @@ crmode(); termlib_init(); + mode = oldmode; break; } @@ -702,4 +705,5 @@ char *cmd,*dir; { + char oldmode = mode; if (chdir(dir)) { printf(nocd,dir) FLUSH; @@ -707,4 +711,5 @@ } termlib_reset(); + mode = 'x'; #ifdef VERBOSE IF(verbose) @@ -729,4 +734,5 @@ #endif termlib_init(); + mode = oldmode; #ifdef USE_NNTP if (chdir(spool)) { Index:rt-mt.c @@ -20,6 +20,4 @@ #include "rthread.h" #include "rt-process.h" - -#ifdef USE_MT #include "INTERN.h" #include "rt-mt.h" @@ -745,4 +743,2 @@ } } - -#endif /* USE_MT */ Index:rt-ov.c @@ -23,6 +23,4 @@ #include "rt-util.h" #include "overview.h" - -#ifdef USE_OV #include "INTERN.h" #include "rt-ov.h" @@ -319,4 +317,2 @@ } } - -#endif /* USE_OV */ Index:rt-page.c @@ -449,5 +449,5 @@ continue; sel = !!(ap->flags & sel_mask) + (ap->flags & AF_DEL); - sel_items[sel_item_cnt].ptr = (void*)ap; + sel_items[sel_item_cnt].ptr = (VOIDPTR*)ap; sel_items[sel_item_cnt].line = sel_line; sel_items[sel_item_cnt].sel = sel; @@ -491,5 +491,5 @@ if (sel_line + line_cnt > LINES - 3) break; - sel_items[sel_item_cnt].ptr = (void*)sp; + sel_items[sel_item_cnt].ptr = (VOIDPTR*)sp; sel_items[sel_item_cnt].line = sel_line; sel_items[sel_item_cnt].sel = sel; Index:rt-select.h @@ -33,6 +33,8 @@ EXT int added_articles INIT(0); +#define VOIDPTR void + struct sel_item { - void *ptr; + VOIDPTR *ptr; int line; int sel; Index:rthread.c @@ -35,16 +35,11 @@ HASHTABLE *msgid_hash = 0; -bool try_ov = FALSE; -bool try_mt = FALSE; - void thread_init() { -#ifdef USE_OV - try_ov = ov_init(); -#endif -#ifdef USE_MT - try_mt = mt_init(); -#endif + if (try_ov) + try_ov = ov_init(); + if (try_mt) + try_mt = mt_init(); } @@ -72,10 +67,7 @@ set_selector(sel_threadmode, sel_threadsort); -#ifdef USE_MT if (try_mt && !first_subject) if (!mt_data()) return; -#endif -#ifdef USE_OV if (try_ov && first_cached > last_cached) if (thread_always) @@ -87,5 +79,4 @@ } else (void) ov_data(firstart, lastart, FALSE); -#endif #ifdef USE_NNTP if (!ov_opened) @@ -150,7 +141,5 @@ sel_last_sp = 0; selected_only = FALSE; -#ifdef USE_OV ov_close(); -#endif } @@ -1291,5 +1280,5 @@ if ((eq = (int)((*spp1)->misc - (*spp2)->misc)) != 0) return eq * sel_direction; - return (int)((*spp1)->date - (*spp2)->date) * sel_direction; + return (int)((*spp1)->date - (*spp2)->date); } @@ -1303,5 +1292,5 @@ if (t1 != t2 && t1 && t2) return strcasecmp(t1->subj->str+4, t2->subj->str+4) * sel_direction; - return (int)((*spp1)->date - (*spp2)->date) * sel_direction; + return (int)((*spp1)->date - (*spp2)->date); } @@ -1324,9 +1313,9 @@ if (sp2->misc) break; - if ((eq = (int)(sp1->date - sp2->date) * sel_direction) != 0) - return eq; - return strcasecmp(sp1->str+4, sp2->str+4) * sel_direction; + if (!(eq = (int)(sp1->date - sp2->date))) + return strcasecmp(sp1->str+4, sp2->str+4); + return eq * sel_direction; } - return (int)((*spp1)->date - (*spp2)->date) * sel_direction; + return (int)((*spp1)->date - (*spp2)->date); } Index:sw.c @@ -480,4 +480,22 @@ actFetchTime = upordown * 5L * 60L; break; + case 'Z': + s++; + if (*s == '=') s++; + try_mt = FALSE; + try_ov = FALSE; + if (upordown) { + while (*s) { + switch (*s++) { + case 'o': + try_ov = TRUE; + break; + case 't': + try_mt = TRUE; + break; + } + } + } + break; default: #ifdef VERBOSE @@ -562,4 +580,5 @@ printf("+S "); #endif + putchar('\n'); #ifdef VERBOSE #ifdef TERSE @@ -585,4 +604,13 @@ else printf("+z "); + if (try_mt || try_ov) { + printf("-Z"); + if (try_ov) + putchar('o'); + if (try_mt) + putchar('t'); + putchar(' '); + } else + printf("+Z "); fputs("\n\n",stdout) FLUSH; #ifdef ONLY Index:term.c @@ -1027,6 +1027,7 @@ goto reask_in_answer; /* give them a prompt again */ } - if (!finish_command(TRUE)) - goto reinp_in_answer; + if (*buf != ' ' && *buf != '\n') + if (!finish_command(TRUE)) + goto reinp_in_answer; mode = oldmode; } @@ -1246,27 +1247,30 @@ int dummy; { - /* Reset signal in case of System V dain bramage */ - sigset(SIGWINCH, winch_catcher); + /* Reset signal in case of System V dain bramage */ + sigset(SIGWINCH, winch_catcher); - /* Come here if window size change signal received */ + /* Come here if window size change signal received */ #ifdef TIOCGWINSZ - { struct winsize ws; - char lines[10], cols[10]; - if (ioctl(0, TIOCGWINSZ, &ws) >= 0 && ws.ws_row > 0 && ws.ws_col > 0) { - LINES = ws.ws_row; - COLS = ws.ws_col; - line_col_calcs(); - sprintf(lines, "%d", LINES); - sprintf(cols, "%d", COLS); - export("LINES",lines); - export("COLUMNS",cols); - forceme("\f"); /* cause a refresh */ + { struct winsize ws; + char lines[10], cols[10]; + if (ioctl(0, TIOCGWINSZ, &ws) >= 0 && ws.ws_row > 0 && ws.ws_col > 0) { + if (LINES != ws.ws_row || COLS != ws.ws_col) { + LINES = ws.ws_row; + COLS = ws.ws_col; + line_col_calcs(); + sprintf(lines, "%d", LINES); + sprintf(cols, "%d", COLS); + export("LINES",lines); + export("COLUMNS",cols); + if (mode == 't' || mode == 'a' || mode == 'p') + forceme("\f"); /* cause a refresh */ /* (defined only if TIOCSTI defined) */ - } - } + } + } + } #else - /* Well, if SIGWINCH is defined, but TIOCGWINSZ isn't, there's */ - /* almost certainly something wrong. Figure it out for yourself, */ - /* because I don't know how to deal with it :-) */ + /* Well, if SIGWINCH is defined, but TIOCGWINSZ isn't, there's */ + /* almost certainly something wrong. Figure it out for yourself, */ + /* because I don't know how to deal with it :-) */ #endif } Index:term.h @@ -28,5 +28,5 @@ # else /* FIONREAD */ # ifdef HAS_RDCHK -#define input_pending() (rdchk(0) > 0) /* boolean only */ +#define input_pending() (nextin!=nextout || rdchk(0)) # else /* HAS_RDCHK */ int circfill(); Index:trn.1 @@ -335,5 +335,5 @@ the remaining groups can be ignored by typing \*(L'N\*(R'. After any new newsgroups have been added, the \*(L'a\*(R' command also -restricts the current set of newsgroups just like the \*(L'o\*(R' command +restricts the current set of newsgroups just like the \*(L'O\*(R' command does. .Ip & 8 @@ -1633,4 +1633,10 @@ A value of 0 or using +z turns this off. .TP 5 +.B \-Z +is used to select what style of database you want trn to access. +Use \-Zt for thread files, \-Zo for overview files, and +Z for none. +The default is whatever your newsadmin compiled into trn, and can +be \-Zot to try to access either one. +.TP 5 .B \-/ sets SAVEDIR to \*(L"%p/%c\*(R" and SAVENAME to \*(L"%a\*(R", which means