Apply this patch in your trn3 source directory with the command: patch -p /tmp/c1$$ </dev/null 2>&1 && \ - cat <<'EOM' +: On HP-UX, large Configure scripts may exercise a bug in /bin/sh +if test -f /hp-ux -a -x /bin/ksh >/dev/null 2>&1; then + if (alias -x) >/dev/null 2>&1; then + : already under /bin/ksh + else + cat <<'EOM' +(Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.) +EOM + exec /bin/ksh $0 "$@" + fi +else + : Warn them if they use ksh on other systems + (alias -x) >/dev/null 2>&1 && \ + cat <<'EOM' (I see you are using the Korn shell. Some ksh's blow up on Configure, especially on exotic machines. If yours does, try the Bourne shell instead.) EOM +fi : Configure runs within the UU subdirectory @@ -90,5 +102,4 @@ chown='' compress='' -cp='' cpp='' csh='' @@ -103,6 +114,4 @@ inews='' ispell='' -ispell_path='' -ispell_options='' ksh='' less='' @@ -128,4 +137,5 @@ sed='' sendmail='' +sh='' shar='' sleep='' @@ -205,6 +215,9 @@ d_sighold='' d_sizet='' +d_strcasecmp='' d_strchr='' d_strftime='' +strftimec='' +strftimeo='' d_libndir='' d_usendir='' @@ -216,10 +229,10 @@ defeditor='' filexp='' -h_fcntl='' -h_sysfile='' d_dirnamlen='' i_dirent='' -i_fcntl='' i_ptem='' +i_stdlib='' +i_string='' +strings='' i_sysdir='' d_voidtty='' @@ -231,8 +244,13 @@ i_termio='' i_termios='' +i_systime='' +i_time='' +i_unistd='' i_vfork='' +ispell_options='' +ispell_prg='' libc='' plibpth='' -xlibpath='' +xlibpth='' libs='' citydist='' @@ -253,5 +271,4 @@ d_usgnames='' nametype='' -passcat='' inewsloc='' newslib='' @@ -296,5 +313,5 @@ echo "Doing variable substitutions on .SH files..." if test -f MANIFEST; then - set x `awk '{print $1}' &2 + -V) echo "Configure generated by metaconfig 2.9dev PL20." >&2 exit 0;; --) break;; @@ -441,5 +458,5 @@ echo "Fetching answers from $config_sh..." cd .. - . ./$config + . $config echo " " . ./UU/extract @@ -452,4 +469,5 @@ : set package name package=trn +Package=Trn : Eunice requires " " instead of "", can you believe it @@ -475,5 +493,5 @@ : list of known cpp symbols -attrlist="DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__" +attrlist="__alpha DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__" attrlist="$attrlist _AIX __STDC__ __m88k__ ansi bsd4_2 gcos gimpel" attrlist="$attrlist hp9000s300 hp9000s400 hp9000s500 hp9000s700" @@ -481,60 +499,20 @@ attrlist="$attrlist i186 i386 i486 i8086 iAPX286 ibm interdata" attrlist="$attrlist m88k mc300 mc500 mc68000 mc68k mc700 mert" -attrlist="$attrlist mips NeXT ns16000 ns32000 nsc32000 os pdp11 posix" +attrlist="$attrlist mips NeXT ns16000 ns32000 nsc32000 os" +attrlist="$attrlist __osf__ pdp11 posix" attrlist="$attrlist pyr sinix sony sparc sun tower tower32 tower32_600" attrlist="$attrlist tower32_800 tss u3b2 u3b20 u3b200 u3b5 ultrix unix" -attrlist="$attrlist vax venix xenix z8000" +attrlist="$attrlist __unix__ vax venix xenix z8000" : change the next line if compiling for Xenix/286 on Xenix/386 -xlibpath='/usr/lib/386 /lib/386' +xlibpth='/usr/lib/386 /lib/386' : general looking path for locating libraries -libpth='/usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small' +libpth='/usr/lib/large /lib /lib/large /usr/lib/small /lib/small' : no include file wanted by default inclwanted='/usr/include/NET-5000' -libswanted='malloc bsd socket bsdipc sun net hdb bbn str inet nls nsl c_s intl x' - -: Now test for existence of everything in MANIFEST -echo " " -if test -f ../MANIFEST; then - echo "First let's make sure your kit is complete. Checking..." >&4 - awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50 - rm -f missing - for filelist in x??; do - (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing) - done - if test -s missing; then - cat missing - cat >&4 <<'EOM' - -THIS PACKAGE SEEMS TO BE INCOMPLETE. - -You have the option of continuing the configuration process, despite the -distinct possibility that your kit is damaged, by typing 'y'es. If you -do, don't blame me if something goes wrong. I advise you to type 'n'o -and contact the author (davison@borland.com). - -EOM - echo "[Type 'yes' to continue]" >&4 - read ans - case "$ans" in - y*) - echo "Continuing..." >&4 - rm -f missing - ;; - *) - echo "ABORTING..." >&4 - kill $$ - ;; - esac - else - echo "Looks good..." >&4 - fi -else - echo "There is no MANIFEST file. I hope your kit is complete !" -fi -rm -f missing x?? +libswanted='malloc bsd socket bsdipc sun net hdb bbn str nls nsl c_s intl x ucb' : Some greps do not return status, grrr. @@ -578,4 +556,45 @@ rm -f .echotmp +: Now test for existence of everything in MANIFEST +echo " " +if test -f ../MANIFEST; then + echo "First let's make sure your kit is complete. Checking..." >&4 + awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50 + rm -f missing + for filelist in x??; do + (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing) + done + if test -s missing; then + cat missing >&4 + cat >&4 <<'EOM' + +THIS PACKAGE SEEMS TO BE INCOMPLETE. + +You have the option of continuing the configuration process, despite the +distinct possibility that your kit is damaged, by typing 'y'es. If you +do, don't blame me if something goes wrong. I advise you to type 'n'o +and contact the author (davison@borland.com). + +EOM + echo $n "Continue? [n] $c" >&4 + read ans + case "$ans" in + y*) + echo "Continuing..." >&4 + rm -f missing + ;; + *) + echo "ABORTING..." >&4 + kill $$ + ;; + esac + else + echo "Looks good..." >&4 + fi +else + echo "There is no MANIFEST file. I hope your kit is complete !" +fi +rm -f missing x?? + : compute the number of columns on the terminal for proper question formatting case "$COLUMNS" in @@ -627,5 +646,5 @@ "\$ans") case "\$ans" in - !) + "!") sh 1>&4 echo " " @@ -675,5 +694,5 @@ $eunicefix try chmod +x try - try > today + ./try > today if test -s today; then echo "It does." @@ -683,10 +702,10 @@ $eunicefix try chmod +x try - try > today + ./try > today if test -s today; then echo "It does." sharpbang='#! ' else - echo "It doesn't." + echo "It's just a comment." sharpbang=': use ' fi @@ -826,5 +845,5 @@ awk cat -cp +chmod echo expr @@ -904,5 +923,5 @@ echo "Hopefully test is built into your sh." ;; -/bin/test) +*) if sh -c "PATH= test true" >/dev/null 2>&1; then echo "Using the test built into your sh." @@ -910,7 +929,4 @@ fi ;; -*) - test=test - ;; esac case "$echo" in @@ -949,28 +965,32 @@ : Try to determine whether config.sh was made on this system -xxx=`( ($uname -a) 2>/dev/null || hostname) 2>&1` case "$config_sh" in '') +myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1` dflt=n -if test -f ../config.sh; then - eval "`grep myuname= ../config.sh`" - if test "X$xxx" = "X$myuname"; then +if test "$fastread" = yes; then + dflt=y +elif test -f ../config.sh; then + eval "old`grep myuname= ../config.sh`" + if test "X$myuname" = "X$oldmyuname"; then dflt=y fi fi -: Get old answers, if there is a config file out there +: Get old answers from old config file if Configure was run on the +: same system, otherwise use the hints. hint=default -if test -f ../config.sh; then +cd .. +if test -f config.sh; then echo " " rp="I see a config.sh file. Do you want to use it to set the defaults?" - . ./myread + . ./UU/myread case "$ans" in - n*|N*) echo "OK, I'll ignore it.";; + n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;; *) echo "Fetching default answers from your old config.sh file..." >&4 tmp="$n" ans="$c" - . ../config.sh - cp ../config.sh . + . ./config.sh + cp config.sh UU n="$tmp" c="$ans" @@ -979,4 +999,98 @@ esac fi +if test ! -f config.sh; then + $cat <&4 + dflt='' + : Half the following guesses are probably wrong... If you have better + : tests or hints, please send them to davison@borland.com + : The metaconfig authors would also appreciate a copy... + $test -f /vmunix && $test -f /usr/convex/spucmd && dflt="$dflt convexos" + $test -f /irix && dflt="$dflt sgi" + $test -f /xenix && dflt="$dflt sco_xenix" + $test -f /dynix && dflt="$dflt dynix" + $test -f /bin/mips && /bin/mips && dflt="$dflt mips" + $test -d /NextApps && test -f /usr/adm/software_version && dflt="$dflt next" + if $test -f $uname; then + set `$uname -a | tr '[A-Z]' '[a-z]'` + + $test -f $5.sh && dflt="$dflt $5" + + case "$5" in + mips*) dflt="$dflt mips";; + [23]100) dflt="$dflt mips";; + next*) dflt="$dflt next" ;; + esac + + case "$1" in + aix) dflt="$dflt aix_rs" ;; + sunos) case "$3" in + 4.1*) dflt="$dflt sunos_4_1" ;; + esac + ;; + dgux) dflt="$dflt dgux" ;; + hp*ux) dflt="$dflt hpux" ;; + next) dflt="$dflt next" ;; + irix) dflt="$dflt sgi" ;; + convexos) dflt="$dflt convexos";; + $2) if $test -f /usr/lib/sysadm/sysadm.menu; then + if $test ! -f /etc/copyrights/01.sco; then + set 3 2 0 + else + set `uname -X 2>&1 | grep Release` + if test "x$1" != "xRelease"; then + set 3 2 1 + else + set `echo $3 | sed 's/[^0-9]/ /g'` + fi + fi + if $test -f sco_$1_$2_$3.sh; then + dflt="$dflt sco_$1_$2_$3" + elif $test -f sco_$1_$2.sh; then + dflt="$dflt sco_$1_$2" + elif $test -f sco_$1.sh; then + dflt="$dflt sco_$1" + fi + fi ;; + esac + fi + set X `echo $dflt | tr ' ' '\012' | sort | uniq` + shift + dflt='' + for file in $*; do + if $test -f "$file.sh"; then + dflt="$dflt $file" + fi + done + set X $dflt + shift + dflt=${1+"$@"} + case "$dflt" in + '') dflt=none;; + esac + $cat <> ../UU/config.sh + else + echo "$file.sh does not exist -- ignored" + fi + done + hint=recommended + cd .. +fi +cd UU ;; *) @@ -995,5 +1109,4 @@ ;; esac -myuname=$xxx : Restore computed paths @@ -1057,7 +1170,7 @@ *) dflt="n";; esac - $cat <<'EOM' + $cat </dev/null 2>&1 + elif test -r "$testvalue" || (test -h "$testvalue") >/dev/null 2>&1 then echo "($value is not a plain file, but that's ok.)" @@ -1231,5 +1347,5 @@ ;; Directory) - if test -d "$value"; then + if test -d "$testvalue"; then type='' fi @@ -1259,5 +1375,5 @@ fi rp="$what $value doesn't exist. Use that name anyway?" - . ./myread + . ./UU/myread dflt='' case "$ans" in @@ -1272,4 +1388,5 @@ esac done +cd UU ans="$value" rp="$orig_rp" @@ -1370,5 +1487,5 @@ echo " " case "$sysman" in -'') sysman=`loc . /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.L` +'') 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 @@ -1502,5 +1619,5 @@ fi case "$cc" in -gcc*) cpp=`loc gcc-cpp $cpp $pth`;; +gcc*) cpp=`./loc gcc-cpp $cpp $pth`;; esac @@ -1571,5 +1688,5 @@ yyy="$incpath/usr/ccs/lib $incpath/usr/lib $incpath/usr/ucblib" yyy="$yyy $incpath/usr/local/lib $incpath/lib" - xxx=`loc lib$thislib.a X $yyy` + xxx=`./loc lib$thislib.a X $yyy` if $test -f $xxx; then echo "Found -l$thislib." @@ -1579,5 +1696,5 @@ esac else - xxx=`loc lib$thislib.a X $libpth` + xxx=`./loc lib$thislib.a X $libpth` if $test -f $xxx; then echo "Found $xxx." @@ -1587,5 +1704,5 @@ esac else - xxx=`loc Slib$thislib.a X $xlibpth` + xxx=`./loc Slib$thislib.a X $xlibpth` if $test -f $xxx; then echo "Found -l$thislib." @@ -1658,5 +1775,5 @@ '') libc=unknown case "$libs" in - *-lc_s*) libc=`loc libc_s.a $libc $libpth` + *-lc_s*) libc=`./loc libc_s.a $libc $libpth` esac ;; @@ -1670,11 +1787,11 @@ -l*) thislib=`expr X$thislib : 'X-l\(.*\)'` - try=`loc lib$thislib.a blurfl/dyick $libpth` + try=`./loc lib$thislib.a blurfl/dyick $libpth` if test ! -f $try; then - try=`loc lib$thislib blurfl/dyick $libpth` + try=`./loc lib$thislib blurfl/dyick $libpth` if test ! -f $try; then - try=`loc $thislib blurfl/dyick $libpth` + try=`./loc $thislib blurfl/dyick $libpth` if test ! -f $try; then - try=`loc Slib$thislib.a blurfl/dyick $xlibpth` + try=`./loc Slib$thislib.a blurfl/dyick $xlibpth` if test ! -f $try; then try='' @@ -1881,5 +1998,5 @@ compiles with the -O flag to use the optimizer. Alternately, you might want to use the symbolic debugger, which uses the -g flag (on traditional Unix -systems). Either flag can be specified here. To use neither flag, specify +systems). Either flag can be specified here. To use neither flag, specify the word "none". @@ -1900,4 +2017,12 @@ *-g*) dflt="$dflt -DDEBUG";; esac + case "$cc" in + *gcc*) if test -d /etc/conf/kconfig.d && + $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1 + then + dflt="$dflt -posix" + fi + ;; + esac ;; *) dflt="$ccflags" ;; @@ -1945,6 +2070,7 @@ Your C compiler may want other flags. For this question you should include -I/whatever and -DWHATEVER flags and any other flags used by the C compiler, -but you should NOT include libraries or ld flags like -lwhatever. To use no -flags, specify the word "none". +but you should NOT include libraries or ld flags like -lwhatever. If you +want $package to honor its debug switch, you should include -DDEBUG here. +To use no flags, specify the word "none". EOH @@ -1961,7 +2087,4 @@ : the following weeds options from ccflags that are of no interest to cpp cppflags="$ccflags" -case "$cc" in -*gcc*) cppflags="$cppflags -D__GNUC__";; -esac case "$mips_type" in '');; @@ -2076,27 +2199,11 @@ esac' -: see if bcmp exists -case "$d_bcmp" in -$define) d_bcmp="$undef";; -$undef) d_bcmp="$define";; -esac -set bcmp d_bcmp +: see if memcmp exists +set memcmp d_bcmp eval $inlibc -case "$d_bcmp" in -$define) d_bcmp="$undef";; -*) d_bcmp="$define";; -esac -: see if bcopy exists -case "$d_bcopy" in -$define) d_bcopy="$undef";; -$undef) d_bcopy="$define";; -esac -set bcopy d_bcopy +: see if memcpy exists +set memcpy d_bcopy eval $inlibc -case "$d_bcopy" in -$define) d_bcopy="$undef";; -*) d_bcopy="$define";; -esac : find out how to find out full name @@ -2172,57 +2279,7 @@ esac -: see if we have to deal with yellow pages -if $test -d /usr/etc/yp || $test -d /etc/yp; then - echo " " - if $test -f /usr/etc/nibindd; then - echo "I'm fairly confident you're on a NeXT." - echo " " - rp='Do you get the passwd file via NetInfo?' - dflt=y - case "$passcat" in - nidump*) ;; - '') ;; - *) dflt=n;; - esac - . ./myread - case "$ans" in - y*) passcat='nidump passwd .';; - *) echo "You told me, so don't blame me."; echo " "; passcat='';; - esac - fi - case "$passcat" in - nidump*) ;; - *) - case "$passcat" in - *ypcat*) dflt=y;; - *) if $contains '^\+:' /etc/passwd >/dev/null 2>&1; then - dflt=y - else - dflt=n - fi;; - esac - rp='Are you getting the passwd file via yellow pages?' - . ./myread - case "$ans" in - y*) passcat='ypcat passwd';; - *) passcat='cat /etc/passwd';; - esac - ;; - esac -else - passcat='cat /etc/passwd' -fi - -: see if bzero exists -case "$d_bzero" in -$define) d_bzero="$undef";; -$undef) d_bzero="$define";; -esac -set bzero d_bzero +: see if memset exists +set memset d_bzero eval $inlibc -case "$d_bzero" in -$define) d_bzero="$undef";; -*) d_bzero="$define";; -esac : function used to set $1 to $val @@ -2485,5 +2542,5 @@ case "$ans" in x) - ans=`loc libtermlib.a x $libpth` + ans=`./loc libtermlib.a x $libpth` case "$ans" in /usr/lib*|/lib*) @@ -2498,5 +2555,5 @@ ;; *) - ans=`loc libtermcap.a x $libpth` + ans=`./loc libtermcap.a x $libpth` case "$ans" in /usr/lib*|/lib*) @@ -2526,5 +2583,5 @@ rp='Specify termlib path:' . ./myread - termlib=`filexp $ans` + termlib=`./filexp $ans` ;; *) @@ -2546,13 +2603,13 @@ *) dflt=n ;; esac -cat <<'EOM' +cat <Cppsym.know -$cat <Cppsym -$startsh -case "\$1" in --l) list=true - shift - ;; -esac -unknown='' -case "\$list\$#" in -1|2) - for sym do - if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then - exit 0 - elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then - : - else - unknown="\$unknown \$sym" - fi - done - set X \$unknown - shift - ;; -esac -case \$# in -0) exit 1;; -esac -echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\ -#ifdef \1\\ -exit 0; _ _ _ _\1\\ \1\\ -#endif\\ -/' >Cppsym\$\$ -echo "exit 1; _ _ _" >>Cppsym\$\$ -$cppstdin $cppminus Cppsym2\$\$ -case "\$list" in -true) $awk 'NF > 5 {print substr(\$6,2,100)}' Cppsym.true -$cat Cppsym.true - : see if there is a vfork -$echo " " +echo " " if set vfork val -f d_hvfork; eval $csym; $val; then - $echo "vfork() found." >&4 - if Cppsym sgi; then - $echo "However, IRIX vfork() is buggy. We'll use fork() instead." >&4 - val="$define" - else - val="$undef" - fi + echo "vfork() found." >&4 + val="$undef" else - $echo "No vfork() found--will use fork() instead." >&4 + echo "No vfork() found--will use fork() instead." >&4 val="$define" fi @@ -2975,5 +2975,5 @@ $echo "Checking to see how well your C compiler groks the void type..." $cat >void.c <<'EOCP' -void main(); +void main(){;} EOCP if $cc -c void.c >/dev/null 2>&1 ; then @@ -2995,17 +2995,6 @@ : see if sigblock exists -if set sigblock val -f d_sigblock; eval $csym; $val; then - $echo "sigblock() found." >&4 - if Cppsym sgi; then - $echo "We'll ignore it on this Silicon Graphics box, though." - val="$undef" - else - val="$define" - fi -else - val="$undef" -fi -set d_sigblock -eval $setvar +set sigblock d_sigblock +eval $inlibc : see if sighold exists @@ -3020,15 +3009,49 @@ fi +: see if strcasecmp exists +set strcasecmp d_strcasecmp +eval $inlibc + +: see which of string.h or strings.h is needed +echo " " +strings=`./findhdr strings.h` +if $test "$strings" && $test -r "$strings"; then + echo "Using instead of ." >&4 + val="$undef" +else + val="$define" + strings=`./findhdr string.h` + if $test "$strings" && $test -r "$strings"; then + echo "Using instead of ." >&4 + else + echo "No string header found -- You'll surely have problems." >&4 + fi +fi +set i_string +eval $setvar + : index or strchr -$echo " " +echo " " if set index val -f; eval $csym; $val; then + if set strchr val -f d_strchr; eval $csym; $val; then + if $contains strchr "$strings" >/dev/null 2>&1 ; then + val="$define" + echo "strchr() found." >&4 + else + val="$undef" + echo "index() found." >&4 + fi + else val="$undef" - $echo "index() found." >&4 -elif set strchr val -f d_strchr; eval $csym; $val; then - val="$define" - $echo "strchr() found." >&4 + echo "index() found." >&4 + fi else - $echo "No index() or strchr() found!" >&4 + if set strchr val -f d_strchr; eval $csym; $val; then + val="$define" + echo "strchr() found." >&4 + else + echo "No index() or strchr() found!" >&4 val="$undef" + fi fi set d_strchr @@ -3038,4 +3061,30 @@ set strftime d_strftime eval $inlibc +case "$d_strftime" in +"$undef") + case "$strftimec" in + '') dflt="./strftime.c";; + *) dflt="$strftimec";; + esac + $cat <Cppsym.know +$cat <Cppsym +$startsh +case "\$1" in +-l) list=true + shift + ;; +esac +unknown='' +case "\$list\$#" in +1|2) + for sym do + if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then + exit 0 + elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then + : + else + unknown="\$unknown \$sym" + fi + done + set X \$unknown + shift + ;; +esac +case \$# in +0) exit 1;; +esac +echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\ +#ifdef \1\\ +exit 0; _ _ _ _\1\\ \1\\ +#endif\\ +/' >Cppsym\$\$ +echo "exit 1; _ _ _" >>Cppsym\$\$ +$cppstdin $cppminus Cppsym2\$\$ +case "\$list" in +true) $awk 'NF > 5 {print substr(\$6,2,100)}' Cppsym.true +$cat Cppsym.true -: Initialize h_sysfile -h_sysfile=false +: see if this is a termio system +val="$undef" +val2="$undef" +val3="$undef" +if $test `./findhdr termios.h`; then + set tcsetattr i_termios + eval $inlibc + val3="$i_termios" +fi +echo " " +case "$val3" in +"$define") echo "You have POSIX termios.h... good!" >&4;; +*) if Cppsym pyr; then + case "`/bin/universe`" in + ucb) if $test `./findhdr sgtty.h`; then + val2="$define" + echo " found." >&4 + else + echo "System is pyramid with BSD universe." + echo " not found--you could have problems." >&4 + fi;; + *) if $test `./findhdr termio.h`; then + val="$define" + echo " found." >&4 + else + echo "System is pyramid with USG universe." + echo " not found--you could have problems." >&4 + fi;; + esac + elif usg; then + if $test `./findhdr termio.h`; then + echo " found." >&4 + val="$define" + elif $test `./findhdr sgtty.h`; then + echo " found." >&4 + val2="$define" + else +echo "Neither nor found--you could have problems." >&4 + fi + else + if $test `./findhdr sgtty.h`; then + echo " found." >&4 + val2="$define" + elif $test `./findhdr termio.h`; then + echo " found." >&4 + val="$define" + else +echo "Neither nor found--you could have problems." >&4 + fi + fi;; +esac +set i_termio; eval $setvar +val=$val2; set i_sgtty; eval $setvar +val=$val3; set i_termios; eval $setvar : define an alternate in-header-list? function @@ -3575,91 +3798,8 @@ done' -: see if fcntl.h is there -val='' -set fcntl.h val +: see if stdlib is available +set stdlib.h i_stdlib eval $inhdr -: see if we can include fcntl.h -case "$val" in -"$define") - echo " " - if $h_fcntl; then - val="$define" - echo "We'll be including ." >&4 - else - val="$undef" - if $h_sysfile; then - echo "We don't need to include if we include ." >&4 - else - echo "We won't be including ." >&4 - fi - fi - ;; -*) - h_fcntl=false - val="$undef" - ;; -esac -set i_fcntl -eval $setvar - -: see if ptem.h exists -if $test -r /usr/include/sys/ptem.h ; then - $echo "sys/ptem.h found." - i_ptem="$define" -else - i_ptem="$undef" -fi - -: see if this is a termio system -val="$undef" -val2="$undef" -val3="$undef" -$echo " " -if Cppsym pyr; then - case "`bin/universe`" in - ucb) if $test `./findhdr sgtty.h`; then - val2="$define" - $echo " found." >&4 - else - $echo "System is pyramid with BSD universe." >&4 - $echo " not found--you could have problems." >&4 - fi;; - *) if $test `./findhdr termio.h`; then - val="$define" - $echo " found." >&4 - else - $echo "System is pyramid with USG universe." >&4 - $echo " not found--you could have problems." >&4 - fi;; - esac -elif bsd; then - if $test `./findhdr sgtty.h`; then - $echo " found." >&4 - val2="$define" - elif $test `./findhdr termio.h`; then - $echo " found." >&4 - val="$define" - else -$echo "Neither nor found--you could have problems." >&4 - fi -else - if $test -d /usr/convex; then - echo " found." >&4 - val3="$define" - elif $test `./findhdr termio.h`; then - echo " found." >&4 - val="$define" - elif $test `./findhdr sgtty.h`; then - echo " found." >&4 - val2="$define" - else -echo "Neither nor found--you could have problems." >&4 - fi -fi -set i_termio; eval $setvar -val=$val2; set i_sgtty; eval $setvar -val=$val3; set i_termios; eval $setvar - : see if this is an sysdir system set sys/dir.h i_sysdir @@ -3685,57 +3825,80 @@ eval $inhdr -: see if this is a vfork system -set vfork.h i_vfork -eval $inhdr - -: check for ispell spelling checker -case "$ispell_path" in -none) dflt=n - dflt_path= - dflt_options= - ;; -'') if $test -n "$ispell" -a "$ispell" != "ispell"; then - dflt=y - dflt_path=$ispell - dflt_options='-x' - else - dflt=n - dflt_path= - dflt_options= - fi - ;; -*) dflt=y - dflt_path=$ispell_path - dflt_options=$ispell_options - ;; +: see if we should include time.h, sys/time.h, or both +echo " " +echo "Testing to see if we should include , or both." >&4 +$echo $n "I'm now running the test program...$c" +$cat >try.c <<'EOCP' +#include +#ifdef I_TIME +#include +#endif +#ifdef I_SYSTIME +#include +#endif +#ifdef I_SYSSELECT +#include +#endif +main() +{ + struct tm foo; +#ifdef S_TIMEVAL + struct timeval bar; +#endif +#ifdef S_TIMEZONE + struct timezone tzp; +#endif + if (foo.tm_sec == foo.tm_sec) + exit(0); +#ifdef S_TIMEVAL + if (bar.tv_sec == bar.tv_sec) + exit(0); +#endif + exit(1); +} +EOCP +flags='' +for s_timezone in '-DS_TIMEZONE' ''; do +sysselect='' +for s_timeval in '-DS_TIMEVAL' ''; do +for i_time in '' '-DI_TIME'; do +for i_systime in '-DI_SYSTIME' ''; do + case "$flags" in + '') $echo $n ".$c" + if $cc $ccflags \ + $i_time $i_systime $sysselect $s_timeval $s_timezone \ + try.c -o try >/dev/null 2>&1 ; then + set X $i_time $i_systime $sysselect $s_timeval + shift + flags="$*" + echo " " + $echo $n "Succeeded with $flags$c" + fi + ;; + esac +done +done +done +done +echo " " +case "$flags" in +*I_TIME*) i_time="$define" + echo "We'll include ." >&4;; +*) i_time="$undef";; +esac +case "$flags" in +*I_SYSTIME*) i_systime="$define" + echo "We'll include ." >&4;; +*) i_systime="$undef";; esac -$cat </dev/null 2>&1; then - dflt=n - case "$silent" in - true) ;; - *) - $cat < makedepend.out &" -It can take a while, so you might not want to run it right now. - -EOM - ;; - esac - rp="Run make depend now?" - . ./UU/myread - case "$ans" in - y*) - make depend && echo "Now you must run a make." - ;; - *) - echo "You must run 'make depend' then 'make'." - ;; - esac -elif test -f [Mm]akefile; then - echo " " - echo "Now you must run a make." -else - echo "Done." -fi +echo " " +echo 'Now type "make".' $rm -f kit*isdone ark*isdone Index:EXTERN.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:INSTALL @@ -26,8 +26,7 @@ Some things Configure will figure out for itself, other things it will ask you about. It will then proceed to make config.h, config.sh, the - Makefile, and a bunch of shell scripts. It will also do a make depend - for you, or let you start one in the background. You might possibly - have to trim # comments from the front of Configure if your sh doesn't - handle them, but all other # comments will be taken care of. + Makefile, and a bunch of shell scripts. You might possibly have to + trim # comments from the front of Configure if your sh doesn't handle + them, but all other # comments will be taken care of. 4) Glance through config.h and common.h to make sure system dependencies @@ -43,6 +42,6 @@ want to be using trn. Feel free to give it a try, though -- there are some defines in common.h that can be turned off to try to make trn fit - (see the System Dependencies section). You should run "make depend" - again to be safe. + (see the System Dependencies section). You might run a "make depend" + afterward just to be safe. 5) make Index:INTERN.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:MANIFEST @@ -19,4 +19,5 @@ art.c Routines to display an article. art.h Public info regarding art.c. +artcheck.c An article-checking program called from Pnews. artio.c Reserved for the article abstract type, someday. artio.h Public info regarding artio.c. @@ -36,4 +37,5 @@ decode.c Routines common to the binary decoders decode.h Public info for the binary decoders. +dependencies A pre-made list of the source's dependencies. edit_dist.c Routines to find the edit distance between two strings. final.c Finalization (exit) routines. @@ -108,4 +110,5 @@ search.c Regular expression processing ala emacs. search.h Public info regarding search.c. +strftime.c Source for strftime.c, if needed. sw.c Switch processing routines. sw.h Public info regarding switch.c. Index:Makefile.SH @@ -31,4 +31,6 @@ ndirc = $ndirc ndiro = $ndiro +strftimec = $strftimec +strftimeo = $strftimeo libs = $libndir $termlib $jobslib -lm $libs @@ -56,7 +58,8 @@ c4 = only.c rcln.c rcstuff.c respond.c rthread.c rt-mt.c rt-ov.c c5 = rt-process.c rt-page.c rt-select.c rt-util.c rt-wumpus.c search.c -c6 = sw.c term.c trn.c util.c unship.c uudecode.c $(nntpsrc) +c6 = $(strftimec) sw.c term.c trn.c util.c unship.c uudecode.c +c7 = $(nntpsrc) -c = $(c1) $(c2) $(c3) $(c4) $(c5) $(c6) +c = $(c1) $(c2) $(c3) $(c4) $(c5) $(c6) $(c7) obj1 = addng.o art.o artio.o artsrch.o autosub.o backpage.o bits.o cache.o @@ -65,7 +68,8 @@ obj4 = only.o rcln.o rcstuff.o respond.o rthread.o rt-mt.o rt-ov.o obj5 = rt-process.o rt-page.o rt-select.o rt-util.o rt-wumpus.o search.o -obj6 = sw.o term.o trn.o util.o unship.o uudecode.o parsedate.o $(nntpobj) +obj6 = $(strftimeo) sw.o term.o trn.o util.o unship.o uudecode.o parsedate.o +obj7 = $(nntpobj) -obj = $(obj1) $(obj2) $(obj3) $(obj4) $(obj5) $(obj6) +obj = $(obj1) $(obj2) $(obj3) $(obj4) $(obj5) $(obj6) $(obj7) lintflags = -phbvxac @@ -92,4 +96,7 @@ #NNTP $(CC) $(LDFLAGS) getactive.o nntpinit.o nntpclient.o -o getactive $(libs) +artcheck: artcheck.o + $(CC) $(LDFLAGS) artcheck.o -o artcheck $(libs) + parsedate.o: parsedate.y @echo 'Expect 6 shift/reduce conflicts' @@ -98,8 +105,14 @@ $(CC) -c $(CFLAGS) parsedate.c rm -f parsedate.c +#STRFTIME +#STRFTIME$(strftimeo): $(strftimec) +#STRFTIME $(CC) -c $(CFLAGS) $(strftimec) + +unipatch: unipatch.o + $(CC) $(LDFLAGS) unipatch.o -o unipatch # if a .h file depends on another .h file... $(h): - touch $@ + -touch $@ install: $(public) $(private) $(manpages) @@ -151,14 +164,14 @@ # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE -config.h: config.h.SH config.sh ; sh config.h.SH -Makefile: Makefile.SH config.sh ; sh Makefile.SH -makedepend: makedepend.SH config.sh ; sh makedepend.SH -$(obj1): - @echo "You haven't done a "'"make depend" yet!'; exit 1 !NO!SUBS! +$cat dependencies >>Makefile case "$d_nntp" in define) sed < Makefile -e '/^#NNTP/s/^#NNTP//' > Makefile.new ;; *) sed < Makefile -e '/^#NNTP/d' > Makefile.new ;; esac -mv Makefile.new Makefile +case "$strftimec" in +'') sed < Makefile.new -e '/^#STRFTIME/d' > Makefile ;; +*) sed < Makefile.new -e '/^#STRFTIME/s/^#STRFTIME//' > Makefile ;; +esac +rm Makefile.new $eunicefix Makefile Index:NEW @@ -1,10 +1,55 @@ This file will aquaint you with the user-visible changes in trn 3.0. -For a list of bug fixes, see the ChangeLog file. - See the discussion of the -a option and the 't' command (newsgroup selection level), and the 'T' command (article level & in kill files) for slight incompatibilities between trn 2.5 and trn 3.0. +Changes from trn 3.0 to trn 3.1: + + o Added a new header-searching syntax: /string/Hheader:cmd. + This allows you to match a string on any header that trn + knows about and is faster on the NNTP side than full-header + matching. Example: /: .../Hlines:j would junk all postings + longer than 99 lines. + o Two new commands can be put into a group's kill file: *j + (mark all articles from THRU to the end of the group) and *X + (mark all unselected articles from THRU to the end of the group). + o Pnews (using artcheck) now checks the active file as well as + the newsgroups file for each group on the Newsgroups line. This + lets you know whenever you specify a group that doesn't exist. + Also, the NNTP version has been fixed to provide full checking. + o Pnews/Rnmail have been modified to allow you to type either upper + or lower case for the response letters, and use "sp*ell" in addition + to "c*heck" for the spelling checker ("s*end" is unchanged). + o Pnews/Rnmail each have a pre-edit signature appending option. + If you use the file DOTDIR/.news_sig INSTEAD of .signature Pnews + will append your signature before you edit the file. Rnmail uses + the file DOTDIR/.mail_sig. Note also that the names may be + customized with the environment variables NEWSSIGNATURE and + MAILSIGNATURE, if desired (allowing a per-group signature). + o Added the modifiers '>' and ')' to interpreted strings. For + example: %>f gives you the address only on the From line, + while %)f gives you the real name portion. + o Added the 'O' command (newsgroup level) that works just like 'o' + except that it does not visit empty groups. + o The killfile is fully saved before manual editing with Ctrl-K + (message-id commands used to be saved only on exit from the group). + o The screen is now refreshed when the window size changes. + o Trn now makes use of stdlib.h, unistd.h (if available) and does a + more intelligent inclusion of time.h & sys/time.h (as needed). + o Trn doesn't loop through the current thread if unread articles + still exist in it. Also fixed various problems with '>' & 'P'. + o The 'D' command in the selector no longer jumps back to the top. + o The NNTP version has a different new-article aquisition strategy. + Your nntp server must send up-to-date information in response to + the GROUP command (INN's nnrpd does) for a group to expand while + you're in it. Also, you can now set the minimum time for trn to + wait (see -z) before it refetches the active file at the end of + the newsgroups. The default is 5 minutes. + o Optional metamail support pauses between the headers and the + metamail-interpreted article. Also, the 'v' command displays the + raw article without metamail processing. + o Numerous portability changes and bug fixes. + Changes from trn 2.5 to trn 3.0: Index:Pnews.1 @@ -1,15 +1,4 @@ .\" $Id: Pnews.1,v 4.4.3.1 1992/02/01 03:17:20 sob PATCH_3 sob $ -.\" -.\" $Log: Pnews.1,v $ -.\" Revision 4.4.3.1 1992/02/01 03:17:20 sob -.\" Version 4.4 Patchlevel 3 .\" -.\" Revision 4.4.1.1 1991/09/25 19:36:48 sob -.\" Changed quote macro to "standard" one -.\" -.\" Revision 4.4 1991/09/09 20:18:23 sob -.\" release 4.4 -.\" -.\" .\" This software is Copyright 1991 by Stan Barber. .\" @@ -20,5 +9,5 @@ .\" included prominently in any copy made. .\" -.\" The author make no claims as to the fitness or correctness of this software +.\" The authors make no claims as to the fitness or correctness of this software .\" for any use whatsoever, and it is provided as is. Any use of this software .\" is at the user's own risk. @@ -35,14 +24,10 @@ .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. -.\" +.\" unbreakable dash. +.tr \(*W-|\(bv\*(Tr .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 -- \(*W- +.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch .ds L" "" .ds R" "" @@ -79,5 +64,18 @@ will tell you what it wants to know. .PP +If you put a +.I .signature +file in your home directory, your inews program will usually append it +to your message after you are done editing it. +If you prefer to see your signature while you are editing, rename your +\&.signature file to be .news_sig and it will be appended before you +begin to edit. +Note that .news_sig obeys the setting of DOTDIR, but .signature does +not (since it is out of Pnew's control). +If both .news_sig and .signature exist you'll get two signatures appended. +.PP The -h form is used when invoked from +.I trn +or .IR rn . If your editor can edit multiple files, and you want the article to which @@ -86,5 +84,5 @@ You can also modify the the NEWSHEADER environment variable to change the header file that -.I rn +.I [t]rn passes to Pnews. .SH ENVIRONMENT @@ -142,7 +140,9 @@ $DOTDIR/.article .br +$DOTDIR/.news_sig +.br ~/dead.article .SH SEE ALSO -rn(1), Rnmail(1), inews(1) +trn(1), rn(1), Rnmail(1), inews(1) .SH DIAGNOSTICS .SH BUGS Index:Pnews.SH @@ -28,5 +28,5 @@ # System dependencies -mailer="${mailer-/bin/mail}" +mailer="\${RNMAILER-${mailer-/bin/mail}}" # if you change this to something that does signatures, take out signature code @@ -70,4 +70,5 @@ cont="$contdist" +active=${active-$lib/active} test=${test-test} sed=${sed-sed} @@ -82,5 +83,5 @@ !GROK!THIS! -case "$ignoreorg" in +case "$d_ignoreorg" in define) $spitshell >>Pnews <<'!NO!SUBS!' orgname=${NEWSORG-$orgname} @@ -98,4 +99,20 @@ speller=$rnlib/Speller +tmp="${TMPDIR-/tmp}" +newsgroups=${NEWSGROUPS-$lib/newsgroups} +active=${NEWSACTIVE-$active} +news_sig=${NEWSSIGNATURE-$dotdir/.news_sig} + +if $test ! -f $newsgroups -a -x $rnlib/getactive; then + newsgroups="$tmp/Pnng.$$"; + rmlist="$newsgroups"; + cmdlist="$rnlib/getactive newsgroups $tmp/Pnng.$$ ; "; +fi +if $test ! -f $active -a -x $rnlib/getactive; then + active="$tmp/Pnact.$$"; + rmlist="$rmlist $active"; + cmdlist="$cmdlist $rnlib/getactive active $tmp/Pnact.$$"; +fi + if $test -f $dotdir/.pnewsexpert; then expertise=expert @@ -157,6 +174,9 @@ ;; esac - rescue="sleep 1; $cat $tmpart >>${HOME-$LOGDIR}/dead.article ; $echo Article appended to ${HOME-$LOGDIR}/dead.article ; exit" - trap "$rescue" 1 + rescue="sleep 1; $cat $tmpart >>${HOME-$LOGDIR}/dead.article ; rm -f $rmlist ; $echo Article appended to ${HOME-$LOGDIR}/dead.article ; exit" + if $test "$rmlist" ; then + trap "rm -f $rmlist" 0 + fi + trap "trap : 1; $rescue" 1 trap "$rescue" 2 @@ -280,5 +300,5 @@ esac ans="" -while $test "$ans" = "" ; do +while $test "X$ans" = X ; do $echo $n "Are you absolutely sure that you want to do this? [ny] $c" read ans @@ -296,6 +316,11 @@ done +# run getactive in the background, if necessary +if $test "$cmdlist"; then + ( eval $cmdlist ) & +fi + file=h -while $test "$file" = h ; do +while $test "X$file" = Xh ; do $echo "" $echo $n "Prepared file to include [none]: $c" @@ -324,4 +349,9 @@ $echo "" +if $test -r $news_sig; then + $echo "-- " >> $tmpart + $sed 4q $news_sig >> $tmpart +fi + while true ; do case $state in @@ -354,5 +384,5 @@ ;; esac - while $test "$tmp" = h ; do + while $test "X$tmp" = Xh ; do $echo $n "Editor [${VISUAL-${EDITOR-$defeditor}}]: $c" read tmp @@ -382,6 +412,8 @@ check) + # wait for possible background getactive + wait # warn about long lines, malformed headers, misspelled newsgroups - $artcheck $tmpart 79 $lib/newsgroups + $artcheck $tmpart 79 $newsgroups $active state=ask ;; @@ -391,10 +423,10 @@ $echo $n "Check spelling, Send, Abort, Edit, or List? $c" read ans - + case "$ans" in - a*) + [aA]*) state=rescue ;; - e*) + [eE]*) set $ans case $# in @@ -403,16 +435,16 @@ state=edit ;; - l*) + [lL]*) $pager $tmpart state=ask ;; - s*) - state=send - ;; - c*) + [cC]*|[sS][pP]*) $speller $tmpart state=ask ;; - h*) + [sS]*) + state=send + ;; + [hH]*) $cat <<'EOH' @@ -436,5 +468,5 @@ shift case "$1" in - *,*) set `$echo $1 | tr ',' ' '`;; + *,*) set `$echo $1 | $tr ',' ' '`;; esac for newsgroup in $*; do @@ -487,7 +519,9 @@ case "$tryinews" in yes) - if $sed '1,/^[ ]*$/{/^[A-Z][-A-Za-z0-9]*:[ ]*$/d; + headerstrip='1,/^[ ]*$/{/^[A-Z][-A-Za-z0-9]*:[ ]*$/d; /^X-ORIGINAL-NEWSGROUPS:.*$/d; - /^[Cc][Cc]:/d;}' $tmpart | $inews -h ; then + /^[Cc][Cc]:/d; + /^Distribution: world/d;}' + if $sed "$headerstrip" $tmpart | $inews -h ; then : null else @@ -496,13 +530,16 @@ cc=`$sed -n '1,/^[ ]*$/{/^[Cc][Cc]:[ ][^ ]/p;}' $tmpart| $sed 's/^[Cc][Cc]:[ ][ ]*//'` - if $test "$cc " != " " ; then - set -- $cc + if $test "X$cc" != X ; then + set X $cc + shift case "$mailer" in *recmail) - $echo To: $cc | $cat - $tmpart | $mailer + ($echo To: $cc + $sed "$headerstrip" $tmpart) | $mailer ;; *) - set -- `echo $cc | sed 's/,/ /g'` - $mailer $@ < $tmpart + set X `echo $cc | sed 's/,/ /g'` + shift + $sed "$headerstrip" $tmpart | $mailer $@ ;; esac @@ -556,5 +593,5 @@ 0) ng=h - while $test "$ng" = h ; do + while $test "X$ng" = Xh ; do $echo "" $echo $n "Newsgroup(s): $c" @@ -600,5 +637,5 @@ esac -while $test "$dist" = h ; do +while $test "X$dist" = Xh ; do if $test -f $lib/distributions; then $echo " " @@ -667,5 +704,5 @@ 0) title=h - while $test "$title" = h ; do + while $test "X$title" = Xh ; do $echo "" $echo $n "Title/Subject: $c" @@ -716,10 +753,10 @@ case ${NAME-$nametype} in bsd) - if $test "$ypmatch" != ""; then + if $test "X$ypmatch" != X; then fullname=`$ypmatch $logname passwd 2>/dev/null | $sed -e "s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/"` - elif $test "$nidump" != ""; then + elif $test "X$nidump" != X; then fullname=`$nidump passwd / | $sed -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"` fi - if $test "$fullname" = ""; then + if $test "X$fullname" = X; then fullname=`$sed /dev/null | $sed -e "s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^(:]*\).*"'$'"/\1/" -e "s/^.*-//" -e "q"` - fi - if $test "$fullname" = ""; then - fullname=`$sed /dev/null | $sed -e "s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^(:]*\).*"'$'"/\1/" -e "s/^.*-//" -e "q"` + fi + if $test "X$fullname" = X; then + fullname=`$sed >Rnmail <<'!NO!SUBS!' orgname=${NEWSORG-$orgname} @@ -67,4 +70,5 @@ tmpart=$dotdir/.letter speller=$rnlib/Speller +mail_sig=${MAILSIGNATURE-$dotdir/.mail_sig} headerfile="" @@ -150,5 +154,5 @@ file=h -while $test "$file" = h ; do +while $test X$file = Xh ; do $echo "" $echo $n "Prepared file to include [none]: $c" @@ -177,4 +181,9 @@ $echo "" +if $test -r $mail_sig; then + $echo "-- " >> $tmpart + $cat $mail_sig >> $tmpart +fi + while true ; do case $state in @@ -221,10 +230,10 @@ $echo $n "Check spelling, Send, Abort, Edit, or List? $c" read ans - + case $ans in - a*) + [aA]*) state=rescue ;; - e*) + [eE]*) set $ans case $# in @@ -233,16 +242,16 @@ state=edit ;; - l*) + [lL]*) $pager $tmpart state=ask ;; - s*) - state=send - ;; - c*) + [cC]*|[sS][pP]*) $speller $tmpart state=ask ;; - h*) + [sS]*) + state=send + ;; + [hH]*) $cat <<'EOH' Index:Speller.SH @@ -15,10 +15,9 @@ export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$) -# temporary, or is it? -tmpdir=/tmp +tmpdir="${TMPDIR-/tmp}" # what pager you use--if you have kernal paging use cat pager="\${PAGER-$pager}" # either the ispell program or "none" -ispell=$ispell_path +ispell=$ispell_prg ispell_options=$ispell_options test=${test-test} @@ -130,5 +129,5 @@ if $test "$ispell " = "none "; then - ($echo ---- mispelled words -------------------------------------- + ($echo ---- misspelled words ------------------------------------- spell $mine | fmt $echo ----------------------------------------------------------- Index:addng.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -45,7 +45,4 @@ register char *s, *status; register NG_NUM ngnum; -#ifndef ACTIVE_TIMES - long birthof(); -#endif tmpname = filexp(RNEWNAME); @@ -175,5 +172,5 @@ { register char *s; - long lastone; + time_t lastone; NG_NUM oldnext = nextrcline; /* remember # lines in newsrc */ @@ -249,5 +246,5 @@ /* return creation time of newsgroup */ -long +time_t birthof(ngnam,ngsize) char *ngnam; @@ -257,9 +254,9 @@ long tot; - if (!nntp_group(ngnam)) + if (!nntp_group(ngnam,0)) return 0; /* not a real group */ (void) sscanf(ser_line,"%*d%ld",&tot); if (tot > 0) - return time(Null(long *)); + return time(Null(time_t*)); return 0; @@ -269,5 +266,5 @@ sprintf(tst, ngsize ? "%s/%s/1" : "%s/%s" ,spool,getngdir(ngnam)); if (stat(tst,&filestat) < 0) - return (ngsize ? 0L : time(Null(long *))); + return (ngsize ? 0L : time(Null(time_t*))); /* not there, assume something good */ return filestat.st_mtime; Index:addng.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -20,5 +20,5 @@ bool find_new_groups _((void)); # else -long birthof _((char*,ART_NUM)); +time_t birthof _((char*,ART_NUM)); # endif bool scanactive _((void)); Index:art.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -73,4 +73,7 @@ art_init() { +#ifdef INNERSEARCH + init_compex(&gcompex) +#endif ; } @@ -81,17 +84,34 @@ display_mime() { + int code = 1; + if (!getenv("NOMETAMAIL")) { - int code; + char oldmode = mode; interp(cmd_buf,(sizeof cmd_buf),getval("MIMESHOW",MIMESHOW)); - termlib_reset(); - resetty(); - code = doshell(SH,cmd_buf); - noecho(); - crmode(); - termlib_init(); - return code; + fputs("Display MIME article with metamail? [yn]",stdout); + fflush(stdout); + eat_typeahead(); +#ifdef PENDING + cache_until_key(); +#endif + mode = 'p'; + getcmd(buf); + mode = oldmode; + setdef(buf,"y"); +#ifdef VERIFY + printcmd(); +#endif + putchar('\n') FLUSH; + if (*buf == 'y') { + termlib_reset(); + resetty(); + code = doshell(SH,cmd_buf); + noecho(); + crmode(); + termlib_init(); + } } - return 1; + return code; } #endif @@ -270,4 +290,5 @@ strcpy(art_buf+6,s); } +#ifdef HAS_STRFTIME else if (in_header == DATE_LINE) { if (do_hiding && curr_artp->date != -1) @@ -276,4 +297,5 @@ localtime(&curr_artp->date)); } +#endif #ifdef METAMAIL else if (in_header == CONTENT_LINE) { @@ -310,5 +332,5 @@ else { /* just a normal line */ #ifdef METAMAIL - if (mime_article && !tried_display_mime) { + if (mime_article && do_hiding && !tried_display_mime) { if (display_mime() == 0) return DA_NORM; @@ -560,5 +582,4 @@ #endif fflush(stdout); -/* reinp_pager: /* unused, commented for lint */ eat_typeahead(); #ifdef DEBUG @@ -821,6 +842,5 @@ *buf = 'n'; /* FALL THROUGH */ - case 'k': case 'K': - case 'T': case 'J': + case 'k': case 'K': case 'J': case 'n': case 'N': case Ctl('n'): case 's': case 'S': @@ -847,4 +867,5 @@ case '=': case '?': + case 'A': case 'T': case 'c': case 'C': #ifdef DEBUG Index:art.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:artcheck.c @@ -1,13 +1,18 @@ /* $Id: artcheck.c,v 3.0 1992/02/01 03:09:32 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ /* A program to check an article's validity and print warnings if problems ** are found. ** -** Usage: artcheck
+** Usage: artcheck
*/ #include "EXTERN.h" #include "common.h" +#include "config.h" #define MAXNGS 100 @@ -18,14 +23,15 @@ char *argv[]; { - FILE *fp, *fp2; + FILE *fp, *fp_active = NULL, *fp_ng = NULL; char buff[LBUFLEN], *cp, *cp2; char *ngptrs[MAXNGS]; int nglens[MAXNGS]; - int i, col, max_col_len, line_num = 0, ngcnt = 0; + int foundactive[MAXNGS]; + int i, col, max_col_len, line_num = 0, ngcnt = 0, ngleft; int found_newsgroups = 0; - if (argc != 4 || !(max_col_len = atoi(argv[2]))) { + if (argc != 5 || !(max_col_len = atoi(argv[2]))) { fprintf(stderr, "\ -Usage: artcheck
\n"); +Usage: artcheck
\n"); exit(1); } @@ -49,5 +55,5 @@ break; } - if (cp[1] != ' ') { + if (cp[1] != ' ' && cp[1] != '\0') { printf("\n\ ERROR: header on line %d does not have a space after the colon:\n%s\n", @@ -72,4 +78,5 @@ if (ngcnt < MAXNGS) { nglens[ngcnt] = strlen(cp); + foundactive[ngcnt] = 0; ngptrs[ngcnt] = malloc(nglens[ngcnt]+1); if (!ngptrs[ngcnt]) { @@ -112,15 +119,53 @@ } if (ngcnt) { + struct stat st; + if (stat(argv[3], &st) != -1 && st.st_size > 0) + fp_ng = fopen(argv[3], "r"); + if (stat(argv[4], &st) != -1 && st.st_size > 0) + fp_active = fopen(argv[4], "r"); + } + if (ngcnt && (fp_ng != NULL || fp_active != NULL)) { /* Print a note about each newsgroup */ printf("\nYour article's newsgroup%s:\n", ngcnt == 1? "" : "s"); - if ((fp2 = fopen(argv[3], "r")) != NULL) { - while (fgets(buff, LBUFLEN, fp2)) { + if (fp_active == NULL) { + for (i = 0; i < ngcnt; i++) { + foundactive[i] = 1; + } + } else { + ngleft = ngcnt; + while (fgets(buff, LBUFLEN, fp_active)) { + if (!ngleft) + break; + for (i = 0; i < ngcnt; i++) { + if (!foundactive[i]) { + if ((buff[nglens[i]] == '\t' || buff[nglens[i]] == ' ') + && strnEQ(ngptrs[i], buff, nglens[i])) { + foundactive[i] = 1; + ngleft--; + } + } + } + } + } + fclose(fp_active); + if (fp_ng != NULL) { + ngleft = ngcnt; + while (fgets(buff, LBUFLEN, fp_ng)) { + if (!ngleft) + break; for (i = 0; i < ngcnt; i++) { - if (ngptrs[i]) { + if (foundactive[i] && ngptrs[i]) { if ((buff[nglens[i]] == '\t' || buff[nglens[i]] == ' ') && strnEQ(ngptrs[i], buff, nglens[i])) { - printf("%s", buff); + cp = &buff[nglens[i]]; + *cp++ = '\0'; + while (*cp == ' ' || *cp == '\t') + cp++; + if (cp[0] == '?' && cp[1] == '?') + cp = "[no description available]\n"; + printf("%-23s %s", buff, cp); free(ngptrs[i]); ngptrs[i] = 0; + ngleft--; } } @@ -128,7 +173,12 @@ } } + fclose(fp_ng); for (i = 0; i < ngcnt; i++) { - if (ngptrs[i]) { - printf("%s\t[no description available]\n", ngptrs[i]); + if (!foundactive[i]) { + printf("%-23s ** invalid news group -- check spelling **\n", + ngptrs[i]); + free(ngptrs[i]); + } else if (ngptrs[i]) { + printf("%-23s [no description available]\n", ngptrs[i]); free(ngptrs[i]); } Index:artio.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -23,4 +23,5 @@ #include "bits.h" #include "final.h" +#include "ngdata.h" #include "INTERN.h" #include "artio.h" @@ -63,6 +64,10 @@ #endif if (!artfp) { +#ifdef ETIMEDOUT if (errno == ETIMEDOUT) goto retry_open; +#endif + if (errno == EINTR) + goto retry_open; uncache_article(ap,FALSE); } else { Index:artio.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:artsrch.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -39,9 +39,7 @@ { #ifdef ARTSEARCH -#ifdef ZEROGLOB init_compex(&sub_compex); init_compex(&art_compex); #endif -#endif } @@ -64,5 +62,6 @@ int normal_return = SRCH_NOTFOUND; /* assume no commands */ bool saltaway = FALSE; /* store in KILL file? */ - char howmuch; /* search scope: subj/from/head/art */ + char howmuch; /* search scope: subj/from/Hdr/head/art */ + char *srchhdr; /* header to search if Hdr scope */ bool doread; /* search read articles? */ bool foldcase = TRUE; /* fold upper and lower case? */ @@ -76,9 +75,11 @@ compex = &art_compex; if (patbuf[1]) { - howmuch = 0; + howmuch = ARTSCOPE_SUBJECT; + srchhdr = Nullch; doread = FALSE; } else { howmuch = art_howmuch; + srchhdr = art_srchhdr; doread = art_doread; } @@ -91,11 +92,23 @@ } if (*s) { /* modifiers or commands? */ - for (s++; *s && index("Karchf",*s); s++) { + for (s++; *s && index("KarchHf",*s); s++) { if (*s == 'f') /* scan from line */ - howmuch = 1; - else if (*s == 'h') /* scan header */ - howmuch = 2; + howmuch = ARTSCOPE_FROM; + else if (*s == 'H') { /* scan a specific header */ + howmuch = ARTSCOPE_ONEHDR; + srchhdr = s + 1; + if (!(s = index(srchhdr, ':'))) { + s = buf + strlen(buf); + *s++ = ':'; + *s = '\0'; + } + else + s++; + srchhdr = savestr(srchhdr); + break; + } else if (*s == 'h') /* scan header */ + howmuch = ARTSCOPE_HEAD; else if (*s == 'a') /* scan article */ - howmuch = 3; + howmuch = ARTSCOPE_ARTICLE; else if (*s == 'r') /* scan read articles */ doread = TRUE; @@ -117,4 +130,9 @@ } art_howmuch = howmuch; + if (art_srchhdr != srchhdr) { + if (art_srchhdr) + free(art_srchhdr); + art_srchhdr = srchhdr; + } art_doread = doread; if (srchahead) @@ -124,5 +142,5 @@ register char *h; - howmuch = 0; /* just search subjects */ + howmuch = ARTSCOPE_SUBJECT; /* just search subjects */ doread = (cmdchr == Ctl('p')); if (cmdchr == Ctl('n')) @@ -133,5 +151,6 @@ h = pattern + strlen(pattern); interp(h,patbufsiz - (h-patbuf),"%\\s"); /* fetch current subject */ - if (cmdchr == 'k' || cmdchr == 'K' || cmdchr == '+' || cmdchr == ',') { + if (cmdchr == 'k' || cmdchr == 'K' || cmdchr == ',' + || cmdchr == '+' || cmdchr == '.') { if (cmdchr != 'k') saltaway = TRUE; @@ -139,11 +158,15 @@ if (cmdchr == '+') cmdlst = savestr("++"); - else if (cmdchr == ',') - cmdlst = savestr(","); - mark_as_read(); /* this article has this subject */ + else if (cmdchr == '.') + cmdlst = savestr("."); + else { + if (cmdchr == ',') + cmdlst = savestr(","); + mark_as_read(); /* this article has this subject */ + } if (!*h) { #ifdef VERBOSE IF(verbose) - fputs("\nCannot delete null subject.\n",stdout) FLUSH; + fputs("\nCannot process a null subject.\n",stdout) FLUSH; ELSE #endif @@ -155,9 +178,13 @@ #ifdef VERBOSE else if (verbose) - printf("\nMarking subject \"%s\" as read.\n",h) FLUSH; + if (cmdchr != '+' && cmdchr != '.') + printf("\nMarking subject \"%s\" as read.\n",h) FLUSH; + else + printf("\nSelecting subject \"%s\".\n",h) FLUSH; #endif } else if (!srchahead) srchahead = -1; + { /* compensate for notesfiles */ register int i; @@ -181,5 +208,4 @@ if (saltaway) { char saltbuf[LBUFLEN]; - static char *scopestr = "fha"; s = saltbuf; @@ -188,6 +214,12 @@ if (doread) *s++ = 'r'; - if (howmuch > 0) + if (howmuch != ARTSCOPE_SUBJECT) { *s++ = scopestr[howmuch]; + if (howmuch == ARTSCOPE_ONEHDR) + safecpy(s,srchhdr,LBUFLEN-(s-saltbuf)); + s = index(s,':'); + if (!s) + s = saltbuf+LBUFLEN-2; + } *s++ = ':'; if (!cmdlst) @@ -214,6 +246,6 @@ } srchfirst = (doread? absfirst : - (mode == 'k' && (howmuch > 1 || lastart - last_cached > 25) - ? killfirst : firstart)); + (mode == 'k' && (howmuch > ARTSCOPE_FROM || lastart - last_cached > 25) + ? killfirst : firstart)); if (backward) { if (cmdlst && art <= lastart) @@ -285,35 +317,51 @@ return FALSE; - if (scope <= 1) { - if (!scope) { - strcpy(buf,"Subject: "); - strncpy(buf+9,fetchsubj(artnum,FALSE),256); + switch (scope) { + case ARTSCOPE_SUBJECT: + strcpy(buf,"Subject: "); + strncpy(buf+9,fetchsubj(artnum,FALSE),256); #ifdef DEBUG - if (debug & DEB_SEARCH_AHEAD) - printf("%s\n",buf) FLUSH; + if (debug & DEB_SEARCH_AHEAD) + printf("%s\n",buf) FLUSH; #endif - } else { - strcpy(buf, "From: "); - strncpy(buf+6,fetchfrom(artnum,FALSE),256); + break; + case ARTSCOPE_FROM: + strcpy(buf, "From: "); + strncpy(buf+6,fetchfrom(artnum,FALSE),256); + break; + case ARTSCOPE_ONEHDR: + { + int header_num; + char *s; + assert(art_srchhdr != Nullch); + s = index(art_srchhdr,':'); + header_num = set_line_type(art_srchhdr, s); + if (header_num == SOME_LINE) + return FALSE; /* FIX ME */ + untrim_cache = TRUE; + strcpy(buf, art_srchhdr); + sprintf(buf + (s-art_srchhdr), ": %s", + prefetchlines(artnum,header_num,FALSE)); + untrim_cache = FALSE; + break; + } + default: + if (!parseheader(artnum)) + return FALSE; + /* see if it's in the header */ + if (execute(compex,headbuf) != Nullch) /* does it match? */ + return TRUE; /* say, "Eureka!" */ + if (scope < ARTSCOPE_ARTICLE) + return FALSE; + if (!artopen(artnum)) /* ensure we have the body */ + return FALSE; + /* loop through each line of the article */ + while (fgets(buf,LBUFLEN,artfp) != Nullch) { + if (execute(compex,buf) != Nullch) /* does it match? */ + return TRUE; /* say, "Eureka!" */ } - return execute(compex,buf) != Nullch; - } - - if (!parseheader(artnum)) - return FALSE; - /* see if it's in the header */ - if (execute(compex,headbuf) != Nullch) /* does it match? */ - return TRUE; /* say, "Eureka!" */ - if (scope < 3) - return FALSE; - - if (!artopen(artnum)) /* ensure we have the body */ - return FALSE; - /* loop through each line of the article */ - while (fgets(buf,LBUFLEN,artfp) != Nullch) { - if (execute(compex,buf) != Nullch) /* does it match? */ - return TRUE; /* say, "Eureka!" */ + return FALSE; /* out of article, so no match */ } - return FALSE; /* out of article, so no match */ + return execute(compex,buf) != Nullch; } #endif Index:artsrch.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -37,5 +37,14 @@ /* current compex with brackets */ # endif -EXT char art_howmuch; /* search just the subjects */ + +#define ARTSCOPE_SUBJECT 0 +#define ARTSCOPE_FROM 1 +#define ARTSCOPE_ONEHDR 2 +#define ARTSCOPE_HEAD 3 +#define ARTSCOPE_ARTICLE 4 + +EXT char scopestr[] INIT("sfHha"); +EXT char art_howmuch; /* search scope */ +EXT char *art_srchhdr; /* specific header to search or NULL */ EXT bool art_doread; /* search read articles? */ #endif Index:artstate.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:autosub.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:autosub.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:backpage.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -22,5 +22,4 @@ ART_LINE maxindx = -1; -long lseek(); void Index:backpage.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:bits.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -458,5 +458,7 @@ int markread; { +# ifdef VALIDATE_XREF_SITE bool valid_xref_site(); +# endif register char *xartnum; register ART_NUM x; @@ -474,5 +476,8 @@ # endif curxref = cpytill(tmpbuf,xref_buf,' ') + 1; - if (valid_xref_site(artnum,tmpbuf)) { +# ifdef VALIDATE_XREF_SITE + if (valid_xref_site(artnum,tmpbuf)) +# endif + { while (*curxref) { /* for each newsgroup */ curxref = cpytill(tmpbuf,curxref,' '); @@ -510,4 +515,5 @@ } +# ifdef VALIDATE_XREF_SITE /* Make sure the site name on Xref matches what inews thinks the site * is. Check first against last inews_site. If it matches, fine. @@ -560,4 +566,5 @@ return FALSE; } +# endif /* VALIDATE_XREF_SITE */ #else /* DBM_XREFS */ Index:bits.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:cache.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -50,4 +50,9 @@ cache_init() { +#ifdef PENDING +# ifdef ARTSEARCH + init_compex(&srchcompex) +# endif +#endif ; } @@ -226,10 +231,10 @@ if (!(ap->flags & AF_FROMTRUNCED)) { if (instr(ap->from,phostname,FALSE)) { - if (instr(ap->from,logname,TRUE)) + if (instr(ap->from,loginName,TRUE)) select_subthread(ap,AF_AUTOSELECT); else { #ifdef SLOW_BUT_COMPLETE_POSTER_CHECKING char *reply_buf = fetchlines(article_num(ap),REPLY_LINE); - if (instr(reply_buf,logname,TRUE)) + if (instr(reply_buf,loginName,TRUE)) select_subthread(ap,AF_AUTOSELECT); free(reply_buf); @@ -345,15 +350,17 @@ void -set_subj_line(ap, s, size) +set_subj_line(ap, subj, size) register ARTICLE *ap; -register char *s; /* not yet allocated, so we can tweak it first */ +register char *subj; /* not yet allocated, so we can tweak it first */ register int size; { HASHDATUM data; SUBJECT *sp; - char *s2, *subj_start = get_subject_start(s); + char *newsubj, *subj_start = get_subject_start(subj); + char *t, *f; + int i; - if (s != subj_start) { - size -= subj_start - s; + if (subj != subj_start) { + size -= subj_start - subj; ap->flags |= AF_HAS_RE; } @@ -361,7 +368,17 @@ return; - s2 = safemalloc(size + 4 + 1); - strcpy(s2, "Re:"); - safecat(s2, subj_start, size+5); + newsubj = safemalloc(size + 4 + 1); + strcpy(newsubj, "Re: "); + for (t = newsubj + 4, f = subj_start, i = size; i--; ) { + if (*f == ' ' || *f == '\t') { + while (i && (*++f == ' ' || *f == '\t')) + i--, size--; + *t++ = ' '; + } else if (*f != '\n') + *t++ = *f++; + else + f++; + } + *t = '\0'; if (ap->subj) { @@ -369,9 +386,9 @@ hashdelete(subj_hash, ap->subj->str+4, strlen(ap->subj->str+4)); free(ap->subj->str); - ap->subj->str = s2; + ap->subj->str = newsubj; data.dat_ptr = (char*)ap->subj; - hashstore(subj_hash, s2 + 4, size, data); + hashstore(subj_hash, newsubj + 4, size, data); } else { - data = hashfetch(subj_hash, s2 + 4, size); + data = hashfetch(subj_hash, newsubj + 4, size); if (!(sp = (SUBJECT*)data.dat_ptr)) { sp = (SUBJECT*)safemalloc(sizeof (SUBJECT)); @@ -383,5 +400,5 @@ first_subject = sp; last_subject = sp; - sp->str = s2; + sp->str = newsubj; sp->thread_link = sp; sp->flags = SF_THREAD; @@ -390,5 +407,5 @@ hashstorelast(data); } else - free(s2); + free(newsubj); ap->subj = sp; } Index:cache.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -39,5 +39,4 @@ #define SF_VISIT 0x0200 #define SF_WASSELECTED 0x0400 -#define SF_AUTOSELECT 0x0800 #define SF_SUBJTRUNCED 0x1000 @@ -95,9 +94,12 @@ /* These must never use their args more than once in the definition */ #define article_num(ap) (((ap)-article_list)+absfirst) -#define article_ptr(artnum) (article_list+((artnum)-absfirst)) +#define article_ptr(an) (article_list+((an)-absfirst)) +#define find_article(an) ((an < absfirst || an > lastart)? \ + Nullart : article_ptr(an)) EXT ARTICLE *article_list INIT(Nullart); EXT ARTICLE **artptr_list INIT(0); EXT ARTICLE **artptr; +EXT ART_NUM artptr_list_size INIT(0); #ifdef ARTSEARCH Index:common.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -38,4 +38,7 @@ # ifdef I_TERMIOS # include +# if !defined (O_NDELAY) +# define O_NDELAY O_NONBLOCK /* Posix-style non-blocking i/o */ +# endif # else # include @@ -52,5 +55,26 @@ #endif +#ifdef I_UNISTD +#include +#endif +#ifdef I_STDLIB +#include +#else +char *malloc(); +char *realloc(); +#endif + +#ifdef I_STRING +#include +#else +#include +#endif + +#ifdef I_TIME #include +#endif +#ifdef I_SYS_TIME +#include +#endif #define BITSPERBYTE 8 @@ -167,4 +191,6 @@ * Put _ in the middle to capitalize last component: %_c = net/Jokes * Put \ in the middle to quote regexp and % characters in the result + * Put > in the middle to return the address portion of a name. + * Put ) in the middle to return the comment portion of a name. * Put :FMT in the middle to format the result: %:-30.30t * @@ -270,4 +296,5 @@ /* /, ?, ^N, ^P, k, K */ #define EDIT_DISTANCE /* Allow -G to specify a fuzzy 'go' command */ +#undef VALIDATE_XREF_SITE /* are xrefs possibly invalid? */ #undef METAMAIL /* use metamail to process mime articles */ @@ -382,6 +409,11 @@ /* file containing list of active newsgroups and max article numbers */ -#ifndef ACTIVE /* % and ~ */ +#ifdef USE_NNTP +# undef ACTIVE +# define ACTIVE "%P/rrnact.%$" +#else +# ifndef ACTIVE /* % and ~ */ # define ACTIVE "%x/active" +# endif #endif #ifndef DBINIT @@ -570,5 +602,5 @@ #ifndef ATTRIBUTION /* % */ -# define ATTRIBUTION "In article %i %f writes:" +# define ATTRIBUTION "In article %i,%?%)f <%>f> wrote:" #endif @@ -702,4 +734,10 @@ typedef unsigned int MEM_SIZE; /* for passing to malloc */ +/* index/strchr slight-of-hand */ + +#ifdef HAS_STRCHR +# define index strchr +# define rindex strrchr +#endif /* *** end of the machine dependent stuff *** */ @@ -713,4 +751,5 @@ /* various things of type char */ +#ifdef SUPPLIMENT_STRING_H char *index(); char *rindex(); @@ -718,6 +757,5 @@ char *strcat(); char *strcpy(); -char *malloc(); -char *realloc(); +#endif EXT char buf[LBUFLEN+1]; /* general purpose line buffer */ @@ -785,12 +823,19 @@ #ifdef VERBOSE # ifdef TERSE - EXT bool verbose INIT(TRUE); /* +t */ +EXT bool verbose INIT(TRUE); /* +t */ # endif #endif EXT bool unbroken_subjects INIT(FALSE); /* -u */ +EXT bool unsafe_rc_saves INIT(FALSE); /* -U */ #ifdef VERIFY - EXT bool verify INIT(FALSE); /* -v */ +EXT bool verify INIT(FALSE); /* -v */ +#endif +EXT bool quickstart INIT(FALSE); /* -q */ +EXT time_t actFetchTime /* -z */ +#ifdef USE_NNTP + INIT(5*60); +#else + INIT(0); #endif - EXT bool quickstart INIT(FALSE); /* -q */ #define NOMARKING 0 @@ -809,6 +854,10 @@ /* miscellania */ +#ifndef __STDC__ int fseek(); long atol(), ftell(); +extern int errno; +#endif + EXT bool in_ng INIT(FALSE); /* current state of trn */ EXT char mode INIT('i'); /* current state of trn */ @@ -817,7 +866,6 @@ EXT NG_NUM nextrcline INIT(0); /* 1st unused slot in rcline array */ - /* startup to avoid checking twice in a row */ + /* startup to avoid checking twice in a row */ -extern errno; /* Factored strings */ Index:config.h.SH @@ -42,6 +42,6 @@ /* bcmp: - * This symbol is maped to memcmp if the bcmp() routine is not - * available to compare strings. + * 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 */ @@ -89,4 +89,10 @@ #$d_normsig NORMSIG /**/ +/* vfork: + * This symbol, if defined, remaps the vfork routine to fork if the + * vfork() routine isn't supported here. + */ +#$d_novfork vfork fork /**/ + /* HAS_RDCHK * This symbol, if defined, indicates that the rdchk routine is available @@ -103,4 +109,10 @@ #$d_rename HAS_RENAME /**/ +/* HAS_SIGBLOCK: + * This symbol, if defined, indicates that the sigblock routine is + * available to block signal reception. + */ +#$d_sigblock HAS_SIGBLOCK /**/ + /* HAS_SIGHOLD: * This symbol, if defined, indicates that the sighold routine is @@ -109,4 +121,10 @@ #$d_sighold HAS_SIGHOLD /**/ +/* HAS_STRCASECMP: + * This symbol, if defined, indicates that the strcasecmp routine is + * available for case-insensitive string compares. + */ +#$d_strcasecmp HAS_STRCASECMP /**/ + /* Signal_t * This symbol's value is either "void" or "int", corresponding to the @@ -123,8 +141,9 @@ #$i_dirent I_DIRENT /**/ -/* I_FCNTL - * This manifest constant tells the C program to include . +/* I_STDLIB: + * This symbol, if defined, indicates that exists and should + * be included. */ -#$i_fcntl I_FCNTL /**/ +#$i_stdlib I_STDLIB /**/ /* I_SYS_DIR @@ -146,4 +165,30 @@ #$i_sysndir I_SYS_NDIR /**/ +/* I_TERMIO: + * This symbol, if defined, indicates that the program should include + * rather than . There are also differences in + * the ioctl() calls that depend on the value of this symbol. + */ +/* I_TERMIOS: + * This symbol, if defined, indicates that the program should include + * the POSIX termios.h rather than sgtty.h or termio.h. + * There are also differences in the ioctl() calls that depend on the + * value of this symbol. + */ +/* I_SGTTY: + * This symbol, if defined, indicates that the program should include + * rather than . There are also differences in + * the ioctl() calls that depend on the value of this symbol. + */ +#$i_termio I_TERMIO /**/ +#$i_termios I_TERMIOS /**/ +#$i_sgtty I_SGTTY /**/ + +/* I_UNISTD: + * This symbol, if defined, indicates to the C program that it should + * include . + */ +#$i_unistd I_UNISTD /**/ + /* I_VFORK: * This symbol, if defined, indicates to the C program that it should @@ -265,10 +310,4 @@ #$d_xdata USE_XOVER /**/ -/* vfork: - * This symbol, if defined, remaps the vfork routine to fork if the - * vfork() routine isn't supported here. - */ -#$d_novfork vfork fork /**/ - /* void: * This symbol is used for void functions. On implementations which @@ -278,10 +317,4 @@ #$d_novoid void int /**/ -/* HAS_SIGBLOCK: - * This symbol, if defined, indicates that the sigblock routine is - * available to block signal reception. - */ -#$d_sigblock HAS_SIGBLOCK /**/ - /* size_t: * This symbol is defined as an int if no size_t definition exists. @@ -289,18 +322,13 @@ #$d_sizet size_t int /**/ -/* index: - * This preprocessor symbol is defined, along with rindex, if the system - * uses the strchr and strrchr routines instead. - */ -/* rindex: - * This preprocessor symbol is defined, along with index, if the system - * uses the strchr and strrchr routines instead. +/* HAS_STRCHR: + * This symbol is defined to indicate that the strchr()/strrchr() + * functions are available for string searching. */ -#$d_strchr index strchr /**/ -#$d_strchr rindex strrchr /**/ +#$d_strchr HAS_STRCHR /**/ /* HAS_STRFTIME: * This symbol, if defined, indicates that the strftime routine is - * available. + * available to format locale-specific times. */ #$d_strftime HAS_STRFTIME /**/ @@ -328,23 +356,20 @@ #$i_ptem I_PTEM /**/ -/* I_TERMIO: - * This symbol, if defined, indicates that the program should include - * rather than . There are also differences in - * the ioctl() calls that depend on the value of this symbol. +/* I_STRING: + * This symbol, if defined, indicates to the C program that it should + * include (USG systems) instead of (BSD systems). */ -/* I_TERMIOS: - * This symbol, if defined, indicates that the program should include - * the POSIX termios.h rather than sgtty.h or termio.h. - * There are also differences in the ioctl() calls that depend on the - * value of this symbol. +#$i_string I_STRING /**/ + +/* I_TIME + * This symbol, if defined, indicates to the C program that it should + * include . */ -/* I_SGTTY: - * This symbol, if defined, indicates that the program should include - * rather than . There are also differences in - * the ioctl() calls that depend on the value of this symbol. +/* I_SYS_TIME + * This symbol, if defined, indicates to the C program that it should + * include . */ -#$i_termio I_TERMIO /**/ -#$i_termios I_TERMIOS /**/ -#$i_sgtty I_SGTTY /**/ +#$i_time I_TIME /**/ +#$i_systime I_SYS_TIME /**/ /* PASSNAMES: Index:decode.c @@ -1,4 +1,8 @@ /* $Id: decode.c,v 3.0 1991/11/22 04:12:25 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #include "EXTERN.h" Index:decode.h @@ -1,4 +1,8 @@ /* $Id: decode.h,v 3.0 1991/11/22 04:12:25 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ EXT FILE *decode_fp INIT(NULL); Index:dependencies @@ -0,0 +1,764 @@ +addng.o: EXTERN.h +addng.o: INTERN.h +addng.o: addng.c +addng.o: addng.h +addng.o: common.h +addng.o: config.h +addng.o: final.h +addng.o: intrp.h +addng.o: last.h +addng.o: ngdata.h +addng.o: nntp.h +addng.o: nntpclient.h +addng.o: only.h +addng.o: rcstuff.h +addng.o: search.h +addng.o: trn.h +addng.o: util.h +art.o: EXTERN.h +art.o: INTERN.h +art.o: art.c +art.o: art.h +art.o: artio.h +art.o: artstate.h +art.o: backpage.h +art.o: bits.h +art.o: cache.h +art.o: common.h +art.o: config.h +art.o: final.h +art.o: head.h +art.o: help.h +art.o: intrp.h +art.o: ng.h +art.o: ngdata.h +art.o: ngstuff.h +art.o: rcstuff.h +art.o: rt-select.h +art.o: rt-util.h +art.o: rt-wumpus.h +art.o: rthread.h +art.o: search.h +art.o: sw.h +art.o: term.h +art.o: trn.h +art.o: util.h +artcheck.o: EXTERN.h +artcheck.o: artcheck.c +artcheck.o: common.h +artcheck.o: config.h +artio.o: EXTERN.h +artio.o: INTERN.h +artio.o: art.h +artio.o: artio.c +artio.o: artio.h +artio.o: bits.h +artio.o: cache.h +artio.o: common.h +artio.o: config.h +artio.o: final.h +artio.o: head.h +artio.o: ngdata.h +artio.o: nntp.h +artio.o: nntpclient.h +artio.o: rthread.h +artsrch.o: EXTERN.h +artsrch.o: INTERN.h +artsrch.o: artio.h +artsrch.o: artsrch.c +artsrch.o: artsrch.h +artsrch.o: bits.h +artsrch.o: cache.h +artsrch.o: common.h +artsrch.o: config.h +artsrch.o: final.h +artsrch.o: head.h +artsrch.o: intrp.h +artsrch.o: kfile.h +artsrch.o: ng.h +artsrch.o: ngdata.h +artsrch.o: ngstuff.h +artsrch.o: nntp.h +artsrch.o: nntpclient.h +artsrch.o: rt-select.h +artsrch.o: rthread.h +artsrch.o: search.h +artsrch.o: term.h +artsrch.o: util.h +autosub.o: EXTERN.h +autosub.o: INTERN.h +autosub.o: autosub.c +autosub.o: autosub.h +autosub.o: common.h +autosub.o: config.h +autosub.o: final.h +autosub.o: ngsrch.h +autosub.o: search.h +autosub.o: util.h +backpage.o: EXTERN.h +backpage.o: INTERN.h +backpage.o: backpage.c +backpage.o: backpage.h +backpage.o: common.h +backpage.o: config.h +backpage.o: final.h +backpage.o: intrp.h +bits.o: EXTERN.h +bits.o: INTERN.h +bits.o: artio.h +bits.o: bits.c +bits.o: bits.h +bits.o: cache.h +bits.o: common.h +bits.o: config.h +bits.o: final.h +bits.o: head.h +bits.o: intrp.h +bits.o: ndir.h +bits.o: ng.h +bits.o: ngdata.h +bits.o: nntp.h +bits.o: nntpclient.h +bits.o: rcln.h +bits.o: rcstuff.h +bits.o: rt-select.h +bits.o: rthread.h +bits.o: trn.h +bits.o: util.h +cache.o: EXTERN.h +cache.o: INTERN.h +cache.o: artsrch.h +cache.o: bits.h +cache.o: cache.c +cache.o: cache.h +cache.o: common.h +cache.o: config.h +cache.o: final.h +cache.o: hash.h +cache.o: head.h +cache.o: intrp.h +cache.o: ng.h +cache.o: ngdata.h +cache.o: rcstuff.h +cache.o: rt-ov.h +cache.o: rt-select.h +cache.o: rt-util.h +cache.o: rthread.h +cache.o: search.h +cache.o: term.h +cache.o: trn.h +cache.o: util.h +decode.o: EXTERN.h +decode.o: INTERN.h +decode.o: common.h +decode.o: config.h +decode.o: decode.c +decode.o: decode.h +edit_dist.o: EXTERN.h +edit_dist.o: common.h +edit_dist.o: config.h +edit_dist.o: edit_dist.c +edit_dist.o: util.h +final.o: EXTERN.h +final.o: INTERN.h +final.o: artio.h +final.o: bits.h +final.o: cache.h +final.o: common.h +final.o: config.h +final.o: final.c +final.o: final.h +final.o: init.h +final.o: intrp.h +final.o: last.h +final.o: ng.h +final.o: ngdata.h +final.o: nntp.h +final.o: nntpclient.h +final.o: rcstuff.h +final.o: term.h +final.o: util.h +getactive.o: EXTERN.h +getactive.o: common.h +getactive.o: config.h +getactive.o: getactive.c +getactive.o: nntpclient.h +hash.o: EXTERN.h +hash.o: INTERN.h +hash.o: common.h +hash.o: config.h +hash.o: final.h +hash.o: hash.c +hash.o: hash.h +hash.o: util.h +head.o: EXTERN.h +head.o: INTERN.h +head.o: artio.h +head.o: cache.h +head.o: common.h +head.o: config.h +head.o: final.h +head.o: hash.h +head.o: head.c +head.o: head.h +head.o: ng.h +head.o: ngdata.h +head.o: nntp.h +head.o: nntpclient.h +head.o: rt-process.h +head.o: rt-util.h +head.o: rthread.h +head.o: util.h +help.o: EXTERN.h +help.o: INTERN.h +help.o: common.h +help.o: config.h +help.o: help.c +help.o: help.h +help.o: term.h +help.o: trn.h +init.o: EXTERN.h +init.o: INTERN.h +init.o: addng.h +init.o: art.h +init.o: artio.h +init.o: artsrch.h +init.o: backpage.h +init.o: bits.h +init.o: cache.h +init.o: common.h +init.o: config.h +init.o: decode.h +init.o: final.h +init.o: head.h +init.o: help.h +init.o: init.c +init.o: init.h +init.o: intrp.h +init.o: kfile.h +init.o: last.h +init.o: ng.h +init.o: ngdata.h +init.o: ngsrch.h +init.o: ngstuff.h +init.o: nntp.h +init.o: nntpclient.h +init.o: only.h +init.o: rcln.h +init.o: rcstuff.h +init.o: respond.h +init.o: rthread.h +init.o: search.h +init.o: sw.h +init.o: term.h +init.o: trn.h +init.o: util.h +intrp.o: EXTERN.h +intrp.o: INTERN.h +intrp.o: artio.h +intrp.o: artsrch.h +intrp.o: bits.h +intrp.o: cache.h +intrp.o: common.h +intrp.o: config.h +intrp.o: final.h +intrp.o: head.h +intrp.o: init.h +intrp.o: intrp.c +intrp.o: intrp.h +intrp.o: ng.h +intrp.o: ngdata.h +intrp.o: nntp.h +intrp.o: nntpclient.h +intrp.o: rcstuff.h +intrp.o: respond.h +intrp.o: rt-select.h +intrp.o: rt-util.h +intrp.o: rthread.h +intrp.o: search.h +intrp.o: term.h +intrp.o: trn.h +intrp.o: util.h +kfile.o: EXTERN.h +kfile.o: INTERN.h +kfile.o: artsrch.h +kfile.o: cache.h +kfile.o: common.h +kfile.o: config.h +kfile.o: hash.h +kfile.o: intrp.h +kfile.o: kfile.c +kfile.o: kfile.h +kfile.o: ng.h +kfile.o: ngdata.h +kfile.o: ngstuff.h +kfile.o: rcstuff.h +kfile.o: rt-process.h +kfile.o: rt-select.h +kfile.o: rthread.h +kfile.o: search.h +kfile.o: term.h +kfile.o: trn.h +kfile.o: util.h +last.o: EXTERN.h +last.o: INTERN.h +last.o: common.h +last.o: config.h +last.o: intrp.h +last.o: last.c +last.o: last.h +last.o: trn.h +last.o: util.h +ndir.o: EXTERN.h +ndir.o: INTERN.h +ndir.o: common.h +ndir.o: config.h +ndir.o: ndir.c +ndir.o: ndir.h +ng.o: EXTERN.h +ng.o: INTERN.h +ng.o: art.h +ng.o: artio.h +ng.o: artsrch.h +ng.o: artstate.h +ng.o: backpage.h +ng.o: bits.h +ng.o: cache.h +ng.o: common.h +ng.o: config.h +ng.o: decode.h +ng.o: final.h +ng.o: head.h +ng.o: help.h +ng.o: intrp.h +ng.o: kfile.h +ng.o: last.h +ng.o: ng.c +ng.o: ng.h +ng.o: ngdata.h +ng.o: ngstuff.h +ng.o: nntp.h +ng.o: nntpclient.h +ng.o: rcln.h +ng.o: rcstuff.h +ng.o: respond.h +ng.o: rt-select.h +ng.o: rt-wumpus.h +ng.o: rthread.h +ng.o: search.h +ng.o: term.h +ng.o: trn.h +ng.o: util.h +ngdata.o: EXTERN.h +ngdata.o: INTERN.h +ngdata.o: bits.h +ngdata.o: cache.h +ngdata.o: common.h +ngdata.o: config.h +ngdata.o: final.h +ngdata.o: head.h +ngdata.o: intrp.h +ngdata.o: kfile.h +ngdata.o: ndir.h +ngdata.o: ng.h +ngdata.o: ngdata.c +ngdata.o: ngdata.h +ngdata.o: nntp.h +ngdata.o: nntpclient.h +ngdata.o: rcln.h +ngdata.o: rcstuff.h +ngdata.o: rt-select.h +ngdata.o: rthread.h +ngdata.o: term.h +ngdata.o: trn.h +ngdata.o: util.h +nghash.o: EXTERN.h +nghash.o: common.h +nghash.o: config.h +nghash.o: final.h +nghash.o: hash.h +nghash.o: intrp.h +nghash.o: ndir.h +nghash.o: ngdata.h +nghash.o: nghash.c +nghash.o: nntp.h +nghash.o: nntpclient.h +nghash.o: rcln.h +nghash.o: rcstuff.h +nghash.o: term.h +nghash.o: trn.h +nghash.o: util.h +ngsrch.o: EXTERN.h +ngsrch.o: INTERN.h +ngsrch.o: common.h +ngsrch.o: config.h +ngsrch.o: final.h +ngsrch.o: ngsrch.c +ngsrch.o: ngsrch.h +ngsrch.o: rcln.h +ngsrch.o: rcstuff.h +ngsrch.o: search.h +ngsrch.o: term.h +ngsrch.o: trn.h +ngsrch.o: util.h +ngstuff.o: EXTERN.h +ngstuff.o: INTERN.h +ngstuff.o: bits.h +ngstuff.o: cache.h +ngstuff.o: common.h +ngstuff.o: config.h +ngstuff.o: decode.h +ngstuff.o: final.h +ngstuff.o: head.h +ngstuff.o: intrp.h +ngstuff.o: kfile.h +ngstuff.o: ng.h +ngstuff.o: ngdata.h +ngstuff.o: ngstuff.c +ngstuff.o: ngstuff.h +ngstuff.o: rcstuff.h +ngstuff.o: respond.h +ngstuff.o: rt-select.h +ngstuff.o: rt-wumpus.h +ngstuff.o: rthread.h +ngstuff.o: sw.h +ngstuff.o: term.h +ngstuff.o: trn.h +ngstuff.o: util.h +nntp.o: EXTERN.h +nntp.o: bits.h +nntp.o: cache.h +nntp.o: common.h +nntp.o: config.h +nntp.o: final.h +nntp.o: head.h +nntp.o: init.h +nntp.o: ngdata.h +nntp.o: nntp.c +nntp.o: nntp.h +nntp.o: nntpclient.h +nntp.o: rcln.h +nntp.o: trn.h +nntp.o: util.h +nntpclient.o: EXTERN.h +nntpclient.o: INTERN.h +nntpclient.o: common.h +nntpclient.o: config.h +nntpclient.o: nntpclient.c +nntpclient.o: nntpclient.h +nntpinit.o: EXTERN.h +nntpinit.o: common.h +nntpinit.o: config.h +nntpinit.o: nntpclient.h +nntpinit.o: nntpinit.c +only.o: EXTERN.h +only.o: INTERN.h +only.o: common.h +only.o: config.h +only.o: final.h +only.o: ngsrch.h +only.o: only.c +only.o: only.h +only.o: search.h +only.o: util.h +parsedate.o: config.h +parsedate.o: parsedate.y +rcln.o: EXTERN.h +rcln.o: INTERN.h +rcln.o: common.h +rcln.o: config.h +rcln.o: ngdata.h +rcln.o: rcln.c +rcln.o: rcln.h +rcln.o: rcstuff.h +rcln.o: util.h +rcstuff.o: EXTERN.h +rcstuff.o: INTERN.h +rcstuff.o: autosub.h +rcstuff.o: bits.h +rcstuff.o: cache.h +rcstuff.o: common.h +rcstuff.o: config.h +rcstuff.o: final.h +rcstuff.o: hash.h +rcstuff.o: intrp.h +rcstuff.o: ngdata.h +rcstuff.o: nntp.h +rcstuff.o: nntpclient.h +rcstuff.o: only.h +rcstuff.o: rcln.h +rcstuff.o: rcstuff.c +rcstuff.o: rcstuff.h +rcstuff.o: search.h +rcstuff.o: term.h +rcstuff.o: trn.h +rcstuff.o: util.h +respond.o: EXTERN.h +respond.o: INTERN.h +respond.o: artio.h +respond.o: cache.h +respond.o: common.h +respond.o: config.h +respond.o: decode.h +respond.o: final.h +respond.o: head.h +respond.o: intrp.h +respond.o: ng.h +respond.o: ngdata.h +respond.o: respond.c +respond.o: respond.h +respond.o: term.h +respond.o: trn.h +respond.o: util.h +rt-mt.o: EXTERN.h +rt-mt.o: INTERN.h +rt-mt.o: bits.h +rt-mt.o: cache.h +rt-mt.o: common.h +rt-mt.o: config.h +rt-mt.o: hash.h +rt-mt.o: intrp.h +rt-mt.o: ng.h +rt-mt.o: ngdata.h +rt-mt.o: nntp.h +rt-mt.o: nntpclient.h +rt-mt.o: rcln.h +rt-mt.o: rt-mt.c +rt-mt.o: rt-mt.h +rt-mt.o: rt-process.h +rt-mt.o: rthread.h +rt-mt.o: trn.h +rt-mt.o: util.h +rt-ov.o: EXTERN.h +rt-ov.o: INTERN.h +rt-ov.o: bits.h +rt-ov.o: cache.h +rt-ov.o: common.h +rt-ov.o: config.h +rt-ov.o: final.h +rt-ov.o: hash.h +rt-ov.o: head.h +rt-ov.o: ng.h +rt-ov.o: ngdata.h +rt-ov.o: nntp.h +rt-ov.o: nntpclient.h +rt-ov.o: overview.h +rt-ov.o: rt-ov.c +rt-ov.o: rt-ov.h +rt-ov.o: rt-process.h +rt-ov.o: rt-util.h +rt-ov.o: rthread.h +rt-ov.o: term.h +rt-ov.o: trn.h +rt-ov.o: util.h +rt-page.o: EXTERN.h +rt-page.o: INTERN.h +rt-page.o: cache.h +rt-page.o: common.h +rt-page.o: config.h +rt-page.o: ngdata.h +rt-page.o: rt-page.c +rt-page.o: rt-page.h +rt-page.o: rt-select.h +rt-page.o: rt-util.h +rt-page.o: rthread.h +rt-page.o: term.h +rt-page.o: trn.h +rt-page.o: util.h +rt-process.o: EXTERN.h +rt-process.o: bits.h +rt-process.o: cache.h +rt-process.o: common.h +rt-process.o: config.h +rt-process.o: final.h +rt-process.o: hash.h +rt-process.o: intrp.h +rt-process.o: kfile.h +rt-process.o: ng.h +rt-process.o: ngdata.h +rt-process.o: rcln.h +rt-process.o: rt-process.c +rt-process.o: rt-select.h +rt-process.o: rthread.h +rt-process.o: trn.h +rt-process.o: util.h +rt-select.o: EXTERN.h +rt-select.o: INTERN.h +rt-select.o: artsrch.h +rt-select.o: bits.h +rt-select.o: cache.h +rt-select.o: common.h +rt-select.o: config.h +rt-select.o: final.h +rt-select.o: help.h +rt-select.o: kfile.h +rt-select.o: ng.h +rt-select.o: ngdata.h +rt-select.o: ngstuff.h +rt-select.o: rt-page.h +rt-select.o: rt-select.c +rt-select.o: rt-select.h +rt-select.o: rt-util.h +rt-select.o: rthread.h +rt-select.o: search.h +rt-select.o: term.h +rt-select.o: trn.h +rt-select.o: util.h +rt-util.o: EXTERN.h +rt-util.o: INTERN.h +rt-util.o: artio.h +rt-util.o: cache.h +rt-util.o: common.h +rt-util.o: config.h +rt-util.o: ngdata.h +rt-util.o: rt-select.h +rt-util.o: rt-util.c +rt-util.o: rt-util.h +rt-util.o: rthread.h +rt-util.o: term.h +rt-wumpus.o: EXTERN.h +rt-wumpus.o: INTERN.h +rt-wumpus.o: artio.h +rt-wumpus.o: backpage.h +rt-wumpus.o: cache.h +rt-wumpus.o: common.h +rt-wumpus.o: config.h +rt-wumpus.o: final.h +rt-wumpus.o: head.h +rt-wumpus.o: ng.h +rt-wumpus.o: ngdata.h +rt-wumpus.o: rt-select.h +rt-wumpus.o: rt-wumpus.c +rt-wumpus.o: rt-wumpus.h +rt-wumpus.o: rthread.h +rt-wumpus.o: term.h +rt-wumpus.o: util.h +rthread.o: EXTERN.h +rthread.o: INTERN.h +rthread.o: artstate.h +rthread.o: bits.h +rthread.o: cache.h +rthread.o: common.h +rthread.o: config.h +rthread.o: hash.h +rthread.o: head.h +rthread.o: intrp.h +rthread.o: kfile.h +rthread.o: ng.h +rthread.o: ngdata.h +rthread.o: nntp.h +rthread.o: nntpclient.h +rthread.o: rcln.h +rthread.o: rcstuff.h +rthread.o: rt-mt.h +rthread.o: rt-ov.h +rthread.o: rt-page.h +rthread.o: rt-process.h +rthread.o: rt-select.h +rthread.o: rt-util.h +rthread.o: rt-wumpus.h +rthread.o: rthread.c +rthread.o: rthread.h +rthread.o: search.h +rthread.o: trn.h +rthread.o: util.h +search.o: EXTERN.h +search.o: INTERN.h +search.o: common.h +search.o: config.h +search.o: search.c +search.o: search.h +search.o: util.h +strftime.o: EXTERN.h +strftime.o: common.h +strftime.o: config.h +strftime.o: strftime.c +sw.o: EXTERN.h +sw.o: INTERN.h +sw.o: cache.h +sw.o: common.h +sw.o: config.h +sw.o: head.h +sw.o: intrp.h +sw.o: ng.h +sw.o: only.h +sw.o: rt-page.h +sw.o: rt-util.h +sw.o: search.h +sw.o: sw.c +sw.o: sw.h +sw.o: term.h +sw.o: util.h +term.o: EXTERN.h +term.o: INTERN.h +term.o: cache.h +term.o: common.h +term.o: config.h +term.o: final.h +term.o: help.h +term.o: intrp.h +term.o: term.c +term.o: term.h +term.o: util.h +trn.o: EXTERN.h +trn.o: INTERN.h +trn.o: addng.h +trn.o: cache.h +trn.o: common.h +trn.o: config.h +trn.o: final.h +trn.o: help.h +trn.o: init.h +trn.o: intrp.h +trn.o: kfile.h +trn.o: last.h +trn.o: ng.h +trn.o: ngdata.h +trn.o: ngsrch.h +trn.o: ngstuff.h +trn.o: nntp.h +trn.o: nntpclient.h +trn.o: only.h +trn.o: patchlevel.h +trn.o: rcln.h +trn.o: rcstuff.h +trn.o: search.h +trn.o: sw.h +trn.o: term.h +trn.o: trn.c +trn.o: trn.h +trn.o: util.h +unipatch.o: unipatch.c +unship.o: EXTERN.h +unship.o: common.h +unship.o: config.h +unship.o: decode.h +unship.o: respond.h +unship.o: unship.c +util.o: EXTERN.h +util.o: INTERN.h +util.o: common.h +util.o: config.h +util.o: final.h +util.o: term.h +util.o: util.c +util.o: util.h +uudecode.o: EXTERN.h +uudecode.o: common.h +uudecode.o: config.h +uudecode.o: decode.h +uudecode.o: respond.h +uudecode.o: uudecode.c +Makefile: Makefile.SH config.sh ; /bin/sh Makefile.SH +Pnews: Pnews.SH config.sh ; /bin/sh Pnews.SH +Rnmail: Rnmail.SH config.sh ; /bin/sh Rnmail.SH +Speller: Speller.SH config.sh ; /bin/sh Speller.SH +config.h: config.h.SH config.sh ; /bin/sh config.h.SH +makedepend: makedepend.SH config.sh ; /bin/sh makedepend.SH +makedir: makedir.SH config.sh ; /bin/sh makedir.SH +mbox.saver: mbox.saver.SH config.sh ; /bin/sh mbox.saver.SH +newsetup: newsetup.SH config.sh ; /bin/sh newsetup.SH +newsgroups: newsgroups.SH config.sh ; /bin/sh newsgroups.SH +newsnews: newsnews.SH config.sh ; /bin/sh newsnews.SH +norm.saver: norm.saver.SH config.sh ; /bin/sh norm.saver.SH +# WARNING: Put nothing here or make depend will gobble it up! Index:edit_dist.c @@ -1,2 +1,7 @@ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ + #include "EXTERN.h" #include "common.h" /* Declare MEM_SIZE */ Index:final.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -52,10 +52,4 @@ #endif -#ifndef lint -#ifdef SIGEMT - sigignore(SIGEMT); -#endif -#endif - #ifdef DEBUG /* sometimes we WANT a core dump */ @@ -246,8 +240,8 @@ if (!waiting) { termlib_init(); - noecho(); /* set no echo */ - crmode(); /* set cbreak mode */ - forceme("\f"); /* cause a refresh */ - /* (defined only if TIOCSTI defined) */ + noecho(); /* set no echo */ + crmode(); /* set cbreak mode */ + forceme("\f"); /* cause a refresh */ + /* (defined only if TIOCSTI defined) */ errno = 0; /* needed for getcmd */ } Index:final.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:getactive.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:hash.c @@ -8,4 +8,5 @@ #include "common.h" #include "util.h" +#include "final.h" #include "INTERN.h" #include "hash.h" Index:hash.h @@ -2,4 +2,8 @@ * general-purpose in-core hashing */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #define HASHDATUM struct hashdatum Index:head.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -91,5 +91,4 @@ * optimization to avoid calling subroutine strEQ unnecessarily. Hauls. */ - if (islower(*f)) { for (i = htypeix[*f - 'a']; *htype[i].ht_name == *f; --i) { @@ -163,7 +162,14 @@ end_header_line(); s = index(art_buf,':'); - if (s == Nullch) /* is it the end of the header? */ + if (s == Nullch) { /* is it the end of the header? */ +#ifdef USE_NNTP + /* Did NNTP ship us a mal-formed header line? */ + if (*art_buf && *art_buf != '\n') { + in_header = SOME_LINE; + return newhide; + } +#endif in_header = PAST_HEADER; - else { /* it is a new header line */ + } else { /* it is a new header line */ in_header = set_line_type(art_buf,s); first_one = (htype[in_header].ht_minpos < 0); @@ -205,5 +211,5 @@ #endif #ifdef USE_NNTP - htype[PAST_HEADER].ht_minpos = artpos; /* remember where body starts */ + htype[PAST_HEADER].ht_minpos = artpos+1; /* remember where body starts */ #else htype[PAST_HEADER].ht_minpos = ftell(artfp); @@ -259,5 +265,4 @@ if (!bp[1]) { *bp++ = '\n'; /* tag the end with an empty line */ - artpos++; break; } @@ -293,7 +298,10 @@ int size; - s = fetchcache(artnum,which_line); - if (s) - return savestr(s); + /* 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); + if (s) + return savestr(s); + } if ((firstpos = htype[which_line].ht_minpos) < 0) return savestr(nullstr); @@ -334,5 +342,5 @@ if (!(ap = find_article(artnum)) || (ap->flags & AF_MISSING)) s = nullstr; - else if (cached) + else if (cached && (which_line != SUBJ_LINE || parsed_art != artnum)) s = get_cached_line(ap, which_line, untrim_cache); else Index:head.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:help.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -265,4 +265,5 @@ m name Move named newsgroup elsewhere (no name moves current newsgroup).\n\ o pat Only display newsgroups matching pattern. Omit pat to unrestrict.\n\ +O pat Like o, but skip empty groups.\n\ a pat Like o, but also scans for unsubscribed newsgroups matching pattern.\n\ L List current .newsrc.\n\ Index:help.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:hints/aix_rs.sh @@ -0,0 +1,2 @@ +cppstdin='/lib/cpp -D_AIX -D_IBMR2 -U__STR__' +cppminus='' Index:hints/altos486.sh @@ -0,0 +1,3 @@ +: have heard of problems with -lc_s on Altos 486 +set `echo " $libswanted " | sed "s/ c_s / /"` +libswanted="$*" Index:hints/convexos.sh @@ -0,0 +1,7 @@ +i_sgtty=undef +i_termios=define +ccflags="-D__STDC__ -ext -tm c1" +d_voidsig='define' +signal_t='void' +d_strchr='undef' +libc='/usr/lib/libc.a' Index:hints/dec_osf1.sh @@ -0,0 +1,2 @@ +libpth="$libpth /usr/shlib" # Use the shared libraries if possible +libc='/usr/shlib/libc.so' # The archive version is /lib/libc.a Index:hints/dgux.sh @@ -0,0 +1,4 @@ +cppstdin='/lib/cpp' +libs='-ldgc' +d_strchr='define' +cc='gcc' Index:hints/dynix.sh @@ -0,0 +1,1 @@ +libswanted=`echo $libswanted | sed -e 's/socket /socket seq inet /'` Index:hints/hp9000_800.sh @@ -0,0 +1,1 @@ +libswanted=`echo $libswanted | sed -e 's/malloc //' -e 's/BSD //` Index:hints/hpux.sh @@ -0,0 +1,4 @@ +case `(uname -r) 2>/dev/null` in +*2.1*) libswanted=`echo $libswanted | sed 's/malloc //'` ;; +esac +d_strchr=define Index:hints/i386.sh @@ -0,0 +1,1 @@ +ldflags='-L/usr/ucblib' Index:hints/isc_2_2_1.sh @@ -0,0 +1,1 @@ +d_ftime=undef Index:hints/isc_3_2_2.sh @@ -0,0 +1,2 @@ +set `echo $libswanted | sed -e 's/ x//' -e 's/malloc //'` +libswanted="inet malloc $*" Index:hints/isc_3_2_3.sh @@ -0,0 +1,2 @@ +set `echo $libswanted | sed -e 's/ socket / inet /'` +libswanted="$*" Index:hints/mc6000.sh @@ -0,0 +1,2 @@ +# defaults for the masscomp (concurrent) 6000 series running RTU 5.0 +cppstdin=/lib/cpp Index:hints/mips.sh @@ -0,0 +1,2 @@ +cc=cc +nm_opts='-B' Index:hints/next.sh @@ -0,0 +1,1 @@ +libswanted='sys_s' Index:hints/osf1.sh @@ -0,0 +1,1 @@ +libswanted=m Index:hints/sco_3.sh @@ -0,0 +1,3 @@ +libswanted=`echo $libswanted | sed 's/ x//'` +cppminus='' +d_rename=undef Index:hints/sco_3_2_4.sh @@ -0,0 +1,3 @@ +xlibpth='' +mailer='/usr/lib/mail/execmail' +libc='/lib/libc.a' Index:hints/sco_xenix @@ -0,0 +1,2 @@ +i_dirent=undef +libswanted=`echo $libswanted | sed 's/ x//'` Index:hints/sgi.sh @@ -0,0 +1,3 @@ +d_voidsig=define +d_novfork=undef +d_sigblock=undef Index:hints/solaris_2_0.sh @@ -0,0 +1,1 @@ +d_novfork=undef Index:hints/solaris_2_1.sh @@ -0,0 +1,3 @@ +d_novfork=undef +i_dirent=undef +i_sysdir=define Index:hints/sunos_4_1.sh @@ -0,0 +1,3 @@ +i_sgtty=define +i_termios=undef +i_string=define Index:hints/svr4.sh @@ -0,0 +1,5 @@ +cc='/bin/cc' +test -f $cc || cc='/usr/ccs/bin/cc' +mansrc='/usr/share/man/man1' +libswanted='malloc socket nsl' +d_strchr=define Index:init.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -54,5 +54,4 @@ char *tcbuf; register bool foundany = FALSE; - long time(); #ifdef NOLINEBUF static char std_out_buf[BUFSIZ]; /* must be static or malloced */ @@ -73,4 +72,8 @@ /* mode setting is in term_set() */ + /* init syntax etc. for searching (must also precede sw_init()) */ + + search_init(); + /* we have to know rnlib to look up global switches in %X/INIT */ @@ -159,5 +162,4 @@ respond_init(); rn_init(); - search_init(); decode_init(); thread_init(); @@ -189,8 +191,4 @@ } -#ifndef SIGEMT -#define SIGEMT 0 -#endif - /* make sure there is no rn out there already */ @@ -216,7 +214,5 @@ printf("Trn left running, #%d.\n", processnum) FLUSH; #endif - if (kill(processnum, SIGEMT)) { - /* does process not exist? */ - /* (rn ignores SIGEMT) */ + if (kill(processnum, 0)) { /* does process not exist? */ sleep(2); #ifdef VERBOSE Index:init.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:intrp.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -33,4 +33,5 @@ #include "rthread.h" #include "rt-select.h" +#include "rt-util.h" #include "nntp.h" #include "INTERN.h" @@ -52,4 +53,5 @@ #ifdef CONDSUB +COMPEX cond_compex; char *skipinterp _((char *,char *)); #endif @@ -62,4 +64,8 @@ { char *getlogin(); + +#ifdef CONDSUB + init_compex(&cond_compex); +#endif /* get environmental stuff */ @@ -95,10 +101,10 @@ /* get login name */ - logname = getenv("USER"); - if (logname == Nullch) - logname = getenv("LOGNAME"); + loginName = getenv("USER"); + if (loginName == Nullch) + loginName = getenv("LOGNAME"); #ifdef GETLOGIN - if (logname == Nullch) - logname = savestr(getlogin()); + if (loginName == Nullch) + loginName = savestr(getlogin()); #endif @@ -116,7 +122,7 @@ #ifdef NEWS_ADMIN - /* if this is the news admin than load his UID into newsuid */ + /* if this is the news admin then load his UID into newsuid */ - if ( strEQ(logname,NEWS_ADMIN) ) + if (strEQ(loginName,NEWS_ADMIN)) newsuid = getuid(); #endif @@ -128,5 +134,5 @@ /* get the real name of the person (%N) */ - /* Must be done after logname is read in because BERKNAMES uses that */ + /* Must be done after loginName is read in because BERKNAMES uses that */ strcpy(tcbuf,getrealname((long)getuid())); @@ -150,4 +156,5 @@ buf[strlen(buf)-1] = 0; fclose(tmpfp); + phostname = savestr(buf); } else { @@ -250,7 +257,7 @@ #endif struct passwd *pwd = getpwnam(tildename); - if ( pwd == NULL){ + if (pwd == NULL) { printf("%s is an unknown user. Using default.\n",tildename) FLUSH; - return(Nullch); + return Nullch; } sprintf(scrbuf,"%s%s",pwd->pw_dir,s); @@ -423,4 +430,6 @@ char *dist_buf = Nullch; char *line_buf = Nullch; + char *line_split = Nullch; + char *orig_dest = dest; register char *s, *h; register int i; @@ -430,4 +439,6 @@ bool lastcomp = FALSE; bool re_quote = FALSE; + bool address_parse = FALSE; + bool comment_parse = FALSE; bool proc_sprintf = FALSE; int metabit = 0; @@ -442,4 +453,6 @@ lastcomp = FALSE; re_quote = FALSE; + address_parse = FALSE; + comment_parse = FALSE; proc_sprintf = FALSE; for (s=Nullch; !s; ) { @@ -454,4 +467,10 @@ re_quote = TRUE; break; + case '>': + address_parse = TRUE; + break; + case ')': + comment_parse = TRUE; + break; case ':': proc_sprintf = TRUE; @@ -468,5 +487,5 @@ break; case '/': -#ifdef ARTSRCH +#ifdef ARTSEARCH s = scrbuf; if (!index("/?g",pattern[-2])) @@ -479,10 +498,15 @@ else *s++ = '/'; - if (art_howmuch == 1) - *s++ = 'h'; - else if (art_howmuch == 2) - *s++ = 'a'; if (art_doread) *s++ = 'r'; + if (art_howmuch != ARTSCOPE_SUBJECT) { + *s++ = scopestr[art_howmuch]; + if (art_howmuch == ARTSCOPE_ONEHDR) + safecpy(s,art_srchhdr, + (sizeof scrbuf) - (s-scrbuf)); + s = index(s,':') + 1; + if (!s) + s = scrbuf+(sizeof scrbuf)-1; + } } *s = '\0'; @@ -510,9 +534,7 @@ case '(': { COMPEX *oldbra_compex = bra_compex; - COMPEX cond_compex; char rch; bool matched; - init_compex(&cond_compex); pattern = dointerp(dest,destsize,pattern+1,"!="); rch = *pattern; @@ -527,8 +549,9 @@ printf("%s: %s\n",scrbuf,s) FLUSH; pattern += strlen(pattern); + free_compex(&cond_compex); goto getout; } matched = (execute(&cond_compex,dest) != Nullch); - if (cond_compex.nbra) /* were there brackets? */ + if (getbracket(&cond_compex, 0)) /* were there brackets? */ bra_compex = &cond_compex; if (matched==(rch == '=')) { @@ -604,4 +627,8 @@ sprintf(s,"%d",perform_cnt); break; + case '?': + s = " "; + line_split = dest; + break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': @@ -656,5 +683,5 @@ case 'f': /* from line */ parseheader(art); - if (htype[REPLY_LINE].ht_minpos >= 0) { + if (htype[REPLY_LINE].ht_minpos >= 0 && !comment_parse) { /* was there a reply line? */ if (!(s=reply_buf)) @@ -698,5 +725,5 @@ break; case 'L': /* login id */ - s = logname; + s = loginName; break; case 'm': /* current mode */ @@ -835,13 +862,5 @@ s += i + 1; } - if ((h=index(s,'(')) != Nullch) - /* strip garbage from end */ - *(h-1) = '\0'; - else if ((h=index(s,'<')) != Nullch) { - /* or perhaps from beginning */ - s = h+1; - if ((h=index(s,'>')) != Nullch) - *h = '\0'; - } + address_parse = TRUE; /* just the good part */ break; case 'u': @@ -936,4 +955,24 @@ /* A maze of twisty little conditions, all alike... */ + if (address_parse || comment_parse) { + if (s != scrbuf) { + safecpy(scrbuf,s,(sizeof scrbuf)); + s = scrbuf; + } + if (address_parse) { + if ((h=index(s,'<')) != Nullch) { /* grab the good part */ + s = h+1; + if ((h=index(s,'>')) != Nullch) + *h = '\0'; + } else if ((h=index(s,'(')) != Nullch) { + while (h-- != s && *h == ' ') + ; + h[1] = '\0'; /* or strip the comment */ + } + } else { + if (!(s = extract_name(s))) + s = nullstr; + } + } if (metabit) { /* set meta bit while copying. */ @@ -1027,4 +1066,7 @@ } *dest = '\0'; + if (line_split != Nullch) + if (strlen(orig_dest) > 79) + *line_split = '\n'; getout: if (subj_buf != Nullch) /* return any checked out storage */ @@ -1166,5 +1208,5 @@ if (*s == '&') { /* whoever thought this one up was */ c = buf + strlen(buf); /* in the middle of the night */ - strcat(c,logname); /* before the morning after */ + strcat(c,loginName); /* before the morning after */ strcat(c,s+1); if (islower(*c)) Index:intrp.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -19,5 +19,5 @@ EXT char *homedir INIT(Nullch); /* login directory */ EXT char *dotdir INIT(Nullch); /* where . files go */ -EXT char *logname INIT(Nullch); /* login id of user */ +EXT char *loginName INIT(Nullch); /* login id of user */ EXT char *realname INIT(Nullch); /* real name of user */ EXT char *phostname INIT(Nullch); /* host name in a posting */ Index:kfile.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -33,4 +33,6 @@ #include "kfile.h" +extern HASHTABLE *msgid_hash; + static bool exitcmds = FALSE; @@ -76,5 +78,5 @@ } -bool kill_mentioned; +static bool kill_mentioned; int @@ -96,4 +98,10 @@ if (strnEQ(buf,"THRU",4)) { killfirst = atol(buf+4)+1; + if (killfirst < absfirst) + killfirst = absfirst; + if (killfirst > lastart) + killfirst = lastart+1; + if (entering) + localkf_changes |= 1; continue; } @@ -112,8 +120,10 @@ switcheroo(); } - else if (*buf == '/' && firstart <= lastart) { + else if (*buf == '/') { + has_normal_kills = TRUE; + if (firstart > lastart) + continue; mention(buf); kill_mentioned = TRUE; - has_normal_kills = TRUE; switch (art_search(buf, (sizeof buf), FALSE)) { case SRCH_ABORT: @@ -149,5 +159,4 @@ else *cp++ = '\0'; - art = 0; if ((ap = get_article(buf)) != Nullart) { if ((ap->flags & AF_FAKE) == AF_FAKE) { @@ -163,4 +172,5 @@ thread_select_cnt++; break; + case 'J': case 'j': ap->flags |= AF_AUTOKILLALL; @@ -183,4 +193,22 @@ } art = lastart+1; + } else if (*buf == '*') { + register ARTICLE *ap; + register int killmask = AF_READ; + switch (buf[1]) { + case 'X': + killmask |= sel_mask; /* don't kill selected articles */ + /* FALL THROUGH */ + case 'j': + for (art = killfirst, ap = article_ptr(killfirst); + art <= lastart; + art++, ap++ + ) { + if (!(ap->flags & killmask)) + set_read(ap); + } + break; + } + has_normal_kills = TRUE; } } @@ -265,21 +293,45 @@ firstart = oldfirst; } - if (!entering && (localkfp || save_ids) && !intr) - setthru(lastart); + if (!entering && localkf_changes && !intr) + rewrite_kfile(lastart); mode = oldmode; } +static FILE *newkfp; + +static void write_thread_commands(data, extra) +HASHDATUM *data; +int extra; +{ + register ARTICLE *ap = (data->dat_ptr? (ARTICLE*)data->dat_ptr + : article_ptr(data->dat_len)); + register int flags; + char ch; + + if (flags = (ap->flags & AF_AUTOFLAGS)) { + if (!(ap->flags & AF_MISSING) || ap->child1) { + if (flags & AF_AUTOKILLALL) + ch = 'J'; + else if (flags & AF_AUTOKILL) + ch = ','; + else if (flags & AF_AUTOSELECTALL) + ch = '+'; + else if (flags & AF_AUTOSELECT) + ch = '.'; + fprintf(newkfp,"%s T%c\n", ap->msgid, ch); + } + } +} + void -setthru(thru) +rewrite_kfile(thru) ART_NUM thru; { - register ARTICLE *ap; - register ART_NUM an; - FILE *newkfp; - bool no_kills = 0; + bool no_kills = 0, has_star_commands = FALSE; if (localkfp) { fseek(localkfp,0L,0); /* rewind current file */ - if (save_ids) + /* If we're writing ids, we know the file is not null */ + if (localkf_changes > 1) ; else if (fgets(buf,LBUFLEN,localkfp) != Nullch @@ -300,17 +352,22 @@ if (strnEQ(buf,"THRU",4)) continue; + /* Write star commands after other kill commands */ + if (*buf == '*') { + has_star_commands = TRUE; + continue; + } /* Leave out any outdated thread commands */ if (*buf != 'T' && *buf != '<') fputs(buf,newkfp); } - /* Append all the still-valid thread commands */ - for (an = absfirst, ap = article_ptr(an); an <= lastart; an++, ap++) { - if (ap->flags & (AF_AUTOKILLALL|AF_AUTOSELECTALL)) - fprintf(newkfp,"%s T%c\n",ap->msgid, - (ap->flags & AF_AUTOKILLALL)? 'j' : '+'); - else if (ap->flags & (AF_AUTOKILL|AF_AUTOSELECT)) - fprintf(newkfp,"%s T%c\n",ap->msgid, - (ap->flags & AF_AUTOKILL)? ',' : '.'); + if (has_star_commands) { + fseek(localkfp,0L,0); /* rewind file */ + while (fgets(buf,LBUFLEN,localkfp) != Nullch) { + if (*buf == '*') + fputs(buf,newkfp); + } } + /* Append all the still-valid thread commands */ + hashwalk(msgid_hash, write_thread_commands, 0); fclose(newkfp); open_kfile(KF_LOCAL); /* and reopen local file */ @@ -318,4 +375,6 @@ else printf(cantcreate,buf) FLUSH; + localkf_changes = 0; + has_normal_kills = FALSE; } @@ -327,7 +386,14 @@ int r = -1; - if (in_ng) + if (in_ng) { + register SUBJECT *sp; + + if (localkf_changes) + rewrite_kfile(lastart); + for (sp = first_subject; sp; sp = sp->next) + clear_subject(sp); + localkf_changes = 0; strcpy(buf,filexp(getval("KILLLOCAL",killlocal))); - else + } else strcpy(buf,filexp(getval("KILLGLOBAL",killglobal))); if ((r = makedir(buf,MD_FILE)) >= 0) { @@ -341,4 +407,39 @@ crmode(); /* unfriendly again */ open_kfile(in_ng); + if (localkfp) { + fseek(localkfp,0L,0); /* rewind file */ + has_normal_kills = FALSE; + while (fgets(buf,LBUFLEN,localkfp) != Nullch) { + if (*buf == '/' || *buf == '*') + has_normal_kills = TRUE; + else if (*buf == '<') { + register ARTICLE *ap; + char *cp = index(buf,' '); + if (!cp) + cp = ","; + else + *cp++ = '\0'; + if ((ap = get_article(buf)) != Nullart) { + if (*cp == 'T') + cp++; + switch (*cp) { + case '+': + ap->flags |= AF_AUTOSELECTALL; + break; + case '.': + ap->flags |= AF_AUTOSELECT; + break; + case 'J': + case 'j': + ap->flags |= AF_AUTOKILLALL; + break; + case ',': + ap->flags |= AF_AUTOKILL; + break; + } + } + } + } + } } else Index:kfile.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -20,8 +20,8 @@ EXT FILE *globkfp INIT(Nullfp); /* global article killer file */ EXT FILE *localkfp INIT(Nullfp); /* local (for this newsgroup) file */ -#endif +EXT int localkf_changes; /* do we need to write changes? */ EXT bool has_normal_kills; /* flag when KILLs needs rereading */ -EXT bool save_ids; /* flag when we need to write ids */ EXT ART_NUM killfirst; /* used as firstart when killing */ +#endif void kfile_init _((void)); @@ -31,3 +31,3 @@ void open_kfile _((int)); void kf_append _((char*)); -void setthru _((ART_NUM)); +void rewrite_kfile _((ART_NUM)); Index:last.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:last.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -15,7 +15,7 @@ EXT char *lastngname INIT(Nullch); /* last newsgroup read, from .rnlast file */ -EXT long lasttime INIT(0); /* time last rn was started up */ +EXT time_t lasttime INIT(0); /* time last rn was started up */ EXT long lastactsiz INIT(0); /* size of active file when rn last started up */ -EXT long lastnewtime INIT(0); /* time last new group was found */ +EXT time_t lastnewtime INIT(0); /* time last new group was found */ EXT long lastnewsize INIT(0); /* size of active.times file when rn last started up */ Index:makedepend.SH @@ -22,5 +22,4 @@ $cat /dev/null >.deptmp $echo "(Note: this is going to take a while.)" -$rm -f X*.[cy] for file in *.[cy]; do case "\$file" in @@ -29,5 +28,5 @@ esac $echo "Finding dependencies for \$filebase.o." - $sed -n <\$file >X\$file \\ + $sed -n <\$file \\ -e "/^\${filebase}_init(/q" \\ -e '/^#/{' \\ @@ -35,11 +34,10 @@ -e 's/\\\\[ ]*$//' \\ -e p \\ - -e '}' - $cpp -I/usr/local/include X\$file | $sed \\ + -e '}' | $cppstdin -I/usr/local/include | $sed \\ -e '/^# *line/s/line//' \ -e '/^# *[0-9]/!d' \\ -e 's/^.*"\(.*\)".*\$/'\$filebase'.o: \1/' \\ -e 's|: \./|: |' \\ - -e 's|: X|: |' | \\ + -e 's/: .*\.c/: '\$file'/' | \\ $uniq | $sort | $uniq >> .deptmp done @@ -53,22 +51,18 @@ if $test -s .deptmp; then echo "Updating Makefile..." - echo "# If this runs make out of memory, delete /usr/include lines." >>Makefile.new - $sed -e 's/\\\$/\$\$/g' .deptmp >>Makefile.new + $sed -e 's/\\\$/\$\$/g' .deptmp | $egrep -v $usrinc >dependencies else $echo "You don't seem to have a proper C preprocessor. Using grep instead." - $egrep '^#include ' *.[cyh] >.deptmp + $egrep '^#include ' *.[cyh] ?.[cyh] >.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|y:#include "\(.*\)".*\$\$|o: \1|p' >> Makefile.new - <.deptmp $sed -n 's|y:#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 + <.deptmp $sed -n 's|c:#include "\(.*\)".*\$\$|o: \1|p' > dependencies + <.deptmp $sed -n 's|y:#include "\(.*\)".*\$\$|o: \1|p' >> dependencies + <.deptmp $sed -n 's|h:#include "\(.*\)".*\$\$|h: \1|p' >> dependencies fi +$echo "# WARNING: Put nothing here or make depend will gobble it up!" >> dependencies $mv Makefile Makefile.old $mv Makefile.new Makefile -$echo "# WARNING: Put nothing here or make depend will gobble it up!" >> Makefile -rm .deptmp X*.[cy] - +$cat dependencies >>Makefile +rm .deptmp !GROK!THIS! $eunicefix makedepend Index:ndir.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:ndir.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -17,4 +17,8 @@ #include #else +#ifdef I_DIRENT +#include +#define direct dirent +#else #ifdef I_SYS_NDIR #include @@ -23,8 +27,4 @@ #include #else -#ifdef I_DIRENT -#include -#define direct dirent -#else #ifndef DEV_BSIZE Index:newsetup.1 @@ -1,15 +1,4 @@ .\" $Id: newsetup.1,v 4.4.3.1 1992/02/01 03:17:20 sob PATCH_3 sob $ -.\" -.\" $Log: newsetup.1,v $ -.\" Revision 4.4.3.1 1992/02/01 03:17:20 sob -.\" Version 4.4 Patchlevel 3 .\" -.\" Revision 4.4.1.1 1991/09/25 19:36:48 sob -.\" Changed quote macro to "standard" one -.\" -.\" Revision 4.4 1991/09/09 20:23:31 sob -.\" release 4.4 -.\" -.\" .\" This software is Copyright 1991 by Stan Barber. .\" @@ -20,9 +9,8 @@ .\" included prominently in any copy made. .\" -.\" The author make no claims as to the fitness or correctness of this software +.\" The authors make no claims as to the fitness or correctness of this software .\" for any use whatsoever, and it is provided as is. Any use of this software .\" is at the user's own risk. -.\" -.\" +.\" .de Sh .br @@ -36,14 +24,10 @@ .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. -.\" +.\" unbreakable dash. +.tr \(*W-|\(bv\*(Tr .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 -- \(*W- +.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch .ds L" "" .ds R" "" Index:newsgroups.1 @@ -1,15 +1,4 @@ .\" $Id: newsgroups.1,v 4.4.3.1 1992/02/01 03:17:20 sob PATCH_3 sob $ -.\" -.\" $Log: newsgroups.1,v $ -.\" Revision 4.4.3.1 1992/02/01 03:17:20 sob -.\" Version 4.4 Patchlevel 3 .\" -.\" Revision 4.4.1.1 1991/09/25 19:36:48 sob -.\" Changed quote macro to "standard" one -.\" -.\" Revision 4.4 1991/09/09 20:23:31 sob -.\" release 4.4 -.\" -.\" .\" This software is Copyright 1991 by Stan Barber. .\" @@ -20,9 +9,8 @@ .\" included prominently in any copy made. .\" -.\" The author make no claims as to the fitness or correctness of this software +.\" The authors make no claims as to the fitness or correctness of this software .\" for any use whatsoever, and it is provided as is. Any use of this software .\" is at the user's own risk. -.\" -.\" +.\" .de Sh .br @@ -36,14 +24,10 @@ .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. -.\" +.\" unbreakable dash. +.tr \(*W-|\(bv\*(Tr .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 -- \(*W- +.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch .ds L" "" .ds R" "" Index:newsnews.SH @@ -7,13 +7,13 @@ *** NEWS NEWS *** -Welcome to trn. There are more options to trn 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: +Welcome to trn. There are more options to trn than you want to think about, +so we won't list them here. If you want to find out about them, read the +manpage. There are some important things to remember, though: * Trn is an extension of rn. Where possible, the command syntax is the same. * To access all the new features, specify the options -x and -X. These options MAY be on by default, but it won't hurt to be redundant. - * Trn runs in cbreak mode. This means you don't have to type carriage return - on single character commands. (There are some multi-character commands.) + * Single-character commands don't require a carriage return -- only + commands that let you type in an argument. * At ANY prompt, you may type 'h' for help. There are many different help menus, depending on the context. Also, typing h in the middle of a @@ -22,9 +22,8 @@ spend all day reading news and never hit anything but the space bar. -This particular message comes from $privlib/newsnews, and will only -appear once. If your news administrator puts a new message in here, it -will be displayed for you the first time you run trn after the change. +This message will not be displayed again unless it is updated with new +information. -Wayne Davison davison@borland.com +Wayne Davison !GROK!THIS! $eunicefix newsnews Index:ng.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -111,5 +111,5 @@ exit_code = NG_NORM; - save_ids = FALSE; + localkf_changes = 0; killfirst = 0; @@ -174,5 +174,6 @@ rc_changed = doing_ng = TRUE; /* enter the twilight zone */ - checkcount = 0; /* do not checkpoint for a while */ + if (!unsafe_rc_saves) + checkcount = 0; /* do not checkpoint for a while */ do_fseek = FALSE; /* start 1st article at top */ for (; art<=lastart+1; ) { /* for each article */ @@ -184,11 +185,12 @@ ART_NUM oldlast = lastart; #ifdef USE_NNTP - ART_NUM newlast = lastart; - while (nntp_stat(newlast+1)) - newlast++; - if (newlast > oldlast) { - ngmax[ng] = newlast; - grow_ng(newlast); + if (!nntp_group(ngname,ng)) { + fprintf(stderr,"Your server went south for the winter:\n%s\n", + ser_line); + finalize(1); } + if (ngmax[ng] > lastart) { + grow_ng(ngmax[ng]); + } #else grow_ng(getngsize(ng)); @@ -197,5 +199,6 @@ art = lastart+1; } - find_article(art); /* sets artp */ + if (!artp || (artp->flags & AF_TMPMEM) != AF_TMPMEM || art != 0) + artp = find_article(art); if (start_command) { /* do we have an initial command? */ pushstring(start_command, 0); @@ -393,5 +396,6 @@ bits_to_rc(); /* reconstitute .newsrc line */ doing_ng = FALSE; /* tell sig_catcher to cool it */ - write_rc(); /* and update .newsrc */ + if (!unsafe_rc_saves) + write_rc(); /* and update .newsrc */ rc_changed = FALSE; /* tell sig_catcher it is ok */ if (chdir(spool)) { @@ -550,12 +554,12 @@ } not_threaded: - if (ThreadedGroup) { + if (!artp) { #ifdef VERBOSE IF(verbose) - fputs("\nThis article is not threaded.\n",stdout) FLUSH; + fputs("\nYou're at the end of the group.\n",stdout) FLUSH; ELSE #endif #ifdef TERSE - fputs("\nUnthreaded article.\n",stdout) FLUSH; + fputs("\nEnd of group.\n",stdout) FLUSH; #endif return AS_ASK; @@ -613,8 +617,6 @@ /* FALL THROUGH */ case 'A': - if (!artp) { - printf("You're not at an article.\n"); - return AS_ASK; - } + if (!artp) + goto not_threaded; switch (ask_memorize(*buf)) { case ',': case 'j': @@ -623,8 +625,6 @@ return AS_ASK; case 'K': - if (!artp) { - printf("You're not at an article.\n"); - return AS_ASK; - } + if (!artp) + goto not_threaded; /* first, write kill-subject command */ (void)art_search(buf, (sizeof buf), TRUE); @@ -634,4 +634,6 @@ return AS_NORM; case ',': /* kill this node and all descendants */ + if (!artp) + goto not_threaded; if (ThreadedGroup) kill_subthread(artp,KF_ALL); @@ -640,4 +642,6 @@ return AS_NORM; case 'J': /* Junk all nodes in this thread */ + if (!artp) + goto not_threaded; if (ThreadedGroup) { kill_thread(artp->subj->thread,KF_ALL); @@ -646,4 +650,6 @@ /* FALL THROUGH */ case 'k': /* kill current subject */ + if (!artp) + goto not_threaded; kill_subject(artp->subj,KF_ALL); if (last_cached < lastart) { @@ -866,8 +872,8 @@ return AS_NORM; } -#else - buf[1] = '\0'; - notincl(buf); - return AS_ASK; +#else /* !ARTSEARCH */ + buf[1] = '\0'; + notincl(buf); + return AS_ASK; #endif case 'u': /* unsubscribe from this newsgroup? */ Index:ng.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:ngdata.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -40,44 +40,9 @@ ngdata_init() { -#ifdef USE_NNTP - char *cp; - - nntp_command("LIST"); /* tell server we want the active file */ - if (nntp_check(TRUE) != NNTP_CLASS_OK) { /* and then see if that's ok */ - printf("Can't get active file from server: \n%s\n", ser_line); - finalize(1); - } - time(&lastactfetch); - - cp = filexp("%P/rrnact.%$"); /* make a temporary name */ - strcpy(active_name, cp); - actfp = fopen(active_name, "w+"); /* and get ready */ - if (actfp == Nullfp) { - printf(cantopen,active_name) FLUSH; - finalize(1); - } - - activeitems = 0; - while (1) { - nntp_gets(ser_line, sizeof ser_line); - if (ser_line[0] == '.') /* while there's another line */ - break; /* get it and write it to */ - activeitems++; - fputs(ser_line, actfp); - putc('\n', actfp); - } - - if (ferror(actfp)) { - printf("Error writing to active file %s.\n", active_name) FLUSH; - finalize(1); - } -#else /* !USE_NNTP */ - ngdatansrv_init(); -#endif + ngdatahash_init(); if (fseek(actfp,0L,0) == -1) { /* just get to the beginning */ printf("Error seeking in active file.\n") FLUSH; finalize(1); } - return; } @@ -86,7 +51,7 @@ { #ifdef USE_NNTP - long unread, first, last; + ART_NUM old_first = abs1st[ng]; - if (!nntp_group(ngname)) { + if (!nntp_group(ngname,ng)) { toread[ng] = TR_BOGUS; return FALSE; @@ -94,18 +59,7 @@ if ((lastart = getngsize(ng)) < 0) /* this cannot happen (laugh here) */ return FALSE; - (void) sscanf(ser_line,"%*d%ld%ld%ld",&unread,&first,&last); - - /* NNTP mangles the high/low values when no articles are present. */ - if (!unread) - absfirst = lastart+1; - else { - absfirst = (ART_NUM)first; - if (last > lastart) - lastart = (ART_NUM)last; - } - ngmax[ng] = lastart; /* ensure getngsize() knows the new maximum */ - first = abs1st[ng]; - abs1st[ng] = absfirst; - if (absfirst > first) + absfirst = abs1st[ng]; + lastart = ngmax[ng]; + if (absfirst > old_first) checkexpired(ng); #else /* !USE_NNTP */ @@ -269,5 +223,5 @@ oldsoft = softptr[num]; #ifndef USE_NNTP - fseek(actfp,100000L,1); /* hopefully this forces a reread */ + fseek(actfp,100000L,1); /* hopefully this forces a reread */ #endif if ((softptr[num] = findact(tmpbuf, nam, len, (long)oldsoft)) >= 0) { @@ -281,5 +235,5 @@ if (RCCHAR(rcchar[num]) == ':') rcchar[num] = NEGCHAR; - return TR_BOGUS; /* well, not so quietly, actually */ + return TR_BOGUS; } Index:ngdata.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -25,5 +25,4 @@ EXT char active_name[MAXFILENAME]; EXT time_t lastactfetch INIT(0); -#define MINFETCHTIME (2 * 60 * 60) #endif @@ -42,3 +41,3 @@ ACT_POS findact _((char*,char*,int,long)); -void ngdatansrv_init _(()); +void ngdatahash_init _((void)); Index:nghash.c @@ -1,6 +1,5 @@ /* $Id: nghash.c,v 3.0 1992/02/01 03:09:32 davison Trn $ */ -/* - * This software is Copyright 1991 by Stan Barber. +/* This software is Copyright 1991 by Stan Barber. * * Permission is hereby granted to copy, reproduce, redistribute or otherwise @@ -10,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -33,5 +32,5 @@ void -ngdatansrv_init() /* non-NNTP initialisation */ +ngdatahash_init() { register long offset; @@ -39,4 +38,34 @@ struct stat actstat; +#ifdef USE_NNTP + nntp_command("LIST"); /* tell server we want the active file */ + if (nntp_check(TRUE) != NNTP_CLASS_OK) { /* and then see if that's ok */ + printf("Can't get active file from server: \n%s\n", ser_line); + finalize(1); + } + time(&lastactfetch); + + strcpy(active_name, cp); + actfp = fopen(active_name, "w+"); /* and get ready */ + if (actfp == Nullfp) { + printf(cantopen,active_name) FLUSH; + finalize(1); + } + + while (1) { + nntp_gets(ser_line, sizeof ser_line); + if (ser_line[0] == '.') /* while there's another line */ + break; /* get it and write it to */ + fputs(ser_line, actfp); + putc('\n', actfp); + } + + if (ferror(actfp)) { + printf("Error writing to active file %s.\n", active_name) FLUSH; + finalize(1); + } + fseek(actfp,0L,0); /* rewind file */ + +#else /* !USE_NNTP */ actfp = fopen(cp, "r"); if (actfp == Nullfp) { @@ -44,4 +73,5 @@ finalize(1); } +#endif /* rn was being a slug about rereading the active file over and @@ -49,5 +79,5 @@ (void) fstat(fileno(actfp), &actstat); actfile = safemalloc(actstat.st_size + 1); - rewind(actfp); + /* * NOTE: this won't work on machines with ints too small to hold @@ -58,5 +88,4 @@ actfile[0] = '\0'; } - rewind(actfp); actfile[actstat.st_size] = '\0'; Index:ngsrch.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -26,6 +26,6 @@ #include "ngsrch.h" -#ifdef NGSORONLY - COMPEX ngcompex; +#ifdef NGSEARCH +COMPEX ngcompex; #endif @@ -33,7 +33,7 @@ ngsrch_init() { -#ifdef ZEROGLOB - init_compex(&ngcompex); -#endif /* ZEROGLOB */ +#ifdef NGSEARCH + init_compex(&ngcompex) +#endif ; } @@ -110,5 +110,5 @@ return execute(&ngcompex,rcline[ng]) != Nullch; } -#endif +#endif /* NGSEARCH */ #ifdef NGSORONLY @@ -124,8 +124,8 @@ if (!*s) { - if(compex->expbuf) - return Nullch; /* reuse old pattern */ - else + if (compile(compex, "", RE, fold)) return "No previous search pattern"; + else + return Nullch; /* reuse old pattern */ } for (; *s; s++) { Index:ngsrch.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:ngstuff.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -145,5 +145,5 @@ return NN_ASK; } -#ifdef ARTSRCH +#ifdef ARTSEARCH if (srchahead) srchahead = -1; @@ -276,5 +276,5 @@ /* Use the explicit article-order if it exists */ if (artptr_list) { - ARTICLE **app, **limit = artptr_list + article_count; + ARTICLE **app, **limit = artptr_list + artptr_list_size; for (app = artptr_list; app < limit; app++) if ((!((ap = *app)->flags & AF_READ) ^ want_read) @@ -334,5 +334,5 @@ deselect_article(artp); } else if (ch == '+') { - if (cmdlst[1] == '+') { + if ((saveit || cmdlst[1] == '+') && artp->subj) { if (sel_mode == SM_THREAD) select_thread(artp->subj->thread, @@ -342,9 +342,9 @@ cmdlst++; } else - select_article(artp, (saveit? AF_AUTOSELECT : 0) | AF_ECHO); + select_article(artp, (saveit? AF_AUTOSELECTALL : 0) | AF_ECHO); } else if (ch == '.') { select_subthread(artp, saveit? AF_AUTOSELECT : 0); } else if (ch == '-') { - if (cmdlst[1] == '-') { + if (cmdlst[1] == '-' && artp->subj) { if (sel_mode == SM_THREAD) deselect_thread(artp->subj->thread); @@ -357,6 +357,13 @@ kill_subthread(artp, saveit? (KF_ALL|KF_KILLFILE) : KF_ALL); } else if (ch == 'J' || ch == 'j') { - kill_thread(artp->subj->thread, + if (!artp->subj) { + set_read(artp); + artp->flags |= AF_AUTOKILLALL; + } else if (sel_mode == SM_THREAD) + kill_thread(artp->subj->thread, saveit? (KF_ALL|KF_KILLFILE) : KF_ALL); + else + kill_subject(artp->subj, + saveit? (KF_ALL|KF_KILLFILE) : KF_ALL); } else if (ch == 't') { entire_tree(artp); @@ -364,5 +371,5 @@ saveit = TRUE; } else if (ch == 'm') { - if (was_read(art)) { + if ((article_ptr(art)->flags & (AF_READ|AF_MISSING)) == AF_READ) { unmark_as_read(); #ifdef VERBOSE Index:ngstuff.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:nntp.c @@ -1,4 +1,8 @@ /* $Id: nntp.c,v 3.0 1991/11/22 04:12:21 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #include "EXTERN.h" @@ -20,6 +24,7 @@ bool -nntp_group(group) +nntp_group(group, num) char *group; +NG_NUM num; { sprintf(ser_line, "GROUP %s", group); @@ -38,4 +43,17 @@ return FALSE; } + if (num) { + long count, first, last; + + (void) sscanf(ser_line,"%*d%ld%ld%ld",&count,&first,&last); + /* NNTP mangles the high/low values when no articles are present. */ + if (!count) + abs1st[num] = ngmax[num]+1; + else { + abs1st[num] = (ART_NUM)first; + if (last > ngmax[num]) + ngmax[num] = (ART_NUM)last; + } + } return TRUE; } @@ -48,5 +66,5 @@ { sprintf(ser_line, "STAT %ld", (long)artnum); - nntp_command(ser_line); /* ask the server for the header */ + nntp_command(ser_line); return (nntp_check(TRUE) == NNTP_CLASS_OK); } @@ -59,5 +77,5 @@ { sprintf(ser_line, "HEAD %ld", (long)artnum); - nntp_command(ser_line); /* ask the server for the header */ + nntp_command(ser_line); return (nntp_check(TRUE) == NNTP_CLASS_OK); } @@ -81,5 +99,5 @@ } sprintf(ser_line, "BODY %ld", (long)artnum); - nntp_command(ser_line); /* ask the server for the article */ + nntp_command(ser_line); if (nntp_check(TRUE) != NNTP_CLASS_OK) { /* and get it's reaction */ fclose(fp); @@ -106,9 +124,6 @@ { char *s; - int year, month, day, hh, mm, ss; -#ifdef DEBUG - struct tm *ts; - char ch; -#endif + int year, month, day, hh, mm; + time_t ss; nntp_command("DATE"); @@ -123,12 +138,6 @@ day = (*--s - '0') + (*--s - '0') * 10; month = (*--s - '0') + (*--s - '0') * 10; -#ifdef DEBUG - ch = *s; -#endif *s = '\0'; year = atoi(s-4); -#ifdef DEBUG - *s = ch; -#endif /* This simple algorithm will be valid until the year 2400 */ @@ -148,12 +157,4 @@ + mm) * 60 + ss; -#ifdef DEBUG - ts = gmtime(&ss); - sprintf(buf,"19%02d%02d%02d%02d%02d%02d", - ts->tm_year % 100, ts->tm_mon+1, ts->tm_mday, - ts->tm_hour, ts->tm_min, ts->tm_sec) FLUSH; - if (strNE(ser_line+4,buf)) - printf("\n** Tell Wayne: %s != %s **\n",ser_line+4,buf); -#endif return ss; } Index:nntp.h @@ -1,8 +1,12 @@ /* $Id: nntp.h,v 3.0 1992/12/14 00:14:55 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #ifdef USE_NNTP -bool nntp_group _((char*)); +bool nntp_group _((char*,NG_NUM)); bool nntp_stat _((ART_NUM)); bool nntp_header _((ART_NUM)); Index:nntpclient.c @@ -1,4 +1,8 @@ /* $Id: nntpclient.c,v 3.0 1991/11/22 04:12:21 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #include "EXTERN.h" @@ -18,5 +22,5 @@ nntp_connect() { - char *server; + char *server, filebuf[128]; int response; @@ -27,10 +31,10 @@ if ((fp = fopen(server, "r")) != Nullfp) { server = Nullch; - while (fgets(ser_line, sizeof ser_line, fp) != Nullch) { - if (*ser_line == '\n' || *ser_line == '#') + while (fgets(filebuf, sizeof filebuf, fp) != Nullch) { + if (*filebuf == '\n' || *filebuf == '#') continue; - if ((server = index(ser_line, '\n')) != Nullch) + if ((server = index(filebuf, '\n')) != Nullch) *server = '\0'; - server = ser_line; + server = filebuf; break; } Index:nntpclient.h @@ -1,4 +1,8 @@ /* $Id: nntpclient.h,v 3.0 1992/12/14 00:14:55 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #ifdef USE_NNTP Index:nntpinit.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -89,11 +89,12 @@ nntp_check(FALSE); - /* Send a MODE READER command in case we're talking to innd. - ** If understood, use that reply. */ - nntp_command("MODE READER"); - if (nntp_gets(line2, sizeof line2) < 0) - return -1; - if (atoi(line2) != NNTP_BAD_COMMAND_VAL) - strcpy(ser_line, line2); + if (*ser_line == NNTP_CLASS_OK) { + /* Send a MODE READER command in case we're talking to innd. + ** If understood, use that reply. */ + nntp_command("MODE READER"); + nntp_gets(line2, sizeof line2); + if (atoi(line2) != NNTP_BAD_COMMAND_VAL) + strcpy(ser_line, line2); + } return atoi(ser_line); } Index:only.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -131,4 +131,5 @@ } maxngtodo = 0; + emptyOnly = FALSE; } } Index:only.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -27,4 +27,5 @@ EXT int maxngtodo INIT(0); /* 0 => no restrictions */ /* >0 => # of entries in ngtodo */ +EXT bool emptyOnly INIT(FALSE); void only_init _((void)); Index:overview.h @@ -1,4 +1,8 @@ /* $Id: overview.h,v 3.0 1992/12/14 00:14:09 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ /* The order of the overview file fields */ @@ -14,5 +18,5 @@ #undef OV_OTHERS_HAS_XREFS /* forces trn to assume xrefs always exist */ -/* If all the overview files trn will be accessing have xrefs in the OTHERS +/* If ALL the overview files trn will be accessing have xrefs in the OTHERS ** field you may choose to define OV_OTHERS_HAS_XREFS. This may save some ** article accessing during the time that it would take trn to determine @@ -21,13 +25,13 @@ /* NOTE that you must NOT define OV_XREFS unless you have opted to create ** a new (non-standard) overview field for xrefs instead of placing them -** in the OTHERS field. If you have included the xrefs header without its +** in the OTHERS field. If you have included the xref header without its ** prefix into a field of its own, define OV_XREFS with the appropriate -** field number in the list above. If it has the "Xrefs:" prefix, just -** point the OV_OTHERS field at it. Alternately, you can define both -** OV_XREFS and OV_LAX_XREFS and trn accepts a field with or without -** the "Xrefs:" prefix. */ +** field number in the list above. If it has the "Xref:" prefix and you +** didn't want to point the OV_OTHERS field at it (for some reason) you +** can define both OV_XREFS and OV_LAX_XREFS and trn accepts a field with +** or without the "Xref:" prefix. */ #undef OV_XREFS /* only define when using non-standard .overview */ -#undef OV_LAX_XREFS /* allow xrefs field to have a header-prefix */ +#undef OV_LAX_XREFS /* allow xref field to have a header-prefix */ /* What name to append to the directory name to read an overview file. Index:rcln.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:rcln.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:rcstuff.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -317,5 +317,5 @@ #ifdef USE_NNTP softptr[ng] = 0; - if (!nntp_group(ngname)) + if (!nntp_group(ngname,ng)) #else /* !USE_NNTP */ if ((softptr[ng] = findact(buf,ngname,strlen(ngname),0L)) < 0) @@ -928,5 +928,5 @@ else { UNLINK(rcbname); /* unlink backup file name */ - link(rcname,rcbname); /* and backup current name */ + safelink(rcname,rcbname); /* and backup current name */ } } @@ -1010,5 +1010,5 @@ rename(rctname,rcname); #else - link(rctname,rcname); + safelink(rctname,rcname); UNLINK(rctname); #endif @@ -1035,7 +1035,7 @@ rename(rcbname,rcname); #else - link(rcname,rctname); + safelink(rcname,rctname); UNLINK(rcname); - link(rcbname,rcname); + safelink(rcbname,rcname); UNLINK(rcbname); #endif Index:rcstuff.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:respond.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -37,5 +37,5 @@ respond_init() { - ; + export("NEWSACTIVE", filexp(ACTIVE)); } @@ -494,6 +494,6 @@ ngs_buf = fetchlines(art,NGS_LINE); if (!instr(from_buf,phostname,FALSE) || - (!instr(from_buf,logname,TRUE) && - !instr(reply_buf,logname,TRUE) && + (!instr(from_buf,loginName,TRUE) && + !instr(reply_buf,loginName,TRUE) && #ifdef NEWS_ADMIN myuid != newsuid && @@ -502,5 +502,5 @@ #ifdef DEBUG if (debug) - printf("\n%s@%s != %s\n",logname,phostname,from_buf) FLUSH; + printf("\n%s@%s != %s\n",loginName,phostname,from_buf) FLUSH; #endif #ifdef VERBOSE @@ -560,6 +560,6 @@ ngs_buf = fetchlines(art,NGS_LINE); if (!instr(from_buf,phostname,FALSE) || - (!instr(from_buf,logname,TRUE) && - !instr(reply_buf,logname,TRUE) && + (!instr(from_buf,loginName,TRUE) && + !instr(reply_buf,loginName,TRUE) && #ifdef NEWS_ADMIN myuid != newsuid && @@ -568,5 +568,5 @@ #ifdef DEBUG if (debug) - printf("\n%s@%s != %s\n",logname,phostname,from_buf) FLUSH; + printf("\n%s@%s != %s\n",loginName,phostname,from_buf) FLUSH; #endif #ifdef VERBOSE Index:respond.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:rt-mt.c @@ -1,4 +1,8 @@ /* $Id: rt-mt.c,v 3.0 1992/12/14 00:14:13 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #include "EXTERN.h" @@ -133,5 +137,9 @@ } if (total.last > lastart) +#ifdef USE_NNTP + total.last = lastart; +#else grow_cache(total.last); +#endif if (read_authors() @@ -192,9 +200,9 @@ while ((cp = index(cp, '.'))) *cp = '/'; -#endif if (threaddir == spool) strcat(buf, "/.thread"); else strcat(buf, ".th"); +#endif return buf; } @@ -425,5 +433,10 @@ wp_bmap(&p_article.subject, 8); +#ifdef USE_NNTP + article = *art_ptr++ = allocate_article(p_article.num > lastart? + 0 : p_article.num); +#else article = *art_ptr++ = allocate_article(p_article.num); +#endif article->date = p_article.date; #ifndef DBM_XREFS Index:rt-mt.h @@ -1,4 +1,8 @@ /* $Id: rt-mt.h,v 3.0 1992/12/14 00:14:09 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ bool mt_init _((void)); Index:rt-ov.c @@ -1,4 +1,8 @@ /* $Id: rt-ov.c,v 3.0 1992/12/14 00:14:13 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #include "EXTERN.h" @@ -134,5 +138,5 @@ register ARTICLE *ap2; ap2 = article_ptr(first); - for (i = artnum-first+1; i; ap2++, i--) + for (i = artnum-first; i; ap2++, i--) ap2->xrefs = nullstr; ov_files_have_xrefs = TRUE; @@ -258,5 +262,5 @@ #ifdef OV_XREFS # ifdef OV_LAX_XREFS - if (!strnCASEcmp("xref: ", fields[OV_XREFS], 6)) + if (!strncasecmp("xref: ", fields[OV_XREFS], 6)) article->xrefs = savestr(fields[OV_XREFS]+6); else @@ -274,5 +278,5 @@ if ((cp = index(cp, '\t')) != Nullch) *cp++ = '\0'; - if (!strnCASEcmp("xref: ", fld, 6)) { + if (!strncasecmp("xref: ", fld, 6)) { article->xrefs = savestr(fld+6); break; Index:rt-ov.h @@ -1,4 +1,8 @@ /* $Id: rt-ov.h,v 3.0 1992/12/14 00:14:15 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ bool ov_init _((void)); Index:rt-page.c @@ -1,4 +1,8 @@ /* $Id: rt-page.c,v 3.0 1992/12/14 00:14:12 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #include "EXTERN.h" @@ -149,9 +153,30 @@ ARTICLE *ap, **app, **limit; - sort_articles(); + if (sel_page_app) { + int desired_flags = (sel_rereading? AF_READ : 0); + limit = artptr_list + artptr_list_size; + for (app = sel_page_app; app < limit; app++) { + ap = *app; + if ((ap->flags & (AF_MISSING|AF_READ)) == desired_flags) + break; + } + sort_articles(); + if (app == limit) + sel_page_app = artptr_list + artptr_list_size; + else { + for (app = artptr_list; app < limit; app++) { + if (*app == ap) { + sel_page_app = app; + break; + } + } + } + } else + sort_articles(); + while (sel_page_sp && sel_page_sp->misc == 0) sel_page_sp = sel_page_sp->next; /* The artptr_list contains only unread or read articles, never both */ - limit = artptr_list + article_count; + limit = artptr_list + artptr_list_size; for (app = artptr_list; app < limit; app++) { ap = *app; @@ -175,9 +200,18 @@ if (!sel_page_app) (void) first_page(); + else if (sel_page_app >= limit) + (void) last_page(); } else { SUBJECT *sp, *group_sp; int group_arts; - sort_subjects(); + if (sel_page_sp) { + while (sel_page_sp && sel_page_sp->misc == 0) + sel_page_sp = sel_page_sp->next; + sort_subjects(); + if (!sel_page_sp) + sel_page_sp = last_subject; + } else + sort_subjects(); for (sp = first_subject; sp; sp = sp->next) { if (sel_rereading && !(sp->flags & sel_mask)) @@ -218,4 +252,6 @@ if (!sel_page_sp) (void) first_page(); + else if (sel_page_sp == last_subject) + (void) last_page(); } } @@ -229,5 +265,5 @@ ARTICLE **app, **limit; - limit = artptr_list + article_count; + limit = artptr_list + artptr_list_size; for (app = artptr_list; app < limit; app++) { if ((*app)->flags & AF_INCLUDED) { @@ -262,5 +298,5 @@ if (sel_mode == SM_ARTICLE) { ARTICLE **app = sel_page_app; - sel_page_app = artptr_list + article_count; + sel_page_app = artptr_list + artptr_list_size; if (!prev_page()) sel_page_app = app; @@ -282,5 +318,5 @@ { if (sel_mode == SM_ARTICLE) { - if (sel_next_app < artptr_list + article_count) { + if (sel_next_app < artptr_list + artptr_list_size) { sel_page_app = sel_next_app; sel_prior_arts += sel_page_arts; @@ -404,5 +440,5 @@ ARTICLE *ap, **app, **limit; - limit = artptr_list + article_count; + limit = artptr_list + artptr_list_size; app = sel_page_app; do { Index:rt-page.h @@ -1,4 +1,8 @@ /* $Id: rt-page.h,v 3.0 1992/12/14 00:14:12 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ bool set_sel_mode _((char_int)); Index:rt-process.c @@ -1,4 +1,8 @@ /* $Id: rt-process.c,v 3.0 1992/12/14 00:14:13 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #include "EXTERN.h" @@ -8,4 +12,5 @@ #include "cache.h" #include "bits.h" +#include "final.h" #include "ng.h" #include "ngdata.h" @@ -107,5 +112,5 @@ if (fake_ap->flags & AF_AUTOFLAGS) { article->flags |= fake_ap->flags & AF_AUTOFLAGS; - save_ids = TRUE; + localkf_changes = 2; } if (curr_artp == fake_ap) { @@ -141,9 +146,4 @@ } } -#if 1 - for (ap = fake_had_subj->articles; ap; ap = ap->subj_next) { - assert(ap != fake_ap); - } -#endif } for (ap = article->child1; ap; ap = ap->sibling) @@ -198,7 +198,6 @@ register char *cp, *end; ARTICLE *kill_ap = ((article->flags & AF_AUTOKILL)? article : Nullart); - int select_this_art = (article->subj->flags & SF_AUTOSELECT) - || (article->flags & AF_AUTOSELECTALL)? AF_AUTOSELECTALL - : (article->flags & AF_AUTOSELECT); + int select_this_art = article->flags + | (article->subj->articles? article->subj->articles->flags : 0); /* We're definitely not a fake anymore */ @@ -271,5 +270,5 @@ ap = get_article(cp); *cp = '\0'; - select_this_art |= ap->flags & (AF_AUTOSELECT|AF_AUTOSELECTALL); + select_this_art |= ap->flags; if (ap->flags & AF_AUTOKILL) kill_ap = ap; @@ -347,5 +346,5 @@ else select_subject(article->subj, AF_AUTOSELECTALL); - } else if (select_this_art) + } else if (select_this_art & AF_AUTOSELECT) select_subthread(article, AF_AUTOSELECT); if (kill_ap) Index:rt-process.h @@ -1,4 +1,8 @@ /* $Id: rt-process.h,v 3.0 1992/12/14 00:14:15 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ int msgid_cmp _((char*,int,HASHDATUM)); Index:rt-select.c @@ -1,4 +1,8 @@ /* $Id: rt-select.c,v 3.0 1992/12/14 00:14:12 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #include "EXTERN.h" @@ -51,4 +55,5 @@ mode = 't'; + art = lastart+1; sel_rereading = (cmd == 'U'); clear_on_stop = TRUE; @@ -93,6 +98,16 @@ disp_status_line = FALSE; if (added_articles > 0) { - sprintf(promptbuf, "** %ld new article%s arrived ** ", + register long i = added_articles, j; + register ARTICLE *ap = article_ptr(lastart - i + 1); + for (j = 0; j < added_articles; j++, ap++) { + if (ap->flags & AF_READ) + i--; + } + if (i == added_articles) + sprintf(promptbuf, "** %ld new article%s arrived ** ", (long)added_articles, added_articles == 1? nullstr : "s"); + else + sprintf(promptbuf, "** %ld of %ld new articles unread ** ", + i, (long)added_articles); disp_status_line = TRUE; } @@ -408,5 +423,6 @@ srchahead = 0; #endif - selected_only = (selected_count || !article_count); +/* selected_only = (selected_count || !article_count);*/ + selected_only = (selected_count != 0); if (sel_ret != '#') count_subjects(sel_ret == '+'? CS_RESELECT : CS_UNSELECT); @@ -700,11 +716,6 @@ set_sel_sort(*buf); count_subjects(CS_NORM); -#if 0 - sel_last_sp = (SUBJECT*)sel_items[sel_item_index].ptr; - sel_last_ap = sel_page_app[sel_item_index]; -#else sel_page_sp = Nullsubj; sel_page_app = Null(ARTICLE**); -#endif init_pages(); return DS_DISPLAY; @@ -714,11 +725,6 @@ sel_direction *= -1; count_subjects(CS_NORM); -#if 0 - sel_last_sp = (SUBJECT*)sel_items[sel_item_index].ptr; - sel_last_ap = sel_page_app[sel_item_index]; -#else sel_page_sp = Nullsubj; sel_page_app = Null(ARTICLE**); -#endif init_pages(); return DS_DISPLAY; @@ -737,5 +743,5 @@ if (sel_mode == SM_ARTICLE) { register ARTICLE *ap, **app, **limit; - limit = artptr_list + article_count; + limit = artptr_list + artptr_list_size; if (ch == 'D') app = sel_page_app; @@ -772,8 +778,4 @@ if (article_count && (ch == 'J' || (ch == 'D' && !selected_count))) { - if (ch == 'D') { - sel_page_sp = sel_next_sp; - sel_page_app = sel_next_app; - } init_pages(); sel_item_index = 0; @@ -802,6 +804,12 @@ if (sel_mode == SM_ARTICLE) artp = (ARTICLE*)sel_items[sel_item_index].ptr; - else - artp = ((SUBJECT*)sel_items[sel_item_index].ptr)->articles; + else { + register SUBJECT *sp = (SUBJECT*)sel_items[sel_item_index].ptr; + if (sel_mode == SM_THREAD) { + while (!sp->misc) + sp = sp->next; + } + artp = sp->articles; + } art = article_num(artp); /* This call executes the action too */ Index:rt-select.h @@ -1,4 +1,8 @@ /* $Id: rt-select.h,v 3.0 1992/12/14 00:14:15 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #define MAX_SEL 64 Index:rt-util.c @@ -1,4 +1,8 @@ /* $Id: rt-util.c,v 3.0 1992/12/14 00:14:12 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #include "EXTERN.h" @@ -481,5 +485,5 @@ int -strCASEcmp(s1, s2) +strcasecmp(s1, s2) register char *s1, *s2; { @@ -492,5 +496,5 @@ int -strnCASEcmp(s1, s2, len) +strncasecmp(s1, s2, len) register char *s1, *s2; register int len; Index:rt-util.h @@ -1,4 +1,8 @@ /* $Id: rt-util.h,v 3.0 1992/12/14 00:14:15 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ char *extract_name _((char*)); @@ -8,6 +12,6 @@ char *get_subject_start _((char*)); #ifndef HAS_STRCASECMP -int strCASEcmp _((char*,char*)); -int strnCASEcmp _((char*,char*,int)); +int strcasecmp _((char*,char*)); +int strncasecmp _((char*,char*,int)); #endif Index:rt-wumpus.c @@ -1,4 +1,8 @@ /* $Id: rt-wumpus.c,v 3.0 1992/12/14 00:14:00 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #include "EXTERN.h" Index:rt-wumpus.h @@ -1,4 +1,8 @@ /* $Id: rt-wumpus.h,v 3.0 1992/12/14 00:14:15 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ void init_tree _((void)); Index:rthread.c @@ -1,4 +1,8 @@ /* $Id: rthread.c,v 3.0 1992/12/14 00:14:13 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ #include "EXTERN.h" @@ -24,4 +28,5 @@ #include "rt-process.h" #include "rt-select.h" +#include "rt-util.h" #include "rt-wumpus.h" #include "INTERN.h" @@ -88,4 +93,5 @@ #endif +#ifndef USE_NNTP if (last_cached > lastart) { toread[ng] += (ART_UNREAD)(last_cached-lastart); @@ -93,4 +99,5 @@ ngmax[ng] = lastart = last_cached; } +#endif thread_grow(); /* thread any new articles not yet in the database */ added_articles = 0; @@ -121,6 +128,8 @@ register ARTICLE *ap = (ARTICLE*)data->dat_ptr; - if (ap) + if (ap) { + clear_article(ap); free((char*)ap); + } } @@ -146,15 +155,4 @@ } -ARTICLE * -find_article(artnum) -ART_NUM artnum; -{ - if (artp && (artp->flags & AF_TMPMEM) == AF_TMPMEM && !artnum) - return artp; - if (artnum < absfirst || artnum > lastart) - return (artp = Nullart); - return (artp = article_ptr(artnum)); -} - void top_article() @@ -217,5 +215,5 @@ /* Use the explicit article-order if it exists */ if (artptr_list) { - ARTICLE **limit = artptr_list + article_count; + ARTICLE **limit = artptr_list + artptr_list_size; if (!ap) artptr = artptr_list-1; @@ -246,5 +244,4 @@ if (ThreadedGroup || srchahead) { register SUBJECT *sp; - bool try_this_group_again = !rereading; if (ap) sp = ap->subj; @@ -260,13 +257,9 @@ ap = first_art(sp); while (!ap) { - if (try_this_group_again) - try_this_group_again = FALSE; - else { - while ((sp = sp->next) != Nullsubj - && (sp->flags & subj_mask) != subj_mask) - ; - if (!sp) - break; - } + while ((sp = sp->next) != Nullsubj + && !rereading && (sp->flags & subj_mask) != subj_mask) + ; + if (!sp) + break; ap = first_art(sp); } @@ -311,5 +304,5 @@ /* Use the explicit article-order if it exists */ if (artptr_list) { - ARTICLE **limit = artptr_list + article_count; + ARTICLE **limit = artptr_list + artptr_list_size; if (!ap) artptr = limit; @@ -348,5 +341,5 @@ while (!ap) { while ((sp = sp->prev) != Nullsubj - && (sp->flags & subj_mask) != subj_mask) + && !rereading && (sp->flags & subj_mask) != subj_mask) ; if (!sp) @@ -477,5 +470,4 @@ register ARTICLE *ap = artp; register SUBJECT *sp; - bool try_this_subj_again = TRUE; if (!ap) @@ -486,12 +478,7 @@ ap = ap->subj_next; if (!ap) { - if (try_this_subj_again) { - ap = sp->articles; - try_this_subj_again = FALSE; - } else { - if (!art) - art = firstart; - return FALSE; - } + if (!art) + art = firstart; + return FALSE; } } while ((ap->flags & (AF_READ|AF_MISSING)) @@ -513,5 +500,4 @@ register ARTICLE *ap = artp, *ap2; register SUBJECT *sp; - bool try_this_subj_again = TRUE; if (!ap) @@ -529,14 +515,7 @@ } if (!ap) { - if (try_this_subj_again) { - ap = sp->articles; - while (ap->subj_next) - ap = ap->subj_next; - try_this_subj_again = FALSE; - } else { - if (!art) - art = lastart; - return FALSE; - } + if (!art) + art = lastart; + return FALSE; } } while ((ap->flags & (AF_READ|AF_MISSING)) @@ -567,5 +546,5 @@ #endif if (sel_flags & (AF_AUTOSELECT|AF_AUTOSELECTALL)) - save_ids = TRUE; + localkf_changes = 2; if ((ap->flags & (AF_MISSING|AF_READ)) == desired_flags) { if (!(ap->flags & sel_mask)) { @@ -581,10 +560,12 @@ } else ap->flags |= sel_flags; - if (!(ap->subj->flags & sel_mask)) - selected_subj_cnt++; - ap->subj->flags = (ap->subj->flags&~SF_DEL)|sel_mask|sel_flags|SF_VISIT; - if (sel_mode == SM_THREAD) { - if ((ap = ap->subj->thread) != NULL) - ap->subj->flags |= SF_VISIT; + if (ap->subj) { + if (!(ap->subj->flags & sel_mask)) + selected_subj_cnt++; + ap->subj->flags = (ap->subj->flags&~SF_DEL) | sel_mask | SF_VISIT; + if (sel_mode == SM_THREAD) { + if ((ap = ap->subj->thread) != NULL) + ap->subj->flags |= SF_VISIT; + } } selected_only = (selected_only || selected_count != 0); @@ -602,9 +583,6 @@ int old_count = selected_count; - if (sel_flags & (AF_AUTOSELECT|AF_AUTOSELECTALL)) { - save_ids = TRUE; - if (sel_flags & AF_AUTOSELECTALL) - subj->flags |= SF_AUTOSELECT; - } + if (sel_flags & (AF_AUTOSELECT|AF_AUTOSELECTALL)) + localkf_changes = 2; for (ap = subj->articles; ap; ap = ap->subj_next) { if ((ap->flags & (AF_MISSING|AF_READ|sel_mask)) == desired_flags) { @@ -667,5 +645,5 @@ if (sel_flags & (AF_AUTOSELECT|AF_AUTOSELECTALL)) - save_ids = TRUE; + localkf_changes = 2; for (; ap != limit; ap = bump_art(ap)) { if ((ap->flags & (AF_MISSING|AF_READ|sel_mask)) == desired_flags) { @@ -675,5 +653,5 @@ ap->flags |= sel_flags; } - if (selected_count > old_count) { + if (subj && selected_count > old_count) { if (!(subj->flags & sel_mask)) selected_subj_cnt++; @@ -777,5 +755,5 @@ if (kill_flags & KF_KILLFILE) { - save_ids = TRUE; + localkf_changes = 2; kill_flags = AF_AUTOKILLALL; } else @@ -824,5 +802,5 @@ if (kill_flags & KF_KILLFILE) { - save_ids = TRUE; + localkf_changes = 2; kill_flags = AF_AUTOKILL; } else @@ -923,5 +901,5 @@ } -/* Kill all unread articles attached to the given subject. +/* Clear the auto flags in all unread articles attached to the given subject. */ void @@ -934,8 +912,8 @@ ap->flags &= ~AF_AUTOFLAGS; } - subj->flags &= ~(SF_WASSELECTED | SF_AUTOSELECT); + localkf_changes = 2; } -/* Kill all unread articles attached to the given thread. +/* Clear the auto flags in all unread articles attached to the given thread. */ void @@ -952,5 +930,5 @@ } -/* Kill the subthread attached to this article. +/* Clear the auto flags in the subthread attached to this article. */ void @@ -972,4 +950,5 @@ ap->flags &= ~AF_AUTOFLAGS; } + localkf_changes = 2; } @@ -1008,8 +987,9 @@ register SUBJECT *sp; register ARTICLE *ap; + int subj_mask = (sel_mode == SM_THREAD? (SF_THREAD|SF_VISIT) : SF_VISIT); sp = ((ap = artp) ? ap->subj->next : first_subject); for (; sp; sp = sp->next) { - if (sp->flags & SF_VISIT) { + if ((sp->flags & subj_mask) == subj_mask) { if ((ap = subj_art(sp)) != Nullart) { art = article_num(ap); @@ -1033,8 +1013,9 @@ register SUBJECT *sp; register ARTICLE *ap; + int subj_mask = (sel_mode == SM_THREAD? (SF_THREAD|SF_VISIT) : SF_VISIT); sp = ((ap = artp) ? ap->subj->prev : last_subject); for (; sp; sp = sp->prev) { - if (sp->flags & SF_VISIT) { + if ((sp->flags & subj_mask) == subj_mask) { if ((ap = subj_art(sp)) != Nullart) { art = article_num(ap); @@ -1291,5 +1272,5 @@ register SUBJECT **spp2; { - return strCASEcmp((*spp1)->str+4, (*spp2)->str+4) * sel_direction; + return strcasecmp((*spp1)->str+4, (*spp2)->str+4) * sel_direction; } @@ -1321,5 +1302,5 @@ register ARTICLE *t2 = (*spp2)->thread; if (t1 != t2 && t1 && t2) - return strCASEcmp(t1->subj->str+4, t2->subj->str+4) * sel_direction; + return strcasecmp(t1->subj->str+4, t2->subj->str+4) * sel_direction; return (int)((*spp1)->date - (*spp2)->date) * sel_direction; } @@ -1345,5 +1326,5 @@ if ((eq = (int)(sp1->date - sp2->date) * sel_direction) != 0) return eq; - return strCASEcmp(sp1->str+4, sp2->str+4) * sel_direction; + return strcasecmp(sp1->str+4, sp2->str+4) * sel_direction; } return (int)((*spp1)->date - (*spp2)->date) * sel_direction; @@ -1443,5 +1424,5 @@ if ((*art1)->subj == (*art2)->subj) return (int)((*art1)->date - (*art2)->date); - return strCASEcmp((*art1)->subj->str + 4, (*art2)->subj->str + 4) + return strcasecmp((*art1)->subj->str + 4, (*art2)->subj->str + 4) * sel_direction; } @@ -1453,5 +1434,5 @@ { int eq; - if ((eq = strCASEcmp((*art1)->from, (*art2)->from)) != 0) + if ((eq = strcasecmp((*art1)->from, (*art2)->from)) != 0) return eq * sel_direction; return (int)((*art1)->date - (*art2)->date); @@ -1478,5 +1459,5 @@ /* If we don't have at least two articles, we're done! */ - if (article_count <2) + if (artptr_list_size < 2) return; @@ -1496,17 +1477,13 @@ break; } - if (sel_page_app) - sel_last_ap = *sel_page_app; sel_page_app = 0; - qsort(artptr_list, article_count, sizeof (ARTICLE*), sort_procedure); + qsort(artptr_list, artptr_list_size, sizeof (ARTICLE*), sort_procedure); } -static long artptr_list_size = 0; - static void build_artptrs() { ARTICLE **app, *ap; - long count = article_count; + ART_NUM count = article_count; int desired_flags = (sel_rereading? AF_READ : 0); Index:rthread.h @@ -1,4 +1,8 @@ /* $Id: rthread.h,v 3.0 1992/12/14 00:14:15 davison Trn $ */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ EXT ART_NUM article_count INIT(0); @@ -14,5 +18,4 @@ void top_article _((void)); -ARTICLE *find_article _((ART_NUM)); ARTICLE *first_art _((SUBJECT*)); ARTICLE *last_art _((SUBJECT*)); Index:search.c @@ -127,5 +127,7 @@ int length = compex->braelist[n] - compex->braslist[n]; - if (!compex->nbra || n > compex->nbra || !compex->braelist[n] || length<0) + if (!compex->nbra) + return Nullch; + if (n > compex->nbra || !compex->braelist[n] || length < 0) return nullstr; growstr(&gbr_str, &gbr_siz, length+1); @@ -186,5 +188,5 @@ lastep = 0; for (;;) { - if (ep - compex->expbuf >= compex->eblen) + if (ep + 4 - compex->expbuf >= compex->eblen) ep = grow_eb(compex, ep, alt); c = *strp++; /* fetch next char of pattern */ Index:search.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:strftime.c @@ -0,0 +1,221 @@ +/* + * strftime: print formatted information about a given time. + * Adapted from the routine by Eric R. Smith, Michal Jaegermann, + * Arnold Robins, and Paul Close. + */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ + +/* Configuration choices for %x and %X */ + +#undef LOCAL_DDMMYY /* choose DD/MM/YY instead of MM/DD/YY */ +#undef LOCAL_DOTTIME /* choose HH.MM.SS instead of HH:MM:SS */ + +#include "EXTERN.h" +#include "common.h" + +static char *mth_name[] = { + "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" +}; + +static char *day_name[] = { + "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", + "Saturday" +}; + +#ifdef HAS_FTIME +# ifndef TM_ZONE +char tznm[16] = ""; +# endif +#else +extern char *tzname[]; +#endif + +size_t +strftime(str, maxsize, fmt, ts) +char *str; +size_t maxsize; +CONST char *fmt; +CONST struct tm *ts; +{ + size_t num = 0, len; + char ch; + char *putstr; + char tmpbuf[80]; + + if (maxsize-- <= 0) + return 0; + + for (;;) { + if (!(ch = *fmt++)) + break; + if (num == maxsize) { + num = 0; + break; + } + if (ch != '%') { + *str++ = ch; + num++; + continue; + } + /* assume the finished product will be sprintf'ed into tmpbuf */ + putstr = tmpbuf; + + switch (ch = *fmt++) { + case 'A': + case 'a': + if (ts->tm_wday < 0 || ts->tm_wday > 6) + putstr = "?"; + else + if (ch == 'A') + putstr = day_name[ts->tm_wday]; + else + sprintf(tmpbuf, "%-.3s", day_name[ts->tm_wday]); + break; + case 'B': + case 'b': + case 'h': + if (ts->tm_mon < 0 || ts->tm_mon > 11) + putstr = "?"; + else if (ch == 'B') + putstr = mth_name[ts->tm_mon]; + else + sprintf(tmpbuf, "%-.3s", mth_name[ts->tm_mon]); + break; + case 'C': + strftime(tmpbuf, sizeof tmpbuf, "%A, %B %e, %Y", ts); + break; + case 'c': + strftime(tmpbuf, sizeof tmpbuf, "%x %X", ts); + break; + case 'D': +#ifndef LOCAL_DDMMYY + case 'x': +#endif + strftime(tmpbuf, sizeof tmpbuf, "%m/%d/%y", ts); + break; + case 'd': + sprintf(tmpbuf, "%02d", ts->tm_mday); + break; + case 'e': /* day of month, blank padded */ + sprintf(tmpbuf, "%2d", ts->tm_mday); + break; + case 'H': + sprintf(tmpbuf, "%02d", ts->tm_hour); + break; + case 'I': + { + int n; + + n = ts->tm_hour; + if (n == 0) + n = 12; + else if (n > 12) + n -= 12; + sprintf(tmpbuf, "%02d", n); + break; + } + case 'j': + sprintf(tmpbuf, "%03d", ts->tm_yday + 1); + break; + case 'm': + sprintf(tmpbuf, "%02d", ts->tm_mon + 1); + break; + case 'M': + sprintf(tmpbuf, "%02d", ts->tm_min); + break; + case 'p': + putstr = (ts->tm_hour < 12) ? "AM" : "PM"; + break; + case 'r': + strftime(tmpbuf, sizeof tmpbuf, "%I:%M:%S %p", ts); + break; + case 'R': + strftime(tmpbuf, sizeof tmpbuf, "%H:%M", ts); + break; + case 'S': + sprintf(tmpbuf, "%02d", ts->tm_sec); + break; + case 'T': +#ifndef LOCAL_DOTTIME + case 'X': +#endif + strftime(tmpbuf, sizeof tmpbuf, "%H:%M:%S", ts); + break; + case 'U': /* week of year - starting Sunday */ + sprintf(tmpbuf, "%02d", (ts->tm_yday - ts->tm_wday + 10) / 7); + break; + case 'W': /* week of year - starting Monday */ + sprintf(tmpbuf, "%02d", (ts->tm_yday - ((ts->tm_wday + 6) % 7) + + 10) / 7); + break; + case 'w': + sprintf(tmpbuf, "%d", ts->tm_wday); + break; + case 'y': + sprintf(tmpbuf, "%02d", ts->tm_year % 100); + break; +#ifdef LOCAL_DOTTIME + case 'X': + strftime(tmpbuf, sizeof tmpbuf, "%H.%M.%S", ts); + break; +#endif +#ifdef LOCAL_DDMMYY + case 'x': + strftime(tmpbuf, sizeof tmpbuf, "%d/%m/%y", ts); + break; +#endif + case 'Y': + sprintf(tmpbuf, "%d", ts->tm_year + 1900); + break; + case 'Z': +#ifdef HAS_FTIME +# ifdef TM_ZONE + sprintf(tmpbuf, "%s", ts->tm_zone); +# else + if (*tznm == '\0') { + char *timezone(); + struct timeval tv; + struct timezone tz; + + (void) gettimeofday(&tv, &tz); + strcpy(tznm, timezone(tz.tz_minuteswest, ts->tm_isdst)); + } + sprintf(tmpbuf, "%s", tznm); +# endif +#else + sprintf(tmpbuf, "%s", tzname[ts->tm_isdst]); +#endif + break; + case '%': + case '\0': + putstr = "%"; + break; + case 'n': /* same as \n */ + putstr = "\n"; + break; + case 't': /* same as \t */ + putstr = "\t"; + break; + default: + sprintf(tmpbuf, "%%%c", ch); + break; + } + len = strlen(putstr); + num += len; + if (num > maxsize) { + len -= num - maxsize; + num = 0; + ch = '\0'; + } + strncpy(str, putstr, len); + str += len; + if (!ch) + break; + } + *str = '\0'; + return num; +} Index:sw.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -194,6 +194,6 @@ break; #ifdef SETENV - setenv("SAVEDIR", upordown ? "%p/%c" : "%p" ); - setenv("SAVENAME", upordown ? "%a" : "%^C"); + export("SAVEDIR", upordown ? "%p/%c" : "%p" ); + export("SAVENAME", upordown ? "%a" : "%^C"); #else notincl("-/"); @@ -260,8 +260,8 @@ if (s) { *s++ = '\0'; - setenv(tmpbuf,s); + export(tmpbuf,s); } else - setenv(tmpbuf,nullstr); + export(tmpbuf,nullstr); #else notincl("-E"); @@ -382,4 +382,7 @@ auto_select_postings = upordown; break; + case 'q': + quickstart = upordown; + break; case 'r': findlast = upordown; @@ -429,4 +432,7 @@ unbroken_subjects = upordown; break; + case 'U': + unsafe_rc_saves = upordown; + break; case 'v': #ifdef VERIFY @@ -466,10 +472,12 @@ page_select = *s; break; - /* - * People want a way to avoid checking for new newsgroups on startup. - */ - case 'q': - quickstart = upordown; - break; + case 'z': + s++; + if (*s == '=') s++; + if (*s) + actFetchTime = atoi(s) * 60L; + else + actFetchTime = upordown * 5L * 60L; + break; default: #ifdef VERBOSE @@ -511,5 +519,5 @@ printf("-F\"%s\" ", indstr); #ifdef INNERSEARCH - printf("-g%d ", gline); + printf("-g%d ", gline+1); #endif printf("%cG", mp[fuzzyGet]); @@ -542,4 +550,5 @@ printf("+o "); printf("%cp ", mp[auto_select_postings]); + printf("%cq ", mp[quickstart]); printf("%cr ", mp[findlast]); if (countdown) @@ -560,4 +569,5 @@ printf("%cT ", mp[typeahead]); printf("%cu ", mp[unbroken_subjects]); + printf("%cU ", mp[unsafe_rc_saves]); #ifdef VERIFY printf("%cv ", mp[verify]); @@ -571,4 +581,8 @@ else printf("+X "); + if (actFetchTime) + printf("-z%ld ",(long)actFetchTime / 60); + else + printf("+z "); fputs("\n\n",stdout) FLUSH; #ifdef ONLY Index:sw.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:term.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -83,5 +83,7 @@ ERASECH = _tty.c_cc[VERASE]; /* for finish_command() */ KILLCH = _tty.c_cc[VKILL]; /* for finish_command() */ -/* _tty.c_oflag &= ~OXTABS; /* turn off kernel tabbing-done in rn */ +#if 0 + _tty.c_oflag &= ~OXTABS; /* turn off kernel tabbing-done in rn */ +#endif # else /* !I_TERMIOS */ outspeed = _tty.sg_ospeed; /* for tputs() */ @@ -191,5 +193,6 @@ if (!*CE || !*CD || !can_home) /* can we CE, CD, and home? */ can_home_clear = FALSE; /* no, so disable use of clear eol */ - if (!*CE) CE = CD; + if (!*CE) + CE = CD; #endif /* CLEAREOL */ upcost = strlen(UP); @@ -238,7 +241,9 @@ } #ifdef TIOCGWINSZ - if (ioctl(1, TIOCGWINSZ, &winsize)>=0) { - if (winsize.ws_row>0) LINES=winsize.ws_row; - if (winsize.ws_col>0) COLS=winsize.ws_col; + if (ioctl(1, TIOCGWINSZ, &winsize) >= 0) { + if (winsize.ws_row > 0) + LINES = winsize.ws_row; + if (winsize.ws_col > 0) + COLS = winsize.ws_col; } #endif @@ -265,5 +270,5 @@ * Try to recognize and adjust for this case. */ - if ((seq[0]==(char)27) && (seq[1]=='[') && seq[2]) { + if (seq[0] == '\033' && seq[1] == '[' && seq[2]) { char lbuf[LBUFLEN]; /* copy of possibly non-writable string */ strcpy(lbuf,seq); @@ -271,5 +276,5 @@ mac_line(def,lbuf,0); } - if ((seq[0]==(char)27) && (seq[1]=='O') && seq[2]) { + if (seq[0] == '\033' && seq[1] == 'O' && seq[2]) { char lbuf[LBUFLEN]; /* copy of possibly non-writable string */ strcpy(lbuf,seq); @@ -1166,12 +1171,12 @@ if (!*HO) { /* no home sequence? */ if (!*CM) { /* no cursor motion either? */ - fputs ("\n\n\n", stdout); + fputs("\n\n\n", stdout); return; /* forget it. */ } - tputs (tgoto (CM, 0, 0), 1, putchr); /* go to home via CM */ + tputs(tgoto(CM, 0, 0), 1, putchr); /* go to home via CM */ return; } else { /* we have home sequence */ - tputs (HO, 1, putchr); /* home via HO */ + tputs(HO, 1, putchr); /* home via HO */ } } @@ -1215,5 +1220,5 @@ { if (LINES > 0) { /* is this a crt? */ - if ((!initlines) || (!initlines_specified)) + if (!initlines || !initlines_specified) /* no -i or unreasonable value for initlines */ if (outspeed >= B9600) /* whole page at >= 9600 baud */ @@ -1227,5 +1232,5 @@ LINES = 30000; /* so don't page */ CL = "\n\n"; /* put a couple of lines between */ - if ((!initlines) || (!initlines_specified)) + if (!initlines || !initlines_specified) /* make initlines reasonable */ initlines = 8; @@ -1247,8 +1252,15 @@ #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 */ + /* (defined only if TIOCSTI defined) */ } } @@ -1256,8 +1268,9 @@ /* 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 now to deal :-) */ + /* because I don't know how to deal with it :-) */ #endif } #endif + void termlib_init() @@ -1265,8 +1278,9 @@ #ifdef USETITE if (TI && *TI) - tputs (TI,1,putchr); + tputs(TI,1,putchr); #endif return; } + void termlib_reset() @@ -1274,5 +1288,5 @@ #ifdef USETITE if (TE && *TE) - tputs (TE,1,putchr); + tputs(TE,1,putchr); #endif return; Index:term.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:trn.1 @@ -1,4 +1,4 @@ .\" $Id: trn.1,v 3.0 1992/12/14 00:14:10 davison Trn $ -.\" +.\" .\" This software is Copyright 1991 by Stan Barber. .\" @@ -9,8 +9,8 @@ .\" included prominently in any copy made. .\" -.\" The author make no claims as to the fitness or correctness of this software +.\" The authors make no claims as to the fitness or correctness of this software .\" for any use whatsoever, and it is provided as is. Any use of this software .\" is at the user's own risk. -.\" +.\" .de Sh .br @@ -72,7 +72,8 @@ In addition, .I trn -has an thread selector that allows you to quickly browse through a +has a thread selector that allows you to quickly browse through a list of subjects and choose the ones you find interesting. -This thread selector can be sorted by in a variety of orders and switched +This thread selector sorts articles according to various criteria +and can be switched into various display modes that allows you to pick all the subjects separately (threads can have multiple subjects) or even pick individual @@ -308,4 +309,5 @@ Useful when you accidentally mark a group as read. .Ip "o {pattern}" 8 +.Ip "O {pattern}" 8 Only display those newsgroups whose name matches .IR pattern . @@ -320,4 +322,5 @@ is optional, \*(L'o\*(R' by itself will remove the restriction. +Using \*(L'O\*(R' will omit empty groups from the cycle. .Ip "a pattern" 8 Add unsubscribed newsgroups matching @@ -527,5 +530,5 @@ .Ip ":command" 8 Apply a command to all selected articles. -If nothing is selected, apply the command to all the unread articles. +If nothing is selected, nothing is done. .Sp Applicable commands include \*(L'+\*(R'/\*(L'-\*(R' (select/deselect @@ -725,4 +728,20 @@ .I pattern in the from line. +If you are using thread files the article data you are matching against +MAY contain only the real name of the user. +If you want to always match the full from line, see the following +header-matching option that will read in the full from-line data if +it is not already available. +.Ip /pattern/Hheader 8 +Scan forward for article containing +.I pattern +in the indicated +.Ip header . +Because we scan the entire string up to the end of the modifiers, this +modifier must be the last one. +For example, \*(L"/jsmoe@somesite.com/rHfrom:m+\*(R" will mark all +articles from \*(L"jsmoe@somesite.com\*(R" as unread and select them. +Note that if the header line isn't one that trn recognizes in its +header parser, you'll have to use the following full-header matching. .Ip /pattern/h 8 Scan forward for article containing @@ -822,5 +841,11 @@ is invoked on the KILL file. .Sp -The KILL file may also contain switch-setting lines beginning with \*(L'&\*(R'. +The KILL file may also contain switch-setting lines beginning with \*(L'&\*(R' +(see the section on \*(L"Options\*(R") and special commands beginning +with \*(L'*\*(R'. +There are two such commands at the moment: \*(L"*j\*(R" (junk all articles +from THRU to the end of the group) and \*(L"*X\*(R" (junk all +.I unselected +articles from THRU to the end of the group). Additionally, any line beginning with \*(L'X\*(R' is executed on exit from the newsgroup rather than on entrance. @@ -1345,9 +1370,11 @@ .B \-h hides (disables the printing of) all header lines beginning with -.I string. +.I string +that trn recognizes. For instance, \-hexp will disable the printing of the \*(L"Expires:\*(R" line. Case is insignificant. -If is null, all header lines except Subject are hidden, and you -may then use +Headers unknown to trn cannot be disabled except by turning them all off +(\-h without a string will disable all headers except the Subject) +and then using .B +h to select those lines you want to see. @@ -1539,4 +1566,9 @@ the last two words of the subject. .TP 5 +.B \-U +tells trn to not write the .newsrc file out after visiting each group. +While this is \*(L"unsafe\*(R" it can be faster if you have a really +huge .newsrc. +.TP 5 .B \-v sets verification mode for commands. @@ -1596,4 +1628,9 @@ default entry into a newsgroup, specify a high number, like 9999. .TP 5 +.B \-z +sets the minimum number of minutes that must elaps before the active file +is refetched to look for new articles. +A value of 0 or using +z turns this off. +.TP 5 .B \-/ sets SAVEDIR to \*(L"%p/%c\*(R" and SAVENAME to \*(L"%a\*(R", which means @@ -1820,4 +1857,7 @@ .Ip %/ 8 Last search string. +.Ip %? 8 +A space unless the current interp string is > 79 characters, at which point +it turns into a newline. .Ip %% 8 A percent sign. @@ -1885,5 +1925,5 @@ included by an F command. .Sp -Default: In article %i %f writes: +Default: In article %i,%?%)f <%>f> wrote: .Ip "AUTOSUBSCRIBE" 8 When Index:trn.c @@ -28,5 +28,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -181,5 +181,5 @@ } } - if (toread[ng] < (maxngtodo||special ? TR_NONE : TR_ONE) + if (toread[ng] < (emptyOnly || special ? TR_NONE : TR_ONE) || !shoe_fits) { /* unwanted newsgroup? */ ng += direction; /* then skip it */ @@ -201,5 +201,6 @@ if (ng >= nextrcline) { #ifdef USE_NNTP - if (time(Null(time_t*)) - lastactfetch > MINFETCHTIME) { + if (actFetchTime + && time(Null(time_t*)) - lastactfetch > actFetchTime) { fclose(actfp); ngdata_init(); /* re-grab the active file */ @@ -350,9 +351,11 @@ strcpy(s,ngname); #endif - if (isalnum(*s)) { + { char *_s; for (_s=s; isdigit(*_s); _s++) ; - if (*_s && !isspace(*_s)) + if (isspace(*_s)) + *_s = '\0'; + if (*_s) /* found non-digit before hitting end */ set_ngname(s); @@ -368,7 +371,4 @@ } } - } else { - printf("\nPlease specify a newsgroup.\n") FLUSH; - goto reask_newsgroup; } /* try to find newsgroup */ @@ -476,4 +476,5 @@ #endif case 'o': + case 'O': #ifdef ONLY { @@ -496,4 +497,5 @@ scanactive(); #endif + emptyOnly = (*buf == 'o' && maxngtodo); } ng = 0; /* simulate ^ */ Index:trn.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. Index:unship.c @@ -3,4 +3,9 @@ /* Modified by Wayne Davison, but still not copyrighted. */ +/* The authors make no claims as to the fitness or correctness of this software + * for any use whatsoever, and it is provided as is. Any use of this software + * is at the user's own risk. + */ + #include "EXTERN.h" #include "common.h" Index:util.c @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -21,8 +21,4 @@ #include "util.h" -#ifndef HAS_STRFTIME -#include "sys/time.h" -#endif - void util_init() @@ -262,6 +258,12 @@ char *np; { + char *ret; extern char *getcwd(); - return getcwd(np,512); + + if ((ret = getcwd(np,512)) == Nullch) { + printf("Cannot determine current working directory!\n") FLUSH; + finalize(1); + } + return ret; } #else @@ -271,7 +273,7 @@ { FILE *popen(); - FILE *pipefp = popen("/bin/pwd","r"); + FILE *pipefp; - if (pipefp == Nullfp) { + if ((pipefp = popen("/bin/pwd","r")) == Nullfp) { printf("Can't run /bin/pwd\n") FLUSH; finalize(1); @@ -279,5 +281,8 @@ fgets(np,512,pipefp); np[strlen(np)-1] = '\0'; /* wipe out newline */ - pclose(pipefp); + if (pclose(pipefp) == EOF) { + printf("Failed to run /bin/pwd\n") FLUSH; + finalize(1); + } return np; } @@ -385,9 +390,9 @@ #ifdef SETENV -static bool firstsetenv = TRUE; +static bool firstexport = TRUE; extern char **environ; void -setenv(nam,val) +export(nam,val) char *nam, *val; { @@ -395,5 +400,5 @@ if (!environ[i]) { /* does not exist yet */ - if (firstsetenv) { /* need we copy environment? */ + if (firstexport) { /* need we copy environment? */ int j; #ifndef lint @@ -404,5 +409,5 @@ #endif /* lint */ - firstsetenv = FALSE; + firstexport = FALSE; for (j=0; jtm_wday < 0 || ts->tm_wday > 6) - putstr = "?"; - else - if (ch == 'A') - putstr = day_name[ts->tm_wday]; - else - sprintf(tmpbuf, "%-.3s", day_name[ts->tm_wday]); - break; - case 'B': - case 'b': - case 'h': - if (ts->tm_mon < 0 || ts->tm_mon > 11) - putstr = "?"; - else if (ch == 'B') - putstr = mth_name[ts->tm_mon]; - else - sprintf(tmpbuf, "%-.3s", mth_name[ts->tm_mon]); - break; - case 'C': - strftime(tmpbuf, sizeof tmpbuf, "%A, %B %e, %Y", ts); - break; - case 'c': - strftime(tmpbuf, sizeof tmpbuf, "%x %X", ts); - break; - case 'D': -#ifndef LOCAL_DDMMYY - case 'x': -#endif - strftime(tmpbuf, sizeof tmpbuf, "%m/%d/%y", ts); - break; - case 'd': - sprintf(tmpbuf, "%02d", ts->tm_mday); - break; - case 'e': /* day of month, blank padded */ - sprintf(tmpbuf, "%2d", ts->tm_mday); - break; - case 'H': - sprintf(tmpbuf, "%02d", ts->tm_hour); - break; - case 'I': - { - int n; - - n = ts->tm_hour; - if (n == 0) - n = 12; - else if (n > 12) - n -= 12; - sprintf(tmpbuf, "%02d", n); - break; - } - case 'j': - sprintf(tmpbuf, "%03d", ts->tm_yday + 1); - break; - case 'm': - sprintf(tmpbuf, "%02d", ts->tm_mon + 1); - break; - case 'M': - sprintf(tmpbuf, "%02d", ts->tm_min); - break; - case 'p': - putstr = (ts->tm_hour < 12) ? "AM" : "PM"; - break; - case 'r': - strftime(tmpbuf, sizeof tmpbuf, "%I:%M:%S %p", ts); - break; - case 'R': - strftime(tmpbuf, sizeof tmpbuf, "%H:%M", ts); - break; - case 'S': - sprintf(tmpbuf, "%02d", ts->tm_sec); - break; - case 'T': -#ifndef LOCAL_DOTTIME - case 'X': -#endif - strftime(tmpbuf, sizeof tmpbuf, "%H:%M:%S", ts); - break; - case 'U': /* week of year - starting Sunday */ - sprintf(tmpbuf, "%02d", (ts->tm_yday - ts->tm_wday + 10) / 7); - break; - case 'W': /* week of year - starting Monday */ - sprintf(tmpbuf, "%02d", (ts->tm_yday - ((ts->tm_wday + 6) % 7) - + 10) / 7); - break; - case 'w': - sprintf(tmpbuf, "%d", ts->tm_wday); - break; - case 'y': - sprintf(tmpbuf, "%02d", ts->tm_year % 100); - break; -#ifdef LOCAL_DOTTIME - case 'X': - strftime(tmpbuf, sizeof tmpbuf, "%H.%M.%S", ts); - break; -#endif -#ifdef LOCAL_DDMMYY - case 'x': - strftime(tmpbuf, sizeof tmpbuf, "%d/%m/%y", ts); - break; +void +safelink(old, new) +char *old, *new; +{ +#if 0 + extern int sys_nerr; + extern char *sys_errlist[]; #endif - case 'Y': - sprintf(tmpbuf, "%d", ts->tm_year + 1900); - break; - case 'Z': -#ifdef HAS_FTIME -# ifdef TM_ZONE - sprintf(tmpbuf, "%s", ts->tm_zone); -# else - if (*tznm == '\0') { - char *timezone(); - struct timeval tv; - struct timezone tz; - (void) gettimeofday(&tv, &tz); - strcpy(tznm, timezone(tz.tz_minuteswest, ts->tm_isdst)); - } - sprintf(tmpbuf, "%s", tznm); -# endif -#else - sprintf(tmpbuf, "%s", tzname[ts->tm_isdst]); + if (link(old,new)) { + printf("Can't link backup (%s) to .newsrc (%s)\n", old, new) FLUSH; +#if 0 + if (errno>0 && errno maxsize) { - len -= num - maxsize; - num = 0; - ch = '\0'; - } - strncpy(str, putstr, len); - str += len; - if (!ch) - break; + finalize(1); } - *str = '\0'; - return num; } -#endif /* !HAS_STRFTIME */ Index:util.h @@ -9,5 +9,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk. @@ -41,5 +41,5 @@ char *savestr _((char*)); int makedir _((char*,int)); -void setenv _((char*,char*)); +void export _((char*,char*)); int envix _((char*)); void notincl _((char*)); @@ -47,5 +47,3 @@ void growstr _((char**,int*,int)); void setdef _((char*,char*)); -#ifndef HAS_STRFTIME -size_t strftime _((char*, size_t, CONST char*, CONST struct tm*)); -#endif +void safelink _((char*,char*)); Index:uudecode.c @@ -15,5 +15,5 @@ * included prominently in any copy made. * - * The author make no claims as to the fitness or correctness of this software + * The authors make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk.