 MANIFEST             |  186 +++--
 Makefile             |  108 ++-
 README               |    2 
 README.VMS           |   74 ++
 configure            |  846 +++++++++++++-----------
 configure.in         |   13 
 doc/CHANGES          |   65 +
 doc/INSTALL          |   20 
 doc/TODO             |   30 
 doc/tin.1            |   91 +-
 doc/tin.defaults     |  105 +++
 include/autoconf.hin |   11 
 include/bugrep.h     |   26 
 include/extern.h     |   56 +
 include/menukeys.h   |   25 
 include/msmail.h     |   21 
 include/os_2.h       |  105 ---
 include/proto.h      |   21 
 include/stpwatch.h   |    2 
 include/tcurses.h    |   12 
 include/tin.h        |  100 +-
 include/tnntp.h      |   52 -
 include/trace.h      |    2 
 include/version.h    |    6 
 include/win32.h      |  160 ----
 include/win32tcp.h   |   32 
 makefile.in          |   38 -
 mkdirs.sh            |    2 
 old/msmail.c         |  263 +++++++
 old/msmail.h         |   21 
 old/nntpvms.c        |  194 +++++
 old/nntpw32.c        | 1458 ++++++++++++++++++++++++++++++++++++++++++
 old/os_2.c           |  444 ++++++++++++
 old/os_2.h           |  102 ++
 old/win32.c          |  705 ++++++++++++++++++++
 old/win32.h          |  163 ++++
 old/win32tcp.c       |  111 +++
 old/win32tcp.h       |   32 
 pcre/pcre.mms        |   85 ++
 src/Makefile.in      |   31 
 src/active.c         |   68 +
 src/art.c            |   57 -
 src/attrib.c         |    2 
 src/auth.c           |    6 
 src/charset.c        |    4 
 src/color.c          |   19 
 src/config.c         |   83 +-
 src/curses.c         |   46 -
 src/debug.c          |    2 
 src/descrip.mms      |  318 +++++++++
 src/feed.c           |   60 -
 src/filter.c         |  118 +--
 src/group.c          |   88 --
 src/header.c         |   37 -
 src/help.c           |   20 
 src/inews.c          |   18 
 src/init.c           |  360 +++++-----
 src/lang.c           |   31 
 src/list.c           |   61 -
 src/mail.c           |    2 
 src/main.c           |   16 
 src/memory.c         |   14 
 src/misc.c           |  328 +++------
 src/msmail.c         |  254 -------
 src/newsrc.c         |   31 
 src/nntplib.c        |   79 +-
 src/nntpvms.c        |  190 -----
 src/nntpw32.c        | 1487 -------------------------------------------
 src/nrctbl.c         |    8 
 src/open.c           |   51 -
 src/os_2.c           |  469 -------------
 src/page.c           |  129 +--
 src/pgp.c            |    2 
 src/post.c           |   97 +-
 src/prompt.c         |   60 -
 src/read.c           |   24 
 src/refs.c           |    9 
 src/rfc1521.c        |    8 
 src/rfc1522.c        |   20 
 src/save.c           |   48 -
 src/screen.c         |   28 
 src/search.c         |   25 
 src/select.c         |  173 ++---
 src/sigfile.c        |    2 
 src/signal.c         |   90 --
 src/strftime.c       |    5 
 src/string.c         |    7 
 src/tcurses.c        |    4 
 src/thread.c         |  151 +---
 src/vms.c            |  294 --------
 src/win32.c          |  691 --------------------
 src/win32tcp.c       |  110 ---
 tools/metamutt       |   44 +
 vms/dir.h            |  109 +++
 vms/filetypes.h      |   13 
 vms/getopt.c         |  755 +++++++++++++++++++++
 vms/getopt.h         |  131 +++
 vms/getopt1.c        |  180 +++++
 vms/getpass.c        |   99 ++
 vms/isxterm.c        |   31 
 vms/libvms.mms       |   72 ++
 vms/ndir.h           |   51 +
 vms/parsdate.c       | 1757 +++++++++++++++++++++++++++++++++++++++++++++++++++
 vms/parse.c          |   91 ++
 vms/parse.h          |   10 
 vms/pwd.h            |   34 
 vms/qsort.c          |  202 +++++
 vms/select.h         |   26 
 vms/strings.h        |   32 
 vms/uaf.h            |  295 ++++++++
 vms/vms.c            |  350 ++++++++++
 vms/vmsdir.c         |  130 +++
 vms/vmsfile.c        |   82 ++
 vms/vmspwd.c         |  248 +++++++
 vms/vmstimval.h      |   20 
 115 files changed, 10949 insertions, 5937 deletions

diff -Nur tin-980117/MANIFEST tin-980202/MANIFEST
--- tin-980117/MANIFEST	Sat Jan 17 21:41:46 1998
+++ tin-980202/MANIFEST	Sun Feb  1 14:01:34 1998
@@ -1,21 +1,22 @@
-MANIFEST for tin-pre-1.4-980117 (Sat Jan 17 21:41:45 CET 1998)
+MANIFEST for tin-pre-1.4-980201 (Sun Feb  1 14:01:29 CET 1998)
 ----------------------------------------------------
-   7860 ./Makefile
-   3446 ./MANIFEST
-   1184 ./README
+   8557 ./Makefile
+   4037 ./MANIFEST
+   1185 ./README
+   2208 ./README.VMS
   45106 ./aclocal.m4
+    673 ./conf-tin
   20446 ./config.guess
   19236 ./config.sub
- 209438 ./configure
-  18069 ./configure.in
+ 211286 ./configure
+  18477 ./configure.in
    4765 ./install.sh
-    660 ./mkdirs.sh
-  11871 ./makefile.in
-    673 ./conf-tin
- 116220 ./doc/CHANGES
+  11864 ./makefile.in
+    661 ./mkdirs.sh
+ 118396 ./doc/CHANGES
    1469 ./doc/DEBUG_REFS
   16433 ./doc/INSTALL
-  15148 ./doc/TODO
+  15997 ./doc/TODO
    2881 ./doc/WHATSNEW
   12686 ./doc/auth.txt
    8383 ./doc/filtering
@@ -23,86 +24,77 @@
   23621 ./doc/iso2asc.txt
   34970 ./doc/minimal-netkeeping
    1615 ./doc/umlaute.txt
-  86923 ./doc/tin.1
+   3341 ./doc/tin.defaults
+  87658 ./doc/tin.1
+   1011 ./tools/metamutt
     896 ./tools/tinpp
    1661 ./tools/expand_aliases.tgz
-   1045 ./include/bugrep.h
+   1193 ./include/bugrep.h
    8208 ./include/config.h
-  53086 ./include/extern.h
-  13209 ./include/menukeys.h
-    718 ./include/msmail.h
+  53918 ./include/extern.h
+  13261 ./include/menukeys.h
    5089 ./include/nntplib.h
-   2233 ./include/os_2.h
-  23804 ./include/proto.h
-   2202 ./include/stpwatch.h
-   2522 ./include/tcurses.h
-  48833 ./include/tin.h
-   2941 ./include/tnntp.h
-    962 ./include/trace.h
-    993 ./include/version.h
-   4100 ./include/win32.h
-    789 ./include/win32tcp.h
-  20876 ./src/active.c
-  38058 ./src/art.c
-  23465 ./src/attrib.c
-   9759 ./src/auth.c
-   8925 ./src/charset.c
-   7881 ./src/color.c
-  55885 ./src/config.c
-  20797 ./src/curses.c
-  11829 ./src/debug.c
+  23768 ./include/proto.h
+   2220 ./include/stpwatch.h
+   2551 ./include/tcurses.h
+  49568 ./include/tin.h
+   3392 ./include/tnntp.h
+    971 ./include/trace.h
+    991 ./include/version.h
+  21217 ./src/active.c
+  37824 ./src/art.c
+  23464 ./src/attrib.c
+   9742 ./src/auth.c
+   8931 ./src/charset.c
+   7893 ./src/color.c
+  56098 ./src/config.c
+  20892 ./src/curses.c
+  11825 ./src/debug.c
    2300 ./src/envarg.c
-  19115 ./src/feed.c
-  43957 ./src/filter.c
+  18832 ./src/feed.c
+  43851 ./src/filter.c
   11249 ./src/getline.c
-  42433 ./src/group.c
+  42218 ./src/group.c
    2997 ./src/hashstr.c
-   7231 ./src/header.c
-  10495 ./src/help.c
-   6827 ./src/inews.c
-  35664 ./src/init.c
+   7508 ./src/header.c
+  10468 ./src/help.c
+   6817 ./src/inews.c
+  37193 ./src/init.c
    1388 ./src/joinpath.c
-  84926 ./src/lang.c
-   3778 ./src/list.c
-  10132 ./src/mail.c
-  21862 ./src/main.c
+  85556 ./src/lang.c
+   2933 ./src/list.c
+  10131 ./src/mail.c
+  21829 ./src/main.c
    8674 ./src/makecfg.c
-   8436 ./src/memory.c
-  53048 ./src/misc.c
-   7228 ./src/msmail.c
-  34642 ./src/newsrc.c
-  22970 ./src/nntplib.c
-  31267 ./src/nntpw32.c
-   4405 ./src/nntpvms.c
-   5782 ./src/nrctbl.c
-  22399 ./src/open.c
-   6272 ./src/os_2.c
-  39416 ./src/page.c
+   8467 ./src/memory.c
+  53032 ./src/misc.c
+  34807 ./src/newsrc.c
+  22876 ./src/nntplib.c
+   5771 ./src/nrctbl.c
+  22296 ./src/open.c
+  39308 ./src/page.c
   24108 ./src/parsdate.y
-   7801 ./src/pgp.c
-  89881 ./src/post.c
-  10684 ./src/prompt.c
-   7687 ./src/read.c
-  23384 ./src/refs.c
+   7753 ./src/pgp.c
+  89851 ./src/post.c
+  10108 ./src/prompt.c
+   7979 ./src/read.c
+  23373 ./src/refs.c
    1776 ./src/regex.c
-  11885 ./src/rfc1521.c
-  22306 ./src/rfc1522.c
-  33442 ./src/save.c
-   7336 ./src/screen.c
-  12103 ./src/search.c
-  35083 ./src/select.c
-   5735 ./src/sigfile.c
-   9640 ./src/signal.c
-   5686 ./src/strftime.c
-   8973 ./src/string.c
-   6155 ./src/tcurses.c
-  28894 ./src/thread.c
+  11877 ./src/rfc1521.c
+  22279 ./src/rfc1522.c
+  33153 ./src/save.c
+   7374 ./src/screen.c
+  11937 ./src/search.c
+  35453 ./src/select.c
+   5733 ./src/sigfile.c
+   9268 ./src/signal.c
+   5652 ./src/strftime.c
+   8955 ./src/string.c
+   6159 ./src/tcurses.c
+  29088 ./src/thread.c
    1038 ./src/trace.c
    4336 ./src/wildmat.c
-  12575 ./src/win32.c
-   2134 ./src/win32tcp.c
    4911 ./src/xref.c
-   5597 ./src/vms.c
    4987 ./amiga/README
    5086 ./amiga/tin.readme
   10650 ./amiga/smakefile
@@ -111,6 +103,28 @@
    6373 ./amiga/amigatcp.c
    2371 ./amiga/amiga.h
    2167 ./amiga/amigatcp.h
+   3013 ./vms/dir.h
+    424 ./vms/filetypes.h
+  21451 ./vms/getopt.c
+   4489 ./vms/getopt.h
+   4252 ./vms/getopt1.c
+   2374 ./vms/getpass.c
+    496 ./vms/isxterm.c
+   1262 ./vms/libvms.mms
+   1262 ./vms/ndir.h
+  47990 ./vms/parsdate.c
+   2716 ./vms/parse.c
+    165 ./vms/parse.h
+   1138 ./vms/pwd.h
+   5596 ./vms/qsort.c
+   1019 ./vms/select.h
+   1172 ./vms/strings.h
+   9012 ./vms/uaf.h
+   6809 ./vms/vms.c
+   3251 ./vms/vmsdir.c
+   1705 ./vms/vmsfile.c
+   5652 ./vms/vmspwd.c
+    389 ./vms/vmstimval.h
   10194 ./pcre/ChangeLog
    2020 ./pcre/Makefile.in
    2243 ./pcre/Makefile.orig
@@ -134,9 +148,21 @@
    3714 ./pcre/testinput2
   54973 ./pcre/testoutput
   12137 ./pcre/testoutput2
-   8775 ./include/autoconf.hin
-  12118 ./src/Makefile.in
+   9025 ./include/autoconf.hin
+  11955 ./src/Makefile.in
    4278 ./src/l1_next.tab
    4278 ./src/next_l1.tab
    4413 ./src/tincfg.tbl
-2434169 total
+   8787 ./src/descrip.mms
+   1677 ./pcre/pcre.mms
+   7092 ./old/msmail.c
+   4443 ./old/nntpvms.c
+  31232 ./old/nntpw32.c
+   6967 ./old/os_2.c
+  12414 ./old/win32.c
+   2143 ./old/win32tcp.c
+    718 ./old/msmail.h
+   2225 ./old/os_2.h
+   3753 ./old/win32.h
+    786 ./old/win32tcp.h
+2581415 total
diff -Nur tin-980117/Makefile tin-980202/Makefile
--- tin-980117/Makefile	Sat Jan 17 04:03:38 1998
+++ tin-980202/Makefile	Mon Feb  2 13:41:35 1998
@@ -8,7 +8,7 @@
 EXE		= tin
 MANEXT		= 1
 LVER		= 1.4
-PVER		= 980117
+PVER		= 980202
 VER		= pre-$(LVER)-$(PVER)
 
 # directory structure
@@ -18,17 +18,17 @@
 OBJDIR	= ./src
 SRCDIR	= ./src
 AMGDIR	= ./amiga
-TOLDIR	= ./tools
+VMSDIR	= ./vms
 PCREDIR	= ./pcre
+TOLDIR	= ./tools
+OLDDIR	= ./old
 
 HFILES	= \
 	$(INCDIR)/bugrep.h \
 	$(INCDIR)/config.h \
 	$(INCDIR)/extern.h \
 	$(INCDIR)/menukeys.h \
-	$(INCDIR)/msmail.h \
 	$(INCDIR)/nntplib.h \
-	$(INCDIR)/os_2.h \
 	$(INCDIR)/proto.h \
 	$(INCDIR)/stpwatch.h \
 	$(INCDIR)/tcurses.h \
@@ -36,8 +36,6 @@
 	$(INCDIR)/tnntp.h \
 	$(INCDIR)/trace.h \
 	$(INCDIR)/version.h \
-	$(INCDIR)/win32.h \
-	$(INCDIR)/win32tcp.h
 
 CFILES	= \
 	$(SRCDIR)/active.c \
@@ -67,14 +65,10 @@
 	$(SRCDIR)/makecfg.c \
 	$(SRCDIR)/memory.c \
 	$(SRCDIR)/misc.c \
-	$(SRCDIR)/msmail.c \
 	$(SRCDIR)/newsrc.c\
 	$(SRCDIR)/nntplib.c \
-	$(SRCDIR)/nntpw32.c \
-	$(SRCDIR)/nntpvms.c \
 	$(SRCDIR)/nrctbl.c \
 	$(SRCDIR)/open.c \
-	$(SRCDIR)/os_2.c \
 	$(SRCDIR)/page.c \
 	$(SRCDIR)/parsdate.y \
 	$(SRCDIR)/pgp.c \
@@ -97,10 +91,7 @@
 	$(SRCDIR)/thread.c \
 	$(SRCDIR)/trace.c \
 	$(SRCDIR)/wildmat.c \
-	$(SRCDIR)/win32.c \
-	$(SRCDIR)/win32tcp.c \
-	$(SRCDIR)/xref.c \
-	$(SRCDIR)/vms.c
+	$(SRCDIR)/xref.c
 
 AMIGA	= \
 	$(AMGDIR)/README \
@@ -112,6 +103,30 @@
 	$(AMGDIR)/amiga.h \
 	$(AMGDIR)/amigatcp.h
 
+VMS	= \
+	$(VMSDIR)/dir.h \
+	$(VMSDIR)/filetypes.h \
+	$(VMSDIR)/getopt.c \
+	$(VMSDIR)/getopt.h \
+	$(VMSDIR)/getopt1.c \
+	$(VMSDIR)/getpass.c \
+	$(VMSDIR)/isxterm.c \
+	$(VMSDIR)/libvms.mms \
+	$(VMSDIR)/ndir.h \
+	$(VMSDIR)/parsdate.c \
+	$(VMSDIR)/parse.c \
+	$(VMSDIR)/parse.h \
+	$(VMSDIR)/pwd.h \
+	$(VMSDIR)/qsort.c \
+	$(VMSDIR)/select.h \
+	$(VMSDIR)/strings.h \
+	$(VMSDIR)/uaf.h \
+	$(VMSDIR)/vms.c \
+	$(VMSDIR)/vmsdir.c \
+	$(VMSDIR)/vmsfile.c \
+	$(VMSDIR)/vmspwd.c \
+	$(VMSDIR)/vmstimval.h
+
 DOC	= \
 	$(DOCDIR)/CHANGES \
 	$(DOCDIR)/DEBUG_REFS \
@@ -124,9 +139,11 @@
 	$(DOCDIR)/iso2asc.txt \
 	$(DOCDIR)/minimal-netkeeping \
 	$(DOCDIR)/umlaute.txt \
+	$(DOCDIR)/tin.defaults \
 	$(DOCDIR)/$(EXE).$(MANEXT)
 
 TOL	= \
+	$(TOLDIR)/metamutt \
 	$(TOLDIR)/tinpp \
 	$(TOLDIR)/expand_aliases.tgz
 
@@ -134,15 +151,16 @@
 	$(TOPDIR)/Makefile \
 	$(TOPDIR)/MANIFEST \
 	$(TOPDIR)/README \
+	$(TOPDIR)/README.VMS \
 	$(TOPDIR)/aclocal.m4 \
+	$(TOPDIR)/conf-tin \
 	$(TOPDIR)/config.guess \
 	$(TOPDIR)/config.sub \
 	$(TOPDIR)/configure \
 	$(TOPDIR)/configure.in \
 	$(TOPDIR)/install.sh \
-	$(TOPDIR)/mkdirs.sh \
 	$(TOPDIR)/makefile.in \
-	$(TOPDIR)/conf-tin
+	$(TOPDIR)/mkdirs.sh
 
 PCRE	= \
 	$(PCREDIR)/ChangeLog \
@@ -169,31 +187,47 @@
 	$(PCREDIR)/testoutput \
 	$(PCREDIR)/testoutput2
 
-ALL_FILES = $(TOP) $(DOC) $(TOL) $(HFILES) $(CFILES) $(AMIGA) $(PCRE) \
+OLD    = \
+	$(OLDDIR)/msmail.c \
+	$(OLDDIR)/nntpvms.c \
+	$(OLDDIR)/nntpw32.c \
+	$(OLDDIR)/os_2.c \
+	$(OLDDIR)/win32.c \
+	$(OLDDIR)/win32tcp.c \
+	$(OLDDIR)/msmail.h \
+	$(OLDDIR)/os_2.h \
+	$(OLDDIR)/win32.h \
+	$(OLDDIR)/win32tcp.h
+
+MISC	= \
 	$(INCDIR)/autoconf.hin \
 	$(SRCDIR)/Makefile.in \
 	$(SRCDIR)/l1_next.tab \
 	$(SRCDIR)/next_l1.tab \
-	$(SRCDIR)/tincfg.tbl
+	$(SRCDIR)/tincfg.tbl \
+	$(SRCDIR)/descrip.mms \
+	$(PCREDIR)/pcre.mms
+
+ALL_FILES = $(TOP) $(DOC) $(TOL) $(HFILES) $(CFILES) $(AMIGA) $(VMS) $(PCRE) $(MISC) $(OLD)
 
-ALL_DIRS = $(TOPDIR) $(DOCDIR) $(SRCDIR) $(INCDIR) $(AMGDIR) $(PCREDIR)
+ALL_DIRS = $(TOPDIR) $(DOCDIR) $(SRCDIR) $(INCDIR) $(AMGDIR) $(VMSDIR) $(PCREDIR) $(OLDDIR)
 
 # standard commands
-CD		= cd
-CHMOD		= chmod
-CP		= cp -p
-ECHO		= echo
-LS		= ls -l
-MAKE		= make
-MV		= mv
-NROFF		= groff -Tascii
-RM		= rm
-SHELL		= /bin/sh
-TAR		= gtar
-BZIP2		= bzip2
-WC		= wc
-SED		= sed
-TR		= tr
+CD	= cd
+CHMOD	= chmod
+CP	= cp -p
+ECHO	= echo
+LS	= ls -l
+MAKE	= make
+MV	= mv
+NROFF	= groff -Tascii
+RM	= rm
+SHELL	= /bin/sh
+TAR	= gtar
+BZIP2	= bzip2
+WC	= wc
+SED	= sed
+TR	= tr
 
 all:
 	@$(ECHO) "Top level Makefile for the TIN v$(VER) Usenet newsreader."
@@ -251,8 +285,8 @@
 	@$(ECHO) "Setting the file permissions..."
 	@$(CHMOD) 644 $(ALL_FILES)
 	@$(CHMOD) 755 $(ALL_DIRS)
-	@$(CHMOD) 755 ./conf-tin ./config.guess ./config.sub ./configure ./install.sh
-	@$(CHMOD) 755 $(TOLDIR)/tinpp $(PCREDIR)/perltest
+	@$(CHMOD) 755 ./conf-tin ./config.guess ./config.sub ./configure ./install.sh ./mkdirs.sh
+	@$(CHMOD) 755 $(TOLDIR)/tinpp $(TOLDIR)/metamutt $(PCREDIR)/perltest
 
 tar:
 	@$(ECHO) "Generating gzipped tar file..."
@@ -299,7 +333,7 @@
 	@$(MAKE) tar
 
 version :
-	@$(ECHO) "TIN v$(VER)"
+	@$(ECHO) "TIN $(VER)"
 
 distclean:
 	@-$(MAKE) clean
diff -Nur tin-980117/README tin-980202/README
--- tin-980117/README	Fri Dec 26 03:40:46 1997
+++ tin-980202/README	Sat Jan 17 23:09:17 1998
@@ -32,5 +32,5 @@
 
 If you have additional questions or like to be informed about the
 latest new features/version you may subscribe to the (developers)
-tin mailing lists; to subscribe write to majordomo@tin.org,asking
+tin mailing lists; to subscribe write to majordomo@tin.org, asking
 in the body to: subscribe <listname> and/or read news.software.readers.
diff -Nur tin-980117/README.VMS tin-980202/README.VMS
--- tin-980117/README.VMS	Thu Jan  1 01:00:00 1970
+++ tin-980202/README.VMS	Sun Feb  1 08:44:23 1998
@@ -0,0 +1,74 @@
+WARNING, this is still a BETA release!
+It is still a work in progress and might not compile on all machines
+
+It has been installed on the following OpenVMS platforms:
+
+1) OpenVMS/Alpha 6.2, DEC C V5.0-003,                  SOCKETSHR_TCP
+2) OpenVMS/Vax   5.3, GCC 2.7.2 (Pat Ranking edition), SOCKETSHR_TCP
+
+Pre-Requisites:
+
+  This Tin version builds currently only against the SOCKETSHR shareable image.
+
+  SOCKETSHR provides a complete BSD compatible socket library.
+  It requires the NETLIB software to interface with the underlying TCP/IP
+  transport. NETLIB provides an interface to all available TCP/IP
+  transports for OpenVMS.
+
+  For building the image either MMS or MMK is required.
+
+  SOCKETSHR is freeware and available from:
+
+    http://alder.cc.kcl.ac.uk/fileserv/zip/socketshr_src_09d-5.zip
+    http://www.ifn.ing.tu-bs.de/ifn/sonst/socketshr.html
+    ftp://ftp2.kcl.ac.uk/zip/socketshr_src_09D-5.zip
+
+  NETLIB is freeware and available from:
+
+    http://alder.cc.kcl.ac.uk/fileserv/zip/netlib022.zip
+    http://www.madgoat.com/netlib.html
+    ftp://ftp2.kcl.ac.uk/zip/netlib022.zip
+
+  MMK is freeware and available from:
+
+    http://www.madgoat.com/mmk.html
+
+Quick Install:
+
+    $set def [.src]
+
+    On ALPHA:
+
+    $mms /macro=(alpha=1)
+
+    or on a VAX
+
+    $mms /macro=(vax=1)
+
+    or on a VAX with GCC
+
+    $mms /macro=(vax=1,gnuc=1)
+
+install with:
+
+    Define tin as a foreign command:
+
+    $tin :== $device:[dir.sub]tin.exe
+
+
+Install at your own risk.
+
+Please do NOT mail any bug-reports concerning THIS version to Iain Lea but
+to tin-bugs@tin.org. Before mailing a bug-report please check if you are
+using the latest release, and if not, please upgrade first! Have a look at
+the TODO file for known bugs. If you still think you found a bug, please use
+tins mail_bugreport function (shift-R) and write in english.
+
+The latest release is available at:
+<ftp://ftp.tin.org/pub/news/clients/tin/current/>
+or it's mirrors.
+
+If you have additional questions or like to be informed about the
+latest new features/version you may subscribe to the (developers)
+tin mailing lists; to subscribe write to majordomo@tin.org,asking
+in the body to: subscribe <listname> and/or read news.software.readers.
diff -Nur tin-980117/configure tin-980202/configure
--- tin-980117/configure	Thu Jan  1 19:30:31 1998
+++ tin-980202/configure	Sat Jan 31 06:27:59 1998
@@ -37,7 +37,7 @@
 ac_help="$ac_help
   --with-libdir=PATH      news-library (default: /usr/lib/news)"
 ac_help="$ac_help
-  --with-spooldir=PATH    news spool-directory (default: /usr/spool/news)"
+  --with-spooldir=PATH    news spool-directory (default: /var/spool/news)"
 ac_help="$ac_help
   --with-nov-dir=PATH     news overview-directory (default: $SPOOLDIR)"
 ac_help="$ac_help
@@ -93,6 +93,9 @@
 ac_help="$ac_help
   --disable-append-pid    disable appending .pid to tmp-files (default: on)"
 ac_help="$ac_help
+  --with-defaults-dir=PATH
+                          directory containing tin.defaults file (default: /etc/tin)"
+ac_help="$ac_help
   --with-coffee           coffee support"
 
 # Initialize some variables set by options.
@@ -630,7 +633,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:634: checking host system type" >&5
+echo "configure:637: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -714,7 +717,7 @@
 			# Extract the first word of "xlc", so it can be a program name with args.
 set dummy xlc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:718: checking for $ac_word" >&5
+echo "configure:721: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_XLC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -757,7 +760,7 @@
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:761: checking for $ac_word" >&5
+echo "configure:764: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -786,7 +789,7 @@
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:790: checking for $ac_word" >&5
+echo "configure:793: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -834,7 +837,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:838: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:841: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -844,11 +847,11 @@
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext <<EOF
-#line 848 "configure"
+#line 851 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -868,12 +871,12 @@
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:872: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:875: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:877: checking whether we are using GNU C" >&5
+echo "configure:880: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -882,7 +885,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:886: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:889: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -897,7 +900,7 @@
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:901: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:904: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -925,7 +928,7 @@
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:929: checking how to run the C preprocessor" >&5
+echo "configure:932: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -940,13 +943,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 944 "configure"
+#line 947 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:950: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:953: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -957,13 +960,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 961 "configure"
+#line 964 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:967: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:970: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -987,13 +990,13 @@
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:991: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:994: checking whether ${CC-cc} needs -traditional" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
   cat > conftest.$ac_ext <<EOF
-#line 997 "configure"
+#line 1000 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
@@ -1011,7 +1014,7 @@
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 1015 "configure"
+#line 1018 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
@@ -1033,7 +1036,7 @@
 fi
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1037: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1040: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1070,7 +1073,7 @@
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1074: checking for a BSD compatible install" >&5
+echo "configure:1077: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1122,7 +1125,7 @@
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1126: checking for $ac_word" >&5
+echo "configure:1129: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1173,14 +1176,14 @@
   do
     rm -f y.tab.ch
     echo $ac_n "checking for $cf_prog""... $ac_c" 1>&6
-echo "configure:1177: checking for $cf_prog" >&5
+echo "configure:1180: checking for $cf_prog" >&5
     cf_command="$cf_prog conftest.y"
     cf_result=no
-    if { (eval echo configure:1180: \"$cf_command\") 1>&5; (eval $cf_command) 2>&5; } && test -s y.tab.c ; then
+    if { (eval echo configure:1183: \"$cf_command\") 1>&5; (eval $cf_command) 2>&5; } && test -s y.tab.c ; then
       mv y.tab.c conftest.c
       rm -f y.tab.h
       if test "$cf_prog" = 'bison -y' ; then
-        if { (eval echo configure:1184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest ; then
+        if { (eval echo configure:1187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest ; then
           cf_result=yes
         fi
       else
@@ -1204,7 +1207,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1208: checking for $ac_word" >&5
+echo "configure:1211: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LINT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1234,7 +1237,7 @@
 
 
 echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
-echo "configure:1238: checking for ${CC-cc} option to accept ANSI C" >&5
+echo "configure:1241: checking for ${CC-cc} option to accept ANSI C" >&5
 if eval "test \"`echo '$''{'cf_cv_ansi_cc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1252,7 +1255,7 @@
 do
 	CFLAGS="$cf_save_CFLAGS $cf_arg"
 	cat > conftest.$ac_ext <<EOF
-#line 1256 "configure"
+#line 1259 "configure"
 #include "confdefs.h"
 
 #ifndef CC_HAS_PROTOS
@@ -1268,7 +1271,7 @@
 	struct s2 {int (*f) (double a);};
 ; return 0; }
 EOF
-if { (eval echo configure:1272: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1275: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ansi_cc="$cf_arg"; break
 else
@@ -1317,7 +1320,7 @@
   *)
    # user supplied option-value for "--with-ispell=path"
    echo $ac_n "checking for ispell""... $ac_c" 1>&6
-echo "configure:1321: checking for ispell" >&5
+echo "configure:1324: checking for ispell" >&5
    ac_cv_path_PATH_ISPELL="$withval"
    cat >> confdefs.h <<\EOF
 #define HAVE_ISPELL 1
@@ -1331,7 +1334,7 @@
   # Extract the first word of "ispell", so it can be a program name with args.
 set dummy ispell; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1335: checking for $ac_word" >&5
+echo "configure:1338: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_PATH_ISPELL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1384,7 +1387,7 @@
   *)
    # user supplied option-value for "--with-metamail=path"
    echo $ac_n "checking for metamail""... $ac_c" 1>&6
-echo "configure:1388: checking for metamail" >&5
+echo "configure:1391: checking for metamail" >&5
    ac_cv_path_PATH_METAMAIL="$withval"
    cat >> confdefs.h <<\EOF
 #define HAVE_METAMAIL 1
@@ -1398,7 +1401,7 @@
   # Extract the first word of "metamail", so it can be a program name with args.
 set dummy metamail; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1402: checking for $ac_word" >&5
+echo "configure:1405: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_PATH_METAMAIL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1451,7 +1454,7 @@
   *)
    # user supplied option-value for "--with-pgp=path"
    echo $ac_n "checking for pgp""... $ac_c" 1>&6
-echo "configure:1455: checking for pgp" >&5
+echo "configure:1458: checking for pgp" >&5
    ac_cv_path_PATH_PGP="$withval"
    cat >> confdefs.h <<\EOF
 #define HAVE_PGP 1
@@ -1465,7 +1468,7 @@
   # Extract the first word of "pgp", so it can be a program name with args.
 set dummy pgp; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1469: checking for $ac_word" >&5
+echo "configure:1472: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_PATH_PGP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1518,7 +1521,7 @@
   *)
    # user supplied option-value for "--with-sum=path"
    echo $ac_n "checking for sum""... $ac_c" 1>&6
-echo "configure:1522: checking for sum" >&5
+echo "configure:1525: checking for sum" >&5
    ac_cv_path_PATH_SUM="$withval"
    cat >> confdefs.h <<\EOF
 #define HAVE_SUM 1
@@ -1532,7 +1535,7 @@
   # Extract the first word of "sum", so it can be a program name with args.
 set dummy sum; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1536: checking for $ac_word" >&5
+echo "configure:1539: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_PATH_SUM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1575,12 +1578,12 @@
 if test $ac_cv_path_PATH_SUM
 then
 echo $ac_n "checking if $ac_cv_path_PATH_SUM takes -r""... $ac_c" 1>&6
-echo "configure:1579: checking if $ac_cv_path_PATH_SUM takes -r" >&5
+echo "configure:1582: checking if $ac_cv_path_PATH_SUM takes -r" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_sum_r'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-if { ac_try='$ac_cv_path_PATH_SUM -r config.log 1>&5'; { (eval echo configure:1584: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
+if { ac_try='$ac_cv_path_PATH_SUM -r config.log 1>&5'; { (eval echo configure:1587: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
 then
 	ac_cv_prog_sum_r=yes
 else
@@ -1610,7 +1613,7 @@
 
 ### check for this early, since it'll override several options
 echo $ac_n "checking if NNTP-support will be used""... $ac_c" 1>&6
-echo "configure:1614: checking if NNTP-support will be used" >&5
+echo "configure:1617: checking if NNTP-support will be used" >&5
 # Check whether --enable-nntp or --disable-nntp was given.
 if test "${enable_nntp+set}" = set; then
   enableval="$enable_nntp"
@@ -1631,7 +1634,7 @@
 USE_SPOOLDIR=yes
 if test "$USE_NNTP" = "yes" ; then
 echo $ac_n "checking whether to be NNTP_ONLY""... $ac_c" 1>&6
-echo "configure:1635: checking whether to be NNTP_ONLY" >&5
+echo "configure:1638: checking whether to be NNTP_ONLY" >&5
 # Check whether --enable-nntp-only or --disable-nntp-only was given.
 if test "${enable_nntp_only+set}" = set; then
   enableval="$enable_nntp_only"
@@ -1662,7 +1665,7 @@
 
 ###	use option --enable-debug to compile-in test/development code
 echo $ac_n "checking if you want to compile-in debug support""... $ac_c" 1>&6
-echo "configure:1666: checking if you want to compile-in debug support" >&5
+echo "configure:1669: checking if you want to compile-in debug support" >&5
 # Check whether --enable-debug or --disable-debug was given.
 if test "${enable_debug+set}" = set; then
   enableval="$enable_debug"
@@ -1687,7 +1690,7 @@
 
 ###	use option --disable-echo to suppress full display compiling commands
 echo $ac_n "checking if you want to see long compiling messages""... $ac_c" 1>&6
-echo "configure:1691: checking if you want to see long compiling messages" >&5
+echo "configure:1694: checking if you want to see long compiling messages" >&5
 # Check whether --enable-echo or --disable-echo was given.
 if test "${enable_echo+set}" = set; then
   enableval="$enable_echo"
@@ -1712,7 +1715,7 @@
 
 ### use option --enable-prototypes to turn on optional prototypes
 echo $ac_n "checking if you want to compile with fallback prototypes""... $ac_c" 1>&6
-echo "configure:1716: checking if you want to compile with fallback prototypes" >&5
+echo "configure:1719: checking if you want to compile with fallback prototypes" >&5
 # Check whether --enable-prototypes or --disable-prototypes was given.
 if test "${enable_prototypes+set}" = set; then
   enableval="$enable_prototypes"
@@ -1735,7 +1738,7 @@
 if test -n "$GCC"
 then
 echo $ac_n "checking if you want to turn on gcc warnings""... $ac_c" 1>&6
-echo "configure:1739: checking if you want to turn on gcc warnings" >&5
+echo "configure:1742: checking if you want to turn on gcc warnings" >&5
 # Check whether --enable-warnings or --disable-warnings was given.
 if test "${enable_warnings+set}" = set; then
   enableval="$enable_warnings"
@@ -1759,11 +1762,11 @@
 if test -n "$GCC"
 then
 		cat > conftest.$ac_ext <<EOF
-#line 1763 "configure"
+#line 1766 "configure"
 int main(int argc, char *argv[]) { return argv[argc-1] == 0; }
 EOF
 		echo "checking for gcc warning options" 1>&6
-echo "configure:1767: checking for gcc warning options" >&5
+echo "configure:1770: checking for gcc warning options" >&5
 	cf_save_CFLAGS="$CFLAGS"
 	EXTRA_CFLAGS="-W -Wall"
 	cf_warn_CONST=""
@@ -1781,7 +1784,7 @@
 		Wstrict-prototypes $cf_warn_CONST
 	do
 		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-		if { (eval echo configure:1785: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+		if { (eval echo configure:1788: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 			test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6
 			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
 			test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES"
@@ -1799,7 +1802,7 @@
 if test "$USE_SPOOLDIR" = "yes"; then
 	## options for directories
 	echo $ac_n "checking for news-library path""... $ac_c" 1>&6
-echo "configure:1803: checking for news-library path" >&5
+echo "configure:1806: checking for news-library path" >&5
 	# Check whether --with-libdir or --without-libdir was given.
 if test "${with_libdir+set}" = set; then
   withval="$with_libdir"
@@ -1830,13 +1833,13 @@
 	echo "$ac_t""$NEWSLIBDIR" 1>&6
 
 	echo $ac_n "checking for news spool-directory path""... $ac_c" 1>&6
-echo "configure:1834: checking for news spool-directory path" >&5
+echo "configure:1837: checking for news spool-directory path" >&5
 	# Check whether --with-spooldir or --without-spooldir was given.
 if test "${with_spooldir+set}" = set; then
   withval="$with_spooldir"
   :
 else
-  withval="${SPOOLDIR-/usr/spool/news}"
+  withval="${SPOOLDIR-/var/spool/news}"
 fi
 case ".$withval" in #(vi
 ./*) #(vi
@@ -1861,7 +1864,7 @@
 	echo "$ac_t""$SPOOLDIR" 1>&6
 
 	echo $ac_n "checking for news overview-directory path""... $ac_c" 1>&6
-echo "configure:1865: checking for news overview-directory path" >&5
+echo "configure:1868: checking for news overview-directory path" >&5
 	# Check whether --with-nov-dir or --without-nov-dir was given.
 if test "${with_nov_dir+set}" = set; then
   withval="$with_nov_dir"
@@ -1892,7 +1895,7 @@
 	echo "$ac_t""$NOVROOTDIR" 1>&6
 
 	echo $ac_n "checking for overview filename""... $ac_c" 1>&6
-echo "configure:1896: checking for overview filename" >&5
+echo "configure:1899: checking for overview filename" >&5
 	# Check whether --with-nov-fname or --without-nov-fname was given.
 if test "${with_nov_fname+set}" = set; then
   withval="$with_nov_fname"
@@ -1924,7 +1927,7 @@
 fi
 
 echo $ac_n "checking for directory containing \"inews\"""... $ac_c" 1>&6
-echo "configure:1928: checking for directory containing \"inews\"" >&5
+echo "configure:1931: checking for directory containing \"inews\"" >&5
 # Check whether --with-inews-dir or --without-inews-dir was given.
 if test "${with_inews_dir+set}" = set; then
   withval="$with_inews_dir"
@@ -1958,7 +1961,7 @@
 if test "$USE_SPOOLDIR" = "yes"; then
 	## options for libraries
 	echo $ac_n "checking for optional INN-NNTP library""... $ac_c" 1>&6
-echo "configure:1962: checking for optional INN-NNTP library" >&5
+echo "configure:1965: checking for optional INN-NNTP library" >&5
 	# Check whether --with-inn-nntplib or --without-inn-nntplib was given.
 if test "${with_inn_nntplib+set}" = set; then
   withval="$with_inn_nntplib"
@@ -1988,7 +1991,7 @@
 ### Look for network libraries first, since some functions (such as gethostname)
 ### are used in a lot of places.
 echo $ac_n "checking if you want socks5 library""... $ac_c" 1>&6
-echo "configure:1992: checking if you want socks5 library" >&5
+echo "configure:1995: checking if you want socks5 library" >&5
 if eval "test \"`echo '$''{'cf_cv_use_libsocks5'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2009,14 +2012,14 @@
 if test $cf_cv_use_libsocks5 = yes ; then
 	
 echo $ac_n "checking if we can link against socks5 library""... $ac_c" 1>&6
-echo "configure:2013: checking if we can link against socks5 library" >&5
+echo "configure:2016: checking if we can link against socks5 library" >&5
 if eval "test \"`echo '$''{'cf_cv_lib_socks5'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 LIBS="$LIBS -lsocks5"
 cat > conftest.$ac_ext <<EOF
-#line 2020 "configure"
+#line 2023 "configure"
 #include "confdefs.h"
 
 #define SOCKS
@@ -2031,7 +2034,7 @@
 	getpeername(0, (struct sockaddr *)0, (int *)0);
 ; return 0; }
 EOF
-if { (eval echo configure:2035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_lib_socks5=yes
 else
@@ -2058,7 +2061,7 @@
 	
 cf_test_netlibs=no
 echo $ac_n "checking for network libraries""... $ac_c" 1>&6
-echo "configure:2062: checking for network libraries" >&5
+echo "configure:2065: checking for network libraries" >&5
 if eval "test \"`echo '$''{'cf_cv_netlibs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2069,12 +2072,12 @@
 for ac_func in gethostname
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2073: checking for $ac_func" >&5
+echo "configure:2076: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2078 "configure"
+#line 2081 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2097,7 +2100,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2120,7 +2123,7 @@
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for gethostname in -lnsl""... $ac_c" 1>&6
-echo "configure:2124: checking for gethostname in -lnsl" >&5
+echo "configure:2127: checking for gethostname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2128,7 +2131,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2132 "configure"
+#line 2135 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2139,7 +2142,7 @@
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:2143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2172,7 +2175,7 @@
 	
 		
 echo $ac_n "checking for gethostname in -lsocket""... $ac_c" 1>&6
-echo "configure:2176: checking for gethostname in -lsocket" >&5
+echo "configure:2179: checking for gethostname in -lsocket" >&5
 ac_lib_var=`echo socket'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2180,7 +2183,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2184 "configure"
+#line 2187 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2191,7 +2194,7 @@
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:2195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2198: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2235,21 +2238,21 @@
 # FIXME:  sequent needs this library (i.e., -lsocket -linet -lnsl), but
 # I don't know the entrypoints - 97/7/22 TD
 echo $ac_n "checking for -linet""... $ac_c" 1>&6
-echo "configure:2239: checking for -linet" >&5
+echo "configure:2242: checking for -linet" >&5
 if eval "test \"`echo '$''{'ac_cv_lib_inet'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-linet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2246 "configure"
+#line 2249 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_lib_inet=yes
 else
@@ -2272,12 +2275,12 @@
 for ac_func in socket
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2276: checking for $ac_func" >&5
+echo "configure:2279: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2281 "configure"
+#line 2284 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2300,7 +2303,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2323,7 +2326,7 @@
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:2327: checking for socket in -lsocket" >&5
+echo "configure:2330: checking for socket in -lsocket" >&5
 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2331,7 +2334,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2335 "configure"
+#line 2338 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2342,7 +2345,7 @@
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:2346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2375,7 +2378,7 @@
 	
 		
 echo $ac_n "checking for socket in -lbsd""... $ac_c" 1>&6
-echo "configure:2379: checking for socket in -lbsd" >&5
+echo "configure:2382: checking for socket in -lbsd" >&5
 ac_lib_var=`echo bsd'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2383,7 +2386,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lbsd $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2387 "configure"
+#line 2390 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2394,7 +2397,7 @@
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:2398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2439,12 +2442,12 @@
 for ac_func in gethostbyname
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2443: checking for $ac_func" >&5
+echo "configure:2446: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2448 "configure"
+#line 2451 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2467,7 +2470,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2490,7 +2493,7 @@
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:2494: checking for gethostbyname in -lnsl" >&5
+echo "configure:2497: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2498,7 +2501,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2502 "configure"
+#line 2505 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2509,7 +2512,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:2513: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2550,12 +2553,12 @@
 for ac_func in strcasecmp
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2554: checking for $ac_func" >&5
+echo "configure:2557: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2559 "configure"
+#line 2562 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2578,7 +2581,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2601,7 +2604,7 @@
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for strcasecmp in -lresolv""... $ac_c" 1>&6
-echo "configure:2605: checking for strcasecmp in -lresolv" >&5
+echo "configure:2608: checking for strcasecmp in -lresolv" >&5
 ac_lib_var=`echo resolv'_'strcasecmp | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2609,7 +2612,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2613 "configure"
+#line 2616 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2620,7 +2623,7 @@
 strcasecmp()
 ; return 0; }
 EOF
-if { (eval echo configure:2624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2668,7 +2671,7 @@
 ### Look for ncurses in the usual places, accommodating compilers that don't
 ### search /usr/local by default.
 echo $ac_n "checking if you want ncurses library""... $ac_c" 1>&6
-echo "configure:2672: checking if you want ncurses library" >&5
+echo "configure:2675: checking if you want ncurses library" >&5
 found_ncurses=no
 # Check whether --with-ncurses or --without-ncurses was given.
 if test "${with_ncurses+set}" = set; then
@@ -2682,13 +2685,13 @@
 if test $found_ncurses != no ; then
 	 
 echo $ac_n "checking for ncurses header file""... $ac_c" 1>&6
-echo "configure:2686: checking for ncurses header file" >&5
+echo "configure:2689: checking for ncurses header file" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_header'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 2692 "configure"
+#line 2695 "configure"
 #include "confdefs.h"
 #include <curses.h>
 int main() {
@@ -2705,7 +2708,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:2709: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2712: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ncurses_header=predefined
 else
@@ -2791,7 +2794,7 @@
 	;;
 esac
 echo $ac_n "checking for ncurses version""... $ac_c" 1>&6
-echo "configure:2795: checking for ncurses version" >&5
+echo "configure:2798: checking for ncurses version" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2816,7 +2819,7 @@
 #endif
 EOF
 	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo configure:2820: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
+	{ (eval echo configure:2823: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
 	if test -f conftest.out ; then
 		cf_out=`cat conftest.out | sed -e 's@^Autoconf @@' -e 's@^[^"]*"@@' -e 's@".*@@'`
 		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
@@ -2825,7 +2828,7 @@
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 2829 "configure"
+#line 2832 "configure"
 #include "confdefs.h"
 
 #include <$cf_cv_ncurses_header>
@@ -2848,7 +2851,7 @@
 	exit(0);
 }
 EOF
-if { (eval echo configure:2852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   
 	cf_cv_ncurses_version=`cat $cf_tempfile`
@@ -2873,7 +2876,7 @@
 cf_ncurses_LIBS=""
 cf_ncurses_SAVE="$LIBS"
 echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6
-echo "configure:2877: checking for Gpm_Open in -lgpm" >&5
+echo "configure:2880: checking for Gpm_Open in -lgpm" >&5
 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2881,7 +2884,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lgpm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2885 "configure"
+#line 2888 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2892,7 +2895,7 @@
 Gpm_Open()
 ; return 0; }
 EOF
-if { (eval echo configure:2896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2908,7 +2911,7 @@
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   echo $ac_n "checking for initscr in -lgpm""... $ac_c" 1>&6
-echo "configure:2912: checking for initscr in -lgpm" >&5
+echo "configure:2915: checking for initscr in -lgpm" >&5
 ac_lib_var=`echo gpm'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2916,7 +2919,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lgpm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2920 "configure"
+#line 2923 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2927,7 +2930,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:2931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2958,7 +2961,7 @@
 	# This is only necessary if you are linking against an obsolete
 	# version of ncurses (but it should do no harm, since it's static).
 	echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6
-echo "configure:2962: checking for tgoto in -lmytinfo" >&5
+echo "configure:2965: checking for tgoto in -lmytinfo" >&5
 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2966,7 +2969,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lmytinfo  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2970 "configure"
+#line 2973 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2977,7 +2980,7 @@
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:2981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2984: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3005,12 +3008,12 @@
 	cf_cv_have_lib_ncurses=no
 	cf_libdir=""
 	echo $ac_n "checking for initscr""... $ac_c" 1>&6
-echo "configure:3009: checking for initscr" >&5
+echo "configure:3012: checking for initscr" >&5
 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3014 "configure"
+#line 3017 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr(); below.  */
@@ -3033,7 +3036,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_initscr=yes"
 else
@@ -3053,17 +3056,17 @@
 
 		cf_save_LIBS="$LIBS"
 		echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:3057: checking for initscr in -lncurses" >&5
+echo "configure:3060: checking for initscr in -lncurses" >&5
 		LIBS="-lncurses $LIBS"
 		cat > conftest.$ac_ext <<EOF
-#line 3060 "configure"
+#line 3063 "configure"
 #include "confdefs.h"
 #include <$cf_cv_ncurses_header>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 cf_cv_have_lib_ncurses=yes
@@ -3090,17 +3093,17 @@
 			for cf_libdir in $cf_search
 			do
 				echo $ac_n "checking for -lncurses in $cf_libdir""... $ac_c" 1>&6
-echo "configure:3094: checking for -lncurses in $cf_libdir" >&5
+echo "configure:3097: checking for -lncurses in $cf_libdir" >&5
 				LIBS="-L$cf_libdir -lncurses $cf_save_LIBS"
 				cat > conftest.$ac_ext <<EOF
-#line 3097 "configure"
+#line 3100 "configure"
 #include "confdefs.h"
 #include <$cf_cv_ncurses_header>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 		 cf_cv_have_lib_ncurses=yes
@@ -3127,7 +3130,7 @@
 
 if test -n "$cf_ncurses_LIBS" ; then
 	echo $ac_n "checking if we can link ncurses without $cf_ncurses_LIBS""... $ac_c" 1>&6
-echo "configure:3131: checking if we can link ncurses without $cf_ncurses_LIBS" >&5
+echo "configure:3134: checking if we can link ncurses without $cf_ncurses_LIBS" >&5
 	cf_ncurses_SAVE="$LIBS"
 	for p in $cf_ncurses_LIBS ; do
 		q=`echo $LIBS | sed -e 's/'$p' //' -e 's/'$p'$//'`
@@ -3136,14 +3139,14 @@
 		fi
 	done
 	cat > conftest.$ac_ext <<EOF
-#line 3140 "configure"
+#line 3143 "configure"
 #include "confdefs.h"
 #include <$cf_cv_ncurses_header>
 int main() {
 initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:3147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -3159,7 +3162,7 @@
 fi
 
 echo $ac_n "checking if you want curses""... $ac_c" 1>&6
-echo "configure:3163: checking if you want curses" >&5
+echo "configure:3166: checking if you want curses" >&5
 # Check whether --enable-curses or --disable-curses was given.
 if test "${enable_curses+set}" = set; then
   enableval="$enable_curses"
@@ -3179,14 +3182,14 @@
 
 ## debugging libraries (do this after other libraries)
 echo $ac_n "checking if you want dbmalloc library""... $ac_c" 1>&6
-echo "configure:3183: checking if you want dbmalloc library" >&5
+echo "configure:3186: checking if you want dbmalloc library" >&5
 debug_malloc=none
 # Check whether --with-dbmalloc or --without-dbmalloc was given.
 if test "${with_dbmalloc+set}" = set; then
   withval="$with_dbmalloc"
   echo "$ac_t""yes" 1>&6
 	 echo $ac_n "checking for debug_malloc in -ldbmalloc""... $ac_c" 1>&6
-echo "configure:3190: checking for debug_malloc in -ldbmalloc" >&5
+echo "configure:3193: checking for debug_malloc in -ldbmalloc" >&5
 ac_lib_var=`echo dbmalloc'_'debug_malloc | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3194,7 +3197,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldbmalloc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3198 "configure"
+#line 3201 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3205,7 +3208,7 @@
 debug_malloc()
 ; return 0; }
 EOF
-if { (eval echo configure:3209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3222,17 +3225,17 @@
   echo "$ac_t""yes" 1>&6
   ac_safe=`echo "dbmalloc.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dbmalloc.h""... $ac_c" 1>&6
-echo "configure:3226: checking for dbmalloc.h" >&5
+echo "configure:3229: checking for dbmalloc.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3231 "configure"
+#line 3234 "configure"
 #include "confdefs.h"
 #include <dbmalloc.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3236: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3239: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3263,13 +3266,13 @@
 
 
 echo $ac_n "checking if you want dmalloc library""... $ac_c" 1>&6
-echo "configure:3267: checking if you want dmalloc library" >&5
+echo "configure:3270: checking if you want dmalloc library" >&5
 # Check whether --with-dmalloc or --without-dmalloc was given.
 if test "${with_dmalloc+set}" = set; then
   withval="$with_dmalloc"
   echo "$ac_t""yes" 1>&6
 	 echo $ac_n "checking for dmalloc_debug in -ldmalloc""... $ac_c" 1>&6
-echo "configure:3273: checking for dmalloc_debug in -ldmalloc" >&5
+echo "configure:3276: checking for dmalloc_debug in -ldmalloc" >&5
 ac_lib_var=`echo dmalloc'_'dmalloc_debug | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3277,7 +3280,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldmalloc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3281 "configure"
+#line 3284 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3288,7 +3291,7 @@
 dmalloc_debug()
 ; return 0; }
 EOF
-if { (eval echo configure:3292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3305,17 +3308,17 @@
   echo "$ac_t""yes" 1>&6
   ac_safe=`echo "dmalloc.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dmalloc.h""... $ac_c" 1>&6
-echo "configure:3309: checking for dmalloc.h" >&5
+echo "configure:3312: checking for dmalloc.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3314 "configure"
+#line 3317 "configure"
 #include "confdefs.h"
 #include <dmalloc.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3319: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3322: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3346,7 +3349,7 @@
 
 
 echo $ac_n "checking if you want debugging-trace""... $ac_c" 1>&6
-echo "configure:3350: checking if you want debugging-trace" >&5
+echo "configure:3353: checking if you want debugging-trace" >&5
 # Check whether --with-trace or --without-trace was given.
 if test "${with_trace+set}" = set; then
   withval="$with_trace"
@@ -3364,7 +3367,7 @@
 
 ## options for miscellaneous definitions
 echo $ac_n "checking for domain-name""... $ac_c" 1>&6
-echo "configure:3368: checking for domain-name" >&5
+echo "configure:3371: checking for domain-name" >&5
 # Check whether --with-domain-name or --without-domain-name was given.
 if test "${with_domain_name+set}" = set; then
   withval="$with_domain_name"
@@ -3381,7 +3384,7 @@
 
 if test "$USE_NNTP" = "yes" ; then
 echo $ac_n "checking for NNTP default-server""... $ac_c" 1>&6
-echo "configure:3385: checking for NNTP default-server" >&5
+echo "configure:3388: checking for NNTP default-server" >&5
 # Check whether --with-nntp-default-server or --without-nntp-default-server was given.
 if test "${with_nntp_default_server+set}" = set; then
   withval="$with_nntp_default_server"
@@ -3433,7 +3436,7 @@
 
 ## optional features
 echo $ac_n "checking whether to use MH style mail handling""... $ac_c" 1>&6
-echo "configure:3437: checking whether to use MH style mail handling" >&5
+echo "configure:3440: checking whether to use MH style mail handling" >&5
 # Check whether --enable-mh-mail-handling or --disable-mh-mail-handling was given.
 if test "${enable_mh_mail_handling+set}" = set; then
   enableval="$enable_mh_mail_handling"
@@ -3451,7 +3454,7 @@
 echo "$ac_t""$enableval" 1>&6
 
 echo $ac_n "checking whether to enable 8-bit keycodes""... $ac_c" 1>&6
-echo "configure:3455: checking whether to enable 8-bit keycodes" >&5
+echo "configure:3458: checking whether to enable 8-bit keycodes" >&5
 # Check whether --enable-8bit-keys or --disable-8bit-keys was given.
 if test "${enable_8bit_keys+set}" = set; then
   enableval="$enable_8bit_keys"
@@ -3476,7 +3479,7 @@
 echo "$ac_t""$enableval" 1>&6
 
 echo $ac_n "checking whether to enable ANSI-color""... $ac_c" 1>&6
-echo "configure:3480: checking whether to enable ANSI-color" >&5
+echo "configure:3483: checking whether to enable ANSI-color" >&5
 # Check whether --enable-color or --disable-color was given.
 if test "${enable_color+set}" = set; then
   enableval="$enable_color"
@@ -3501,7 +3504,7 @@
 echo "$ac_t""$enableval" 1>&6
 
 echo $ac_n "checking whether to enable posting-etiquette""... $ac_c" 1>&6
-echo "configure:3505: checking whether to enable posting-etiquette" >&5
+echo "configure:3508: checking whether to enable posting-etiquette" >&5
 # Check whether --enable-etiquette or --disable-etiquette was given.
 if test "${enable_etiquette+set}" = set; then
   enableval="$enable_etiquette"
@@ -3520,7 +3523,7 @@
 
 
 echo $ac_n "checking whether to strictly observe RFC1522 and break long lines""... $ac_c" 1>&6
-echo "configure:3524: checking whether to strictly observe RFC1522 and break long lines" >&5
+echo "configure:3527: checking whether to strictly observe RFC1522 and break long lines" >&5
 # Check whether --enable-break-long-lines or --disable-break-long-lines was given.
 if test "${enable_break_long_lines+set}" = set; then
   enableval="$enable_break_long_lines"
@@ -3538,7 +3541,7 @@
 echo "$ac_t""$enableval" 1>&6
 
 echo $ac_n "checking whether to force MM_CHARSET obeyance when decoding mime""... $ac_c" 1>&6
-echo "configure:3542: checking whether to force MM_CHARSET obeyance when decoding mime" >&5
+echo "configure:3545: checking whether to force MM_CHARSET obeyance when decoding mime" >&5
 # Check whether --enable-mime-strict-charset or --disable-mime-strict-charset was given.
 if test "${enable_mime_strict_charset+set}" = set; then
   enableval="$enable_mime_strict_charset"
@@ -3563,7 +3566,7 @@
 echo "$ac_t""$enableval" 1>&6
 
 echo $ac_n "checking for MIME character-set""... $ac_c" 1>&6
-echo "configure:3567: checking for MIME character-set" >&5
+echo "configure:3570: checking for MIME character-set" >&5
 # Check whether --with-mime-default-charset or --without-mime-default-charset was given.
 if test "${with_mime_default_charset+set}" = set; then
   withval="$with_mime_default_charset"
@@ -3585,7 +3588,7 @@
 echo "$ac_t""$MM_CHARSET" 1>&6
 
 echo $ac_n "checking for default ISO/ASCII table""... $ac_c" 1>&6
-echo "configure:3589: checking for default ISO/ASCII table" >&5
+echo "configure:3592: checking for default ISO/ASCII table" >&5
 # Check whether --with-iso-to-ascii or --without-iso-to-ascii was given.
 if test "${with_iso_to_ascii+set}" = set; then
   withval="$with_iso_to_ascii"
@@ -3607,7 +3610,7 @@
 echo "$ac_t""$DEFAULT_ISO2ASC" 1>&6
 
 echo $ac_n "checking whether to enable forged cancels""... $ac_c" 1>&6
-echo "configure:3611: checking whether to enable forged cancels" >&5
+echo "configure:3614: checking whether to enable forged cancels" >&5
 # Check whether --enable-forgery or --disable-forgery was given.
 if test "${enable_forgery+set}" = set; then
   enableval="$enable_forgery"
@@ -3625,7 +3628,7 @@
 echo "$ac_t""$enableval" 1>&6
 
 echo $ac_n "checking whether to enable locale support""... $ac_c" 1>&6
-echo "configure:3629: checking whether to enable locale support" >&5
+echo "configure:3632: checking whether to enable locale support" >&5
 # Check whether --enable-locale or --disable-locale was given.
 if test "${enable_locale+set}" = set; then
   enableval="$enable_locale"
@@ -3643,7 +3646,7 @@
 echo "$ac_t""$enableval" 1>&6
 
 echo $ac_n "checking whether to enable piping support""... $ac_c" 1>&6
-echo "configure:3647: checking whether to enable piping support" >&5
+echo "configure:3650: checking whether to enable piping support" >&5
 # Check whether --enable-piping or --disable-piping was given.
 if test "${enable_piping+set}" = set; then
   enableval="$enable_piping"
@@ -3661,7 +3664,7 @@
 echo "$ac_t""$enableval" 1>&6
 
 echo $ac_n "checking whether to unique tmp-files by appending .pid""... $ac_c" 1>&6
-echo "configure:3665: checking whether to unique tmp-files by appending .pid" >&5
+echo "configure:3668: checking whether to unique tmp-files by appending .pid" >&5
 # Check whether --enable-append-pid or --disable-append-pid was given.
 if test "${enable_append_pid+set}" = set; then
   enableval="$enable_append_pid"
@@ -3685,9 +3688,45 @@
 
 echo "$ac_t""$enableval" 1>&6
 
+### checks for the location of the system-wide default setting file
+echo $ac_n "checking for directory containing tin.defaults file""... $ac_c" 1>&6
+echo "configure:3694: checking for directory containing tin.defaults file" >&5
+# Check whether --with-defaults-dir or --without-defaults-dir was given.
+if test "${with_defaults_dir+set}" = set; then
+  withval="$with_defaults_dir"
+  :
+else
+  withval="${TIN_DEFAULTS_DIR-/etc/tin}"
+fi
+case ".$withval" in #(vi
+./*) #(vi
+  ;;
+.\${*prefix}*) #(vi
+  eval withval="$withval"
+  case ".$withval" in #(vi
+  .NONE/*)
+    withval=`echo $withval | sed -e s@NONE@$ac_default_prefix@`
+    ;;
+  esac
+  ;; #(vi
+.NONE/*)
+  withval=`echo $withval | sed -e s@NONE@$ac_default_prefix@`
+  ;;
+*)
+  { echo "configure: error: expected a pathname for defaults-dir" 1>&2; exit 1; }
+  ;;
+esac
+eval TIN_DEFAULTS_DIR="$withval"
+
+echo "$ac_t""$TIN_DEFAULTS_DIR" 1>&6
+cat >> confdefs.h <<EOF
+#define TIN_DEFAULTS_DIR "$TIN_DEFAULTS_DIR"
+EOF
+
+
 ###	checks for operator characteristics (should be the last option)
 echo $ac_n "checking whether to make a coffee while compiling""... $ac_c" 1>&6
-echo "configure:3691: checking whether to make a coffee while compiling" >&5
+echo "configure:3730: checking whether to make a coffee while compiling" >&5
 # Check whether --with-coffee or --without-coffee was given.
 if test "${with_coffee+set}" = set; then
   withval="$with_coffee"
@@ -3711,7 +3750,7 @@
 ###	checks for compiler characteristics
 
 echo $ac_n "checking for makeflags variable""... $ac_c" 1>&6
-echo "configure:3715: checking for makeflags variable" >&5
+echo "configure:3754: checking for makeflags variable" >&5
 if eval "test \"`echo '$''{'cf_cv_makeflags'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3744,12 +3783,12 @@
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:3748: checking for working const" >&5
+echo "configure:3787: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3753 "configure"
+#line 3792 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3798,7 +3837,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3802: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3841: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -3819,21 +3858,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:3823: checking for inline" >&5
+echo "configure:3862: checking for inline" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 3830 "configure"
+#line 3869 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:3837: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3876: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -3860,13 +3899,13 @@
 
 
 echo $ac_n "checking for ansi token expansion/substitution""... $ac_c" 1>&6
-echo "configure:3864: checking for ansi token expansion/substitution" >&5
+echo "configure:3903: checking for ansi token expansion/substitution" >&5
 if eval "test \"`echo '$''{'cf_cv_cpp_expands'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 3870 "configure"
+#line 3909 "configure"
 #include "confdefs.h"
 
 #define string(n) #n
@@ -3874,7 +3913,7 @@
 char *s = string(token)
 ; return 0; }
 EOF
-if { (eval echo configure:3878: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3917: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_cpp_expands=yes
 else
@@ -3895,13 +3934,13 @@
 
 
 echo $ac_n "checking for ansi token concatenation""... $ac_c" 1>&6
-echo "configure:3899: checking for ansi token concatenation" >&5
+echo "configure:3938: checking for ansi token concatenation" >&5
 if eval "test \"`echo '$''{'cf_cv_cpp_concats'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 3905 "configure"
+#line 3944 "configure"
 #include "confdefs.h"
 
 #define concat(a,b) a ## b
@@ -3909,7 +3948,7 @@
 char *firstlast = "y", *s = concat(first,last)
 ; return 0; }
 EOF
-if { (eval echo configure:3913: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3952: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_cpp_concats=yes
 else
@@ -3930,20 +3969,20 @@
 
 
 echo $ac_n "checking if nested parameters work""... $ac_c" 1>&6
-echo "configure:3934: checking if nested parameters work" >&5
+echo "configure:3973: checking if nested parameters work" >&5
 if eval "test \"`echo '$''{'cf_cv_nested_params'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 3940 "configure"
+#line 3979 "configure"
 #include "confdefs.h"
 
 int main() {
 extern void (*sigdisp(int sig, void (*func)(int sig)))(int sig)
 ; return 0; }
 EOF
-if { (eval echo configure:3947: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_nested_params=yes
 else
@@ -3969,19 +4008,19 @@
   # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:3973: checking for working alloca.h" >&5
+echo "configure:4012: checking for working alloca.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3978 "configure"
+#line 4017 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:3985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_header_alloca_h=yes
 else
@@ -4002,12 +4041,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:4006: checking for alloca" >&5
+echo "configure:4045: checking for alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4011 "configure"
+#line 4050 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -4030,7 +4069,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:4034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4073: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_func_alloca_works=yes
 else
@@ -4062,12 +4101,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:4066: checking whether alloca needs Cray hooks" >&5
+echo "configure:4105: checking whether alloca needs Cray hooks" >&5
 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4071 "configure"
+#line 4110 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -4092,12 +4131,12 @@
 if test $ac_cv_os_cray = yes; then
 for ac_func in _getb67 GETB67 getb67; do
   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4096: checking for $ac_func" >&5
+echo "configure:4135: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4101 "configure"
+#line 4140 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4120,7 +4159,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4147,7 +4186,7 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:4151: checking stack direction for C alloca" >&5
+echo "configure:4190: checking stack direction for C alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4155,7 +4194,7 @@
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 4159 "configure"
+#line 4198 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -4174,7 +4213,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:4178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_stack_direction=1
 else
@@ -4204,12 +4243,12 @@
 
 ###	Checks for header files.
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:4208: checking for ANSI C header files" >&5
+echo "configure:4247: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4213 "configure"
+#line 4252 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -4217,7 +4256,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4221: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4260: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4234,7 +4273,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 4238 "configure"
+#line 4277 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -4252,7 +4291,7 @@
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 4256 "configure"
+#line 4295 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -4273,7 +4312,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 4277 "configure"
+#line 4316 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -4284,7 +4323,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:4288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -4312,12 +4351,12 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:4316: checking for $ac_hdr that defines DIR" >&5
+echo "configure:4355: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4321 "configure"
+#line 4360 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -4325,7 +4364,7 @@
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4329: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4368: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -4350,7 +4389,7 @@
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
 echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:4354: checking for opendir in -ldir" >&5
+echo "configure:4393: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4358,7 +4397,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4362 "configure"
+#line 4401 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4369,7 +4408,7 @@
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4391,7 +4430,7 @@
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4395: checking for opendir in -lx" >&5
+echo "configure:4434: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4399,7 +4438,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4403 "configure"
+#line 4442 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4410,7 +4449,7 @@
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4433,12 +4472,12 @@
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:4437: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:4476: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4442 "configure"
+#line 4481 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -4447,7 +4486,7 @@
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:4451: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4490: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -4468,12 +4507,12 @@
 fi
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:4472: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:4511: checking for sys/wait.h that is POSIX.1 compatible" >&5
 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4477 "configure"
+#line 4516 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -4489,7 +4528,7 @@
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:4493: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4532: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -4553,17 +4592,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4557: checking for $ac_hdr" >&5
+echo "configure:4596: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4562 "configure"
+#line 4601 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4567: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4606: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4593,7 +4632,7 @@
 ###	Checks that depend on existence-checks for headers
 
 echo $ac_n "checking declaration of size-change""... $ac_c" 1>&6
-echo "configure:4597: checking declaration of size-change" >&5
+echo "configure:4636: checking declaration of size-change" >&5
 if eval "test \"`echo '$''{'cf_cv_sizechange'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4607,7 +4646,7 @@
     CFLAGS="$cf_save_CFLAGS"
     test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts"
     cat > conftest.$ac_ext <<EOF
-#line 4611 "configure"
+#line 4650 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if HAVE_TERMIOS_H
@@ -4646,7 +4685,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:4650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_sizechange=yes
 else
@@ -4678,7 +4717,7 @@
 
 
 echo $ac_n "checking if sys/time.h conflicts with sys/select.h""... $ac_c" 1>&6
-echo "configure:4682: checking if sys/time.h conflicts with sys/select.h" >&5
+echo "configure:4721: checking if sys/time.h conflicts with sys/select.h" >&5
 if eval "test \"`echo '$''{'cf_cv_sys_select_timeval'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4686,7 +4725,7 @@
 for cf_opts in no yes
 do
 cat > conftest.$ac_ext <<EOF
-#line 4690 "configure"
+#line 4729 "configure"
 #include "confdefs.h"
 
 #define yes 1
@@ -4713,7 +4752,7 @@
 struct timeval foo
 ; return 0; }
 EOF
-if { (eval echo configure:4717: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4756: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_sys_select_timeval=$cf_opts
 	 break
@@ -4737,12 +4776,12 @@
 
 ###	Checks for Datatypes.
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:4741: checking for mode_t" >&5
+echo "configure:4780: checking for mode_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4746 "configure"
+#line 4785 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4769,13 +4808,46 @@
 
 fi
 
+echo $ac_n "checking for off_t""... $ac_c" 1>&6
+echo "configure:4813: checking for off_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4818 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_off_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_off_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_off_t" 1>&6
+if test $ac_cv_type_off_t = no; then
+  cat >> confdefs.h <<\EOF
+#define off_t long
+EOF
+
+fi
+
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:4774: checking for pid_t" >&5
+echo "configure:4846: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4779 "configure"
+#line 4851 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4803,12 +4875,12 @@
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:4807: checking for size_t" >&5
+echo "configure:4879: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4812 "configure"
+#line 4884 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4836,12 +4908,12 @@
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:4840: checking for uid_t in sys/types.h" >&5
+echo "configure:4912: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4845 "configure"
+#line 4917 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -4870,12 +4942,12 @@
 fi
 
 echo $ac_n "checking for time_t""... $ac_c" 1>&6
-echo "configure:4874: checking for time_t" >&5
+echo "configure:4946: checking for time_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_time_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4879 "configure"
+#line 4951 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4903,12 +4975,12 @@
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:4907: checking return type of signal handlers" >&5
+echo "configure:4979: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4912 "configure"
+#line 4984 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -4925,7 +4997,7 @@
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:4929: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5001: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -4949,12 +5021,12 @@
 	if test $found_ncurses != yes ; then
 		
 echo $ac_n "checking for initscr""... $ac_c" 1>&6
-echo "configure:4953: checking for initscr" >&5
+echo "configure:5025: checking for initscr" >&5
 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4958 "configure"
+#line 5030 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr(); below.  */
@@ -4977,7 +5049,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_initscr=yes"
 else
@@ -4998,7 +5070,7 @@
 case $host_os in #(vi
 freebsd*) #(vi
 	echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6
-echo "configure:5002: checking for tgoto in -lmytinfo" >&5
+echo "configure:5074: checking for tgoto in -lmytinfo" >&5
 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5006,7 +5078,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lmytinfo  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5010 "configure"
+#line 5082 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5017,7 +5089,7 @@
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:5021: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5040,7 +5112,7 @@
 	;;
 *hp-hpux10.*)
 	echo $ac_n "checking for initscr in -lHcurses""... $ac_c" 1>&6
-echo "configure:5044: checking for initscr in -lHcurses" >&5
+echo "configure:5116: checking for initscr in -lHcurses" >&5
 ac_lib_var=`echo Hcurses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5048,7 +5120,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lHcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5052 "configure"
+#line 5124 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5059,7 +5131,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5083,7 +5155,7 @@
   echo "$ac_t""no" 1>&6
 
 	echo $ac_n "checking for initscr in -lcur_color""... $ac_c" 1>&6
-echo "configure:5087: checking for initscr in -lcur_color" >&5
+echo "configure:5159: checking for initscr in -lcur_color" >&5
 ac_lib_var=`echo cur_color'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5091,7 +5163,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lcur_color  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5095 "configure"
+#line 5167 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5102,7 +5174,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5141,12 +5213,12 @@
 
 cf_save_LIBS="$LIBS"
 echo $ac_n "checking for tgoto""... $ac_c" 1>&6
-echo "configure:5145: checking for tgoto" >&5
+echo "configure:5217: checking for tgoto" >&5
 if eval "test \"`echo '$''{'ac_cv_func_tgoto'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5150 "configure"
+#line 5222 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char tgoto(); below.  */
@@ -5169,7 +5241,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_tgoto=yes"
 else
@@ -5185,7 +5257,7 @@
   echo "$ac_t""yes" 1>&6
   
 	echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:5189: checking for initscr in -lcurses" >&5
+echo "configure:5261: checking for initscr in -lcurses" >&5
 ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5193,7 +5265,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5197 "configure"
+#line 5269 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5204,7 +5276,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5208: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5238,7 +5310,7 @@
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6
-echo "configure:5242: checking for tgoto in -ltermcap" >&5
+echo "configure:5314: checking for tgoto in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5246,7 +5318,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5250 "configure"
+#line 5322 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5257,7 +5329,7 @@
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:5261: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5275,7 +5347,7 @@
   
 	LIBS="-ltermcap $cf_save_LIBS"
 	echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:5279: checking for initscr in -lcurses" >&5
+echo "configure:5351: checking for initscr in -lcurses" >&5
 ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5283,7 +5355,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5287 "configure"
+#line 5359 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5294,7 +5366,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5321,7 +5393,7 @@
   echo "$ac_t""no" 1>&6
 
 		echo $ac_n "checking for initscr in -lcursesX""... $ac_c" 1>&6
-echo "configure:5325: checking for initscr in -lcursesX" >&5
+echo "configure:5397: checking for initscr in -lcursesX" >&5
 ac_lib_var=`echo cursesX'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5329,7 +5401,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lcursesX  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5333 "configure"
+#line 5405 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5340,7 +5412,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5367,7 +5439,7 @@
   echo "$ac_t""no" 1>&6
 
 			echo $ac_n "checking for initscr in -ljcurses""... $ac_c" 1>&6
-echo "configure:5371: checking for initscr in -ljcurses" >&5
+echo "configure:5443: checking for initscr in -ljcurses" >&5
 ac_lib_var=`echo jcurses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5375,7 +5447,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ljcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5379 "configure"
+#line 5451 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5386,7 +5458,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5424,7 +5496,7 @@
   echo "$ac_t""no" 1>&6
 
 	echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:5428: checking for initscr in -lcurses" >&5
+echo "configure:5500: checking for initscr in -lcurses" >&5
 ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5432,7 +5504,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5436 "configure"
+#line 5508 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5443,7 +5515,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5519: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5485,7 +5557,7 @@
 	found_tcap=no
 	if test $found_ncurses = yes ; then
 		echo $ac_n "checking for tgoto in -lncurses""... $ac_c" 1>&6
-echo "configure:5489: checking for tgoto in -lncurses" >&5
+echo "configure:5561: checking for tgoto in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5493,7 +5565,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5497 "configure"
+#line 5569 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5504,7 +5576,7 @@
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:5508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5532,7 +5604,7 @@
 			# obsolete version of ncurses (but it should do no
 			# harm, since it's static).
 			echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6
-echo "configure:5536: checking for tgoto in -lmytinfo" >&5
+echo "configure:5608: checking for tgoto in -lmytinfo" >&5
 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5540,7 +5612,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lmytinfo  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5544 "configure"
+#line 5616 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5551,7 +5623,7 @@
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:5555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5576,7 +5648,7 @@
 	fi
 	if test $found_tcap != yes ; then
 		echo $ac_n "checking for tgoto in -ltermlib""... $ac_c" 1>&6
-echo "configure:5580: checking for tgoto in -ltermlib" >&5
+echo "configure:5652: checking for tgoto in -ltermlib" >&5
 ac_lib_var=`echo termlib'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5584,7 +5656,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ltermlib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5588 "configure"
+#line 5660 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5595,7 +5667,7 @@
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:5599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5619,7 +5691,7 @@
 	if test "$found_tcap" != yes; then
 		# allow curses library for broken AIX system.
 		echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:5623: checking for initscr in -lcurses" >&5
+echo "configure:5695: checking for initscr in -lcurses" >&5
 ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5627,7 +5699,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5631 "configure"
+#line 5703 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5638,7 +5710,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5659,7 +5731,7 @@
 fi
 
 		echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6
-echo "configure:5663: checking for tgoto in -ltermcap" >&5
+echo "configure:5735: checking for tgoto in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5667,7 +5739,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5671 "configure"
+#line 5743 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5678,7 +5750,7 @@
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:5682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5701,7 +5773,7 @@
 	fi
 	if test "$found_tcap" != yes; then
 		echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6
-echo "configure:5705: checking for tgoto in -ltermcap" >&5
+echo "configure:5777: checking for tgoto in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5709,7 +5781,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5713 "configure"
+#line 5785 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5720,7 +5792,7 @@
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:5724: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5747,11 +5819,11 @@
 	# terminfo-based termcap interfaces may be prototyped in <curses.h>,
 	# which may/may not be compatible with <termcap.h>
 	echo $ac_n "checking if we should include termcap.h""... $ac_c" 1>&6
-echo "configure:5751: checking if we should include termcap.h" >&5
+echo "configure:5823: checking if we should include termcap.h" >&5
 	cf_save_CFLAGS="$CFLAGS"
 	CFLAGS="$CFLAGS -I$srcdir/include"
 	cat > conftest.$ac_ext <<EOF
-#line 5755 "configure"
+#line 5827 "configure"
 #include "confdefs.h"
 
 #define HAVE_TERMCAP_H 1
@@ -5760,7 +5832,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5764: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5836: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_result=yes
 else
@@ -5778,7 +5850,7 @@
 
 fi
 echo $ac_n "checking declaration of tputs 3rd param""... $ac_c" 1>&6
-echo "configure:5782: checking declaration of tputs 3rd param" >&5
+echo "configure:5854: checking declaration of tputs 3rd param" >&5
 if eval "test \"`echo '$''{'cf_cv_type_outchar'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5790,7 +5862,7 @@
 for R in int char; do
 for S in "" const; do
 	cat > conftest.$ac_ext <<EOF
-#line 5794 "configure"
+#line 5866 "configure"
 #include "confdefs.h"
 
 #ifdef USE_TERMINFO
@@ -5812,7 +5884,7 @@
 	tputs("", 1, OutChar)
 ; return 0; }
 EOF
-if { (eval echo configure:5816: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5888: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_type_outchar="$Q OutChar($R)"
 	 cf_cv_found=yes
@@ -5855,13 +5927,13 @@
 
 
 echo $ac_n "checking declaration of errno""... $ac_c" 1>&6
-echo "configure:5859: checking declaration of errno" >&5
+echo "configure:5931: checking declaration of errno" >&5
 if eval "test \"`echo '$''{'cf_cv_dcl_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 5865 "configure"
+#line 5937 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -5871,7 +5943,7 @@
 long x = (long) errno
 ; return 0; }
 EOF
-if { (eval echo configure:5875: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5947: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval 'cf_cv_dcl_'errno'=yes'
 else
@@ -5901,9 +5973,9 @@
 EOF
 
     echo $ac_n "checking existence of errno""... $ac_c" 1>&6
-echo "configure:5905: checking existence of errno" >&5
+echo "configure:5977: checking existence of errno" >&5
         cat > conftest.$ac_ext <<EOF
-#line 5907 "configure"
+#line 5979 "configure"
 #include "confdefs.h"
 
 #undef errno
@@ -5913,7 +5985,7 @@
 errno = 2
 ; return 0; }
 EOF
-if { (eval echo configure:5917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval 'cf_cv_have_'errno'=yes'
 else
@@ -5946,13 +6018,13 @@
 do
     
 echo $ac_n "checking declaration of $cf_name""... $ac_c" 1>&6
-echo "configure:5950: checking declaration of $cf_name" >&5
+echo "configure:6022: checking declaration of $cf_name" >&5
 if eval "test \"`echo '$''{'cf_cv_dcl_$cf_name'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 5956 "configure"
+#line 6028 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -5962,7 +6034,7 @@
 long x = (long) $cf_name
 ; return 0; }
 EOF
-if { (eval echo configure:5966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval 'cf_cv_dcl_'$cf_name'=yes'
 else
@@ -5992,9 +6064,9 @@
 EOF
 
     echo $ac_n "checking existence of $cf_name""... $ac_c" 1>&6
-echo "configure:5996: checking existence of $cf_name" >&5
+echo "configure:6068: checking existence of $cf_name" >&5
         cat > conftest.$ac_ext <<EOF
-#line 5998 "configure"
+#line 6070 "configure"
 #include "confdefs.h"
 
 #undef $cf_name
@@ -6004,7 +6076,7 @@
 $cf_name = 2
 ; return 0; }
 EOF
-if { (eval echo configure:6008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval 'cf_cv_have_'$cf_name'=yes'
 else
@@ -6078,12 +6150,12 @@
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6082: checking for $ac_func" >&5
+echo "configure:6154: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6087 "configure"
+#line 6159 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6106,7 +6178,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6132,7 +6204,7 @@
 
 
 echo $ac_n "checking for fork""... $ac_c" 1>&6
-echo "configure:6136: checking for fork" >&5
+echo "configure:6208: checking for fork" >&5
 if eval "test \"`echo '$''{'cf_cv_func_fork'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6141,7 +6213,7 @@
   cf_cv_func_fork=unknown
 else
   cat > conftest.$ac_ext <<EOF
-#line 6145 "configure"
+#line 6217 "configure"
 #include "confdefs.h"
 
 int main()
@@ -6151,7 +6223,7 @@
 	exit(0);
 }
 EOF
-if { (eval echo configure:6155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   cf_cv_func_fork=yes
 else
@@ -6175,7 +6247,7 @@
 if test ".$ac_cv_func_memmove" != .yes ; then
 	if test ".$ac_cv_func_bcopy" = ".yes" ; then
 		echo $ac_n "checking if bcopy does overlapping moves""... $ac_c" 1>&6
-echo "configure:6179: checking if bcopy does overlapping moves" >&5
+echo "configure:6251: checking if bcopy does overlapping moves" >&5
 		if eval "test \"`echo '$''{'cf_cv_good_bcopy'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6184,7 +6256,7 @@
   cf_cv_good_bcopy=unknown
 else
   cat > conftest.$ac_ext <<EOF
-#line 6188 "configure"
+#line 6260 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -6197,7 +6269,7 @@
 }
 		
 EOF
-if { (eval echo configure:6201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   cf_cv_good_bcopy=yes
 else
@@ -6231,9 +6303,9 @@
 
 
 echo $ac_n "checking if select expects int * arguments""... $ac_c" 1>&6
-echo "configure:6235: checking if select expects int * arguments" >&5
+echo "configure:6307: checking if select expects int * arguments" >&5
 cat > conftest.$ac_ext <<EOF
-#line 6237 "configure"
+#line 6309 "configure"
 #include "confdefs.h"
 #include <time.h>
 EOF
@@ -6252,7 +6324,7 @@
 
 
 echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:6256: checking whether setpgrp takes no argument" >&5
+echo "configure:6328: checking whether setpgrp takes no argument" >&5
 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6260,7 +6332,7 @@
   { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 6264 "configure"
+#line 6336 "configure"
 #include "confdefs.h"
 
 /*
@@ -6276,7 +6348,7 @@
 }
 
 EOF
-if { (eval echo configure:6280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_setpgrp_void=no
 else
@@ -6310,12 +6382,12 @@
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6314: checking for $ac_func" >&5
+echo "configure:6386: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6319 "configure"
+#line 6391 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6338,7 +6410,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6365,9 +6437,9 @@
 
 if test $ac_cv_func_sigaction = yes; then
 echo $ac_n "checking whether sigaction needs _POSIX_SOURCE""... $ac_c" 1>&6
-echo "configure:6369: checking whether sigaction needs _POSIX_SOURCE" >&5
+echo "configure:6441: checking whether sigaction needs _POSIX_SOURCE" >&5
 cat > conftest.$ac_ext <<EOF
-#line 6371 "configure"
+#line 6443 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -6375,7 +6447,7 @@
 struct sigaction act;
 ; return 0; }
 EOF
-if { (eval echo configure:6379: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6451: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   sigact_bad=no
 else
@@ -6393,7 +6465,7 @@
 
 
 echo $ac_n "checking for setuid-like functions""... $ac_c" 1>&6
-echo "configure:6397: checking for setuid-like functions" >&5
+echo "configure:6469: checking for setuid-like functions" >&5
 if eval "test \"`echo '$''{'cf_cv_setuid_funcs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6414,13 +6486,13 @@
 
 
 echo $ac_n "checking for type sigaction_t""... $ac_c" 1>&6
-echo "configure:6418: checking for type sigaction_t" >&5
+echo "configure:6490: checking for type sigaction_t" >&5
 if eval "test \"`echo '$''{'cf_cv_type_sigaction'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 6424 "configure"
+#line 6496 "configure"
 #include "confdefs.h"
 
 #include <signal.h>
@@ -6428,7 +6500,7 @@
 sigaction_t x
 ; return 0; }
 EOF
-if { (eval echo configure:6432: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6504: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_type_sigaction=yes
 else
@@ -6448,13 +6520,13 @@
 
 
 echo $ac_n "checking for nonconflicting termios.h""... $ac_c" 1>&6
-echo "configure:6452: checking for nonconflicting termios.h" >&5
+echo "configure:6524: checking for nonconflicting termios.h" >&5
 if eval "test \"`echo '$''{'cf_cv_use_termios_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 6458 "configure"
+#line 6530 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_IOCTL_H
@@ -6476,7 +6548,7 @@
 	(void) tcgetattr (0, &save_tty)
 ; return 0; }
 EOF
-if { (eval echo configure:6480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_use_termios_h=yes
 else
@@ -6507,13 +6579,13 @@
 
 
 echo $ac_n "checking for tm.tm_gmtoff""... $ac_c" 1>&6
-echo "configure:6511: checking for tm.tm_gmtoff" >&5
+echo "configure:6583: checking for tm.tm_gmtoff" >&5
 if eval "test \"`echo '$''{'cf_cv_tm_gmtoff'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 6517 "configure"
+#line 6589 "configure"
 #include "confdefs.h"
 
 #ifdef TIME_WITH_SYS_TIME
@@ -6533,7 +6605,7 @@
 	long bar = foo.tm_gmtoff
 ; return 0; }
 EOF
-if { (eval echo configure:6537: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6609: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_tm_gmtoff=yes
 else
@@ -6553,7 +6625,7 @@
 
 
 echo $ac_n "checking for long file names""... $ac_c" 1>&6
-echo "configure:6557: checking for long file names" >&5
+echo "configure:6629: checking for long file names" >&5
 if eval "test \"`echo '$''{'ac_cv_sys_long_file_names'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6598,7 +6670,7 @@
 
 
 echo $ac_n "checking declaration of signal arguments""... $ac_c" 1>&6
-echo "configure:6602: checking declaration of signal arguments" >&5
+echo "configure:6674: checking declaration of signal arguments" >&5
 if eval "test \"`echo '$''{'cf_cv_sig_args'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6607,7 +6679,7 @@
 for cf_test in "int sig" "int sig, ..."
 do
 	cat > conftest.$ac_ext <<EOF
-#line 6611 "configure"
+#line 6683 "configure"
 #include "confdefs.h"
 
 #include <signal.h>
@@ -6615,7 +6687,7 @@
 extern RETSIGTYPE catch($cf_test); signal(SIGINT, catch)
 ; return 0; }
 EOF
-if { (eval echo configure:6619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6691: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_sig_args="$cf_test";break
 else
@@ -6638,17 +6710,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6642: checking for $ac_hdr" >&5
+echo "configure:6714: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6647 "configure"
+#line 6719 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6724: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6685,17 +6757,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6689: checking for $ac_hdr" >&5
+echo "configure:6761: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6694 "configure"
+#line 6766 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6699: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6771: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6725,17 +6797,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6729: checking for $ac_hdr" >&5
+echo "configure:6801: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6734 "configure"
+#line 6806 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6739: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6776,13 +6848,13 @@
 
 
 echo $ac_n "checking for union wait""... $ac_c" 1>&6
-echo "configure:6780: checking for union wait" >&5
+echo "configure:6852: checking for union wait" >&5
 if eval "test \"`echo '$''{'cf_cv_type_unionwait'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 6786 "configure"
+#line 6858 "configure"
 #include "confdefs.h"
 $cf_wait_headers
 int main() {
@@ -6793,7 +6865,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_type_unionwait=no
 	 echo compiles ok w/o union wait 1>&5
@@ -6804,7 +6876,7 @@
   rm -rf conftest*
   
 	cat > conftest.$ac_ext <<EOF
-#line 6808 "configure"
+#line 6880 "configure"
 #include "confdefs.h"
 $cf_wait_headers
 int main() {
@@ -6819,7 +6891,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_type_unionwait=yes
 	 echo compiles ok with union wait and possibly macros too 1>&5
@@ -6844,7 +6916,7 @@
 
 
 echo $ac_n "checking if the system function returns usable child-status""... $ac_c" 1>&6
-echo "configure:6848: checking if the system function returns usable child-status" >&5
+echo "configure:6920: checking if the system function returns usable child-status" >&5
 if eval "test \"`echo '$''{'cf_cv_system_status'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6853,7 +6925,7 @@
   cf_cv_system_status=unknown
 else
   cat > conftest.$ac_ext <<EOF
-#line 6857 "configure"
+#line 6929 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -6886,7 +6958,7 @@
 }
 
 EOF
-if { (eval echo configure:6890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   cf_cv_system_status=no
 else
@@ -6897,11 +6969,11 @@
   cf_cv_system_status=unknown
 else
   cat > conftest.$ac_ext <<EOF
-#line 6901 "configure"
+#line 6973 "configure"
 #include "confdefs.h"
 int main() { exit(system("exit 23") != (23 << 8)); }
 EOF
-if { (eval echo configure:6905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   cf_cv_system_status=yes
 else
@@ -6942,7 +7014,7 @@
   
 
 echo $ac_n "checking for redefinable signal constants""... $ac_c" 1>&6
-echo "configure:6946: checking for redefinable signal constants" >&5
+echo "configure:7018: checking for redefinable signal constants" >&5
 if eval "test \"`echo '$''{'cf_cv_sig_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6954,7 +7026,7 @@
   cf_cv_sig_const=unknown
 else
   cat > conftest.$ac_ext <<EOF
-#line 6958 "configure"
+#line 7030 "configure"
 #include "confdefs.h"
 
 #define NEW_DFL	((RETSIGTYPE (*)($cf_test))0)
@@ -6981,7 +7053,7 @@
 	exit(0);
 }
 EOF
-if { (eval echo configure:6985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   cf_cv_sig_const=yes
 else
@@ -7007,13 +7079,13 @@
 
 
 echo $ac_n "checking for ANSI qsort""... $ac_c" 1>&6
-echo "configure:7011: checking for ANSI qsort" >&5
+echo "configure:7083: checking for ANSI qsort" >&5
 if eval "test \"`echo '$''{'cf_cv_comptype'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 7017 "configure"
+#line 7089 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_STDLIB_H
@@ -7025,7 +7097,7 @@
 	 qsort(foo, sizeof(foo)/sizeof(*foo), sizeof(*foo), compare)
 ; return 0; }
 EOF
-if { (eval echo configure:7029: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7101: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_comptype=yes
 else
@@ -7053,7 +7125,7 @@
 
 
 echo $ac_n "checking if application can dump core""... $ac_c" 1>&6
-echo "configure:7057: checking if application can dump core" >&5
+echo "configure:7129: checking if application can dump core" >&5
 if eval "test \"`echo '$''{'cf_cv_corefile'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7062,7 +7134,7 @@
   cf_cv_corefile=unknown
 else
   cat > conftest.$ac_ext <<EOF
-#line 7066 "configure"
+#line 7138 "configure"
 #include "confdefs.h"
 
 #include <signal.h>
@@ -7103,7 +7175,7 @@
 #endif
 }
 EOF
-if { (eval echo configure:7107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   cf_cv_corefile=yes
 else
@@ -7148,18 +7220,18 @@
 
 
 echo $ac_n "checking for missing "${ac_func}" extern""... $ac_c" 1>&6
-echo "configure:7152: checking for missing "${ac_func}" extern" >&5
+echo "configure:7224: checking for missing "${ac_func}" extern" >&5
 if eval "test \"`echo '$''{'cf_cv_func_${ac_func}'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 
-echo "(line 7158) testing for missing "${ac_func}" external ..." 1>&5
+echo "(line 7230) testing for missing "${ac_func}" external ..." 1>&5
 
 cf_save_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS $CHECK_DECL_FLAG"
 cat > conftest.$ac_ext <<EOF
-#line 7163 "configure"
+#line 7235 "configure"
 #include "confdefs.h"
 
 $CHECK_DECL_HDRS
@@ -7173,7 +7245,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval 'cf_cv_func_'${ac_func}'=yes'
 else
@@ -7209,18 +7281,18 @@
 
 
 echo $ac_n "checking for missing "${ac_func}" extern""... $ac_c" 1>&6
-echo "configure:7213: checking for missing "${ac_func}" extern" >&5
+echo "configure:7285: checking for missing "${ac_func}" extern" >&5
 if eval "test \"`echo '$''{'cf_cv_func_${ac_func}'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 
-echo "(line 7219) testing for missing "${ac_func}" external ..." 1>&5
+echo "(line 7291) testing for missing "${ac_func}" external ..." 1>&5
 
 cf_save_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS $CHECK_DECL_FLAG"
 cat > conftest.$ac_ext <<EOF
-#line 7224 "configure"
+#line 7296 "configure"
 #include "confdefs.h"
 
 $CHECK_DECL_HDRS
@@ -7234,7 +7306,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7310: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval 'cf_cv_func_'${ac_func}'=yes'
 else
@@ -7270,18 +7342,18 @@
 
 
 echo $ac_n "checking for missing "${ac_func}" extern""... $ac_c" 1>&6
-echo "configure:7274: checking for missing "${ac_func}" extern" >&5
+echo "configure:7346: checking for missing "${ac_func}" extern" >&5
 if eval "test \"`echo '$''{'cf_cv_func_${ac_func}'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 
-echo "(line 7280) testing for missing "${ac_func}" external ..." 1>&5
+echo "(line 7352) testing for missing "${ac_func}" external ..." 1>&5
 
 cf_save_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS $CHECK_DECL_FLAG"
 cat > conftest.$ac_ext <<EOF
-#line 7285 "configure"
+#line 7357 "configure"
 #include "confdefs.h"
 
 $CHECK_DECL_HDRS
@@ -7295,7 +7367,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7299: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval 'cf_cv_func_'${ac_func}'=yes'
 else
@@ -7358,6 +7430,7 @@
 	rewind \
 	select \
 	setegid \
+	setenv \
 	seteuid \
 	setpgrp \
 	setregid \
@@ -7383,18 +7456,18 @@
 
 
 echo $ac_n "checking for missing "${ac_func}" extern""... $ac_c" 1>&6
-echo "configure:7387: checking for missing "${ac_func}" extern" >&5
+echo "configure:7460: checking for missing "${ac_func}" extern" >&5
 if eval "test \"`echo '$''{'cf_cv_func_${ac_func}'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 
-echo "(line 7393) testing for missing "${ac_func}" external ..." 1>&5
+echo "(line 7466) testing for missing "${ac_func}" external ..." 1>&5
 
 cf_save_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS $CHECK_DECL_FLAG"
 cat > conftest.$ac_ext <<EOF
-#line 7398 "configure"
+#line 7471 "configure"
 #include "confdefs.h"
 
 $CHECK_DECL_HDRS
@@ -7408,7 +7481,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7485: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval 'cf_cv_func_'${ac_func}'=yes'
 else
@@ -7446,18 +7519,18 @@
 
 
 echo $ac_n "checking for missing "${ac_func}" extern""... $ac_c" 1>&6
-echo "configure:7450: checking for missing "${ac_func}" extern" >&5
+echo "configure:7523: checking for missing "${ac_func}" extern" >&5
 if eval "test \"`echo '$''{'cf_cv_func_${ac_func}'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 
-echo "(line 7456) testing for missing "${ac_func}" external ..." 1>&5
+echo "(line 7529) testing for missing "${ac_func}" external ..." 1>&5
 
 cf_save_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS $CHECK_DECL_FLAG"
 cat > conftest.$ac_ext <<EOF
-#line 7461 "configure"
+#line 7534 "configure"
 #include "confdefs.h"
 
 $CHECK_DECL_HDRS
@@ -7471,7 +7544,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval 'cf_cv_func_'${ac_func}'=yes'
 else
@@ -7506,18 +7579,18 @@
 
 
 echo $ac_n "checking for missing "${ac_func}" extern""... $ac_c" 1>&6
-echo "configure:7510: checking for missing "${ac_func}" extern" >&5
+echo "configure:7583: checking for missing "${ac_func}" extern" >&5
 if eval "test \"`echo '$''{'cf_cv_func_${ac_func}'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 
-echo "(line 7516) testing for missing "${ac_func}" external ..." 1>&5
+echo "(line 7589) testing for missing "${ac_func}" external ..." 1>&5
 
 cf_save_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS $CHECK_DECL_FLAG"
 cat > conftest.$ac_ext <<EOF
-#line 7521 "configure"
+#line 7594 "configure"
 #include "confdefs.h"
 
 $CHECK_DECL_HDRS
@@ -7531,7 +7604,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval 'cf_cv_func_'${ac_func}'=yes'
 else
@@ -7558,7 +7631,7 @@
 
 
 echo $ac_n "checking for working TIOCGWINSZ""... $ac_c" 1>&6
-echo "configure:7562: checking for working TIOCGWINSZ" >&5
+echo "configure:7635: checking for working TIOCGWINSZ" >&5
 if eval "test \"`echo '$''{'cf_cv_use_tiocgwinsz'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7569,7 +7642,7 @@
   cf_cv_use_tiocgwinsz=unknown
 else
   cat > conftest.$ac_ext <<EOF
-#line 7573 "configure"
+#line 7646 "configure"
 #include "confdefs.h"
 
 $CHECK_DECL_HDRS
@@ -7594,7 +7667,7 @@
 	exit(0);	/* we cannot guarantee this is run interactively */
 }
 EOF
-if { (eval echo configure:7598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   cf_cv_use_tiocgwinsz=yes
 else
@@ -7806,6 +7879,7 @@
 s%@INEWSDIR@%$INEWSDIR%g
 s%@INN_NNTPLIB@%$INN_NNTPLIB%g
 s%@EXTRAOBJS@%$EXTRAOBJS%g
+s%@TIN_DEFAULTS_DIR@%$TIN_DEFAULTS_DIR%g
 s%@cf_cv_makeflags@%$cf_cv_makeflags%g
 s%@ALLOCA@%$ALLOCA%g
 s%@PCRE_DEFINES@%$PCRE_DEFINES%g
diff -Nur tin-980117/configure.in tin-980202/configure.in
--- tin-980117/configure.in	Fri Dec 26 03:40:56 1997
+++ tin-980202/configure.in	Sat Jan 31 06:25:05 1998
@@ -153,7 +153,7 @@
 	AC_MSG_CHECKING(for news spool-directory path)
 	CF_WITH_PATH(spooldir,
 		[  --with-spooldir=PATH    news spool-directory],
-		SPOOLDIR,/usr/spool/news)
+		SPOOLDIR,/var/spool/news)
 	AC_MSG_RESULT($SPOOLDIR)
 
 	AC_MSG_CHECKING(for news overview-directory path)
@@ -382,6 +382,15 @@
         [AC_DEFINE(APPEND_PID)])
 AC_MSG_RESULT($enableval)
 
+### checks for the location of the system-wide default setting file
+AC_MSG_CHECKING(for directory containing tin.defaults file)
+CF_WITH_PATH(defaults-dir,
+        [  --with-defaults-dir=PATH
+                          directory containing tin.defaults file],
+        TIN_DEFAULTS_DIR,/etc/tin)
+AC_MSG_RESULT($TIN_DEFAULTS_DIR)
+AC_DEFINE_UNQUOTED(TIN_DEFAULTS_DIR,"$TIN_DEFAULTS_DIR")
+
 ###	checks for operator characteristics (should be the last option)
 AC_MSG_CHECKING(whether to make a coffee while compiling)
 AC_ARG_WITH(coffee,
@@ -470,6 +479,7 @@
 
 ###	Checks for Datatypes.
 AC_TYPE_MODE_T
+AC_TYPE_OFF_T
 AC_TYPE_PID_T
 AC_TYPE_SIZE_T
 AC_TYPE_UID_T
@@ -702,6 +712,7 @@
 	rewind \
 	select \
 	setegid \
+	setenv \
 	seteuid \
 	setpgrp \
 	setregid \
diff -Nur tin-980117/doc/CHANGES tin-980202/doc/CHANGES
--- tin-980117/doc/CHANGES	Sat Jan 17 21:14:42 1998
+++ tin-980202/doc/CHANGES	Mon Feb  2 13:42:13 1998
@@ -1,3 +1,68 @@
+-- pre-1.4 release 980202 --
+
+553) Michael Stenns <stenns@hal.tci.uni-hannover.de>
+     ADD. VMS port
+     FIX. several supplied patches
+
+552) Ralf Doeblitz <doeblitz@gmx.de>
+     BUG. default_filter_kill_case and default_filter_select_case
+          ignored, interpreted wrong (ON must be false)
+     BUG. empty scope written to filter file
+     FIX. config.c, filter.c
+
+551) Borislav Deianov <borislav@CS.Cornell.EDU>
+     ADD. fixed display-gaps caused by missing articles in the
+          threading tree
+     FIX. thread.c
+
+550) Urs Janssen <urs@tin.org>
+     ADD. Support for configure --with-defaults-dir, used for
+          tin.defaults, new Makefile options to install this file
+     BUG. cleanup of init.c
+     FIX. Makefile, configure.in, Makefile.in, init.c
+
+549) Sven Paulus <sven@tin.org>
+     ADD. new system-wide defaults file "tin.defaults" (primarily
+          aimed for making binary distributions of TIN)
+     BUG. GetConfigValue() was more than useless if compiled without
+          INN library
+     FIX. Makefile, tin.defaults, autoconf.hin, extern.h, proto.h,
+          tin.h, makefile.in, art.c, header.c, inews.c, init.c,
+          nntplib.c, nntpw32.c
+
+548) Jungshik Shin <jshin@pantheon.yale.edu>
+     ADD. MIME related documentation updated
+     FIX. tin.1, lang.c, rfc1521.c, rfc1522.c
+
+547) Borislav Deianov <borislav@CS.Cornell.EDU>
+     ADD. rewrote active file reread-stuff
+     REM. file-pointer-fix from patch nr. 511
+     FIX. several supplied patches
+
+546) Urs Janssen <urs@tin.org>
+     ADD. minor code cleanup
+     FIX. several patches
+
+545) Branden Robinson <branden@purdue.edu>
+     ADD. iKeyPostponed2 ('O')
+     FIX. menukeys.h
+
+544) Thomas E. Dickey <dickey@clark.net>
+     BUG. some display-problems with --enable-curses and metamail
+     FIX. feed.c, page.c
+
+543) Roland Rosenfeld <roland@spinnaker.rhein.de>
+     ADD. metamutt - a shell script to call mutt as mimeparser
+     FIX. metamutt
+
+542) Ulli Horlacher <framstag@moep.bb.bawue.de>
+     ADD. $METAMAIL to set external mime-parser (i.e. metamutt vs. metamail)
+     FIX. page.c
+
+541) Sven Paulus <sven@tin.org>
+     BUG. deep threads could thrash display
+     FIX. thread.c
+
 -- pre-1.4 release 980117 --
 
 540) Jason Faultless <jason@radar.demon.co.uk>
diff -Nur tin-980117/doc/INSTALL tin-980202/doc/INSTALL
--- tin-980117/doc/INSTALL	Fri Jan 16 12:45:07 1998
+++ tin-980202/doc/INSTALL	Sun Feb  1 04:55:07 1998
@@ -17,7 +17,7 @@
   --enable-nntp		     --with-pgp
   --enable-nntp-only	     --with-spooldir		SMALL_MEMORY_MACHINE
   --with-domain-name	     DONT_HAVE_PIPING		USE_INVERSE_HACK
-  --with-inews-dir	     DONT_REREAD_ACTIVE_FILE
+  --with-inews-dir
 
 
 News machine names
@@ -49,7 +49,7 @@
 
 Tin can be compiled to read news in any of the following ways:
 
-  o  locally from your machines news spool dir (default /usr/spool/news).
+  o  locally from your machines news spool dir (default /var/spool/news).
 
   o  locally and remotely via NNTP (rtin or tin -r option) (--enable-nntp).
 
@@ -165,7 +165,7 @@
 (only needed if not running --enable-nntp-only)
 
 --with-spooldir=PATH
-Define if news articles are not in /usr/spool/news.
+Define if news articles are not in /var/spool/news.
 (only needed if not running --enable-nntp-only)
 
 --with-nov-dir=PATH
@@ -301,11 +301,6 @@
 DONT_HAVE_PIPING
 Define if your system does not support piping of articles to shell commands.
 
-DONT_REREAD_ACTIVE_FILE
-Define if you do not want the active file to be reread periodically.
-The reread period can be set in seconds by setting the tinrc variable
-'reread_active_file_secs='
-
 HAVE_FASCIST_NEWSADMIN
 Define if you want users articles to be posted to groups that your site
 receives.  This will change the warning that a group that the user is
@@ -341,7 +336,8 @@
 Compiled & installed on the following machines:
 -----------------------------------------------
 
-1)	i486 & Linux 1.2.13 with gcc 2.7.0
+1)	i486 & Linux 0.99.14w with gcc  2.5.7
+	i486 & Linux 1.2.13 with gcc 2.7.0
 	i486 & Linux 2.0.33 with gcc 2.7.2.2
 	i586 & Linux 2.0.27 with gcc 2.7.2.1
 	DEC Alpha AXP & Linux 2.0.0 with gcc 2.7.1
@@ -386,8 +382,9 @@
 	Sun 3/60 & NetBSD 1.2G with gcc 2.7.2.2
 
 10)	i386 & FreeBSD 2.1.0 with 2.7.2
+	i586 & FreeBSD 3.0-SNAP-971208 with 2.7.2.1
 
-11)	IBM PowerPC RS6000/40p & AIX 4.1.5.0 with gcc 2.7.2.2
+11)	IBM PowerPC RS6000/40p & AIX 4.1.5.0 with gcc 2.8.0
 	IBM 7012/320H & AIX 3.2 with gcc 2.3.3
 
 12)	i586 & SCO OpenServer Enterprise System (ver 5.0.0b)
@@ -404,3 +401,6 @@
 	with Motorola Configurable C Compilation System (CCCS) 1.0
 
 17)	Amiga 4000 & AmigaOS 3.0 with SAS/C 6.57
+
+18)	OpenVMS/Alpha 6.2, DEC C V5.0-003,                  SOCKETSHR_TCP
+	OpenVMS/Vax   5.3, GCC 2.7.2 (Pat Ranking edition), SOCKETSHR_TCP
diff -Nur tin-980117/doc/TODO tin-980202/doc/TODO
--- tin-980117/doc/TODO	Mon Jan 12 13:37:42 1998
+++ tin-980202/doc/TODO	Mon Feb  2 15:22:09 1998
@@ -66,6 +66,17 @@
    - in the article pager (page.c) it marks the whole current thread as read
      and jumps to the next unread article.
 
+o  'c' and 'C' are a bit inconsistent
+   - 'C' (captial c) catches up the current group and enters the next group
+      containing unread articles - this works at any level except the
+      thread display level where only the current thread is marked read;
+      no matter if using 'c' or 'C' - both do the same in the thread level.
+      'C' should enter the next thread containing unread articles or skip to
+      the next group, then we would need another key to catchup threads.
+    - 'c' (small c) catches up the current group and skips the pointer to
+      the next group - this works on any level except the pager where the
+      pointer stays at the current group.
+
 o  In cases where a tinrc variable is stored in group->attributes
    (ie on a per-group basis) then changes in the config menu won't always
    have an effect.  This is because the Option-Menu in {group,page}.c
@@ -147,6 +158,7 @@
 
 o  if using mailreader_i add In-Reply-To: header and rename Newsgroups:
    to X-Newsgroups (RFC 822 doesn't define a Newsgroups:-header)
+   [might be impossible]
 
 o  if using "-n" commandline switch you can't subscribe to newsgroups not
    present in your newsrc - a simple check against the server
@@ -210,6 +222,7 @@
 o  Additions to the thread menu :
 	'/','?' (search subject)
 	'B' (body search)
+        'D' (cancel article)
 	'M' (option menu)
 	'w' (post an article)
 	'r' (reply to) /* not 'R' cause it conflicts with mail_bugreport */
@@ -234,6 +247,7 @@
    store the differences from this.
    A key code to reset to the system defaults
    Maybe a file which could be used to force settings (eg inews & mailer)
+   (tin.defaults [--with-defaults-dir] is a start)
 
 o  if Newsgroups:-line has groups in it which are not present in the users
    active file ask the user if he wants to strip these groups from the
@@ -297,12 +311,12 @@
    to autoconf; determine which network libraries are needed; eradicate
    platform/compiler ifdefs
 
-o  move architecture dependent files to subdirectories, clean up architecture
-   independent files, rename several defines, remove useless doubled defines
+o  clean up architecture independent files, rename several defines,
+   remove useless doubled defines
 
 o  split tin.h/proto.h for better dependencies in make
 
-o  check where int/long/... should be replaced by size_t/uid_t/mode_t/...
+o  check where int/long/... should be replaced by size_t/uid_t/mode_t/off_t...
 
 o  join Makefile and makefile (not entirely possible)
 
@@ -317,19 +331,23 @@
 
 o  check where tin_done() should be called instead of using exit()
 
+o  check where STRCPY() should be used
+
 Docs/online help
 ----------------
 o  man page is still out dated and buggy
 
 o  error message when tin -uv and using xover is misleading
 
+o  tin.defaults is not mentioned in manpage/INSTALL
+
 Not yet classified
 ------------------
-o  tin in batchmode dumps core if getting a SIGINT, usefull?
+o  tin in batchmode dumps core if getting a SIGINT, useful?
 
 o  'u'nsubscribe/'s'ubscribe are inconsistent - bug or feature?
    's' subscribes you to the curent group and does _not_ skip to the next
-       group (annoying wehen subscribing to multiple groups, but usefull
+       group (annoying wehen subscribing to multiple groups, but useful
        when subsribing to a single group right before reading it)
    'u' unsubsribes you form the curent goup and skips to the next group.
 
@@ -390,7 +408,7 @@
 Filtering enhancements
 ----------------------
 o  add command: mark all articles older than <date> as read
-   (usefull when subscribing to a new group with high-traffic...)
+   (useful when subscribing to a new group with high-traffic...)
 
 o  fix kill/hot mechanism so that it is possible to match articles on
    arbitrary headers
diff -Nur tin-980117/doc/tin.1 tin-980202/doc/tin.1
--- tin-980117/doc/tin.1	Fri Jan 16 12:47:39 1998
+++ tin-980202/doc/tin.1	Sun Feb  1 05:10:08 1998
@@ -488,6 +488,9 @@
 User configurable options menu (for more information see section
 GLOBAL OPTIONS MENU AND TINRC CONFIGURABLE VARIABLES).
 .TP
+.B O
+Reload postponed article. See also ``\fB-o\fR'' command-line switch.
+.TP
 .B q
 Quit \fBtin\fR - ask the user to confirm if 'confirm_to_quit' is on.
 .TP
@@ -500,7 +503,7 @@
 the command line when \fBtin\fR was started.
 .TP
 .B R
-Mail a bug report or comment to $\fBBUG_ADDRESS\fR. This is the best way of
+Mail a bug report or comment to <tin-bugs@tin.org>. This is the best way of
 getting bugs fixed and features added/changed.
 .TP
 .B s
@@ -684,6 +687,9 @@
 Output current article / thread / auto selected (hot) articles /
 articles matching pattern / tagged articles to printer.
 .TP
+.B O
+Reload postponed article. See also ``fB-o\fR'' command-line switch.
+.TP
 .B p
 Go to previous group.
 .TP
@@ -847,6 +853,9 @@
 .B K
 Mark thread as read.
 .TP
+.B O
+Reload postponed article. See also ``fB-o\fR'' command-line switch.
+.TP
 .B q
 Return to previous level.
 .TP
@@ -857,8 +866,8 @@
 Toggle display to show all articles or only unread articles.
 .TP
 .B R
-Mail a bug report or comment to <tin-bugs@tin.org>. This is the best way of
-getting bugs fixed and features added/changed.
+Mail a bug report or comment to <tin-bugs@tin.org>. This is the best way
+of getting bugs fixed and features added/changed.
 .TP
 .B s
 Save article/thread/hot/pattern/tagged articles to file
@@ -920,6 +929,9 @@
 .in -.6i
 Read the section FILTERING ARTICLES for more information.
 .TP
+.B ^G
+Perform PGP operations on article.
+.TP
 .B ^H
 Toggle display of all the articles mail header.
 .TP
@@ -1042,6 +1054,9 @@
 Output current article / thread / auto selected (hot) articles /
 articles matching pattern / tagged articles to printer.
 .TP
+.B O
+Reload postponed article. See also ``\fB-o\fR'' command-line switch.
+.TP
 .B p
 Go to the previous article.
 .TP
@@ -1151,7 +1166,7 @@
 .\"
 .SH "GLOBAL OPTIONS MENU AND TINRC CONFIGURABLE VARIABLES"
 .\" FIXME - add missing descriptions
-.\" FIXME - bring into a usefull order
+.\" FIXME - bring into a useful order
 At startup, \fBtin\fR reads in the configuration file. This contains a list
 of variables that can be used to configure the way \fBtin\fR works. If it
 exists, the global configuration file, \fI/usr/lib/news/tinrc\fP is read.
@@ -1368,7 +1383,8 @@
 used for mailing articles to other people.
 Default is '%M "%T" < %F' (i.e., /bin/mail "iain" < .article). The flexible
 format allows other mailers with different command line parameters to be used
-such as 'elm -s "%S" "%T" < "%F"' (i.e., elm -s "subject" "iain" < .article).
+such as 'elm -s "%S" "%T" < "%F"' (i.e., elm -s "subject" "iain" < .article)
+or 'sendmail  -oem -t  < %F' (i.e. sendmail -oem -t < .article).
 .TP
 .B default_move_group
 .TP
@@ -1458,18 +1474,22 @@
 .TP
 .B Use 8bit characters in mail headers (mail_8bit_header)
 Allows 8bit characters unencoded in the header of mail message.
-Default is OFF. Turning it ON is effective only if 'mail_mime_encoding' is
-also set to 8bit. Leaving it OFF is safe for most users except for Korean
-users with localized \fBsendmail\fR(8).
+Default is OFF. Turning it ON is effective only if \fBmail_mime_encoding\fR is
+also set to 8bit. Leaving it OFF is safe for most users and compliant
+to Internet Mail Standard(STD 11/RFC 822 and RFC 2047).
 .TP
 .B Mail address (mail_address)
 User's mail address, if not username@host.
 .TP
 .B MIME encoding in mail messages (mail_mime_encoding)
 MIME encoding of the body in mail message, if necessary (8bit, base64, quoted-printable, 7bit)
-Default is 8bit. If set to 7bit, CJK text is encoded into ISO-2022-KR/JP/CN.
-Currently, only ISO-2022-KR is implemented. No encoding (or charset conversion)
-is done (i.e., local charset is used as it is) if set to 8bit.
+Default is 8bit and no encoding(or charset conversion) is performed
+(i.e., local charset is used as it is). 
+If set to 7bit, CJK text in 8bit encoding(EUC-CN,EUC-TW,
+EUC-JP,EUC-KR,Big5,Shift_JIS) is supposed to be converted into 
+ISO-2022-KR/JP/CN. Only EUC-KR to ISO-2022-KR conversion
+has been implemented, however.  Accordingly, setting it to 7bit has 
+no effect on MIME charsets/encodings other than EUC-KR(Korean).  
 .TP
 .B Quote line when mailing (mail_quote_format)
 Default is "In article %M you wrote:"
@@ -1480,11 +1500,11 @@
 .B MM_CHARSET (mm_charset)
 Charset supported locally, which is also used for MIME header (charset
 parameter and charset name in header encoding)
-in mail and news posting unless local charset needs to be encoded into
-other charset as in case of ISO-2022-KR encoding of EUC-KR in mail message.
+in mail and news posting unless local charset/encoding needs to be 
+converted into other charset/encoding as in case of EUC-KR which
+is converted to ISO-2022-KR if \fBmail_mime_encoding\fR is set to 7bit.
 Possible values include ISO-8859-X (where X is 1 to 10), EUC-JP, EUC-CN,
-EUC-KR, and perhaps names for various Chinese and Japanese charsets (GB, Big5,
-SJIS, Shift JIS, and so forth).
+EUC-KR, EUC-TW,Big5, Shift_JIS, and so forth.
 If \fBMIME_STRICT_CHARSET\fR is defined at the compile time, text in
 charset other than the value of this parameter is considered
 not displayable and represented as '?'. Otherwise, all character
@@ -1527,14 +1547,21 @@
 .TP
 .B Use 8bit characters in news headers (post_8bit_header)
 Allows 8bit characters unencoded in the header of news article.
-Default is OFF. Only enacted if 'post_mime_encoding' is also set to 8bit.
+Default is OFF. Only enacted if \fBpost_mime_encoding\fR is also set to 8bit.
+In a number of local hiearchies where 8bit characters are used,
+using unencoded(raw) 8bit characters in header is acceptable and sometimes
+even recommended so that you need to check the convention adopted in
+the local hierarchy of your interest to determine what to do with this and
+\fBpost_mime_encoding\fR.
 .TP
 .B MIME encoding in news messages (post_mime_encoding)
 MIME encoding of the body in news message, if necessary. (8bit, base64, quoted-printable, 7bit)
 Default is 8bit, which leads to no encoding (or charset conversion, i.e.,
 local charset is posted as it is). If set to 7bit, Chinese and Japanese
-text is encoded into ISO-2022-CN/JP (not yet implemented). 7bit is
-equivalent to 8bit for Korean news messages.
+text(in 8bit encodings such as EUC-CN,EUC-TW,EUC-JP,Shift_JIS,Big5) 
+is supposed to be  converted into ISO-2022-CN/JP, but it's NOT 
+yet implemented. Therefore,  currently  7bit has NO effect(i.e. equivalent to
+8bit) whatever MIME charset/encoding is chosen.
 .TP
 .B post_process_command
 Full pathname of a command to be run after successfully uudecoding an
@@ -2333,8 +2360,8 @@
 .B ORGANIZATION
 Set the article header field ``Organization:'' to the contents of the
 variable instead of the system default. If reading news on an Apollo
-DomainOS machine the environment variable $\fBNEWSORG\fR has to be used instead
-of $\fBORGANIZATION\fR.
+DomainOS machine the environment variable $\fBNEWSORG\fR has to be used
+instead of $\fBORGANIZATION\fR.
 .TP
 .B REPLYTO
 Set the article header field ``Reply-To:'' to the return address specified
@@ -2342,13 +2369,6 @@
 This is useful if the machine is not registered in the UUCP mail maps
 or if you wish to receive replies at a different machine.
 .TP
-.B BUG_ADDRESS
-If the `R' command bug report mail address is not correct this variable should
-be set to the correct mail address. This variable has precedence over the file
-\fI$HOME/.tin/bug_address\fP that may also contain a mail address. If
-$\fBBUG_ADDRESS\fR is unset and \fI$HOME/.tin/bug_address\fP is empty or
-does not exist it will default to <tin-bugs@tin.org>.
-.TP
 .B MAILER
 This variable has precedence over the default mailer that is used in all
 mailing operations within \fBtin\fR.
@@ -2394,6 +2414,10 @@
 these strings. The matching is case-insensitive. Example:
 .sp
 \fISPAMTRAP=spam,delete,remove\fP
+.TP
+.B METAMAIL
+Set this variable to point to \fBmetamail\fR(1) or a replacement
+(i.e. metamutt).
 .\"
 .\"
 .SH FILES
@@ -2426,9 +2450,6 @@
 \fI$HOME/.tin/active.save\fP
 active file of user's saved newsgroups.
 .TP
-\fI$HOME/.tin/bug_address\fP
-address to send bug reports to. See also $\fBBUG_ADDRESS\fR.
-.TP
 \fI$HOME/.tin/filter\fP
 filtering file for article killing and auto-selection.
 .TP
@@ -2607,11 +2628,11 @@
 Schwimmer, Bart Sears, Karl-Olav Serrander, Doug Sewell, Philip Shearer,
 Jungshik Shin, Sergey Shkonda, Andreas Siegert, Mark Smith, Steve Spearman,
 Cliff Stanford, Steve Starck, Jason Steiner, Ralf Stephan, Helmrich
-Streitmatter, Dieter Stueken, Ed Sznyter, Dean Takemori, Darrell Tangman,
-Derek Terveer, Carsten Theis, Julian Thompson, David Tiller, Andry Timonin,
-Mark Tomlin, Michael Traub, Adri Verhoef, Paul Vickers, Oliver B. Warzecha,
-Jason Wessel, Cary Whitney, Henrik Wist, Greg Woods, Lloyd Wright, Billy Y.,
-Nickolai Zeldovich
+Streitmatter, Michael Stenns, Dieter Stueken, Ed Sznyter, Dean Takemori,
+Darrell Tangman, Derek Terveer, Carsten Theis, Julian Thompson, David
+Tiller, Andry Timonin, Mark Tomlin, Michael Traub, Adri Verhoef, Paul
+Vickers, Oliver B. Warzecha, Jason Wessel, Cary Whitney, Henrik Wist, Greg
+Woods, Lloyd Wright, Billy Y., Nickolai Zeldovich
 .\"
 .\"
 .SH AUTHOR
diff -Nur tin-980117/doc/tin.defaults tin-980202/doc/tin.defaults
--- tin-980117/doc/tin.defaults	Thu Jan  1 01:00:00 1970
+++ tin-980202/doc/tin.defaults	Wed Jan 28 04:22:46 1998
@@ -0,0 +1,105 @@
+#
+# TIN 1.4 - a threaded newsreader
+#
+# tin.defaults - set some machine specified options
+#                and override compile time defaults
+#
+# Only do changes in this file, if your actual configurations
+# differs from the configuration compiled in. All values have
+# defaults at compile time, so usually editing this file is not
+# needed. An exception are distributed binaries which run on
+# different machines, here some configuration might be necessary.
+# 
+
+############# global options ####################################
+
+
+# domainname - this sets a global domain name used in From lines
+# 
+# set your full domain name without a trailing dot
+# 
+#domainname=domain.com
+
+# organization - defines the name of your organization
+#
+#organization=TIN unltd.
+
+# newslibdir - defines the default place for some configuration
+#              files
+# common values are /usr/lib/news, /var/lib/news, /usr/local/lib/news
+#
+#newslibdir=/usr/lib/news
+
+# bugaddress - defines the email address to which users can send
+#              bugreports using tin's builtin function
+#
+# The default points to a developers mailing list located at tin.org.
+# You might want to change this address to one of your local
+# administration if you want to deal with your lusers problems on
+# your own.
+#
+#bugaddress=tin-bugs@tin.org 
+
+# inewsdir - defines the directory containing of the inews executable
+#
+# Usually tin uses its own builtin inews routines. you might want
+# to use an external inews, so you can define the directoy where tin
+# expects the executable. The program's name is set to inews, don't
+# include it
+#
+#inewsdir=/usr/lib/news
+
+############# reading from a local spool #########################
+#
+# If you are using tin only via NNTP connections, this section
+# has no meaning for you.
+#
+
+# spooldir - the base of your newsspool (INN, Bnews, Cnews style)
+# common values are /var/spool/news, /usr/spool/news, /news/spool
+#
+#spooldir=/var/spool/news
+
+# overviewdir - the base of your NOV database
+#
+# the overview files are either included within your spooldir or
+# in a separate direcory tree
+# common values are /var/spool/overview, /usr/spool/overview, /news/overview
+#
+#overviewdir=/var/spool/overview
+
+# overviewfile - the name of a single overview file
+#
+# the name of a single file within the overview spool
+# common values are .overview, over.view
+#
+#overviewfile=.overview
+
+# activefile - the full pathname of your newssystem's active file
+#
+# usually the active file is newslibdir, so you only have
+# to change this setting if your configuration differs
+#
+#activefile=/usr/lib/news/active
+
+# activetimesfile - the full pathname of your newssystem's active.times file
+#
+# usually the active file is newslibdir, so you only have
+# to change this setting if your configuration differs
+#
+#activetimesfile=/usr/lib/news/active.times
+
+# newsgroupsfile - the full pathname of your newssystem's newsgroups file
+#
+# usually the newsgroups file is newslibdir, so you only have
+# to change this setting if your configuration differs
+#
+#newsgroupsfile=/usr/lib/news/newsgroups
+
+# subscriptionsfile - the full pathname of your newssystem's 
+#                     subscriptions file
+#
+# usually the newsgroups file is newslibdir, so you only have
+# to change this setting if your configuration differs
+#
+#subscriptionsfile=/usr/lib/news/subscriptions
diff -Nur tin-980117/include/autoconf.hin tin-980202/include/autoconf.hin
--- tin-980117/include/autoconf.hin	Wed Dec 31 04:17:11 1997
+++ tin-980202/include/autoconf.hin	Sun Feb  1 08:18:36 1998
@@ -5,7 +5,7 @@
  *  Created   : 24.08.1995
  *  Updated   : 04.12.1997
  *  Notes     : #include files, #defines & struct's
- *  Copyright : (c) Copyright 1996-98 by Thomas Dickey 
+ *  Copyright : (c) Copyright 1996-98 by Thomas Dickey
  *              You may  freely  copy or  redistribute  this software,
  *              so  long as there is no profit made from its use, sale
  *              trade or  reproduction.  You may not change this copy-
@@ -78,6 +78,7 @@
  * Data types
  */
 #undef	mode_t
+#undef	off_t
 #undef	pid_t
 #undef	size_t
 #undef	time_t
@@ -244,6 +245,7 @@
 #undef	DECL_REWIND
 #undef	DECL_SELECT
 #undef	DECL_SETEGID
+#undef	DECL_SETENV
 #undef	DECL_SETEUID
 #undef	DECL_SETPGRP
 #undef	DECL_SETREGID
@@ -411,5 +413,12 @@
  * Use this if you want pid attached to the end of .article filename
  */
 #undef APPEND_PID
+
+/*
+ * The directory, where tin looks first for its tin.defaults file
+ * can be left empty, tin searches for some standard places
+ * XXXXX please define surrounded with double quotes! XXXXX
+ */
+#undef TIN_DEFAULTS_PATH
 
 #undef HAVE_COFFEE
diff -Nur tin-980117/include/bugrep.h tin-980202/include/bugrep.h
--- tin-980117/include/bugrep.h	Fri Dec 26 03:41:03 1997
+++ tin-980202/include/bugrep.h	Sun Feb  1 05:58:39 1998
@@ -3,7 +3,7 @@
  *  Module    : bugrep.h
  *  Author    : Urs Janssen <urs@tin.org>
  *  Created   : 30.07.1997
- *  Updated   : 24.12.1997
+ *  Updated   : 01.02.1998
  *  Notes     :
  *  Copyright : (c) Copyright 1997-98 by Urs Janssen
  *              You may  freely  copy or  redistribute this  software,
@@ -15,28 +15,30 @@
 #ifndef BUGREP_H
 #	define BUGREP_H	1
 
-#	ifdef M_AMIGA
-#		define	BUG_REPORT_ADDRESS	"obw@amarok.ping.de"
-#	endif
-
 #	ifdef M_UNIX
 #		define	BUG_REPORT_ADDRESS	"tin-bugs@tin.org"
-#	endif
+#	endif /* M_UNIX */
 
-#	ifdef M_OS2
-#		define	BUG_REPORT_ADDRESS	"andreas@scilink.org"
-#	endif
+#	ifdef M_AMIGA
+#		define	BUG_REPORT_ADDRESS	"obw@amarok.ping.de"
+#	endif /* M_AMIGA */
 
 #	ifdef VMS
-#		define	BUG_REPORT_ADDRESS	"mcquill@next.duq.edu"
+#		define	BUG_REPORT_ADDRESS	"stenns@vw.tci.uni-hannover.de"
 #	endif /* VMS */
 
+/* OS2 and WIN32 are currently not supported */
+#	ifdef M_OS2
+#		define	BUG_REPORT_ADDRESS	"andreas@scilink.org"
+#	endif /* M_OS2 */
+
 #	ifdef WIN32
 #		define	BUG_REPORT_ADDRESS	"nigele@microsoft.com"
-#	endif
+#	endif /* WIN32 */
 
+/* fallback */
 #	ifndef BUG_REPORT_ADDRESS
 #		define	BUG_REPORT_ADDRESS	"tin-bugs@tin.org"
-#	endif
+#	endif /* BUG_REPORT_ADDRESS */
 
 #endif /* !BUGREP_H */
diff -Nur tin-980117/include/extern.h tin-980202/include/extern.h
--- tin-980117/include/extern.h	Fri Jan 16 12:45:07 1998
+++ tin-980202/include/extern.h	Sun Feb  1 10:04:12 1998
@@ -153,6 +153,9 @@
 #ifdef DECL_SETEGID
 extern int setegid (gid_t);
 #endif
+#ifdef DECL_SETENV
+extern int setenv (const char *, const char *, int);
+#endif
 #ifdef DECL_SETEUID
 extern int seteuid (uid_t);
 #endif
@@ -161,7 +164,7 @@
 extern pid_t setpgrp (void);
 #else
 extern int setpgrp (int, int);
-#endif
+#endif /* SETPGRP_VOID */
 #endif /* DECL_SETPGRP */
 #ifdef DECL_SETREGID
 extern int setregid (gid_t, gid_t);
@@ -306,6 +309,7 @@
 extern char index_maildir[PATH_LEN];
 extern char index_newsdir[PATH_LEN];
 extern char index_savedir[PATH_LEN];
+extern char inewsdir[PATH_LEN];
 extern char last_put[];
 extern char libdir[PATH_LEN];
 extern char local_attributes_file[PATH_LEN];
@@ -331,6 +335,7 @@
 extern char newsgroups_file[PATH_LEN];
 extern char newsrc[PATH_LEN];
 extern char novrootdir[PATH_LEN];
+extern char novfilename[PATH_LEN];
 extern char page_header[LEN];
 extern char post_proc_command[PATH_LEN];
 extern char posted_info_file[PATH_LEN];
@@ -464,6 +469,7 @@
 extern constext txt_error_no_read_permission[];
 extern constext txt_error_no_such_file[];
 extern constext txt_error_no_write_permission[];
+extern constext txt_error_metamail_failed[];
 extern constext txt_error_sender_in_header_not_allowed[];
 extern constext txt_external_mail_done[];
 extern constext txt_extracting_archive[];
@@ -1158,7 +1164,6 @@
 extern int real_gid;
 extern int real_uid;
 extern int real_umask;
-extern int reread_active_file;
 extern int reread_active_file_secs;
 extern int show_subject;
 extern int space_mode;
@@ -1224,6 +1229,7 @@
 extern t_bool display_mime_header_asis;
 extern t_bool display_mime_allheader_asis;
 extern t_bool draw_arrow_mark;
+extern t_bool force_reread_active_file;
 extern t_bool force_screen_redraw;
 extern t_bool full_page_scroll;
 extern t_bool got_sig_pipe;
@@ -1313,25 +1319,45 @@
 
 /* This fixes ambiguities on platforms that don't distinguish extern case */
 #ifdef CASE_PROBLEM
-#define txt_help_B	txt_help_BIGB
-#define txt_help_D	txt_help_BIGD
-#define txt_help_I	txt_help_BIGI
-#define txt_help_K	txt_help_BIGK
-#define txt_help_L	txt_help_BIGL
-#define txt_help_M	txt_help_BIGM
-#define txt_help_S	txt_help_BIGS
-#define txt_help_T	txt_help_BIGT
-#define txt_help_U	txt_help_BIGU
-#define txt_help_W	txt_help_BIGW
-#define txt_help_X	txt_help_BIGX
-#define txt_help_p_S	txt_help_p_BIGS
-#define txt_help_t_K	txt_help_t_BIGK
+#	define txt_help_B	txt_help_BIGB
+#	define txt_help_D	txt_help_BIGD
+#	define txt_help_I	txt_help_BIGI
+#	define txt_help_K	txt_help_BIGK
+#	define txt_help_L	txt_help_BIGL
+#	define txt_help_M	txt_help_BIGM
+#	define txt_help_S	txt_help_BIGS
+#	define txt_help_T	txt_help_BIGT
+#	define txt_help_U	txt_help_BIGU
+#	define txt_help_W	txt_help_BIGW
+#	define txt_help_X	txt_help_BIGX
+#	define txt_help_p_S	txt_help_p_BIGS
+#	define txt_help_t_K	txt_help_t_BIGK
+#endif
+
+#ifdef VMS /* M.St. 15.01.98 */
+	extern constext txt_help_BIGB[];
+	extern constext txt_help_BIGD[];
+	extern constext txt_help_BIGI[];
+	extern constext txt_help_BIGK[];
+	extern constext txt_help_BIGL[];
+	extern constext txt_help_BIGM[];
+	extern constext txt_help_BIGS[];
+	extern constext txt_help_BIGT[];
+	extern constext txt_help_BIGU[];
+	extern constext txt_help_BIGW[];
+	extern constext txt_help_BIGX[];
+	extern constext txt_help_p_BIGS[];
+	extern constext txt_help_t_BIGK[];
 #endif
 
 #ifndef DONT_HAVE_PIPING
 	extern constext txt_pipe_to_command[];
 	extern constext txt_piping[];
 #else
+#	ifdef VMS /* M.St. 15.01.98 */
+		extern constext txt_pipe_to_command[];
+		extern constext txt_piping[];
+#	endif
 	extern constext txt_piping_not_enabled[];
 #endif /* DONT_HAVE_PIPING */
 
diff -Nur tin-980117/include/menukeys.h tin-980202/include/menukeys.h
--- tin-980117/include/menukeys.h	Thu Jan  8 15:56:24 1998
+++ tin-980202/include/menukeys.h	Sun Feb  1 10:15:23 1998
@@ -13,7 +13,7 @@
  */
 
 #ifndef MENUKEYS_H
-#define MENUKEYS_H 1
+#	define MENUKEYS_H 1
 
 
 /* Revised 9 October 1996 by Branden Robinson in ASCII order
@@ -90,19 +90,19 @@
  * When adding key functionality, be aware of key functions in the "big five"
  * levels of tin operation: top (group selection), group, thread, article
  * (pager), and help.  If possible, when adding a key to any of these levels,
- * the others to make sure that the key doesn't do something non-analogous
- * elsewhere.  For instance, having "^R" map to "redraw screen" at article
- * level and "reset .newsrc" (a drastic and unreversible action) is a bad
- * idea.
+ * check the others to make sure that the key doesn't do something
+ * non-analogous elsewhere.  For instance, having "^R" map to "redraw screen"
+ * at article level and "reset .newsrc" (a drastic and unreversible action)
+ * at top level is a bad idea.
  *
  * [make emacs happy: "]
  */
 
 /* general keys
- * ESC,
- * ' ','!','$','/','?',
- * 'M',
- * '^',
+ * ESC
+ * ' ','!','$','/','?'
+ * 'L','M','O','Q'
+ * '^'
  * 'b','i','j','k','q','v'
  * ctrl('B'),ctrl('D'),ctrl('F'),ctrl('N'),ctrl('O'),ctrl('P'),ctrl('U')
  */
@@ -110,7 +110,7 @@
 #define iKeyAbort ESC
 #define iKeyPageDown3 ' '
 #ifndef NO_SHELL_ESCAPE
-#  define iKeyShellEscape '!'
+#	define iKeyShellEscape '!'
 #endif
 #define iKeySetRange '#'
 #define iKeyLastPage '$'
@@ -118,6 +118,7 @@
 #define iKeySearchSubjB '?'
 #define iKeyLookupMessage 'L'
 #define iKeyOptionMenu 'M'
+#define iKeyPostponed2 'O'
 #define iKeyQuitTin 'Q'
 #define iKeyFirstPage '^'
 #define iKeyPageUp3 'b'
@@ -243,8 +244,8 @@
 #define iKeyPageToggleTex2iso '\"'
 #define iKeyPageToggleRot '%'
 #ifdef HAVE_COLOR
-#  define iKeyPageToggleColor '&'
-#  define iKeyPageToggleHighlight '_'
+#	define iKeyPageToggleColor '&'
+#	define iKeyPageToggleHighlight '_'
 #endif
 #define iKeyPageLastViewed '-'
 /* digits 0-9 in use */
diff -Nur tin-980117/include/msmail.h tin-980202/include/msmail.h
--- tin-980117/include/msmail.h	Fri Dec 26 03:41:05 1997
+++ tin-980202/include/msmail.h	Thu Jan  1 01:00:00 1970
@@ -1,21 +0,0 @@
-/*
- *  Project   : tin - a Usenet reader
- *  Module    : msmail.h
- *  Author    : N.Ellis
- *  Created   : 01-10-94
- *  Updated   : 27-10-94
- *  Notes     : WinNT specific
- *  Copyright : (c) Copyright 1991-94 by Nigel Ellis & Iain Lea
- *              You may  freely  copy or  redistribute  this software,
- *              so  long as there is no profit made from its use, sale
- *              trade or  reproduction.  You may not change this copy-
- *              right notice, and it must be included in any copy made
- */
-
-#if defined(WIN32) && !defined(__MSMAIL_H__)
-#define __MSMAIL_H__
-
-int sendmail(LPSTR szFileName, LPSTR szTo, LPSTR szSubject, BOOL fEdit);
-void endmailsession(void);
-
-#endif /* __MSMAIL_H__ */
diff -Nur tin-980117/include/os_2.h tin-980202/include/os_2.h
--- tin-980117/include/os_2.h	Fri Dec 26 03:41:06 1997
+++ tin-980202/include/os_2.h	Thu Jan  1 01:00:00 1970
@@ -1,105 +0,0 @@
-/*
- *  Project   : tin - a Usenet reader
- *  Module    : os_2.h
- *  Author    : A.Wrede & I.Lea
- *  Created   : 05-07-92
- *  Updated   : 22-08-92
- *  Notes     : Directory support for OS/2
- *  Copyright : (c) Copyright 1991-94 by Andreas Wrede & Iain Lea
- *              You may  freely  copy or  redistribute  this software,
- *              so  long as there is no profit made from its use, sale
- *              trade or  reproduction.  You may not change this copy-
- *              right notice, and it must be included in any copy made
- */
-
-#if defined(M_OS2)
-
-#ifndef OS_2_H
-#define OS_2_H
-
-#include <io.h>
-#include <process.h>
-
-#define	INCL_KBD
-
-#ifdef __TURBOC__
-#define	INCL_NOPMAPI
-#define	INCL_DOSPROCESS
-
-APIRET APIENTRY DosSleep(ULONG msec);
-#endif
-
-#define popen _popen
-#define pclose _pclose
-
-#define	NOBSD
-#undef	BSD	/* stupid define in IBM libs ? */
-
-#define	u_char	unsigned char
-#define	u_short	unsigned short
-#define	u_long	unsigned long
-
-typedef int uid_t;
-typedef int gid_t;
-
-struct dirent
-{
-	char	d_name[256];
-};
-
-typedef struct
-{
-	unsigned long	_d_hdir;
-	char			*_d_dirname;
-	unsigned		_d_magic;
-	unsigned		_d_nfiles;
-	char			*_d_bufp;
-	char			_d_buf[512];
-} DIR;
-
-struct passwd
-{
-	char	*pw_name;
-	char	*pw_passwd;
-	uid_t	pw_uid;
-	gid_t	pw_gid;
-	char	*pw_age;
-	char	*pw_comment;
-	char	*pw_gecos;
-	char	*pw_dir;
-	char	*pw_shell;
-};
-
-#if !defined(_POSIX_SOURCE)
-
-struct comment
-{
-	char	*c_dept;
-	char	*c_name;
-	char	*c_acct;
-	char	*c_bin;
-};
-
-#endif	/* _POSIX_SOURCE */
-
-extern int closedir (DIR *__dir);
-extern char getopt (int argc,char *argv[],char *options);
-extern void endpwent (void);
-extern struct passwd *fgetpwent (FILE *);
-extern char *getlogin (void);
-extern struct passwd *getpwent (void);
-extern struct passwd *getpwuid (uid_t);
-extern struct passwd *getpwnam (const char *);
-extern int getuid (void);
-extern void backslash(char *ptr);
-extern int make_post_cmd (char *cmd,char *name);
-extern int make_post_process_cmd (char *cmd,char *dir,char *file);
-extern DIR *opendir (const char *__dirname);
-extern int putpwent (const struct passwd *, FILE *);
-extern struct dirent *readdir (DIR *__dir);
-extern void rewinddir (DIR *__dir);
-extern void setpwent (void);
-
-#endif	/* OS_2_H */
-
-#endif	/* M_OS2 */
diff -Nur tin-980117/include/proto.h tin-980202/include/proto.h
--- tin-980117/include/proto.h	Fri Jan 16 12:45:07 1998
+++ tin-980202/include/proto.h	Mon Feb  2 14:44:24 1998
@@ -4,10 +4,10 @@
 /* active.c */
 extern int get_active_num (void);
 extern int group_flag (int ch);
-extern int match_group_list (char *group, char *group_list);
 extern int parse_active_line (char *line, long *max, long *min, char *moderated);
 extern int process_bogus(char *name);
 extern int resync_active_file (void);
+extern t_bool match_group_list (char *group, char *group_list);
 extern void create_save_active_file (void);
 extern void load_newnews_info (char *info);
 extern void read_news_active_file (void);
@@ -37,7 +37,7 @@
 #endif /* !INDEX_DAEMON && NNTP_ABLE */
 
 /* charset.c */
-extern int iIsArtTexEncoded (long art, char *group_path);
+extern t_bool iIsArtTexEncoded (long art, char *group_path);
 extern void Convert2Printable (char* buf);
 extern void ConvertBody2Printable (char* buf);
 extern void ConvertIso2Asc (char *iso, char *asc, int t);
@@ -166,7 +166,9 @@
 extern void get_user_info (char *user_name, char *full_name);
 
 /* init.c */
+#ifdef USE_INN_NNTPLIB
 extern char *GetConfigValue (const char *name);
+#endif
 extern int create_mail_save_dirs (void);
 extern t_bool (*wildcard_func)(const char *str, char *patt, t_bool icase);		/* Wildcard matching function */
 extern void init_selfinfo (void);
@@ -238,7 +240,6 @@
 extern int iCopyFile (char *pcSrcFile, char *pcDstFile);
 extern int invoke_cmd (char *nam);
 extern int invoke_editor (char *filename, int lineno);
-extern int mail_check (void);
 extern int my_chdir (char *path);
 extern int my_isprint (int c);
 extern int my_mkdir (char *path, mode_t mode);
@@ -248,6 +249,7 @@
 extern int strfpath (char *format, char *str, size_t maxsize, char *the_homedir, char *maildir, char *savedir, char *group);
 extern int strfquote (char *group, int respnum, char *s, size_t maxsize, char *format);
 extern int untag_all_articles (void);
+extern t_bool mail_check (void);
 extern void asfail (const char *file, int line, const char *cond);
 extern void base_name (char *dirname, char *program);
 extern void cleanup_tmp_files (void);
@@ -301,7 +303,7 @@
 extern void grp_mark_read (struct t_group *group, struct t_article *psArt);
 extern void grp_mark_unread (struct t_group *group);
 extern void parse_unread_arts (struct t_group *group);
-extern void read_newsrc (char *newsrc_file, int allgroups);
+extern void read_newsrc (char *newsrc_file, t_bool allgroups);
 extern void reset_newsrc (void);
 extern void subscribe (struct t_group *group, int sub_state);
 extern void thd_mark_read (struct t_group *group, long thread);
@@ -320,9 +322,8 @@
 extern char *getserverbyfile (const char *file);
 extern char *get_server (char *string, int size);
 #ifdef DEBUG
-extern const char *nntp_respcode (int respcode);
-#endif
-extern int get_tcp_socket (char *machine, char *service, unsigned port);
+	extern const char *nntp_respcode (int respcode);
+#endif /* DEBUG */
 extern int server_init (char *machine, const char *service, int port, char *text);
 extern void close_server (void);
 extern void put_server (const char *string);
@@ -346,9 +347,9 @@
 extern int nntp_open (void);
 extern int setup_hard_base (struct t_group *group, char *group_path);
 extern int stat_article (long art, char *group_path);
-extern void vGet1GrpArtInfo(struct t_group *grp);
 extern int vGrpGetArtInfo (char *pcSpoolDir, char *pcGrpName, int iGrpType, long *plArtCount, long *plArtMax, long *plArtMin);
 extern void nntp_close (void);
+extern void vGet1GrpArtInfo(struct t_group *grp);
 extern void vGrpGetSubArtInfo (void);
 #ifdef HAVE_MH_MAIL_HANDLING
 	extern FILE *open_mail_active_fp (const char *mode);
@@ -385,6 +386,7 @@
 extern int post_article (char *group, int *posted_flag);
 extern int post_response (char *group, int respnum, int copy_text, int with_headers);
 extern int repost_article (char *group, struct t_article *art, int respnum, int supersede);
+extern int reread_active_file (void);
 extern int reread_active_after_posting (void);
 extern t_bool cancel_article (struct t_group *group, struct t_article *art, int respnum);
 extern t_bool pickup_postponed_articles (t_bool ask, t_bool all);
@@ -499,9 +501,6 @@
 extern int set_win_size (int *num_lines, int *num_cols);
 extern void _CDECL signal_handler (SIG_ARGS);
 extern void handle_resize (int repaint);
-extern void set_alarm_clock_off (void);
-extern void set_alarm_clock_on (void);
-extern void set_alarm_signal (void);
 extern void set_signal_catcher (int flag);
 extern void set_signal_handlers (void);
 extern void set_signals_art (void);
diff -Nur tin-980117/include/stpwatch.h tin-980202/include/stpwatch.h
--- tin-980117/include/stpwatch.h	Wed Dec 31 04:17:32 1997
+++ tin-980202/include/stpwatch.h	Sat Jan 24 02:17:52 1998
@@ -18,7 +18,7 @@
 
 #	ifdef PROFILE
 
-#		if HAVE_SYS_TIMEB_H && HAVE_FTIME
+#		if defined(HAVE_SYS_TIMEB_H) && defined(HAVE_FTIME)
 #			include <sys/timeb.h>
 
 char msg_tb[LEN];
diff -Nur tin-980117/include/tcurses.h tin-980202/include/tcurses.h
--- tin-980117/include/tcurses.h	Wed Dec 31 04:18:27 1997
+++ tin-980202/include/tcurses.h	Sat Jan 24 02:18:13 1998
@@ -32,13 +32,13 @@
 #	endif
 #endif
 
-#if USE_CURSES
+#ifdef USE_CURSES
 
-#if USE_TRACE
-#if HAVE_NOMACROS_H
-#include <nomacros.h>
-#endif
-#endif
+#ifdef USE_TRACE
+#	ifdef HAVE_NOMACROS_H
+#		include <nomacros.h>
+#	endif
+#endif /* USE_TRACE */
 
 #if 0	/* FIXME: this has prototypes, but opens up new problems! */
 #ifdef HAVE_TERM_H
diff -Nur tin-980117/include/tin.h tin-980202/include/tin.h
--- tin-980117/include/tin.h	Fri Jan 16 18:22:55 1998
+++ tin-980202/include/tin.h	Sun Feb  1 10:08:48 1998
@@ -44,8 +44,7 @@
  */
 #if defined(__amiga__) || defined(__amiga)
 #	define SMALL_MEMORY_MACHINE
-#	define DONT_REREAD_ACTIVE_FILE
-#	ifndef __GNUC__
+#	if !defined(__GNUC__)
 #		undef M_UNIX
 #		define M_AMIGA
 #		define SIG_ARGS /*nothing, since compiler doesn't handle it*/
@@ -57,21 +56,41 @@
 
 #ifdef VMS
 #	ifdef __DECC
-#		include	<unixio.h>
+#		include <unixio.h>
 #	else
-#		include	<stdio.h>
+#		ifndef __VMS_VER  /* assume old types.h */
+			typedef unsigned short mode_t;
+#			undef HAVE_STRFTIME
+#		endif
+#		include <stdio.h>
+#	endif
+#	ifdef SOCKETSHR_TCP
+#		include <socketshr.h>
+#		include <unistd.h>
+#		ifndef SOCKETSHR_HAVE_DUP
+#			define dup
+#		endif
+#		ifndef SOCKETSHR_HAVE_FERROR
+#			define ferror(a) (0)
+#		endif
 #	endif
+#	include <curses.h>
+#	include <stat.h>
+#	undef	HAVE_SELECT
+#	define CASE_PROBLEM
+#	define HAVE_ERRNO_H
 #	define NNTP_ONLY
 #	define NNTP_INEWS
 #	define DONT_HAVE_PIPING
 #	define NO_SHELL_ESCAPE
 #	define USE_CLEARSCREEN
+#	ifndef MM_CHARSET
+#		define MM_CHARSET "ISO-8859-1"
+#	endif
 	/* Apparently this means fileops=create if not already there - no idea
 	 * why this should be needed. Standard fopen() implies this in arg 2
 	 */
-#	define FOPEN_OPTS	, "fop=cif"
-extern char *get_uaf_fullname();
-
+	extern char *get_uaf_fullname();
 #	ifdef MULTINET
 #		include "MULTINET_ROOT:[MULTINET.INCLUDE.SYS]TYPES.H"
 #		include "MULTINET_ROOT:[MULTINET.INCLUDE.SYS]TIME.H"
@@ -82,22 +101,21 @@
 #		endif /* VAXC */
 #		include <types.h>
 #	endif /* !MULTINET */
-#	include <stat.h>
+#	define FOPEN_OPTS       , "fop=cif"
+#else
+#	define FOPEN_OPTS
 #endif /* VMS */
 
-#ifndef VMS
-#	include	<stdio.h>
-#	ifdef HAVE_ERRNO_H
-#		include	<errno.h>
-#	else
-#		include	<sys/errno.h>
-#	endif
-#	if !defined(errno)
-#		ifdef DECL_ERRNO
-			extern int errno;
-#		endif
+#include <stdio.h>
+#ifdef HAVE_ERRNO_H
+#	include	<errno.h>
+#else
+#	include	<sys/errno.h>
+#endif
+#if !defined(errno)
+#	ifdef DECL_ERRNO
+		extern int errno;
 #	endif
-#	define FOPEN_OPTS
 #endif
 
 #ifdef HAVE_STDDEF_H
@@ -194,7 +212,7 @@
  */
 
 #ifdef HAVE_SYS_SELECT_H
-#	if NEED_TIMEVAL_FIX
+#	ifdef NEED_TIMEVAL_FIX
 #		define timeval fake_timeval
 #		include <sys/select.h>
 #		undef timeval
@@ -216,15 +234,15 @@
  */
 
 #ifdef HAVE_CONFIG_H
-#	if HAVE_DIRENT_H
+#	ifdef HAVE_DIRENT_H
 #		include <dirent.h>
 #		define	DIR_BUF struct dirent
 #		define	D_NAMLEN(p)	(p)->d_reclen
 #	else
-#		if HAVE_SYS_DIR_H
+#		ifdef HAVE_SYS_DIR_H
 #			include <sys/dir.h>
 #		endif
-#		if HAVE_SYS_NDIR_H
+#		ifdef HAVE_SYS_NDIR_H
 #			include <sys/ndir.h>
 #		endif
 #		define	DIR_BUF struct direct
@@ -334,7 +352,7 @@
 #			ifdef VMS
 #				define	SPOOLDIR	"NEWSSPOOL:[000000]"
 #			else
-#				define	SPOOLDIR	"/usr/spool/news"
+#				define	SPOOLDIR	"/var/spool/news"
 #			endif /* VMS */
 #		endif /* !SPOOLDIR */
 #		ifndef NEWSLIBDIR
@@ -437,11 +455,11 @@
 #		define	DEFAULT_EDITOR	"EDIT/TPU"
 #		define	DEFAULT_MAILBOX	"SYS$LOGIN:"
 #		define	DEFAULT_MAILER	"MAIL"
-#		define	MAILER_FORMAT	"MAIL /SUBJECT=\"%S\" %F \"IN%%\"\"%T\"\""
-#		define	DEFAULT_POSTER	"inews %s"
+#		define	MAILER_FORMAT	"MAIL /SUBJECT=\"%S\" %F MX%%\"%T\""
+#		define	DEFAULT_POSTER	"inews %s."
 #		define	DEFAULT_PRINTER	"PRINT/DELETE"
-#		define	DEFAULT_UUDECODE	"uudecode %s"
-#		define	DEFAULT_UNSHAR	"unshar %s"
+#		define	DEFAULT_UUDECODE	"uudecode %s."
+#		define	DEFAULT_UNSHAR	"unshar %s."
 #	endif
 #	ifdef M_OS2
 #		ifndef DEFAULT_EDITOR
@@ -566,15 +584,11 @@
 #endif
 
 /*
- * Should active file be reread for new news & if so how often
+ * How often should the active file be reread for new news
  */
 
-#ifdef DONT_REREAD_ACTIVE_FILE
-#	define	REREAD_ACTIVE_FILE_SECS 0
-#else
-#	ifndef REREAD_ACTIVE_FILE_SECS
-#		define	REREAD_ACTIVE_FILE_SECS 1200	/* seconds (20 mins) */
-#	endif
+#ifndef REREAD_ACTIVE_FILE_SECS
+#	define	REREAD_ACTIVE_FILE_SECS 1200	/* seconds (20 mins) */
 #endif
 
 /*
@@ -1605,8 +1619,8 @@
 #	ifdef	HAVE_KEY_PREFIX
 #		define	KEY_PREFIX	0x9b
 #	endif
-extern void joinpath (char *result, char *dir, char *file);
-extern void joindir (char *result, char *dir, char *file);
+extern void joinpath (char *result, const char *dir, const char *file);
+extern void joindir (char *result, const char *dir, const char *file);
 #endif /* VMS */
 
 #ifdef M_OS2
@@ -1899,7 +1913,15 @@
 #else
 #	ifdef HAVE_TMPNAM
 #		define	my_tempnam(a,b)	tmpnam((char *)0)
-#  endif
+#	endif
+#endif
+
+/* define some standard places to look for a tin.defaults file */
+#define TIN_DEFAULTS_BUILTIN "/etc/opt/tin","/etc/tin","/etc","/usr/local/lib/tin","/usr/local/lib","/usr/local/etc/tin","/usr/local/etc","/usr/lib/tin","/usr/lib",NULL
+#ifdef	TIN_DEFAULTS_PATH
+#	define TIN_DEFAULTS TIN_DEFAULTS_PATH,TIN_DEFAULTS_BUILTIN
+#else
+#	define TIN_DEFAULTS TIN_DEFAULTS_BUILTIN
 #endif
 
 #endif /* !TIN_H */
diff -Nur tin-980117/include/tnntp.h tin-980202/include/tnntp.h
--- tin-980117/include/tnntp.h	Wed Dec 31 04:19:21 1997
+++ tin-980202/include/tnntp.h	Sun Feb  1 10:14:22 1998
@@ -15,24 +15,40 @@
 #ifndef TNNTP_H
 #define TNNTP_H 1
 
-#ifdef VMS
-#	include "sio.h"
-#endif
-
-#ifdef M_AMIGA
-#	include "amigatcp.h"
-#else
-#	define	s_printf	fprintf
-#	define	s_fdopen	fdopen
-#	define	s_flush	fflush
-#	define	s_fclose	fclose
-#	define	s_gets	fgets
-#	define	s_close	close
-#	define	s_puts	fputs
-#	define	s_dup		dup
+#if defined (VMS) && defined (SOCKETSHR_TCP)
+#	ifdef __GNUC__
+#		define __SOCKET_TYPEDEFS
+#	endif
+#	include <netdb.h>
+#	include <in.h>
+#	include <inet.h>
+#	include <socket.h>
+#	define	s_printf	si_fprintf
+#	define	s_fdopen	si_fdopen
+#	define	s_flush	si_fflush
+#	define	s_fclose	si_fclose
+#	define	s_gets	si_fgets
+#	define	s_close	si_close
+#	define	s_puts	si_fputs
+#	define	s_dup
 #	define	s_init()	(1)
 #	define	s_end()
-#endif
+#else
+#	ifdef M_AMIGA
+#		include "amigatcp.h"
+#	else
+#		define	s_printf	fprintf
+#		define	s_fdopen	fdopen
+#		define	s_flush	fflush
+#		define	s_fclose	fclose
+#		define	s_gets	fgets
+#		define	s_close	close
+#		define	s_puts	fputs
+#		define	s_dup		dup
+#		define	s_init()	(1)
+#		define	s_end()
+#		endif /* M_AMIGA */
+#endif /* VMS && SOCKETSHR_TCP */
 
 #if defined(NNTP_ABLE) || defined(HAVE_GETHOSTBYNAME)
 #	ifdef HAVE_NETDB_H
@@ -108,10 +124,10 @@
 #endif
 
 #ifdef DECL_CONNECT
-extern int  connect(int  sockfd, struct sockaddr *serv_addr, int addrlen);
+	extern int  connect(int  sockfd, struct sockaddr *serv_addr, int addrlen);
 #endif
 #ifdef DECL_INET_NTOA
-extern char *inet_ntoa (struct in_addr);
+	extern char *inet_ntoa (struct in_addr);
 #endif
 
 #endif /* TNNTP_H */
diff -Nur tin-980117/include/trace.h tin-980202/include/trace.h
--- tin-980117/include/trace.h	Wed Dec 31 04:21:00 1997
+++ tin-980202/include/trace.h	Sat Jan 24 02:19:06 1998
@@ -26,7 +26,7 @@
 extern	char *_tracechar(int c);
 
 extern	void	_tracef ( const char *, ... )
-#if __GNUC__
+#if defined(__GNUC__)
 	__attribute__ ((format(printf,1,2)))
 #endif
 	;
diff -Nur tin-980117/include/version.h tin-980202/include/version.h
--- tin-980117/include/version.h	Sat Jan 17 04:03:38 1998
+++ tin-980202/include/version.h	Mon Feb  2 13:41:35 1998
@@ -17,7 +17,7 @@
 
 #	define PRODUCT		"tin"
 #	define VERSION		"pre-1.4"
-#	define RELEASEDATE	"980117"
+#	define RELEASEDATE	"980202"
 #	define TINRC_VERSION	"1.1"
 
 #	ifdef M_AMIGA
@@ -31,9 +31,9 @@
 
 #	ifdef M_UNIX
 #		if !defined( __amiga )
-#			define  OS	"UNIX"
+#			define	OS	"UNIX"
 #		else
-#			define  OS	"AMIGA"
+#			define	OS	"AMIGA"
 #		endif
 #	endif
 
diff -Nur tin-980117/include/win32.h tin-980202/include/win32.h
--- tin-980117/include/win32.h	Fri Dec 26 03:41:08 1997
+++ tin-980202/include/win32.h	Thu Jan  1 01:00:00 1970
@@ -1,160 +0,0 @@
-/*
- *  Project   : tin - a Usenet reader
- *  Module    : win32.h
- *  Author    : S.Lam, N.Ellis & P.Haken
- *  Created   : 01-06-87
- *  Updated   : 02-24-95
- *  Notes     : ndir.h for MS-DOS by Samuel Lam <skl@van-bc.UUCP>, June/87
- *              additional WIN32 support by N.Ellis and P.Haken.
- *
- *  Copyright : (c) Copyright 1987-93 by Samuel Lam
- *				(c) Copyright 1994-95 by N.Ellis & P.Haken
- *              You may  freely  copy or  redistribute  this software,
- *              so  long as there is no profit made from its use, sale
- *              trade or  reproduction.  You may not change this copy-
- *              right notice, and it must be included in any copy made
- */
-
-#if defined(WIN32)
-
-#ifndef WIN32_H
-#define WIN32_H
-
-#include <windows.h>
-#include <direct.h>
-#include <io.h>
-#include <assert.h>
-#include <malloc.h>
-
-#define MSDOS_MAXNAMLEN	12
-#define MAXNAMLEN		MSDOS_MAXNAMLEN
-
-extern char TMPDIR[MAX_PATH];
-
-#define popen _popen
-#define pclose _pclose
-#define sleep(s) Sleep(s*1000)		// WIN32 sleep is in Millseconds.
-#define pipe(a) _pipe(a,1024,0)
-#define rename(s,d) win32rename(s,d)
-
-typedef int     uid_t;
-typedef int     gid_t;
-
-struct direct {
-    long            d_ino;
-    short           d_reclen;
-    short           d_namlen;
-    char            d_name[MAXNAMLEN + 1];
-};
-
-typedef struct {
-    char            filereserved[21];
-    char            fileattr;
-    int             filetime,
-                    filedate;
-    long            filesize;
-    char            filename[MSDOS_MAXNAMLEN + 1];
-} DTA;
-
-typedef struct {
-    char            dirid[4];
-    struct direct   dirent;
-    DTA             dirdta;
-    int             dirfirst;
-} DIR;
-
-
-struct passwd {
-    char           *pw_name;
-    char           *pw_passwd;
-    uid_t           pw_uid;
-    gid_t           pw_gid;
-    char           *pw_age;
-    char           *pw_comment;
-    char           *pw_gecos;
-    char           *pw_dir;
-    char           *pw_shell;
-};
-
-
-extern char		*getlogin(void);
-extern char		getopt(int argc, char *argv[], char *options);
-
-extern DIR		*opendirx(const char *dirname, char *pattern);
-
-// extern DIR *opendir (const char *__dirname);
-#define opendir(x) opendirx(x, "*.*")
-extern void		closedir(DIR * __dir);
-extern struct	direct *readdir(DIR * __dir);
-extern void		rewinddir(DIR * __dir);
-
-extern int		getuid(void);
-extern int		geteuid(void);
-extern int		getegid(void);
-extern int		getgid(void);
-extern long		getpid(void);
-extern int		putpwent(const struct passwd *, FILE *);
-extern void		endpwent(void);
-extern void		setpwent(void);
-extern struct	passwd *fgetpwent(FILE *);
-extern struct	passwd *getpwent(void);
-extern struct	passwd *getpwnam(const char *);
-extern struct	passwd *getpwuid(uid_t);
-
-extern void     backslash(char *ptr);
-extern int      make_post_cmd(char *cmd, char *name);
-
-#define alarm(x) (1)
-
-extern void setup_screen(void);
-
-extern void set_xclick_on(void);
-extern void set_xclick_off(void);
-extern int win32rename(char *, char *);
-
-/*
- * tmp_close will delete a file on closure if it had been opened
- * with nntp_to_fp(). Otherwise it behaves just like fclose().
- */
-
-extern void log_unlink(FILE *fp, char *fname);
-extern int tmp_close(FILE *fp);
-#define fclose(fp) tmp_close(fp)
-
-#if defined(DEBUG) && defined(CHECKHEAP)
-void DebugAssertDialog(LPSTR szMessage, DWORD dwLine, LPSTR szFile);
-_inline void CheckHeap(DWORD dwLine, LPSTR szFile)
-	{
-	if (_heapchk()!=_HEAPOK)
-		DebugAssertDialog("Invalid Heap", dwLine, szFile);
-	};
-
-_inline void * __cdecl mymalloc(size_t cb, DWORD dwLine, LPSTR szFile)
-	{
-	CheckHeap(dwLine, szFile);
-	return malloc(cb);
-	};
-
-_inline void * __cdecl myrealloc(void *pv, size_t cb, DWORD dwLine, LPSTR szFile)
-	{
-	CheckHeap(dwLine, szFile);
-	return realloc(pv, cb);
-	};
-
-_inline void * __cdecl mycalloc(size_t cbnum, size_t cbsize, DWORD dwLine, LPSTR szFile)
-	{
-	CheckHeap(dwLine, szFile);
-	return calloc(cbnum, cbsize);
-	};
-
-_inline void   __cdecl myfree(void *pv, DWORD dwLine, LPSTR szFile)
-	{
-	CheckHeap(dwLine, szFile);
-	free(pv);
-	CheckHeap(dwLine, szFile);
-	};
-
-#endif
-
-#endif	// WIN32_H
-#endif	// WIN32
diff -Nur tin-980117/include/win32tcp.h tin-980202/include/win32tcp.h
--- tin-980117/include/win32tcp.h	Fri Dec 26 03:41:08 1997
+++ tin-980202/include/win32tcp.h	Thu Jan  1 01:00:00 1970
@@ -1,32 +0,0 @@
-/*
- *  Project   : tin - a Usenet reader
- *  Module    : win32tcp.c
- *  Author    : N.Ellis
- *  Created   : 01-10-94
- *  Updated   : 04-11-94
- *  Notes     :
- *  Copyright : (c) Copyright 1991-94 by Nigel Ellis
- *              You may  freely  copy or  redistribute  this software,
- *              so  long as there is no profit made from its use, sale
- *              trade or  reproduction.  You may not change this copy-
- *              right notice, and it must be included in any copy made
- */
-
-#ifdef WIN32
-
-#	define	s_printf
-#	define	s_flush
-#	define	s_puts
-#	define	s_end()
-
-typedef struct {
-	int fd;
-} TCP;
-
-int s_init(void);
-TCP *s_fdopen(int s, const char *mode);
-void s_close(int s);
-int s_dup(int fd);
-char *s_gets(LPSTR nntp_line, DWORD length, TCP *tp);
-
-#endif /* WIN32 */
diff -Nur tin-980117/makefile.in tin-980202/makefile.in
--- tin-980117/makefile.in	Sat Jan 17 04:03:39 1998
+++ tin-980202/makefile.in	Mon Feb  2 13:41:36 1998
@@ -7,7 +7,7 @@
 EXE		= tin
 MANEXT		= 1
 LVER		= 1.4
-PVER		= 980117
+PVER		= 980202
 VER		= pre-$(LVER)-$(PVER)
 MAIL_ADDR 	= "urs@tin.org"
 
@@ -20,6 +20,7 @@
 INCDIR = ./include
 OBJDIR = ./src
 SRCDIR = ./src
+OLDDIR = ./old
 
 # OS2DIR    = ./os2
 # MISCDIR   = ./misc
@@ -30,28 +31,23 @@
 # WIN32DIR  = ./win32
 
 HFILES	= \
-	$(INCDIR)/amiga.h \
-	$(INCDIR)/amigatcp.h \
-	$(INCDIR)/conf.h \
 	$(INCDIR)/bugrep.h \
 	$(INCDIR)/config.h \
 	$(INCDIR)/extern.h \
 	$(INCDIR)/menukeys.h \
-	$(INCDIR)/msmail.h \
 	$(INCDIR)/nntplib.h \
-	$(INCDIR)/os_2.h \
 	$(INCDIR)/proto.h \
 	$(INCDIR)/stpwatch.h \
 	$(INCDIR)/tin.h \
-	$(INCDIR)/version.h \
-	$(INCDIR)/win32.h \
-	$(INCDIR)/win32tcp.h
+	$(INCDIR)/version.h
+#	$(OLDDIR)/msmail.h
+#	$(OLDDIR)/os_2.h
+#	$(OLDDIR)/win32.h
+#	$(OLDDIR)/win32tcp.h
+#	$(INCDIR)/conf.h
 
 CFILES	= \
 	$(SRCDIR)/active.c \
-	$(SRCDIR)/actived.c \
-	$(SRCDIR)/amiga.c \
-	$(SRCDIR)/amigatcp.c \
 	$(SRCDIR)/art.c \
 	$(SRCDIR)/attrib.c \
 	$(SRCDIR)/auth.c \
@@ -75,13 +71,9 @@
 	$(SRCDIR)/main.c \
 	$(SRCDIR)/memory.c \
 	$(SRCDIR)/misc.c \
-	$(SRCDIR)/msmail.c \
 	$(SRCDIR)/newsrc.c\
 	$(SRCDIR)/nntplib.c \
-	$(SRCDIR)/nntpw32.c \
-	$(SRCDIR)/nntpvms.c \
 	$(SRCDIR)/open.c \
-	$(SRCDIR)/os_2.c \
 	$(SRCDIR)/page.c \
 	$(SRCDIR)/parsdate.y \
 	$(SRCDIR)/pgp.c \
@@ -100,10 +92,14 @@
 	$(SRCDIR)/string.c \
 	$(SRCDIR)/thread.c \
 	$(SRCDIR)/wildmat.c \
-	$(SRCDIR)/win32.c \
-	$(SRCDIR)/win32tcp.c \
 	$(SRCDIR)/xref.c \
 	$(SRCDIR)/vms.c
+#	$(OLDDIR)/msmail.c
+#	$(OLDDIR)/nntpw32.c
+#	$(OLDDIR)/nntpvms.c
+#	$(OLDDIR)/os_2.c
+#	$(OLDDIR)/win32.c
+#	$(OLDDIR)/win32tcp.c
 
 DOC	= \
 	$(DOCDIR)/HACKERS \
@@ -150,7 +146,11 @@
 AMIGA	= \
 	$(AMGDIR)/README \
 	$(AMGDIR)/smakefile \
+	$(AMGDIR)/amiga.h \
+	$(AMGDIR)/amigatcp.h \
 	$(AMGDIR)/actived.c \
+	$(AMGDIR)/amiga.c \
+	$(AMGDIR)/amigatcp.c \
 	$(AMGDIR)/parsdate.c
 
 NNTP	= \
@@ -442,7 +442,7 @@
 distclean:
 	$(CD) pcre && $(MAKE) @cf_cv_makeflags@ $@
 	$(CD) src && $(MAKE) @cf_cv_makeflags@ $@
-	$(RM) -f config.cache config.log config.status makefile */Makefile include/autoconf.h
+	$(RM) -f config.cache config.log config.status makefile */Makefile include/autoconf.h td-conf.out
 
 configure: configure.in aclocal.m4
 	autoconf
diff -Nur tin-980117/mkdirs.sh tin-980202/mkdirs.sh
--- tin-980117/mkdirs.sh	Fri Dec 26 03:41:09 1997
+++ tin-980202/mkdirs.sh	Wed Jan 28 06:08:20 1998
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/sh
 # mkinstalldirs --- make directory hierarchy
 # Author: Noah Friedman <friedman@prep.ai.mit.edu>
 # Created: 1993-05-16
diff -Nur tin-980117/old/msmail.c tin-980202/old/msmail.c
--- tin-980117/old/msmail.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/old/msmail.c	Sat Jan 31 11:18:33 1998
@@ -0,0 +1,263 @@
+/*
+ *  Project   : tin - a Usenet reader
+ *  Module    : msmail.c
+ *  Author    : N.Ellis
+ *  Created   : 01-10-94
+ *  Updated   : 17-10-94
+ *  Notes     : WinNT specific
+ *  Copyright : (c) Copyright 1991-94 by Nigel Ellis & Iain Lea
+ *              You may  freely  copy or  redistribute  this software,
+ *              so  long as there is no profit made from its use, sale
+ *              trade or  reproduction.  You may not change this copy-
+ *              right notice, and it must be included in any copy made
+ */
+
+#include "tin.h"
+
+#if defined(WIN32)
+
+#include <windows.h>
+#include <stdio.h>
+#include "mapi.h"
+#include "msmail.h"
+
+static HINSTANCE hLibrary = NULL;	/* handle for MAPI library. */
+static HINSTANCE hMAPISession = NULL;
+
+static MapiMessage mmMapiMessage;
+
+static ULONG nMessageSize = 0x000004000;
+static lpMapiMessage FAR *lppMessage;
+static lpMapiMessage lpMessage;
+static char szSeedMessageID[512];
+static char szMessageID[512];
+static char szSubject[512];
+static char szNoteText[4096];
+
+static LPSTR lpszSeedMessageID = &szSeedMessageID[0];
+static LPSTR lpszMessageID = &szMessageID[0];
+
+static LPSTR pszSubject = &szSubject[0];
+static LPSTR pszNoteText = &szNoteText[0];
+static MapiRecipDesc rdOriginator =
+{0L, MAPI_ORIG, (LPSTR) "ONE", NULL};
+
+#define SZ_MAPILOGON "MAPILogon"
+#define SZ_MAPILOGOFF "MAPILogoff"
+#define SZ_MAPISENDMAIL "MAPISendMail"
+#define SZ_MAPISENDDOC "MAPISendDocuments"
+#define SZ_MAPIFINDNEXT "MAPIFindNext"
+#define SZ_MAPIREADMAIL "MAPIReadMail"
+#define SZ_MAPISAVEMAIL "MAPISaveMail"
+#define SZ_MAPIDELMAIL "MAPIDeleteMail"
+#define SZ_MAPIFREEBUFFER "MAPIFreeBuffer"
+#define SZ_MAPIADDRESS "MAPIAddress"
+#define SZ_MAPIDETAILS "MAPIDetails"
+#define SZ_MAPIRESOLVENAME "MAPIResolveName"
+#define MAPIDLL "MAPI32.DLL"
+
+#define ERR_LOAD_LIB  0x02
+#define ERR_LOAD_FUNC 0x04
+
+ULONG(FAR PASCAL * lpfnMAPILogon) (ULONG, LPSTR, LPSTR, FLAGS, ULONG, HINSTANCE *);
+
+ULONG(FAR PASCAL * lpfnMAPILogoff) (HINSTANCE, ULONG, FLAGS, ULONG);
+
+ULONG(FAR PASCAL * lpfnMAPISendMail) (HINSTANCE, ULONG, lpMapiMessage, FLAGS,
+												  ULONG);
+
+ULONG(FAR PASCAL * lpfnMAPISendDocuments) (ULONG, LPSTR, LPSTR, LPSTR, ULONG);
+
+ULONG(FAR PASCAL * lpfnMAPIFindNext) (HINSTANCE, ULONG, LPSTR, LPSTR, FLAGS,
+												  ULONG, LPSTR);
+
+ULONG(FAR PASCAL * lpfnMAPIReadMail) (HINSTANCE, ULONG, LPSTR, FLAGS, ULONG,
+												  lpMapiMessage FAR *);
+
+ULONG(FAR PASCAL * lpfnMAPISaveMail) (HINSTANCE, ULONG, lpMapiMessage, FLAGS,
+												  ULONG, LPSTR);
+
+ULONG(FAR PASCAL * lpfnMAPIDeleteMail) (HINSTANCE, ULONG, LPSTR, FLAGS, ULONG);
+
+ULONG(FAR PASCAL * lpfnMAPIFreeBuffer) (LPVOID);
+
+ULONG(FAR PASCAL * lpfnMAPIAddress) (HINSTANCE, ULONG, LPSTR, ULONG, LPSTR,
+												 ULONG, lpMapiRecipDesc, FLAGS, ULONG,
+												 LPULONG, lpMapiRecipDesc FAR *);
+
+ULONG(FAR PASCAL * lpfnMAPIDetails) (HINSTANCE, ULONG, lpMapiRecipDesc, FLAGS,
+												 ULONG);
+
+ULONG(FAR PASCAL * lpfnMAPIResolveName) (HINSTANCE, ULONG, LPSTR, FLAGS,
+													  ULONG, lpMapiRecipDesc FAR *);
+
+static int FAR PASCAL DeInitMAPI();
+
+static int FAR PASCAL
+InitMAPI()
+{
+	FLAGS flFlag;
+	int err = 0;
+
+	if (hLibrary != NULL)		  // Already init..
+
+		return err;
+
+	if ((hLibrary = LoadLibrary(MAPIDLL)) == NULL)
+		return (ERR_LOAD_LIB);
+
+#pragma warning (disable : 4113)
+
+	if ((lpfnMAPILogon = GetProcAddress(hLibrary, SZ_MAPILOGON)) == NULL)
+		return (ERR_LOAD_FUNC);
+
+	if ((lpfnMAPILogoff = GetProcAddress(hLibrary, SZ_MAPILOGOFF)) == NULL)
+		return (ERR_LOAD_FUNC);
+
+	if ((lpfnMAPISendMail = GetProcAddress(hLibrary, SZ_MAPISENDMAIL)) == NULL)
+		return (ERR_LOAD_FUNC);
+
+#ifdef FULLMAPI					  /* not needed here */
+	if ((lpfnMAPISendDocuments = GetProcAddress(hLibrary, SZ_MAPISENDDOC)) == NULL)
+		return (ERR_LOAD_FUNC);
+
+	if ((lpfnMAPIFindNext = GetProcAddress(hLibrary, SZ_MAPIFINDNEXT)) == NULL)
+		return (ERR_LOAD_FUNC);
+
+	if ((lpfnMAPIReadMail = GetProcAddress(hLibrary, SZ_MAPIREADMAIL)) == NULL)
+		return (ERR_LOAD_FUNC);
+
+	if ((lpfnMAPISaveMail = GetProcAddress(hLibrary, SZ_MAPISAVEMAIL)) == NULL)
+		return (ERR_LOAD_FUNC);
+
+	if ((lpfnMAPIDeleteMail = GetProcAddress(hLibrary, SZ_MAPIDELMAIL)) == NULL)
+		return (ERR_LOAD_FUNC);
+
+	if ((lpfnMAPIFreeBuffer = GetProcAddress(hLibrary, SZ_MAPIFREEBUFFER)) == NULL)
+		return (ERR_LOAD_FUNC);
+
+	if ((lpfnMAPIAddress = GetProcAddress(hLibrary, SZ_MAPIADDRESS)) == NULL)
+		return (ERR_LOAD_FUNC);
+
+	if ((lpfnMAPIDetails = GetProcAddress(hLibrary, SZ_MAPIDETAILS)) == NULL)
+		return (ERR_LOAD_FUNC);
+
+	if ((lpfnMAPIResolveName = GetProcAddress(hLibrary, SZ_MAPIRESOLVENAME)) == NULL)
+		return (ERR_LOAD_FUNC);
+#endif // not needed here
+
+#pragma warning (default : 4113)
+
+	flFlag = MAPI_NEW_SESSION | MAPI_LOGON_UI;
+	if ((err = (*lpfnMAPILogon) (0L, NULL, NULL, flFlag, 0L, &hMAPISession)) != 0)
+		DeInitMAPI();
+
+	return (err);
+}
+
+void
+endmailsession(void)
+{
+	DeInitMAPI();
+}
+
+static int FAR PASCAL
+DeInitMAPI()
+{
+
+	lpfnMAPILogon = NULL;
+	lpfnMAPILogoff = NULL;
+	lpfnMAPISendMail = NULL;
+	lpfnMAPISendDocuments = NULL;
+	lpfnMAPIFindNext = NULL;
+	lpfnMAPIReadMail = NULL;
+	lpfnMAPISaveMail = NULL;
+	lpfnMAPIDeleteMail = NULL;
+	lpfnMAPIFreeBuffer = NULL;
+	lpfnMAPIAddress = NULL;
+	lpfnMAPIDetails = NULL;
+	lpfnMAPIResolveName = NULL;
+
+	if (hLibrary)
+		FreeLibrary(hLibrary);
+
+	return (0);
+}
+
+static int
+sendMail(char *To, char *Subject, char *Text, BOOL editBeforeSend)
+{
+	MapiRecipDesc MAPIRecip;
+	SYSTEMTIME st;
+	char localTime[40];
+	FLAGS flFlag;
+
+	GetLocalTime(&st);
+	sprintf(localTime, "%.2d/%.2d/%d %.2d:%.2d",
+			  st.wMonth, st.wDay, st.wYear, st.wHour, st.wMinute);
+
+	MAPIRecip.ulReserved = 0L;
+	MAPIRecip.ulRecipClass = MAPI_TO;
+	MAPIRecip.lpszName = To;
+	MAPIRecip.lpszAddress = "";
+	MAPIRecip.ulEIDSize = 0L;
+	MAPIRecip.lpEntryID = (LPVOID) NULL;
+
+	mmMapiMessage.ulReserved = 0L;
+	mmMapiMessage.lpszSubject = Subject;
+	mmMapiMessage.lpszNoteText = Text;
+	mmMapiMessage.lpszMessageType = NULL;
+	mmMapiMessage.lpszDateReceived = localTime;
+	mmMapiMessage.flFlags = MAPI_UNREAD;
+	mmMapiMessage.lpOriginator = &rdOriginator;
+	mmMapiMessage.nRecipCount = 1L;
+	mmMapiMessage.lpRecips = &MAPIRecip;
+	mmMapiMessage.nFileCount = 0L;
+	mmMapiMessage.lpFiles = NULL;
+
+	flFlag = MAPI_DIALOG;
+	return (*lpfnMAPISendMail) (hMAPISession, 0L, &mmMapiMessage,
+										 editBeforeSend ? MAPI_DIALOG : 0L, 0L);
+}
+
+int
+sendmail(LPSTR szFileName, LPSTR szTo, LPSTR szSubject, BOOL fEdit)
+{
+	int err = 1;
+	HANDLE hFile = NULL;
+	LPSTR pText = NULL;
+	DWORD dwSize = 0, dwRead = 0;
+
+	hFile = CreateFile(szFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+	if (hFile == INVALID_HANDLE_VALUE)
+		goto exit;
+
+	if ((dwSize = GetFileSize(hFile, NULL)) == 0)
+		goto exit;
+
+	if ((pText = (LPSTR) GlobalAlloc(GPTR, dwSize)) == NULL)
+		goto exit;
+
+	if (!ReadFile(hFile, pText, dwSize, &dwRead, NULL))
+		goto exit;
+
+	if (dwSize != dwRead)
+		goto exit;
+
+	if (InitMAPI() != 0)
+		goto exit;
+
+	err = sendMail(szTo, szSubject, pText, fEdit);
+
+	// BUGBUG: DeInitMAPI() at end of session
+	// DeInitMAPI();
+
+ exit:
+	if (hFile)
+		CloseHandle(hFile);
+	if (pText)
+		GlobalFree((HGLOBAL) pText);
+	return err;
+}
+
+#endif /* WIN32 */
diff -Nur tin-980117/old/msmail.h tin-980202/old/msmail.h
--- tin-980117/old/msmail.h	Thu Jan  1 01:00:00 1970
+++ tin-980202/old/msmail.h	Sat Jan 31 11:19:17 1998
@@ -0,0 +1,21 @@
+/*
+ *  Project   : tin - a Usenet reader
+ *  Module    : msmail.h
+ *  Author    : N.Ellis
+ *  Created   : 01-10-94
+ *  Updated   : 27-10-94
+ *  Notes     : WinNT specific
+ *  Copyright : (c) Copyright 1991-94 by Nigel Ellis & Iain Lea
+ *              You may  freely  copy or  redistribute  this software,
+ *              so  long as there is no profit made from its use, sale
+ *              trade or  reproduction.  You may not change this copy-
+ *              right notice, and it must be included in any copy made
+ */
+
+#if defined(WIN32) && !defined(__MSMAIL_H__)
+#define __MSMAIL_H__
+
+int sendmail(LPSTR szFileName, LPSTR szTo, LPSTR szSubject, BOOL fEdit);
+void endmailsession(void);
+
+#endif /* __MSMAIL_H__ */
diff -Nur tin-980117/old/nntpvms.c tin-980202/old/nntpvms.c
--- tin-980117/old/nntpvms.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/old/nntpvms.c	Sat Jan 31 11:18:33 1998
@@ -0,0 +1,194 @@
+/*
+ *  Project   : tin - a Usenet reader
+ *  Module    : nntpvms.c
+ *  Author    : S.Barber & I.Lea
+ *  Created   : 10-04-97
+ *  Notes     : VMS specific NNTP client routines, see nntplib.c
+ *  Copyright : (c) Copyright 1991-94 by Stan Barber & Iain Lea
+ *              Permission is hereby granted to copy, reproduce, redistribute
+ *              or otherwise use this software  as long as: there is no
+ *              monetary  profit  gained  specifically  from the use or
+ *              reproduction or this software, it is not  sold, rented,
+ *              traded or otherwise marketed, and this copyright notice
+ *              is included prominently in any copy made.
+ */
+#ifdef VMS
+
+int sockt_rd = -1, sockt_wr = -1;
+
+/*
+ * u_put_server -- send data to the server. Do not flush output.
+ */
+
+#ifdef NNTP_ABLE
+void
+u_put_server(
+					const char *string)
+{
+	netwrite(sockt_wr, string, strlen(string));
+}
+
+#endif
+
+/*
+ * put_server -- send a line of text to the server, terminating it
+ * with CR and LF, as per ARPA standard.
+ *
+ * Parameters: "string" is the string to be sent to the
+ *       server.
+ *
+ * Returns: Nothing.
+ *
+ * Side effects:  Talks to the server.
+ *       Closes connection if things are not right.
+ *
+ * Note: This routine flushes the buffer each time
+ *       it is called.  For large transmissions
+ *       (i.e., posting news) don't use it.  Instead,
+ *       do the fprintf's yourself, and then a final
+ *       fflush.
+ */
+
+#ifdef NNTP_ABLE
+void
+put_server(
+				 const char *string)
+{
+	int respno;
+	static time_t time_last;
+	time_t time_now;
+
+	/*
+	 *  Check how idle we have been, if too idle send a STAT to check
+	 */
+	time(&time_now);
+
+	if (sockt_wr == -1 || (time_last != 0 && time_last + NNTP_IDLE_RETRY_SECS < time_now)) {
+		respno = 0;
+		if (sockt_wr >= 0) {
+			netwrite(sockt_wr, "stat\r\n", 6);
+			respno = get_respcode();
+		}
+		if (respno != OK_NOTEXT && respno != ERR_NCING && respno != ERR_NOCRNT) {
+			/*
+			 *  STAT was not happy, close the connection
+			 *  it will reopen on next get_server
+			 */
+			if (sockt_wr >= 0)
+				netclose(sockt_wr);
+			sockt_wr = sockt_rd = -1;
+
+			strcpy(last_put, string);
+			time_last = 0;
+			return;
+		}
+	}
+	time_last = time_now;
+
+	{
+		char line[256];
+
+		sprintf(line, "%s\r\n", string);
+		netwrite(sockt_wr, line, strlen(line));
+	}
+
+	strcpy(last_put, string);
+}
+
+#endif /* NNTP_ABLE */
+
+/*
+ * get_server -- return the next line of text from the server.  Strips
+ * CR's and LF's.
+ *
+ * Parameters: "string" has the buffer space for the line received.
+ *       "size" is maximum size of the buffer to read.
+ *
+ * Returns: NULL on end of stream, or a line of data
+ *
+ * Side effects:  Talks to server, changes contents of "string".
+ *       Reopens connection when necessary and requested.
+ *       Exits via tin_done() if fatal error occurs.
+ */
+
+#ifdef NNTP_ABLE
+char *
+get_server(char *string, int size)
+{
+	char buf[NNTP_STRLEN];
+	register char *cp;
+
+#ifdef USE_SFGETS
+	while (Sfgets(string, size, sockt_rd) == NULL) {
+#else
+	char *p;
+
+	while ((p = Srdline(sockt_rd)) == NULL) {
+#endif
+		if (errno != EINTR) {
+			netclose(sockt_rd);
+			ring_bell();
+			if (!prompt_yn(cLINES, txt_reconnect_to_news_server, TRUE)) {
+				tin_done(EXIT_NNTP_ERROR);
+			}
+			clear_message();
+			strcpy(buf, last_put);
+			if (nntp_open() == 0) {
+				if (glob_group != (char *) 0) {
+					sprintf(last_put, "group %s", glob_group);
+					put_server(last_put);
+#ifdef USE_SFGETS
+					Sfgets(last_put, NNTP_STRLEN, sockt_rd);
+#else
+					p = Srdline(sockt_rd);
+					strncpy(last_put, p, NNTP_STRLEN);
+#endif
+				}
+			} else {
+				tin_done(EXIT_NNTP_ERROR);
+			}
+			put_server(buf);
+		}
+	}
+#ifndef USE_SFGETS
+	memcpy(string, p, SIOLINELEN(sockt_rd) + 1);
+#endif
+	if ((cp = strchr(string, '\r')) != NULL) {
+		*cp = '\0';
+	} else if ((cp = strchr(string, '\n')) != NULL) {
+		*cp = '\0';
+	}
+	return (0);
+}
+#endif /* NNTP_ABLE */
+
+/*
+ * close_server -- close the connection to the server, after sending
+ *    the "quit" command.
+ *
+ * Parameters: None.
+ *
+ * Returns: Nothing.
+ *
+ * Side effects:  Closes the connection with the server.
+ *       You can't use "put_server" or "get_server"
+ *       after this routine is called.
+ */
+
+#ifdef NNTP_ABLE
+void
+close_server(void)
+{
+	if (sockt_rd < 0 || sockt_wr < 0)
+		return;
+
+	put_server("QUIT");
+	(void) get_server(nntp_line, sizeof (nntp_line));
+
+	netclose(sockt_rd);
+	s_end();
+	sockt_rd = sockt_wr = -1;
+}
+#endif /* NNTP_ABLE */
+
+#endif /* VMS */
diff -Nur tin-980117/old/nntpw32.c tin-980202/old/nntpw32.c
--- tin-980117/old/nntpw32.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/old/nntpw32.c	Sun Feb  1 08:21:17 1998
@@ -0,0 +1,1458 @@
+/*
+ *  Project   : tin - a Usenet reader
+ *  Module    : nntpw32.c
+ *  Author    : N.Ellis (portions taken from nntplib.c)
+ *  Created   : 12-01-91
+ *  Updated   : 15-12-94
+ *  Notes     : NNTP client routines taken from clientlib.c 1.5.11 (10-02-91)
+ *  Copyright : (c) Copyright 1991-94 by Stan Barber & Iain Lea
+ *              Permission is hereby granted to copy, reproduce, redistribute
+ *              or otherwise use this software  as long as: there is no
+ *              monetary  profit  gained  specifically  from the use or
+ *              reproduction or this software, it is not  sold, rented,
+ *              traded or otherwise marketed, and this copyright notice
+ *              is included prominently in any copy made.
+ */
+
+#include "tin.h"
+
+#if defined(WIN32)
+#if defined(NNTP_ABLE)
+
+char last_put[NNTP_STRLEN];
+static char nntp_line[NNTP_STRLEN];
+
+#ifdef WIN32XNS
+#define PACKET_SIZE 4096
+#define cmemBlock PACKET_SIZE
+// #define XNS_ASYNC       // XNS ASYNC send and receive
+#else
+#define cmemBlock (8*1024)
+#endif
+
+static char memBlock[cmemBlock + 4];
+static UINT imemBlock = 0;
+static UINT iendBlock = 0;
+
+#if !defined(WIN32IP) && !defined(WIN32XNS) && !defined(WIN32PIPES)
+#pragma message("No network transport defined, defaulting to WIN32IP")
+#define WIN32IP
+#endif
+
+#ifdef DEBUG
+void DebugAssertDialog(LPSTR, DWORD, LPSTR);
+
+#define DEBUGCheckString(s, m)	if (*s=='\0') DebugAssertDialog(m, __LINE__, __FILE__);
+#else
+#define DEBUGCheckString(s, m)
+#endif
+
+#endif /* NNTP_ABLE */
+
+// Transport independant routines...
+
+/*
+ * handle_server_response
+ *
+ * Print some informative messages based on the server's initial
+ * response code.  This is here so inews, rn, etc. can share
+ * the code.
+ *
+ * Parameters: "response" is the response code which the
+ *       server sent us, presumably from "server_init",
+ *       above.
+ *       "nntpserver" is the news server we got the
+ *       response code from.
+ *
+ * Returns: -1 if the error is fatal (and we should exit).
+ *       0 otherwise.
+ *
+ * Side effects:  None.
+ */
+
+int
+handle_server_response(response, nntpserver)
+	int response;
+	char *nntpserver;
+{
+#ifdef NNTP_ABLE
+	switch (response) {
+		case OK_NOPOST:			  /* fall through */
+			printf("NOTE: This machine does not have permission to post articles.\n");
+			printf("      Please don't waste your time trying.\n\n");
+
+		case OK_CANPOST:
+			return (0);
+			break;
+
+		case ERR_ACCESS:
+			printf("This machine does not have permission to use the %s news server.\n", nntpserver);
+			return (-1);
+			break;
+
+		default:
+			printf("Unexpected response code from %s news server: %d\n",
+					 nntpserver, response);
+			return (-1);
+			break;
+	}
+	/*NOTREACHED */
+#else
+	return (-1);
+#endif /* NNTP_ABLE */
+}
+
+#ifdef DEBUG
+/*
+ * NNTP strings for get_respcode()
+ */
+char *
+nntp_respcode(respcode)
+	int respcode;
+{
+#ifdef NNTP_ABLE
+	static char *text;
+
+	/*
+	 * If the last response line matches and has a description, return it
+	 */
+	if (atoi(nntp_line) == respcode && strlen(nntp_line) > 4) {
+		return nntp_line;
+	}
+	switch (respcode) {
+		case 0:
+			text = "";
+			break;
+		case INF_HELP:
+			text = "100  Help text on way";
+			break;
+		case INF_AUTH:
+			text = "180  Authorization capabilities";
+			break;
+		case INF_DEBUG:
+			text = "199  Debug output";
+			break;
+		case OK_CANPOST:
+			text = "200  Hello; you can post";
+			break;
+		case OK_NOPOST:
+			text = "201  Hello; you can't post";
+			break;
+		case OK_SLAVE:
+			text = "202  Slave status noted";
+			break;
+		case OK_GOODBYE:
+			text = "205  Closing connection";
+			break;
+		case OK_GROUP:
+			text = "211  Group selected";
+			break;
+		case OK_GROUPS:
+			text = "215  Newsgroups follow";
+			break;
+		case OK_XMOTD:
+			text = "217  News motd file follows";
+			break;
+		case OK_XINDEX:
+			text = "218  Group index file follows";
+			break;
+		case OK_ARTICLE:
+			text = "220  Article (head & body) follows";
+			break;
+		case OK_HEAD:
+			text = "221  Head follows";
+			break;
+		case OK_BODY:
+			text = "222  Body follows";
+			break;
+		case OK_NOTEXT:
+			text = "223  No text sent -- stat, next, last";
+			break;
+		case OK_NEWNEWS:
+			text = "230  New articles by message-id follow";
+			break;
+		case OK_NEWGROUPS:
+			text = "231  New newsgroups follow";
+			break;
+		case OK_XFERED:
+			text = "235  Article transferred successfully";
+			break;
+		case OK_POSTED:
+			text = "240  Article posted successfully";
+			break;
+		case OK_AUTHSYS:
+			text = "280  Authorization system ok";
+			break;
+		case OK_AUTH:
+			text = "281  Authorization (user/pass) ok";
+			break;
+		case OK_BIN:
+			text = "282  binary data follows";
+			break;
+		case OK_SPLIST:
+			text = "283  spooldir list follows";
+			break;
+		case OK_SPSWITCH:
+			text = "284  Switching to a different spooldir";
+			break;
+		case OK_SPNOCHANGE:
+			text = "285  Still using same spooldir";
+			break;
+		case OK_SPLDIRCUR:
+			text = "286  Current spooldir";
+			break;
+		case OK_SPLDIRAVL:
+			text = "287  Available spooldir";
+			break;
+		case OK_SPLDIRERR:
+			text = "288  Unavailable spooldir or invalid entry";
+			break;
+		case CONT_XFER:
+			text = "335  Continue to send article";
+			break;
+		case CONT_POST:
+			text = "340  Continue to post article";
+			break;
+		case NEED_AUTHINFO:
+			text = "380  authorization is required";
+			break;
+		case NEED_AUTHDATA:
+			text = "381  <type> authorization data required";
+			break;
+		case ERR_GOODBYE:
+			text = "400  Have to hang up for some reason";
+			break;
+		case ERR_NOGROUP:
+			text = "411  No such newsgroup";
+			break;
+		case ERR_NCING:
+			text = "412  Not currently in newsgroup";
+			break;
+		case ERR_XMOTD:
+			text = "417  No news motd file";
+			break;
+		case ERR_XINDEX:
+			text = "418  No index file for this group";
+			break;
+		case ERR_NOCRNT:
+			text = "420  No current article selected";
+			break;
+		case ERR_NONEXT:
+			text = "421  No next article in this group";
+			break;
+		case ERR_NOPREV:
+			text = "422  No previous article in this group";
+			break;
+		case ERR_NOARTIG:
+			text = "423  No such article in this group";
+			break;
+		case ERR_NOART:
+			text = "430  No such article at all";
+			break;
+		case ERR_GOTIT:
+			text = "435  Already got that article, don't send";
+			break;
+		case ERR_XFERFAIL:
+			text = "436  Transfer failed";
+			break;
+		case ERR_XFERRJCT:
+			text = "437  Article rejected, don't resend";
+			break;
+		case ERR_NOPOST:
+			text = "440  Posting not allowed";
+			break;
+		case ERR_POSTFAIL:
+			text = "441  Posting failed";
+			break;
+		case ERR_NOAUTH:
+			text = "480  authorization required for command";
+			break;
+		case ERR_AUTHSYS:
+			text = "481  Authorization system invalid";
+			break;
+		case ERR_AUTHREJ:
+			text = "482  Authorization data rejected";
+			break;
+		case ERR_INVALIAS:
+			text = "483  Invalid alias on spooldir cmd";
+			break;
+		case ERR_INVNOSPDIR:
+			text = "484  No spooldir file found";
+			break;
+		case ERR_COMMAND:
+			text = "500  Command not recognized";
+			break;
+		case ERR_CMDSYN:
+			text = "501  Command syntax error";
+			break;
+		case ERR_ACCESS:
+			text = "502  Access to server denied";
+			break;
+		case ERR_FAULT:
+			text = "503  Program fault, command not performed";
+			break;
+		case ERR_AUTHBAD:
+			text = "580  Authorization Failed";
+			break;
+		default:
+			text = "Unknown NNTP response code";
+			break;
+	}
+	return (text);
+#else
+	return ("");
+#endif
+}
+#endif /* DEBUG */
+
+/*
+ * getserverbyfile Get the name of a server from a named file.
+ *       Handle white space and comments.
+ *       Use NNTPSERVER environment variable if set.
+ *
+ * Parameters: "file" is the name of the file to read.
+ *
+ * Returns: Pointer to static data area containing the
+ *       first non-ws/comment line in the file.
+ *       NULL on error (or lack of entry in file).
+ *
+ * Side effects:  None.
+ */
+
+char *
+getserverbyfile(file)
+	char *file;
+{
+#ifdef NNTP_ABLE
+	register FILE *fp;
+	register char *cp;
+	static char buf[256];
+
+	cp = getenv("NNTPSERVER");
+	if (cp != (char *) 0) {
+		(void) strcpy(buf, cp);
+		return (buf);
+	}
+	if (file == (char *) 0) {
+		return (char *) 0;
+	}
+	if ((fp = fopen(file, "r")) == (FILE *) 0) {
+		return (char *) 0;
+	}
+	while (fgets(buf, sizeof (buf), fp) != (char *) 0) {
+		if (*buf == '\n' || *buf == '#') {
+			continue;
+		}
+		cp = strrchr(buf, '\n');
+		if (cp) {
+			*cp = '\0';
+		}
+		(void) fclose(fp);
+		return (buf);
+	}
+
+#ifdef NNTP_DEFAULT_SERVER
+	if (*(NNTP_DEFAULT_SERVER)) {
+		return NNTP_DEFAULT_SERVER;
+	}
+#endif /* NNTP_DEFAULT_SERVER */
+
+	(void) fclose(fp);
+#endif /* NNTP_ABLE */
+	return (char *) 0;			  /* No entry */
+}
+
+/*=-=-=-=-=-=-=-=-=-=
+ * TCP/IP Transport *
+ *=-=-=-=-=-=-=-=-=-=*/
+
+#ifdef WIN32IP						  /* TCP/IP Transport */
+
+#include <winsock.h>
+
+int nntp_rd_fp = 0;
+int nntp_wr_fp = 0;
+
+/*
+ * server_init  Get a connection to the remote server.
+ *
+ * Parameters: "machine" is the machine to connect to.
+ *       "service" is the service to connect to on the machine.
+ *       "port" is the servive port to connect to.
+ *
+ * Returns: -1 on error
+ *       server's initial response code on success.
+ *
+ * Side effects:  Connects to server.
+ *       "nntp_rd_fp" and "nntp_wr_fp" are fp's
+ *       for reading and writing to server.
+ */
+
+int
+server_init(machine, service, port)
+	char *machine;
+	char *service;
+	int port;
+{
+#ifdef NNTP_ABLE
+	int sockt_rd;
+	WSADATA wsaData;
+
+	if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) {
+		return -1;
+	}
+	sockt_rd = get_tcp_socket(machine, service, port);
+
+	if (sockt_rd < 0)
+		return (-1);
+
+	nntp_rd_fp = nntp_wr_fp = sockt_rd;
+	/*
+	 * Now get the server's signon message
+	 */
+	(void) get_server(nntp_line, sizeof (nntp_line));
+	return (atoi(nntp_line));
+#else
+	return (-1);
+#endif /* NNTP_ABLE */
+}
+
+/*
+ * get_tcp_socket -- get us a socket connected to the specified server.
+ *
+ * Parameters: "machine" is the machine the server is running on.
+ *       "service" is the service to connect to on the server.
+ *       "port" is the port to connect to on the server.
+ *
+ * Returns: Socket connected to the server if
+ *       all is ok, else -1 on error.
+ *
+ * Side effects:  Connects to server.
+ *
+ * Errors:     Printed via perror.
+ */
+
+int
+get_tcp_socket(machine, service, port)
+	char *machine;					  /* remote host */
+	char *service;					  /* nttp/smtp etc. */
+	unsigned port;					  /* tcp port number */
+{
+#ifdef NNTP_ABLE
+	int s = -1;
+	struct sockaddr_in sin;
+	struct servent *sp;
+	struct hostent *hp;
+
+#ifdef h_addr
+	int x = 0;
+	register char **cp;
+	static char *alist[1];
+
+#endif /* h_addr */
+	static struct hostent def;
+	static struct in_addr defaddr;
+	static char namebuf[256];
+
+	if ((sp = (struct servent *) getservbyname(service, "tcp")) == NULL) {
+		fprintf(stderr, "%s/tcp: Unknown service.\n", service);
+		return (-1);
+	}
+	/* If not a raw ip address, try nameserver */
+	if (!isdigit((unsigned char) *machine) ||
+		 (long) (defaddr.s_addr = (long) inet_addr(machine)) == -1) {
+		hp = gethostbyname(machine);
+	} else {
+		/* Raw ip address, fake  */
+		(void) strcpy(namebuf, machine);
+		def.h_name = (char *) namebuf;
+#ifdef h_addr
+		def.h_addr_list = alist;
+#endif
+		def.h_addr = (char *) &defaddr;
+		def.h_length = sizeof (struct in_addr);
+
+		def.h_addrtype = AF_INET;
+		def.h_aliases = 0;
+		hp = &def;
+	}
+	if (hp == NULL) {
+		fprintf(stderr, "\n%s: Unknown host.\n", machine);
+		return (-1);
+	}
+	memset((char *) &sin, '\0', sizeof (sin));
+	sin.sin_family = hp->h_addrtype;
+	sin.sin_port = sp->s_port;
+
+	/*
+	 * The following is kinda gross.  The name server under 4.3
+	 * returns a list of addresses, each of which should be tried
+	 * in turn if the previous one fails.  However, 4.2 hostent
+	 * structure doesn't have this list of addresses.
+	 * Under 4.3, h_addr is a #define to h_addr_list[0].
+	 * We use this to figure out whether to include the NS specific
+	 * code...
+	 */
+
+#ifdef h_addr
+	/*
+	 * get a socket and initiate connection -- use multiple addresses
+	 */
+
+	for (cp = hp->h_addr_list; cp && *cp; cp++) {
+		s = socket(hp->h_addrtype, SOCK_STREAM, 0);
+		if (s < 0) {
+			perror("socket");
+			return (-1);
+		}
+		memcpy((char *) &sin.sin_addr, *cp, hp->h_length);
+
+		if (x < 0) {
+			fprintf(stderr, "Trying %s", (char *) inet_ntoa(sin.sin_addr));
+		}
+		x = connect(s, (struct sockaddr *) &sin, sizeof (sin));
+		if (x == 0) {
+			break;
+		}
+		fprintf(stderr, "\nConnection to %s: ", (char *) inet_ntoa(sin.sin_addr));
+		perror("");
+		(void) closesocket(s);
+	}
+	if (x < 0) {
+		fprintf(stderr, "Giving up...\n");
+		return (-1);
+	}
+#else	/* no name server */
+	if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+		perror("socket");
+		return (-1);
+	}
+	/* And then connect */
+
+	memcpy((char *) &sin.sin_addr, hp->h_addr, hp->h_length);
+	if (connect(s, (struct sockaddr *) &sin, sizeof (sin)) < 0) {
+		perror("connect");
+		(void) closesocket(s);
+		return (-1);
+	}
+#endif /* !h_addr */
+	/* Disable nagling to prevent packet delays */
+	{
+		BOOL fOn = TRUE;
+
+		(void) setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (const char *) &fOn, sizeof (fOn));
+	}
+
+	return (s);
+#else
+	return (-1);
+#endif /* NNTP_ABLE */
+}
+
+/*
+ * u_put_server -- send data to the server. Do not flush output.
+ */
+
+void
+u_put_server(string)
+	char *string;
+{
+#ifdef	NNTP_ABLE
+	send(nntp_wr_fp, string, strlen(string), 0);
+#endif
+}
+
+/*
+ * put_server -- send a line of text to the server, terminating it
+ * with CR and LF, as per ARPA standard.
+ *
+ * Parameters: "string" is the string to be sent to the
+ *       server.
+ *
+ * Returns: Nothing.
+ *
+ * Side effects:  Talks to the server.
+ *       Closes connection if things are not right.
+ *
+ * Note: This routine flushes the buffer each time
+ *       it is called.  For large transmissions
+ *       (i.e., posting news) don't use it.  Instead,
+ *       do the fprintf's yourself, and then a final
+ *       fflush.
+ */
+
+void
+put_server(string)
+	char *string;
+{
+#ifdef NNTP_ABLE
+	int respno;
+	static time_t time_last;
+	time_t time_now;
+
+	DEBUGCheckString(string, "NULL NNTP Command");
+	/*
+	 *  Check how idle we have been, if too idle send a STAT to check
+	 */
+	time(&time_now);
+	if (time_last != 0 && time_last + NNTP_IDLE_RETRY_SECS < time_now) {
+		send(nntp_wr_fp, "stat\r\n", 6, 0);
+		respno = get_respcode();
+		if (respno != OK_NOTEXT && respno != ERR_NCING && respno != ERR_NOCRNT) {
+			/*
+			 *  STAT was not happy, close the connection
+			 *  it will reopen on next get_server
+			 */
+			closesocket(nntp_wr_fp);
+			closesocket(nntp_rd_fp);
+			strcpy(last_put, string);
+			time_last = 0;
+			return;
+		}
+	}
+	time_last = time_now;
+
+	sprintf(nntp_line, "%s\r\n", string);
+	send(nntp_wr_fp, nntp_line, strlen(nntp_line), 0);
+
+	strcpy(last_put, string);
+#endif /* NNTP_ABLE */
+}
+
+#ifdef NNTP_ABLE
+static int
+read_from_server(LPSTR nntp_line, DWORD length)
+{
+	DWORD cbRead = 0, cb;
+	char *pEol;
+
+	if (imemBlock == iendBlock) {
+		pEol = 0;
+	} else {
+		pEol = strstr(memBlock + imemBlock, "\r\n");		/* search for a newline                */
+		if (pEol > memBlock + iendBlock - 2)	/* if one was found outside the buffer */
+			pEol = 0;				  /* then we didn't really find one      */
+	}
+
+	if (!pEol) {
+		iendBlock -= imemBlock;
+		if (iendBlock)
+			memcpy(memBlock, memBlock + imemBlock, iendBlock);
+		imemBlock = 0;
+		do {
+			cbRead = recv(nntp_rd_fp, memBlock + iendBlock, cmemBlock - iendBlock, 0);
+			if (cbRead == 0 || cbRead == SOCKET_ERROR) {
+				return -1;
+			}
+			iendBlock += cbRead;
+
+			pEol = strstr(memBlock, "\r\n");		/* search for a newline */
+		} while (pEol > memBlock + iendBlock - 2);
+	}
+	cb = pEol - (memBlock + imemBlock);
+
+	memcpy(nntp_line, memBlock + imemBlock, cb);
+	nntp_line[cb] = '\0';
+	imemBlock += cb + 2;
+
+	assert(imemBlock <= iendBlock);
+
+	return (strlen(nntp_line));
+}
+#endif /* NNTP_ABLE */
+
+/*
+ * get_server -- get a line of text from the server.  Strips
+ * CR's and LF's.
+ *
+ * Parameters: "string" has the buffer space for the
+ *       line received.
+ *       "size" is the size of the buffer.
+ *
+ * Returns: -1 on error, 0 otherwise, -2 if user said no to reconnection.
+ *
+ * Side effects:  Talks to server, changes contents of "string".
+ *       Reopens connection when necessary and requested.
+ */
+
+int
+get_server(string, size)
+	char *string;
+	int size;
+{
+#ifdef NNTP_ABLE
+	int cbRead;
+
+	cbRead = read_from_server(string, size);
+	if (cbRead == -1) {
+		closesocket(nntp_wr_fp);
+		if (nntp_open() == 0) {
+			char buf[NNTP_STRLEN];
+
+			strcpy(buf, last_put);
+			if (glob_group != (char *) 0) {
+				char tmp[NNTP_STRLEN];
+
+				sprintf(tmp, "group %s", glob_group);
+				put_server(tmp);
+				cbRead = read_from_server(tmp, NNTP_STRLEN);
+			}
+			put_server(buf);
+			cbRead = read_from_server(string, size);
+		}
+	}
+	return cbRead;
+#else
+	return -1;
+#endif /* NNTP_ABLE */
+}
+
+/*
+ * close_server -- close the connection to the server, after sending
+ *    the "quit" command.
+ *
+ * Parameters: None.
+ *
+ * Returns: Nothing.
+ *
+ * Side effects:  Closes the connection with the server.
+ *       You can't use "put_server" or "get_server"
+ *       after this routine is called.
+ */
+
+void
+close_server()
+{
+#ifdef NNTP_ABLE
+	if (nntp_wr_fp == 0 || nntp_rd_fp == 0)
+		return;
+
+	put_server("QUIT");
+	(void) get_server(nntp_line, sizeof (nntp_line));
+
+	(void) closesocket(nntp_wr_fp);
+#endif /* NNTP_ABLE */
+}
+
+#endif /* WIN32IP */
+
+/*=-=-=-=-=-=-=-=-=-=-=-=*
+ * Named pipes Transport *
+ *=-=-=-=-=-=-=-=-=-=-=-=*/
+
+#ifdef WIN32PIPES
+HANDLE hPipe;
+
+/*
+ * server_init get a connection to a remote server
+ *
+ *
+ *  returns -1 on error
+ */
+
+int
+server_init(LPCSTR machine, LPCSTR service, USHORT port)
+{
+	BOOL fSuccess;
+	DWORD dwMode;
+	CHAR lpszPipename[128];
+
+	strcpy(lpszPipename, "\\\\");
+	strcat(lpszPipename, machine);
+	strcat(lpszPipename, "\\pipe\\");
+	strcat(lpszPipename, service);
+
+	/* try and open the pipe */
+	while (1) {
+		hPipe = CreateFile(
+									lpszPipename,	/* pipe name           */
+									GENERIC_READ |		/* read/write access   */
+									GENERIC_WRITE,
+									0,	  /* no sharing          */
+									NULL,		/* no security attr. */
+									OPEN_EXISTING,		/* opens existing pipe */
+									0,	  /* default attributes  */
+									NULL);	/* no template file    */
+
+		/* Break if the pipe handle is valid. */
+
+		if (hPipe != INVALID_HANDLE_VALUE)
+			break;
+
+		/* Exit if an error other than ERROR_PIPE_BUSY occurs */
+
+		if (GetLastError() != ERROR_PIPE_BUSY)
+			return (-1);
+
+		/* All pipe instances are busy, so wait for 20 seconds. */
+
+		if (!WaitNamedPipe(lpszPipename, 20000))
+			return (-1);
+
+	}
+	dwMode = PIPE_READMODE_BYTE;
+	fSuccess = SetNamedPipeHandleState(
+													 hPipe,	/* pipe handle          */
+													 &dwMode,	/* new pipe mode        */
+													 NULL,	/* don't set max. bytes */
+													 NULL);	/* don't set max. time  */
+
+	if (!fSuccess)
+		return (-1);
+	/*
+	 * now get the servers signon message
+	 */
+	(void) get_server(nntp_line, sizeof (nntp_line));
+
+	return (atoi(nntp_line));
+}
+
+/*
+ * real_put_server -- send a line of text to the server, terminating it
+ * with  CR and LF if asked, as per the ARPA standard
+ *
+ * Parameters: the line to put to the server
+ * Side effects: talks to the server and closes the link if problems
+ *
+ */
+static void
+real_put_server(LPCSTR plpvMessage, int fCRLF)
+{
+	BOOL fSuccess;
+	DWORD cbWritten;
+
+	fSuccess = WriteFile(hPipe, plpvMessage, strlen(plpvMessage), &cbWritten, NULL);
+	if (fSuccess && fCRLF)
+		fSuccess = WriteFile(hPipe, "\r\n", 2, &cbWritten, NULL);
+
+	if (!fSuccess) {
+		char buf[NNTP_STRLEN];
+
+		CloseHandle(hPipe);
+		strcpy(buf, plpvMessage);
+		if (nntp_open() == 0) {
+			if (glob_group != (char *) 0) {
+				char tmp[NNTP_STRLEN];
+
+				sprintf(tmp, "group %s", glob_group);
+				put_server(tmp);
+				get_server(tmp, NNTP_STRLEN);
+			}
+			put_server(buf);
+		}
+	}
+}
+
+/*
+ * u_put_server -- send data to the server. Do not flush output.
+ */
+_inline void
+u_put_server(string)
+	char *string;
+{
+#ifdef	NNTP_ABLE
+	real_put_server(string, 0);
+#endif
+}
+
+/*
+ * put_server -- send a line of text to the server, terminating it
+ * with  CR and LF, as per the ARPA standard
+ */
+void
+put_server(LPCSTR plpvMessage)
+{
+	DEBUGCheckString(plpvMessage, "NULL NNTP Command");
+	real_put_server(plpvMessage, 1);
+}
+
+/*
+ * close_server close the connection to the server after sending the 'quit'
+ * command
+ *
+ * Side effects: closes the connections to the server, you can't use put/get
+ * after this call
+ */
+
+void
+close_server()
+{
+	put_server("QUIT\r\n");
+	get_server(nntp_line, sizeof (nntp_line));
+	CloseHandle(hPipe);
+}
+
+int
+get_server(LPSTR nntp_line, DWORD length)
+{
+	DWORD cbRead = 0, cb;
+	char *pEol;
+	BOOL fSuccess;
+
+	if (imemBlock == iendBlock) {
+		pEol = 0;
+	} else {
+		/* search for a newline */
+		pEol = strstr(memBlock + imemBlock, "\r\n");
+
+		/* if one was found outside the buffer */
+		if (pEol > memBlock + iendBlock - 2)
+			pEol = 0;				  /* then we didn't really find one */
+
+	}
+
+	if (!pEol) {
+		iendBlock -= imemBlock;
+		if (iendBlock)
+			memcpy(memBlock, memBlock + imemBlock, iendBlock);
+		imemBlock = 0;
+		do {
+			fSuccess = ReadFile(
+										 hPipe,	/* pipe handle */
+										 (LPVOID) (memBlock + iendBlock),	/* buffer to receive reply */
+										 cmemBlock - iendBlock,		/* size of buffer          */
+										 &cbRead,	/* number of bytes read    */
+										 NULL);	/* not overlapped          */
+
+			assert(fSuccess);
+
+			iendBlock += cbRead;
+
+			pEol = strstr(memBlock, "\r\n");		/* search for a newline */
+
+		}
+		while (pEol > memBlock + iendBlock - 2);
+	}
+	cb = pEol - (memBlock + imemBlock);
+
+	memcpy(nntp_line, memBlock + imemBlock, cb);
+	nntp_line[cb] = '\0';
+	imemBlock += cb + 2;
+
+	assert(imemBlock <= iendBlock);
+
+	return (strlen(nntp_line));
+}
+
+#endif /* WIN32PIPES */
+
+/*=-=-=-=-=-=-=-=-=-=-=-=*
+ * XNS Netbios Transport *
+ *=-=-=-=-=-=-=-=-=-=-=-=*/
+
+#ifdef WIN32XNS
+static int LSN;
+static unsigned LANA;
+static int neterrno = 0x00;
+
+static int rc;						  /* generic return code placeholder */
+
+/* Misc NB functions for low level network I/O */
+static int netpname(unsigned, char *);
+static int checknet(void);
+static int resetnet(unsigned);
+static int netconnect(unsigned *, char *, char *);
+static int netaddname(unsigned, char *);
+static int netsend(unsigned, int, char *, unsigned);
+static int netreceive(unsigned, int, char *, unsigned);
+static void nethangup(unsigned, int);
+static int netlana(LANA_ENUM * plenum);
+static int get_connection(unsigned *, char *);
+
+static int passncb(struct _NCB *);
+static void netperror(char *);
+
+#define SubmitNCB(ncb)	Netbios(ncb)
+#define HOSTNAMSZ       8		  /* max size of a machine name */
+#define ACK_CHAR        0x06	  /* expected reply from server daemon */
+
+/*
+ * server_init get a connection to a remote server
+ *
+ *
+ *  returns -1 on error
+ */
+
+int
+server_init(LPCSTR machine, LPCSTR service, USHORT port)
+{
+	/*
+	 * Make the connection to the server
+	 *
+	 */
+	strcpy(nntp_line, machine);
+
+	if ((LSN = get_connection(&LANA, nntp_line)) < 0)
+		return -1;
+
+	printf("connected...");
+
+	/* Now get the server's signon message */
+	get_server(nntp_line, sizeof (nntp_line));
+
+	return (atoi(nntp_line));
+}
+
+void
+real_put_server(LPCSTR plpvMessage, int fCRLF)
+{
+	DWORD cbWritten;
+	unsigned packet, length;
+
+	length = (unsigned) strlen(plpvMessage);
+	packet = 0;
+
+	if (length - packet) {
+		cbWritten = netsend(LANA, LSN, (char *) plpvMessage + packet, length - packet);
+		assert(cbWritten != -1);
+	}
+	if (fCRLF) {
+		cbWritten = netsend(LANA, LSN, (char *) "\r\n", 2);
+		assert(cbWritten != 1);
+	}
+	return /* (packet + cbWritten) */ ;
+}
+
+/*
+ * u_put_server -- send data to the server. Do not flush output.
+ */
+
+_inline void
+u_put_server(string)
+	char *string;
+{
+#ifdef	NNTP_ABLE
+	real_put_server(string, 0);
+#endif
+}
+
+/*
+ * put_server -- send a line of text to the server, terminating it
+ * with  CR and LF, as per the ARPA standard
+ *
+ * Parameters: the line to put to the server
+ * Side effects: talks to the server and closes the link if problems
+ *
+ */
+void
+put_server(LPCSTR plpvMessage)
+{
+	DEBUGCheckString(plpvMessage, "NULL NNTP Command");
+	real_put_server(plpvMessage, 1);
+}
+
+/*
+ * close_server close the connection to the server after sending the 'quit'
+ * command
+ *
+ * Side effects: closes the connections to the server, you can't use put/get
+ * after this call
+ */
+
+void
+close_server()
+{
+	if (LSN == 0)
+		return;
+
+	put_server("QUIT");
+	get_server(nntp_line, sizeof (nntp_line));
+
+	nethangup(LANA, LSN);
+	LSN = 0;
+}
+
+int
+get_server(LPSTR nntp_line, DWORD length)
+{
+	DWORD cbRead = 0, cb;
+	char *pEol;
+	BOOL fSuccess;
+
+	if (imemBlock == iendBlock) {
+		pEol = 0;
+	} else {
+		/* search for a newline */
+		pEol = strstr(memBlock + imemBlock, "\r\n");
+
+		/* if one was found outside the buffer */
+		if (pEol > memBlock + iendBlock - 2)
+			pEol = 0;				  /* then we didn't really find one */
+	}
+
+	if (!pEol) {
+		iendBlock -= imemBlock;
+		if (iendBlock)
+			memcpy(memBlock, memBlock + imemBlock, iendBlock);
+		imemBlock = 0;
+		do {
+			cbRead = netreceive(LANA, LSN, memBlock + iendBlock, cmemBlock - iendBlock);
+			fSuccess = (cbRead != -1);
+
+			assert(fSuccess);
+
+			iendBlock += cbRead;
+
+			pEol = strstr(memBlock, "\r\n");		/* search for a newline */
+		}
+		while (pEol > memBlock + iendBlock - 2);
+	}
+	assert(pEol != (char *) NULL);
+
+	cb = pEol - (memBlock + imemBlock);
+
+	assert(cb <= length);
+	memcpy(nntp_line, memBlock + imemBlock, cb);
+	nntp_line[cb] = '\0';
+	imemBlock += cb + 2;
+
+	assert(imemBlock <= iendBlock);
+
+	return (strlen(nntp_line));
+}
+
+int
+netaddname(unsigned lana, char *lname)
+{
+	struct _NCB ncb =
+	{0};
+
+	if (lname == NULL || *lname == '\0')
+		return -1;
+
+	ncb.ncb_command = NCBADDNAME;
+	ncb.ncb_lana_num = LANA;
+	memcpy(ncb.ncb_name, (char *) lname, NCBNAMSZ);
+
+	rc = passncb(&ncb);
+	if (rc < 0)
+		rc = -1;
+	else
+		rc = ncb.ncb_num;
+
+	return rc;
+}
+
+/*
+ * get_connection -- get us a connection to the news server.
+ *
+ * Parameters: "machine" is the machine the server is running on.
+ *
+ *      Returns:        LSN connected to the news server if
+ *                      all is ok, else -1 on error.
+ */
+
+int
+get_connection(unsigned *lana, char *machine)
+{
+	int s;
+
+	if ((s = checknet()) < 0) {
+		netperror("Net not found");
+	} else {
+		if ((s = netconnect(lana, machine, "nntp")) < 0) {
+			netperror("Trouble connecting");
+		}
+	}
+	return s;
+}
+
+void
+nethangup(unsigned lana, int lsn)
+{
+	struct _NCB ncb =
+	{0};
+
+	ncb.ncb_command = NCBHANGUP;
+	ncb.ncb_lsn = (unsigned char) lsn;
+	ncb.ncb_lana_num = lana;
+
+	passncb(&ncb);
+}
+
+unsigned char
+netcall(unsigned lana, char *lname, char *rname)
+{
+	struct _NCB ncb =
+	{0};
+
+	if (lname == NULL) {
+		/* use permanent node name */
+		if (netpname(lana, ncb.ncb_name) < 0) {
+			return 0;
+		}
+	} else {
+		if ((netaddname(lana, lname) < 0) &&
+			 (neterrno != NRC_DUPNAME)) {
+			return 0;
+		}
+		memcpy(ncb.ncb_name, (char *) lname, NCBNAMSZ);
+	}
+
+	ncb.ncb_command = NCBCALL;
+	ncb.ncb_lana_num = lana;
+	memcpy(ncb.ncb_callname, (char *) rname, NCBNAMSZ);
+
+	rc = passncb(&ncb);
+
+	if (rc < 0)
+		rc = 0;
+	else
+		rc = ncb.ncb_lsn;
+
+	return rc;
+}
+
+int
+netconnect(unsigned *lana, char *rname, char *service)
+{
+	char callname[NCBNAMSZ];
+	unsigned lsn = 0;
+	int saverr;
+	int i;
+	LANA_ENUM lenum =
+	{0};
+
+	/* find the valid lana numbers for the network */
+	if (netlana(&lenum) == 0) {
+		perror("No adapters found");
+		return -1;
+	}
+	memset(callname, '\0', NCBNAMSZ);
+	strncpy(callname, rname, HOSTNAMSZ);
+	strcat(callname, ".srv");
+
+	// Try to connect to the service using the valid lana numbers
+	for (i = 0; i < lenum.length; i++) {
+		if ((resetnet(lenum.lana[i]) != -1) && ((lsn = netcall(lenum.lana[i], NULL, callname)) != (unsigned char) 0))
+			break;
+	}
+
+	/* Failed ... */
+	if (i == lenum.length) {
+		*lana = 0;
+		return -1;
+	} else {
+		/* Found.. */
+		*lana = lenum.lana[i];
+	}
+
+	/* tell the server daemon what service we want */
+	if (netsend(*lana, lsn, service, strlen(service) + 1) != -1) {
+		if (netreceive(*lana, lsn, callname, 1) != -1) {
+			if (*callname == ACK_CHAR) {
+				return lsn;
+			}
+		}
+	}
+	nethangup(*lana, lsn);
+	*lana = 0;
+	saverr = neterrno;
+	neterrno = saverr;
+	return -1;
+}
+
+int
+netpname(unsigned lana, char *pname)
+{
+	ADAPTER_STATUS stats =
+	{0};
+	struct _NCB ncb =
+	{0};
+
+	ncb.ncb_command = NCBASTAT;
+	ncb.ncb_lana_num = lana;
+	ncb.ncb_callname[0] = '*';
+	ncb.ncb_length = sizeof (ADAPTER_STATUS);
+	ncb.ncb_buffer = (char *) &stats;
+
+	memset(stats.adapter_address, 0, 6);
+
+	if (passncb(&ncb) < 0)
+		rc = -1;
+	else {
+		memset(pname, '\0', 10);
+		memcpy(pname + 10, stats.adapter_address, 6);
+		rc = 0;
+	}
+
+	return rc;
+}
+
+/*
+   ** This function needs to calculate the 'real' number of bytes returned
+   ** into the buffer.
+ */
+int
+netreceive(unsigned lana, int lsn, char *data, unsigned nbytes)
+{
+	struct _NCB ncb =
+	{0};
+	char buffer[PACKET_SIZE + 1] =
+	{0};
+
+	ncb.ncb_command = NCBRECV;
+#ifdef XNS_ASYNC
+	ncb.ncb_command |= ASYNCH;
+#endif
+	ncb.ncb_lana_num = lana;
+	ncb.ncb_lsn = (unsigned char) lsn;
+	ncb.ncb_length = nbytes;
+	ncb.ncb_buffer = (char *) buffer;
+
+	rc = passncb(&ncb);
+
+	if (rc < 0)
+		rc = -1;
+	else {
+		if (nbytes == 1) {
+			rc = 1;
+			*data = *buffer;
+		} else {
+			rc = strlen(buffer);
+			memcpy(data, buffer, rc);
+		}
+	}
+
+	return rc;
+}
+
+int
+netsend(unsigned lana, int lsn, char *data, unsigned nbytes)
+{
+	struct _NCB ncb =
+	{0};
+	char buffer[PACKET_SIZE + 1];
+
+	if (nbytes == 0) {
+		neterrno = NRC_BUFLEN;
+		return -1;
+	}
+	memcpy(buffer, (char *) data, nbytes);
+
+	ncb.ncb_command = NCBSEND;
+#ifdef XNS_ASYNC
+	ncb.ncb_command |= ASYNCH;
+#endif
+	ncb.ncb_lana_num = lana;
+	ncb.ncb_lsn = (unsigned char) lsn;
+	ncb.ncb_length = nbytes;
+	ncb.ncb_buffer = (char *) buffer;
+
+	rc = passncb(&ncb);
+
+	if (rc < 0)
+		rc = -1;
+	else
+		rc = ncb.ncb_length;
+
+	return rc;
+}
+
+int
+checknet(void)
+{
+	struct _NCB ncb =
+	{0};
+
+	/* Send illegal command */
+	ncb.ncb_command = 0x7f;
+
+	passncb(&ncb);
+
+	rc = neterrno;
+	if (rc == NRC_ILLCMD)
+		rc = neterrno = 0;
+
+	return rc;
+}
+
+int
+resetnet(unsigned lana)
+{
+	struct _NCB ncb =
+	{0};
+
+	// Send a RESET for a specific LANA number.
+	ncb.ncb_command = NCBRESET;
+	ncb.ncb_lana_num = lana;
+	ncb.ncb_lsn = 0;
+
+	ncb.ncb_callname[0] = (unsigned char) 16;		// 16 sessions
+
+	ncb.ncb_callname[1] = (unsigned char) 255;	// 255 commands
+
+	ncb.ncb_callname[2] = (unsigned char) 8;	// 8 names
+
+	ncb.ncb_callname[3] = (unsigned char) 1;	// Request non-perm node name
+
+	rc = passncb(&ncb);
+
+	rc = neterrno;
+	if (rc != NRC_GOODRET)
+		rc = neterrno = -1;
+
+	return rc;
+}
+
+int
+netlana(LANA_ENUM * plenum)
+{
+	struct _NCB ncb =
+	{0};
+
+	/* Send a ENUM to get the network numbers */
+	ncb.ncb_command = NCBENUM;
+	ncb.ncb_length = sizeof (LANA_ENUM);
+	ncb.ncb_buffer = (unsigned char *) plenum;
+	if (ncb.ncb_buffer == (unsigned char *) NULL) {
+		rc = neterrno = -1;
+		return rc;
+	}
+	passncb(&ncb);
+
+	rc = plenum->length;
+	if (ncb.ncb_retcode != NRC_GOODRET)
+		rc = neterrno = -1;
+
+	return rc;
+}
+
+#pragma optimize("a", on)
+#pragma optimize("gw", off)
+int
+passncb(PNCB ncb)
+{
+	if (ncb->ncb_command & ASYNCH) {
+		ncb->ncb_event = CreateEvent(NULL, FALSE, FALSE, "passncb");
+		assert(ncb->ncb_event != NULL);
+
+		neterrno = Netbios(ncb);
+
+		if (WaitForSingleObject(ncb->ncb_event, INFINITE) == WAIT_FAILED) {
+			CloseHandle(ncb->ncb_event);
+			return -1;
+		}
+		CloseHandle(ncb->ncb_event);
+	} else {
+		neterrno = Netbios(ncb);
+	}
+
+	if (neterrno && neterrno != NRC_INCOMP)
+		return -1;
+	else
+		return 0;
+}
+#pragma optimize("gw", on)
+#pragma optimize("a", off)
+
+void
+netperror(char *wintitle)
+{
+	fprintf(stderr, "%s (NetBIOS code 0x%x)\n", wintitle, neterrno);
+	neterrno = 0;
+}
+
+#endif /* WIN32XNS */
+
+#endif /* WIN32 */
diff -Nur tin-980117/old/os_2.c tin-980202/old/os_2.c
--- tin-980117/old/os_2.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/old/os_2.c	Sat Jan 31 11:18:33 1998
@@ -0,0 +1,444 @@
+/*
+ *  Project   : tin - a Usenet reader
+ *  Module    : os_2.c
+ *  Author    : A.Wrede & I.Lea
+ *  Created   : 05-07-93
+ *  Updated   : 02-11-93
+ *  Notes     : Extra functions for OS/2 port
+ *  Copyright : (c) Copyright 1991-94 by Andreas Wrede & Iain Lea
+ *              You may  freely  copy or  redistribute  this software,
+ *              so  long as there is no profit made from its use, sale
+ *              trade or  reproduction.  You may not change this copy-
+ *              right notice, and it must be included in any copy made
+ */
+
+#include	"tin.h"
+#include	"version.h"
+
+#if defined(M_OS2)
+
+#include "os_2.h"
+
+struct passwd no_pw =
+{
+	"OS2User",
+	"x",
+	1,
+	1,
+	"",
+	"OS/2 User",
+	"OS/2 User",
+	"C:/",
+	"CMD"
+};
+
+char *optarg;
+FILE *_pwf;
+int fakepw = 1;
+int optind = 1;
+
+/*
+ * stub for tputs
+ */
+
+#ifndef INDEX_DAEMON
+
+int
+tputs(str, zzz, func)
+	register char *str;
+	int zzz;
+	OutcPtr func;
+{
+	if (!str) {
+		return 0;
+	}
+	if (func == outchar) {
+		my_fputs(str, stdout);
+	} else {
+		while (*str) {
+			if (*str == '\n') {
+				func('\r');
+			}
+			func(*str++);
+		}
+	}
+	return 0;						  /* OK */
+}
+
+#endif
+
+void
+backslash(
+				char *ptr)
+{
+	while (*ptr) {
+		if (*ptr == '/') {
+			*ptr = '\\';
+		}
+		ptr++;
+	}
+}
+
+/*
+ * joinpath tacks a file (or sub dir) on to the end of a directory name.
+ * Have to check existing / or \ to avoid doubling them.
+ */
+
+void
+joinpath(
+			  char *str,
+			  char *dir,
+			  char *file)
+{
+	char c;
+
+	if (strlen(dir) == 0) {
+		strcpy(str, file);
+		return;
+	}
+	c = dir[strlen(dir) - 1];
+	if (c == '/' || c == '\\') {
+		sprintf(str, "%s%s", dir, file);
+	} else {
+		sprintf(str, "%s/%s", dir, file);
+	}
+}
+
+#ifndef __TURBOC__
+
+FILE *
+popen(
+		  char *command,
+		  char *mode)
+{
+	return (FILE *) 0;
+}
+
+void
+pclose(
+			FILE * pipe)
+{
+	return;
+}
+
+DIR *
+opendir(
+			 const char *name)
+{
+	return NULL;
+}
+
+struct dirent *
+readdir(
+			 DIR * di)
+{
+	return NULL;
+}
+
+int
+closedir(
+			  DIR * di)
+{
+	return 0;
+}
+
+#endif /* __TURBOC__ */
+
+char
+getopt(
+			int argc,
+			char *argv[],
+			char *options)
+{
+	char c, *z;
+	static int subind = 0;
+
+	for (; optind < argc; optind++, subind = 0) {
+		if (subind == 0) {
+			c = argv[optind][0];
+			if (c != '-') {
+				return EOF;
+			}
+			subind = 1;
+		}
+		c = argv[optind][subind];
+		if (c != 0) {
+			break;
+		}
+	}
+
+	if (optind == argc) {
+		return EOF;
+	}
+	/*
+	 * get rid of funnies
+	 */
+	if (c == ':' || c == '?') {
+		return '?';
+	}
+	if ((z = strchr(options, c)) == 0) {
+		return '?';
+	}
+	if (z[1] == ':') {
+		if (argv[optind][subind + 1]) {
+			optarg = &argv[optind][subind + 1];
+		} else {
+			optarg = argv[++optind];
+		}
+		optind++;
+		subind = 0;
+		return c;
+	}
+	subind++;
+
+	return c;
+}
+
+int
+make_post_cmd(
+					 char *cmd,
+					 char *name)
+{
+	char *p;
+
+	if ((p = getenv(ENV_VAR_POSTER)) != (char *) 0) {
+		sprintf(cmd, p, name);
+	} else {
+		sprintf(cmd, DEFAULT_POSTER, name);
+	}
+
+	return 0;
+}
+
+int
+gethostname(
+				  char *name,
+				  int namelen)
+{
+	char *p;
+
+	if ((p = getenv("HOSTNAME")) == (char *) 0) {
+		errno = 1;
+		return (-1);
+	}
+	strncpy(name, p, namelen);
+
+	return (0);
+}
+
+#ifdef __TURBOC__
+
+int
+sleep(
+		  int sec)
+{
+	DosSleep(sec * 1000);
+	return;
+}
+
+#endif /* __TURBOC__ */
+
+struct passwd *
+fakepwent(void)
+{
+	if (!fakepw) {
+		return (struct passwd *) 0;
+	}
+	fakepw = 0;
+	if ((no_pw.pw_name = getenv("USER")) == NULL) {
+		no_pw.pw_name = "OS2USER";
+	}
+	no_pw.pw_uid = 1;
+	no_pw.pw_gid = 1;
+	no_pw.pw_age = "";
+	if ((no_pw.pw_comment = getenv("REALNAME")) == NULL) {
+		no_pw.pw_comment = "OS2 User";
+	}
+	no_pw.pw_gecos = no_pw.pw_comment;
+	if ((no_pw.pw_dir = getenv("HOME")) == NULL) {
+		no_pw.pw_dir = "C:";
+	}
+	if ((no_pw.pw_shell = getenv("SHELL")) == NULL) {
+		if ((no_pw.pw_shell = getenv("COMSPEC")) == NULL) {
+			no_pw.pw_shell = "CMD.EXE";
+		}
+	}
+	return (&no_pw);
+}
+
+struct passwd *
+getpwent(void)
+{
+	char pwn[512];
+
+	if (!_pwf) {
+		if (getenv("ETC") == NULL) {
+			return (fakepwent());
+		}
+		sprintf(pwn, "%s/passwd", getenv("ETC"));
+		if ((_pwf = fopen(pwn, "r")) == NULL) {
+			return (fakepwent());
+		}
+	}
+	return (fgetpwent(_pwf));
+}
+
+struct passwd *
+getpwuid(
+			  uid_t uid)
+{
+	struct passwd *pw;
+
+	endpwent();
+	while (1) {
+		pw = getpwent();
+		if ((!pw) || (pw->pw_uid == uid)) {
+			return (pw);
+		}
+	}
+
+	return NULL;
+}
+
+struct passwd *
+getpwnam(
+			  const char *name)
+{
+	struct passwd *pw;
+
+	endpwent();
+
+	while (1) {
+		pw = getpwent();
+		if ((!pw) || STRCMPEQ(pw->pw_name, name)) {
+			return (
+						 }
+						 }
+
+						 return NULL;
+						 }
+
+						 void
+						 setpwent(void) {
+						 if (_pwf) {
+						 rewind(_pwf);
+						 }
+						 }
+
+						 void
+						 endpwent(void) {
+						 if (_pwf) {
+						 fclose(_pwf);
+						 _pwf = NULL;
+						 }
+						 fakepw = 1;
+						 }
+
+						 struct passwd *
+						 fgetpwent(
+										 FILE * f) {
+						 char *line;
+						 static char pwe[512];
+						 static struct passwd _pw;
+
+						 if (fgets(pwe, sizeof (pwe), f) == NULL) {
+						 return (fakepwent());
+						 }
+
+						 line = pwe;
+						 if (line[strlen(line) - 1] == '\n') {
+						 line[strlen(line) - 1] = 0;
+						 }
+						 if (line[strlen(line) - 1] == '\r') {
+						 line[strlen(line) - 1] = 0;
+						 }
+						 _pw.pw_name = line;
+						 while ((*line) && (*line != ':')) {
+						 line++;
+						 }
+						 if (!*line) {
+						 return (struct passwd *) 0;
+						 }
+						 *line = 0;
+						 _pw.pw_passwd = ++line;
+						 while ((*line) && (*line != ':')) {
+						 line++;
+						 }
+						 if (!*line) {
+						 return (struct passwd *) 0;
+						 }
+						 *line = 0;
+						 _pw.pw_uid = atoi(++line);
+						 while ((*line) && (*line != ':')) {
+						 line++;
+						 }
+						 if (!*line) {
+						 return (struct passwd *) 0;
+						 }
+						 *line = 0;
+						 _pw.pw_gid = atoi(++line);
+						 while ((*line) && (*line != ':')) {
+						 line++;
+						 }
+						 if (!*line) {
+						 return (struct passwd *) 0;
+						 }
+						 *line = 0;
+						 _pw.pw_age = "";
+						 _pw.pw_comment = ++line;
+						 _pw.pw_gecos = line;
+						 while ((*line) && (*line != ':')) {
+						 line++;
+						 }
+						 if (!*line) {
+						 return (struct passwd *) 0;
+						 }
+						 *line = 0;
+						 _pw.pw_dir = ++line;
+						 if ((_pw.pw_dir[1] == ':') &&
+							  (tolower((unsigned char) _pw.pw_dir[0]) >= 'c') &&
+							  (tolower((unsigned char) _pw.pw_dir[0]) <= 'z')) {
+						 line += 2;
+						 }
+						 while ((*line) && (*line != ':')) {
+						 line++;
+						 }
+						 if (!*line) {
+						 return (struct passwd *) 0;
+						 }
+						 *line = 0;
+						 _pw.pw_shell = ++line;
+
+						 return (&_pw);
+						 }
+
+						 int
+						 putpwent(
+										const struct passwd *pwd,
+										FILE * f) {
+						 return (-1);
+						 }
+
+						 char *
+						 getlogin(void) {
+						 char *p;
+
+						 if ((p = getenv("USER")) == NULL) {
+						 return (char *) 0;
+						 }
+
+						 return (p);
+						 }
+
+						 int
+						 getuid(void) {
+						 char *p;
+
+						 if ((p = getenv("UID")) == NULL) {
+						 return (0);  /* pretend we are root */
+						 }
+
+						 return atoi(p);
+						 }
+
+#endif /* M_OS2 */
diff -Nur tin-980117/old/os_2.h tin-980202/old/os_2.h
--- tin-980117/old/os_2.h	Thu Jan  1 01:00:00 1970
+++ tin-980202/old/os_2.h	Sat Jan 31 11:19:17 1998
@@ -0,0 +1,102 @@
+/*
+ *  Project   : tin - a Usenet reader
+ *  Module    : os_2.h
+ *  Author    : A.Wrede & I.Lea
+ *  Created   : 05-07-92
+ *  Updated   : 22-08-92
+ *  Notes     : Directory support for OS/2
+ *  Copyright : (c) Copyright 1991-94 by Andreas Wrede & Iain Lea
+ *              You may  freely  copy or  redistribute  this software,
+ *              so  long as there is no profit made from its use, sale
+ *              trade or  reproduction.  You may not change this copy-
+ *              right notice, and it must be included in any copy made
+ */
+
+#if defined(M_OS2)
+
+#ifndef OS_2_H
+#define OS_2_H
+
+#include <io.h>
+#include <process.h>
+
+#define	INCL_KBD
+
+#ifdef __TURBOC__
+#define	INCL_NOPMAPI
+#define	INCL_DOSPROCESS
+
+APIRET APIENTRY DosSleep(ULONG msec);
+
+#endif
+
+#define popen _popen
+#define pclose _pclose
+
+#define	NOBSD
+#undef	BSD						  /* stupid define in IBM libs ? */
+
+#define	u_char	unsigned char
+#define	u_short	unsigned short
+#define	u_long	unsigned long
+
+typedef int uid_t;
+typedef int gid_t;
+
+struct dirent {
+	char d_name[256];
+};
+
+typedef struct {
+	unsigned long _d_hdir;
+	char *_d_dirname;
+	unsigned _d_magic;
+	unsigned _d_nfiles;
+	char *_d_bufp;
+	char _d_buf[512];
+} DIR;
+
+struct passwd {
+	char *pw_name;
+	char *pw_passwd;
+	uid_t pw_uid;
+	gid_t pw_gid;
+	char *pw_age;
+	char *pw_comment;
+	char *pw_gecos;
+	char *pw_dir;
+	char *pw_shell;
+};
+
+#if !defined(_POSIX_SOURCE)
+
+struct comment {
+	char *c_dept;
+	char *c_name;
+	char *c_acct;
+	char *c_bin;
+};
+
+#endif /* _POSIX_SOURCE */
+
+extern int closedir(DIR * __dir);
+extern char getopt(int argc, char *argv[], char *options);
+extern void endpwent(void);
+extern struct passwd *fgetpwent(FILE *);
+extern char *getlogin(void);
+extern struct passwd *getpwent(void);
+extern struct passwd *getpwuid(uid_t);
+extern struct passwd *getpwnam(const char *);
+extern int getuid(void);
+extern void backslash(char *ptr);
+extern int make_post_cmd(char *cmd, char *name);
+extern int make_post_process_cmd(char *cmd, char *dir, char *file);
+extern DIR *opendir(const char *__dirname);
+extern int putpwent(const struct passwd *, FILE *);
+extern struct dirent *readdir(DIR * __dir);
+extern void rewinddir(DIR * __dir);
+extern void setpwent(void);
+
+#endif /* OS_2_H */
+
+#endif /* M_OS2 */
diff -Nur tin-980117/old/win32.c tin-980202/old/win32.c
--- tin-980117/old/win32.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/old/win32.c	Sun Feb  1 08:22:52 1998
@@ -0,0 +1,705 @@
+/*
+ *  Project   : tin - a Usenet reader
+ *  Module    : win32.c
+ *  Author    : S. Lam, D. Derbyshire, T. Loebach, N. Ellis, P. Haken
+ *  Created   : 01-06-87
+ *  Updated   : 10-17-94
+ *  Notes     : Berkeley-style directory reading routine on Windows NT
+ *          Console <-> Curses mapping layer.
+ *  Copyright : (c) Copyright 1987-94 by Sam Lam, Drew Derbyshire, Tom Loebach
+ *              You may  freely  copy or  redistribute  this software,
+ *              so  long as there is no profit made from its use, sale
+ *              trade or  reproduction.  You may not change this copy-
+ *              right notice, and it must be included in any copy made
+ */
+
+#include "tin.h"
+
+#if defined(WIN32)
+
+/*
+ * Windows/NT include files
+ */
+
+#define INCL_BASE
+
+#include <time.h>
+
+#ifdef ERR
+#undef ERR
+#endif
+
+#define ERR(s, c)	if (opterr) {\
+	    fprintf(stderr, "%s%s%c\n", argv[0], s, c);}
+
+int currentfile();
+
+typedef struct {
+	DIR dir;
+	char *pathname;
+	HANDLE dirHandle;
+	WIN32_FIND_DATA dirData;
+} XDIR;
+
+BOOL inverse_okay = TRUE;
+BOOL _hp_glitch = FALSE;
+
+char TMPDIR[MAX_PATH];
+
+int opterr = 1;
+int optind = 1;
+int optopt;
+char *optarg;
+
+struct passwd no_pw =
+{0};
+char szHomeDir[MAX_PATH];
+
+static int curX, curY;
+static WORD curAttr, baseAttr;
+
+int cLINES, cCOLS;
+
+int raw = TRUE;
+
+static HANDLE hConIn, hConOut;
+static CONSOLE_SCREEN_BUFFER_INFO csInfo;
+
+/*
+ * Open a directory
+ */
+
+DIR *
+opendirx(const char *dirname, char *pattern)
+{
+	XDIR *dirp;
+	char *pathname;
+	HANDLE dirHandle;
+	WIN32_FIND_DATA dirData;
+
+	pathname = malloc(strlen(dirname) + strlen(pattern) + 2);
+	strcpy(pathname, dirname);
+	if ((*pattern != '\\') || (dirname[strlen(dirname) - 1] != '\\')) {
+		strcat(pathname, "\\");
+	}
+	strcat(pathname, pattern);	  // Read the first file in the directory
+
+	dirHandle = FindFirstFile(pathname, &dirData);
+	if ((int) dirHandle == -1) {
+		return NULL;
+	} else {
+		dirp = malloc(sizeof (XDIR));
+		dirp->dir.dirfirst = 1;
+		strcpy(dirp->dir.dirid, "DIR");
+		dirp->dirHandle = dirHandle;
+		dirp->dirData = dirData;
+		dirp->pathname = pathname;
+		return (DIR *) dirp;
+	}
+}
+/*
+ * Get next entry in a directory
+ */
+struct direct *
+readdir(DIR * dirp)
+{
+	BOOL rc;
+	XDIR *xdirp = (XDIR *) dirp;
+
+	assert(strcmp(xdirp->dir.dirid, "DIR") == 0);
+	if (xdirp->dir.dirfirst) {
+		xdirp->dir.dirfirst = 0;
+	} else {
+		rc = FindNextFile(xdirp->dirHandle, &xdirp->dirData);
+	}
+	if (!strcmp(xdirp->dirData.cFileName, ".")) {
+		rc = FindNextFile(xdirp->dirHandle, &xdirp->dirData);
+	}
+	if (!strcmp(xdirp->dirData.cFileName, "..")) {
+		rc = FindNextFile(xdirp->dirHandle, &xdirp->dirData);
+	}
+	if (rc) {
+		xdirp->dir.dirent.d_ino = -1;		/*
+													   * no inode information
+													 */
+		strlwr(strcpy(xdirp->dir.dirent.d_name, xdirp->dirData.cFileName));
+		xdirp->dir.dirent.d_namlen = strlen(xdirp->dirData.cFileName);
+		xdirp->dir.dirent.d_reclen = sizeof (struct direct) - (MAXNAMLEN + 1) +
+		       ((((xdirp->dir.dirent.d_namlen + 1) + 3) / 4) * 4);
+
+		return &(xdirp->dir.dirent);
+	} else {
+		return NULL;
+	}
+}
+/*
+ * Close a directory
+ */
+void
+closedir(DIR * dirp)
+{
+	BOOL rc;
+	XDIR *xdirp = (XDIR *) dirp;
+
+	assert(strcmp(xdirp->dir.dirid, "DIR") == 0);
+	rc = FindClose(xdirp->dirHandle);
+	free(xdirp->pathname);
+	free(xdirp);
+	dirp = NULL;
+}
+
+char
+getopt(int argc, char *argv[], char *opts)
+{
+	static int sp = 1;
+	register int c;
+	register char *cp;
+
+	if (sp == 1)
+		if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0')
+			return (EOF);
+		else if (strcmp(argv[optind], "--") == 0) {
+			optind++;
+			return (EOF);
+		}
+	optopt = c = argv[optind][sp];
+	if (c == ':' || (cp = strchr(opts, c)) == NULL) {
+		ERR(": illegal option -- ", c);
+		if (argv[optind][++sp] == '\0') {
+			optind++;
+			sp = 1;
+		}
+		return ('?');
+	}
+	if (*++cp == ':') {
+		if (argv[optind][sp + 1] != '\0')
+			optarg = &argv[optind++][sp + 1];
+		else if (++optind >= argc) {
+			ERR(": option requires an argument -- ", c);
+			sp = 1;
+			return ('?');
+		} else
+			optarg = argv[optind++];
+		sp = 1;
+	} else {
+		if (argv[optind][++sp] == '\0') {
+			sp = 1;
+			optind++;
+		}
+		optarg = NULL;
+	}
+	return (c);
+}
+/*
+ * joinpath tacks a file (or sub dir) on to the end of a directory name.
+ * Have to check existing / or \ to avoid doubling them.
+ */
+
+void
+joinpath(char *str, char *dir, char *file)
+{
+	char c;
+	struct passwd *pw;
+
+	if (strlen(dir) == 0) {
+		strcpy(str, file);
+		return;
+	}
+	if (file[0] == '.')
+		file++;
+
+	if (dir[0] == '~') {
+		if (no_pw.pw_dir == NULL)
+			pw = getpwnam(getlogin());
+		else
+			pw = &no_pw;
+
+		strcpy(str, pw->pw_dir);
+		dir++;
+		str += strlen(str);
+	}
+	c = dir[strlen(dir) - 1];
+	if (c == '/' || c == '\\') {
+		sprintf(str, "%s%s", dir, file);
+	} else {
+		sprintf(str, "%s\\%s", dir, file);
+	}
+}
+
+int
+make_post_cmd(char *cmd, char *name)
+{
+	char *p;
+
+	if ((p = getenv(ENV_VAR_POSTER)) != (char *) 0) {
+		sprintf(cmd, p, name);
+	} else {
+		sprintf(cmd, DEFAULT_POSTER, name);
+	}
+
+	return 0;
+}
+
+long
+getpid()
+{
+	return GetCurrentProcessId();
+}
+int
+getgid()
+{
+	return 1;
+}
+int
+getuid()
+{
+	return 1;
+}
+int
+setgid(int id)
+{
+	return 1;
+}
+int
+setuid(int id)
+{
+	return 1;
+}
+int
+getegid()
+{
+	return 1;
+}
+int
+geteuid()
+{
+	return 1;
+}
+
+#pragma warning( disable: 4035 )
+struct passwd *
+getpwuid(int id)
+{
+	fprintf(stderr, "\nYou must set the environment variable USERNAME");
+	exit(1);
+}
+
+#pragma warning( default: 4035 )
+
+char *
+getlogin(void)
+{
+	return getenv("USERNAME");
+}
+
+struct passwd *
+getpwnam(const char *name)
+{
+	char *env;
+
+	if (!(env = getenv("USERNAME"))) {
+		fprintf(stderr, "\nYou must set the environment variable USERNAME");
+		exit(1);
+	}
+	no_pw.pw_name = no_pw.pw_gecos = env;
+
+	if (!(env = getenv("HOMEDRIVE"))) {
+		fprintf(stderr, "\nYou must set the environment variable HOMEDRIVE");
+		exit(1);
+	}
+	strcpy(szHomeDir, env);
+
+	if (!(env = getenv("HOMEPATH"))) {
+		fprintf(stderr, "\nYou must set the environment variable HOMEPATH");
+		exit(1);
+	}
+	strcat(szHomeDir, env);
+	no_pw.pw_dir = szHomeDir;
+
+	return &no_pw;
+}
+
+void
+setup_screen()
+{
+	int cols, lines;
+
+	cmd_line = FALSE;
+// setupterm();
+	cols = cCOLS;
+	lines = cLINES;
+	ClearScreen();
+	set_win_size(&lines, &cols);
+	refresh();
+}
+
+void
+set_xclick_on()
+{
+}
+
+void
+set_xclick_off()
+{
+}
+
+// Curses functionality
+
+void
+cursoron(void)
+{
+	CONSOLE_CURSOR_INFO ccinfo;
+
+	if (GetConsoleCursorInfo(hConOut, &ccinfo)) {
+		ccinfo.bVisible = TRUE;
+		SetConsoleCursorInfo(hConOut, &ccinfo);
+	}
+}
+
+void
+cursoroff(void)
+{
+	CONSOLE_CURSOR_INFO ccinfo;
+
+	if (GetConsoleCursorInfo(hConOut, &ccinfo)) {
+		ccinfo.bVisible = FALSE;
+		SetConsoleCursorInfo(hConOut, &ccinfo);
+	}
+}
+
+void
+GetConsoleCursorPosition(HANDLE hCon, COORD * pCoord)
+{
+	CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+	assert(pCoord);
+
+	GetConsoleScreenBufferInfo(hCon, &csbi);
+	*pCoord = csbi.dwCursorPosition;
+}
+
+void
+StartInverse(void)
+{
+	curAttr = baseAttr;
+	ToggleInverse();
+}
+
+void
+EndInverse(void)
+{
+	curAttr = baseAttr;
+	SetConsoleTextAttribute(hConOut, curAttr);
+}
+
+void
+ToggleInverse(void)
+{
+	short color = curAttr & 0x00FF;
+
+	curAttr = (curAttr & 0xFF00) | (color >> 4) | ((color & 0x000F) << 4);
+
+	SetConsoleTextAttribute(hConOut, curAttr);
+}
+
+void
+MoveCursor(int y, int x)
+{
+	COORD dwOrigin;
+
+	dwOrigin.X = curX = x;
+	dwOrigin.Y = curY = y;
+	SetConsoleCursorPosition(hConOut, dwOrigin);
+}
+
+void
+addch(UCHAR c)
+{
+	assert(hConOut != NULL);
+
+	switch (c) {
+		case '\n':
+			MoveCursor(curY + 1, curX);
+			break;
+
+		case '\r':
+			MoveCursor(curY, 0);
+			break;
+
+		case '\b':
+			if (curX > 0)
+				MoveCursor(curY, curX - 1);
+			break;
+
+		default:
+			{
+				DWORD cchWritten;
+
+				WriteConsole(hConOut, &c, 1, &cchWritten, NULL);
+				if (curX++ >= cCOLS) {
+					curX = 0;
+					curY++;
+				}
+			}
+			break;
+	}
+}
+
+// Print a line of text and draw to the end of the line
+#undef addline
+void
+addline(unsigned char *lpszStr)
+{
+	DWORD cchWritten;
+	COORD pt;
+	INT ich = strlen(lpszStr);
+
+	if (lpszStr[ich - 2] == '\r')
+		ich -= 2;
+
+	assert(hConOut != NULL);
+
+	WriteConsole(hConOut, lpszStr, ich, &cchWritten, NULL);
+
+	GetConsoleCursorPosition(hConOut, &pt);
+	MoveCursor(pt.Y, pt.X);
+
+	CleartoEOLN();
+}
+
+void
+addstr(unsigned char *lpszStr)
+{
+	DWORD cchWritten;
+	COORD pt;
+
+	assert(hConOut != NULL);
+
+	WriteConsole(hConOut, lpszStr, strlen(lpszStr), &cchWritten, NULL);
+
+	GetConsoleCursorPosition(hConOut, &pt);
+	MoveCursor(pt.Y, pt.X);
+}
+
+void
+CleartoEOS(void)
+{
+	CONSOLE_SCREEN_BUFFER_INFO csInfo;
+	DWORD cCharCells;				  /* number of character cells to write to  */
+	COORD coordChar;				  /* x- and y-coordinates of first cell  */
+	DWORD cWritten;
+
+	coordChar.X = 0;
+	coordChar.Y = curY;
+
+	cCharCells = cCOLS * (cLINES + 1 - curY);
+
+	GetConsoleScreenBufferInfo(hConOut, &csInfo);
+
+	baseAttr = curAttr = csInfo.wAttributes;
+
+	FillConsoleOutputCharacter(hConOut, ' ', cCharCells, coordChar, &cWritten);
+	FillConsoleOutputAttribute(hConOut, curAttr, cCharCells, coordChar, &cWritten);
+}
+
+void
+CleartoEOLN(void)
+{
+	DWORD cCharCells;				  /* number of character cells to write to  */
+	COORD coordChar;				  /* x- and y-coordinates of first cell  */
+	DWORD cWritten;
+
+	coordChar.X = curX;
+	coordChar.Y = curY;
+
+	cCharCells = cCOLS - curX;
+
+	FillConsoleOutputCharacter(hConOut, ' ', cCharCells, coordChar, &cWritten);
+	FillConsoleOutputAttribute(hConOut, curAttr, cCharCells, coordChar, &cWritten);
+}
+
+int
+InitScreen(void)
+{
+	hConIn = GetStdHandle(STD_INPUT_HANDLE);
+	hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
+
+	GetConsoleScreenBufferInfo(hConOut, &csInfo);
+
+	baseAttr = curAttr = csInfo.wAttributes;
+#ifdef USE_WINDOW_BUFFER_SIZE
+	cLINES = csInfo.dwSize.Y - 1;
+	cCOLS = csInfo.dwSize.X;
+#else
+	{
+		COORD wCoord;
+
+		cLINES = csInfo.srWindow.Bottom - csInfo.srWindow.Top;
+		cCOLS = csInfo.srWindow.Right - csInfo.srWindow.Left + 1;
+		wCoord.Y = cLINES;
+		wCoord.X = cCOLS;
+		SetConsoleScreenBufferSize(hConOut, wCoord);
+	}
+#endif
+
+	return -1;
+}
+
+void
+ClearScreen(void)
+{
+	MoveCursor(0, 0);
+	CleartoEOS();
+}
+
+void
+refresh(void)
+{
+}
+
+void
+InitWin(void)
+{
+}
+
+void
+EndWin(void)
+{
+#ifndef USE_WINDOW_BUFFER_SIZE
+	COORD wCoord;
+
+	wCoord.Y = csInfo.dwSize.Y;
+	wCoord.X = csInfo.dwSize.X;
+	SetConsoleScreenBufferSize(hConOut, wCoord);
+#endif
+}
+
+int
+RawState(void)
+{
+	return raw;
+}
+
+void
+Raw(int f)
+{
+	raw = f;
+}
+
+int
+ReadCh(void)
+{
+	INPUT_RECORD irBuffer;
+	DWORD cRead;
+	BOOL fOkay;
+
+	DWORD dwMode;
+	DWORD dwModeSave = 0L;
+
+	assert(hConIn != NULL);
+
+	if (GetConsoleMode(hConIn, &dwMode)) {
+		dwModeSave = dwMode;
+		dwMode &= ~ENABLE_LINE_INPUT;
+		if (raw)
+			dwMode &= ~ENABLE_ECHO_INPUT;
+		SetConsoleMode(hConIn, dwMode);
+	}
+	do {
+		WaitForSingleObject(hConIn, INFINITE);
+		fOkay = ReadConsoleInput(hConIn, &irBuffer, 1, &cRead);
+	} while (
+				  (irBuffer.EventType != KEY_EVENT) ||
+				  (!irBuffer.Event.KeyEvent.bKeyDown) ||
+				  ((irBuffer.Event.KeyEvent.wVirtualKeyCode >= VK_SHIFT) &&
+					(irBuffer.Event.KeyEvent.wVirtualKeyCode <= VK_CAPITAL)));
+
+	if (dwModeSave)
+		SetConsoleMode(hConIn, dwModeSave);
+
+	if (irBuffer.Event.KeyEvent.uChar.AsciiChar) {
+		return (char) irBuffer.Event.KeyEvent.uChar.AsciiChar;
+	} else {
+		if ((irBuffer.Event.KeyEvent.wVirtualKeyCode > VK_SPACE) &&
+			 (irBuffer.Event.KeyEvent.wVirtualKeyCode < VK_HELP)) {
+			return (char) irBuffer.Event.KeyEvent.wVirtualKeyCode | 0x80;
+		} else {
+			return irBuffer.Event.KeyEvent.wVirtualKeyCode;
+		}
+	}
+}
+
+/*
+ * Rename, clobber the new file if it exists.
+ */
+int
+win32rename(char *src, char *dest)
+{
+	if (MoveFile(src, dest))
+		return 0;
+	else {
+		int rc = GetLastError();
+
+		return -1;
+	}
+}
+
+/*
+ * Stuff for handling NT's inability to unlink an open file...  Grabbed from
+ * AMI sources.
+ */
+
+#define NUM_TEMP_FP 6
+static struct {
+	FILE *fp;
+	char name[PATH_LEN];
+} temp_fp[NUM_TEMP_FP];
+
+void
+log_unlink(FILE * fp, char *fname)
+{
+	int i;
+
+	for (i = 0; i < NUM_TEMP_FP; i++) {
+		if (temp_fp[i].fp == (FILE *) 0) {
+			temp_fp[i].fp = fp;
+			strcpy(temp_fp[i].name, fname);
+			break;
+		}
+	}
+}
+
+#undef fclose
+
+int
+tmp_close(FILE * fp)
+{
+	int i, ret;
+
+	ret = fclose(fp);
+	for (i = 0; i < NUM_TEMP_FP; i++) {
+		if (temp_fp[i].fp == fp) {
+			unlink(temp_fp[i].name);
+			temp_fp[i].fp = (FILE *) 0;
+			break;
+		}
+	}
+	return ret;
+}
+
+#ifdef DEBUG
+void
+DebugAssertDialog(LPSTR szMessage, DWORD dwLine, LPSTR szFile)
+{
+	char szMessageBuf[256];
+	UINT uType;
+
+	sprintf(szMessageBuf, "%s at line %ld of %s", szMessage, dwLine, szFile);
+
+	uType = MB_SYSTEMMODAL | MB_ICONSTOP | MB_OKCANCEL;
+	if (MessageBox(NULL, (LPTSTR) szMessageBuf, (LPTSTR) "Assert Failed", uType) == IDCANCEL)
+		DebugBreak();
+}
+#endif
+
+#endif /* WIN32 */
diff -Nur tin-980117/old/win32.h tin-980202/old/win32.h
--- tin-980117/old/win32.h	Thu Jan  1 01:00:00 1970
+++ tin-980202/old/win32.h	Sun Feb  1 08:23:12 1998
@@ -0,0 +1,163 @@
+/*
+ *  Project   : tin - a Usenet reader
+ *  Module    : win32.h
+ *  Author    : S.Lam, N.Ellis & P.Haken
+ *  Created   : 01-06-87
+ *  Updated   : 02-24-95
+ *  Notes     : ndir.h for MS-DOS by Samuel Lam <skl@van-bc.UUCP>, June/87
+ *              additional WIN32 support by N.Ellis and P.Haken.
+ *
+ *  Copyright : (c) Copyright 1987-93 by Samuel Lam
+ *          (c) Copyright 1994-95 by N.Ellis & P.Haken
+ *              You may  freely  copy or  redistribute  this software,
+ *              so  long as there is no profit made from its use, sale
+ *              trade or  reproduction.  You may not change this copy-
+ *              right notice, and it must be included in any copy made
+ */
+
+#if defined(WIN32)
+
+#ifndef WIN32_H
+#define WIN32_H
+
+#include <windows.h>
+#include <direct.h>
+#include <io.h>
+#include <assert.h>
+#include <malloc.h>
+
+#define MSDOS_MAXNAMLEN	12
+#define MAXNAMLEN		MSDOS_MAXNAMLEN
+
+extern char TMPDIR[MAX_PATH];
+
+#define popen _popen
+#define pclose _pclose
+#define sleep(s) Sleep(s*1000)  // WIN32 sleep is in Millseconds.
+#define pipe(a) _pipe(a,1024,0)
+#define rename(s,d) win32rename(s,d)
+
+typedef int uid_t;
+typedef int gid_t;
+
+struct direct {
+	long d_ino;
+	short d_reclen;
+	short d_namlen;
+	char d_name[MAXNAMLEN + 1];
+};
+
+typedef struct {
+	char filereserved[21];
+	char fileattr;
+	int filetime, filedate;
+	long filesize;
+	char filename[MSDOS_MAXNAMLEN + 1];
+} DTA;
+
+typedef struct {
+	char dirid[4];
+	struct direct dirent;
+	DTA dirdta;
+	int dirfirst;
+} DIR;
+
+struct passwd {
+	char *pw_name;
+	char *pw_passwd;
+	uid_t pw_uid;
+	gid_t pw_gid;
+	char *pw_age;
+	char *pw_comment;
+	char *pw_gecos;
+	char *pw_dir;
+	char *pw_shell;
+};
+
+extern char *getlogin(void);
+extern char getopt(int argc, char *argv[], char *options);
+
+extern DIR *opendirx(const char *dirname, char *pattern);
+
+// extern DIR *opendir (const char *__dirname);
+#define opendir(x) opendirx(x, "*.*")
+extern void closedir(DIR * __dir);
+extern struct direct *readdir(DIR * __dir);
+extern void rewinddir(DIR * __dir);
+
+extern int getuid(void);
+extern int geteuid(void);
+extern int getegid(void);
+extern int getgid(void);
+extern long getpid(void);
+extern int putpwent(const struct passwd *, FILE *);
+extern void endpwent(void);
+extern void setpwent(void);
+extern struct passwd *fgetpwent(FILE *);
+extern struct passwd *getpwent(void);
+extern struct passwd *getpwnam(const char *);
+extern struct passwd *getpwuid(uid_t);
+
+extern void backslash(char *ptr);
+extern int make_post_cmd(char *cmd, char *name);
+
+#define alarm(x) (1)
+
+extern void setup_screen(void);
+
+extern void set_xclick_on(void);
+extern void set_xclick_off(void);
+extern int win32rename(char *, char *);
+
+/*
+ * tmp_close will delete a file on closure if it had been opened
+ * with nntp_to_fp(). Otherwise it behaves just like fclose().
+ */
+
+extern void log_unlink(FILE * fp, char *fname);
+extern int tmp_close(FILE * fp);
+
+#define fclose(fp) tmp_close(fp)
+
+#if defined(DEBUG) && defined(CHECKHEAP)
+void DebugAssertDialog(LPSTR szMessage, DWORD dwLine, LPSTR szFile);
+_inline void
+CheckHeap(DWORD dwLine, LPSTR szFile)
+{
+	if (_heapchk() != _HEAPOK)
+		DebugAssertDialog("Invalid Heap", dwLine, szFile);
+};
+
+_inline void *__cdecl
+mymalloc(size_t cb, DWORD dwLine, LPSTR szFile)
+{
+	CheckHeap(dwLine, szFile);
+	return malloc(cb);
+};
+
+_inline void *__cdecl
+myrealloc(void *pv, size_t cb, DWORD dwLine, LPSTR szFile)
+{
+	CheckHeap(dwLine, szFile);
+	return realloc(pv, cb);
+};
+
+_inline void *__cdecl
+mycalloc(size_t cbnum, size_t cbsize, DWORD dwLine, LPSTR szFile)
+{
+	CheckHeap(dwLine, szFile);
+	return calloc(cbnum, cbsize);
+};
+
+_inline void __cdecl
+myfree(void *pv, DWORD dwLine, LPSTR szFile)
+{
+	CheckHeap(dwLine, szFile);
+	free(pv);
+	CheckHeap(dwLine, szFile);
+};
+
+#endif
+
+#endif // WIN32_H
+#endif // WIN32
diff -Nur tin-980117/old/win32tcp.c tin-980202/old/win32tcp.c
--- tin-980117/old/win32tcp.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/old/win32tcp.c	Sun Feb  1 08:23:28 1998
@@ -0,0 +1,111 @@
+/*
+ *  Project   : tin - a Usenet reader
+ *  Module    : win32tcp.c
+ *  Author    : N.Ellis
+ *  Created   : 01-10-94
+ *  Updated   : 07-11-94
+ *  Notes     :
+ *  Copyright : (c) Copyright 1991-94 by Nigel Ellis
+ *              You may  freely  copy or  redistribute  this software,
+ *              so  long as there is no profit made from its use, sale
+ *              trade or  reproduction.  You may not change this copy-
+ *              right notice, and it must be included in any copy made
+ */
+
+#include "tin.h"
+
+#if defined(WIN32) && defined(NNTP_ABLE)
+
+#include "win32tcp.h"
+#include <winsock.h>
+
+#define	cmemBlock	(8*1024)
+static char memBlock[cmemBlock + 4];
+static UINT imemBlock = 0;
+static UINT iendBlock = 0;
+
+static TCP mytcp;
+
+static int sock_dups;
+
+int
+s_init()
+{
+	WSADATA wsaData;
+
+	if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) {
+		return 0;
+	}
+	return 1;
+}
+
+TCP *
+s_fdopen(int s, const char *mode)
+{
+	mytcp.fd = s;
+	return &mytcp;
+}
+
+void
+s_fclose(TCP * tp)
+{
+	s_close(tp->fd);
+}
+
+void
+s_close(int s)
+{
+	if (--sock_dups[s] <= 0)
+		closesocket(s);
+}
+
+int
+s_dup(int fd)
+{
+	sock_dups[fd]++;
+	return fd;
+}
+
+char *
+s_gets(LPSTR nntp_line, DWORD length, TCP * tp)
+{
+	DWORD cbRead = 0, cb;
+	char *pEol;
+
+	if (imemBlock == iendBlock) {
+		pEol = 0;
+	} else {
+		pEol = strstr(memBlock + imemBlock, "\r\n");		/* search for a newline */
+		if (pEol > memBlock + iendBlock - 2)	/* if one was found outside the buffer */
+			pEol = 0;				  /* then we didn't really find one */
+	}
+
+	if (!pEol) {
+		iendBlock -= imemBlock;
+		if (iendBlock)
+			memcpy(memBlock, memBlock + imemBlock, iendBlock);
+		imemBlock = 0;
+		do {
+			cbRead = recv(nntp_rd_fp, memBlock + iendBlock, cmemBlock - iendBlock, 0);
+			if (cbRead == 0 || cbRead == SOCKET_ERROR) {
+				errno = SOCKET_ERROR;
+				return (char *) NULL;
+			}
+			iendBlock += cbRead;
+
+			pEol = strstr(memBlock, "\r\n");		// search for a newline
+
+		} while (pEol > memBlock + iendBlock - 2);
+	}
+	cb = pEol - (memBlock + imemBlock);
+
+	memcpy(nntp_line, memBlock + imemBlock, cb);
+	nntp_line[cb] = '\0';
+	imemBlock += cb + 2;
+
+	assert(imemBlock <= iendBlock);
+
+	return nntp_line;
+}
+
+#endif /* WIN32 */
diff -Nur tin-980117/old/win32tcp.h tin-980202/old/win32tcp.h
--- tin-980117/old/win32tcp.h	Thu Jan  1 01:00:00 1970
+++ tin-980202/old/win32tcp.h	Sat Jan 31 11:19:17 1998
@@ -0,0 +1,32 @@
+/*
+ *  Project   : tin - a Usenet reader
+ *  Module    : win32tcp.c
+ *  Author    : N.Ellis
+ *  Created   : 01-10-94
+ *  Updated   : 04-11-94
+ *  Notes     :
+ *  Copyright : (c) Copyright 1991-94 by Nigel Ellis
+ *              You may  freely  copy or  redistribute  this software,
+ *              so  long as there is no profit made from its use, sale
+ *              trade or  reproduction.  You may not change this copy-
+ *              right notice, and it must be included in any copy made
+ */
+
+#ifdef WIN32
+
+#define	s_printf
+#define	s_flush
+#define	s_puts
+#define	s_end()
+
+typedef struct {
+	int fd;
+} TCP;
+
+int s_init(void);
+TCP *s_fdopen(int s, const char *mode);
+void s_close(int s);
+int s_dup(int fd);
+char *s_gets(LPSTR nntp_line, DWORD length, TCP * tp);
+
+#endif /* WIN32 */
diff -Nur tin-980117/pcre/pcre.mms tin-980202/pcre/pcre.mms
--- tin-980117/pcre/pcre.mms	Thu Jan  1 01:00:00 1970
+++ tin-980202/pcre/pcre.mms	Sun Feb  1 08:47:24 1998
@@ -0,0 +1,85 @@
+#
+# MMS description file for PCRE routines of TIN
+#
+
+.IFDEF VAXC
+CC = cc
+.ELSE
+.IFDEF GNUC
+CC = gcc
+.ELSE
+CC = cc/decc
+.ENDIF
+.ENDIF
+
+.IFDEF DEBUG
+DBG             = /debug /nooptim
+.ELSE # not debug
+
+.IFDEF VAXC
+DBG             = /optim
+.ELSE
+.IFDEF GNUC
+DBG             = /optim=2
+.ELSE
+DBG             = /optim
+.ENDIF
+.ENDIF
+
+.ENDIF
+
+.IFDEF VAXC
+OPTS            =
+.ELSE
+.IFDEF GNUC
+OPTS            =
+.ELSE
+OPTS            = /warning=(disable=implicitfunc) /prefix=all
+.ENDIF
+.ENDIF
+
+# CFLAGS= $(DBG) $(OPTS) /include=([])
+CFLAGS= $(DBG) $(OPTS)
+
+MODULES = chartables, study, pcre
+
+OBJECTS = $(MODULES:.obj)
+
+LIB = pcrelib$(OLB)
+
+all : $(LIB)($(MODULES))
+    @ WRITE SYS$OUTPUT "Built $(LIB)"
+
+clean :
+    @ WRITE SYS$OUTPUT "Cleaning $(LIB)"
+    @ if f$search("*.obj;*") .nes. "" then Delete/Log *.obj;*
+    @ if f$search("*.olb;*") .nes. "" then Delete/Log *.olb;*
+    @ if f$search("*.lis;*") .nes. "" then Delete/Log *.lis;*
+    @ if f$search("chartables.c;*") .nes. "" then Delete/Log chartables.c;*
+    @ if f$search("maketables.exe;*") .nes. "" then Delete/Log maketables.exe;*
+
+.IFDEF DECC
+.ELSE
+.FIRST :
+	define sys sys$library
+
+.LAST :
+	deassign sys
+.ENDIF
+
+pcre.obj :         pcre.c pcre.h internal.h
+chartables.obj :   chartables.c
+study.obj :        study.c pcre.h internal.h
+maketables.obj :   maketables.c
+
+# An auxiliary program makes the character tables
+
+chartables.c :    maketables.exe
+        CURRENT_OUTPUT = f$trnlnm("SYS$OUTPUT")
+	DEFINE SYS$OUTPUT chartables.c
+	run maketables
+	DEASS SYS$OUTPUT
+	DEFINE SYS$OUTPUT 'CURRENT_OUTPUT'           !nun wieder aufs Terminal
+
+maketables.exe :     maketables.obj
+        link maketables, [-.vms]tin.opt/option
diff -Nur tin-980117/src/Makefile.in tin-980202/src/Makefile.in
--- tin-980117/src/Makefile.in	Mon Jan  5 18:47:27 1998
+++ tin-980202/src/Makefile.in	Sun Feb  1 04:44:23 1998
@@ -1,7 +1,7 @@
 # Source Makefile for tin 
 # - for configuration options read the ../doc/INSTALL file.
 #
-# Updated   : 31.12.1997
+# Updated   : 31.01.1998
 #
 
 SHELL		= /bin/sh
@@ -32,6 +32,7 @@
 INS_BINARY_DIR	= @bindir@
 INS_DAEMON_DIR	= @NEWSLIBDIR@
 INS_MANUAL_DIR	= @mandir@/man
+INS_SYSDEF_DIR	= @TIN_DEFAULTS_DIR@
 INS_MANUAL_EXT	= 1
 
 # Project
@@ -76,10 +77,6 @@
 	$(INCDIR)/tin.h \
 	$(INCDIR)/version.h
 #	$(INCDIR)/config.h
-#	$(INCDIR)/msmail.h
-#	$(INCDIR)/os_2.h
-#	$(INCDIR)/win32.h
-#	$(INCDIR)/win32tcp.h
 
 CFILES	= \
 	$(SRCDIR)/active.c \
@@ -132,13 +129,6 @@
 	$(SRCDIR)/thread.c \
 	$(SRCDIR)/wildmat.c \
 	$(SRCDIR)/xref.c
-#	$(SRCDIR)/msmail.c
-#	$(SRCDIR)/nntpw32.c
-#	$(SRCDIR)/nntpvms.c
-#	$(SRCDIR)/win32.c
-#	$(SRCDIR)/win32tcp.c
-#	$(SRCDIR)/os_2.c
-#	$(SRCDIR)/vms.c
 
 EXTRAOBJS = @EXTRAOBJS@
 
@@ -197,11 +187,6 @@
 	$(OBJDIR)/thread.o \
 	$(OBJDIR)/wildmat.o \
 	$(OBJDIR)/xref.o
-#	$(OBJDIR)/win32.o
-#	$(OBJDIR)/vms.o
-#	$(OBJDIR)/os_2.o
-#	$(OBJDIR)/nntpw32.o
-#	$(OBJDIR)/nntpvms.o
 
 
 ALL_FILES = $(HFILES) $(CFILES) $(NNTP)
@@ -250,18 +235,24 @@
 	@$(ECHO) "    make install_setuid  [ Install the binary setuid & the manual page ]"
 	@$(ECHO) "    make install_daemon  [ Install the index daemon binary ]"
 	@$(ECHO) "    make install_manpage [ Install the manual page ]"
+	@$(ECHO) "    make install_sysdefs [ Install the system-wide-defaults file ]"
 	@$(ECHO) "    make help            [ Show this text ]"
 	@$(ECHO) " "
 
 $(INSTALL_PREFIX)$(INS_MANUAL_DIR)$(INS_MANUAL_EXT) \
 $(INSTALL_PREFIX)$(INS_BINARY_DIR) \
-$(INSTALL_PREFIX)$(INS_DAEMON_DIR) :
+$(INSTALL_PREFIX)$(INS_DAEMON_DIR) \
+$(INS_SYSDEF_DIR) :
 	$(srcdir)/../mkdirs.sh $@
 
 install_manpage: $(INSTALL_PREFIX)$(INS_MANUAL_DIR)$(INS_MANUAL_EXT)
 	@$(ECHO) "Installing $(EXE) manual page to $(INSTALL_PREFIX)$(INS_MANUAL_DIR)$(INS_MANUAL_EXT)..."
 	@$(INSTALL) -m 444 $(DOCDIR)/$(EXE).$(MANEXT) $(INSTALL_PREFIX)$(INS_MANUAL_DIR)$(INS_MANUAL_EXT)/$(EXE).$(INS_MANUAL_EXT)
 
+install_sysdefs: $(INS_SYSDEF_DIR)
+	@$(ECHO) "Installing system-wide defaults file to $(INS_SYSDEF_DIR)..."
+	@$(INSTALL) -m 644 $(DOCDIR)/tin.defaults $(INS_SYSDEF_DIR)/tin.defaults
+
 install: $(INSTALL_PREFIX)$(INS_BINARY_DIR)
 	@$(MAKE) all
 	@$(ECHO) "Installing $(EXE) v$(VER) to $(INSTALL_PREFIX)$(INS_BINARY_DIR)..."
@@ -421,7 +412,3 @@
 				$(INCDIR)/menukeys.h
 $(OBJDIR)/wildmat.o:		$(SRCDIR)/wildmat.c $(TIN_DEP)
 $(OBJDIR)/xref.o:		$(SRCDIR)/xref.c $(TIN_DEP)
-
-# $(OBJDIR)/msmail.o:		$(SRCDIR)/msmail.c $(TIN_DEP)
-# $(OBJDIR)/win32.o:		$(SRCDIR)/win32.c $(TIN_DEP)
-# $(OBJDIR)/vms.o:		$(SRCDIR)/vms.c $(TIN_DEP)
diff -Nur tin-980117/src/active.c tin-980202/src/active.c
--- tin-980117/src/active.c	Fri Jan 16 12:50:16 1998
+++ tin-980202/src/active.c	Sun Feb  1 11:13:15 1998
@@ -23,7 +23,8 @@
  */
 #define ACTIVE_SEP		" \n"
 
-int reread_active_file = FALSE;
+t_bool force_reread_active_file = FALSE;
+static time_t active_timestamp;  /* time active file read (local) */
 
 /* FIXME: make local */
 char	acHomeDir[PATH_LEN];
@@ -40,6 +41,7 @@
 /*
  * Local prototypes
  */
+static void set_active_timestamp (void);
 static int find_newnews_index (char *cur_newnews_host);
 static int parse_newsrc_active_line (char *buf, long *count, long *max, long *min, char *moderated);
 static void check_for_any_new_groups (void);
@@ -58,7 +60,7 @@
 int
 get_active_num (void)
 {
-#ifdef ENV_VAR_GROUPS
+#ifdef ENV_VAR_GROUPS /* M_AMIGA && M_OS2 && WIN32 only */
 	char *ptr;
 	int num;
 
@@ -68,18 +70,33 @@
 	return DEFAULT_ACTIVE_NUM;
 }
 
+static void
+set_active_timestamp (void)
+{
+	time (&active_timestamp);
+	force_reread_active_file = FALSE;
+}
+
+
+int
+reread_active_file (void)
+{
+	return (force_reread_active_file || (reread_active_file_secs != 0 &&
+		(int)(time(NULL) - active_timestamp) >= reread_active_file_secs));
+}
+
+
 /*
- *  Resync active file when SIGALRM signal received that
- *  is triggered by alarm (reread_active_file_secs) call.
+ * Resync active file when reread_active_file_secs have passed or
+ * force_reread_actve_file is set.
  */
-
 int
 resync_active_file (void)
 {
 	char old_group[HEADER_LEN];
 	int command_line;
 
-	if (!reread_active_file)
+	if (!reread_active_file ())
 		return FALSE;
 
 	reread_active_for_posted_arts = FALSE;
@@ -94,7 +111,7 @@
 
 	command_line = read_cmd_line_groups ();
 
-	read_newsrc (newsrc, command_line ? 0 : 1);
+	read_newsrc (newsrc, command_line ? FALSE : TRUE);
 
 	if (command_line)		/* Can't show only unread groups with cmd line groups */
 		show_only_unread_groups = FALSE;
@@ -102,7 +119,6 @@
 		toggle_my_groups (show_only_unread_groups, old_group);
 
 	set_groupname_len (FALSE);
-	set_alarm_signal ();
 	show_selection_page ();
 
 	return TRUE;
@@ -126,10 +142,7 @@
 	ptr->description = (char *) 0;
 	/* spool - see below */
 	ptr->moderated = moderated[0];
-	if (moderated[0] == '=')
-		ptr->aliasedto = my_strdup(moderated+1);
-	else
-		ptr->aliasedto = (char *) 0;
+	ptr->aliasedto = ((moderated[0] == '=') ? my_strdup(moderated+1) : (char *) 0);
 	ptr->count = count;
 	ptr->xmax = max;
 	ptr->xmin = min;
@@ -246,7 +259,7 @@
 
 	*ptr = '\0';					/* Now buf is the group name */
 
-	if (vGrpGetArtInfo (spooldir, buf, GROUP_TYPE_NEWS, count, max, min) != 0)
+	if (vGrpGetArtInfo (spooldir, buf, GROUP_TYPE_NEWS, count, max, min))
 		return(FALSE);
 
 	strcpy (moderated, "y");
@@ -345,11 +358,13 @@
 	/*
 	 *  Exit if active file wasn't read correctly or is empty
 	 */
-	if (tin_errno != 0 || !num_active) {
+	if (tin_errno || !num_active) {
 		error_message (txt_active_file_is_empty, news_active_file);
 		tin_done (EXIT_ERROR);
 	}
 
+	set_active_timestamp ();
+
 	if (INTERACTIVE2)
 		wait_message (0, "\n");
 
@@ -369,12 +384,12 @@
 static void
 check_for_any_new_groups (void)
 {
+	FILE *fp;
 	char *autosubscribe, *autounsubscribe;
 	char *ptr, buf[NNTP_STRLEN];
 	char old_newnews_host[PATH_LEN];
 	char new_newnews_host[PATH_LEN];
 	int newnews_index;
-	FILE *fp;
 	time_t old_newnews_time;
 	time_t new_newnews_time;
 
@@ -382,13 +397,8 @@
 		return;
 
 	wait_message (0, txt_checking_new_groups);
-
 	time (&new_newnews_time);
-
-	if (read_news_via_nntp)
-		strcpy (new_newnews_host, nntp_server);
-	else
-		strcpy (new_newnews_host, "local");	/* What if nntp server called local ? */
+	strcpy (new_newnews_host, (read_news_via_nntp ? nntp_server : "local")); /* What if nntp server called local ? */
 
 	/*
 	 * find out if we have read news from here before otherwise -1
@@ -435,7 +445,7 @@
 		}
 
 		TIN_FCLOSE (fp);
-		if (tin_errno != 0)
+		if (tin_errno)
 			return;				/* Don't update the time if we quit */
 	}
 
@@ -514,15 +524,15 @@
  * group_list is a comma separated list of newsgroups, ! implies NOT
  * The same degree of wildcarding as used elsewhere in tin is allowed
  */
-int
+t_bool
 match_group_list (
 	char *group,
 	char *group_list)
 {
 	char *separator;
 	char pattern[HEADER_LEN];
-	int accept, negate, list_len;
-	size_t group_len;
+	size_t group_len, list_len;
+	t_bool accept, negate;
 
 	accept = FALSE;
 	list_len = strlen (group_list);
@@ -534,11 +544,7 @@
 		 * find end/length of this entry
 		 */
 		separator = strchr (group_list, ',');
-
-		if (separator != (char *) 0)
-			group_len = separator-group_list;
-		else
-			group_len = list_len;
+		group_len = ((separator == (char *) 0) ? list_len : (separator - group_list));
 
 		if ((negate = ('!' == *group_list))) {
 			/*
@@ -753,7 +759,7 @@
 	if (iVerbose)
 		my_printf ("BEG Base=[%s] path=[%s]\n", pcBaseDir, pcGrpPath);
 
-	if (access (pcGrpPath, R_OK) != 0)
+	if (access (pcGrpPath, R_OK))
 		return;
 
 	tDirFile = opendir (pcGrpPath);
diff -Nur tin-980117/src/art.c tin-980202/src/art.c
--- tin-980117/src/art.c	Sun Jan 11 19:00:58 1998
+++ tin-980202/src/art.c	Wed Jan 28 04:24:45 1998
@@ -35,7 +35,7 @@
 static int from_comp (t_comptype *p1, t_comptype *p2);
 static int iReadNovFile (struct t_group *group, long min, long max, int *expired);
 static int parse_headers (FILE *fp, struct t_article *h);
-static int read_group (struct t_group *group, char *group_path, int *pcount);
+static t_bool read_group (struct t_group *group, char *group_path, int *pcount);
 static int score_comp (t_comptype *p1, t_comptype *p2);
 static int subj_comp (t_comptype *p1, t_comptype *p2);
 static int valid_artnum (long art);
@@ -133,7 +133,6 @@
 	make_group_path (group->name, group_path);
 	glob_art_group = group->name;
 
-	set_alarm_clock_off ();
 	set_signals_art ();
 
 	hash_reclaim ();
@@ -174,11 +173,9 @@
 	/*
 	 * Read in the existing index via XOVER or the index file
 	 */
-	if (iReadNovFile (group, min, max, &expired) == -1) {
+	if (iReadNovFile (group, min, max, &expired) == -1)
 		/* user aborted indexing */
-		set_alarm_clock_on ();
 		return FALSE;
-	}
 
 	/*
 	 * Prints 'P' for each expired article if verbose
@@ -189,11 +186,9 @@
 	/*
 	 * Add any articles to arts[] that are new or were killed
 	 */
-	if ((modified = read_group (group, group_path, &count)) == -1) {
+	if ((modified = read_group (group, group_path, &count)) == -1)
 		/* user aborted indexing */
-		set_alarm_clock_on ();
 		return FALSE;
-	}
 
 	/*
 	 * Do this before calling art_mark_read if you want
@@ -258,7 +253,6 @@
 	if ((modified || filtered) && !batch_mode)
 		clear_message ();
 
-	set_alarm_clock_on ();
 	return (TRUE);
 }
 
@@ -270,7 +264,7 @@
  *    -1     user aborted indexing operation
  */
 
-static int
+static t_bool
 read_group (
 	struct t_group *group,
 	char *group_path,
@@ -279,7 +273,7 @@
 	FILE *fp;
 	char buf[PATH_LEN];
 	int count = 0, res;
-	int modified = FALSE;
+	t_bool modified = FALSE;
 	int respnum, total = 0;
 	long art;
 	register int i;
@@ -353,7 +347,7 @@
 		res = parse_headers (fp, &arts[top]);
 
 		TIN_FCLOSE(fp);
-		if (tin_errno != 0) {
+		if (tin_errno) {
 			chdir (dir);
 			return(-1);
 		}
@@ -486,12 +480,8 @@
 {
 	int i;
 
-	if (!cmd_line) {
-		if (group->attribute && group->attribute->thread_arts == THREAD_NONE)
-			info_message (txt_unthreading_arts);
-		else
-			info_message (txt_threading_arts);
-	}
+	if (!cmd_line)
+		info_message (((group->attribute && group->attribute->thread_arts == THREAD_NONE) ? txt_unthreading_arts : txt_threading_arts));
 
 #ifdef DEBUG
 	if (debug == 2)
@@ -662,7 +652,7 @@
 					    *buf2 != '\0') {
 						parse_from (buf2, art_from_addr, art_full_name);
 						h->from = hash_str (art_from_addr);
-						if (art_full_name[0])
+						if (*art_full_name)
 							h->name = hash_str (art_full_name);
 						got_from = TRUE;
 					}
@@ -758,7 +748,7 @@
 
 	} /* while */
 
-	if (tin_errno != 0)
+	if (tin_errno)
 		return FALSE;
 
 	/* TODO its possible some of these tests must go back to break; the main loop */
@@ -917,7 +907,7 @@
 		parse_from (rfc1522_decode (p), art_from_addr, art_full_name);
 		arts[top].from = hash_str (art_from_addr);
 
-		if (art_full_name[0])
+		if (*art_full_name)
 			arts[top].name = hash_str (art_full_name);
 
 		p = q + 1;
@@ -968,10 +958,7 @@
 		} else
 			*q = '\0';
 
-		if (*p)
-			arts[top].refs = my_strdup (p);
-		else
-			arts[top].refs = '\0';
+		arts[top].refs = ((*p) ? (my_strdup (p)) : ('\0'));
 
 		p = q + 1;
 
@@ -1045,7 +1032,7 @@
 
 	TIN_FCLOSE (fp);
 
-	if (tin_errno != 0)
+	if (tin_errno)
 		return(-1);
 
 	return top;
@@ -1095,11 +1082,7 @@
 	 * than W_OK, since we won't read it anyway.
 	 */
 
-	if((pcNovFile = pcFindNovFile (psGrp, R_OK))!=0)
-		strcpy(tmp, pcNovFile);
-	else
-		strcpy(tmp, "");
-
+	strcpy(tmp, ((((pcNovFile = pcFindNovFile (psGrp, R_OK)) != 0)) ? pcNovFile : ""));
 	pcNovFile = pcFindNovFile (psGrp, W_OK);
 
 	if(strcmp(tmp, pcNovFile)!=0) {
@@ -1234,9 +1217,9 @@
 				sprintf (acNovFile, "%s%d.idx", TMPDIR, process_id);
 			else {
 				vMakeGrpPath (novrootdir, psGrp->name, acBuf);
-				sprintf (acNovFile, "%s/%s", acBuf, OVERVIEW_FILE);
-				if (iMode == R_OK || iMode == W_OK /*vb*/) {
-					if (access (acNovFile, iMode) == 0)
+				sprintf (acNovFile, "%s/%s", acBuf, novfilename);
+				if (iMode == R_OK || iMode == W_OK) {
+					if (!access (acNovFile, iMode))
 						overview_index_filename = TRUE;
 				}
 				if (!overview_index_filename) {
@@ -1582,11 +1565,7 @@
 			return cur;
 
 		prev = cur;
-		if (arts[cur].artnum < art)
-			cur = cur + range;
-		else
-			cur = cur - range;
-
+		cur += (arts[cur].artnum < art) ? range : -range;
 		if (prev == cur)
 			return -1;
 
diff -Nur tin-980117/src/attrib.c tin-980202/src/attrib.c
--- tin-980117/src/attrib.c	Sun Jan 11 19:01:28 1998
+++ tin-980202/src/attrib.c	Wed Jan 28 01:47:45 1998
@@ -671,7 +671,7 @@
 	fprintf (fp, "############################################################################\n\n");
 
 /*
- * some usefull defaults
+ * some useful defaults
  */
 	fprintf (fp, "# in *sources* set post process type to shar\n");
 	fprintf (fp, "scope=*sources*\n");
diff -Nur tin-980117/src/auth.c tin-980202/src/auth.c
--- tin-980117/src/auth.c	Sun Jan 11 19:01:53 1998
+++ tin-980202/src/auth.c	Sun Jan 18 03:29:55 1998
@@ -103,10 +103,8 @@
 	setenv ("NNTP_AUTH_FDS", tmpbuf, 1);
 #endif
 
-	if (!builtinauth)
-		return (invoke_cmd (authval));	/* TODO - is it possible that we should have drained server here ? */
-	else
-		return (get_respcode(NULL) == OK_AUTH);
+		/* TODO - is it possible that we should have drained server here ? */
+		return (builtinauth ? (get_respcode(NULL) == OK_AUTH) : invoke_cmd (authval));
 }
 
 /*
diff -Nur tin-980117/src/charset.c tin-980202/src/charset.c
--- tin-980117/src/charset.c	Fri Jan 16 17:59:25 1998
+++ tin-980202/src/charset.c	Sat Jan 24 19:27:32 1998
@@ -254,15 +254,15 @@
  * Check for german TeX encoding
  */
 
-int
+t_bool
 iIsArtTexEncoded (
 	long art,
 	char *group_path)
 {
 	char line[LEN];
 	FILE *fp;
-	int body = FALSE;
 	int i, len;
+	t_bool body = FALSE;
 
 	/*
 	 * TODO: This is a farce. Reread the whole art !!
diff -Nur tin-980117/src/color.c tin-980202/src/color.c
--- tin-980117/src/color.c	Sun Jan 11 19:02:23 1998
+++ tin-980202/src/color.c	Sat Jan 24 01:54:42 1998
@@ -38,7 +38,7 @@
 static t_bool isalp (int c);
 static void color_fputs (const char *s, FILE *stream, int color);
 
-#if USE_CURSES
+#ifdef USE_CURSES
 static void
 set_colors (
 	int fcolor,
@@ -120,7 +120,7 @@
 	TRACE(("fcol(%d) %s", color, txt_colors[color-MIN_COLOR]))
 	if (use_color) {
 		if (color >= MIN_COLOR && color <= MAX_COLOR) {
-#if USE_CURSES
+#ifdef USE_CURSES
 			set_colors(color, current_bcol);
 #else
 			int bold;
@@ -134,8 +134,9 @@
 			current_fcol = color;
 		}
 	}
-#if USE_CURSES
-	else set_colors(default_fcol, default_bcol);
+#ifdef USE_CURSES
+	else
+		set_colors(default_fcol, default_bcol);
 #endif /* USE_CURSES */
 }
 
@@ -147,7 +148,7 @@
 	TRACE(("bcol(%d) %s", color, txt_colors[color-MIN_COLOR]))
 	if (use_color) {
 		if (color >= MIN_COLOR && color <= MAX_BACKCOLOR) {
-#if USE_CURSES
+#ifdef USE_CURSES
 			set_colors(current_fcol, color);
 #else
 			if (color < 0)
@@ -157,8 +158,9 @@
 			current_bcol = color;
 		}
 	}
-#if USE_CURSES
-	else set_colors(default_fcol, default_bcol);
+#ifdef USE_CURSES
+	else
+		set_colors(default_fcol, default_bcol);
 #endif
 }
 
@@ -360,9 +362,8 @@
 			} else if (in_headers) {
 				color = col_newsheaders;
 				fcol (col_newsheaders);
-			} else {
+			} else
 				fcol (col_text);
-			}
 		}
 	}
 
diff -Nur tin-980117/src/config.c tin-980202/src/config.c
--- tin-980117/src/config.c	Fri Jan 16 17:11:45 1998
+++ tin-980202/src/config.c	Sun Feb  1 04:17:25 1998
@@ -35,7 +35,7 @@
  * 1st line, then switch to UPGRADE or IGNORE accordingly.
  */
 static int
-check_upgrade(
+check_upgrade (
 	char *buf)
 {
 	if (strncmp(buf, "# tin-unoff configuration file V" TINRC_VERSION, 35) == 0)
@@ -57,10 +57,10 @@
 	char	*file,
 	int	global_file) /* return value is always ignored */
 {
+	FILE	*fp;
 	char	newnews_info[PATH_LEN];
 	char	buf[LEN];
 	int	upgrade = CHECK;
-	FILE	*fp;
 
 	if ((fp = fopen (file, "r")) == (FILE *) 0)
 		return FALSE;
@@ -90,26 +90,32 @@
 				art_marked_deleted = buf[0];
 				break;
 			}
+
 			if (match_string (buf, "art_marked_inrange=", buf, sizeof (buf))) {
 				art_marked_inrange = buf[0];
 				break;
 			}
+
 			if (match_string (buf, "art_marked_return=", buf, sizeof (buf))) {
 				art_marked_return = buf[0];
 				break;
 			}
+
 			if (match_string (buf, "art_marked_selected=", buf, sizeof (buf))) {
 				art_marked_selected = buf[0];
 				break;
 			}
+
 			if (match_string (buf, "art_marked_unread=", buf, sizeof (buf))) {
 				art_marked_unread = buf[0];
 				break;
 			}
+
 #ifdef HAVE_METAMAIL
 			if (match_boolean (buf, "ask_for_metamail=", &ask_for_metamail))
 				break;
 #endif
+
 			if (match_boolean (buf, "auto_cc=", &auto_cc))
 				break;
 
@@ -203,8 +209,8 @@
 
 			if (match_color (buf, "col_markdash=", &col_markdash, MAX_COLOR))
 				break;
-
 #endif
+
 			break;
 
 		case 'd':
@@ -221,10 +227,12 @@
 				}
 				break;
 			}
+
 			if (match_string (buf, "default_maildir=", default_maildir, sizeof (default_maildir))) {
 				joinpath (posted_msgs_file, default_maildir, POSTED_FILE);
 				break;
 			}
+
 			if (match_string (buf, "default_printer=", default_printer, sizeof (default_printer)))
 				break;
 
@@ -240,8 +248,11 @@
 			if (match_boolean (buf, "default_filter_kill_global=", &default_filter_kill_global))
 				break;
 
-			if (match_boolean (buf, "default_filter_kill_case=", &default_filter_kill_case))
+			if (match_boolean (buf, "default_filter_kill_case=", &default_filter_kill_case)) {
+				/* ON=false, OFF=true */
+				default_filter_kill_case = !default_filter_kill_case;
 				break;
+			}
 
 			if (match_boolean (buf, "default_filter_kill_expire=", &default_filter_kill_expire))
 				break;
@@ -252,8 +263,11 @@
 			if (match_boolean (buf, "default_filter_select_global=", &default_filter_select_global))
 				break;
 
-			if (match_boolean (buf, "default_filter_select_case=", &default_filter_select_case))
+			if (match_boolean (buf, "default_filter_select_case=", &default_filter_select_case)) {
+				/* ON=false, OFF=true */
+				default_filter_select_case = !default_filter_select_case;
 				break;
+			}
 
 			if (match_boolean (buf, "default_filter_select_expire=", &default_filter_select_expire))
 				break;
@@ -262,6 +276,7 @@
 				default_save_mode = buf[0];
 				break;
 			}
+
 			if (match_string (buf, "default_author_search=", default_author_search, sizeof (default_author_search)))
 				break;
 
@@ -406,11 +421,13 @@
 				load_newnews_info (newnews_info);
 				break;
 			}
+
 			/* pick which news headers to display */
 			if (match_string(buf, "news_headers_to_display=", news_headers_to_display, sizeof (news_headers_to_display))) {
 				news_headers_to_display_array = ulBuildArgv(news_headers_to_display, &num_headers_to_display);
 				break;
 			}
+
 			/* pick which news headers to NOT display */
 			if (match_string(buf, "news_headers_to_not_display=", news_headers_to_not_display, sizeof (news_headers_to_not_display))) {
 				news_headers_to_not_display_array = ulBuildArgv(news_headers_to_not_display, &num_headers_to_not_display);
@@ -582,7 +599,9 @@
 				break;
 			}
 #endif
+
 			break;
+
 		case 'w':
 			if (match_integer (buf, "wildcard=", &wildcard, 2)) {
 				wildcard_func = (wildcard) ? match_regex : wildmat;
@@ -664,7 +683,7 @@
 	if (!cmd_line)
 		wait_message (0, txt_saving);
 
-	if (!default_editor_format[0])
+	if (!*default_editor_format)
 		strcpy (default_editor_format, EDITOR_FORMAT_ON);
 
 	fprintf (fp, txt_tinrc_header, TINRC_VERSION, progname, VERSION, RELEASEDATE);
@@ -962,7 +981,7 @@
 
 	if (*mail_address) {
 		fprintf (fp, txt_tinrc_mail_address);
-		fprintf (fp, "mail_address=%s\n\n",mail_address);
+		fprintf (fp, "mail_address=%s\n\n", mail_address);
 	}
 
 	fprintf (fp, txt_tinrc_mm_charset);
@@ -1004,8 +1023,10 @@
 
 	fprintf (fp, txt_tinrc_alternative_handling);
 	fprintf (fp, "alternative_handling=%s\n\n", print_boolean (alternative_handling));
+
 	fprintf (fp, txt_tinrc_strip_newsrc);
 	fprintf (fp, "strip_newsrc=%s\n\n", print_boolean (strip_newsrc));
+
 	fprintf (fp, txt_tinrc_strip_bogus);
 	fprintf (fp, "strip_bogus=%d\n\n", strip_bogus);
 
@@ -1015,11 +1036,13 @@
 	fprintf (fp, txt_tinrc_filter);
 	fprintf (fp, "default_filter_kill_header=%d\n", default_filter_kill_header);
 	fprintf (fp, "default_filter_kill_global=%s\n", print_boolean (default_filter_kill_global));
-	fprintf (fp, "default_filter_kill_case=%s\n", print_boolean (default_filter_kill_case));
+	/* ON=false, OFF=true */
+	fprintf (fp, "default_filter_kill_case=%s\n", print_boolean (!default_filter_kill_case));
 	fprintf (fp, "default_filter_kill_expire=%s\n", print_boolean (default_filter_kill_expire));
 	fprintf (fp, "default_filter_select_header=%d\n", default_filter_select_header);
 	fprintf (fp, "default_filter_select_global=%s\n", print_boolean (default_filter_select_global));
-	fprintf (fp, "default_filter_select_case=%s\n", print_boolean (default_filter_select_case));
+	/* ON=false, OFF=true */
+	fprintf (fp, "default_filter_select_case=%s\n", print_boolean (!default_filter_select_case));
 	fprintf (fp, "default_filter_select_expire=%s\n\n", print_boolean (default_filter_select_expire));
 
 	fprintf (fp, txt_tinrc_defaults);
@@ -1092,7 +1115,7 @@
 		default:
 			break;
 	}
-#if USE_CURSES
+#ifdef USE_CURSES
 	clrtoeol();
 #endif
 }
@@ -1108,7 +1131,7 @@
 OptionOnPage (
 	int option)
 {
-	if ((option >= first_option_on_screen) && (option <  first_option_on_screen + option_lines_per_page))
+	if ((option >= first_option_on_screen) && (option < first_option_on_screen + option_lines_per_page))
 		return TRUE;
 	return FALSE;
 }
@@ -1136,7 +1159,7 @@
 	}
 }
 
-#if USE_CURSES
+#ifdef USE_CURSES
 static void DoScroll (
 	int jump)
 {
@@ -1154,7 +1177,7 @@
 	int option)
 {
 	if (!OptionOnPage(option)) {
-#if USE_CURSES
+#ifdef USE_CURSES
 		if (option > 0 && OptionOnPage(option-1)) {
 			DoScroll(1);
 			first_option_on_screen++;
@@ -1201,7 +1224,7 @@
 refresh_config_page (int act_option)
 {
 	static int last_option = 0;
-	int force_redraw = FALSE;
+	t_bool force_redraw = FALSE;
 
 	if (act_option < 0) {
 		force_redraw = TRUE;
@@ -1226,12 +1249,12 @@
 	struct t_group *group)
 {
 	int ch, i;
-	int change_option = FALSE;
-	t_bool original_on_off_value;
 	int original_list_value;
 	int option, old_option;
 	int ret_code = NO_FILTERING;
 	int mime_type = 0;
+	t_bool change_option = FALSE;
+	t_bool original_on_off_value;
 
 	set_signals_config ();
 
@@ -1336,7 +1359,7 @@
 				unhighlight_option (option);
 				if (OptionInPage(option)) {
 					option = first_option_on_screen;
-				} else if (first_option_on_screen == 0) {
+				} else if (!first_option_on_screen) {
 					option = LAST_OPT;
 					first_option_on_screen = TopOfPage(option);
 				} else if ((option -= option_lines_per_page) < 0) {
@@ -1427,13 +1450,9 @@
 										if (new_responses (i))
 											break;
 									}
-									if (i < top_base)
-										index_point = i;
-									else
-										index_point = top_base - 1;
-								} else {
+									index_point = ((i < top_base) ? i: top_base - 1);
+								} else
 									index_point = top_base - 1;
-								}
 							}
 							break;
 
@@ -1485,7 +1504,7 @@
 #ifdef HAVE_COLOR
 						/* use ANSI color */
 						case OPT_USE_COLOR_TINRC:
-#if USE_CURSES
+#ifdef USE_CURSES
 							if (!has_colors())
 								use_color = 0;
 							else
@@ -1818,7 +1837,7 @@
 		if (!found)
 			*dst = atoi (&line[patlen]);
 
-		if (maxlen)  {
+		if (maxlen) {
 			if ((*dst < -1) || (*dst > maxlen)) {
 				my_fprintf(stderr, txt_value_out_of_range, pat, *dst, maxlen);
 				*dst = 0;
@@ -1842,18 +1861,17 @@
 	int *dst,
 	int maxlen)
 {
-	size_t	patlen = strlen (pat);
+	size_t patlen = strlen (pat);
 
 	if (STRNCMPEQ(line, pat, patlen)) {
 		*dst = atoi (&line[patlen]);
 
-		if (maxlen)  {
+		if (maxlen) {
 			if ((*dst < 0) || (*dst > maxlen)) {
 				my_fprintf(stderr, txt_value_out_of_range, pat, *dst, maxlen);
 				*dst = 0;
 			}
 		}
-
 		return TRUE;
 	}
 	return FALSE;
@@ -1931,10 +1949,10 @@
 	return txt_onoff[value != FALSE];
 }
 
+
 /*
  *  convert underlines to spaces in a string
  */
-
 void
 quote_dash_to_space (
 	char *str)
@@ -1947,10 +1965,10 @@
 	}
 }
 
+
 /*
  *  convert spaces to underlines in a string
  */
-
 char *
 quote_space_to_dash (
 	char *str)
@@ -1980,7 +1998,7 @@
 {
 	int i, lines_to_print = option_lines_per_page;
 
-#if !USE_CURSES
+#ifdef USE_CURSES
 	ClearScreen ();
 #endif
 	center_line (0, TRUE, txt_options_menu);
@@ -1991,8 +2009,7 @@
 	if (first_option_on_screen + option_lines_per_page > LAST_OPT)
 		lines_to_print = LAST_OPT + 1 - first_option_on_screen;
 
-	for (i = 0; i < lines_to_print;i++)
-	{
+	for (i = 0; i < lines_to_print;i++) {
 		MoveCursor (INDEX_TOP + i, 3);
 		print_any_option (first_option_on_screen + i);
 	}
diff -Nur tin-980117/src/curses.c tin-980202/src/curses.c
--- tin-980117/src/curses.c	Thu Jan 15 16:27:01 1998
+++ tin-980202/src/curses.c	Sun Feb  1 04:48:55 1998
@@ -14,7 +14,7 @@
 #include "tin.h"
 #include "tcurses.h"
 
-#if USE_CURSES
+#ifdef USE_CURSES
 
 #define ReadCh cmdReadCh
 
@@ -35,9 +35,9 @@
 #include <iodef.h>
 #include <ssdef.h>
 #include <dvidef.h>
-#ifdef __GNUC__
-#include <sys$routines.h>
-#include <lib$routines.h>
+#ifdef __GNUC__ /* M.St. 22.01.98 */
+#include <vms/sys$routines.h>
+#include <vms/lib$routines.h>
 #endif
 #endif
 
@@ -60,7 +60,7 @@
 
 #ifdef HAVE_CONFIG_H
 
-#if HAVE_TERMIOS_H && HAVE_TCGETATTR && HAVE_TCSETATTR
+#if defined(HAVE_TERMIOS_H) && defined(HAVE_TCGETATTR) && defined(HAVE_TCSETATTR)
 #	ifdef HAVE_IOCTL_H
 #		include <ioctl.h>
 #	else
@@ -74,12 +74,12 @@
 #	define USE_POSIX_TERMIOS 1
 #	define TTY struct termios
 #else
-#	if HAVE_TERMIO_H
+#	ifdef HAVE_TERMIO_H
 #		include <termio.h>
 #		define USE_TERMIO 1
 #		define TTY struct termio
 #	else
-#		if HAVE_SGTTY_H
+#		ifdef HAVE_SGTTY_H
 #			include <sgtty.h>
 #			define USE_SGTTY 1
 #			define TTY struct sgttyb
@@ -299,10 +299,10 @@
 	/*
 	 * kludge to workaround no inverse
 	 */
-	if (_setinverse == 0) {
+	if (!_setinverse) {
 		_setinverse = _setunderline;
 		_clearinverse = _clearunderline;
-		if (_setinverse == 0)
+		if (!_setinverse)
 			draw_arrow_mark = 1;
 	}
 #ifdef HAVE_COLOR
@@ -400,15 +400,7 @@
 		_columns = COLS;
 	}
 #endif	/* M_OS2 */
-
-	if (_lines < MIN_LINES_ON_TERMINAL || _columns < MIN_COLUMNS_ON_TERMINAL) {
-		my_fprintf(stderr, txt_screen_too_small, progname);
-		return (FALSE);
-	}
-
-	InitWin ();
-
-#ifdef VMS
+#ifdef VMS  /* moved from below InitWin () M.St. 22.01.98 */
 	{
 		int input_chan, status;
 		int item_code, eightbit;
@@ -481,6 +473,14 @@
 #endif /* HAVE_IS_XTERM */
 	}
 #endif /* VMS */
+
+	if (_lines < MIN_LINES_ON_TERMINAL || _columns < MIN_COLUMNS_ON_TERMINAL) {
+		my_fprintf(stderr, txt_screen_too_small, progname);
+		return (FALSE);
+	}
+
+	InitWin ();
+
 	Raw (FALSE);
 
 	return (TRUE);
@@ -501,8 +501,10 @@
 {
 #ifndef INDEX_DAEMON
 
-	if (_lines == 0) _lines = DEFAULT_LINES_ON_TERMINAL;
-	if (_columns == 0) _columns = DEFAULT_COLUMNS_ON_TERMINAL;
+	if (!_lines)
+		_lines = DEFAULT_LINES_ON_TERMINAL;
+	if (!_columns)
+		_columns = DEFAULT_COLUMNS_ON_TERMINAL;
 
 	*num_lines = _lines - 1;		/* assume index from zero*/
 	*num_columns = _columns;		/* assume index from one */
@@ -730,7 +732,7 @@
 {
 #ifndef INDEX_DAEMON
 
-	if (in_inverse == 0)
+	if (!in_inverse)
 		StartInverse();
 	else
 		EndInverse();
@@ -883,7 +885,7 @@
 	int result;
 	unsigned char ch;
 
-	while (getscrsize || buflen == 0) {
+	while (getscrsize || !buflen) {
 PROFILE_OFF();
 		result = read (0, (char *)&buf[buflen], 1);
 PROFILE_ON();
diff -Nur tin-980117/src/debug.c tin-980202/src/debug.c
--- tin-980117/src/debug.c	Sun Jan 11 19:03:40 1998
+++ tin-980202/src/debug.c	Sun Jan 18 21:15:49 1998
@@ -70,7 +70,7 @@
 	char file[PATH_LEN];
 	FILE *fp;
 
-	if (debug == 0)
+	if (!debug)
 		return;
 
 	sprintf (file, "%sNNTP", TMPDIR);
diff -Nur tin-980117/src/descrip.mms tin-980202/src/descrip.mms
--- tin-980117/src/descrip.mms	Thu Jan  1 01:00:00 1970
+++ tin-980202/src/descrip.mms	Sun Feb  1 08:48:08 1998
@@ -0,0 +1,318 @@
+# Makefile for tin - for tin compiler flag options read INSTALL and README.
+#
+
+.IFDEF DEF_NNTP
+.ELSE
+# Edit the following line for your default nntp server.
+# Remark:
+# The environment variable NNTPSERVER will overwrite this option.
+DEF_NNTP = NNTP_DEFAULT_SERVER="""news.rrzn.uni-hannover.de"""
+.ENDIF
+
+#
+# The only tcp option currently supported is SOCKETSHR_TCP
+#
+.IFDEF TCP
+.ELSE
+#TCP = UCX
+TCP = SOCKETSHR_TCP
+.ENDIF
+
+.IFDEF ALPHA
+OS_STR  = OpenVMS/ALPHA
+.ENDIF
+
+.IFDEF VAX
+OS_STR  = OpenVMS/VAX
+.ENDIF
+
+.IFDEF OS_STR
+.ELSE
+.FIRST :
+        @ WRITE SYS$OUTPUT "   Please start MMS (or MMK) at least with following switches:"
+        @ WRITE SYS$OUTPUT ""
+        @ WRITE SYS$OUTPUT "   on OpenVMS/Alpha:"
+        @ WRITE SYS$OUTPUT "   $MMS /MACRO=(alpha=1)"
+        @ WRITE SYS$OUTPUT ""
+        @ WRITE SYS$OUTPUT "   on OpenVMS/Vax:"
+        @ WRITE SYS$OUTPUT "   $MMS /MACRO=(vax=1)"
+        @ WRITE SYS$OUTPUT ""
+        @ WRITE SYS$OUTPUT "   Another example:"
+        @ WRITE SYS$OUTPUT "   $MMS /MACRO=(vax=1,gnuc=1,tcp=socketshr_tcp)"
+        @ return 44  ! %SYSTEM-F-ABORT, abort
+
+.ENDIF
+
+
+DEF_OS   = OS="""$(OS_STR)"""
+DEFINES  = HAVE_ISPELL,DONT_HAVE_NNTP_EXTS,VMS,$(TCP),$(DEF_NNTP),$(DEF_OS)
+
+.IFDEF DEBUG
+DBG = /debug /nooptim
+LFLAGS = /debug/nomap
+TARGET = tin_debug$(EXE)
+TINLIB = TINDBG.OLB
+.ELSE # !DEBUG
+TARGET = tin$(EXE)
+TINLIB = TIN.OLB
+.IFDEF VAXC
+DBG = /optim
+.ELSE
+.IFDEF GNUC
+DBG = /optim=2
+.ELSE
+DBG = /optim
+#DBG = /nooptim
+.ENDIF
+.ENDIF
+
+.IFDEF VAXC
+CC = cc
+CDEFS = /include=([-.include],[-.vms],[-.PCRE])/define=($(DEFINES))/nowarning/list/show=expans
+GLOMOD = $(TINLIB)/LIBRARY/INCL=LANG,
+COMPILER = VAXC
+.ELSE
+.IFDEF  GNUC
+CC	= gcc
+CDEFS = /include=([-.include],[-.vms],[-.PCRE])/define=($(DEFINES))
+GLOMOD = $(TINLIB)/LIBRARY/INCL=LANG,
+COMPILER = GNUC
+.ELSE
+CC = cc/decc
+CDEFS = /include=([-.include],[-.vms],[-.PCRE])/define=($(DEFINES))/nowarning/list/show=expans
+COMPILER = DECC
+.ENDIF
+.ENDIF
+
+.IFDEF VAX
+GLOMOD = $(TINLIB)/LIBRARY/INCL=LANG,
+.ELSE
+GLOMOD =
+.ENDIF
+
+#CDEFS = /include=([-.include],[-.vms],[-.PCRE])/define=($(DEFINES))/nowarning/list/show=all
+
+LFLAGS = /nomap
+.ENDIF # !DEBUG
+
+.IFDEF VAXC
+OPTS    =
+.ELSE
+.IFDEF GNUC
+OPTS    =
+.ELSE
+#OPTS    = /warning=(disable=implicitfunc)/prefix=all
+OPTS    = /prefix=(all,except=ENDWIN)
+#OPTS    = /prefix=all
+.ENDIF
+.ENDIF
+
+CFLAGS = $(DBG) $(OPTS) $(CDEFS)
+
+LIBS    = [-.vms]libvms/libr,[-.pcre]pcrelib/libr
+INCDIR  = [-.include]
+
+.IFDEF BISON
+YACC = bison/fixed
+YACCOUTPUT = y_tab.c
+.ELSE
+.IFDEF POSIX
+YACC = POSIX/Run/Path=POSIX "/bin/yacc"
+YACCOUTPUT = ytab.c
+.ELSE
+YACC = yacc
+YACCOUTPUT = ytab.c
+.ENDIF
+.ENDIF
+
+MODULES = active, art, attrib, -
+          charset, config, curses, debug, -
+	  envarg, feed, filter, getline, group, hashstr, -
+          help, inews, init, lang, list, mail, main, -
+          memory, misc, msmail, newsrc, nntplib, nntpw32, -
+          open, os_2, page, pgp, post, prompt, -
+          save, screen, search, select, sigfile, signal, -
+          strftime, thread, wildmat, win32, win32tcp, -
+          xref, -
+          rfc1522, rfc1521, string, header, -
+          nrctbl, read, refs, regex, auth
+
+CFILES = $(MODULES:=.c)
+OFILES = $(CFILES:.c=.obj)
+#HFILES  = $(INCDIR)config.h, $(INCDIR)tin.h, $(INCDIR)extern.h, $(INCDIR)nntplib.h, \
+#          $(INCDIR)proto.h, $(INCDIR)stpwatch.h, \
+#          $(INCDIR)os_2.h, $(INCDIR)win32.h
+HFILES   = $(INCDIR)tin.h
+TNNTP	 = $(INCDIR)tnntp.h
+
+all : opt pcrelib vmslib  tincfg.h tin
+    continue
+
+#
+# The MMS target opt is only for creating the right linker options file.
+# With GNUC and DECC on both VAX and ALPHA and different TCP stacks the
+# ammount of different option files with mostly identical lines would be
+# very large.
+#
+opt :
+	@ write sys$output "Creating linker options file on ''OS_STR' for ''TCP' with ''COMPILER'"
+	@ open/write optfile [-.vms]tin.opt
+        @ write optfile "!Options file for tin pre-1.4 on ''OS_STR' for ''TCP' with ''COMPILER'"
+	@ if ("$(TCP)" .eqs. "SOCKETSHR_TCP") then write optfile "!Using Socketshr TCP/IP"
+	@ if ("$(TCP)" .eqs. "SOCKETSHR_TCP") then write optfile "socketshr/share"
+.ifdef VAXC
+        @ write optfile "!VAXC options"
+        @ write optfile "sys$share:vaxcrtl/share"
+.else
+.ifdef GNUC
+        @ write optfile "!GNUC options"
+.ifdef VAX
+        @ write optfile "gnu_cc:[000000]gcclib/libr"
+.else
+        @ write optfile "gnu_cc_library:libgcc/libr"
+.endif
+        @ write optfile "sys$share:vaxcrtl/share"
+.else
+	@ write optfile "!DECC options"
+.endif
+.endif
+        @ write optfile "sys$library:decw$dwtlibshr/share"
+        @ write optfile "sys$library:decw$xlibshr/share"
+        @ write optfile "sys$library:vaxccurse/libr"
+.ifdef GNUC
+.ifdef ALPHA
+        @ write optfile "gnu_cc_library:crt0.obj"
+.endif
+.endif
+	@ close optfile
+
+
+tin : $(TINLIB)($(MODULES))
+    link $(LFLAGS) /exec=$(TARGET) $(TINLIB)/LIBRARY/INCL=MAIN,$(GLOMOD) -
+        [-.vms]tin.opt/option, $(LIBS)
+
+vmslib :
+    set def [-.vms]
+    @ if f$getsyi("VERSION") .lts. "V6.2" then -
+	modules = "vms,vmsdir,vmspwd,vmsfile,parse,parsdate,getopt,getopt1,getpass,qsort,isxterm"
+    @ if f$getsyi("VERSION") .ges. "V6.2" then -
+        modules = "vms,vmsdir,vmspwd,vmsfile,parse,parsdate,getpass,qsort,isxterm"
+    mms /description=libvms.mms $(MMSQUALIFIERS) $(MMSTARGETS)
+    set def [-.src]
+
+pcrelib :
+    set def [-.pcre]
+    mms /description=pcre.mms $(MMSQUALIFIERS) $(MMSTARGETS)
+    set def [-.src]
+
+tincfg.h :	makecfg.exe
+	CURRENT_OUTPUT = f$trnlnm("SYS$OUTPUT")
+	PROG_NAME = f$search("makecfg.exe")
+	DEFINE SYS$OUTPUT tincfg.h
+	mc 'PROG_NAME' TINCFG.TBL
+	DEASS SYS$OUTPUT
+	DEFINE SYS$OUTPUT 'CURRENT_OUTPUT'           !nun wieder aufs Terminal
+
+makecfg.exe : makecfg.obj
+    link $(LFLAGS) /exec=makecfg.exe makecfg.obj,[-.vms]tin.opt/option
+
+active.obj :    active.c, $(HFILES)
+actived.obj :   actived.c, $(HFILES)
+art.obj :       art.c, $(HFILES), $(INCDIR)stpwatch.h
+attrib.obj :    attrib.c, $(HFILES)
+charset.obj :   charset.c, $(HFILES)
+config.obj :    config.c, $(HFILES)
+curses.obj :    curses.c, $(HFILES)
+tcurses.obj :    tcurses.c, $(HFILES)
+debug.obj :     debug.c, $(HFILES)
+envarg.obj :    envarg.c, $(HFILES)
+feed.obj :      feed.c, $(HFILES)
+filter.obj :    filter.c, $(HFILES)
+getline.obj :   getline.c, $(HFILES)
+group.obj :     group.c, $(HFILES)
+hashstr.obj :   hashstr.c, $(HFILES)
+help.obj :      help.c, $(HFILES)
+inews.obj :     inews.c, $(TNNTP),$(HFILES)
+init.obj :      init.c, $(TNNTP), $(HFILES)
+lang.obj :      lang.c, $(HFILES)
+list.obj :      list.c, $(HFILES)
+mail.obj :      mail.c, $(HFILES)
+main.obj :      main.c, $(HFILES)
+makecfg.obj :   makecfg.c, $(HFILES)
+memory.obj :    memory.c, $(HFILES)
+misc.obj :      misc.c, $(HFILES)
+msmail.obj :    msmail.c, $(HFILES)
+newsrc.obj :    newsrc.c, $(HFILES)
+nntplib.obj :   nntplib.c, $(TNNTP), $(HFILES)
+nntpw32.obj :   nntpw32.c, $(HFILES)
+open.obj :      open.c, $(HFILES)
+os_2.obj :      os_2.c, $(HFILES), $(INCDIR)os_2.h
+page.obj :      page.c, $(HFILES)
+parsdate.obj :  parsdate.c, $(HFILES)
+post.obj :      post.c, $(HFILES)
+prompt.obj :    prompt.c, $(HFILES)
+save.obj :      save.c, $(HFILES)
+screen.obj :    screen.c, $(HFILES)
+search.obj :    search.c, $(HFILES)
+select.obj :    select.c, $(HFILES)
+sigfile.obj :   sigfile.c, $(HFILES)
+signal.obj :    signal.c, $(HFILES)
+strftime.obj :  strftime.c, $(HFILES)
+thread.obj :    thread.c, $(HFILES)
+wildmat.obj :   wildmat.c, $(HFILES)
+win32.obj :     win32.c, $(HFILES)
+xref.obj :      xref.c, $(HFILES)
+vms.obj :       vms.c, $(HFILES)
+rfc1522.obj :       rfc1522.c, $(HFILES)
+rfc1521.obj :       rfc1521.c, $(HFILES)
+string.obj :        string.c, $(HFILES)
+header.obj :        header.c, $(TNNTP), $(HFILES)
+nrctbl.obj :        nrctbl.c, $(HFILES)
+read.obj :        read.c, $(HFILES)
+refs.obj :        refs.c, $(HFILES)
+regex.obj :        regex.c, $(HFILES)
+auth.obj :        auth.c, $(HFILES)
+
+parsdate.c : parsdate.y
+    $(YACC) $?
+    rename/log $(YACCOUTPUT) $@
+
+clean : vmslib pcrelib
+    @- WRITE SYS$OUTPUT "Cleaning tin directory"
+    @- if f$search("*.obj;*") .nes. "" then Delete/Log *.obj;*
+    @- if f$search("*.lis;*") .nes. "" then Delete/Log *.lis;*
+    @- if f$search("makecfg.exe;*") .nes. "" then Delete/Log makecfg.exe;*
+    @- if f$search("tincfg.h;*") .nes. "" then Delete/Log tincfg.h;*
+    @- if f$search("tin.*;*") .nes. "" then Delete/Log tin.*;*
+    @- !Delete/Log parsdate.c;*
+
+
+
+.IFDEF VAXC
+
+.IFDEF MULTINET
+.FIRST :
+    Define SYS 		Multinet_Common_Root:[Multinet.Include.Sys],Sys$Library
+    Define VAXC$INCLUDE	Multinet_Common_Root:[Multinet.Include.Sys],Sys$Library
+.ELSE
+.FIRST :
+    Define SYS 		Sys$Library
+    Define VAXC$INCLUDE	Sys$Library
+.ENDIF
+
+.LAST :
+    deassign sys
+    deassing vaxc$include
+
+.ELSE
+.IFDEF GNUC
+
+.FIRST :
+   define sys sys$share
+
+.LAST :
+    deassign sys
+
+.ENDIF
+.ENDIF
+
diff -Nur tin-980117/src/feed.c tin-980202/src/feed.c
--- tin-980117/src/feed.c	Sun Jan 11 19:04:43 1998
+++ tin-980202/src/feed.c	Thu Jan 22 23:50:55 1998
@@ -95,15 +95,7 @@
 	 * try and work out what default the user wants
 	 * This is dumb. If you have _any_ selected arts, then it picks 'h'
 	 */
-	if (num_of_tagged_arts) {
-		ch_default = iKeyFeedTag;
-	} else if (num_of_selected_arts) {
-		ch_default = iKeyFeedHot;
-	} else if (num_of_responses (b)) {
-		ch_default = iKeyFeedThd;
-	} else {
-		ch_default = iKeyFeedArt;
-	}
+	ch_default = (num_of_tagged_arts ? iKeyFeedTag : (num_of_selected_arts ? iKeyFeedHot : ((num_of_responses (b)) ? iKeyFeedThd : iKeyFeedArt)));
 
 	switch (function) {
 		case FEED_MAIL:
@@ -154,7 +146,7 @@
 			if (strlen (pattern))
 				my_strncpy (default_regex_pattern, pattern, sizeof (default_regex_pattern));
 			else {
-				if (default_regex_pattern[0])
+				if (*default_regex_pattern)
 					my_strncpy (pattern, default_regex_pattern, sizeof (default_regex_pattern));
 				else {
 					info_message (txt_no_match);
@@ -177,7 +169,7 @@
 			if (strlen (address))
 				strcpy (default_mail_address, address);
 			else {
-				if (default_mail_address[0])
+				if (*default_mail_address)
 					strcpy (address, default_mail_address);
 				else {
 					info_message (txt_no_mail_address);
@@ -195,7 +187,7 @@
 			if (strlen (command))
 				strcpy (default_pipe_command, command);
 			else {
-				if (default_pipe_command[0])
+				if (*default_pipe_command)
 					strcpy (command, default_pipe_command);
 				else {
 					info_message (txt_no_command);
@@ -209,23 +201,16 @@
 				return;
 			}
 			wait_message (0, txt_piping);
-			Raw (FALSE);
+			EndWin();
 			break;
 		case FEED_PRINT:
-			if (cmd_line_printer[0])
-				sprintf (command, "%s %s", cmd_line_printer, REDIRECT_OUTPUT);
-			else
-				sprintf (command, "%s %s", group->attribute->printer, REDIRECT_OUTPUT);
+			sprintf (command, "%s %s", (*cmd_line_printer ? cmd_line_printer : group->attribute->printer), REDIRECT_OUTPUT);
 			break;
 		case FEED_SAVE:		/* ask user for filename to save to */
 		case FEED_SAVE_TAGGED:
 			free_save_array ();
 			if ((!default_auto_save || arts[respnum].archive == (char *) 0)) {
-
-				if (group->attribute->savefile != (char *) 0)
-					strcpy (save_file, group->attribute->savefile);
-				else
-					strcpy (save_file, default_save_file);
+				strcpy (save_file, ((group->attribute->savefile != (char *) 0) ? group->attribute->savefile : default_save_file));
 
 				if (function != FEED_SAVE_TAGGED) {
 					sprintf (msg, txt_save_filename, save_file);
@@ -235,17 +220,14 @@
 						return;
 					}
 				}
-				if (strlen (filename)) {
+				if (*filename) {
 					if (group->attribute->savefile != (char *) 0) {
 						free (group->attribute->savefile);
 						group->attribute->savefile = my_strdup (filename);
-					} else
-						strcpy (default_save_file, filename);
-
-					my_strncpy (default_save_file, filename,
-						sizeof (default_save_file));
+					}
+					my_strncpy (default_save_file, filename, sizeof (default_save_file));
 				} else {
-					if (save_file[0])
+					if (*save_file)
 						my_strncpy (filename, save_file, sizeof (filename));
 					else {
 						info_message (txt_no_filename);
@@ -331,7 +313,7 @@
 					my_strncpy (default_repost_group, group_name,
 						sizeof (default_repost_group));
 				} else {
-					if (default_repost_group[0]) {
+					if (*default_repost_group) {
 						my_strncpy (group_name, default_repost_group,
 							sizeof (group_name));
 					} else {
@@ -379,7 +361,7 @@
 					if (can_post)
 						redraw_screen = repost_article (group_name, &arts[respnum], respnum, supersede);
 					else
-						info_message(txt_cannot_post);
+						info_message (txt_cannot_post);
 					break;
 
 				default:
@@ -437,7 +419,7 @@
 						if (can_post)
 							redraw_screen = repost_article (group_name, &arts[i], i, supersede);
 						else
-							info_message(txt_cannot_post);
+							info_message (txt_cannot_post);
 						break;
 
 					default:
@@ -495,7 +477,7 @@
 								if (can_post)
 									redraw_screen = repost_article (group_name, &arts[j], j, supersede);
 								else
-									info_message(txt_cannot_post);
+									info_message (txt_cannot_post);
 								break;
 
 							default:
@@ -531,15 +513,13 @@
 							proceed = TRUE;
 
 					if (proceed) {
-						if (level == PAGE_LEVEL) {
+						if (level == PAGE_LEVEL)
 							art_close ();
-						}
-						if (!does_article_exist (function, &arts[j], group_path)) {
+						if (!does_article_exist (function, &arts[j], group_path))
 							continue;
-						}
-						if (process_only_unread && arts[j].status == ART_READ) {
+						if (process_only_unread && arts[j].status == ART_READ)
 							continue;
-						}
+
 						switch (function) {
 
 							case FEED_MAIL:
@@ -567,7 +547,7 @@
 								if (can_post)
 									redraw_screen = repost_article (group_name, &arts[j], j, supersede);
 								else
-									info_message(txt_cannot_post);
+									info_message (txt_cannot_post);
 								break;
 
 							default:
diff -Nur tin-980117/src/filter.c tin-980202/src/filter.c
--- tin-980117/src/filter.c	Thu Jan  8 02:08:16 1998
+++ tin-980202/src/filter.c	Sun Feb  1 04:22:31 1998
@@ -22,8 +22,8 @@
 #define IS_KILLED(i)	(arts[i].killed)
 #define IS_SELECTED(i)	(arts[i].selected)
 
-/* SET_FILTER in group grp, current article arts[i], with rule ptr[j] */
-/*
+/* SET_FILTER in group grp, current article arts[i], with rule ptr[j]
+ *
  * filtering is now done this way:
  * a. set score for all articles and rules
  * b. check each article if the score is above or below the limit
@@ -52,8 +52,8 @@
 struct t_filters glob_filter = { 0, 0, (struct t_filter *) 0 };
 
 /*
-** Local prototypes
-*/
+ * Local prototypes
+ */
 static int get_choice (int x, const char *help, const char *prompt, const char *opt1, const char *opt2, const char *opt3, const char *opt4, const char *opt5);
 static int iAddFilterRule (struct t_group *psGrp, struct t_article *psArt, struct t_filter_rule *psRule);
 static int unfilter_articles (void);
@@ -71,8 +71,8 @@
  * library (see pcre/pcre.[ch] for details)
  */
 struct regex_cache {
-	pcre		*re;
-	pcre_extra	*extra;
+	pcre *re;
+	pcre_extra *extra;
 };
 
 struct t_filter *
@@ -186,6 +186,7 @@
 	t_bool global_file)
 {
 	FILE *fp;
+	char *s;
 	char buf[HEADER_LEN];
 	char scope[HEADER_LEN];
 	char subj[HEADER_LEN];
@@ -195,7 +196,6 @@
 	char xref[HEADER_LEN];
 	char xref_score[HEADER_LEN];
 	char scbuf[PATH_LEN];
-	char *s;
 	int expired = FALSE;
 	int expired_time = FALSE;
 	int global = TRUE;
@@ -205,8 +205,8 @@
 	int xref_max = 0;
 	int xref_score_cnt = 0;
 	int xref_score_value = 0;
-	time_t current_secs = 0L;
 	long secs = 0L;
+	time_t current_secs = 0L;
 	struct t_group *psGrp;
 
 	if ((fp = fopen (file, "r")) == (FILE *) 0)
@@ -366,10 +366,10 @@
 #endif
 				break;
 			}
+
 			/*
-			 *  read score for rule
+			 * read score for rule
 			 */
-
 			if (match_string (buf+1, "core=", scbuf, PATH_LEN)) {
 				score = atoi(scbuf);
 #ifdef DEBUG
@@ -386,10 +386,8 @@
 					else if (score == 0) {
 						if (strncmp(scbuf, "kill", 4) == 0)
 							score = SCORE_KILL;
-						else if (strncmp(scbuf, "hot", 3) == 0)
-							score = SCORE_SELECT;
 						else
-							score = SCORE_DEFAULT;
+							score = (strncmp(scbuf, "hot", 3) == 0) ? SCORE_SELECT : SCORE_DEFAULT;
 					}
 					if ((arr_ptr[i].type == FILTER_KILL && score > 0) || (arr_ptr[i].type == FILTER_SELECT && score < 0))
 						score = -score;
@@ -479,7 +477,7 @@
 }
 
 /*
- *  write filter strings to ~/.tin/filter
+ * write filter strings to ~/.tin/filter
  */
 
 static void
@@ -622,8 +620,8 @@
 	const char *opt4,
 	const char *opt5)
 {
-	int ch, n = 0, i = 0;
 	const char *argv[5];
+	int ch, n = 0, i = 0;
 
 	if (opt1)
 		argv[n++] = opt1;
@@ -658,8 +656,8 @@
 }
 
 /*
- *  Interactive filter menu so that the user can dynamically enter parameters.
- *  Can be configured for kill or auto-selection screens.
+ * Interactive filter menu so that the user can dynamically enter parameters.
+ * Can be configured for kill or auto-selection screens.
  */
 
 int
@@ -769,7 +767,7 @@
 	if (!prompt_menu_string (INDEX_TOP, (int) strlen (ptr_filter_text), rule.text))
 		return FALSE;
 
-	if (rule.text[0]) {
+	if (*rule.text) {
 		i = get_choice (INDEX_TOP+1, txt_help_filter_text_type,
 			       txt_filter_text_type,
 			       txt_subj_line_only_case,
@@ -783,7 +781,7 @@
 		rule.counter = i;
 	}
 
-	if (!rule.text[0]) {
+	if (!*rule.text) {
 		rule.check_string = TRUE;
 		/*
 		 * Subject:
@@ -798,10 +796,7 @@
 		/*
 		 * From:
 		 */
-		if (rule.subj_ok)
-			i = get_choice (INDEX_TOP+4, txt_help_filter_from, text_from, txt_no, txt_yes, (char *)0, (char *)0, (char *)0);
-		else
-			i = get_choice (INDEX_TOP+4, txt_help_filter_from, text_from, txt_yes, txt_no, (char *)0, (char *)0, (char *)0);
+		i = get_choice (INDEX_TOP+4, txt_help_filter_from, text_from, (rule.subj_ok ? txt_no : txt_yes) , (rule.subj_ok ? txt_yes : txt_no), (char *)0, (char *)0, (char *)0);
 
 		if (i == -1)
 			return FALSE;
@@ -892,7 +887,7 @@
 
 	rule.score = atoi(buf);
 	/*
-	 *  assure we are in range
+	 * assure we are in range
 	 */
 	if (rule.score <= 0)
 		rule.score = SCORE_DEFAULT;
@@ -919,7 +914,7 @@
 	/*
 	 * Scope
 	 */
-	if (rule.text[0] || rule.subj_ok || rule.from_ok || rule.msgid_ok || rule.lines_ok) {
+	if (*rule.text || rule.subj_ok || rule.from_ok || rule.msgid_ok || rule.lines_ok) {
 		strcpy (argv[0], group->name);
 		strcpy (argv[1], txt_all_groups);
 		strcpy (argv[2], group->name);
@@ -960,7 +955,7 @@
 		ch = prompt_slk_response(ch_default, "eqs\033", ptr_filter_quit_edit_save);
 		switch (ch) {
 /*
- *  what is this? when you edit the filter_file the rule is not saved?
+ * what is this? when you edit the filter_file the rule is not saved?
  */
 
 		case iKeyFilterEdit:
@@ -999,7 +994,7 @@
 }
 
 /*
- *  Quick command to add a kill filter to specified groups filter
+ * Quick command to add a kill filter to specified groups filter
  */
 
 int
@@ -1036,16 +1031,8 @@
 	rule.lines_ok = (header == FILTER_LINES);
 	rule.msgid_ok = (header == FILTER_MSGID) || (header == FILTER_MSGID_LAST);
 	rule.fullref = header; /* value is directly used to select correct filter type */
-
-	if (header == FILTER_FROM_CASE_SENSITIVE || header == FILTER_FROM_CASE_IGNORE)
-		rule.from_ok = TRUE;
-	else
-		rule.from_ok = FALSE;
-
-	if (header == FILTER_SUBJ_CASE_SENSITIVE || header == FILTER_SUBJ_CASE_IGNORE)
-		rule.subj_ok = TRUE;
-	else
-		rule.subj_ok = FALSE;
+	rule.from_ok = (header == FILTER_FROM_CASE_SENSITIVE || header == FILTER_FROM_CASE_IGNORE);
+	rule.subj_ok = (header == FILTER_SUBJ_CASE_SENSITIVE || header == FILTER_SUBJ_CASE_IGNORE);
 
 	rule.text[0] = '\0';
 	rule.type = FILTER_KILL;
@@ -1060,7 +1047,7 @@
 }
 
 /*
- *  Quick command to add an auto-select filter to specified groups filter
+ * Quick command to add an auto-select filter to specified groups filter
  */
 
 int
@@ -1097,17 +1084,8 @@
 	rule.lines_ok = (header == FILTER_LINES);
 	rule.msgid_ok = (header == FILTER_MSGID) || (header == FILTER_MSGID_LAST);
 	rule.fullref = header; /* value is directly used to select correct filter type */
-
-	if (header == FILTER_FROM_CASE_SENSITIVE || header == FILTER_FROM_CASE_IGNORE)
-		rule.from_ok = TRUE;
-	else
-		rule.from_ok = FALSE;
-
-	if (header == FILTER_SUBJ_CASE_SENSITIVE || header == FILTER_SUBJ_CASE_IGNORE)
-		rule.subj_ok = TRUE;
-	else
-		rule.subj_ok = FALSE;
-
+	rule.from_ok = (header == FILTER_FROM_CASE_SENSITIVE || header == FILTER_FROM_CASE_IGNORE);
+	rule.subj_ok = (header == FILTER_SUBJ_CASE_SENSITIVE || header == FILTER_SUBJ_CASE_IGNORE);
 	rule.text[0] = '\0';
 	rule.type = FILTER_SELECT;
 	rule.icase = group->attribute->quick_select_case;
@@ -1121,9 +1099,9 @@
 }
 
 /*
- *  Quick command to add an auto-select filter to the article that user
- *  has just posted. Selects on Subject: line with limited expire time.
- *  Don't precess if MAILGROUP.
+ * Quick command to add an auto-select filter to the article that user
+ * has just posted. Selects on Subject: line with limited expire time.
+ * Don't precess if MAILGROUP.
  */
 int
 quick_filter_select_posted_art (
@@ -1174,14 +1152,12 @@
 /*
  * API to add filter rule to the local or global filter array
  */
-/* ARGSUSED */
 static int
 iAddFilterRule (
 	struct t_group *psGrp,
 	struct t_article *psArt,
 	struct t_filter_rule *psRule)
 {
-
 	char acBuf[PATH_LEN];
 	int iFiltered = FALSE;
 	int *plNum, *plMax;
@@ -1210,8 +1186,15 @@
 	psPtr[*plNum].xref_max = 0;
 	psPtr[*plNum].xref_score_cnt = 0;
 
-	if (psRule->scope[0] != '*' && psRule->scope[1] != '\0')
-		psPtr[*plNum].scope = my_strdup (psRule->scope);
+	if (psRule->scope[0] == '\0') {
+		/* replace empty scope with current group name */
+		psPtr[*plNum].scope = my_strdup (psGrp->name);
+	} else {
+		if ((psRule->scope[0] != '*') && (psRule->scope[1] != '\0')) {
+			/* copy non-global scope */
+			psPtr[*plNum].scope = my_strdup (psRule->scope);
+		}
+	}
 
 	time (&lCurTime);
 	switch(psRule->expire_time)
@@ -1230,7 +1213,7 @@
 			break;
 	}
 
-	if (psRule->text[0]) {
+	if (*psRule->text) {
 		sprintf (acBuf, REGEX_FMT, quote_wild_whitespace(psRule->text));
 
 		switch (psRule->counter) {
@@ -1262,12 +1245,9 @@
 		iFiltered = TRUE;
 		(*plNum)++;
 	} else {
+		psPtr[*plNum].icase = psRule->icase;
 		if (psRule->subj_ok) {
-			if (psRule->check_string)
-				sprintf (acBuf, REGEX_FMT, quote_wild (psArt->subject));
-			else
-				sprintf (acBuf, REGEX_FMT, psArt->subject);
-
+			sprintf (acBuf, REGEX_FMT, (psRule->check_string ? quote_wild (psArt->subject) : psArt->subject));
 			psPtr[*plNum].subj = my_strdup (acBuf);
 		}
 		if (psRule->from_ok) {
@@ -1421,8 +1401,9 @@
 				 */
 				if (ptr[j].subj != (char *) 0) {
 					if (!wildcard) {
-						if (wildmat(arts[i].subject, ptr[j].subj, ptr[j].icase))
+						if (wildmat(arts[i].subject, ptr[j].subj, ptr[j].icase)) {
 							SET_FILTER(group, i, j);
+						}
 					} else {
 						if (!regex_cache_subj[j].re) {
 							if ((regex_cache_subj[j].re = pcre_compile(ptr[j].subj,
@@ -1459,8 +1440,9 @@
 					else
 						strcpy (buf, arts[i].from);
 					if (!wildcard) {
-						if (wildmat(buf, ptr[j].from, ptr[j].icase))
+						if (wildmat(buf, ptr[j].from, ptr[j].icase)) {
 							SET_FILTER(group, i, j);
+						}
 					} else {
 						if (!regex_cache_from[j].re) {
 							if ((regex_cache_from[j].re = pcre_compile(ptr[j].from,
@@ -1522,9 +1504,9 @@
 					}
 
 					if (!wildcard) {
-						if (wildmat(myrefs, ptr[j].msgid, FALSE) ||
-						 wildmat(MSGID(art), ptr[j].msgid, FALSE))
+						if (wildmat(myrefs, ptr[j].msgid, FALSE) || wildmat(MSGID(art), ptr[j].msgid, FALSE)) {
 							SET_FILTER(group, i, j);
+						}
 					} else {
 						if (!regex_cache_msgid[j].re) {
 							if ((regex_cache_msgid[j].re = pcre_compile(ptr[j].msgid,
@@ -1675,8 +1657,9 @@
 							while(*s && isspace(*s))
 								s++;
 						}
-						if(group_count==-1 || group_count>ptr[j].xref_max)
+						if(group_count==-1 || group_count>ptr[j].xref_max) {
 							SET_FILTER(group, i, j);
+						}
 					}
 				}
 			}
@@ -1685,7 +1668,6 @@
 
 	/*
 	 * throw away the contents of all regex_caches
-	 *
 	 */
 	if (wildcard) {
 		for (j=0 ; j < num ; j++) {
diff -Nur tin-980117/src/group.c tin-980202/src/group.c
--- tin-980117/src/group.c	Thu Jan  8 15:38:37 1998
+++ tin-980202/src/group.c	Wed Jan 28 07:14:27 1998
@@ -152,10 +152,7 @@
 			if (new_responses (i))
 				break;
 		}
-		if (i < top_base)
-			index_point = i;
-		else
-			index_point = top_base - 1;
+		index_point = ((i < top_base) ? i : (top_base - 1));
 	} else
 		index_point = top_base - 1;
 
@@ -366,10 +363,7 @@
 			case iKeyGroupNextUnreadArtOrGrp:	/* goto next unread article/group */
 group_tab_pressed:
 				space_mode = TRUE;
-				if (index_point < 0)
-					n = -1;
-				else
-					n = next_unread ((int) base[index_point]);
+				n = ((index_point < 0) ? -1 : next_unread ((int) base[index_point]));
 				if (index_point < 0 || n < 0) {
 					for (i = cur_groupnum+1 ; i < group_top ; i++) {
 						if (active[my_group[i]].newsrc.num_unread > 0)
@@ -506,11 +500,7 @@
 group_down:
 				if (!top_base)
 					break;
-
-				if (index_point + 1 >= top_base)
-					move_to_thread (0);
-				else
-					move_to_thread (index_point + 1);
+				move_to_thread ((index_point + 1 >= top_base) ? 0 : (index_point + 1));
 				break;
 
 			case iKeyUp:		/* line up */
@@ -518,11 +508,7 @@
 group_up:
 				if (!top_base)
 					break;
-
-				if (index_point == 0)
-					move_to_thread (top_base - 1);
-				else
-					move_to_thread (index_point - 1);
+				move_to_thread ((index_point == 0) ? (top_base - 1) : (index_point - 1));
 				break;
 
 			case iKeyPageUp:		/* page up */
@@ -870,8 +856,7 @@
 
 				i = -1;
 				if (index_point >= 0) {
-					if (CURR_GROUP.attribute->show_only_unread ||
-					    new_responses (index_point)) {
+					if (CURR_GROUP.attribute->show_only_unread || new_responses (index_point)) {
 						i = base[index_point];
 					} else if ((n = prev_unread ((int)base[index_point])) >= 0) {
 						i = n;
@@ -994,7 +979,8 @@
 					show_group_page ();
 				break;
 
-			case iKeyPostponed:	/* post postponed article */
+			case iKeyPostponed:
+			case iKeyPostponed2:	/* post postponed article */
 				if (can_post) {
 					if (pickup_postponed_articles(FALSE, FALSE)) {
 						show_group_page ();
@@ -1449,10 +1435,7 @@
 		}
 	}
 
-	if (cur_pos < top_base)
-		return cur_pos;
-	else
-		return (top_base - 1);
+	return ((cur_pos < top_base)? cur_pos : (top_base - 1));
 }
 
 
@@ -1469,7 +1452,7 @@
 		stow_cursor();
 		my_flush ();
 	} else {
-#if USE_CURSES
+#ifdef USE_CURSES
 		int y, x;
 		getyx(stdscr, y, x);
 		mvaddstr(INDEX_TOP + screen_row, screen_col, value);
@@ -1499,23 +1482,15 @@
 	 * This function is called early during startup when we only have
 	 * very limited information loaded.
 	 */
-	if (group_top && CURR_GROUP.attribute)
-		show_author = CURR_GROUP.attribute->show_author;
-	else
-		show_author = default_show_author;
-
-	if (show_author == SHOW_FROM_BOTH)
-		max_subj = (num_cols / 2) - 4;
-	else
-		max_subj = (num_cols / 2) + 3;
-
+	show_author = ((group_top && CURR_GROUP.attribute) ? CURR_GROUP.attribute->show_author : default_show_author);
+	max_subj = ((show_author == SHOW_FROM_BOTH) ? ((num_cols / 2) - 4): ((num_cols / 2) + 3));
 	max_from = (num_cols - max_subj) - 17;
 
 	if (show_author != SHOW_FROM_BOTH) {
 		if (max_from > 25) {
 			size = max_from - 25;
 			max_from = 25;
-			max_subj = max_subj + size;
+			max_subj += size;
 		}
 	}
 
@@ -1559,7 +1534,7 @@
 bld_sline (
 	int i)
 {
-#if USE_CURSES
+#ifdef USE_CURSES
 	char buffer[BUFSIZ];	/* FIXME: allocate? */
 #else
 	char *buffer;
@@ -1580,21 +1555,17 @@
 	/*
 	 * n is number of articles in this thread
 	 */
-	if (CURR_GROUP.attribute->show_only_unread)
-		n = sbuf.unread + sbuf.seen;
-	else
-		n = sbuf.total;
+	n = ((CURR_GROUP.attribute->show_only_unread) ? (sbuf.unread + sbuf.seen) : sbuf.total);
 	/*
 	 * if you like to see the number of responses excluding the fist
 	 *	art in thread - add the following:
 	 *	n--;
 	 */
 
-	if ((j = line_is_tagged(respnum))) {
+	if ((j = line_is_tagged(respnum)))
 		strcpy (new_resps, tin_itoa(j, 3));
-	} else {
+	else
 		sprintf (new_resps, "  %c", sbuf.art_mark);
-	}
 
 	/*
 	 * Find index of first unread in this thread
@@ -1607,22 +1578,19 @@
 				char tmp_buffer[4];
 				strcpy (tmp_buffer, tin_itoa(n, 3));
 				sprintf (art_cnt, "%s %s ", tmp_buffer, tin_itoa(arts[j].lines, 4));
-			} else {
+			} else
 				sprintf (art_cnt, "%s    ? ", tin_itoa(n, 3));
-			}
 		} else {
-			if (arts[j].lines != -1) {
+			if (arts[j].lines != -1)
 				sprintf (art_cnt, "    %s ", tin_itoa(arts[j].lines, 4));
-			} else {
+			else
 				strcpy (art_cnt, "       ? ");
-			}
 		}
 	} else {
-		if (n > 1) { /* change this to (n > 0) if you do a n-- above */
+		if (n > 1) /* change this to (n > 0) if you do a n-- above */
 			sprintf (art_cnt, "%s ", tin_itoa(n, 3));
-		} else {
+		else
 			strcpy (art_cnt, "    ");
-		}
 	}
 
 	if (CURR_GROUP.attribute->show_author != SHOW_FROM_NONE)
@@ -1632,7 +1600,7 @@
 	j = INDEX2SNUM(i);
 	arts_sub[len_subj-5+1] = '\0';
 
-#if !USE_CURSES
+#ifndef USE_CURSES
 	buffer = screen[j].col;
 #endif
 	sprintf (buffer, "  %s %s %s%-*.*s%s%-*.*s",
@@ -1668,7 +1636,7 @@
 	int tlen;
 	int x = full ? 0 : 6;
 	int k = MARK_OFFSET;
-#if USE_CURSES
+#ifdef USE_CURSES
 	char buffer[BUFSIZ];
 	char *s = screen_contents(INDEX2LNUM(i), x, buffer);
 #else
@@ -1681,9 +1649,9 @@
 			CleartoEOLN ();
 		}
 		tlen = strlen (s);	/* notes new line length */
-	} else {
+	} else
 		tlen = 12; /* ??? */
-	}
+
 	MoveCursor (INDEX2LNUM(i), x);
 	if (tlen)
 		my_printf("%.*s", tlen, s);
@@ -1718,14 +1686,12 @@
 	num = my_group[cur_groupnum];
 
 	if (active[num].attribute->show_only_unread) {
-		for (i = 0 ; i < top_base ; i++) {
+		for (i = 0 ; i < top_base ; i++)
 			art_cnt += new_responses (i);
-		}
 	} else {
 		for (i = 0 ; i < top ; i++) {
-			if (!IGNORE_ART(i)) {
+			if (!IGNORE_ART(i))
 				++art_cnt;
-			}
 		}
 	}
 
diff -Nur tin-980117/src/header.c tin-980202/src/header.c
--- tin-980117/src/header.c	Wed Dec 31 04:05:06 1997
+++ tin-980202/src/header.c	Sun Feb  1 05:31:51 1998
@@ -76,7 +76,7 @@
  * which is illegal on a 68000
  */
 static const char *domain_name_hack = DOMAIN_NAME;
-#		undef   DOMAIN_NAME
+#		undef	DOMAIN_NAME
 #		define DOMAIN_NAME domain_name_hack
 #	endif /* M_AMIGA */
 
@@ -90,7 +90,7 @@
 #else
 	if (domain[0] == '/' && domain[1]) {
 #	endif /* M_AMIGA */
-		/* If 1st letter is '/' read domianname from specified file */
+		/* If 1st letter is '/' read domainname from specified file */
 		if ((fp = fopen (domain, "r")) != (FILE *) 0) {
 			while (fgets (buff, sizeof (buff), fp) != (char *) 0) {
 				if (buff[0] == '#' || buff[0] == '\n')
@@ -143,13 +143,13 @@
 		in.s_addr=inet_addr(name);
 		if ((hp=gethostbyaddr((char *)&in.s_addr,4,AF_INET)))
 			in.s_addr=(*hp->h_addr);
-		return(hp&&strchr(hp->h_name,'.')?hp->h_name:inet_ntoa(in));
+		return(hp&&strchr(hp->h_name,'.') ? hp->h_name : inet_ntoa(in));
 	}
 	if ((hp=gethostbyname(name))&&!strchr(hp->h_name,'.'))
 		if ((hp=gethostbyaddr(hp->h_addr,hp->h_length,hp->h_addrtype)))
 			in.s_addr=(*hp->h_addr);
 
-	sprintf(fqdn,"%s",hp?strchr(hp->h_name,'.')?hp->h_name:inet_ntoa(in):NULL);
+	sprintf(fqdn,"%s",hp ? strchr(hp->h_name,'.') ? hp->h_name : inet_ntoa(in) : NULL);
 	if (!*fqdn || (fqdn[strlen(fqdn)-1] <= '9')) {
 		*fqdn = 0;
 		inf = fopen("/etc/resolv.conf", "r");
@@ -205,20 +205,24 @@
 get_user_name(
 	void)
 {
-#ifdef M_AMIGA
+#if defined (M_AMIGA) || (defined VMS)
 	char *p;
 #endif
 	static char username[128];
 	struct passwd *pw;
 
 	username[0] = '\0';
-#ifndef M_AMIGA
+#if defined (M_AMIGA) || defined (VMS)
+	if ((p = getenv ("USER"))) {
+		STRCPY (username, p);
+#	ifdef VMS
+		lower (username);
+#	endif /* VMS */
+	}
+#else
 	pw = getpwuid (getuid ());
 	strcpy (username, pw->pw_name);
-#else
-	if ((p = getenv ("USER")))
-		strncpy (username, p, 128);
-#endif
+#endif /* M_AMIGA || VMS */
 	return(username);
 }
 
@@ -243,6 +247,9 @@
 		return (fullname);
 	}
 
+#ifdef VMS
+	strncpy (fullname, fix_fullname(get_uaf_fullname()),sizeof (fullname));
+#else  /* !VMS */
 	pw = getpwuid (getuid ());
 	strncpy (buf, pw->pw_gecos, sizeof (fullname));
 	if ((p = strchr (buf, ',')))
@@ -256,6 +263,7 @@
 		sprintf (fullname, "%s%s%s", buf, tmp, p);
 	} else
 		strcpy (fullname, buf);
+#endif /* !VMS */
 	return (fullname);
 }
 
@@ -272,7 +280,11 @@
 	struct t_group *thisgrp)
 {
 #ifndef INDEX_DAEMON
+#ifdef USE_INN_NNTPLIB
 	char *fromhost = GetConfigValue (_CONF_FROMHOST);
+#else /* USE_INN_NNTPLIB */
+	char *fromhost = NULL;
+#endif /* USE_INN_NNTPLIB */
 
 	if (!(fromhost && *fromhost))
 		fromhost = domain_name;
@@ -287,10 +299,7 @@
 		return;
 	}
 
-	if (strchr(get_full_name(), '.'))
-		sprintf (from_name, "\"%s\" <%s@%s>", get_full_name(), get_user_name(), fromhost);
-	else
-		sprintf (from_name, "%s <%s@%s>", get_full_name(), get_user_name(), fromhost);
+	sprintf (from_name,((strchr(get_full_name(), '.')) ? "\"%s\" <%s@%s>" : "%s <%s@%s>"), get_full_name(), get_user_name(), fromhost);
 #ifdef DEBUG
 	if (debug == 2)
 		error_message ("FROM=[%s] USER=[%s] HOST=[%s] NAME=[%s]", from_name, get_user_name(), domain_name, get_full_name());
diff -Nur tin-980117/src/help.c tin-980202/src/help.c
--- tin-980117/src/help.c	Wed Dec 31 04:05:21 1997
+++ tin-980202/src/help.c	Sat Jan 24 01:59:34 1998
@@ -312,7 +312,7 @@
 					break;
 
 				case KEYMAP_UP:
-#if USE_CURSES
+#ifdef USE_CURSES
 					ch = iKeyUp;
 					break;
 #endif
@@ -322,7 +322,7 @@
 					break;
 
 				case KEYMAP_DOWN:
-#if USE_CURSES
+#ifdef USE_CURSES
 					ch = iKeyDown;
 					break;
 #endif
@@ -364,10 +364,7 @@
 	if (NOTESLINES <= 0)
 		return;
 
-	if (beginner_level)
-		help_lines = NOTESLINES + MINI_HELP_LINES - 1;
-	else
-		help_lines = NOTESLINES;
+	help_lines = (beginner_level ? (NOTESLINES + MINI_HELP_LINES - 1) : NOTESLINES);
 
 	set_signals_help ();
 
@@ -398,7 +395,7 @@
 		max_page++;
 
 	set_xclick_off ();
-#if USE_CURSES
+#ifdef USE_CURSES
 	ClearScreen();
 #endif
 	forever {
@@ -411,7 +408,7 @@
 			case ESC:	/* common arrow keys */
 				break;
 
-#if USE_CURSES
+#ifdef USE_CURSES
 			case iKeyUp:				/* line up */
 				if (--pos_help < 0)
 					pos_help = (max_page-1) * help_lines;
@@ -486,7 +483,7 @@
 #ifdef HAVE_COLOR
 	fcol(col_help);
 #endif
-#if USE_CURSES
+#ifdef USE_CURSES
 	if (first)
 #endif
 		ClearScreen ();
@@ -494,10 +491,7 @@
 	center_line (0, TRUE, buf);
 	MoveCursor (INDEX_TOP, 0);
 
-	if (beginner_level)
-		help_lines = NOTESLINES + MINI_HELP_LINES - 1;
-	else
-		help_lines = NOTESLINES;
+	help_lines = (beginner_level ? (NOTESLINES + MINI_HELP_LINES - 1) : NOTESLINES);
 
 	if (info_type == HELP_INFO) {
 		for (i=pos_help ; i < (pos_help + help_lines) && info_help[i] ; i++)
diff -Nur tin-980117/src/inews.c tin-980202/src/inews.c
--- tin-980117/src/inews.c	Sun Jan 11 19:13:57 1998
+++ tin-980202/src/inews.c	Sun Feb  1 05:33:22 1998
@@ -25,18 +25,18 @@
 
 #if 0
 #ifdef VMS
-#   ifdef MULTINET
+#	ifdef MULTINET
 #		define netwrite	socket_write
 #		include "multinet_root:[multinet.include]netdb.h"
-#   else
+#	else
 #		define netwrite	write
 #		include <netdb.h>
-#   endif
+#	endif
 #else
 #	ifdef HAVE_NETDB_H
 #		include	<netdb.h>
 #	endif
-#endif
+#endif /* VMS */
 
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
@@ -207,11 +207,11 @@
 #endif /* DEBUG */
 
 #ifdef M_UNIX
-#	ifdef INEWSDIR
-		strcpy (buf, INEWSDIR);
-		strcat (buf, "/");
-		cp += strlen (cp);
-#	endif /* INEWSDIR */
+		if (*inewsdir) {
+			strcpy (buf, inewsdir);
+			strcat (buf, "/");
+			cp += strlen (cp);
+		}
 		sh_format (cp, sizeof(buf) - (cp - buf), "inews -h < %s", name);
 #else
 		make_post_cmd (cp, name);
diff -Nur tin-980117/src/init.c tin-980202/src/init.c
--- tin-980117/src/init.c	Thu Jan  8 15:21:47 1998
+++ tin-980202/src/init.c	Sun Feb  1 05:26:18 1998
@@ -19,6 +19,12 @@
 #include	"version.h"
 #include	"bugrep.h"
 
+/*
+ * local prototypes
+ */
+static int read_site_config(void);
+static void preinit_colors(void);
+
 char active_times_file[PATH_LEN];
 char art_marked_deleted;
 char art_marked_inrange;
@@ -56,6 +62,7 @@
 char index_maildir[PATH_LEN];
 char index_newsdir[PATH_LEN];
 char index_savedir[PATH_LEN];
+char inewsdir[PATH_LEN];
 char libdir[PATH_LEN];			/* directory where news config files are (ie. active) */
 char local_attributes_file[PATH_LEN];
 char local_config_file[PATH_LEN];
@@ -83,6 +90,7 @@
 char newsgroups_file[PATH_LEN];
 char newsrc[PATH_LEN];
 char novrootdir[PATH_LEN];		/* root directory of nov index files */
+char novfilename[PATH_LEN];		/* file name of a single nov index files */
 char page_header[LEN];			/* page header of pgm name and version */
 char post_proc_command[PATH_LEN];	/* Post processing command */
 char posted_info_file[PATH_LEN];
@@ -399,11 +407,7 @@
 
 #ifdef HAVE_GETHOSTBYNAME
 	if (domain_name[0]=='\0') {
-		if (host_name[0]=='\0')
-			cptr = get_fqdn((char *)NULL);
-		else
-			cptr = get_fqdn(host_name);
-
+		cptr = ((host_name[0]=='\0') ? get_fqdn((char *) 0) : get_fqdn(host_name));
 		if (cptr != (char *)NULL)
 			strcpy (domain_name, cptr);
 	}
@@ -464,19 +468,27 @@
 		fprintf (stderr, "Environment variable USER not set.\n");
 		exit (1);
 	}
-#endif
+#else
+#	ifdef VMS
+	if (((ptr = getlogin ()) != (char *) 0) && strlen (ptr))
+		myentry = getpwnam (ptr);
+#	endif /* VMS */
+#endif /* M_OS2 || WIN32 */
 
 #ifdef M_OS2
 	strcpy (TMPDIR, get_val ("TMP", "/tmp/"));
 	if ((TMPDIR[strlen(TMPDIR)-1] != '/') && (TMPDIR[strlen(TMPDIR)-1] != '\\'))
 		strcat(TMPDIR,"/");
-#endif
+#endif /* M_OS2 */
 #ifdef WIN32
 	strcpy (TMPDIR, get_val ("TMP", "\\tmp\\"));
 	if (TMPDIR[strlen(TMPDIR)-1] != '\\')
 		strcat(TMPDIR,"\\");
-#endif
+#endif /* WIN32 */
 	strcpy (userid, myentry->pw_name);
+#ifdef VMS
+	lower (userid);
+#endif /* VMS */
 
 	if ((ptr = getenv ("TIN_HOMEDIR")) != (char *) 0) {
 		my_strncpy (homedir, ptr, sizeof (homedir));
@@ -579,7 +591,7 @@
 	quote_empty_lines = FALSE;
 	quote_signatures = TRUE;
 	read_local_newsgroups_file = FALSE;
-	reread_active_file = TRUE;
+	force_reread_active_file = TRUE;
 	reread_active_file_secs = REREAD_ACTIVE_FILE_SECS;
 	reread_active_for_posted_arts = TRUE;
 	save_news = FALSE;
@@ -681,6 +693,10 @@
 	news_headers_to_not_display[0] = '\0';
 	news_headers_to_not_display_array = NULL;
 
+	strcpy (bug_addr, BUG_REPORT_ADDRESS);
+	bug_nntpserver1[0] = '\0';
+	bug_nntpserver2[0] = '\0';
+
 	/*
 	 * Amiga uses assigns which end in a ':' and won't work with a '/'
 	 * tacked on after them: e.g. we want UULIB:active, and not
@@ -689,83 +705,137 @@
 	 * on all UNIX systems.
 	 */
 
+#ifdef INEWSDIR
+	strcpy(inewsdir, INEWSDIR);
+#else /* INEWSDIR */
+	inewsdir[0] = '\0';
+#endif /* INEWSDIR */
+
+#ifdef apollo
+	strcpy(default_organization, get_val("NEWSORG", ""));
+#else /* apollo */
+	strcpy(default_organization, get_val("ORGANIZATION", ""));
+#endif /* apollo */
+
+#ifdef USE_INN_NNTPLIB
+	ptr = GetConfigValue (_CONF_ORGANIZATION);
+	if (ptr != (char *) 0)
+		my_strncpy (default_organization, ptr, sizeof (default_organization));
+#endif /* USE_INN_NNTPLIB */
+
+	/* getval sucks - it doesn't check buffer overflows! */
+	strcpy(libdir, get_val("TIN_LIBDIR", NEWSLIBDIR));
 #ifndef NNTP_ONLY
-	strcpy (libdir, get_val ("TIN_LIBDIR", NEWSLIBDIR));
 	strcpy (novrootdir, get_val ("TIN_NOVROOTDIR", NOVROOTDIR));
+	strcpy (novfilename, get_val ("TIN_NOVFILENAME", OVERVIEW_FILE));
 	strcpy (spooldir, get_val ("TIN_SPOOLDIR", SPOOLDIR));
-#endif
+#endif /* NNTP_ONLY */
+	/* clear news_active_file, active_time_file, newsgroups_file */
+	news_active_file[0] = '\0';
+	active_times_file[0] = '\0';
+	newsgroups_file[0] = '\0';
+	subscriptions_file[0] = '\0';
+
+	/*
+	 * read the global site config file to override some default
+	 * values given at compile time
+	 */
+	(void) read_site_config();
+
+	/*
+	 * only set the following variables, if they weren't set from
+	 * within read_site_config()
+	 */
+	if (!*news_active_file)
+		joinpath (news_active_file, libdir, get_val ("TIN_ACTIVEFILE", ACTIVE_FILE));
+	if (!*active_times_file)
+		joinpath (active_times_file, libdir, ACTIVE_TIMES_FILE);
+	if (!*newsgroups_file)
+		joinpath (newsgroups_file, libdir, NEWSGROUPS_FILE);
+	if (!*subscriptions_file)
+		joinpath (subscriptions_file, libdir, SUBSCRIPTIONS_FILE);
+	if (!*default_organization) {
+		char buf[LEN];
+
+		joinpath (buf, libdir, "organization");
+		if ((fp = fopen(buf, "r")) != NULL) {
+			if (fgets (buf, sizeof (buf), fp) != (char *) 0) {
+				ptr = strrchr (buf, '\n');
+				if (ptr != (char *) 0)
+					*ptr = '\0';
+			}
+			fclose (fp);
+			my_strncpy (default_organization, buf, sizeof (default_organization));
+		}
+	}
+
+	/* read_site_config() might have changed the value of libdir */
+	joinpath (global_attributes_file, libdir, ATTRIBUTES_FILE);
+	joinpath (global_config_file, libdir, CONFIG_FILE);
+	joinpath (global_filter_file, libdir, FILTER_FILE);
 
 #ifdef VMS
 	joindir (rcdir, homedir, RCDIR); /* we're naming a directory here */
 	joinpath (rcdir_asfile, homedir, RCDIR);	/* for stat() */
 	strcat(rcdir_asfile, ".DIR");
 	if (stat (rcdir_asfile, &sb) == -1)
-#else
+#else /* VMS */
 	joinpath (rcdir, homedir, RCDIR);
 	if (stat (rcdir, &sb) == -1)
-#endif
+#endif /* VMS */
 	{
 		created_rcdir = TRUE;
 		my_mkdir (rcdir, (S_IRWXU|S_IRUGO|S_IXUGO));
 	}
-
-	strcpy (bug_addr, BUG_REPORT_ADDRESS);
-	bug_nntpserver1[0] = '\0';
-	bug_nntpserver2[0] = '\0';
 #if defined(M_UNIX) || defined (M_AMIGA) || defined(VMS)
 	strcpy (default_mailer_format, MAILER_FORMAT);
-#else
+#else /* M_UNIX ... */
 	strcpy (default_mailer_format, mailer);
-#endif
+#endif /* M_UNIX ... */
 	strcpy (default_printer, DEFAULT_PRINTER);
 #ifdef M_AMIGA
 	if (tin_bbs_mode)
 		strcpy(default_printer, DEFAULT_BBS_PRINTER);
-#endif
+#endif /* M_AMIGA */
 	strcpy (mailer, get_val (ENV_VAR_MAILER, DEFAULT_MAILER));
 	strcpy (quote_chars, DEFAULT_COMMENT);
-
-	joinpath (active_times_file, libdir, ACTIVE_TIMES_FILE);
 #ifdef VMS
 	joinpath (article, homedir, "article.");
-#else
+#else /* VMS */
 	joinpath (article, homedir, ".article");
-#endif
+#endif /* VMS */
 #ifdef APPEND_PID
 	sprintf (article+strlen(article), ".%d", process_id);
-#endif
+#endif /* APPEND_PID */
 	joinpath (dead_article, homedir, "dead.article");
 	joinpath (dead_articles, homedir, "dead.articles");
-
 #ifdef VMS
 	joindir (default_maildir, homedir, DEFAULT_MAILDIR);
 	joindir (default_savedir, homedir, DEFAULT_SAVEDIR);
-#else
+#else /* VMS */
 	joinpath (default_maildir, homedir, DEFAULT_MAILDIR);
 	joinpath (default_savedir, homedir, DEFAULT_SAVEDIR);
-#endif
+#endif /* VMS */
 	joinpath (default_sigfile, homedir, ".Sig");
 	joinpath (default_signature, homedir, ".signature");
-	joinpath (global_attributes_file, libdir, ATTRIBUTES_FILE);
-	joinpath (global_config_file, libdir, CONFIG_FILE);
-	joinpath (global_filter_file, libdir, FILTER_FILE);
 	if (!index_newsdir[0]) {
 #ifdef VMS
-		joindir (index_newsdir, get_val ("TIN_INDEX_NEWSDIR", rcdir), INDEX_NEWSDIR);
-#else
+	joindir (index_newsdir, get_val ("TIN_INDEX_NEWSDIR", rcdir), INDEX_NEWSDIR);
+#else /* VMS */
 		joinpath (index_newsdir, get_val ("TIN_INDEX_NEWSDIR", rcdir), INDEX_NEWSDIR);
-#endif
+#endif /* VMS */
 	}
 	if (stat (index_newsdir, &sb) == -1)
 		my_mkdir (index_newsdir, S_IRWXUGO);
 #ifdef VMS
 	joindir (index_maildir, get_val ("TIN_INDEX_MAILDIR", rcdir), INDEX_MAILDIR);
-#else
+#else /* VMS */
 	joinpath (index_maildir, get_val ("TIN_INDEX_MAILDIR", rcdir), INDEX_MAILDIR);
-#endif
+#endif /* VMS */
 	if (stat (index_maildir, &sb) == -1)
 		my_mkdir (index_maildir, S_IRWXUGO);
 	joinpath (index_savedir, get_val ("TIN_INDEX_SAVEDIR", rcdir), INDEX_SAVEDIR);
+
 	if (stat (index_savedir, &sb) == -1)
 		my_mkdir (index_savedir, S_IRWXUGO);
 	joinpath (local_attributes_file, rcdir, ATTRIBUTES_FILE);
@@ -777,28 +847,25 @@
 	joinpath (mail_active_file, rcdir, ACTIVE_MAIL_FILE);
 #ifdef VMS
 	joinpath (mailbox, DEFAULT_MAILBOX, "MAIL.TXT");
-#else
+#else /* VMS */
 	joinpath (mailbox, DEFAULT_MAILBOX, userid);
-#endif
+#endif /* VMS */
 	joinpath (msg_headers_file, rcdir, MSG_HEADERS_FILE);
 	joinpath (mailgroups_file, rcdir, MAILGROUPS_FILE);
-	joinpath (news_active_file, libdir, get_val ("TIN_ACTIVEFILE", ACTIVE_FILE));
-	joinpath (newsgroups_file, libdir, NEWSGROUPS_FILE);
 #ifdef WIN32
 	joinpath (newsrc, rcdir, NEWSRC_FILE);
 	joinpath (newnewsrc, rcdir, NEWNEWSRC_FILE);
-#else
+#else /* WIN32 */
 	joinpath (newsrc, homedir, NEWSRC_FILE);
 	joinpath (newnewsrc, homedir, NEWNEWSRC_FILE);
 #ifdef APPEND_PID
 	sprintf(newnewsrc+strlen(newnewsrc), "%d", process_id);
-#endif
-#endif
+#endif /* APPEND_PID */
+#endif /* WIN32 */
 	joinpath (posted_info_file, rcdir, POSTED_FILE);
 	joinpath (posted_msgs_file, default_maildir, POSTED_FILE);
 	joinpath (postponed_articles_file, rcdir, POSTPONED_FILE);
 	joinpath (save_active_file, rcdir, ACTIVE_SAVE_FILE);
-	joinpath (subscriptions_file, libdir, SUBSCRIPTIONS_FILE);
 
 #ifdef INDEX_DAEMON
 	joinpath (lock_file, TMPDIR, LOCK_FILE);
@@ -808,22 +875,22 @@
 
 	if (stat (index_newsdir, &sb) == -1)
 		my_mkdir (index_newsdir, (S_IRWXU|S_IRUGO|S_IXUGO));
-#else
+#else /* INDEX_DAEMON */
 #	ifdef HAVE_LONG_FILE_NAMES
 		sprintf (lock_file, "%stin.%s.LCK", TMPDIR, userid);
-#	else
+#	else /* HAVE_LONG_FILE_NAMES */
 		sprintf (lock_file, "%s%s.LCK", TMPDIR, userid);
-#endif
+#	endif /* HAVE_LONG_FILE_NAMES */
 
 #ifdef NNTP_ABLE
 	nntp_tcp_port = (unsigned short) atoi (get_val ("NNTPPORT", NNTP_TCP_PORT));
-#endif
+#endif /* NNTP_ABLE */
 
 #ifdef VMS
 	if (stat (rcdir_asfile, &sb) == -1)
-#else
+#else /* VMS */
 	if (stat (rcdir, &sb) == -1)
-#endif
+#endif /* VMS */
 	{
 		created_rcdir = TRUE;
 		my_mkdir (rcdir, (S_IRWXU|S_IRUGO|S_IXUGO));
@@ -855,48 +922,6 @@
 
 #endif /* INDEX_DAEMON */
 
-#ifndef NNTP_ONLY
-/*
- * checking for an local active if running NNTP_ONLY is stupid
- * I'm sure that there are more 'funny' things like this in Iains code
- * This whole block of code sucks, as we can't even check for 'via_nntp' yet
- */
-	if (stat (news_active_file, &sb) >= 0)
-		goto got_active;
-
-	/*
-	 *  I hate forgetting to define NEWSLIBDIR correctly.  Guess a couple
-	 *  of the likely places if it's not where NEWSLIBDIR says it is.
-	 */
-	strcpy (news_active_file, "/usr/lib/news/active");
-	if (stat (news_active_file, &sb) >= 0)
-		goto got_active;
-
-	strcpy (news_active_file, "/usr/local/lib/news/active");
-	if (stat (news_active_file, &sb) >= 0)
-		goto got_active;
-
-	strcpy (news_active_file, "/usr/public/lib/news/active");
-	if (stat (news_active_file, &sb) >= 0)
-		goto got_active;
-
-	/*
-	 *  Oh well. Revert to what NEWSLIBDIR says it is to produce a useful
-	 *  error message when read_news_active_file () fails later.
-	 */
-	joinpath (news_active_file, libdir, ACTIVE_FILE);
-
-got_active:
-
-#endif /* !NNTP_ONLY */
-
-	/*
-	 *  Get organization name
-	 */
-	ptr = GetConfigValue (_CONF_ORGANIZATION);
-	if (ptr != (char *) 0)
-		my_strncpy (default_organization, ptr, sizeof (default_organization));
-
 	/*
 	 *  check enviroment for REPLYTO
 	 */
@@ -912,7 +937,12 @@
 		my_strncpy (my_distribution, ptr, sizeof (my_distribution));
 
 	/*
-	 *  check enviroment for BUG_ADDRESS
+	 * check enviroment for BUG_ADDRESS
+	 *
+	 * Argh! I think it's complete nonsense to have a _per_user_
+	 * configurable bug report address in $HOME/.tin/bug_address!
+	 * I think we should delete this whole section. Who sets a
+	 * bug report in environment anyway? XXXXXXXXXXXXXXXXXX
 	 */
 	if ((ptr = getenv ("BUG_ADDRESS")) != (char *) 0) {
 		my_strncpy (bug_addr, ptr, sizeof (bug_addr));
@@ -935,7 +965,7 @@
 		strcpy (pgp_data, ptr);
 	else
 		joinpath (pgp_data, homedir, ".pgp");
-#endif
+#endif /* HAVE_PGP */
 }
 
 /*
@@ -1015,90 +1045,72 @@
 	return (created);
 }
 
-
-#ifndef USE_INN_NNTPLIB
-char *
-GetConfigValue (
-	const char *name)
+/*
+ * read_site_config()
+ *
+ * This function permits the local administrator to override a few compile
+ * time defined parameters, especially the concerning the place of a local
+ * news spool. This has especially binary distributions of TIN in mind.
+ *
+ * Sven Paulus <sven@tin.org>, 26-Jan-'98
+ */
+static int read_site_config (void)
 {
-	char *conf_value = (char *) 0;
-	char *ptr;
-	char path[PATH_LEN];
 	FILE *fp;
-	static char conf_fromhost[PATH_LEN];
-	static char conf_org[PATH_LEN];
-	static char conf_server[PATH_LEN];
-
-	if (STRCMPEQ(_CONF_FROMHOST, name)) {
-		conf_fromhost[0] = '\0';
-	} else if (STRCMPEQ(_CONF_SERVER, name)) {
-		conf_server[0] = '\0';
-#ifdef NNTP_DEFAULT_SERVER
-		if (*(NNTP_DEFAULT_SERVER)) {
-			strcpy (conf_server, NNTP_DEFAULT_SERVER);
-			conf_value = conf_server;
-		}
-#endif	/* NNTP_DEFAULT_SERVER */
-	} else if (STRCMPEQ(_CONF_ORGANIZATION, name)) {
-		conf_org[0] = '\0';
-		/*
-		 *  check enviroment for ORGANIZATION / NEWSORG
-		 */
-#ifdef apollo
-		if ((ptr = getenv ("NEWSORG")) != (char *) 0)
-#else
-		if ((ptr = getenv ("ORGANIZATION")) != (char *) 0)
-#endif
-		{
-			my_strncpy (conf_org, ptr, sizeof (conf_org));
-			goto got_org;
-		}
-
-		/*
-		 *  check NEWSLIBDIR/organization for system wide organization
-		 */
-		joinpath (path, libdir, "organization");
-		fp = fopen (path, "r");
-
-#ifndef M_AMIGA
-		if (fp == (FILE *) 0) {
-			sprintf (path, "/usr/lib/news/organization");
-			fp = fopen (path, "r");
-		}
-
-		if (fp == (FILE *) 0) {
-			sprintf (path, "/usr/local/lib/news/organization");
-			fp = fopen (path, "r");
-		}
-
-		if (fp == (FILE *) 0) {
-			sprintf (path, "/usr/public/lib/news/organization");
-			fp = fopen (path, "r");
-		}
-
-		if (fp == (FILE *) 0) {
-			sprintf (path, "/usr/local/etc/organization");
-			fp = fopen (path, "r");
-		}
+	char buf[LEN];
+	const char *tin_defaults[] = { TIN_DEFAULTS };
+	int i = 0;
+	struct stat sb;
 
-		if (fp == (FILE *) 0) {
-			sprintf (path, "/etc/organization");
-			fp = fopen (path, "r");
-		}
-#endif	/* M_AMIGA */
+	/*
+	 * try to find tin.defaults in some different locations
+	 */
+	while (tin_defaults[i] != NULL && i >= 0) {
+		sprintf(buf, "%s/tin.defaults", tin_defaults[i]);
+		if (stat(buf, &sb) < 0)
+			i++;	/* no, skip to next one */
+		else
+			i = -1;	/* we found it */
+	}
 
-		if (fp != (FILE *) 0) {
-			if (fgets (conf_org, sizeof (conf_org), fp) != (char *) 0) {
-				ptr = strrchr (conf_org, '\n');
-				if (ptr != (char *) 0)
-					*ptr = '\0';
-			}
-			fclose (fp);
-		}
-got_org:	/* goto */
-		conf_value = conf_org;
+	if (i != -1)
+		return -1;
+	if ((fp = fopen(buf, "r")) == NULL)
+		return -1;
+
+	while (fgets(buf, sizeof(buf), fp)) {
+		/* ignore comments */
+		if (*buf == '#' || *buf == ';' || *buf == ' ')
+			continue;
+#ifndef NNTP_ONLY
+		if (match_string (buf, "spooldir=", spooldir, sizeof (spooldir)))
+			continue;
+		if (match_string (buf, "overviewdir=", novrootdir, sizeof (novrootdir)))
+			continue;
+		if (match_string (buf, "overviewfile=", novfilename, sizeof (novfilename)))
+			continue;
+#endif	/* NNTP_ONLY */
+		if (match_string (buf, "activefile=", news_active_file, sizeof (news_active_file)))
+			continue;
+		if (match_string (buf, "activetimesfile=", active_times_file, sizeof (active_times_file)))
+			continue;
+		if (match_string (buf, "newsgroupsfile=", newsgroups_file, sizeof (newsgroups_file)))
+			continue;
+		if (match_string (buf, "newslibdir=", libdir, sizeof (libdir)))
+			continue;
+		if (match_string (buf, "subscriptionsfile=", subscriptions_file, sizeof (subscriptions_file)))
+			continue;
+		if (match_string (buf, "domainname=", domain_name, sizeof (domain_name)))
+			continue;
+		if (match_string (buf, "inewsdir=", inewsdir, sizeof (inewsdir)))
+			continue;
+		if (match_string (buf, "bugaddress=", bug_addr, sizeof (bug_addr)))
+			continue;
+		if (match_string (buf, "organization=", default_organization, sizeof (default_organization)))
+			continue;
 	}
 
-	return conf_value;
+	fclose(fp);
+
+	return 0;
 }
-#endif	/* USE_INN_NNTPLIB */
diff -Nur tin-980117/src/lang.c tin-980202/src/lang.c
--- tin-980117/src/lang.c	Fri Jan 16 12:45:08 1998
+++ tin-980202/src/lang.c	Sun Feb  1 05:27:46 1998
@@ -94,7 +94,7 @@
 #endif
 
 #ifdef VMS
-	char txt_copyright_notice[] = "%s (c) Copyright 1991-98 Iain Lea & Tod McQuillin.";
+	constext txt_copyright_notice[] = "%s (c) Copyright 1991-98 Iain Lea & Tod McQuillin & other.";
 #endif
 
 #ifdef WIN32
@@ -134,6 +134,7 @@
 constext txt_error_no_read_permission[] = "No read permissions for %s\n";
 constext txt_error_no_such_file[] = "File %s does not exist\n";
 constext txt_error_no_write_permission[] = "No write permissions for %s\n";
+constext txt_error_metamail_failed[] = "metamail failed: %s";
 constext txt_external_mail_done[] = "leaving external mail-reader";
 constext txt_extracting_archive[] = cCRLF cCRLF "Extracting %s archive..." cCRLF;
 constext txt_extracting_shar[] =cCRLF "Extracting %s..." cCRLF;
@@ -702,6 +703,10 @@
 	constext txt_pipe_to_command[] = "Pipe to command [%.*s]> ";
 	constext txt_piping[] = "Piping...";
 #else
+#	ifdef VMS
+		constext txt_pipe_to_command[] = "";
+		constext txt_piping[] = "";
+#	endif /* VMS */
 	constext txt_piping_not_enabled[] = "Piping not enabled. Recompile without -DNO_PIPING.";
 #endif /* DONT_HAVE_PIPING */
 
@@ -815,13 +820,13 @@
 # 8bit chars in header is encoded regardless of the value of this parameter\n\
 # unless mail_mime_encoding is 8bit as well. Note that RFC 1552/1651/1652\n\
 # prohibit 8bit characters in mail header so that you are advised NOT to\n\
-# turn it ON unless you have some compelling reason as is the case of\n\
-# Korean users with localized sendmail.\n";
+# turn it ON unless you have some compelling reason.\n";
 constext txt_tinrc_mail_address[] = "# user's mail address, if not username@host\n";
 constext txt_tinrc_mark_saved_read[] = "# if ON mark articles that are saved as read\n";
 constext txt_tinrc_mm_charset[] = "# charset supported locally which is also used for MIME header and\n\
 # Content-Type header unless news and mail need to be encoded in other\n\
-# charsets as in ISO-2022-KR encoding of EUC-KR in mail message.\n\
+# charsets as in case of  EUC-KR for Korean which needs to be converted to\n\
+# ISO-2022-KR in mail message.\n\
 # If not set, the value of the environment variable MM_CHARSET is used.\n\
 # Set to US-ASCII or compile time default if neither of them is defined.\n\
 # If MIME_STRICT_CHARSET is defined at compile-time, charset other than\n\
@@ -839,16 +844,22 @@
 constext txt_tinrc_post_mime_encoding[] = "# MIME encoding (8bit, base64, quoted-printable, 7bit) of the body\n\
 # for mails and posts, if necessary. QP is efficient for most European\n\
 # character sets (ISO-8859-X) with small fraction of non-US-ASCII chars,\n\
-# while Base64 is more efficient for most 8bit East Asian charsets.\n\
+# while Base64 is more efficient for most 8bit East Asian,Greek,and Russian\n\
+# charsets with a lot of 8bit characters.\n\
 # For EUC-KR, 7bit encoding specifies that EUC charsets be converted\n\
 # to corresponding ISO-2022-KR. The same may be true of EUC-JP/CN.\n\
-# For other charsets used in Japan and China, it seems more complicated.\n\
 # Korean users should set post_mime_encoding to 8bit and mail_mime_encoding\n\
 # to 7bit. With mm_charset to EUC-KR, post_mime_encoding set to 7bit does\n\
-# NOT lead to encoding of EUC-KR into ISO-2022-KR in news-postings since\n\
-# it's never meant to be used for Usenet news. Perhaps, it's not the case\n\
-# for EUC-JP and EUC-CN.\n\
-# Handling of Chinese and Japanese characters is not yet implemented.\n";
+# NOT lead to conversion of EUC-KR into ISO-2022-KR in news-postings since\n\
+# it's never meant to be used for Usenet news. Japanese always use\n\
+# ISO-2022-JP for both news and mail. Automatic conversion of EUC-JP and\n\
+# other 8bit Japanese encodings into ISO-2022-JP(even if 7bit is chosen)\n\
+# is NOT yet implemented.(it may not be necessary at all as Japanese\n\
+# terminal emulators and editors appear to have native support of\n\
+# ISO-2022-JP). In case of Chinese, the situation seems to be more\n\
+# complicated(different newsgroups and hierarchies for Chinese use different\n\
+# MIME charsets and encodings) and no special handling is  yet implemented.\n\
+# Summing up 7bit does NOT have any effect on MIME charset other than EUC-KR\n";
 constext txt_tinrc_post_process_command[] = "# if set, command to be run after a successful uudecode\n";
 #ifdef M_AMIGA
 	constext txt_tinrc_post_process_type[] = "# type of post processing to perform after saving articles.\n\
diff -Nur tin-980117/src/list.c tin-980202/src/list.c
--- tin-980117/src/list.c	Fri Dec 26 03:44:40 1997
+++ tin-980202/src/list.c	Sun Jan 25 05:14:21 1998
@@ -14,12 +14,7 @@
 
 #include	"tin.h"
 
-#if 0
-	static int iGrpCurNum = -1;
-	static int iGrpMaxNum = -1;
-#endif
-
-int group_hash[TABLE_SIZE];			/* group name --> active[] */
+int group_hash[TABLE_SIZE];	/* group name --> active[] */
 
 void
 init_group_hash (void)
@@ -111,9 +106,6 @@
 	int i;
 
 	if ((i = find_group_index(pcGrpName)) != -1) {
-#if 0
-		iGrpCurNum = i;
-#endif
 		return &active[i];
 	}
 
@@ -156,54 +148,3 @@
 
 	return(&active[num_active++]);
 }
-
-/*
- * What is all the rest of this for ???
- */
-#if 0
-struct t_group *
-psGrpFirst (void)
-{
-	iGrpMaxNum = num_active;
-
-	if (iGrpMaxNum) {
-		iGrpCurNum = 0;
-		return &active[iGrpCurNum];
-	} else
-		return (struct t_group *) 0;
-}
-
-struct t_group *
-psGrpLast (void)
-{
-	if (iGrpMaxNum) {
-		iGrpCurNum = iGrpMaxNum - 1;
-		return &active[iGrpCurNum];
-	} else
-		return (struct t_group *) 0;
-}
-
-struct t_group *
-psGrpNext (void)
-{
-	if (iGrpMaxNum) {
-		if (iGrpCurNum < (iGrpMaxNum - 1)) {
-			iGrpCurNum++;
-			return &active[iGrpCurNum];
-		}
-	}
-	return (struct t_group *) 0;
-}
-
-struct t_group *
-psGrpPrev (void)
-{
-	if (iGrpMaxNum) {
-		if (iGrpCurNum > 1) {
-			iGrpCurNum--;
-			return &active[iGrpCurNum];
-		}
-	}
-	return (struct t_group *) 0;
-}
-#endif
diff -Nur tin-980117/src/mail.c tin-980202/src/mail.c
--- tin-980117/src/mail.c	Fri Dec 26 03:44:40 1997
+++ tin-980202/src/mail.c	Thu Jan 22 14:48:21 1998
@@ -241,7 +241,7 @@
 				*q = ' ';
 
 			psGrp->description = my_strdup (p);
-#if 0 /* not usefull for cache_overview_files */
+#if 0 /* not useful for cache_overview_files */
 			if (psGrp->type == GROUP_TYPE_NEWS) {
 				if (fp_save != (FILE *) 0 &&
 						read_news_via_nntp &&
diff -Nur tin-980117/src/main.c tin-980202/src/main.c
--- tin-980117/src/main.c	Sun Jan 11 19:14:17 1998
+++ tin-980202/src/main.c	Sun Feb  1 05:41:00 1998
@@ -22,7 +22,11 @@
 	extern char	**_WBArgv;
 	char __stdiowin[] = "con:0/12/640/200/TIN " VERSION;
 	char __stdiov37[] = "/AUTO/NOCLOSE";
-#endif
+#else
+#	ifdef VMS
+	int debug;
+#	endif /* VMS */
+#endif /* M_AMIGA && __SASC_650 */
 
 static char **cmdargs;
 static int num_cmdargs;
@@ -117,7 +121,7 @@
 #endif
 
 #if defined(M_UNIX) && !defined(INDEX_DAEMON)
-#	if !USE_CURSES
+#	ifndef USE_CURSES
 	if (INTERACTIVE2) {
 		if (!SetupScreen ()) {
 			error_message (txt_screen_init_failed, progname);
@@ -248,7 +252,7 @@
 	 * Load my_groups[] from the .newsrc file. We append these groups to any
 	 * new newsgroups and command line newsgroups already loaded
 	 */
-	read_newsrc (newsrc, 0);
+	read_newsrc (newsrc, FALSE);
 
 	/*
 	 * We have to show all groups with command line groups
@@ -775,10 +779,7 @@
 		catchup = FALSE;
 		do_update ();
 		catchup = i;			/* set catchup to previous value */
-		if (mail_news)
-			check_start_save_any_news (MAIL_ANY_NEWS);
-		else
-			check_start_save_any_news (SAVE_ANY_NEWS);
+		check_start_save_any_news (mail_news ? MAIL_ANY_NEWS : SAVE_ANY_NEWS);
 		tin_done (EXIT_OK);
 	}
 }
@@ -834,7 +835,6 @@
 #			endif /* HAVE_SETPGRP */
 #		endif /* BSD */
 					signal (SIGQUIT, SIG_IGN);	/* stop indexing being interrupted */
-					signal (SIGALRM, SIG_IGN);	/* stop indexing resyning active file */
 
 					if (nntp_open () != 0)				/* connect server if we are using nntp */
 						tin_done (EXIT_ERROR);
diff -Nur tin-980117/src/memory.c tin-980202/src/memory.c
--- tin-980117/src/memory.c	Fri Dec 26 03:44:42 1997
+++ tin-980202/src/memory.c	Wed Jan 28 07:03:36 1998
@@ -77,7 +77,7 @@
 
 	save = (struct t_save *) my_malloc (sizeof(*save) * max_save);
 
-#if !USE_CURSES
+#ifndef USE_CURSES
 	screen = (struct t_screen *) 0;
 #endif
 }
@@ -129,11 +129,11 @@
 }
 
 
+#ifndef USE_CURSES
 void
 init_screen_array (
 	int allocate)
 {
-#if !USE_CURSES
 	int i;
 
 	if (allocate) {
@@ -152,8 +152,8 @@
 			screen = (struct t_screen *) 0;
 		}
 	}
-#endif
 }
+#endif
 
 
 void
@@ -161,7 +161,9 @@
 {
 	hash_reclaim ();
 
+#ifndef USE_CURSES
 	init_screen_array (FALSE);
+#endif /* USE_CURSES */
 
 	free_art_array ();
 
@@ -377,10 +379,8 @@
 #ifdef DEBUG
 	vDbgPrintMalloc (FALSE, file, line, size);
 #endif
-	if (!p)
-		p = (char *) calloc (1, size);
-	else
-		p = (char *) realloc (p, size);
+
+	p = (char *) ((!p) ? (calloc (1, size)) : realloc (p, size));
 
 	if (p == (char *) 0) {
 		error_message (txt_out_of_memory, progname, size, file, line);
diff -Nur tin-980117/src/misc.c tin-980202/src/misc.c
--- tin-980117/src/misc.c	Fri Jan 16 17:56:18 1998
+++ tin-980202/src/misc.c	Sun Feb  1 09:59:00 1998
@@ -21,7 +21,7 @@
 /*
  * Local prototypes
  */
-static char * escape_shell_meta (char *source, int quote_area);
+static char *escape_shell_meta (char *source, int quote_area);
 static int input_pending (int delay);
 static int strfeditor (char *editor, int linenum, char *filename, char *s, size_t maxsize, char *format);
 static void write_input_history_file (void);
@@ -51,7 +51,7 @@
 		fclose (fp_new);
 		return;
 	}
-	copy_fp(fp_old, fp_new);
+	copy_fp (fp_old, fp_new);
 	fclose (fp_old);
 	fclose (fp_new);
 }
@@ -60,11 +60,10 @@
 void
 asfail (
 	const char *file,
-	int	line,
+	int line,
 	const char *cond)
 {
-	my_fprintf (stderr, "%s: assertion failure: %s (%d): %s\n",
-		progname, file, line, cond);
+	my_fprintf (stderr, "%s: assertion failure: %s (%d): %s\n", progname, file, line, cond);
 	my_fflush (stderr);
 
 	/*
@@ -112,7 +111,8 @@
 }
 
 
-/* copy the body of articles with given file pointers,
+/*
+ * copy the body of articles with given file pointers,
  * prefix (= quote_chars), initials of the articles author
  * and a flag, if the signature should be quoted
  */
@@ -127,15 +127,15 @@
 {
 	char buf[8192];
 	char buf2[8192];
-	int retcode;
 	char prefixbuf[256];
+	int retcode;
+	int i;
 	t_bool status_space;
 	t_bool status_char;
-	int i;
 
 	/* This is a shortcut for speed reasons: if no prefix (= quote_chars) is given just copy */
-	if (!prefix || !prefix[0]) {
-		copy_fp(fp_ip, fp_op);
+	if (!prefix || !*prefix) {
+		copy_fp (fp_ip, fp_op);
 		return;
 	}
 
@@ -145,10 +145,7 @@
 		for (i=0; prefix[i]; i++) {
 			if ((status_char) && (prefix[i] == 'S'))
 				prefix[i] = 's';
-			if (prefix[i] == '%')
-				status_char = TRUE;
-			else
-				status_char = FALSE;
+			status_char = (prefix[i] == '%');
 		}
 	}
 
@@ -175,8 +172,7 @@
 						buf2[i] = buf[i];
 						if (buf[i] != ' ')
 							status_space = TRUE;
-						if ((status_space) &&
-						  !(isalpha(buf[i]) || buf[i] == '>'))
+						if ((status_space) && !(isalpha(buf[i]) || buf[i] == '>'))
 							status_char = FALSE;
 					}
 					buf2[i] = '\0';
@@ -186,24 +182,14 @@
 						retcode = fprintf (fp_op, "%s%s", prefixbuf, buf);
 				} else    /* line was not already quoted (no >) */
 					retcode = fprintf (fp_op, "%s%s", prefixbuf, buf);
-			} else {  /* line is empty */
-				if (quote_empty_lines)
-					retcode = fprintf (fp_op, "%s\n", prefixbuf);
-				else
-					retcode = fprintf (fp_op, "\n");
-			}
+			} else /* line is empty */
+					retcode = fprintf (fp_op, "%s\n", (quote_empty_lines ? prefixbuf : ""));
 		} else {    /* no initials in quote_string, just copy */
 			if ((buf[0] != '\n') || quote_empty_lines) {
-
 				/* use blank-stripped quote string if line is already quoted */
-				if (buf[0]=='>')
-					retcode = fprintf (fp_op, "%s%s", prefixbuf, buf);
-				else
-					retcode = fprintf (fp_op, "%s%s", prefix, buf);
-
+					retcode = fprintf (fp_op, "%s%s", ((buf[0]=='>') ? prefixbuf : prefix), buf);
 			} else
 				retcode = fprintf (fp_op, "\n");
-
 		}
 		if (retcode == EOF) {
 			perror_message ("copy_body() failed");
@@ -214,14 +200,12 @@
 
 const char *
 get_val (
-	const char *env,	/* Environment variable we're looking for	*/
-	const char *def)	/* Default value if no environ value found	*/
+	const char *env,	/* Environment variable we're looking for */
+	const char *def)	/* Default value if no environ value found */
 {
 	const char *ptr;
 
-	ptr = getenv(env);
-
-	return (ptr != (char *) 0 ? ptr : def);
+	return ((ptr = getenv(env)) != (char *) 0 ? ptr : def);
 }
 
 
@@ -232,12 +216,12 @@
 	char *filename,
 	int lineno) /* return value is always ignored */
 {
-	char buf[PATH_LEN],fnameb[PATH_LEN];
-	char editor_format[PATH_LEN];
 	char *my_editor;
+	char buf[PATH_LEN], fnameb[PATH_LEN];
+	char editor_format[PATH_LEN];
 	int retcode;
 	static char editor[PATH_LEN];
-	static int first = TRUE;
+	static t_bool first = TRUE;
 
 	if (first) {
 		my_editor = getenv ("EDITOR");
@@ -246,15 +230,7 @@
 		first = FALSE;
 	}
 
-	if (start_editor_offset) {
-		if (default_editor_format[0])
-			strcpy (editor_format, default_editor_format);
-		else
-			strcpy (editor_format, EDITOR_FORMAT_ON);
-
-	} else {
-		strcpy (editor_format, EDITOR_FORMAT_OFF);
-	}
+	strcpy (editor_format, (start_editor_offset ? (*default_editor_format ? default_editor_format : EDITOR_FORMAT_ON) : EDITOR_FORMAT_OFF));
 
 	retcode = strfeditor (editor, lineno, filename, buf, sizeof (buf), editor_format);
 
@@ -275,10 +251,10 @@
 invoke_ispell (
 	char *nam) /* return value is always ignored */
 {
-	char buf[PATH_LEN];
 	char *my_ispell;
+	char buf[PATH_LEN];
 	static char ispell[PATH_LEN];
-	static int first = TRUE;
+	static t_bool first = TRUE;
 
 	if (first) {
 #ifdef VMS
@@ -306,8 +282,8 @@
 void
 shell_escape (void)
 {
-	char shell[LEN];
 	char *p;
+	char shell[LEN];
 
 	sprintf (msg, txt_shell_escape, default_shell_command);
 
@@ -317,14 +293,10 @@
 	for (p = shell; *p && (*p == ' ' || *p == '\t'); p++)
 		continue;
 
-	if (*p) {
+	if (*p)
 		my_strncpy (default_shell_command, p, sizeof (default_shell_command));
-	} else {
-		if (default_shell_command[0])
-			my_strncpy (shell, default_shell_command, sizeof (shell));
-		else
-			my_strncpy (shell, get_val (ENV_VAR_SHELL, DEFAULT_SHELL), sizeof (shell));
-
+	else {
+		my_strncpy (shell, (*default_shell_command ? default_shell_command : (get_val (ENV_VAR_SHELL, DEFAULT_SHELL))), sizeof (shell));
 		p = shell;
 	}
 
@@ -347,8 +319,8 @@
 tin_done (
 	int ret)
 {
-	int ask = TRUE;
 	register int i, j;
+	t_bool ask = TRUE;
 	struct t_group *group;
 
 	/*
@@ -362,15 +334,13 @@
 					if (prompt_yn (cLINES, txt_catchup_all_read_groups, FALSE) == 1) {
 						ask = FALSE;
 						default_thread_arts = THREAD_NONE;	/* speeds up index loading */
-					} else {
+					} else
 						break;
-					}
 				}
 				wait_message (0, "Catchup %s...", group->name);
 				if (index_group (group)) {
-					for (j = 0; j < top; j++) {
+					for (j = 0; j < top; j++)
 						art_mark_read (group, &arts[j]);
-					}
 				}
 			}
 		}
@@ -440,8 +410,9 @@
 #endif
 
 #ifdef VMS
-	if (ret == 0)
+	if (!ret)
 		ret = 1;
+	vms_close_stdin (); /* free resources used by ReadCh */
 #endif
 
 	exit (ret);
@@ -462,7 +433,8 @@
 strip_double_ngs (
 	char *ngs_list)
 {
-
+	char	*ptr;				/* start of next (outer) newsgroup  */
+	char	*ptr2;			/* temporary pointer                */
 	char	ngroup1[HEADER_LEN];	/* outer newsgroup to compare       */
 	char	ngroup2[HEADER_LEN];	/* inner newsgroup to compare       */
 	char	cmplist[HEADER_LEN];	/* last loops output                */
@@ -470,30 +442,28 @@
 										/* any duplicates of the first nwsg */
 	int	ncnt1;			/* counter for the first newsgroup  */
 	int	ncnt2;			/* counter for the second newsgroup */
-	int	over1;			/* TRUE when the outer loop is over */
-	int	over2;			/* TRUE when the inner loop is over */
-	char	*ptr;				/* start of next (outer) newsgroup  */
-	char	*ptr2;			/* temporary pointer                */
+	t_bool over1;			/* TRUE when the outer loop is over */
+	t_bool over2;			/* TRUE when the inner loop is over */
 
 	/* shortcut, if the is only 1 group */
 	if (strchr(ngs_list, ',') != (char *) 0) {
 
 		over1 = FALSE;
 		ncnt1 = 0;
-		strcpy(newlist, ngs_list);	/* make a "working copy"            */
+		strcpy(newlist, ngs_list);	/* make a "working copy" */
 		ptr = newlist;			/* the next outer newsg. is the 1st */
 
 		while (!over1) {
 			ncnt1++;			/* inc. outer counter */
 			strcpy(cmplist, newlist);	/* duplicate groups for inner loop */
-			ptr2 = strchr(ptr, ',');	/* search "," ...                  */
-			if (ptr2 != (char *) 0) {       /* if found ...                    */
+			ptr2 = strchr(ptr, ',');	/* search "," ... */
+			if (ptr2 != (char *) 0) {       /* if found ... */
 				*ptr2 = '\0';
-				strcpy(ngroup1, ptr);   /* chop off first outer newsgroup  */
-				ptr = ptr2 + 1;		/* pointer points to next newsgr.  */
-			} else {			/* ... if not: last group          */
+				strcpy(ngroup1, ptr);   /* chop off first outer newsgroup */
+				ptr = ptr2 + 1;		/* pointer points to next newsgr. */
+			} else {			/* ... if not: last group */
 				over1 = TRUE;		/* wow, everything is done after . */
-				strcpy(ngroup1, ptr);   /* ... this last outer newsgroup   */
+				strcpy(ngroup1, ptr);   /* ... this last outer newsgroup */
 			}
 
 			over2 = FALSE;
@@ -602,11 +572,37 @@
 		return;
 	}
 }
-#else
+#endif /* M_UNIX */
+
+#ifdef VMS
+void
+rename_file (
+	char *old_filename,
+	char *new_filename)
+{
+	char new_filename_vms[1024];
+
+	if (!strchr(strchr(new_filename, ']') ? strchr(new_filename, ']') : new_filename, '.')) {
+		/* without final dot the new filename is not as tin expects */
+		if (strlen(new_filename) >= sizeof new_filename_vms) {
+			perror_message ("length of %s is too large", new_filename);
+			return;
+		}
+		strcpy(new_filename_vms, new_filename);
+		strcat(new_filename_vms, ".");
+		new_filename = &new_filename_vms[0];
+	}
+
+	if (rename(old_filename,new_filename))
+		perror_message (txt_rename_error, old_filename, new_filename);
+}
+#endif /* VMS */
+
+
+#ifdef M_AMIGA
 /*
  * AmigaOS now has links. Better not to use them as not everybody has new ROMS
  */
-
 void
 rename_file (
 	char *old_filename,
@@ -620,7 +616,7 @@
 
 	return;
 }
-#endif	/* M_UNIX */
+#endif /* M_AMIGA */
 
 
 
@@ -630,14 +626,12 @@
 {
 	int ret;
 
-	set_alarm_clock_off ();
-
 	EndWin ();
 	Raw (FALSE);
 	set_signal_catcher (FALSE);
 
 	TRACE(("called system(%s)", _nc_visbuf(nam)))
-#	if USE_SYSTEM_STATUS
+#	ifdef USE_SYSTEM_STATUS
 		system(nam);
 		ret = system_status;
 #	else
@@ -652,8 +646,6 @@
 	handle_resize(FALSE);
 #endif
 
-	set_alarm_clock_on ();
-
 #ifdef VMS
 	return ret != 0;
 #else
@@ -699,7 +691,7 @@
 
 	umask (real_umask);
 
-#	if HAVE_SETEUID && HAVE_SETEGID
+#	if defined(HAVE_SETEUID) && defined(HAVE_SETEGID)
 	if (seteuid (real_uid) == -1)
 		perror_message ("Error seteuid(real) failed");
 
@@ -707,7 +699,7 @@
 		perror_message ("Error setegid(real) failed");
 
 #	else
-#		if HAVE_SETREUID && HAVE_SETREGID
+#		if defined(HAVE_SETREUID) && defined(HAVE_SETREGID)
 	if (setreuid (-1, real_uid) == -1)
 		perror_message ("Error setreuid(real) failed");
 
@@ -735,7 +727,7 @@
 
 	umask (0);
 
-#	if HAVE_SETEUID && HAVE_SETEGID
+#	if defined(HAVE_SETEUID) && defined(HAVE_SETEGID)
 	if (seteuid (tin_uid) == -1)
 		perror_message ("Error seteuid(real) failed");
 
@@ -743,7 +735,7 @@
 		perror_message ("Error setegid(real) failed");
 
 #	else
-#		if HAVE_SETREUID && HAVE_SETREGID
+#		if defined(HAVE_SETREUID) && defined(HAVE_SETREGID)
 	if (setreuid (-1, tin_uid) == -1)
 		perror_message ("Error setreuid(tin) failed");
 
@@ -799,7 +791,7 @@
  *  Return TRUE if new mail has arrived
  */
 
-int
+t_bool
 mail_check (void)
 {
 #ifndef WIN32 /* No unified mail transport on WIN32 */
@@ -813,12 +805,12 @@
 
 #ifdef M_AMIGA
 	/*
-	** Since AmigaDOS does not distinguish between atime and mtime
-	** we have to find some other way to figure out if the mailbox
-	** was modified (to bad that Iain removed the mail_setup() and
-	** mail_check() scheme used prior to 1.30 260694 which worked also
-	** on AmigaDOS). (R. Luebke 10.7.1994)
-	*/
+	 * Since AmigaDOS does not distinguish between atime and mtime
+	 * we have to find some other way to figure out if the mailbox
+	 * was modified (to bad that Iain removed the mail_setup() and
+	 * mail_check() scheme used prior to 1.30 260694 which worked also
+	 * on AmigaDOS). (R. Luebke 10.7.1994)
+	 */
 
 	/* this is only a first try, but it seems to work :) */
 
@@ -828,7 +820,7 @@
 				if (buf.st_size > mbox_size) {
 					mbox_size = buf.st_size;
 					return TRUE;
-				} else {
+				} else
 					/*
 					 * at this point we have to calculate how much the
 					 * mailbox has to grow until we say "new mail"
@@ -844,17 +836,13 @@
 					 * message I receive. (obw)
 					 */
 					mbox_size = buf.st_size + 1024;
-				}
-			} else {
+			} else
 				mbox_size = 0;
-			}
 		}
 	}
 #else
-	if (mailbox_name != 0 && stat (mailbox_name, &buf) >= 0 &&
-		buf.st_atime < buf.st_mtime && buf.st_size > 0) {
+	if (mailbox_name != 0 && stat (mailbox_name, &buf) >= 0 && buf.st_atime < buf.st_mtime && buf.st_size > 0)
 		return TRUE;
-	}
 #endif
 #endif /* !WIN32 */
 	return FALSE;
@@ -1016,11 +1004,13 @@
 		}
 	}
 	*cmtp = *asp = *atom_p = '\0';
-	if (state == 0)
-		if ((atom_type == 1) || !asbuf[0])
+	if (!state) {
+		if ((atom_type == 1) || !*asbuf) {
 			APPEND_TO (asp, atom_buf);
-		else
+		} else {
 			APPEND_TO (cmtp, atom_buf);
+		}
+	}
 	/* Address specifier */
 	TRIM (asbuf, asp);
 	/* Comment */
@@ -1139,10 +1129,7 @@
 {
 	int author;
 
-	if (thread && !show_subject)
-		author = SHOW_FROM_BOTH;
-	else
-		author = CURR_GROUP.attribute->show_author;
+	author = ((thread && !show_subject) ? SHOW_FROM_BOTH : CURR_GROUP.attribute->show_author);
 
 	switch (author) {
 		case SHOW_FROM_NONE:
@@ -1152,10 +1139,7 @@
 			strncpy (str, art->from, len);
 			break;
 		case SHOW_FROM_NAME:
-			if (art->name)
-				strncpy (str, art->name, len);
-			else
-				strncpy (str, art->from, len);
+			strncpy (str, (art->name ? art->name : art->from), len);
 			break;
 		case SHOW_FROM_BOTH:
 			if (art->name) {
@@ -1189,17 +1173,14 @@
 void
 show_inverse_video_status (void)
 {
-	if (inverse_okay)
-		info_message (txt_inverse_on);
-	else
-		info_message (txt_inverse_off);
+		info_message ((inverse_okay ? txt_inverse_on : txt_inverse_off));
 }
 
 #ifdef HAVE_COLOR
 t_bool
 toggle_color (void)
 {
-#if USE_CURSES
+#ifdef USE_CURSES
 	if (!has_colors()) {
 		use_color = 0;
 		info_message (txt_no_colorterm);
@@ -1214,10 +1195,7 @@
 void
 show_color_status (void)
 {
-	if (use_color)
-		info_message (txt_color_on);
-	else
-		info_message (txt_color_off);
+	info_message ((use_color ? txt_color_on : txt_color_off));
 }
 #endif /* HAVE_COLOR */
 
@@ -1240,7 +1218,7 @@
 static int
 input_pending (int delay)
 {
-#if USE_CURSES
+#ifdef USE_CURSES
 	int ch;
 	nodelay(stdscr, TRUE);
 	if ((ch = getch()) != ERR)
@@ -1311,10 +1289,10 @@
 int
 get_arrow_key (int prech)
 {
-#if USE_CURSES
-#if NCURSES_MOUSE_VERSION
+#ifdef USE_CURSES
+#	ifdef NCURSES_MOUSE_VERSION
 	MEVENT my_event;
-#endif
+#endif /* NCURSES_MOUSE_VERSION */
 	int ch = getch();
 	int code = KEYMAP_UNKNOWN;
 
@@ -1382,7 +1360,9 @@
 	if (WaitForChar(Input(),1000) == DOSTRUE)
 		return prech;
 #else	/* !M_AMIGA */
-
+#	ifdef VMS
+	;
+#	endif /* VMS */
 	if (!input_pending(0)) {
 #ifdef HAVE_USLEEP
 		int i=0;
@@ -1420,7 +1400,7 @@
 #endif	/* HAVE_USLEEP */
 
 		if (!input_pending(0))
-			return prech;
+				return prech;
 	}
 #endif	/* M_AMIGA */
 	ch = ReadCh ();
@@ -1628,9 +1608,8 @@
 				if (s + i < endp - 1) {
 					strcpy (s, tbuf);
 					s += i;
-				} else {
+				} else
 					return 0;
-				}
 			}
 		}
 		if (*format == '%') {
@@ -1652,19 +1631,14 @@
 						sprintf (tbuf, "%s <%s>",
 							arts[respnum].name,
 							arts[respnum].from);
-					} else {
+					} else
 						strcpy (tbuf, arts[respnum].from);
-					}
 					break;
 				case 'G':	/* Groupname of Article */
 					strcpy (tbuf, group);
 					break;
 				case 'I':	/* Initials of author */
-					if (arts[respnum].name != (char *) 0) {
-						strcpy (tbuf, arts[respnum].name);
-					} else {
-						strcpy (tbuf, arts[respnum].from);
-					}
+					strcpy (tbuf, ((arts[respnum].name != (char *) 0) ? arts[respnum].name : arts[respnum].from));
 					j = 0;
 					iflag = 1;
 					for (i=0; tbuf[i]; i++) {
@@ -1680,21 +1654,15 @@
 					strcpy (tbuf, note_h.messageid);
 					break;
 				case 'N':	/* Articles Name of author */
-					if (arts[respnum].name != (char *) 0) {
-						strcpy (tbuf, arts[respnum].name);
-					} else {
-						strcpy (tbuf, arts[respnum].from);
-					}
+					strcpy (tbuf, ((arts[respnum].name != (char *) 0) ? arts[respnum].name : arts[respnum].from));
 					break;
 				case 'C':   /* First Name of author */
 					if (arts[respnum].name != (char *) 0) {
 						strcpy (tbuf, arts[respnum].name);
-						if (strrchr (arts[respnum].name, ' ')) {
+						if (strrchr (arts[respnum].name, ' '))
 							*(strrchr (tbuf, ' ')) = '\0';
-						}
-					} else {
+					} else
 						strcpy (tbuf, arts[respnum].from);
-					}
 					break;
 				default:
 					tbuf[0] = '%';
@@ -1707,9 +1675,8 @@
 				if (s + i < endp - 1) {
 					strcpy (s, tbuf);
 					s += i;
-				} else {
+				} else
 					return 0;
-				}
 			}
 		}
 	}
@@ -1781,9 +1748,8 @@
 				if (s + i < endp - 1) {
 					strcpy (s, tbuf);
 					s += i;
-				} else {
+				} else
 					return 0;
-				}
 			}
 		}
 		if (*format == '%') {
@@ -1814,9 +1780,8 @@
 				if (s + i < endp - 1) {
 					strcpy (s, tbuf);
 					s += i;
-				} else {
+				} else
 					return 0;
-				}
 			}
 		}
 	}
@@ -1892,9 +1857,8 @@
 					default:	/* some other users homedir */
 #ifndef M_AMIGA
 						i = 0;
-						while (*format && *format != '/') {
+						while (*format && *format != '/')
 							tbuf[i++] = *format++;
-						}
 						tbuf[i] = '\0';
 						/*
 						 * OK lookup the username in/etc/passwd
@@ -1903,9 +1867,8 @@
 						if (pwd == (struct passwd *) 0) {
 							str[0] = '\0';
 							return 0;
-						} else {
+						} else
 							sprintf (tbuf, "%s/", pwd->pw_dir);
-						}
 #else
 						/* Amiga has no ther users */
 						return 0;
@@ -1929,22 +1892,19 @@
 				format++;
 				if (*format && *format == '{') {
 					format++;
-					while (*format && !(strchr("}-", *format))) {
+					while (*format && !(strchr("}-", *format)))
 						tbuf[i++] = *format++;
-					}
 					tbuf[i] = '\0';
 					i = 0;
 					if (*format && *format == '-') {
 						format++;
-						while (*format && *format != '}') {
+						while (*format && *format != '}')
 							defbuf[i++] = *format++;
-						}
 					}
 					defbuf[i] = '\0';
 				} else {
-					while (*format && *format != '/') {
+					while (*format && *format != '/')
 						tbuf[i++] = *format++;
-					}
 					tbuf[i] = '\0';
 					format--;
 					defbuf[0] = '\0';
@@ -1953,11 +1913,10 @@
 				 * OK lookup the variable in the shells environment
 				 */
 				envptr = getenv (tbuf);
-				if (envptr == (char *) 0 || (*envptr == '\0')) {
+				if (envptr == (char *) 0 || (*envptr == '\0'))
 					strncpy(tbuf, defbuf, sizeof (tbuf)-1);
-				} else {
+				else
 					strncpy (tbuf, envptr, sizeof (tbuf)-1);
-				}
 				i = strlen (tbuf);
 				if (i) {
 					if (str + i < endp - 1) {
@@ -1990,9 +1949,8 @@
 							return 0;
 						}
 					}
-				} else {
+				} else
 					*str++ = *format;
-				}
 				break;
 			case '+':
 				/*
@@ -2011,9 +1969,8 @@
 						/*
 						 *  convert 1st letter to uppercase
 						 */
-						if (tmp[0] >= 'a' && tmp[0] <= 'z') {
+						if (tmp[0] >= 'a' && tmp[0] <= 'z')
 							tmp[0] = tmp[0] - 32;
-						}
 #ifndef VMS
 						joinpath (tbuf, buf, tmp);
 #ifdef WIN32
@@ -2038,9 +1995,8 @@
 						str[0] = '\0';
 						return 0;
 					}
-				} else {
+				} else
 					*str++ = *format;
-				}
 				break;
 			case '%':	/* Different forms of parsing cmds */
 				*str++ = *format;
@@ -2173,11 +2129,10 @@
 					break;
 			}
 			if (*tbuf) {
-				if (sh_format (s, endp - s, "%s", tbuf) >= 0) {
+				if (sh_format (s, endp - s, "%s", tbuf) >= 0)
 					s += strlen(s);
-				} else {
+				else
 					return 0;
-				}
 			}
 		}
 		if (*format == '%') {
@@ -2211,11 +2166,10 @@
 					break;
 			}
 			if (*tbuf) {
-				if (sh_format (s, endp - s, "%s", tbuf) >= 0) {
+				if (sh_format (s, endp - s, "%s", tbuf) >= 0)
 					s += strlen(s);
-				} else {
+				else
 					return 0;
-				}
 			}
 		}
 	}
@@ -2244,10 +2198,7 @@
 	if (s == (char *) 0 || maxsize == 0)
 		return 0;
 
-	if (arts[respnum].name != (char *) 0)
-		strcpy (tbuf, arts[respnum].name);
-	else
-		strcpy (tbuf, arts[respnum].from);
+	strcpy (tbuf, ((arts[respnum].name != (char *) 0) ? arts[respnum].name : arts[respnum].from));
 
 	iflag = 0;
 	j = 0;
@@ -2289,10 +2240,7 @@
 	sprintf(path, "[%s]", name);
 #else
 	while (*name) {
-		if (*name == '.')
-			*path = '/';
-		else
-			*path = *name;
+		*path = ((*name == '.') ? '/' : *name);
 		name++;
 		path++;
 	}
@@ -2447,9 +2395,8 @@
 		c = c_l1_next[(unsigned char)c];
 		if (c == BAD) return '?';
 		else return c;
-	} else {
+	} else
 		return c;
-	}
 }
 
 void
@@ -2468,9 +2415,8 @@
 		c = c_next_l1[(unsigned char) c];
 		if (c==BAD) return '?';
 		else return c;
-	} else {
+	} else
 		return c;
-	}
 }
 
 void
@@ -2626,10 +2572,7 @@
 			    || *str == '*' || *str == '+' || *str == '?' || *str == '.'
 			    || *str == ' ' || *str == '\t' ) {
 				*target++ = '\\';
-				if (*str == ' ' || *str == '\t')
-					*target++ = 's';
-				else
-					*target++ = *str;
+				*target++ = ((*str == ' ' || *str == '\t')? 's' : *str);
 			} else
 				*target++ = *str;
 		} else {	/* wildmat */
@@ -2663,9 +2606,8 @@
 				*target++ = 's';
 			} else
 				*target++ = *str;
-		} else {	/* wildmat */
+		} else	/* wildmat */
 			*target++ = *str;
-		}
 	}
 	*target = '\0';
 	return (buff);
diff -Nur tin-980117/src/msmail.c tin-980202/src/msmail.c
--- tin-980117/src/msmail.c	Fri Dec 26 03:44:44 1997
+++ tin-980202/src/msmail.c	Thu Jan  1 01:00:00 1970
@@ -1,254 +0,0 @@
-/*
- *  Project   : tin - a Usenet reader
- *  Module    : msmail.c
- *  Author    : N.Ellis
- *  Created   : 01-10-94
- *  Updated   : 17-10-94
- *  Notes     : WinNT specific
- *  Copyright : (c) Copyright 1991-94 by Nigel Ellis & Iain Lea
- *              You may  freely  copy or  redistribute  this software,
- *              so  long as there is no profit made from its use, sale
- *              trade or  reproduction.  You may not change this copy-
- *              right notice, and it must be included in any copy made
- */
-
-#include "tin.h"
-
-#if defined(WIN32)
-
-#include <windows.h>
-#include <stdio.h>
-#include "mapi.h"
-#include "msmail.h"
-
-static HINSTANCE hLibrary=NULL;	/* handle for MAPI library. */
-static HINSTANCE hMAPISession=NULL;
-
-static MapiMessage mmMapiMessage;
-
-static ULONG nMessageSize = 0x000004000;
-static lpMapiMessage FAR *lppMessage;
-static lpMapiMessage lpMessage;
-static char szSeedMessageID[512];
-static char szMessageID[512];
-static char szSubject[512];
-static char szNoteText[4096];
-
-static LPSTR lpszSeedMessageID = &szSeedMessageID[0];
-static LPSTR lpszMessageID = &szMessageID[0];
-
-static LPSTR pszSubject = &szSubject[0];
-static LPSTR pszNoteText = &szNoteText[0];
-static MapiRecipDesc rdOriginator = { 0L,MAPI_ORIG,(LPSTR)"ONE",NULL};
-
-#define SZ_MAPILOGON "MAPILogon"
-#define SZ_MAPILOGOFF "MAPILogoff"
-#define SZ_MAPISENDMAIL "MAPISendMail"
-#define SZ_MAPISENDDOC "MAPISendDocuments"
-#define SZ_MAPIFINDNEXT "MAPIFindNext"
-#define SZ_MAPIREADMAIL "MAPIReadMail"
-#define SZ_MAPISAVEMAIL "MAPISaveMail"
-#define SZ_MAPIDELMAIL "MAPIDeleteMail"
-#define SZ_MAPIFREEBUFFER "MAPIFreeBuffer"
-#define SZ_MAPIADDRESS "MAPIAddress"
-#define SZ_MAPIDETAILS "MAPIDetails"
-#define SZ_MAPIRESOLVENAME "MAPIResolveName"
-#define MAPIDLL "MAPI32.DLL"
-
-#define ERR_LOAD_LIB  0x02
-#define ERR_LOAD_FUNC 0x04
-
-ULONG (FAR PASCAL *lpfnMAPILogon)(ULONG, LPSTR, LPSTR, FLAGS, ULONG, HINSTANCE *);
-
-ULONG (FAR PASCAL *lpfnMAPILogoff)(HINSTANCE, ULONG, FLAGS,ULONG);
-
-ULONG (FAR PASCAL *lpfnMAPISendMail)(HINSTANCE, ULONG, lpMapiMessage, FLAGS,
-                                     ULONG);
-
-ULONG (FAR PASCAL *lpfnMAPISendDocuments)(ULONG, LPSTR, LPSTR, LPSTR, ULONG);
-
-ULONG (FAR PASCAL *lpfnMAPIFindNext)(HINSTANCE, ULONG, LPSTR, LPSTR, FLAGS,
-                                     ULONG, LPSTR);
-
-ULONG (FAR PASCAL *lpfnMAPIReadMail)(HINSTANCE, ULONG, LPSTR, FLAGS, ULONG,
-                                     lpMapiMessage FAR *);
-
-ULONG (FAR PASCAL *lpfnMAPISaveMail)(HINSTANCE, ULONG, lpMapiMessage, FLAGS,
-                                     ULONG, LPSTR);
-
-ULONG (FAR PASCAL *lpfnMAPIDeleteMail)(HINSTANCE, ULONG, LPSTR, FLAGS, ULONG);
-
-ULONG (FAR PASCAL *lpfnMAPIFreeBuffer)(LPVOID);
-
-ULONG (FAR PASCAL *lpfnMAPIAddress)(HINSTANCE, ULONG, LPSTR, ULONG, LPSTR,
-					                ULONG, lpMapiRecipDesc, FLAGS, ULONG,
-                                    LPULONG, lpMapiRecipDesc FAR *);
-
-ULONG (FAR PASCAL *lpfnMAPIDetails)(HINSTANCE, ULONG,lpMapiRecipDesc, FLAGS,
-                                    ULONG);
-
-ULONG (FAR PASCAL *lpfnMAPIResolveName)(HINSTANCE, ULONG, LPSTR, FLAGS,
-						                ULONG, lpMapiRecipDesc FAR *);
-
-static int FAR PASCAL DeInitMAPI();
-
-static int FAR PASCAL InitMAPI()
-{
-  FLAGS flFlag;
-  int err=0;
-
-  if (hLibrary != NULL) // Already init..
-  	return err;
-
-  if ((hLibrary = LoadLibrary(MAPIDLL)) == NULL)
-    return(ERR_LOAD_LIB);
-
-#pragma warning (disable : 4113)
-
-  if ((lpfnMAPILogon = GetProcAddress(hLibrary,SZ_MAPILOGON)) == NULL)
-    return(ERR_LOAD_FUNC);
-
-  if ((lpfnMAPILogoff= GetProcAddress(hLibrary,SZ_MAPILOGOFF)) == NULL)
-    return(ERR_LOAD_FUNC);
-
-  if ((lpfnMAPISendMail= GetProcAddress(hLibrary,SZ_MAPISENDMAIL)) == NULL)
-    return(ERR_LOAD_FUNC);
-
-#ifdef FULLMAPI /* not needed here */
-  if ((lpfnMAPISendDocuments= GetProcAddress(hLibrary,SZ_MAPISENDDOC)) == NULL)
-    return(ERR_LOAD_FUNC);
-
-  if ((lpfnMAPIFindNext= GetProcAddress(hLibrary,SZ_MAPIFINDNEXT)) == NULL)
-    return(ERR_LOAD_FUNC);
-
-  if ((lpfnMAPIReadMail= GetProcAddress(hLibrary,SZ_MAPIREADMAIL)) == NULL)
-    return(ERR_LOAD_FUNC);
-
-  if ((lpfnMAPISaveMail= GetProcAddress(hLibrary,SZ_MAPISAVEMAIL)) == NULL)
-    return(ERR_LOAD_FUNC);
-
-  if ((lpfnMAPIDeleteMail= GetProcAddress(hLibrary,SZ_MAPIDELMAIL)) == NULL)
-    return(ERR_LOAD_FUNC);
-
-  if ((lpfnMAPIFreeBuffer= GetProcAddress(hLibrary,SZ_MAPIFREEBUFFER)) == NULL)
-    return(ERR_LOAD_FUNC);
-
-  if ((lpfnMAPIAddress= GetProcAddress(hLibrary,SZ_MAPIADDRESS)) == NULL)
-    return(ERR_LOAD_FUNC);
-
-  if ((lpfnMAPIDetails= GetProcAddress(hLibrary,SZ_MAPIDETAILS)) == NULL)
-    return(ERR_LOAD_FUNC);
-
-  if ((lpfnMAPIResolveName= GetProcAddress(hLibrary,SZ_MAPIRESOLVENAME)) == NULL)
-    return(ERR_LOAD_FUNC);
-#endif // not needed here
-
-#pragma warning (default : 4113)
-
-  flFlag =MAPI_NEW_SESSION | MAPI_LOGON_UI;
-  if ((err=(*lpfnMAPILogon)(0L, NULL, NULL, flFlag, 0L, &hMAPISession))!=0)
-	DeInitMAPI();
-
-  return(err);
-}
-
-void endmailsession(void)
-	{
-	DeInitMAPI();
-	}
-
-static int FAR PASCAL DeInitMAPI()
-{
-
-  lpfnMAPILogon = NULL;
-  lpfnMAPILogoff= NULL;
-  lpfnMAPISendMail= NULL;
-  lpfnMAPISendDocuments= NULL;
-  lpfnMAPIFindNext= NULL;
-  lpfnMAPIReadMail= NULL;
-  lpfnMAPISaveMail= NULL;
-  lpfnMAPIDeleteMail= NULL;
-  lpfnMAPIFreeBuffer = NULL;
-  lpfnMAPIAddress= NULL;
-  lpfnMAPIDetails = NULL;
-  lpfnMAPIResolveName = NULL;
-
-  if (hLibrary)
-  	FreeLibrary(hLibrary);
-
-  return(0);
-}
-
-static int sendMail(char *To, char *Subject, char *Text, BOOL editBeforeSend)
-{
-    MapiRecipDesc MAPIRecip;
-    SYSTEMTIME st;
-	char localTime[40];
-	FLAGS flFlag;
-
-	GetLocalTime(&st);
-	sprintf(localTime, "%.2d/%.2d/%d %.2d:%.2d",
-					st.wMonth, st.wDay, st.wYear, st.wHour, st.wMinute);
-
-	MAPIRecip.ulReserved = 0L;
-    MAPIRecip.ulRecipClass = MAPI_TO;
-	MAPIRecip.lpszName = To;
-	MAPIRecip.lpszAddress = "";
-	MAPIRecip.ulEIDSize = 0L;
-	MAPIRecip.lpEntryID = (LPVOID) NULL;
-
-	mmMapiMessage.ulReserved = 0L;
-	mmMapiMessage.lpszSubject = Subject;
-	mmMapiMessage.lpszNoteText = Text;
-	mmMapiMessage.lpszMessageType = NULL;
-	mmMapiMessage.lpszDateReceived = localTime;
-	mmMapiMessage.flFlags = MAPI_UNREAD;
-	mmMapiMessage.lpOriginator = &rdOriginator;
-	mmMapiMessage.nRecipCount = 1L;
-	mmMapiMessage.lpRecips = &MAPIRecip;
-	mmMapiMessage.nFileCount = 0L;
-	mmMapiMessage.lpFiles = NULL;
-
-    flFlag = MAPI_DIALOG;
-    return (*lpfnMAPISendMail)(hMAPISession, 0L, &mmMapiMessage,
-    		editBeforeSend ? MAPI_DIALOG : 0L, 0L);
-}
-
-int sendmail(LPSTR szFileName, LPSTR szTo, LPSTR szSubject, BOOL fEdit)
-{
-	int err = 1;
-	HANDLE hFile = NULL;
-	LPSTR pText = NULL;
-	DWORD dwSize = 0, dwRead = 0;
-
-	hFile = CreateFile( szFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-	if ( hFile == INVALID_HANDLE_VALUE )
-		goto exit;
-
-	if ((dwSize = GetFileSize(hFile, NULL)) == 0)
-		goto exit;
-
-	if ((pText=(LPSTR) GlobalAlloc(GPTR, dwSize)) == NULL)
-		goto exit;
-
-	if (! ReadFile(hFile, pText, dwSize, &dwRead, NULL))
-		goto exit;
-
-	if (dwSize != dwRead)
-		goto exit;
-
-	if (InitMAPI() != 0)
-		goto exit;
-
-	err = sendMail(szTo, szSubject, pText, fEdit);
-
-	// BUGBUG: DeInitMAPI() at end of session
-	// DeInitMAPI();
-
-exit:
-	if (hFile)	CloseHandle(hFile);
-	if (pText)	GlobalFree((HGLOBAL) pText);
-	return err;
-}
-
-#endif	/* WIN32 */
diff -Nur tin-980117/src/newsrc.c tin-980202/src/newsrc.c
--- tin-980117/src/newsrc.c	Fri Jan 16 17:17:32 1998
+++ tin-980202/src/newsrc.c	Sun Feb  1 17:11:19 1998
@@ -45,13 +45,12 @@
 void
 read_newsrc (
 	char *newsrc_file,
-	int allgroups)
+	t_bool allgroups)
 {
 	FILE *fp;
 	char *grp, *seq;
 	char buf[HEADER_LEN];
-	int sub;
-	int i;
+	int sub, i;
 	struct stat statbuf;
 
 	if (allgroups)
@@ -153,11 +152,18 @@
 	char *line;
 	char buf[HEADER_LEN];
 	int tot = 0;
+	struct stat note_stat_newsrc;
 	t_bool write_ok = FALSE;
 
 	if ((fp_ip = fopen (newsrc, "r")) == (FILE *) 0)
 		return write_ok;
 
+	/* get size of original newsrc */
+	fstat (fileno(fp_ip), &note_stat_newsrc);
+
+	if (!note_stat_newsrc.st_size)
+		return TRUE; /* newsrc is empty */
+
 	if ((fp_op = fopen (newnewsrc, "w" FOPEN_OPTS)) != (FILE *) 0) {
 		if (newsrc_mode)
 			chmod (newnewsrc, newsrc_mode);
@@ -177,7 +183,7 @@
 
 	fclose (fp_ip);
 
-	if (tot == 0) {
+	if (!tot) {
 		error_message (txt_newsrc_nogroups);
 		return TRUE;		/* So we don't get prompted to try again */
 	}
@@ -581,10 +587,7 @@
 		if (high > group->xmax)
 			high = group->xmax;
 
-		if (low <= 1)
-			min = high + 1;
-		else
-			min = 1;
+		min = ((low <= 1) ? (high + 1) : 1);
 
 		if (group->xmin > min)
 			min = group->xmin;
@@ -641,12 +644,8 @@
 	if (gotseq) {
 		if (group->xmax > high)
 			sum += group->xmax - high;
-	} else {
-		if (group->count >= 0)
-			sum = (int) group->count;
-		else
-			sum = (int) (group->xmax - group->xmin) + 1;
-	}
+	} else
+		sum = (int) ((group->count >= 0) ? group->count : ((group->xmax - group->xmin) + 1));
 
 	group->newsrc.num_unread = sum;
 #ifdef DEBUG_NEWSRC
@@ -1165,7 +1164,7 @@
 	if (group->newsrc.xmin > group->newsrc.xmax + 1)
 		group->newsrc.xmin = group->newsrc.xmax + 1;
 
-	if (min == 0)
+	if (!min)
 		first = min = group->newsrc.xmin;
 	else if (min >= group->newsrc.xmin)
 		first = group->newsrc.xmin;
@@ -1255,7 +1254,7 @@
 			debug_print_bitmap (group, art);
 #endif
 		}
-		if ((art->status  == ART_UNREAD) || (art->status == ART_WILL_RETURN)) {
+		if ((art->status == ART_UNREAD) || (art->status == ART_WILL_RETURN)) {
 			art_mark_xref_read (art);
 
 			if (group != (struct t_group *) 0 && group->newsrc.num_unread)
diff -Nur tin-980117/src/nntplib.c tin-980202/src/nntplib.c
--- tin-980117/src/nntplib.c	Wed Dec 31 04:14:34 1997
+++ tin-980202/src/nntplib.c	Mon Feb  2 14:51:55 1998
@@ -18,23 +18,33 @@
 #include "tcurses.h"
 #include "tnntp.h"
 
+#ifdef VMS  /* M.St. 15.01.98 */
+#	undef VMS
+#endif
+
 /* Copy of last NNTP command sent, so we can retry it if needed */
 char	last_put[NNTP_STRLEN];
 
 #ifdef NNTP_ABLE
 	TCP *nntp_rd_fp = NULL;
 	TCP *nntp_wr_fp = NULL;
-	TCP *nntp_rd_fp_real = NULL;
-	TCP *nntp_wr_fp_real = NULL;
 #endif
 
+/*
+ * local prototypes
+ */
+#ifdef NNTP_ABLE
+	static int get_tcp_socket (char *machine, char *service, unsigned port);
+#endif
+
+
 /* Close the NNTP connection with prejudice */
 #define NNTP_HARD_CLOSE					\
-	if (nntp_wr_fp_real)						\
-		s_fclose (nntp_wr_fp_real);			\
-	if (nntp_rd_fp_real)						\
-		s_fclose (nntp_rd_fp_real);			\
-	nntp_rd_fp_real = nntp_wr_fp_real = nntp_rd_fp = nntp_wr_fp = NULL;
+	if (nntp_wr_fp)						\
+		s_fclose (nntp_wr_fp);			\
+	if (nntp_rd_fp)						\
+		s_fclose (nntp_rd_fp);			\
+	nntp_rd_fp = nntp_wr_fp = NULL;
 
 /*
  * getserverbyfile(file)
@@ -110,10 +120,17 @@
 		}
 	}
 
+#ifdef USE_INN_NNTPLIB
 	if ((cp = GetConfigValue (_CONF_SERVER)) != (char *) 0) {
-		(void) strcpy (buf, cp);
+		(void) STRCPY(buf, cp);
 		return (buf);
 	}
+#endif /* USE_INN_NNTPLIB */
+
+#ifdef NNTP_DEFAULT_SERVER
+	if (*(NNTP_DEFAULT_SERVER))
+		return NNTP_DEFAULT_SERVER;
+#endif	/* NNTP_DEFAULT_SERVER */
 
 #endif /* NNTP_ABLE */
 	return (char *) 0;	/* No entry */
@@ -143,13 +160,13 @@
 	int port,
 	char *text)
 {
-	char *	service = (char *)cservice; /* but calls non-const funcs */
+	char *service = (char *)cservice; /* but calls non-const funcs */
 #ifndef VMS
 	int	sockt_rd, sockt_wr;
 #endif
 
 #if defined (M_AMIGA) || defined(WIN32)
-	if (s_init() == 0)                /* some initialisation ... */
+	if (!s_init())		/* some initialisation ... */
 		return -1;
 #endif
 
@@ -161,9 +178,8 @@
 	if (cp && cp[1] == ':') {
 		*cp = '\0';
 		sockt_rd = get_dnet_socket (machine, service);
-	} else {
+	} else
 		sockt_rd = get_tcp_socket (machine, service, port);
-	}
 #else
 	sockt_rd = get_tcp_socket (machine, service, port);
 #endif
@@ -178,10 +194,7 @@
 	 * open a fp for reading and writing -- we have to open
 	 * up two separate fp's, one for reading, one for writing.
 	 */
-
-	nntp_rd_fp = nntp_wr_fp = NULL;
-
-	if ((nntp_rd_fp_real = (TCP *) s_fdopen (sockt_rd, "r")) == NULL) {
+	if ((nntp_rd_fp = (TCP *) s_fdopen (sockt_rd, "r")) == NULL) {
 		perror ("server_init: fdopen #1");
 		return (-errno);
 	}
@@ -194,17 +207,16 @@
 #ifdef TLI
 	if (t_sync (sockt_rd) < 0) {	/* Sync up new fd with TLI */
 		t_error ("server_init: t_sync");
+		nntp_rd_fp = NULL;		/* from above */
 		return (-EPROTO);
 	}
 #endif
 
-	if ((nntp_wr_fp_real = (TCP *) s_fdopen (sockt_wr, "w")) == NULL) {
+	if ((nntp_wr_fp = (TCP *) s_fdopen (sockt_wr, "w")) == NULL) {
 		perror ("server_init: fdopen #2");
+		nntp_rd_fp = NULL;		/* from above */
 		return (-errno);
 	}
-
-	nntp_rd_fp = stdin;      /* we shouldn't ever use those */
-	nntp_wr_fp = stdout;     /* and it will be obvious if we try */
 #else /* VMS */
 	sockt_wr = sockt_rd;
 #endif
@@ -234,7 +246,7 @@
  */
 
 #ifdef NNTP_ABLE
-int
+static int
 get_tcp_socket (
 	char *machine,		/* remote host */
 	char *service,		/* nttp/smtp etc. */
@@ -312,7 +324,7 @@
 		return (-EPROTO);
 	}
 
-	if (ioctl (s,  I_PUSH, "tirdwr") < 0) {
+	if (ioctl (s, I_PUSH, "tirdwr") < 0) {
 		perror ("I_PUSH(tirdwr)");
 		t_close (s);
 		return (-EPROTO);
@@ -562,7 +574,7 @@
 u_put_server (
 	const char *string)
 {
-	s_puts(string, nntp_wr_fp_real);
+	s_puts(string, nntp_wr_fp);
 }
 #endif
 
@@ -617,8 +629,8 @@
 			 * Don't use nntp_command() here - this is a lower level
 			 */
 fprintf(stderr, "Timeout - sending STAT\n");
-			s_printf (nntp_wr_fp_real, "STAT\r\n");
-			s_flush (nntp_wr_fp_real);
+			s_printf (nntp_wr_fp, "STAT\r\n");
+			s_flush (nntp_wr_fp);
 			respcode = get_respcode (NULL);
 
 			if (respcode == -1) {
@@ -638,8 +650,8 @@
 
 #endif /* 0 */
 
-	s_printf (nntp_wr_fp_real, "%s\r\n", string);
-	(void) s_flush (nntp_wr_fp_real);
+	s_printf (nntp_wr_fp, "%s\r\n", string);
+	(void) s_flush (nntp_wr_fp);
 
 	return;
 }
@@ -673,7 +685,7 @@
 
 	strcpy (buf, last_put);			/* Keep copy here, it will be clobbered a lot otherwise */
 
-	if (nntp_open () == 0) {
+	if (!nntp_open ()) {
 
 		/*
 		 * Re-establish our current group and resend last command
@@ -682,7 +694,7 @@
 DEBUG_IO((stderr, "Rejoin current group\n"));
 			sprintf (last_put, "GROUP %s", glob_group);
 			put_server (last_put);
-			s_gets (last_put, NNTP_STRLEN, nntp_rd_fp_real);
+			s_gets (last_put, NNTP_STRLEN, nntp_rd_fp);
 DEBUG_IO((stderr, "Read (%s)\n", last_put));
 		}
 DEBUG_IO((stderr, "Resend last command (%s)\n", buf));
@@ -721,12 +733,13 @@
 	/*
 	 * NULL socket reads indicates socket has closed. Try a few times more
 	 */
-	while (nntp_rd_fp == NULL || s_gets (string, size, nntp_rd_fp_real) == (char *) 0) {
+	while (nntp_rd_fp == NULL || s_gets (string, size, nntp_rd_fp) == (char *) 0) {
 
 #ifdef DEBUG
 		if (errno != 0 && errno != EINTR)	/*	I'm sure this will only confuse end users*/
 			perror_message("get_server()");
 #endif
+
 		retry = reconnect(retry);			/* Will abort when out of tries */
 	}
 
@@ -757,10 +770,10 @@
 	info_message("Disconnecting from server...");
 	nntp_command("QUIT", OK_GOODBYE, NULL);
 
-	(void) s_fclose (nntp_wr_fp_real);
-	(void) s_fclose (nntp_rd_fp_real);
+	(void) s_fclose (nntp_wr_fp);
+	(void) s_fclose (nntp_rd_fp);
 	s_end();
-	nntp_wr_fp_real = nntp_rd_fp_real = nntp_wr_fp = nntp_rd_fp = NULL;
+	nntp_wr_fp = nntp_rd_fp = NULL;
 }
 #endif /* NNTP_ABLE */
 #endif /* VMS */
diff -Nur tin-980117/src/nntpvms.c tin-980202/src/nntpvms.c
--- tin-980117/src/nntpvms.c	Fri Dec 26 03:44:46 1997
+++ tin-980202/src/nntpvms.c	Thu Jan  1 01:00:00 1970
@@ -1,190 +0,0 @@
-/*
- *  Project   : tin - a Usenet reader
- *  Module    : nntpvms.c
- *  Author    : S.Barber & I.Lea
- *  Created   : 10-04-97
- *  Notes     : VMS specific NNTP client routines, see nntplib.c
- *  Copyright : (c) Copyright 1991-94 by Stan Barber & Iain Lea
- *              Permission is hereby granted to copy, reproduce, redistribute
- *              or otherwise use this software  as long as: there is no
- *              monetary  profit  gained  specifically  from the use or
- *              reproduction or this software, it is not  sold, rented,
- *              traded or otherwise marketed, and this copyright notice
- *              is included prominently in any copy made.
- */
-#ifdef VMS
-
-int	sockt_rd = -1, sockt_wr = -1;
-
-/*
- * u_put_server -- send data to the server. Do not flush output.
- */
-
-#ifdef NNTP_ABLE
-void
-u_put_server (
-	const char *string)
-{
-	netwrite(sockt_wr, string, strlen(string));
-}
-#endif
-
-/*
- * put_server -- send a line of text to the server, terminating it
- * with CR and LF, as per ARPA standard.
- *
- *	Parameters:	"string" is the string to be sent to the
- *			server.
- *
- *	Returns:	Nothing.
- *
- *	Side effects:	Talks to the server.
- *			Closes connection if things are not right.
- *
- *	Note:	This routine flushes the buffer each time
- *			it is called.  For large transmissions
- *			(i.e., posting news) don't use it.  Instead,
- *			do the fprintf's yourself, and then a final
- *			fflush.
- */
-
-#ifdef NNTP_ABLE
-void
-put_server (
-	const char *string)
-{
-	int respno;
-	static time_t time_last;
-	time_t time_now;
-
-	/*
-	 *  Check how idle we have been, if too idle send a STAT to check
-	 */
-	time (&time_now);
-
-	if (sockt_wr == -1 || (time_last != 0 && time_last+NNTP_IDLE_RETRY_SECS < time_now)) {
-		respno = 0;
-		if (sockt_wr >= 0) {
-			netwrite(sockt_wr, "stat\r\n", 6);
-			respno = get_respcode ();
-		}
-		if (respno != OK_NOTEXT && respno != ERR_NCING && respno != ERR_NOCRNT) {
-			/*
-			 *  STAT was not happy, close the connection
-			 *  it will reopen on next get_server
-			 */
-			if (sockt_wr >= 0)
-				netclose(sockt_wr);
-			sockt_wr = sockt_rd = -1;
-
-			strcpy (last_put, string);
-			time_last = 0;
-			return;
-		}
-	}
-	time_last = time_now;
-
-	{
-	  char line[256];
-	  sprintf(line, "%s\r\n", string);
-	  netwrite(sockt_wr, line, strlen(line));
-	}
-
-	strcpy (last_put, string);
-}
-#endif /* NNTP_ABLE */
-
-/*
- * get_server -- return the next line of text from the server.  Strips
- * CR's and LF's.
- *
- *	Parameters:	"string" has the buffer space for the line received.
- *			"size" is maximum size of the buffer to read.
- *
- *	Returns:	NULL on end of stream, or a line of data
- *
- *	Side effects:	Talks to server, changes contents of "string".
- *			Reopens connection when necessary and requested.
- *			Exits via tin_done() if fatal error occurs.
- */
-
-#ifdef NNTP_ABLE
-char *get_server (char *string, int size)
-{
-	char buf[NNTP_STRLEN];
-	register char *cp;
-
-#ifdef USE_SFGETS
-	while (Sfgets (string, size, sockt_rd) == NULL) {
-#else
-	char *p;
-	while ((p = Srdline(sockt_rd)) == NULL) {
-#endif
-		if (errno != EINTR) {
-			netclose(sockt_rd);
-			ring_bell ();
-			if (!prompt_yn (cLINES, txt_reconnect_to_news_server, TRUE)) {
-				tin_done(EXIT_NNTP_ERROR);
-			}
-			clear_message ();
-			strcpy (buf, last_put);
-			if (nntp_open () == 0) {
-				if (glob_group != (char *) 0) {
-					sprintf (last_put, "group %s", glob_group);
-					put_server (last_put);
-#ifdef USE_SFGETS
-					Sfgets (last_put, NNTP_STRLEN, sockt_rd);
-#else
-					p = Srdline(sockt_rd);
-					strncpy(last_put, p, NNTP_STRLEN);
-#endif
-				}
-			} else {
-				tin_done(EXIT_NNTP_ERROR);
-			}
-			put_server (buf);
-		}
-	}
-#ifndef USE_SFGETS
-	memcpy(string, p, SIOLINELEN(sockt_rd) + 1);
-#endif
-	if ((cp = strchr (string, '\r')) != NULL) {
-		*cp = '\0';
-	} else if ((cp = strchr (string, '\n')) != NULL) {
-		*cp = '\0';
-	}
-
-	return (0);
-}
-#endif /* NNTP_ABLE */
-
-/*
- * close_server -- close the connection to the server, after sending
- *		the "quit" command.
- *
- *	Parameters:	None.
- *
- *	Returns:	Nothing.
- *
- *	Side effects:	Closes the connection with the server.
- *			You can't use "put_server" or "get_server"
- *			after this routine is called.
- */
-
-#ifdef NNTP_ABLE
-void
-close_server (void)
-{
-	if (sockt_rd < 0 || sockt_wr < 0)
-		return;
-
-	put_server ("QUIT");
-	(void) get_server (nntp_line, sizeof (nntp_line));
-
-	netclose(sockt_rd);
-	s_end();
-	sockt_rd = sockt_wr = -1;
-}
-#endif /* NNTP_ABLE */
-
-#endif /* VMS */
diff -Nur tin-980117/src/nntpw32.c tin-980202/src/nntpw32.c
--- tin-980117/src/nntpw32.c	Fri Dec 26 03:44:47 1997
+++ tin-980202/src/nntpw32.c	Thu Jan  1 01:00:00 1970
@@ -1,1487 +0,0 @@
-/*
- *  Project   : tin - a Usenet reader
- *  Module    : nntpw32.c
- *  Author    : N.Ellis (portions taken from nntplib.c)
- *  Created   : 12-01-91
- *  Updated   : 15-12-94
- *  Notes     : NNTP client routines taken from clientlib.c 1.5.11 (10-02-91)
- *  Copyright : (c) Copyright 1991-94 by Stan Barber & Iain Lea
- *              Permission is hereby granted to copy, reproduce, redistribute
- *              or otherwise use this software  as long as: there is no
- *              monetary  profit  gained  specifically  from the use or
- *              reproduction or this software, it is not  sold, rented,
- *              traded or otherwise marketed, and this copyright notice
- *              is included prominently in any copy made.
- */
-
-#include "tin.h"
-
-#if defined(WIN32)
-#if defined(NNTP_ABLE)
-
-char	last_put[NNTP_STRLEN];
-static	char nntp_line[NNTP_STRLEN];
-
-#ifdef WIN32XNS
-#define PACKET_SIZE 4096
-#define cmemBlock PACKET_SIZE
-// #define XNS_ASYNC			// XNS ASYNC send and receive
-#else
-#define cmemBlock (8*1024)
-#endif
-
-static char memBlock[cmemBlock+4];
-static UINT imemBlock = 0;
-static UINT iendBlock = 0;
-
-#if !defined(WIN32IP) && !defined(WIN32XNS) && !defined(WIN32PIPES)
-#pragma message("No network transport defined, defaulting to WIN32IP")
-#define WIN32IP
-#endif
-
-#ifdef DEBUG
-void DebugAssertDialog(LPSTR, DWORD, LPSTR);
-#define DEBUGCheckString(s, m)	if (*s=='\0') DebugAssertDialog(m, __LINE__, __FILE__);
-#else
-#define DEBUGCheckString(s, m)
-#endif
-
-#endif /* NNTP_ABLE */
-
-// Transport independant routines...
-
-/*
- * handle_server_response
- *
- *	Print some informative messages based on the server's initial
- *	response code.  This is here so inews, rn, etc. can share
- *	the code.
- *
- *	Parameters:	"response" is the response code which the
- *			server sent us, presumably from "server_init",
- *			above.
- *			"nntpserver" is the news server we got the
- *			response code from.
- *
- *	Returns:	-1 if the error is fatal (and we should exit).
- *			0 otherwise.
- *
- *	Side effects:	None.
- */
-
-int
-handle_server_response (response, nntpserver)
-	int	response;
-	char	*nntpserver;
-{
-#ifdef NNTP_ABLE
-	switch (response) {
-		case OK_NOPOST:		/* fall through */
-   		 	printf ("NOTE: This machine does not have permission to post articles.\n");
-			printf ("      Please don't waste your time trying.\n\n");
-
-		case OK_CANPOST:
-			return (0);
-			break;
-
-		case ERR_ACCESS:
-			printf ("This machine does not have permission to use the %s news server.\n", nntpserver);
-			return (-1);
-			break;
-
-		default:
-			printf ("Unexpected response code from %s news server: %d\n",
-				nntpserver, response);
-			return (-1);
-			break;
-    }
-	/*NOTREACHED*/
-#else
-	return (-1);
-#endif /* NNTP_ABLE */
-}
-
-#ifdef DEBUG
-/*
- * NNTP strings for get_respcode()
- */
-char *
-nntp_respcode (respcode)
-	int respcode;
-{
-#ifdef NNTP_ABLE
-	static char *text;
-
-	/*
-	 * If the last response line matches and has a description, return it
-	 */
-	if (atoi (nntp_line) == respcode && strlen (nntp_line) > 4) {
-		return nntp_line;
-	}
-
-	switch (respcode) {
-		case 0:
-			text = "";
-			break;
-		case INF_HELP:
-			text = "100  Help text on way";
-			break;
-		case INF_AUTH:
-			text = "180  Authorization capabilities";
-			break;
-		case INF_DEBUG:
-			text = "199  Debug output";
-			break;
-		case OK_CANPOST:
-			text = "200  Hello; you can post";
-			break;
-		case OK_NOPOST:
-			text = "201  Hello; you can't post";
-			break;
-		case OK_SLAVE:
-			text = "202  Slave status noted";
-			break;
-		case OK_GOODBYE:
-			text = "205  Closing connection";
-			break;
-		case OK_GROUP:
-			text = "211  Group selected";
-			break;
-		case OK_GROUPS:
-			text = "215  Newsgroups follow";
-			break;
-		case OK_XMOTD:
-			text = "217  News motd file follows";
-			break;
-		case OK_XINDEX:
-			text = "218  Group index file follows";
-			break;
-		case OK_ARTICLE:
-			text = "220  Article (head & body) follows";
-			break;
-		case OK_HEAD:
-			text = "221  Head follows";
-			break;
-		case OK_BODY:
-			text = "222  Body follows";
-			break;
-		case OK_NOTEXT:
-			text = "223  No text sent -- stat, next, last";
-			break;
-		case OK_NEWNEWS:
-			text = "230  New articles by message-id follow";
-			break;
-		case OK_NEWGROUPS:
-			text = "231  New newsgroups follow";
-			break;
-		case OK_XFERED:
-			text = "235  Article transferred successfully";
-			break;
-		case OK_POSTED:
-			text = "240  Article posted successfully";
-			break;
-		case OK_AUTHSYS:
-			text = "280  Authorization system ok";
-			break;
-		case OK_AUTH:
-			text = "281  Authorization (user/pass) ok";
-			break;
-		case OK_BIN:
-			text = "282  binary data follows";
-			break;
-		case OK_SPLIST:
-			text = "283  spooldir list follows";
-			break;
-		case OK_SPSWITCH:
-			text = "284  Switching to a different spooldir";
-			break;
-		case OK_SPNOCHANGE:
-			text = "285  Still using same spooldir";
-			break;
-		case OK_SPLDIRCUR:
-			text = "286  Current spooldir";
-			break;
-		case OK_SPLDIRAVL:
-			text = "287  Available spooldir";
-			break;
-		case OK_SPLDIRERR:
-			text = "288  Unavailable spooldir or invalid entry";
-			break;
-		case CONT_XFER:
-			text = "335  Continue to send article";
-			break;
-		case CONT_POST:
-			text = "340  Continue to post article";
-			break;
-		case NEED_AUTHINFO:
-			text = "380  authorization is required";
-			break;
-		case NEED_AUTHDATA:
-			text = "381  <type> authorization data required";
-			break;
-		case ERR_GOODBYE:
-			text = "400  Have to hang up for some reason";
-			break;
-		case ERR_NOGROUP:
-			text = "411  No such newsgroup";
-			break;
-		case ERR_NCING:
-			text = "412  Not currently in newsgroup";
-			break;
-		case ERR_XMOTD:
-			text = "417  No news motd file";
-			break;
-		case ERR_XINDEX:
-			text = "418  No index file for this group";
-			break;
-		case ERR_NOCRNT:
-			text = "420  No current article selected";
-			break;
-		case ERR_NONEXT:
-			text = "421  No next article in this group";
-			break;
-		case ERR_NOPREV:
-			text = "422  No previous article in this group";
-			break;
-		case ERR_NOARTIG:
-			text = "423  No such article in this group";
-			break;
-		case ERR_NOART:
-			text = "430  No such article at all";
-			break;
-		case ERR_GOTIT:
-			text = "435  Already got that article, don't send";
-			break;
-		case ERR_XFERFAIL:
-			text = "436  Transfer failed";
-			break;
-		case ERR_XFERRJCT:
-			text = "437  Article rejected, don't resend";
-			break;
-		case ERR_NOPOST:
-			text = "440  Posting not allowed";
-			break;
-		case ERR_POSTFAIL:
-			text = "441  Posting failed";
-			break;
-		case ERR_NOAUTH:
-			text = "480  authorization required for command";
-			break;
-		case ERR_AUTHSYS:
-			text = "481  Authorization system invalid";
-			break;
-		case ERR_AUTHREJ:
-			text = "482  Authorization data rejected";
-			break;
-		case ERR_INVALIAS:
-			text = "483  Invalid alias on spooldir cmd";
-			break;
-		case ERR_INVNOSPDIR:
-			text = "484  No spooldir file found";
-			break;
-		case ERR_COMMAND:
-			text = "500  Command not recognized";
-			break;
-		case ERR_CMDSYN:
-			text = "501  Command syntax error";
-			break;
-		case ERR_ACCESS:
-			text = "502  Access to server denied";
-			break;
-		case ERR_FAULT:
-			text = "503  Program fault, command not performed";
-			break;
-		case ERR_AUTHBAD:
-			text = "580  Authorization Failed";
-			break;
-		default:
-			text = "Unknown NNTP response code";
-			break;
-	}
-	return (text);
-#else
-	return ("");
-#endif
-}
-#endif /* DEBUG */
-
-/*
- * getserverbyfile	Get the name of a server from a named file.
- *			Handle white space and comments.
- *			Use NNTPSERVER environment variable if set.
- *
- *	Parameters:	"file" is the name of the file to read.
- *
- *	Returns:	Pointer to static data area containing the
- *			first non-ws/comment line in the file.
- *			NULL on error (or lack of entry in file).
- *
- *	Side effects:	None.
- */
-
-char *
-getserverbyfile (file)
-	char	*file;
-{
-#ifdef NNTP_ABLE
-	register FILE	*fp;
-	register char	*cp;
-	static char	buf[256];
-
-	cp = getenv ("NNTPSERVER");
-	if (cp != (char *) 0) {
-		(void) strcpy (buf, cp);
-		return (buf);
-	}
-
-	cp = GetConfigValue (_CONF_SERVER);
-	if (cp != (char *) 0) {
-		(void) strcpy (buf, cp);
-		return (buf);
-	}
-
-	if (file == (char *) 0) {
-		return (char *) 0;
-	}
-
-	if ((fp = fopen (file, "r")) == (FILE *) 0) {
-		return (char *) 0;
-	}
-
-	while (fgets (buf, sizeof (buf), fp) != (char *) 0) {
-		if (*buf == '\n' || *buf == '#') {
-			continue;
-		}
-		cp = strrchr (buf, '\n');
-		if (cp) {
-			*cp = '\0';
-		}
-		(void) fclose (fp);
-		return (buf);
-	}
-
-	(void) fclose (fp);
-#endif /* NNTP_ABLE */
-	return (char *) 0;	/* No entry */
-}
-
-/*=-=-=-=-=-=-=-=-=-=
- * TCP/IP Transport *
- *=-=-=-=-=-=-=-=-=-=*/
-
-#ifdef WIN32IP	/* TCP/IP Transport */
-
-#include <winsock.h>
-
-int nntp_rd_fp = 0;
-int nntp_wr_fp = 0;
-
-/*
- * server_init  Get a connection to the remote server.
- *
- *	Parameters:	"machine" is the machine to connect to.
- *			"service" is the service to connect to on the machine.
- *			"port" is the servive port to connect to.
- *
- *	Returns:	-1 on error
- *			server's initial response code on success.
- *
- *	Side effects:	Connects to server.
- *			"nntp_rd_fp" and "nntp_wr_fp" are fp's
- *			for reading and writing to server.
- */
-
-int
-server_init (machine, service, port)
-	char	*machine;
-	char	*service;
-	int	port;
-{
-#ifdef NNTP_ABLE
-	int	sockt_rd;
-	WSADATA wsaData;
-
-	if ( WSAStartup( MAKEWORD(1,1), &wsaData) != 0) {
-		return -1;
-	}
-
-	sockt_rd = get_tcp_socket (machine, service, port);
-
-	if (sockt_rd < 0)
-		return (-1);
-
-	nntp_rd_fp = nntp_wr_fp = sockt_rd;
-	/*
-	 * Now get the server's signon message
-	 */
-	(void) get_server (nntp_line, sizeof (nntp_line));
-	return (atoi (nntp_line));
-#else
-	return (-1);
-#endif /* NNTP_ABLE */
-}
-
-/*
- * get_tcp_socket -- get us a socket connected to the specified server.
- *
- *	Parameters:	"machine" is the machine the server is running on.
- *			"service" is the service to connect to on the server.
- *			"port" is the port to connect to on the server.
- *
- *	Returns:	Socket connected to the server if
- *			all is ok, else -1 on error.
- *
- *	Side effects:	Connects to server.
- *
- *	Errors:		Printed via perror.
- */
-
-int
-get_tcp_socket (machine, service, port)
-	char	*machine;	/* remote host */
-	char	*service;	/* nttp/smtp etc. */
-	unsigned port;		/* tcp port number */
-{
-#ifdef NNTP_ABLE
-	int	s = -1;
-	struct	sockaddr_in sin;
-	struct servent *sp;
-	struct hostent *hp;
-#ifdef h_addr
-	int	x = 0;
-	register char **cp;
-	static char *alist[1];
-#endif /* h_addr */
-	static struct hostent def;
-	static struct in_addr defaddr;
-	static char namebuf[256];
-
-	if ((sp = (struct servent *) getservbyname (service, "tcp")) ==  NULL) {
-		fprintf (stderr, "%s/tcp: Unknown service.\n", service);
-		return (-1);
-	}
-	/* If not a raw ip address, try nameserver */
-	if (! isdigit((unsigned char)*machine) ||
-	    (long)(defaddr.s_addr = (long) inet_addr (machine)) == -1) {
-		hp = gethostbyname (machine);
-	} else {
-		/* Raw ip address, fake  */
-		(void) strcpy (namebuf, machine);
-		def.h_name = (char *) namebuf;
-#ifdef h_addr
-		def.h_addr_list = alist;
-#endif
-		def.h_addr = (char *) &defaddr;
-		def.h_length = sizeof (struct in_addr);
-		def.h_addrtype = AF_INET;
-		def.h_aliases = 0;
-		hp = &def;
-	}
-	if (hp == NULL) {
-		fprintf (stderr, "\n%s: Unknown host.\n", machine);
-		return (-1);
-	}
-
-	memset((char *) &sin, '\0', sizeof (sin));
-	sin.sin_family = hp->h_addrtype;
-	sin.sin_port = sp->s_port;
-
-	/*
-	 * The following is kinda gross.  The name server under 4.3
-	 * returns a list of addresses, each of which should be tried
-	 * in turn if the previous one fails.  However, 4.2 hostent
-	 * structure doesn't have this list of addresses.
-	 * Under 4.3, h_addr is a #define to h_addr_list[0].
-	 * We use this to figure out whether to include the NS specific
-	 * code...
-	 */
-
-#ifdef h_addr
-	/*
-	 * get a socket and initiate connection -- use multiple addresses
-	 */
-
-	for (cp = hp->h_addr_list; cp && *cp; cp++) {
-		s = socket (hp->h_addrtype, SOCK_STREAM, 0);
-		if (s < 0) {
-			perror ("socket");
-			return (-1);
-		}
-		memcpy((char *) &sin.sin_addr, *cp, hp->h_length);
-
-		if (x < 0) {
-			fprintf (stderr, "Trying %s", (char *) inet_ntoa (sin.sin_addr));
-		}
-		x = connect (s, (struct sockaddr *) &sin, sizeof (sin));
-		if (x == 0) {
-			break;
-		}
-		fprintf (stderr, "\nConnection to %s: ", (char *) inet_ntoa (sin.sin_addr));
-		perror ("");
-		(void) closesocket (s);
-	}
-	if (x < 0) {
-		fprintf (stderr, "Giving up...\n");
-		return (-1);
-	}
-#else	/* no name server */
-	if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
-		perror ("socket");
-		return (-1);
-	}
-
-	/* And then connect */
-
-	memcpy((char *) &sin.sin_addr, hp->h_addr, hp->h_length);
-	if (connect (s, (struct sockaddr *) &sin, sizeof (sin)) < 0) {
-		perror ("connect");
-		(void) closesocket (s);
-		return (-1);
-	}
-
-#endif /* !h_addr */
-	/* Disable nagling to prevent packet delays */
-	{
-	BOOL fOn = TRUE;
-	(void) setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (const char *) &fOn, sizeof(fOn));
-	}
-
-	return (s);
-#else
-	return (-1);
-#endif /* NNTP_ABLE */
-}
-
-
-/*
- * u_put_server -- send data to the server. Do not flush output.
- */
-
-void
-u_put_server (string)
-	char *string;
-{
-#ifdef	NNTP_ABLE
-	send(nntp_wr_fp, string, strlen(string), 0);
-#endif
-}
-
-/*
- * put_server -- send a line of text to the server, terminating it
- * with CR and LF, as per ARPA standard.
- *
- *	Parameters:	"string" is the string to be sent to the
- *			server.
- *
- *	Returns:	Nothing.
- *
- *	Side effects:	Talks to the server.
- *			Closes connection if things are not right.
- *
- *	Note:	This routine flushes the buffer each time
- *			it is called.  For large transmissions
- *			(i.e., posting news) don't use it.  Instead,
- *			do the fprintf's yourself, and then a final
- *			fflush.
- */
-
-void
-put_server (string)
-	char *string;
-{
-#ifdef NNTP_ABLE
-	int respno;
-	static time_t time_last;
-	time_t time_now;
-
-	DEBUGCheckString(string, "NULL NNTP Command");
-	/*
-	 *  Check how idle we have been, if too idle send a STAT to check
-	 */
-	time (&time_now);
-	if (time_last != 0 && time_last+NNTP_IDLE_RETRY_SECS < time_now) {
-		send(nntp_wr_fp, "stat\r\n", 6, 0);
-		respno = get_respcode ();
-		if (respno != OK_NOTEXT && respno != ERR_NCING && respno != ERR_NOCRNT) {
-			/*
-			 *  STAT was not happy, close the connection
-			 *  it will reopen on next get_server
-			 */
-			closesocket (nntp_wr_fp);
-			closesocket (nntp_rd_fp);
-			strcpy (last_put, string);
-			time_last = 0;
-			return;
-		}
-	}
-	time_last = time_now;
-
-	sprintf(nntp_line, "%s\r\n", string);
-	send(nntp_wr_fp, nntp_line, strlen(nntp_line), 0);
-
-	strcpy (last_put, string);
-#endif /* NNTP_ABLE */
-}
-
-#ifdef NNTP_ABLE
-static int read_from_server (LPSTR nntp_line, DWORD length)
-{
-	DWORD cbRead = 0, cb;
-	char *pEol;
-
-	if ( imemBlock == iendBlock )
-	{
-		pEol = 0;
-	}
-	else
-	{
-		pEol = strstr(memBlock+imemBlock, "\r\n");	/* search for a newline                */
-		if (pEol > memBlock+iendBlock-2)			/* if one was found outside the buffer */
-			pEol = 0;								/* then we didn't really find one      */
-	}
-
-	if ( !pEol)
-	{
-		iendBlock -= imemBlock;
-		if ( iendBlock)
-			memcpy( memBlock, memBlock+imemBlock, iendBlock );
-		imemBlock = 0;
-		do {
-			cbRead = recv( nntp_rd_fp, memBlock+iendBlock, cmemBlock - iendBlock, 0);
-			if (cbRead == 0 || cbRead == SOCKET_ERROR)
-			{
-				return -1;
-			}
-
-			iendBlock += cbRead;
-
-			pEol = strstr(memBlock, "\r\n");				/* search for a newline */
-		} while( pEol > memBlock+iendBlock-2);
-	}
-
-	cb = pEol - (memBlock+imemBlock);
-
-	memcpy (nntp_line, memBlock+imemBlock, cb);
-	nntp_line[cb] = '\0';
-	imemBlock += cb + 2;
-
-	assert(imemBlock<=iendBlock);
-
-	return (strlen (nntp_line));
-}
-#endif /* NNTP_ABLE */
-
-/*
- * get_server -- get a line of text from the server.  Strips
- * CR's and LF's.
- *
- *	Parameters:	"string" has the buffer space for the
- *			line received.
- *			"size" is the size of the buffer.
- *
- *	Returns:	-1 on error, 0 otherwise, -2 if user said no to reconnection.
- *
- *	Side effects:	Talks to server, changes contents of "string".
- *			Reopens connection when necessary and requested.
- */
-
-int
-get_server (string, size)
-	char	*string;
-	int	size;
-{
-#ifdef NNTP_ABLE
-	int cbRead;
-
-	cbRead = read_from_server(string, size);
-	if ( cbRead == -1)
-	{
-		closesocket(nntp_wr_fp);
-		if (nntp_open () == 0)
-		{
-			char buf[NNTP_STRLEN];
-
-			strcpy(buf, last_put);
-			if (glob_group != (char *) 0)
-			{
-				char tmp[NNTP_STRLEN];
-				sprintf (tmp, "group %s", glob_group);
-				put_server (tmp);
-				cbRead = read_from_server (tmp, NNTP_STRLEN);
-			}
-			put_server (buf);
-			cbRead = read_from_server (string, size);
-		}
-	}
-
-	return cbRead;
-#else
-	return -1;
-#endif /* NNTP_ABLE */
-}
-
-/*
- * close_server -- close the connection to the server, after sending
- *		the "quit" command.
- *
- *	Parameters:	None.
- *
- *	Returns:	Nothing.
- *
- *	Side effects:	Closes the connection with the server.
- *			You can't use "put_server" or "get_server"
- *			after this routine is called.
- */
-
-void
-close_server ()
-{
-#ifdef NNTP_ABLE
-	if (nntp_wr_fp == 0 || nntp_rd_fp == 0)
-		return;
-
-	put_server ("QUIT");
-	(void) get_server (nntp_line, sizeof (nntp_line));
-
-	(void) closesocket (nntp_wr_fp);
-#endif /* NNTP_ABLE */
-}
-
-#endif /* WIN32IP */
-
-/*=-=-=-=-=-=-=-=-=-=-=-=*
- * Named pipes Transport *
- *=-=-=-=-=-=-=-=-=-=-=-=*/
-
-#ifdef WIN32PIPES
-HANDLE hPipe;
-
-/*
- * server_init get a connection to a remote server
- *
- *
- *  returns -1 on error
- */
-
-int server_init (LPCSTR machine, LPCSTR service, USHORT port)
-{
-	BOOL fSuccess;
-	DWORD dwMode;
-	CHAR lpszPipename[128];
-
-	strcpy (lpszPipename, "\\\\");
-	strcat (lpszPipename, machine);
-	strcat (lpszPipename, "\\pipe\\");
-	strcat (lpszPipename, service);
-
-	/* try and open the pipe */
-	while (1)
-	{
-		hPipe = CreateFile (
-							   lpszPipename,	/* pipe name           */
-							   GENERIC_READ |	/* read/write access   */
-							   GENERIC_WRITE,
-							   0,	/* no sharing          */
-							   NULL,	/* no security attr. */
-							   OPEN_EXISTING,	/* opens existing pipe */
-							   0,	/* default attributes  */
-							   NULL);	/* no template file    */
-
-		/* Break if the pipe handle is valid. */
-
-		if (hPipe != INVALID_HANDLE_VALUE)
-			break;
-
-		/* Exit if an error other than ERROR_PIPE_BUSY occurs */
-
-		if (GetLastError () != ERROR_PIPE_BUSY)
-			return (-1);
-
-		/* All pipe instances are busy, so wait for 20 seconds. */
-
-		if (! WaitNamedPipe (lpszPipename, 20000))
-			return (-1);
-
-	}
-	dwMode = PIPE_READMODE_BYTE;
-	fSuccess = SetNamedPipeHandleState (
-										   hPipe,	/* pipe handle          */
-										   &dwMode,		/* new pipe mode        */
-										   NULL,	/* don't set max. bytes */
-										   NULL);	/* don't set max. time  */
-
-	if (! fSuccess)
-		return (-1);
-	/*
-	 * now get the servers signon message
-	 */
-	(void) get_server (nntp_line, sizeof (nntp_line));
-
-	return (atoi (nntp_line));
-}
-
-/*
- * real_put_server -- send a line of text to the server, terminating it
- * with  CR and LF if asked, as per the ARPA standard
- *
- * Parameters: the line to put to the server
- * Side effects: talks to the server and closes the link if problems
- *
- */
-static void real_put_server (LPCSTR plpvMessage, int fCRLF)
-{
-	BOOL fSuccess;
-	DWORD cbWritten;
-
-	fSuccess = WriteFile (hPipe, plpvMessage, strlen (plpvMessage), &cbWritten, NULL);
-	if ( fSuccess && fCRLF)
-		fSuccess = WriteFile (hPipe, "\r\n", 2, &cbWritten, NULL);
-
-	if (! fSuccess)
-	{
-		char buf[NNTP_STRLEN];
-
-		CloseHandle (hPipe);
-		strcpy (buf, plpvMessage);
-		if (nntp_open () == 0)
-		{
-			if (glob_group != (char *) 0)
-			{
-				char tmp[NNTP_STRLEN];
-				sprintf (tmp, "group %s", glob_group);
-				put_server (tmp);
-				get_server (tmp, NNTP_STRLEN);
-			}
-			put_server (buf);
-		}
-	}
-}
-
-/*
- * u_put_server -- send data to the server. Do not flush output.
- */
-_inline void
-u_put_server (string)
-	char *string;
-{
-#ifdef	NNTP_ABLE
-	real_put_server(string, 0);
-#endif
-}
-
-/*
- * put_server -- send a line of text to the server, terminating it
- * with  CR and LF, as per the ARPA standard
- */
-void put_server (LPCSTR plpvMessage)
-	{
-	DEBUGCheckString(plpvMessage, "NULL NNTP Command");
-	real_put_server(plpvMessage, 1);
-	}
-
-/*
- * close_server close the connection to the server after sending the 'quit'
- * command
- *
- * Side effects: closes the connections to the server, you can't use put/get
- * after this call
- */
-
-void close_server ()
-{
-	put_server ("QUIT\r\n");
-	get_server (nntp_line, sizeof (nntp_line));
-	CloseHandle (hPipe);
-}
-
-int get_server (LPSTR nntp_line, DWORD length)
-{
-	DWORD cbRead = 0, cb;
-	char *pEol;
-	BOOL fSuccess;
-
-	if (imemBlock == iendBlock)
-	{
-		pEol = 0;
-	}
-	else
-	{
-		/* search for a newline */
-		pEol = strstr (memBlock + imemBlock, "\r\n");
-
-		/* if one was found outside the buffer */
-		if (pEol > memBlock + iendBlock - 2)
-			pEol = 0;		/* then we didn't really find one */
-
-	}
-
-	if (! pEol)
-	{
-		iendBlock -= imemBlock;
-		if (iendBlock)
-			memcpy (memBlock, memBlock + imemBlock, iendBlock);
-		imemBlock = 0;
-		do
-		{
-			fSuccess = ReadFile (
-				hPipe,	/* pipe handle */
-				(LPVOID) (memBlock + iendBlock),	/* buffer to receive reply */
-				cmemBlock - iendBlock,				/* size of buffer          */
-				&cbRead,							/* number of bytes read    */
-				NULL);								/* not overlapped          */
-
-			assert(fSuccess);
-
-			iendBlock += cbRead;
-
-			pEol = strstr (memBlock, "\r\n");	/* search for a newline */
-
-		}
-		while (pEol > memBlock + iendBlock - 2);
-	}
-
-	cb = pEol - (memBlock + imemBlock);
-
-	memcpy (nntp_line, memBlock + imemBlock, cb);
-	nntp_line[cb] = '\0';
-	imemBlock += cb + 2;
-
-	assert (imemBlock <= iendBlock);
-
-	return (strlen (nntp_line));
-}
-
-#endif /* WIN32PIPES */
-
-
-/*=-=-=-=-=-=-=-=-=-=-=-=*
- * XNS Netbios Transport *
- *=-=-=-=-=-=-=-=-=-=-=-=*/
-
-#ifdef WIN32XNS
-static int LSN;
-static unsigned LANA;
-static int neterrno = 0x00;
-
-static int rc;          /* generic return code placeholder */
-
-/* Misc NB functions for low level network I/O */
-static int netpname(unsigned, char *);
-static int checknet(void);
-static int resetnet(unsigned);
-static int netconnect(unsigned *, char *, char *);
-static int netaddname(unsigned, char *);
-static int netsend(unsigned, int, char *, unsigned);
-static int netreceive(unsigned, int, char *, unsigned);
-static void nethangup(unsigned, int);
-static int netlana(LANA_ENUM *plenum);
-static int get_connection(unsigned *, char *);
-
-static int passncb(struct _NCB *);
-static void netperror(char *);
-
-#define SubmitNCB(ncb)	Netbios(ncb)
-#define HOSTNAMSZ       8       /* max size of a machine name */
-#define ACK_CHAR        0x06    /* expected reply from server daemon */
-
-/*
- * server_init get a connection to a remote server
- *
- *
- *  returns -1 on error
- */
-
-int server_init (LPCSTR machine, LPCSTR service, USHORT port)
-	{
-	/*
-	 * Make the connection to the server
-	 *
-	 */
-	strcpy(nntp_line, machine);
-
-	if ((LSN = get_connection(&LANA, nntp_line)) < 0)
-		return -1;
-
-	printf("connected...");
-
-	/* Now get the server's signon message */
-	get_server(nntp_line, sizeof(nntp_line));
-
-	return (atoi (nntp_line));
-	}
-
-void real_put_server (LPCSTR plpvMessage, int fCRLF)
-	{
-	DWORD cbWritten;
-	unsigned packet, length;
-
-	length = (unsigned) strlen(plpvMessage);
-	packet = 0;
-
-	if (length - packet)
-		{
-		cbWritten = netsend(LANA, LSN, (char *) plpvMessage + packet, length - packet);
-		assert(cbWritten!=-1);
-		}
-
-	if (fCRLF)
-		{
-		cbWritten = netsend(LANA, LSN, (char *)"\r\n", 2);
-		assert(cbWritten!=1);
-		}
-
-	return /* (packet + cbWritten) */;
-	}
-
-/*
- * u_put_server -- send data to the server. Do not flush output.
- */
-
-_inline void u_put_server (string)
-	char *string;
-	{
-#ifdef	NNTP_ABLE
-	real_put_server(string, 0);
-#endif
-	}
-
-/*
- * put_server -- send a line of text to the server, terminating it
- * with  CR and LF, as per the ARPA standard
- *
- * Parameters: the line to put to the server
- * Side effects: talks to the server and closes the link if problems
- *
- */
-void put_server(LPCSTR plpvMessage)
-	{
-	DEBUGCheckString(plpvMessage, "NULL NNTP Command");
-	real_put_server(plpvMessage, 1);
-	}
-
-/*
- * close_server close the connection to the server after sending the 'quit'
- * command
- *
- * Side effects: closes the connections to the server, you can't use put/get
- * after this call
- */
-
-void close_server ()
-	{
-	if (LSN == 0)
-		return;
-
-	put_server ("QUIT");
-	get_server (nntp_line, sizeof (nntp_line));
-
-	nethangup(LANA, LSN);
-	LSN = 0;
-	}
-
-int get_server (LPSTR nntp_line, DWORD length)
-	{
-	DWORD cbRead = 0, cb;
-	char *pEol;
-	BOOL fSuccess;
-
-	if (imemBlock == iendBlock)
-		{
-		pEol = 0;
-		}
-	else
-		{
-		/* search for a newline */
-		pEol = strstr (memBlock + imemBlock, "\r\n");
-
-		/* if one was found outside the buffer */
-		if (pEol > memBlock + iendBlock - 2)
-			pEol = 0;		/* then we didn't really find one */
-		}
-
-	if (! pEol)
-		{
-		iendBlock -= imemBlock;
-		if (iendBlock)
-			memcpy (memBlock, memBlock + imemBlock, iendBlock);
-		imemBlock = 0;
-		do
-			{
-			cbRead = netreceive(LANA, LSN, memBlock + iendBlock, cmemBlock - iendBlock);
-			fSuccess = (cbRead != -1);
-
-			assert(fSuccess);
-
-			iendBlock += cbRead;
-
-			pEol = strstr (memBlock, "\r\n");	/* search for a newline */
-			}
-		while (pEol > memBlock + iendBlock - 2);
-		}
-
-	assert(pEol != (char *) NULL);
-
-	cb = pEol - (memBlock + imemBlock);
-
-	assert(cb <= length);
-	memcpy (nntp_line, memBlock + imemBlock, cb);
-	nntp_line[cb] = '\0';
-	imemBlock += cb + 2;
-
-	assert (imemBlock <= iendBlock);
-
-	return (strlen (nntp_line));
-	}
-
-int	netaddname(unsigned lana, char *lname)
-	{
-	struct _NCB ncb={0};
-
-	if (lname == NULL || *lname == '\0')
-		return -1;
-
-	ncb.ncb_command = NCBADDNAME;
-	ncb.ncb_lana_num = LANA;
-	memcpy(ncb.ncb_name, (char *)lname, NCBNAMSZ);
-
-	rc = passncb(&ncb);
-	if (rc < 0)
-		rc = -1;
-	else
-		rc = ncb.ncb_num;
-
-	return rc;
-	}
-
-/*
- * get_connection -- get us a connection to the news server.
- *
- *	Parameters:	"machine" is the machine the server is running on.
- *
- *      Returns:        LSN connected to the news server if
- *                      all is ok, else -1 on error.
- */
-
-int	get_connection(unsigned *lana, char *machine)
-	{
-	int s;
-
-	if ((s = checknet()) < 0)
-		{
-		netperror("Net not found");
-		}
-	else
-		{
-		if ((s = netconnect(lana, machine, "nntp")) < 0)
-			{
-			netperror("Trouble connecting");
-			}
-		}
-	return s;
-	}
-
-void nethangup(unsigned lana, int lsn)
-	{
-	struct _NCB ncb={0};
-
-	ncb.ncb_command = NCBHANGUP;
-	ncb.ncb_lsn = (unsigned char) lsn;
-	ncb.ncb_lana_num = lana;
-
-	passncb(&ncb);
-	}
-
-unsigned char netcall(unsigned lana, char *lname, char *rname)
-	{
-	struct _NCB ncb={0};
-
-	if (lname == NULL)
-		{
-	    /* use permanent node name */
-		if (netpname(lana, ncb.ncb_name) < 0)
-			{
-			return 0;
-			}
-		}
-	else
-		{
-		if ((netaddname(lana, lname) < 0) &&
-			(neterrno != NRC_DUPNAME))
-			{
-			return 0;
-			}
-
-		memcpy(ncb.ncb_name, (char *)lname, NCBNAMSZ);
-		}
-
-	ncb.ncb_command = NCBCALL;
-	ncb.ncb_lana_num = lana;
-	memcpy(ncb.ncb_callname, (char *)rname, NCBNAMSZ);
-
-	rc = passncb(&ncb);
-
-	if (rc < 0)
-		rc = 0;
-	else
-		rc = ncb.ncb_lsn;
-
-	return rc;
-	}
-
-int	netconnect(unsigned *lana, char *rname, char *service)
-	{
-	char    callname[NCBNAMSZ];
-	unsigned lsn=0;
-	int     saverr;
-	int i;
-	LANA_ENUM lenum={0};
-
-	/* find the valid lana numbers for the network */
-	if (netlana(&lenum)==0)
-		{
-		perror("No adapters found");
-		return -1;
-		}
-
-	memset(callname, '\0', NCBNAMSZ);
-	strncpy(callname, rname, HOSTNAMSZ);
-	strcat(callname, ".srv");
-
-	// Try to connect to the service using the valid lana numbers
-	for (i=0; i < lenum.length; i++)
-		{
-		if ((resetnet(lenum.lana[i])!=-1) && ((lsn = netcall(lenum.lana[i], NULL, callname)) != (unsigned char) 0))
-			break;
-		}
-
-	/* Failed ... */
-	if (i == lenum.length)
-		{
-		*lana = 0;
-		return -1;
-		}
-	else
-		{
-		/* Found.. */
-		*lana = lenum.lana[i];
-		}
-
-	/* tell the server daemon what service we want */
-	if (netsend(*lana, lsn, service, strlen(service) + 1) != -1)
-		{
-		if (netreceive(*lana, lsn, callname, 1) != -1)
-			{
-			if (*callname == ACK_CHAR)
-				{
-				return lsn;
-				}
-			}
-		}
-
-	nethangup(*lana, lsn);
-	*lana = 0;
-	saverr = neterrno;
-	neterrno = saverr;
-	return -1;
-	}
-
-int netpname(unsigned lana, char *pname)
-	{
-	ADAPTER_STATUS stats={0};
-	struct _NCB ncb={0};
-
-	ncb.ncb_command = NCBASTAT;
-	ncb.ncb_lana_num = lana;
-	ncb.ncb_callname[0] = '*';
-	ncb.ncb_length = sizeof(ADAPTER_STATUS);
-	ncb.ncb_buffer = (char *) &stats;
-
-	memset(stats.adapter_address, 0, 6);
-
-	if (passncb(&ncb) < 0)
-		rc = -1;
-	else
-		{
-		memset(pname, '\0', 10);
-		memcpy(pname + 10, stats.adapter_address, 6);
-		rc = 0;
-		}
-
-	return rc;
-	}
-
-/*
-** This function needs to calculate the 'real' number of bytes returned
-** into the buffer.
-*/
-int	netreceive(unsigned lana, int lsn, char *data, unsigned nbytes)
-	{
-	struct _NCB ncb = {0};
-	char buffer[PACKET_SIZE + 1]={0};
-
-	ncb.ncb_command = NCBRECV;
-#ifdef XNS_ASYNC
-	ncb.ncb_command |= ASYNCH;
-#endif
-	ncb.ncb_lana_num = lana;
-	ncb.ncb_lsn = (unsigned char) lsn;
-	ncb.ncb_length = nbytes;
-	ncb.ncb_buffer = (char *) buffer;
-
-	rc = passncb(&ncb);
-
-	if (rc < 0)
-		rc = -1;
-	else
-		{
-		if (nbytes==1)
-			{
-			rc = 1;
-			*data = *buffer;
-			}
-		else
-			{
-			rc = strlen(buffer);
-			memcpy(data, buffer, rc);
-			}
-		}
-
-	return rc;
-	}
-
-int	netsend(unsigned lana, int lsn, char *data, unsigned nbytes)
-	{
-	struct _NCB ncb={0};
-	char buffer[PACKET_SIZE + 1];
-
-	if (nbytes == 0)
-		{
-		neterrno = NRC_BUFLEN;
-		return -1;
-		}
-
-	memcpy(buffer, (char *) data, nbytes);
-
-	ncb.ncb_command = NCBSEND;
-#ifdef XNS_ASYNC
-	ncb.ncb_command |= ASYNCH;
-#endif
-	ncb.ncb_lana_num = lana;
-	ncb.ncb_lsn = (unsigned char) lsn;
-	ncb.ncb_length = nbytes;
-	ncb.ncb_buffer = (char *) buffer;
-
-	rc = passncb(&ncb);
-
-	if (rc < 0)
-		rc = -1;
-	else
-		rc = ncb.ncb_length;
-
-	return rc;
-	}
-
-int	checknet(void)
-	{
-	struct _NCB ncb={0};
-
-	/* Send illegal command */
-	ncb.ncb_command = 0x7f;
-
-	passncb(&ncb);
-
-	rc = neterrno;
-	if (rc == NRC_ILLCMD)
-		rc = neterrno = 0;
-
-	return rc;
-	}
-
-int	resetnet(unsigned lana)
-	{
-	struct _NCB ncb={0};
-
-	// Send a RESET for a specific LANA number.
-	ncb.ncb_command = NCBRESET;
-	ncb.ncb_lana_num = lana;
-	ncb.ncb_lsn = 0;
-
-	ncb.ncb_callname[0] = (unsigned char) 16;	// 16 sessions
-	ncb.ncb_callname[1] = (unsigned char) 255;	// 255 commands
-	ncb.ncb_callname[2] = (unsigned char) 8;	// 8 names
-	ncb.ncb_callname[3] = (unsigned char) 1;	// Request non-perm node name
-
-	rc = passncb(&ncb);
-
-	rc = neterrno;
-	if (rc != NRC_GOODRET)
-		rc = neterrno = -1;
-
-	return rc;
-	}
-
-int	netlana(LANA_ENUM *plenum)
-	{
-	struct _NCB ncb={0};
-
-	/* Send a ENUM to get the network numbers */
-	ncb.ncb_command = NCBENUM;
-	ncb.ncb_length = sizeof(LANA_ENUM);
-	ncb.ncb_buffer = (unsigned char *)plenum;
-	if (ncb.ncb_buffer == (unsigned char *) NULL)
-		{
-		rc = neterrno = -1;
-		return rc;
-		}
-
-	passncb(&ncb);
-
-	rc = plenum->length;
-	if (ncb.ncb_retcode != NRC_GOODRET)
-		rc = neterrno = -1;
-
-	return rc;
-	}
-
-#pragma optimize("a", on)
-#pragma optimize("gw", off)
-int passncb(PNCB ncb)
-	{
-	if (ncb->ncb_command & ASYNCH)
-		{
-		ncb->ncb_event = CreateEvent(NULL, FALSE, FALSE, "passncb");
-		assert(ncb->ncb_event != NULL);
-
-		neterrno = Netbios(ncb);
-
-		if (WaitForSingleObject(ncb->ncb_event, INFINITE)==WAIT_FAILED)
-			{
-			CloseHandle(ncb->ncb_event);
-			return -1;
-			}
-
-		CloseHandle(ncb->ncb_event);
-		}
-	else
-		{
-		neterrno = Netbios(ncb);
-		}
-
-	if (neterrno && neterrno != NRC_INCOMP)
-		return -1;
-	else
-		return 0;
-	}
-#pragma optimize("gw", on)
-#pragma optimize("a", off)
-
-void
-netperror(char *wintitle)
-	{
-	fprintf(stderr, "%s (NetBIOS code 0x%x)\n", wintitle, neterrno);
-	neterrno = 0;
-	}
-
-#endif /* WIN32XNS */
-
-#endif /* WIN32 */
diff -Nur tin-980117/src/nrctbl.c tin-980202/src/nrctbl.c
--- tin-980117/src/nrctbl.c	Wed Dec 31 04:11:37 1997
+++ tin-980202/src/nrctbl.c	Sun Feb  1 05:13:49 1998
@@ -81,10 +81,7 @@
 			}
 		}
 		fclose(fp);
-		if (found)
-			strcpy(nntpserver_name, name_found);
-		else
-			strcpy(nntpserver_name, nick_name);
+		strcpy(nntpserver_name, (found ? name_found : nick_name));
 	} else {
 		write_newsrctable_file();
 		strcpy(nntpserver_name, nick_name);
@@ -150,7 +147,8 @@
 					joinpath (newsrc_name, homedir, tmp_newsrc);
 			}
 			(void) strcpy (dir, newsrc_name);
-			*strrchr (dir, '/') = (char) 0;
+			if (strchr (dir, '/'))
+				*strrchr (dir, '/') = (char) 0;
 
 			if (!error) {
 			/* FIXME - write a global permssion check routine */
diff -Nur tin-980117/src/open.c tin-980202/src/open.c
--- tin-980117/src/open.c	Sat Jan 17 21:34:37 1998
+++ tin-980202/src/open.c	Wed Jan 28 07:16:19 1998
@@ -161,25 +161,21 @@
 			char *chr1, *chr2;
 			int j;
 
-			j = atoi(get_val("COLUMNS", "80"));
+			j = atoi (get_val ("COLUMNS", "80"));
+			chr1 = my_strdup ((sec ? bug_nntpserver2 : bug_nntpserver1));
 
-			if (sec)
-				chr1 = my_strdup(bug_nntpserver2);
-			else
-				chr1 = my_strdup(bug_nntpserver1);
-
-			if (((int)strlen(chr1))>=j) {
-				chr2 = chr1+strlen(chr1)-1;
-				while(chr2-chr1>=j)
+			if (((int)strlen (chr1)) >= j) {
+				chr2 = chr1 + strlen (chr1) - 1;
+				while (chr2 - chr1 >= j)
 					chr2--;
-				while(chr2>chr1 && *chr2!=' ')
+				while (chr2 > chr1 && *chr2 != ' ')
 					chr2--;
-				if (chr2!=chr1)
+				if (chr2 != chr1)
 					*chr2 = '\n';
 			}
 
-			wait_message(0, "%s\n", chr1);
-			free(chr1);
+			wait_message (0, "%s\n", chr1);
+			free (chr1);
 		}
 
 		is_reconnect = TRUE;
@@ -251,7 +247,7 @@
 
 	ptr = tin_fgets (line, NNTP_STRLEN, (FILE*)nntp_rd_fp);
 
-	if (tin_errno != 0 || ptr == NULL)
+	if (tin_errno || ptr == NULL)
 		return(-1);
 
 	respcode = (int) strtol(ptr, &end, 10);
@@ -268,7 +264,7 @@
 		put_server (last_put);
 		ptr = tin_fgets (line, NNTP_STRLEN, nntp_rd_fp);
 
-		if (tin_errno != 0)
+		if (tin_errno)
 			return(-1);
 
 		respcode = (int) strtol(ptr, &end, 10);
@@ -290,7 +286,7 @@
 			put_server (last_put);
 			ptr = tin_fgets (line, NNTP_STRLEN, (FILE*)nntp_rd_fp);
 
-			if (tin_errno != 0)
+			if (tin_errno)
 				return(-1);
 
 		} else {
@@ -620,7 +616,7 @@
 #endif
 	}
 
-	if (tin_errno != 0) {
+	if (tin_errno) {
 		fclose(fp);
 		goto error;
 	}
@@ -637,10 +633,7 @@
 	/*
 	 * Grab the correct filesize now that it's been closed
 	 */
-	if (stat (tempfile, &sb) < 0)
-		note_size = 0;
-	else
-		note_size = sb.st_size;
+	note_size = ((stat (tempfile, &sb) < 0) ? 0 : sb.st_size);
 
 	if ((fp = fopen (tempfile, "r")) == (FILE *) 0) {	/* Reopen for just reading */
 		perror_message (txt_nntp_to_fp_cannot_reopen, tempfile);
@@ -659,10 +652,7 @@
 	unlink (tempfile);
 #endif
 
-	if (tin_errno == 0)
-		return (fp);
-	else
-		return ((FILE *) 0);
+	return ((tin_errno == 0) ? fp : (FILE *) 0);
 }
 #endif /* NNTP_ABLE */
 
@@ -704,10 +694,7 @@
 		/* Get the correct file size. This is done in get_article() for
 		 * the NNTP case. TODO - fix this
 		 */
-		if (stat (buf, &sb) == -1)
-			note_size = 0;
-		else
-			note_size = sb.st_size;
+		note_size = ((stat (buf, &sb) == -1) ? 0 : sb.st_size);
 
 		art_fp = fopen (buf, "r");
 #ifdef NNTP_ABLE
@@ -822,14 +809,14 @@
 			debug_nntp ("setup_base", buf);
 #endif
 
-			while ((ptr = tin_fgets(buf, sizeof(buf), (FILE*)nntp_rd_fp)) != NULL)  {
+			while ((ptr = tin_fgets(buf, sizeof(buf), (FILE*)nntp_rd_fp)) != NULL) {
 				if (top_base >= max_art)
 					expand_art ();
 
 				base[top_base++] = atoi (ptr);
 			}
 
-			if (tin_errno != 0)
+			if (tin_errno)
 				return(-1);
 
 		} else {
@@ -840,7 +827,7 @@
 			 * Handle the obscure case that the user aborted before the LISTGROUP
 			 * had a chance to respond
 			 */
-			if (tin_errno != 0)
+			if (tin_errno)
 				return(-1);
 
 			/*
diff -Nur tin-980117/src/os_2.c tin-980202/src/os_2.c
--- tin-980117/src/os_2.c	Fri Dec 26 03:44:48 1997
+++ tin-980202/src/os_2.c	Thu Jan  1 01:00:00 1970
@@ -1,469 +0,0 @@
-/*
- *  Project   : tin - a Usenet reader
- *  Module    : os_2.c
- *  Author    : A.Wrede & I.Lea
- *  Created   : 05-07-93
- *  Updated   : 02-11-93
- *  Notes     : Extra functions for OS/2 port
- *  Copyright : (c) Copyright 1991-94 by Andreas Wrede & Iain Lea
- *              You may  freely  copy or  redistribute  this software,
- *              so  long as there is no profit made from its use, sale
- *              trade or  reproduction.  You may not change this copy-
- *              right notice, and it must be included in any copy made
- */
-
-#include	"tin.h"
-#include	"version.h"
-
-#if defined(M_OS2)
-
-#include "os_2.h"
-
-struct passwd no_pw = {
-	"OS2User",
-	"x",
-	1,
-	1,
-	"",
-	"OS/2 User",
-	"OS/2 User",
-	"C:/",
-	"CMD"
-};
-
-char *optarg;
-FILE *_pwf;
-int fakepw = 1;
-int optind = 1;
-
-/*
- * stub for tputs
- */
-
-#ifndef INDEX_DAEMON
-
-int
-tputs (str, zzz, func)
-	register char *str;
-	int zzz;
-	OutcPtr func;
-{
-	if (! str) {
-		return 0;
-	}
-	if (func == outchar) {
-		my_fputs (str, stdout);
-	} else {
-		while (*str) {
-			if (*str == '\n') {
-				func('\r');
-			}
-			func(*str++);
-		}
-	}
-	return 0;	/* OK */
-}
-
-#endif
-
-void
-backslash (
-	char *ptr)
-{
-	while (*ptr) {
-		if (*ptr == '/') {
-			*ptr = '\\';
-		}
-		ptr++;
-	}
-}
-
-/*
- * joinpath tacks a file (or sub dir) on to the end of a directory name.
- * Have to check existing / or \ to avoid doubling them.
- */
-
-void
-joinpath (
-	char *str,
-	char *dir,
-	char *file)
-{
-	char c;
-
-	if (strlen (dir) == 0) {
-		strcpy (str, file);
-		return;
-	}
-	c = dir[strlen (dir) - 1];
-	if (c=='/' || c=='\\') {
-		sprintf (str, "%s%s", dir, file);
-	} else {
-		sprintf (str, "%s/%s", dir, file);
-	}
-}
-
-
-#ifndef __TURBOC__
-
-FILE *
-popen (
-	char *command,
-	char *mode)
-{
-	return (FILE *) 0;
-}
-
-
-void
-pclose (
-	FILE *pipe)
-{
-	return;
-}
-
-DIR *
-opendir (
-	const char *name)
-{
-	return NULL;
-}
-
-
-struct dirent *
-readdir (
-	DIR *di)
-{
-	return NULL;
-}
-
-
-int
-closedir (
-	DIR *di)
-{
-	return 0;
-}
-
-#endif	/* __TURBOC__ */
-
-char
-getopt (
-	int argc,
-	char *argv[],
-	char *options)
-{
-	char c, *z;
-	static int subind = 0;
-
-	for (;optind < argc ; optind++, subind = 0) {
-		if (subind == 0) {
-			c = argv[optind][0];
-			if (c != '-') {
-				return EOF;
-			}
-			subind = 1;
-		}
-		c = argv[optind][subind];
-		if (c != 0) {
-			break;
-		}
-	}
-
-	if (optind == argc) {
-		return EOF;
-	}
-
-	/*
-	 * get rid of funnies
-	 */
-	if (c == ':' || c == '?') {
-		return '?';
-	}
-
-	if ((z = strchr (options, c)) == 0) {
-		return '?';
-	}
-
-	if (z[1] == ':') {
-		if (argv[optind][subind+1]) {
-			optarg = &argv[optind][subind+1];
-		} else {
-			optarg = argv[++optind];
-		}
-		optind++;
-		subind = 0;
-		return c;
-	}
-	subind++;
-
-	return c;
-}
-
-
-int
-make_post_cmd (
-	char *cmd,
-	char *name)
-{
-	char *p;
-
-	if ((p = getenv (ENV_VAR_POSTER)) != (char *) 0) {
-		sprintf (cmd, p, name);
-	} else {
-		sprintf (cmd, DEFAULT_POSTER, name);
-	}
-
-	return 0;
-}
-
-
-int
-gethostname (
-	char *name,
-	int namelen)
-{
-	char *p;
-
-	if ((p = getenv ("HOSTNAME")) == (char *) 0) {
-		errno = 1;
-		return (-1);
-	}
-	strncpy (name, p, namelen);
-
-	return (0);
-}
-
-#ifdef __TURBOC__
-
-int
-sleep (
-	int sec)
-{
-	DosSleep (sec * 1000);
-	return;
-}
-
-#endif	/* __TURBOC__ */
-
-
-struct passwd *
-	fakepwent (void)
-{
-	if (! fakepw) {
-		return (struct passwd *) 0;
-	}
-	fakepw = 0;
-	if ((no_pw.pw_name = getenv ("USER")) == NULL) {
-		no_pw.pw_name = "OS2USER";
-	}
-	no_pw.pw_uid = 1;
-	no_pw.pw_gid = 1;
-	no_pw.pw_age = "";
-	if ((no_pw.pw_comment = getenv ("REALNAME")) == NULL) {
-		no_pw.pw_comment = "OS2 User";
-	}
-	no_pw.pw_gecos = no_pw.pw_comment;
-	if ((no_pw.pw_dir = getenv ("HOME")) == NULL) {
-		no_pw.pw_dir = "C:";
-	}
-	if ((no_pw.pw_shell = getenv ("SHELL")) == NULL) {
-		if ((no_pw.pw_shell = getenv ("COMSPEC")) == NULL) {
-			no_pw.pw_shell = "CMD.EXE";
-		}
-	}
-
-	return (&no_pw);
-}
-
-struct passwd *
-getpwent (void)
-{
-	char pwn[512];
-
-	if (! _pwf) {
-		if (getenv ("ETC") == NULL) {
-			return (fakepwent ());
-		}
-		sprintf (pwn, "%s/passwd", getenv ("ETC"));
-		if ((_pwf = fopen (pwn, "r")) == NULL) {
-			return(fakepwent ());
-		}
-	}
-
-	return (fgetpwent (_pwf));
-}
-
-
-struct passwd *
-getpwuid (
-	uid_t uid)
-{
-	struct passwd *pw;
-
-	endpwent ();
-	while (1) {
-		pw = getpwent ();
-		if ((!pw) || (pw->pw_uid == uid)) {
-			return (pw);
-		}
-	}
-
-	return NULL;
-}
-
-
-struct passwd *
-getpwnam (
-	const char *name)
-{
-	struct passwd *pw;
-
-	endpwent();
-
-	while (1) {
-		pw = getpwent ();
-		if ((!pw) || STRCMPEQ(pw->pw_name, name)) {
-			return (
-		}
-	}
-
-	return NULL;
-}
-
-
-void
-setpwent (void)
-{
-	if (_pwf) {
-		rewind (_pwf);
-	}
-}
-
-
-void
-endpwent (void)
-{
-	if (_pwf) {
-		fclose (_pwf);
-		_pwf = NULL;
-	}
-	fakepw = 1;
-}
-
-
-struct passwd *
-fgetpwent (
-	FILE *f)
-{
-	char *line;
-	static char pwe[512];
-	static struct passwd _pw;
-
-	if (fgets (pwe, sizeof (pwe), f) == NULL) {
-		return (fakepwent ());
-	}
-
-	line = pwe;
-	if (line[strlen (line)-1] == '\n') {
-		line[strlen (line)-1] = 0;
-	}
-	if (line[strlen (line)-1] == '\r') {
-		line[strlen (line)-1] = 0;
-	}
-	_pw.pw_name = line;
-	while ((*line) && (*line != ':')) {
-		line++;
-	}
-	if (! *line) {
-		return (struct passwd *) 0;
-	}
-	*line = 0;
-	_pw.pw_passwd = ++line;
-	while ((*line) && (*line != ':')) {
-		line++;
-	}
-	if (! *line) {
-		return (struct passwd *) 0;
-	}
-	*line = 0;
-	_pw.pw_uid = atoi (++line);
-	while ((*line) && (*line != ':')) {
-		line++;
-	}
-	if (! *line) {
-		return (struct passwd *) 0;
-	}
-	*line = 0;
-	_pw.pw_gid = atoi (++line);
-	while ((*line) && (*line != ':')) {
-		line++;
-	}
-	if (! *line) {
-		return (struct passwd *) 0;
-	}
-	*line = 0;
-	_pw.pw_age = "";
-	_pw.pw_comment = ++line;
-	_pw.pw_gecos = line;
-	while ((*line) && (*line != ':')) {
-		line++;
-	}
-	if (! *line) {
-		return (struct passwd *) 0;
-	}
-	*line = 0;
-	_pw.pw_dir = ++line;
-	if ((_pw.pw_dir[1] == ':') &&
-	    (tolower ((unsigned char)_pw.pw_dir[0]) >= 'c') &&
-	    (tolower ((unsigned char)_pw.pw_dir[0]) <= 'z')) {
-		line += 2;
-	}
-	while ((*line) && (*line != ':')) {
-		line++;
-	}
-	if (! *line) {
-		return (struct passwd *) 0;
-	}
-	*line = 0;
-	_pw.pw_shell = ++line;
-
-	return (&_pw);
-}
-
-
-int
-putpwent (
-	const struct passwd *pwd,
-	FILE *f)
-{
-	return(-1);
-}
-
-
-char *
-getlogin (void)
-{
-	char *p;
-
-	if ((p = getenv ("USER")) == NULL) {
-		return (char *) 0;
-	}
-
-	return (p);
-}
-
-
-int
-getuid (void)
-{
-	char *p;
-
-	if ((p = getenv ("UID")) == NULL) {
-		return (0);	/* pretend we are root */
-	}
-
-	return atoi (p);
-}
-
-#endif	/* M_OS2 */
diff -Nur tin-980117/src/page.c tin-980202/src/page.c
--- tin-980117/src/page.c	Sun Jan 11 19:08:20 1998
+++ tin-980202/src/page.c	Sun Feb  1 17:13:01 1998
@@ -44,7 +44,7 @@
 t_bool show_all_headers = FALSE;	/* CTRL-H with headers specified */
 t_bool show_prev_header = FALSE;	/* remember display status of last line */
 
-static int tex2iso_article;
+static t_bool tex2iso_article;
 
 /*
  * Local prototypes
@@ -78,7 +78,7 @@
 	int ret_code;
 	long old_artnum;
 	long art;
-	struct stat note_stat_blubb;
+	struct stat note_stat_article;
 
 	local_filtered_articles = FALSE;	/* used in thread level */
 
@@ -117,16 +117,15 @@
 	art_mark_read (group, &arts[respnum]);
 
 	/* Get article size */
-	fstat(fileno(note_fp), &note_stat_blubb);
-	note_size = note_stat_blubb.st_size;
+	fstat(fileno(note_fp), &note_stat_article);
+	note_size = note_stat_article.st_size;
 	show_note_page (group->name, respnum);
 
 	forever {
 		ch = ReadCh ();
 
 		if (ch >= '0' && ch <= '9') {
-			n = which_thread (respnum);
-			if (!num_of_responses (n))
+			if (!num_of_responses (which_thread (respnum)))
 				info_message (txt_no_responses);
 			else {
 				n = prompt_response (ch, respnum);
@@ -385,7 +384,7 @@
 
 			case iKeyPageToggleHeaders:	/* toggle display of article headers */
 				if (note_page == ART_UNAVAILABLE) {
-					if ((n  = next_response (respnum)) == -1)
+					if ((n = next_response (respnum)) == -1)
 						return (which_thread (respnum));
 					respnum = n;
 					goto restart;
@@ -408,10 +407,7 @@
 
 			/* haeh? */
 			case iKeyPageToggleTabs:	/* toggle tab stops 8 vs 4 */
-				if (tabwidth == 8)
-					tabwidth = 4;
-				else
-					tabwidth = 8;
+				tabwidth = ((tabwidth == 8) ? 4 : 8);
 				redraw_page (group->name, respnum);
 				break;
 
@@ -716,7 +712,8 @@
 					redraw_page (group->name, respnum);
 				break;
 
-			case iKeyPostponed:	/* post postponed article */
+			case iKeyPostponed:
+			case iKeyPostponed2:	/* post postponed article */
 				if (can_post) {
 					if (pickup_postponed_articles (FALSE, FALSE))
 						redraw_page (group->name, respnum);
@@ -839,18 +836,15 @@
 	static char buf[HEADER_LEN];
 	t_bool below_sig;				/* are we in the signature? */
 	t_bool ctrl_L = FALSE;		/* form feed character detected */
-	t_bool first  = TRUE;
+	t_bool first = TRUE;
 
-	if (beginner_level)
-		lines = cLINES - (MINI_HELP_LINES - 1);
-	else
-		lines = cLINES;
+	lines = (beginner_level ? (cLINES - (MINI_HELP_LINES - 1)) : cLINES);
 
 	ClearScreen ();
 
 	note_line = 1;
 
-	if (note_page == 0) {
+	if (!note_page) {
 		buf2[0] = '\0';
 		doing_pgdn = FALSE;
 		show_first_header (respnum, group);
@@ -858,7 +852,7 @@
 		show_cont_header (respnum);
 
 #ifdef HAVE_METAMAIL
-	if (note_page == 0 && *note_h.mimeversion && *note_h.contenttype
+	if (!note_page && *note_h.mimeversion && *note_h.contenttype
 		 && (!STRNCMPEQ("text/plain", note_h.contenttype, 10))
 		 && use_metamail) {
 		if (!ask_for_metamail || prompt_yn (cLINES, txt_use_mime, TRUE) == 1) {
@@ -948,15 +942,15 @@
 		 */
 
 		if (in_headers
-			 && ( (!display_mime_header_asis && !show_all_headers)
-					|| (!display_mime_allheader_asis && show_all_headers) ) )  {
+			 && ((!display_mime_header_asis && !show_all_headers)
+					|| (!display_mime_allheader_asis && show_all_headers)))  {
 			/* check if it's a continuation header line */
-			if ( buf2[0] != ' ' && buf2[0] != '\t' ) {
+			if (buf2[0] != ' ' && buf2[0] != '\t') {
 				char header_name[80];
 				size_t header_name_len;
 				/* necessary, if there were only blanks in the header line, which
 					are stripped by strip_line (buf2) above */
-				if ( strstr(buf2, ": ") ) {
+				if (strstr (buf2, ": ")) {
 					header_name_len = strstr(buf2,": ")-buf2;
 					strncpy(header_name,buf2,header_name_len);
 					header_name[header_name_len]='\0';
@@ -1028,10 +1022,7 @@
 		MoveCursor (cLINES, MORE_POS-(5+BLANK_PAGE_COLS));
 		StartInverse ();
 
-		if (arts[respnum].thread != -1)
-			my_fputs (txt_next_resp, stdout);
-		else
-			my_fputs (txt_last_resp, stdout);
+		my_fputs (((arts[respnum].thread != -1) ? txt_next_resp : txt_last_resp), stdout);
 
 		my_flush ();
 		EndInverse ();
@@ -1058,34 +1049,41 @@
 #if defined(HAVE_METAMAIL) && !defined(INDEX_DAEMON)
 static void
 show_mime_article (
-	FILE	*fp,
-	struct	t_article *art)
+	FILE *fp,
+	struct t_article *art)
 {
-	char	buf[PATH_LEN];
-	FILE	*mime_fp;
-	long	offset;
+	FILE *mime_fp;
+	char *mm;
+	char buf[PATH_LEN];
+	long offset;
 
-	Raw(FALSE);
+	EndWin();
 	offset = ftell (fp);
 	rewind (fp);
-	sprintf (buf, METAMAIL_CMD, PATH_METAMAIL);
-	mime_fp = popen (buf, "w");
+	if ((mm=getenv("METAMAIL")))
+		sprintf (buf, mm);
+	else
+		sprintf (buf, METAMAIL_CMD, PATH_METAMAIL);
+
+	if ((mime_fp = popen (buf, "w"))) {
+		while (fgets (buf, sizeof (buf), fp) != 0)
+			fputs (buf, mime_fp);
 
-	while (fgets (buf, sizeof (buf), fp) != 0)
-		my_fputs (buf, mime_fp);
+		fflush (mime_fp);
+		pclose (mime_fp);
+	} else
+		info_message (txt_error_metamail_failed, strerror(errno));
 
-	fflush (mime_fp);
-	pclose (mime_fp);
 	note_end = TRUE;
 	Raw(TRUE);
+	InitWin ();
+	continue_prompt ();
+
 	fseek (fp, offset, SEEK_SET);	/* goto old position */
 	MoveCursor (cLINES, MORE_POS-(5+BLANK_PAGE_COLS));
 	StartInverse ();
 
-	if (art->thread != -1)
-		my_fputs (txt_next_resp, stdout);
-	else
-		my_fputs (txt_last_resp, stdout);
+	my_fputs (((art->thread != -1) ? txt_next_resp : txt_last_resp), stdout);
 
 	my_flush ();
 	EndInverse ();
@@ -1200,19 +1198,13 @@
 		my_fputs (buf, stdout);
 	}
 
-	if (note_h.subj[0])
-		strcpy (buf, note_h.subj);
-	else
-		strcpy (buf, arts[respnum].subject);
+	strcpy (buf, (*note_h.subj ? note_h.subj: arts[respnum].subject));
 
 	buf[RIGHT_POS - 5 - n] = '\0';
 
 	pos = ((cCOLS - (int) strlen (buf)) / 2) - 2;
 
-	if (pos > n)
-		MoveCursor (1, pos);
-	else
-		MoveCursor (1, n);
+	MoveCursor (1, ((pos > n) ? pos : n));
 
 	Convert2Printable (buf);
 
@@ -1229,7 +1221,7 @@
 	if (whichresp)
 		my_printf (txt_resp_x_of_n, whichresp, x_resp);
 	else {
-		if (x_resp == 0)
+		if (!x_resp)
 			my_fputs (txt_no_resp, stdout);
 		else if (x_resp == 1)
 			my_fputs (txt_1_resp, stdout);
@@ -1345,30 +1337,18 @@
 	struct t_article *art,
 	char *group_path)
 {
-	char buf[8192];
 	char *ptr;
-	int c;
-	int is_summary;
+	char buf[8192];
+	int c, is_summary;
 
 	art_close ();	/* just in case */
 
-	if (tex2iso_supported) {
-		tex2iso_article = iIsArtTexEncoded (art->artnum, group_path);
-
-		if (tex2iso_article)
-			wait_message (0, txt_is_tex_ecoded);
-
-	} else
-		tex2iso_article = FALSE;
+	if ((tex2iso_article = (tex2iso_supported ? iIsArtTexEncoded (art->artnum, group_path) : FALSE)))
+		wait_message (0, txt_is_tex_ecoded);
 
-	if ((note_fp = open_art_fp (group_path, art->artnum, art->lines))
-		 == (FILE *) 0) {
+	if ((note_fp = open_art_fp (group_path, art->artnum, art->lines)) == (FILE *) 0) {
 		note_page = ART_UNAVAILABLE;		/* Flag error for later */
-
-		if (tin_errno == 0)
-			return (ART_UNAVAILABLE);
-		else
-			return (ART_ABORT);
+		return ((tin_errno == 0) ? ART_UNAVAILABLE : ART_ABORT);
 	}
 
 	note_h.from[0] = '\0';
@@ -1462,7 +1442,7 @@
 	/*
 	 * If Newsgroups is empty its a good bet the article is a mail article
 	 */
-	if (!note_h.newsgroups[0]) {
+	if (!*note_h.newsgroups) {
 		strcpy (note_h.newsgroups, group_path);
 		while ((ptr = strchr (note_h.newsgroups, '/')))
 			*ptr = '.';
@@ -1560,12 +1540,7 @@
 	}
 
 	while (!note_end) {
-		note_line = 1;
-
-		if (note_page == 0)
-			note_line += 4;
-		else
-			note_line += 2;
+		note_line = (!note_page ? 5 : 3);
 
 		while (note_line < cLINES) {
 			if (fgets (buf, sizeof buf, note_fp) == 0) {
diff -Nur tin-980117/src/pgp.c tin-980202/src/pgp.c
--- tin-980117/src/pgp.c	Sat Jan 10 02:00:29 1998
+++ tin-980202/src/pgp.c	Thu Jan 22 17:44:18 1998
@@ -334,7 +334,6 @@
 		info_message(txt_pgp_nothing);
 		return (0);
 	}
-	set_alarm_clock_off();
 	ClearScreen();
 	if (pgp_signed) {
 		Raw(FALSE);
@@ -372,7 +371,6 @@
 
 	continue_prompt ();
 	unlink(the_article);
-	set_alarm_clock_on ();
 	return (1);
 }
 #endif /* HAVE_PGP */
diff -Nur tin-980117/src/post.c tin-980202/src/post.c
--- tin-980117/src/post.c	Sun Jan 11 19:09:18 1998
+++ tin-980202/src/post.c	Sun Feb  1 05:38:39 1998
@@ -656,7 +656,7 @@
 		my_fflush (stderr);
 		errors++;
 	}
-	if (ngcnt && errors == 0) {
+	if (ngcnt && !errors) {
 		/*
 		 * Print a note about each newsgroup
 		 */
@@ -777,7 +777,7 @@
 	if (strlen (group))
 		my_strncpy (default_post_newsgroups, group, sizeof (default_post_newsgroups));
 	else {
-		if (default_post_newsgroups[0])
+		if (*default_post_newsgroups)
 			my_strncpy (group, default_post_newsgroups, sizeof (group));
 		else {
 			my_fprintf (stderr, "%s\n", txt_no_quick_newsgroups);
@@ -847,7 +847,7 @@
 	if (strlen (subj))
 		my_strncpy (default_post_subject, subj, sizeof (default_post_subject));
 	else {
-		if (default_post_subject[0])
+		if (*default_post_subject)
 			my_strncpy (subj, default_post_subject, sizeof (subj));
 		else {
 			Raw (FALSE);
@@ -1002,10 +1002,10 @@
 	if (keep_posted_articles)
 		update_posted_msgs_file (article, userid);
 
-	if (group[0] != '\0')
+	if (!*group)
 		my_strncpy (default_post_newsgroups, group, sizeof (default_post_newsgroups));
 
-	if (subj[0] != '\0')
+	if (!*subj)
 		my_strncpy (default_post_subject, subj, sizeof (default_post_subject));
 
 	write_config_file (local_config_file);
@@ -1039,10 +1039,7 @@
 		return;
 	}
 
-	if (ask)
-		ch = iKeyPostEdit;
-	else
-		ch = iKeyPostPost;
+	ch = (ask ? iKeyPostEdit : iKeyPostPost);
 	forever {
 post_existing_article_loop:
 		switch (ch) {
@@ -1142,10 +1139,10 @@
 	if (keep_posted_articles)
 		update_posted_msgs_file (article, userid);
 
-	if (group[0] != '\0')
+	if (!*group)
 		my_strncpy (default_post_newsgroups, group, sizeof (default_post_newsgroups));
 
-	if (subj[0] != '\0')
+	if (!*subj)
 		my_strncpy (default_post_subject, subj, sizeof (default_post_subject));
 
 	write_config_file (local_config_file);
@@ -1286,7 +1283,7 @@
 
 	unlink(postponed_articles_file);
 
-	if(anything_left)
+	if (anything_left)
 		rename(postponed_tmp, postponed_articles_file);
 	else
 		unlink(postponed_tmp);
@@ -1432,7 +1429,7 @@
 	if (strlen (subj))
 		my_strncpy (default_post_subject, subj, sizeof (default_post_subject));
 	else {
-		if (default_post_subject[0])
+		if (*default_post_subject)
 			my_strncpy (subj, default_post_subject, sizeof (subj));
 		else {
 			info_message (txt_no_subject);
@@ -1867,7 +1864,6 @@
 				my_fputc (*ptr, stdout);
 			else
 				my_fputs (cCRLF "    ", stdout);
-
 			ptr++;
 		}
 		my_flush ();
@@ -1923,7 +1919,7 @@
 	/*
 	 * Append to References: line if its already there
 	 */
-	if (note_h.references[0]) {
+	if (*note_h.references) {
 		join_references (bigbuf, note_h.references, note_h.messageid);
 		msg_add_header ("References", bigbuf);
 	} else
@@ -1971,10 +1967,8 @@
 			}
 		}
 
-		if (with_headers)
-			fseek (note_fp, 0L, SEEK_SET);
-		else
-			fseek (note_fp, mark_body, SEEK_SET);
+		fseek (note_fp, (with_headers ? 0L : mark_body), SEEK_SET);
+
 		get_initials (respnum, initials, sizeof (initials));
 		copy_body (note_fp, fp,
 			   (psGrp && psGrp->attribute->quote_chars != (char *) 0) ? psGrp->attribute->quote_chars : quote_chars,
@@ -2509,7 +2503,7 @@
 		/*
 		 * Write References and Message-Id as In-Reply-To to the mail
 		 */
-		if (note_h.references[0]) {
+		if (*note_h.references) {
 			join_references (bigbuf, note_h.references, note_h.messageid);
 			msg_add_header ("In-Reply-To", bigbuf);
 		} else
@@ -2540,10 +2534,9 @@
 				}
 			}
 		}
-		if (with_headers)
-			fseek (note_fp, 0L, SEEK_SET);
-		else
-			fseek (note_fp, mark_body, SEEK_SET);
+
+		fseek (note_fp, (with_headers ? 0L : mark_body), SEEK_SET);
+
 		get_initials (respnum, initials, sizeof (initials));
 		copy_body (note_fp, fp, quote_chars, initials, with_headers ? TRUE : quote_signatures);
 	} else
@@ -2749,11 +2742,7 @@
 	fclose (fp);
 
 	if (found) {
-		if (header[0] == ' ')
-			p = &header[1];
-		else
-			p = header;
-
+		p = ((header[0] == ' ') ? &header[1] : header);
 		(void) strcpy (result, rfc1522_decode (p));
 		return TRUE;
 	}
@@ -2982,11 +2971,11 @@
 #define FromSameUser ((strstr (from_name, arts[respnum].from)) != 0)
 
 #ifndef FORGERY
-#	define NotSuperseding (!supersede || (supersede && (!FromSameUser)))
-#	define Superseding    (supersede && FromSameUser)
+#	define NotSuperseding	(!supersede || (supersede && (!FromSameUser)))
+#	define Superseding	(supersede && FromSameUser)
 #else
-#	define NotSuperseding (!supersede)
-#	define Superseding    (supersede)
+#	define NotSuperseding	(!supersede)
+#	define Superseding	(supersede)
 #endif
 
 int
@@ -3089,7 +3078,7 @@
 			msg_add_header ("Reply-To", line);
 			msg_add_header ("X-Superseded-By", from_name);
 
-			if (note_h.org[0])
+			if (*note_h.org)
 				msg_add_header ("Organization", note_h.org);
 
 			sprintf (line, "<supersede.%s", note_h.messageid + 1);
@@ -3097,13 +3086,13 @@
 #endif
 			msg_add_header ("Supersedes", note_h.messageid);
 
-			if (note_h.followup[0])
+			if (*note_h.followup)
 				msg_add_header ("Followup-To", note_h.followup);
 
-			if (note_h.keywords[0])
+			if (*note_h.keywords)
 				msg_add_header ("Keywords", note_h.keywords);
 
-			if (note_h.summary[0])
+			if (*note_h.summary)
 				msg_add_header ("Summary", note_h.summary);
 
 			if (*note_h.distrib)
@@ -3119,7 +3108,7 @@
 	msg_add_header ("Subject", note_h.subj);
 	msg_add_header ("Newsgroups", group);
 
-	if (note_h.references[0]) {
+	if (*note_h.references) {
 		/*
 		 * calling join_references prevents repost_article
 		 * to fail if References: contains a double space
@@ -3175,10 +3164,7 @@
 	}
 	forever {
 repost_article_loop:
-		if (!force_command)
-			ch = prompt_slk_response (ch_default, POST_KEYS, sized_message(txt_quit_edit_xpost, note_h.subj));
-		else
-			ch = ch_default;
+			ch = (force_command ? ch_default : prompt_slk_response (ch_default, POST_KEYS, sized_message(txt_quit_edit_xpost, note_h.subj)));
 
 		switch (ch) {
 			case iKeyPostEdit:
@@ -3219,11 +3205,7 @@
 
 			case iKeyPostPost:
 			case iKeyPostPost2:
-				if (Superseding)
-					wait_message (0, txt_superseding_art);
-				else
-					wait_message (0, txt_repost_an_article);
-
+				wait_message (0, (Superseding ? txt_superseding_art : txt_repost_an_article));
 				backup_article(article);
 
 				if (submit_news_file (article)) {
@@ -3531,7 +3513,7 @@
 				*ptr = '\0';
 			}
 			parse_from (from_both, from_addr, from_name);
-			if (from_name[0])
+			if (*from_name)
 				sprintf (buf, "%s (%s)", from_addr, from_name);
 			found = TRUE;
 		}
@@ -3579,15 +3561,8 @@
 
 	/* We do this to save a redundant strcpy when we don't want to parse */
 
-	if (parse)
-		dest = temp;
-	else
-		dest = from_addr;
-
-	if (found_replyto)
-		strcpy (dest, rfc1522_decode(replyto));
-	else
-		strcpy (dest, rfc1522_decode(from));
+	dest = (parse ? temp : from_addr);
+	strcpy (dest, rfc1522_decode((found_replyto ? replyto : from)));
 
 	if (parse)
 		parse_from (temp, from_addr, fullname);
@@ -3717,6 +3692,14 @@
 			strfmailer (mailer, subject, mail_to, file,
 				  buf, sizeof (buf), default_mailer_format);
 
+#ifdef VMS  /* quick hack! M.St. 29.01.98 */
+			{
+				char *transport = getenv("MAIL$INTERNET_TRANSPORT");
+				if (!transport)
+					transport = "smtp";
+				sprintf (buf,"mail/subject=\"%s\" %s %s%%\"%s\"", subject,file,transport,mail_to);
+			}
+#endif /* VMS */
 			if (invoke_cmd (buf))
 				mailed = TRUE;
 			else
diff -Nur tin-980117/src/prompt.c tin-980202/src/prompt.c
--- tin-980117/src/prompt.c	Wed Dec 31 04:12:27 1997
+++ tin-980202/src/prompt.c	Wed Jan 28 07:19:33 1998
@@ -31,8 +31,6 @@
 	char *p;
 	int num;
 
-	set_alarm_clock_off ();
-
 	clear_message ();
 
 	sprintf (msg, "%c", ch);
@@ -45,8 +43,6 @@
 
 	clear_message ();
 
-	set_alarm_clock_on ();
-
 	return (num);
 }
 
@@ -64,20 +60,16 @@
 {
 	char *p;
 
-	set_alarm_clock_off ();
-
 	clear_message ();
 
 	if ((p = getline (prompt, FALSE, (char *) 0, 0, which_hist)) == (char *) 0) {
 		buf[0] = '\0';
 		clear_message ();
-		set_alarm_clock_on ();
 		return FALSE;
 	}
 	strcpy (buf, p);
 
 	clear_message ();
-	set_alarm_clock_on ();
 
 	return TRUE;
 }
@@ -96,8 +88,6 @@
 {
 	char *p;
 
-	set_alarm_clock_off ();
-
 	/*
 	 * clear buffer - this is needed, otherwise a lost
 	 * connection right before a resync_active() call
@@ -107,13 +97,10 @@
 
 	MoveCursor (line, col);
 
-	if ((p = getline ("", FALSE, var, 0, HIST_OTHER)) == (char *) 0) {
-		set_alarm_clock_on ();
+	if ((p = getline ("", FALSE, var, 0, HIST_OTHER)) == (char *) 0)
 		return FALSE;
-	}
-	strcpy (var, p);
 
-	set_alarm_clock_on ();
+	strcpy (var, p);
 
 	return TRUE;
 }
@@ -135,7 +122,6 @@
 	int ch, prompt_ch;
 	int yn_loop = TRUE;
 
-	set_alarm_clock_off ();
 /*	fflush(stdin);*/		/* Prevent finger trouble from making important decisions */
 
 	while (yn_loop) {
@@ -189,16 +175,11 @@
 		clear_message ();
 	else {
 		MoveCursor (line, (int) strlen (prompt));
-		if (ch == ESC)
-			my_fputc (prompt_ch, stdout);
-		else
-			my_fputc (ch, stdout);
+		my_fputc (((ch == ESC) ? prompt_ch : ch), stdout);
 	}
 	cursoroff ();
 	my_flush ();
 
-	set_alarm_clock_on ();
-
 	return (tolower ((unsigned char)ch) == tolower ((unsigned char)iKeyPromptYes)) ? 1 : (ch == ESC) ? -1 : 0;
 }
 
@@ -226,11 +207,8 @@
 	int adjust = (strcasecmp(list[0], txt_default) == 0);
 	size_t width = 0;
 
-	set_alarm_clock_off ();
-
-	var  += adjust;
+	var += adjust;
 	size += adjust;
-
 	var_orig = var;
 
 	/*
@@ -265,8 +243,6 @@
 
 	cursoroff ();
 
-	set_alarm_clock_on ();
-
 	return(var - adjust);
 }
 
@@ -306,19 +282,14 @@
 	char *p;
 	char *variable = OPT_STRING_list[option_table[option].var_index];
 
-	set_alarm_clock_off ();
-
 	show_menu_help (option_table[option].help_text);
 	MoveCursor (option_row(option), 0);
 	sprintf (&prompt[0], "-> %3d. %s ", option+1, option_table[option].option_text);
 
-	if ((p = getline (prompt, FALSE, variable, 0, HIST_OTHER)) == (char *) 0) {
-		set_alarm_clock_on ();
+	if ((p = getline (prompt, FALSE, variable, 0, HIST_OTHER)) == (char *) 0)
 		return FALSE;
-	}
-	strcpy (variable, p);
 
-	set_alarm_clock_on ();
+	strcpy (variable, p);
 
 	return TRUE;
 }
@@ -343,8 +314,6 @@
 	char *p;
 	int num;
 
-	set_alarm_clock_off ();
-
 	show_menu_help (option_table[option].help_text);
 	MoveCursor (option_row(option), 0);
 	sprintf (&prompt[0], "-> %3d. %s ", option, option_table[option].option_text);
@@ -358,7 +327,6 @@
 	*(option_table[option].variable) = num;
 
 	clear_message ();
-	set_alarm_clock_on ();
 
 	return TRUE;
 }
@@ -385,21 +353,16 @@
 	input[0] = *variable;
 	input[1] = '\0';
 
-	set_alarm_clock_off ();
-
 	show_menu_help (option_table[option].help_text);
 	MoveCursor (option_row(option), 0);
 	sprintf (&prompt[0], "-> %3d. %s ", option, option_table[option].option_text);
 
-	if ((p = getline (prompt, FALSE, p, 1, HIST_OTHER)) == (char *) 0) {
-		set_alarm_clock_on ();
+	if ((p = getline (prompt, FALSE, p, 1, HIST_OTHER)) == (char *) 0)
 		return FALSE;
-	}
 
 	*variable = p[0];
 
 	clear_message ();
-	set_alarm_clock_on ();
 
 	return TRUE;
 }
@@ -469,9 +432,7 @@
 {
 	int ch;
 
-	set_alarm_clock_off ();
-
-#if USE_CURSES
+#ifdef USE_CURSES
 	cmd_line = TRUE;
 #endif
 	info_message (txt_return_key);
@@ -490,10 +451,9 @@
 	}
 #endif /* !WIN32 */
 
-#if USE_CURSES
+#ifdef USE_CURSES
 	cmd_line = FALSE;
 	my_retouch();
-#endif
+#endif /* USE_CURSES */
 
-	set_alarm_clock_on ();
 }
diff -Nur tin-980117/src/read.c tin-980202/src/read.c
--- tin-980117/src/read.c	Mon Jan  5 17:52:42 1998
+++ tin-980202/src/read.c	Sun Feb  1 04:50:04 1998
@@ -42,6 +42,18 @@
 wait_for_input (
 	FILE *fd)
 {
+#ifdef VMS
+	int ch = ReadChNowait ();
+
+	if (ch == 'q' || ch == ESC) {
+		if (prompt_yn (cLINES, "Do you want to abort this operation? (y/n): ", FALSE) == 1)
+			return (TRUE);
+	}
+	if (ch == 'Q') {
+		if (prompt_yn (cLINES, "Do you want to exit tin immediately ? (y/n): ", FALSE) == 1)
+			tin_done (EXIT_ERROR);
+	}
+#else
 	int nfds, ch;
 	fd_set readfds;
 	struct timeval tv;
@@ -111,6 +123,7 @@
 		}
 
 	}
+#endif
 	/* NOTREACHED */
 	return(FALSE);
 }
@@ -182,10 +195,8 @@
 	if (STRCMPEQ(buffer, "."))		/* end of text */
 		return(NULL);
 
-	if (buffer[0] == '.')			/* reduce leading .'s */
-		return (buffer+1);
-	else
-		return(buffer);
+	/* reduce leading .'s */
+	return ((buffer[0] == '.') ? (buffer+1) : buffer);
 }
 
 /*
@@ -347,10 +358,7 @@
 
 	*(++s1) = '\0';
 
-	if (s1 == s)
-		return NULL;
-	else
-		return s;
+	return ((s1 == s) ? NULL : s);
 }
 
 /* end of read.c */
diff -Nur tin-980117/src/refs.c tin-980202/src/refs.c
--- tin-980117/src/refs.c	Mon Jan  5 23:17:43 1998
+++ tin-980202/src/refs.c	Wed Jan 28 07:20:33 1998
@@ -371,7 +371,7 @@
 			error_message("Warning: Too many refs near to %s. Truncated\n", refptr->txt);
 #endif
 		refs = (char *) my_malloc(HEADER_LEN);
-		len  = 0;
+		len = 0;
 	} else
 		refs = _get_references(refptr->parent, depth+1);
 
@@ -452,9 +452,8 @@
 
 			my_fprintf(stderr, "node %d", i);
 
-			for (ptr = msgids[i]; ptr != NULL; ptr = ptr->next) {
+			for (ptr = msgids[i]; ptr != NULL; ptr = ptr->next)
 				my_fprintf(stderr, " -> %s", ptr->txt);
-			}
 
 			my_fprintf(stderr, "\n");
 
@@ -749,9 +748,9 @@
 
 	for (i=0 ; i < top ; i++) {
 		fprintf(dbgfd, "%3d %3d %3d %3d : %3d %3d : %.50s %s\n", i,
-			(arts[i].refptr->parent)  ? arts[i].refptr->parent->article : -2,
+			(arts[i].refptr->parent) ? arts[i].refptr->parent->article : -2,
 			(arts[i].refptr->sibling) ? arts[i].refptr->sibling->article : -2,
-			(arts[i].refptr->child)   ? arts[i].refptr->child->article : -2,
+			(arts[i].refptr->child) ? arts[i].refptr->child->article : -2,
 			arts[i].inthread, arts[i].thread, arts[i].refptr->txt, arts[i].subject);
 	}
 
diff -Nur tin-980117/src/rfc1521.c tin-980202/src/rfc1521.c
--- tin-980117/src/rfc1521.c	Sun Jan  4 22:32:15 1998
+++ tin-980202/src/rfc1521.c	Tue Jan 27 20:51:23 1998
@@ -55,16 +55,14 @@
 		return 0;
 
 	if (line[strlen(boundary) + 2] != '-') {
-		if (nl ? line[strlen(boundary) + 2] == '\n'
-			 : line[strlen(boundary) + 2] == '\0')
+		if (nl ? line[strlen(boundary) + 2] == '\n' : line[strlen(boundary) + 2] == '\0')
 			return 1;
 		else
 			return 0;
 	}
 	if (line[strlen(boundary) + 3] != '-')
 		return 0;
-	if (nl ? line[strlen(boundary) + 4] == '\n'
-		 : line[strlen(boundary) + 4] == '\0')
+	if (nl ? line[strlen(boundary) + 4] == '\n' : line[strlen(boundary) + 4] == '\0')
 		return 2;
 	else
 		return 0;
@@ -423,7 +421,7 @@
 }
 
 /*
- * KS C 5601 -> ISO 2022-KR encoding for Korean mail exchange
+ * EUC-KR -> ISO 2022-KR conversion for Korean mail exchange
  * NOT to be used for News posting, which is made certain
  * by setting post_mime_encoding to 8bit
  */
diff -Nur tin-980117/src/rfc1522.c tin-980202/src/rfc1522.c
--- tin-980117/src/rfc1522.c	Fri Dec 26 03:44:58 1997
+++ tin-980202/src/rfc1522.c	Wed Jan 28 07:22:35 1998
@@ -174,7 +174,7 @@
 {
 	char *c;
 
-	if (!mm_charset[0]) {
+	if (!*mm_charset) {
 		c = getenv("MM_CHARSET");
 		if (!c)
 			strcpy(mm_charset, MM_CHARSET);
@@ -298,12 +298,12 @@
 	t_bool isstruct_head)
 {
 
-	char tmp[60];					  /* strings to be B encoded */
-	int len8 = 0;					  /* the number of  trailing 8bit chars, which
-										     should be even(i.e. the first and second byte
-										     of wide_char should NOT be split into two
-										     encoded words) in order  to be compatible with
-										     some CJK mail client */
+	char tmp[60];				/* strings to be B encoded */
+	int len8 = 0;				/* the number of trailing 8bit chars, which
+									   should be even(i.e. the first and second byte
+									   of wide_char should NOT be split into two
+									   encoded words) in order  to be compatible with
+									   some CJK mail client */
 	char *t = tmp;
 
 	int count = max_ewsize / 4 * 3;
@@ -817,21 +817,21 @@
 	if (!strcasecmp(mime_encoding, txt_7bit)) {
 		encoding = '7';
 
-/* For EUC-KR, 7bit means ISO-2022-KR encoding specified in RFC 1557 */
+/* For EUC-KR, 7bit means conversion to ISO-2022-KR  specified in RFC 1557 */
 
 		if (!strcasecmp(mm_charset, "euc-kr"))
 			body_encode = rfc1557_encode;
 
 /*
  * Not only EUC-JP but also other Japanese charsets such as
- * SJIS and JIS might need RFC 1468 encoding. To be confirmed.
+ * SJIS  might need RFC 1468 encoding. To be confirmed.
  */
 		else if (!strcasecmp(mm_charset, "euc-jp"))
 			body_encode = rfc1468_encode;
 
 /*
  * Not only  EUC-CN but also other Chinese charsets such as
- * BIG5 and Traditional might need RFC 1922 encoding. To be confirmed.
+ * BIG5 and EUC-TW might need RFC 1922 encoding. To be confirmed.
  */
 		else if (!strcasecmp(mm_charset, "euc-cn"))
 			body_encode = rfc1922_encode;
diff -Nur tin-980117/src/save.c tin-980202/src/save.c
--- tin-980117/src/save.c	Sun Jan 11 19:45:08 1998
+++ tin-980202/src/save.c	Sun Feb  1 17:17:46 1998
@@ -363,10 +363,7 @@
 	save[i].saved = TRUE;
 
 	if (filename == 0) {
-		if (is_mailbox)
-			sprintf (save_art_info, txt_saved_to_mailbox, get_first_savefile ());
-		else
-			sprintf (save_art_info, txt_art_saved_to, get_first_savefile ());
+		sprintf (save_art_info, (is_mailbox ? txt_saved_to_mailbox : txt_art_saved_to), get_first_savefile ());
 		info_message (save_art_info);
 	}
 
@@ -472,16 +469,13 @@
 		}
 	}
 
-	if (!num_save)
-		info_message (txt_no_match);
-	else {
+	if (num_save) {
 		if (is_mailbox)
 			sprintf (buf, txt_saved_to_mailbox, get_first_savefile ());
 		else
 			sprintf (buf, txt_saved_pattern_to, get_first_savefile (), get_last_savefile ());
-		info_message (buf);
 	}
-
+	info_message (num_save ? buf : txt_no_match);
 	return ret_code;
 }
 #endif /* !INDEX_DAEMON */
@@ -653,13 +647,7 @@
 	}
 
 	if (is_mailbox) {
-		if ((int) strlen (path) > 1) {
-			if (path[0] == '=')
-				my_strncpy (file, path+1, sizeof (file));
-			else
-				my_strncpy (file, path, sizeof (file));
-		} else
-			my_strncpy (file, glob_group, sizeof (file));
+		my_strncpy (file, ((strlen (path) > 1) ? ((path[0] == '=') ? (path+1) : path) : glob_group), sizeof (file));
 
 		i = my_group[cur_groupnum];
 		if (!strfpath (active[i].attribute->maildir, tmp, sizeof (tmp),
@@ -673,7 +661,7 @@
 		save[num_save].dir = my_strdup (tmp);
 		save[num_save].file = my_strdup (file);
 	} else {
-		if (path[0]) {
+		if (*path) {
 #ifdef VMS
 #include "parse.h"
 			struct filespec *spec;
@@ -728,7 +716,7 @@
 			dir[0] = 0;
 #endif
 
-		if (dir[0])
+		if (*dir)
 			save[num_save].dir = my_strdup (dir);
 		else {
 			i = my_group[cur_groupnum];
@@ -743,14 +731,7 @@
 			save[num_save].dir = my_strdup (tmp);
 		}
 
-		if (file[0])
-			save[num_save].file = my_strdup (file);
-		else {
-			if (path[0])
-				save[num_save].file = my_strdup (path);
-			else
-				save[num_save].file = my_strdup (save[num_save].archive);
-		}
+		save[num_save].file = my_strdup (*file ? file : (*path ? path : save[num_save].archive));
 	}
 	num_save++;
 
@@ -1174,11 +1155,12 @@
 	char	*file_out_dir,
 	char	*file_out)
 {
-	char	buf[LEN];
-	char	*file, *ptr;
-	FILE	*fp_in;
-	int	i, file_size = 0;
-	struct	stat st;
+	FILE *fp_in;
+	char *file, *ptr;
+	char buf[LEN];
+	int i;
+	off_t	file_size = 0;
+	struct stat st;
 
 	wait_message (1, txt_uudecoding, file_out);
 
@@ -1195,7 +1177,7 @@
 			sh_format (buf, sizeof(buf), "%s %s", DEFAULT_SUM, file);
 			if ((fp_in = popen (buf, "r")) != (FILE *) 0) {
 				if (stat (file, &st) != -1)
-					file_size = (int) st.st_size;
+					file_size = st.st_size;
 				if (fgets (buf, sizeof (buf), fp_in) != 0) {
 					ptr = strchr (buf, '\n');
 					if (ptr != 0)
@@ -1204,7 +1186,7 @@
 				pclose (fp_in);
 				my_printf (txt_checksum_of_file, file);
 				my_flush ();
-				my_printf ("%s  %8d bytes" cCRLF cCRLF, buf, file_size);
+				my_printf ("%s  %8d bytes" cCRLF cCRLF, buf, (int)file_size);
 				my_flush ();
 			} else {
 				my_printf ("Cannot execute %s" cCRLF, buf);
diff -Nur tin-980117/src/screen.c tin-980202/src/screen.c
--- tin-980117/src/screen.c	Wed Dec 31 04:12:48 1997
+++ tin-980202/src/screen.c	Sat Jan 24 15:55:54 1998
@@ -17,7 +17,7 @@
 
 char msg[LEN];
 
-#if !USE_CURSES
+#ifndef USE_CURSES
 	struct t_screen *screen;
 #endif
 
@@ -134,7 +134,7 @@
 #				define sys_errlist	__sys_errlist
 #			endif
 #		else
-#			if DECL_SYS_ERRLIST
+#			ifdef DECL_SYS_ERRLIST
 				extern char *sys_errlist[];
 #			endif
 #		endif
@@ -181,7 +181,7 @@
 		MoveCursor (cLINES, 0);
 		CleartoEOLN ();
 		cursoroff ();
-#if !USE_CURSES
+#ifndef USE_CURSES
 		my_flush();
 #endif
 	}
@@ -241,12 +241,12 @@
 	if (draw_arrow_mark)
 		my_fputs ("->", stdout);
 	else {
-#if USE_CURSES
+#ifdef USE_CURSES
 		char buffer[BUFSIZ];
 		char *s = screen_contents(line, 0, buffer);
 #else
 		char *s = screen[line-INDEX_TOP].col;
-#endif
+#endif /* USE_CURSES */
 		StartInverse ();
 		my_fputs (s, stdout);
 		EndInverse ();
@@ -264,12 +264,12 @@
 	if (draw_arrow_mark)
 		my_fputs ("  ", stdout);
 	else {
-#if USE_CURSES
+#ifdef USE_CURSES
 		char buffer[BUFSIZ];
 		char *s = screen_contents(line, 0, buffer);
 #else
 		char *s = screen[line-INDEX_TOP].col;
-#endif
+#endif /* USE_CURSES */
 		EndInverse ();
 		my_fputs (s, stdout);
 	}
@@ -288,10 +288,8 @@
 #ifdef HAVE_COLOR
 		fcol(col_title);
 #endif
-		if (mail_check ())		/* you have mail message in */
-			my_fputs (txt_you_have_mail, stdout);
-		else
-			my_fputs (txt_type_h_for_help, stdout);
+		/* you have mail message in */
+		my_fputs ((mail_check () ? txt_you_have_mail : txt_type_h_for_help) , stdout);
 
 #ifdef HAVE_COLOR
 		fcol(col_normal);
@@ -304,14 +302,14 @@
 void
 ring_bell (void)
 {
-#if USE_CURSES
+#ifdef USE_CURSES
 	if (!cmd_line)
 		beep();
 	else {
 #endif
 	my_fputc ('\007', stdout);
 	my_flush();
-#if USE_CURSES
+#ifdef USE_CURSES
 	}
 #endif
 }
@@ -321,7 +319,7 @@
 spin_cursor (void)
 {
 	static const char *buf = "|/-\\|/-\\";
-	static int i = 0;
+	static unsigned char i = 0;
 
 	if (batch_mode)
 		return;
@@ -429,7 +427,7 @@
 #				define sys_errlist	__sys_errlist
 #			endif
 #		else
-#			if DECL_SYS_ERRLIST
+#			ifdef DECL_SYS_ERRLIST
 				extern char *sys_errlist[];
 #			endif
 #		endif
diff -Nur tin-980117/src/search.c tin-980202/src/search.c
--- tin-980117/src/search.c	Mon Jan  5 01:55:40 1998
+++ tin-980202/src/search.c	Thu Jan 29 03:02:49 1998
@@ -51,10 +51,7 @@
 
 	clear_message ();
 
-	if (forward)
-		sprintf (tmpbuf, fwd_msg, def);
-	else
-		sprintf (tmpbuf, bwd_msg, def);
+	sprintf (tmpbuf, (forward ? fwd_msg : bwd_msg), def);
 
 	if (!prompt_string (tmpbuf, pattern, which_hist))
 		return NULL;
@@ -62,7 +59,7 @@
 	if (pattern[0] != '\0')
 		strcpy (def, pattern);
 	else {
-		if (def[0])
+		if (*def)
 			strcpy (pattern, def);
 		else {
 			info_message (txt_no_search_string);
@@ -431,14 +428,8 @@
 	))) return FALSE;
 
 	while (!local_note_end) {
-		note_line = 1;
 		ctrl_L = FALSE;
-
-		if (local_note_page < 1)
-			note_line += 4;
-			/* FIXME: offset is wrong with news_headers_to_display */
-		else
-			note_line += 2;
+		note_line = (local_note_page < 1) ? 5 : 3;
 
 		while (note_line < cLINES) {
 			if (fgets (buf, sizeof buf, note_fp) == NULL) {
@@ -513,15 +504,11 @@
 	FILE *fp;
 
 #if 1 /* see also screen.c show_progress ()*/
-	if ((fp = open_art_fp (group_path, art->artnum, -art->lines)) == (FILE *) 0) {
+	if ((fp = open_art_fp (group_path, art->artnum, -art->lines)) == (FILE *) 0)
 #else
-	if ((fp = open_art_fp (group_path, art->artnum, art->lines)) == (FILE *) 0) {
+	if ((fp = open_art_fp (group_path, art->artnum, art->lines)) == (FILE *) 0)
 #endif
-		if (tin_errno != 0)
-			return -1;
-		else
-			return FALSE;
-	}
+		return ((tin_errno != 0) ? -1 : FALSE);
 
 	/*
 	 * Skip the header
diff -Nur tin-980117/src/select.c tin-980202/src/select.c
--- tin-980117/src/select.c	Fri Jan 16 12:45:08 1998
+++ tin-980202/src/select.c	Sun Feb  1 11:25:53 1998
@@ -29,6 +29,7 @@
  * Local prototypes
  */
 #ifndef INDEX_DAEMON
+static int continual_key (int ch, int ch1);
 static int next_unread_group (int enter_group);
 static int prompt_group_num (int ch);
 static int reposition_group (struct t_group *group, int default_num);
@@ -41,6 +42,48 @@
 static void vDelRange (int iLevel, int iNumMax);
 static void erase_group_arrow (void);
 
+/*
+ *  TRUE, if we should check whether it's time to reread the active file
+ *  after this keypress.
+ */
+
+static int
+continual_key (int ch, int ch1)
+{
+	switch(ch) {
+		case iKeyShellEscape:
+		case iKeyLookupMessage:
+		case iKeyOptionMenu:
+		case iKeyQuit:
+		case iKeyPostponed:
+		case iKeySelectResetNewsrc:
+		case iKeySelectQuit2:
+		case iKeySelectBugReport:
+		case iKeySelectPostHist:
+		case iKeySelectQuitNoWrite:
+		case iKeySelectSyncWithActive:
+		case iKeySelectHelp:
+		case iKeySelectPost:
+			return FALSE;
+
+#ifndef WIN32
+		case ESC:
+#ifdef HAVE_KEY_PREFIX
+		case KEY_PREFIX:
+#endif
+			switch(ch1) {
+#endif /* WIN32 */
+				case KEYMAP_LEFT:
+					return FALSE;
+#ifndef WIN32
+			}
+			/* FALLTHROUGH */
+#endif /* WIN32 */
+
+		default:
+			return TRUE;
+	}
+}
 
 void
 selection_index (
@@ -72,10 +115,9 @@
 	ClearScreen();
 	set_groupname_len (FALSE);	/* find longest subscribed to groupname */
 	show_selection_page ();	/* display group selection page */
-	set_alarm_signal ();		/* set alarm signal for resync_active_file () */
 
 	forever {
-		if (!resync_active_file ()) {	/* reread active file if alarm set */
+		if (!resync_active_file ()) {	/* reread active file if necessary */
 			if (reread_active_after_posting ()) {
 				show_selection_page ();
 			}
@@ -91,9 +133,9 @@
 				ch1 = get_arrow_key (ch);
 		}
 #endif /* WIN32 */
-		if (ch != iKeyQuit && ch != iKeySelectQuit2) {
+
+		if (continual_key (ch, ch1))
 			(void) resync_active_file ();
-		}
 
 		if (ch > '0' && ch <= '9') {
 			(void) prompt_group_num (ch);
@@ -217,9 +259,8 @@
 
 					if (index_point == GRP_QUIT)
 						goto select_done;
-#ifndef DONT_REREAD_ACTIVE_FILE
-					if (!reread_active_file)
-#endif
+
+					if (!reread_active_file ())
 						show_selection_page ();
 				} else
 					info_message (txt_no_arts);
@@ -270,11 +311,7 @@
 select_down:
 				if (!group_top)
 					break;
-
-				if (cur_groupnum + 1 >= group_top)
-					move_to_group(0);
-				else
-					move_to_group(cur_groupnum + 1);
+				move_to_group((cur_groupnum + 1 >= group_top) ? 0 : (cur_groupnum + 1));
 				break;
 
 			case iKeyUp:		/* line up */
@@ -282,11 +319,7 @@
 select_up:
 				if (!group_top)
 					break;
-
-				if (cur_groupnum == 0)
-					move_to_group (group_top - 1);
-				else
-					move_to_group (cur_groupnum - 1);
+				move_to_group ((cur_groupnum == 0) ? (group_top - 1) : (cur_groupnum - 1));
 				break;
 
 			case iKeySelectResetNewsrc:	/* reset .newsrc */
@@ -316,7 +349,7 @@
 					cur_groupnum = ((cur_groupnum - scroll_lines) / scroll_lines) * scroll_lines;
 				if (cur_groupnum < 0)
 					cur_groupnum = 0;
-				if (cur_groupnum < first_group_on_screen ||  cur_groupnum >= last_group_on_screen)
+				if (cur_groupnum < first_group_on_screen || cur_groupnum >= last_group_on_screen)
 					show_selection_page ();
 				else
 					draw_group_arrow ();
@@ -408,14 +441,12 @@
 				break;
 
 			case iKeyOptionMenu:	/* option menu */
-				set_alarm_clock_off ();
 				(void) change_config_file(NULL);
 				set_signals_select ();	/* just to be sure */
 				free_attributes_array ();
 				read_attributes_file (global_attributes_file, TRUE);
 				read_attributes_file (local_attributes_file, FALSE);
 				show_selection_page ();
-				set_alarm_clock_on ();
 				break;
 
 			case iKeySelectNextUnreadGrp:	/* goto next unread group */
@@ -497,7 +528,7 @@
 					sprintf (buf, txt_remove_bogus, CURR_GROUP.name);
 					vWriteNewsrc();	/* save current newsrc */
 					delete_group(CURR_GROUP.name); /* remove bogus group */
-					read_newsrc(newsrc, 1);	/* reload newsrc*/
+					read_newsrc(newsrc, TRUE);	/* reload newsrc*/
 					toggle_my_groups (show_only_unread_groups, ""); /* keep current display-state */
 					show_selection_page(); /* reddraw screen */
 					info_message (buf);
@@ -537,7 +568,8 @@
 				}
 				break;
 
-			case iKeyPostponed:	/* post postponed article */
+			case iKeyPostponed:
+			case iKeyPostponed2:	/* post postponed article */
 				if (can_post) {
 					if (pickup_postponed_articles(FALSE, FALSE)) {
 						show_selection_page ();
@@ -556,7 +588,6 @@
 			case iKeySelectYankActive:	/* pull in rest of groups from active */
 				if (yank_in_active_file) {
 					wait_message (0, txt_yanking_all_groups);
-					set_alarm_clock_off ();
 					n = group_top;
 					if (group_top) {
 						strcpy (buf, CURR_GROUP.name);
@@ -596,7 +627,6 @@
 					set_groupname_len (yank_in_active_file);
 					show_selection_page ();
 					yank_in_active_file = TRUE;
-					set_alarm_clock_on ();
 				}
 				break;
 
@@ -700,7 +730,7 @@
 	}
 
 	for (j=0, i=first_group_on_screen; i < last_group_on_screen; i++, j++) {
-#if USE_CURSES
+#ifdef USE_CURSES
 		char sptr[BUFSIZ];
 #else
 		char *sptr = screen[j].col;
@@ -727,16 +757,13 @@
 			subs = 'D';
 		else if (active[n].subscribed)			/* Important that this preceeds Newgroup */
 			subs = group_flag (active[n].moderated);
-		else if (active[n].newgroup)
-			subs = 'N';		/* New (but unsubscribed) group */
 		else
-			subs = 'u';		/* unsubscribed group */
+			subs = ((active[n].newgroup) ? 'N' : 'u'); /* New (but unsubscribed) group or unsubscribed group */
 
 		strncpy(active_name, active[n].name, groupname_len);
 		active_name[groupname_len+1] = '\0';
-		if (blank_len > 254) {
+		if (blank_len > 254)
 			blank_len = 254;
-		}
 		/* copy of active[n].description fix some malloc bugs kg */
 		strncpy(group_descript, active[n].description ? active[n].description : " ", blank_len);
 		group_descript[blank_len+1] = '\0';
@@ -836,7 +863,7 @@
 		info_message (txt_no_groups);
 	else if (info_in_last_line) {
 		clear_message ();
-		center_line (cLINES, FALSE, CURR_GROUP.description ?  CURR_GROUP.description : txt_no_description);
+		center_line (cLINES, FALSE, CURR_GROUP.description ? CURR_GROUP.description : txt_no_description);
 	}
 }
 
@@ -845,7 +872,7 @@
 static void
 yank_active_file (void)
 {
-	reread_active_file = TRUE;
+	force_reread_active_file = TRUE;
 	resync_active_file ();
 }
 #endif /* INDEX_DAEMON */
@@ -867,7 +894,7 @@
 	if (strlen (buf)) {
 		strcpy (default_goto_group, buf);
 	} else {
-		if (default_goto_group[0]) {
+		if (*default_goto_group) {
 			strcpy (buf, default_goto_group);
 		} else {
 			return -1;
@@ -955,12 +982,9 @@
 		return default_num;
 	}
 
-	if (strlen (pos)) {
-		if (pos[0] == '$')
-			pos_num = group_top;
-		else
-			pos_num = atoi (pos);
-	} else {
+	if (strlen (pos))
+		pos_num = ((pos[0] == '$') ? group_top: atoi (pos));
+	else {
 		if (default_move_group)
 			pos_num = default_move_group;
 		else
@@ -995,7 +1019,7 @@
 	 * get the right position
 	 */
 	if (pos_group_in_newsrc (group, pos_num - newgroups)) {
-		read_newsrc (newsrc, 1);
+		read_newsrc (newsrc, TRUE);
 		default_move_group = pos_num;
 		return (pos_num-1);
 	} else {
@@ -1010,18 +1034,12 @@
 	struct t_group *group,
 	int goto_next_unread_group)
 {
-	if (!confirm_action || prompt_yn (cLINES,
-					sized_message(txt_mark_group_read, group->name), TRUE) == 1) {
+	if (!confirm_action || prompt_yn (cLINES, sized_message(txt_mark_group_read, group->name), TRUE) == 1) {
 		grp_mark_read (group, NULL);
-
-		mark_screen (SELECT_LEVEL, cur_groupnum - first_group_on_screen,
-			9, "     ");
-
+		mark_screen (SELECT_LEVEL, cur_groupnum - first_group_on_screen, 9, "     ");
 		move_to_group(cur_groupnum + 1);
-
-		if (goto_next_unread_group) {
+		if (goto_next_unread_group)
 			next_unread_group (FALSE);
-		}
 	}
 }
 
@@ -1054,15 +1072,16 @@
 		return GRP_UNINDEXED;
 	}
 
-	if (i != cur_groupnum) {
+	if (i != cur_groupnum)
 		erase_group_arrow ();
-	}
+
 	cur_groupnum = i;
-	if (cur_groupnum < first_group_on_screen || cur_groupnum >= last_group_on_screen) {
+
+	if (cur_groupnum < first_group_on_screen || cur_groupnum >= last_group_on_screen)
 		show_selection_page ();
-	} else {
+	else
 		draw_group_arrow ();
-	}
+
 	space_mode = pos_first_unread;
 
 	if (enter_group) {
@@ -1071,9 +1090,10 @@
 			index_point = GRP_UNINDEXED;
 			group_page (&CURR_GROUP);
 		} while (index_point == GRP_GOTONEXT || index_point == GRP_CONTINUE);
-		if (index_point == GRP_QUIT) {
+
+		if (index_point == GRP_QUIT)
 			return GRP_QUIT;
-		}
+
 		show_selection_page ();
 	}
 
@@ -1099,33 +1119,29 @@
 	if (all_groups) {
 		for (i = 0 ; i < num_active ; i++) {
 			len = strlen (active[i].name);
-			if (len > groupname_len) {
+			if (len > groupname_len)
 				groupname_len = len;
-			}
 		}
 	} else {
 		for (i = 0 ; i < group_top ; i++) {
 			len = strlen (active[my_group[i]].name);
-			if (len > groupname_len) {
+			if (len > groupname_len)
 				groupname_len = len;
-			}
 		}
 	}
 
 	if (groupname_len >= (cCOLS - SELECT_MISC_COLS)) {
 		groupname_len = cCOLS - SELECT_MISC_COLS - 1;
-		if (groupname_len < 0) {
+		if (groupname_len < 0)
 			groupname_len = 0;
-		}
 	}
 
 	/*
 	 * If newsgroups descriptions are ON then cut off groupnames
 	 * to specified max. length otherwise display full length
 	 */
-	if (show_description && groupname_len > groupname_max_length) {
+	if (show_description && groupname_len > groupname_max_length)
 		groupname_len = groupname_max_length;
-	}
 }
 
 /*
@@ -1156,7 +1172,7 @@
 	old_curr_group[0] = '\0';
 
 	if (group_top) {
-		if (!only_unread_groups || reread_active_file) {
+		if (!only_unread_groups || reread_active_file ()) {
 
 			if (group[0] != '\0') {
 				if ((i = find_group_index (group)) >= 0)
@@ -1187,9 +1203,8 @@
 			if (only_unread_groups) {
 				if (active[i].newsrc.num_unread || (active[i].bogus && strip_bogus == BOGUS_ASK))
 					my_group_add (buf);
-			} else {
+			} else
 				my_group_add (buf);
-			}
 		}
 	}
 	fclose (fp);
@@ -1221,7 +1236,7 @@
 	if (!num_active)
 		return;
 
-	if (!prompt_string (prompt, buf, HIST_OTHER) || !buf[0]) {
+	if (!prompt_string (prompt, buf, HIST_OTHER) || !*buf) {
 		clear_message ();
 		return;
 	}
@@ -1345,9 +1360,9 @@
 	/*
 	 * Parse range string
 	 */
-	if (!iParseRange (acRng, iNumMin, iNumMax, iNumCur, &iRngMin, &iRngMax)) {
+	if (!iParseRange (acRng, iNumMin, iNumMax, iNumCur, &iRngMin, &iRngMax))
 		info_message ("Invalid range - valid are '0-9.$' eg. 1-$");
-	} else {
+	else {
 /*
 		info_message ("DefRng=[%s] NewRng=[%s] Min=[%d] Max=[%d]",
 			pcPtr, acRng, iRngMin, iRngMax);
@@ -1406,12 +1421,10 @@
 			if (iSetMax) {
 				*piRngMax = atoi (pcPtr);
 				iDone = TRUE;
-			} else {
+			} else
 				*piRngMin = atoi (pcPtr);
-			}
-			while (*pcPtr >= '0' && *pcPtr <= '9') {
+			while (*pcPtr >= '0' && *pcPtr <= '9')
 				pcPtr++;
-			}
 		} else {
 			switch (*pcPtr) {
 				case '-':
@@ -1421,9 +1434,8 @@
 					if (iSetMax) {
 						*piRngMax = iNumCur;
 						iDone = TRUE;
-					} else {
+					} else
 						*piRngMin = iNumCur;
-					}
 					break;
 				case '$':
 					if (iSetMax) {
@@ -1438,9 +1450,8 @@
 		}
 	}
 
-	if (*piRngMin >= iNumMin && *piRngMax > iNumMin && *piRngMax <= iNumMax) {
+	if (*piRngMin >= iNumMin && *piRngMax > iNumMin && *piRngMax <= iNumMax)
 		iRetCode = TRUE;
-	}
 
 	return iRetCode;
 }
@@ -1456,9 +1467,8 @@
 	switch (iLevel)
 	{
 		case SELECT_LEVEL:
-			for (iIndex = 0; iIndex < iNumMax-1; iIndex++) {
+			for (iIndex = 0; iIndex < iNumMax-1; iIndex++)
 				active[iIndex].inrange = FALSE;
-			}
 			break;
 		case GROUP_LEVEL:
 			for (iIndex = 0; iIndex < iNumMax-1; iIndex++) {
@@ -1469,9 +1479,8 @@
 			}
 			break;
 		case THREAD_LEVEL:
-			for (iIndex = 0; iIndex < iNumMax-1; iIndex++) {
+			for (iIndex = 0; iIndex < iNumMax-1; iIndex++)
 				arts[iIndex].inrange = FALSE;
-			}
 /*
 			for (iIndex = base[thread_basenote]; iIndex >= 0 ; iIndex = arts[iIndex].thread) {
 				arts[iIndex].inrange = FALSE;
diff -Nur tin-980117/src/sigfile.c tin-980202/src/sigfile.c
--- tin-980117/src/sigfile.c	Wed Dec 31 04:13:34 1997
+++ tin-980202/src/sigfile.c	Sun Jan 18 20:13:17 1998
@@ -126,7 +126,7 @@
 			srand ((unsigned int) epoch);
 			my_chdir (sigdir);
 
-			if (thrashdir (sigdir) || !sigfile[0]) {
+			if (thrashdir (sigdir) || !*sigfile) {
 #ifdef DEBUG
 				if (debug == 2)
 					error_message ("NO sigfile=[%s]", sigfile);
diff -Nur tin-980117/src/signal.c tin-980202/src/signal.c
--- tin-980117/src/signal.c	Fri Dec 26 03:45:03 1997
+++ tin-980202/src/signal.c	Sun Feb  1 05:39:37 1998
@@ -16,6 +16,15 @@
 #include	"tcurses.h"
 #include	"trace.h"
 
+
+#if defined (VMS) && defined (SIGBUS)
+	/*
+	 * SIGBUS works on VMS, but many useful information will be hidden
+	 * if catched by signal handler.
+	 */
+#	undef SIGBUS
+#endif
+
 /*
  * Needed for resizing under an xterm
  */
@@ -51,8 +60,6 @@
 #	undef SIGTSTP
 #endif /* !MINIX */
 
-static unsigned int time_remaining;
-
 /*
  * local prototypes
  */
@@ -193,13 +200,13 @@
 	TRACE(("handle_resize(%d:%d)", (int)my_context, repaint))
 
 	if (repaint) {
-#if USE_CURSES
-#ifdef HAVE_RESIZETERM
+#ifdef USE_CURSES
+#	ifdef HAVE_RESIZETERM
 		resizeterm(cLINES+1, cCOLS+1);
-#else
+#	else
 		my_retouch();
-#endif
-#endif
+#	endif /* HAVE_RESIZETERM */
+#endif /* USE_CURSES */
 		switch (my_context) {
 		case cArt:
 			ClearScreen ();
@@ -262,12 +269,12 @@
 void _CDECL signal_handler (int sig)
 {
 #ifdef SIGCHLD
-#if HAVE_TYPE_UNIONWAIT
+#	ifdef HAVE_TYPE_UNIONWAIT
 	union wait wait_status;
-#else
+#	else
 	int wait_status = 1;
-#endif
-#endif
+#	endif /* HAVE_TYPE_UNIONWAIT */
+#endif /* SIGCHLD */
 
 	/* In this case statement, we handle only the non-fatal signals */
 	switch (sig) {
@@ -290,12 +297,6 @@
 			return;
 #endif
 
-#if defined(SIGALRM) && !defined(DONT_REREAD_ACTIVE_FILE)
-		case SIGALRM:
-			set_alarm_signal ();
-			reread_active_file = TRUE;
-			return;
-#endif
 #ifdef SIGPIPE
 		case SIGPIPE:
 			got_sig_pipe = TRUE;
@@ -392,35 +393,6 @@
 }
 
 
-void set_alarm_signal (void)
-{
-#ifndef DONT_REREAD_ACTIVE_FILE
-	(void) alarm (0);
-#if !defined(M_OS2) && !defined(WIN32) && !defined(M_AMIGA)
-	signal (SIGALRM, signal_handler);
-#endif
-	alarm (reread_active_file_secs);
-#endif
-	reread_active_file = FALSE;
-}
-
-
-void set_alarm_clock_on (void)
-{
-#ifndef DONT_REREAD_ACTIVE_FILE
-	alarm (time_remaining);
-#endif
-}
-
-
-void set_alarm_clock_off (void)
-{
-#ifndef DONT_REREAD_ACTIVE_FILE
-	time_remaining = alarm (0);
-#endif
-}
-
-
 int
 set_win_size (
 	int *num_lines,
@@ -439,7 +411,9 @@
 	old_lines = *num_lines;
 	old_cols = *num_cols;
 
+#ifndef USE_CURSES
 	init_screen_array (FALSE);		/* deallocate screen array */
+#endif
 
 #ifdef TIOCGSIZE
 	if (ioctl (0, TIOCGSIZE, &win) == 0) {
@@ -449,38 +423,34 @@
 			*num_cols = win.ts_cols;
 	}
 #else
-#  ifdef TIOCGWINSZ
+#	ifdef TIOCGWINSZ
 	if (ioctl (0, TIOCGWINSZ, &win) == 0) {
 		if (win.ws_row != 0)
 			*num_lines = win.ws_row - 1;
 		if (win.ws_col != 0)
 			*num_cols = win.ws_col;
 	}
-#  else
-#    ifdef M_AMIGA
+#	else
+#		ifdef M_AMIGA
 	AmiGetWinSize(num_lines, num_cols);
 	(*num_lines)--;
-#    endif
-#  endif
-#endif
+#		endif /* M_AMIGA */
+#	endif /* TIOCGWINSZ */
+#endif /* TIOCGSIZE */
 
+#ifndef USE_CURSES
 	init_screen_array (TRUE);		/* allocate screen array for resize */
+#endif
 
 	set_subj_from_size (*num_cols);
 
 	RIGHT_POS = *num_cols - 20;
 	MORE_POS  = *num_cols - 15;
-	if (beginner_level)
-		NOTESLINES = *num_lines - INDEX_TOP - MINI_HELP_LINES;
-	else
-		NOTESLINES = *num_lines - INDEX_TOP - 1;
+	NOTESLINES = *num_lines - INDEX_TOP - (beginner_level ? MINI_HELP_LINES : 1);
 	if (NOTESLINES <= 0)
 		NOTESLINES = 1;
 
-	if (*num_lines != old_lines || *num_cols != old_cols)
-		return TRUE;
-	else
-		return FALSE;
+	return (*num_lines != old_lines || *num_cols != old_cols);
 }
 
 void set_signals_art    (void) { my_context = cArt; }
diff -Nur tin-980117/src/strftime.c tin-980202/src/strftime.c
--- tin-980117/src/strftime.c	Fri Dec 26 03:45:03 1997
+++ tin-980202/src/strftime.c	Sun Jan 18 19:01:29 1998
@@ -156,10 +156,7 @@
 			break;
 
 		case 'p':	/* am or pm based on 12-hour clock */
-			if (timeptr->tm_hour < 12)
-				strcpy(tbuf, ampm[0]);
-			else
-				strcpy(tbuf, ampm[1]);
+			strcpy(tbuf, ampm[((timeptr->tm_hour < 12) ? 0 : 1)]);
 			break;
 
 		case 'S':	/* second, 00 - 61 */
diff -Nur tin-980117/src/string.c tin-980202/src/string.c
--- tin-980117/src/string.c	Thu Jan 15 16:53:01 1998
+++ tin-980202/src/string.c	Sun Feb  1 05:39:55 1998
@@ -173,10 +173,7 @@
 		else source++;
 	}
 	*c = 0;
-	if(decode)
-		c = rfc1522_decode(buf);
-	else
-		c = buf;
+	c = (decode ? (rfc1522_decode(buf)) : buf);
 
 	while (--size)
 		*target++ = *c++;
@@ -367,7 +364,7 @@
  */
 
 /*fix me - put me in tin.h */
-#define FOLD_TO_UPPER(a)        (toupper ((unsigned char)(a)))
+#define	FOLD_TO_UPPER(a)	(toupper ((unsigned char)(a)))
 
 #ifndef HAVE_STRCASECMP
 int
diff -Nur tin-980117/src/tcurses.c tin-980202/src/tcurses.c
--- tin-980117/src/tcurses.c	Wed Dec 31 04:09:49 1997
+++ tin-980202/src/tcurses.c	Sat Jan 24 02:07:54 1998
@@ -16,10 +16,10 @@
 #include "tin.h"
 #include "tcurses.h"
 
-#if USE_CURSES
+#ifdef USE_CURSES
 
 #ifndef KEY_MIN
-#define KEY_MIN KEY_BREAK	/* SVr3 curses */
+#	define KEY_MIN KEY_BREAK	/* SVr3 curses */
 #endif
 
 #include "trace.h"
diff -Nur tin-980117/src/thread.c tin-980202/src/thread.c
--- tin-980117/src/thread.c	Thu Jan 15 16:31:23 1998
+++ tin-980202/src/thread.c	Sun Feb  1 05:30:20 1998
@@ -19,9 +19,13 @@
 #define INDEX2TNUM(i)	((i) % NOTESLINES)
 #define TNUM2LNUM(i)	(INDEX_TOP + (i))
 #define INDEX2LNUM(i)	(TNUM2LNUM(INDEX2TNUM(i)))
+#define EXPIRED(a) ((a)->article == ART_UNAVAILABLE || \
+		    arts[(a)->article].thread == ART_EXPIRED)
 
+#if 0 /* needed by old threading tree */
 /* String of spaces to use to show depth of threading */
 #define THREAD_SPACER		"  "
+#endif /* 0 */
 
 int thread_basenote = 0;
 int show_subject;
@@ -38,15 +42,16 @@
  * Local prototypes
  */
 #ifndef INDEX_DAEMON
+static int find_unexpired (struct t_msgid *ptr);
+static int has_sibling (struct t_msgid *ptr);
+static int prompt_thread_num (int ch);
 static void bld_tline (int l, struct t_article *art);
 static void draw_tline (int i, int full);
-static int prompt_thread_num (int ch);
-static void update_thread_page (void);
 static void draw_thread_arrow (void);
 static void erase_thread_arrow (void);
 static void make_prefix (struct t_msgid *art, char *prefix);
-#endif
-
+static void update_thread_page (void);
+#endif /* !INDEX_DAEMON */
 
 /*
  * Build one line of the thread page display. Looks long winded, but
@@ -58,17 +63,15 @@
 	int l,
 	struct t_article *art)
 {
-	int i;
-	int len_from;
 	char mark;
-#if USE_CURSES
+#ifdef USE_CURSES
 	char buff[BUFSIZ];
 #else
 	char *buff = screen[INDEX2TNUM(l)].col;
-#endif
-#if 0 /* not needed with mutt-like threading tree */
+#endif /* USE_CURSES */
+	int i;
+	int len_from;
 	struct t_msgid *ptr;
-#endif
 
 	/*
 	 * Start with space for ->
@@ -81,9 +84,9 @@
 	/*
 	 * Add the article flags, tag number, or whatever (3 chars)
 	 */
-	if (art->tagged) {
+	if (art->tagged)
 		strcat (buff, tin_itoa(art->tagged, 3));
-	} else {
+	else {
 		strcat(buff, "   ");
 
 		if (art->inrange) {
@@ -110,12 +113,7 @@
 	 */
 	if (show_lines) {
 		strcat (buff, "[");
-
-		if (art->lines != -1)
-			strcat (buff, tin_itoa(art->lines, 4));
-		else
-			strcat (buff, "   ?");
-
+		strcat (buff, ((art->lines != -1) ? tin_itoa(art->lines, 4): "   ?"));
 		strcat (buff, "]  ");
 	}
 
@@ -132,10 +130,7 @@
 		 * TODO why the -3 ???
 		 * show_lines takes up 8 chars if enabled
 		 */
-		if (CURR_GROUP.attribute->show_author != SHOW_FROM_NONE)
-			len_from = (max_from - 3) + 8 * (1 - show_lines);
-		else
-			len_from = 0;
+		len_from = ((CURR_GROUP.attribute->show_author != SHOW_FROM_NONE) ? (max_from - 3) + 8 * (1 - show_lines) : 0);
 
 #if 0 /* old insertion code, obsolete with mutt like threading tree */
 		/*
@@ -155,10 +150,8 @@
 
 		make_prefix(art->refptr, buff+strlen(buff));
 
-		if ((int)strlen(buff) >= cCOLS) { /* If extremely nested */
-			WriteLine(INDEX2LNUM(l), buff);
-			return;
-		}
+		if ((int)strlen(buff) >= cCOLS) /* If extremely nested */
+			buff[cCOLS] = '\0';
 
 #if 0 /* see #if 0 above */
 		}
@@ -170,17 +163,15 @@
 		i = cCOLS - strlen(buff) - len_from;
 
 		if (len_from)	/* Leave gap before author */
-			i=i-2;
+			i -= 2;
 		/*
 		 * Mutt-like thread tree. by sjpark@sparcs.kaist.ac.kr
 		 * Hide subject if same as parent's.
 		 */
 
 		if (i > 0) {
-			if (!(art->refptr->parent &&
-			  art->refptr->parent->article != ART_UNAVAILABLE &&
-			  arts[art->refptr->parent->article].subject ==
-			  art->subject))
+			for (ptr = art->refptr->parent; ptr && EXPIRED (ptr); ptr = ptr->parent);
+			if (!(ptr && arts[ptr->article].subject == art->subject))
 				strncat(buff, art->subject, i);
 
 			*(buff + strlen(buff)) = '\0';	/* Just in case */
@@ -233,12 +224,12 @@
 	int tlen;
 	int x = full ? 0 : (MARK_OFFSET-2);
 	int k = MARK_OFFSET;
-#if USE_CURSES
+#ifdef USE_CURSES
 	char buffer[BUFSIZ];
 	char *s = screen_contents(INDEX2LNUM(i), x, buffer);
 #else
 	char *s = &(screen[INDEX2TNUM(i)].col[x]);
-#endif
+#endif /* USE_CURSES */
 
 	if (full) {
 		if (strip_blanks) {
@@ -246,9 +237,8 @@
 			CleartoEOLN ();
 		}
 		tlen = strlen (s);	/* note new line length */
-	} else {
+	} else
 		tlen = 3; /* tagged/mark is 3 chars wide */
-	}
 
 	MoveCursor(INDEX2LNUM(i), x);
 	if (tlen)
@@ -302,10 +292,7 @@
 	/*
 	 * If threading by Refs, it helps to see the subject line
 	 */
-	if ((arts[thread_respnum].archive != (char *)0) || (group->attribute->thread_arts >= THREAD_REFS))
-		show_subject = TRUE;
-	else
-		show_subject = FALSE;
+	show_subject = ((arts[thread_respnum].archive != (char *)0) || (group->attribute->thread_arts >= THREAD_REFS));
 
 	thread_index_point = top_thread;
 	if (space_mode) {
@@ -470,10 +457,7 @@
 			case iKeyThreadReadNextArtOrThread:
 thread_tab_pressed:
 				space_mode = TRUE;
-				if (thread_index_point == 0)
-					n = thread_respnum;
-				else
-					n = find_response (thread_basenote, thread_index_point);
+				n = ((thread_index_point == 0) ? thread_respnum : find_response (thread_basenote, thread_index_point));
 
 				for (i = n ; i != -1 ; i = arts[i].thread) {
 					if ((arts[i].status == ART_UNREAD) || (arts[i].status == ART_WILL_RETURN)) {
@@ -556,10 +540,9 @@
 				clear_message ();
 				erase_thread_arrow ();
 				scroll_lines = (full_page_scroll ? NOTESLINES : NOTESLINES / 2);
-				if ((n = thread_index_point % scroll_lines) > 0)
-					thread_index_point = thread_index_point - n;
-				else
-					thread_index_point = ((thread_index_point - scroll_lines) / scroll_lines) * scroll_lines;
+
+				thread_index_point = (((n = thread_index_point % scroll_lines) > 0)? (thread_index_point - n) : (((thread_index_point - scroll_lines) / scroll_lines) * scroll_lines));
+
 				if (thread_index_point < 0)
 					thread_index_point = 0;
 				if (thread_index_point < first_thread_on_screen || thread_index_point >= last_thread_on_screen)
@@ -699,10 +682,7 @@
 				n = find_response (thread_basenote, thread_index_point);
 				if (n < 0)
 					break;
-				if (ch == iKeyThreadToggleArtSel && arts[n].selected == 1)
-					flag = 0;
-				else
-					flag = 1;
+				flag = (!(ch == iKeyThreadToggleArtSel && arts[n].selected == 1));
 				arts[n].selected = flag;
 /*				update_thread_page (); */
 				bld_tline (thread_index_point, &arts[n]);
@@ -724,7 +704,8 @@
 				update_thread_page ();
 				break;
 
-			case iKeyPostponed:	/* post postponed article */
+			case iKeyPostponed:
+			case iKeyPostponed2:	/* post postponed article */
 				if (can_post) {
 					if (pickup_postponed_articles(FALSE, FALSE))
 						show_thread_page();
@@ -781,12 +762,8 @@
 		last_thread_on_screen = top_thread;
 		first_thread_on_screen = (top_thread / NOTESLINES) * NOTESLINES;
 
-		if (first_thread_on_screen == last_thread_on_screen || first_thread_on_screen < 0) {
-			if (first_thread_on_screen < 0)
-				first_thread_on_screen = 0;
-			else
-				first_thread_on_screen = last_thread_on_screen - NOTESLINES;
-		}
+		if (first_thread_on_screen == last_thread_on_screen || first_thread_on_screen < 0)
+			first_thread_on_screen = ((first_thread_on_screen < 0) ? 0 : last_thread_on_screen - NOTESLINES);
 	}
 
 	if (top_thread == 0) {
@@ -883,9 +860,9 @@
 {
 	MoveCursor (INDEX2LNUM(thread_index_point), 0);
 
-	if (draw_arrow_mark) {
+	if (draw_arrow_mark)
 		my_fputs ("  ", stdout);
-	} else {
+	else {
 		HpGlitch(EndInverse ());
 		draw_tline (thread_index_point, TRUE);
 	}
@@ -1065,20 +1042,7 @@
 #endif
 	}
 
-
-	if (sbuf->inrange)
-		sbuf->art_mark = art_marked_inrange;
-	else if (sbuf->deleted)
-		sbuf->art_mark = art_marked_deleted;
-	else if (sbuf->selected_unread)
-		sbuf->art_mark = art_marked_selected;
-	else if (sbuf->unread)
-		sbuf->art_mark = art_marked_unread;
-	else if (sbuf->seen)
-		sbuf->art_mark = art_marked_return;
-	else
-		sbuf->art_mark = ART_MARK_READ;
-
+	sbuf->art_mark = (sbuf->inrange ? art_marked_inrange : (sbuf->deleted ? art_marked_deleted : (sbuf->selected_unread ? art_marked_selected : (sbuf->unread ? art_marked_unread : (sbuf->seen ? art_marked_return : ART_MARK_READ)))));
 	return(sbuf->total);
 }
 
@@ -1162,9 +1126,8 @@
 
 	j = (int) base[i];
 
-	while (n-- > 0 && arts[j].thread >= 0) {
+	while (n-- > 0 && arts[j].thread >= 0)
 		j = arts[j].thread;
-	}
 
 	return j;
 }
@@ -1237,6 +1200,26 @@
 #endif /* INDEX_DAEMON */
 
 
+static int
+find_unexpired (
+	struct t_msgid *ptr)
+{
+	return ptr && (!EXPIRED (ptr) || find_unexpired (ptr->child) || find_unexpired (ptr->sibling));
+}
+
+static int
+has_sibling (
+	struct t_msgid *ptr)
+{
+	do {
+		if (find_unexpired (ptr->sibling))
+			return TRUE;
+		ptr = ptr->parent;
+	} while (ptr && EXPIRED (ptr));
+	return FALSE;
+}
+
+
 /*
  * mutt-like subject according. by sjpark@sparcs.kaist.ac.kr
  */
@@ -1250,7 +1233,7 @@
 	int depth = 0;
 
 	for (ptr = art->parent; ptr; ptr = ptr->parent)
-		depth++;
+		depth += !EXPIRED (ptr);
 
 	if (depth == 0) {
 		prefix[0] = '\0';
@@ -1260,19 +1243,15 @@
 	prefix_ptr = depth * 2 - 1;
 	strcpy (&prefix[prefix_ptr], "->");
 	prefix_ptr--;
-	if (art->sibling)
-		prefix[prefix_ptr] = '+';
-	else
-		prefix[prefix_ptr] = '`';
+	prefix[prefix_ptr] = (has_sibling (art) ? '+' : '`');
 
-	for (ptr = art->parent; ptr->parent; ptr = ptr->parent) {
+	for (ptr = art->parent; prefix_ptr != 0; ptr = ptr->parent) {
+		if (EXPIRED (ptr))
+			continue;
 		prefix_ptr--;
 		prefix[prefix_ptr] = ' ';
 		prefix_ptr--;
-		if (ptr->sibling)
-			prefix[prefix_ptr] = '|';
-		else
-			prefix[prefix_ptr] = ' ';
+		prefix[prefix_ptr] = (has_sibling (ptr) ? '|' : ' ');
 	}
 	return;
 }
diff -Nur tin-980117/src/vms.c tin-980202/src/vms.c
--- tin-980117/src/vms.c	Fri Dec 26 03:45:12 1997
+++ tin-980202/src/vms.c	Thu Jan  1 01:00:00 1970
@@ -1,294 +0,0 @@
-/*
- *  Project   : tin - a Usenet reader
- *  Module    : vms.c
- *  Author    : Andrew Greer
- *  Created   : 19-06-95
- *  Updated   : 19-06-95
- *  Notes     :
- *  Copyright : (c) Copyright 1991-95 by Iain Lea & Andrew Greer
- *              You may  freely  copy or  redistribute  this software,
- *              so  long as there is no profit made from its use, sale
- *              trade or  reproduction.  You may not change this copy-
- *              right notice, and it must be included in any copy made
- */
-
-#ifdef VMS
-
-#include <stdio.h>
-#include <descrip.h>
-#include <iodef.h>
-#include <ssdef.h>
-#include <uaidef.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/file.h>
-#ifdef __GNUC__
-#include <sys$routines.h>
-#else
-#include <starlet.h>
-#endif
-#include "tin.h"
-#include "sio.h"
-
-char *
-getlogin (void)
-{
-	char *p;
-
-	if ((p = getenv ("USER")) == NULL) {
-		return ( (char *) 0);
-	}
-
-	return (p);
-}
-
-struct dsc$descriptor *c$dsc(char *c$_str)
-{
-  static struct dsc$descriptor c$_tmpdesc;
-
-  c$_tmpdesc.dsc$w_length = strlen(c$_str);
-  c$_tmpdesc.dsc$b_dtype  = DSC$K_DTYPE_T;
-  c$_tmpdesc.dsc$b_class  = DSC$K_CLASS_S;
-  c$_tmpdesc.dsc$a_pointer= c$_str;
-  return(&c$_tmpdesc);
-}
-
-char *get_uaf_fullname()
-{
-  static char uaf_owner[40];
-  char loc_username[13];
-  int i, pos;
-
-  struct item_list {
-    short bl, ic;
-    char *ba;
-    short *rl;
-  } getuai_itmlist[] = {
-    {
-      sizeof(uaf_owner),
-      UAI$_OWNER,
-      &uaf_owner[0],
-      0
-    },
-    { 0, 0, 0, 0}
-  };
-
-  strcpy(loc_username, getenv("USER"));
-  for (i = strlen(loc_username); i < 12; ++i)
-    loc_username[i] = ' ';
-  loc_username[i] = '\0';
-
-  sys$getuai(0,0,c$dsc(loc_username),getuai_itmlist,0,0,0);
-
-  pos=1;
-  if (uaf_owner[pos]=='|')
-    pos += 3;
-  while (uaf_owner[pos] == ' ')
-    pos++;
-  uaf_owner[uaf_owner[0] + 1] = '\0';
-  return(uaf_owner + pos);
-}
-
-/* Converts "TOD_MCQUILLIN" to "Tod McQuillin" */
-char *fix_fullname(char *p)
-{
-  int cc = 0;
-  char *q = p;
-
-  while (*q) {
-    if (cc > 0) {
-      if (cc > 1 && *(q-1) == 'c' && *(q-2) == 'M') {
-	if (islower((unsigned char)*q))
-	  *q = toupper((unsigned char)*q);
-      } else
-	if (isupper((unsigned char)*q))
-	  *q = tolower((unsigned char)*q);
-    } else
-      if (cc == 0)
-	if (islower((unsigned char)*q))
-	  *q = toupper((unsigned char)*q);
-    if (*q == '_' || *q == ' ') {
-      *q = ' ';
-      cc = 0;
-    } else
-      cc++;
-    q++;
-  }
-  return (p);
-}
-
-#ifndef INDEX_DAEMON
-
-int tputs (str, zzz, func)
-	register char *str;
-	int zzz;
-	OutcPtr func;
-{
-	if (! str) {
-		return(0);
-	}
-	if (func == outchar) {
-		fputs (str, stdout);
-	} else {
-		while (*str) {
-			if (*str == '\n') {
-				func('\r');
-			}
-			func(*str++);
-		}
-	}
-	return(0);
-}
-
-#endif
-
-FILE *
-popen (
-	char *command,
-	char *mode)
-{
-	return ((FILE *) 0);
-}
-
-
-void
-pclose (FILE *pipe)
-{
-	return;
-}
-
-void tzset(void)
-{
-	return;
-}
-
-void
-make_post_cmd (cmd, name)
-	char *cmd;
-	char *name;
-{
-	char *p;
-
-	if ((p = getenv (ENV_VAR_POSTER)) != (char *) 0) {
-		sprintf (cmd, p, name);
-	} else {
-		sprintf (cmd, DEFAULT_POSTER, name);
-	}
-	return;
-}
-
-
-/*
- * Replacement for getchar() for Prof. Davis' C programming class
- *
- * V1.0-00 - 10-Jan-93 - tmk - Original version
- */
-
-int ReadCh(void)
-{
-  $DESCRIPTOR(tt_name,"SYS$INPUT");
-  static int __sgetchar_first_time=1;
-  static short __sgetchar_channel, iosb[4];
-  static char __sgetchar_char[8];
-  static int __sgetchar_status;
-#ifdef DEBUG_READCH
-  static int dribble_fd;
-#endif
-
-  if (__sgetchar_first_time) {
-    __sgetchar_status = sys$assign(&tt_name, &__sgetchar_channel, 0, 0);
-    if (__sgetchar_status != SS$_NORMAL) {
-      printf("sgetchar() error %08x from SYS$ASSIGN\n", __sgetchar_status);
-      exit(__sgetchar_status);
-    }
-#ifdef DEBUG_READCH
-    if ((dribble_fd = open("dribble.dat", O_WRONLY|O_CREAT, 0777)) == -1) {
-      perror("dribble.dat");
-      exit(0);
-    }
-#endif
-    __sgetchar_first_time = 0;
-  }
-
- requeue:
-  __sgetchar_status = sys$qiow(0, __sgetchar_channel,
-			       IO$_READVBLK|IO$M_NOFILTR|IO$M_NOECHO,
-			       iosb, 0, 0, __sgetchar_char, 1, 0, 0, 0, 0);
-
-  if (__sgetchar_status != SS$_NORMAL) {
-    printf("sgetchar() error %08x from SYS$QIOW\n", __sgetchar_status);
-    exit(__sgetchar_status);
-  }
-
-  if ((iosb[0] & 7) != 1) {
-    printf("iosb[0] == %04X\n", iosb[0]);
-    goto requeue;
-  }
-
-#ifdef DEBUG_READCH
-  write(dribble_fd, __sgetchar_char, 1);
-#endif
-  if (__sgetchar_char[0] == 26)
-    return(EOF);
-  else
-    return(__sgetchar_char[0] & 0xFF);
-}
-
-/* fwrite to stdout is S L O W.  Speed it up by using fputc...*/
-#ifdef VAXC
-size_t sys_fwrite (void *ptr, size_t size_of_item,
-		   size_t number_items, FILE *file_ptr)
-{
-  register int tot = number_items * size_of_item;
-
-  while (tot--)
-    fputc (*((char *)ptr)++, file_ptr);
-}
-#else /* not VAXC */
-#ifdef USE_EMACS_SYSFWRITE
-void sys_fwrite (ptr, size, num, fp)
-     register char * ptr;
-     int size;
-     int num;
-     FILE * fp;
-{
-  register int tot = num * size;
-
-  while (tot--)
-    fputc (*ptr++, fp);
-}
-#else
-void sys_fwrite (ptr, size, num, fp)
-     register char * ptr;
-     int size;
-     int num;
-     FILE * fp;
-{
-  register int tot = num * size;
-
-  fflush(fp);
-  write(fileno(fp), ptr, tot);
-}
-#endif
-#endif /* not VAXC */
-
-#ifdef USE_SFGETS
-char *Sfgets(char *s, int n, int fd)
-{
-  register c;
-  register char *cs;
-
-  cs = s;
-  while (--n>0 && (c = Sgetchar(fd)) != SIO_EOF) {
-                *cs++ = c;
-                if (c=='\n')
-                        break;
-        }
-        if (c == SIO_EOF && cs == s)
-                return(NULL);
-        *cs++ = '\0';
-        return(s);
-}
-#endif
-
-#endif /* VMS */
diff -Nur tin-980117/src/win32.c tin-980202/src/win32.c
--- tin-980117/src/win32.c	Fri Dec 26 03:45:13 1997
+++ tin-980202/src/win32.c	Thu Jan  1 01:00:00 1970
@@ -1,691 +0,0 @@
-/*
- *  Project   : tin - a Usenet reader
- *  Module    : win32.c
- *  Author    : S. Lam, D. Derbyshire, T. Loebach, N. Ellis, P. Haken
- *  Created   : 01-06-87
- *  Updated   : 10-17-94
- *  Notes     : Berkeley-style directory reading routine on Windows NT
- *				Console <-> Curses mapping layer.
- *  Copyright : (c) Copyright 1987-94 by Sam Lam, Drew Derbyshire, Tom Loebach
- *              You may  freely  copy or  redistribute  this software,
- *              so  long as there is no profit made from its use, sale
- *              trade or  reproduction.  You may not change this copy-
- *              right notice, and it must be included in any copy made
- */
-
-#include "tin.h"
-
-#if defined(WIN32)
-
-/*
- * Windows/NT include files
- */
-
-#define INCL_BASE
-
-#include <time.h>
-
-#ifdef ERR
-#undef ERR
-#endif
-
-#define ERR(s, c)	if (opterr) {\
-	    fprintf(stderr, "%s%s%c\n", argv[0], s, c);}
-
-int currentfile ();
-
-typedef struct
-	{
-	DIR dir;
-	char *pathname;
-	HANDLE dirHandle;
-	WIN32_FIND_DATA dirData;
-	} XDIR;
-
-BOOL inverse_okay = TRUE;
-BOOL _hp_glitch = FALSE;
-
-char TMPDIR[MAX_PATH];
-
-int opterr = 1;
-int optind = 1;
-int optopt;
-char *optarg;
-
-struct passwd no_pw={0};
-char szHomeDir[MAX_PATH];
-
-static int curX, curY;
-static WORD curAttr, baseAttr;
-
-int cLINES, cCOLS;
-
-int raw=TRUE;
-
-static HANDLE hConIn, hConOut;
-static CONSOLE_SCREEN_BUFFER_INFO csInfo;
-
-/*
- * Open a directory
- */
-
-DIR *opendirx (const char *dirname, char *pattern)
-{
-	XDIR *dirp;
-	char *pathname;
-	HANDLE dirHandle;
-	WIN32_FIND_DATA dirData;
-
-	pathname = malloc (strlen (dirname) + strlen (pattern) + 2);
-	strcpy (pathname, dirname);
-	if ((*pattern != '\\') || (dirname[strlen (dirname) - 1] != '\\'))
-	{
-		strcat (pathname, "\\");
-	}
-	strcat (pathname, pattern);	// Read the first file in the directory
-
-	dirHandle = FindFirstFile (pathname, &dirData);
-	if ((int) dirHandle == -1)
-	{
-		return NULL;
-	}
-	else
-	{
-		dirp = malloc (sizeof (XDIR));
-		dirp->dir.dirfirst = 1;
-		strcpy (dirp->dir.dirid, "DIR");
-		dirp->dirHandle = dirHandle;
-		dirp->dirData = dirData;
-		dirp->pathname = pathname;
-		return (DIR *) dirp;
-	}
-}
-/*
- * Get next entry in a directory
- */
-struct direct *readdir (DIR * dirp)
-{
-	BOOL rc;
-	XDIR *xdirp = (XDIR *) dirp;
-
-	assert (strcmp (xdirp->dir.dirid, "DIR") == 0);
-	if (xdirp->dir.dirfirst)
-	{
-		xdirp->dir.dirfirst = 0;
-	}
-	else
-	{
-		rc = FindNextFile (xdirp->dirHandle, &xdirp->dirData);
-	}
-	if (! strcmp (xdirp->dirData.cFileName, "."))
-	{
-		rc = FindNextFile (xdirp->dirHandle, &xdirp->dirData);
-	}
-	if (! strcmp (xdirp->dirData.cFileName, ".."))
-	{
-		rc = FindNextFile (xdirp->dirHandle, &xdirp->dirData);
-	}
-	if (rc)
-	{
-		xdirp->dir.dirent.d_ino = -1;	/*
-									 * no inode information
-									 */
-		strlwr (strcpy (xdirp->dir.dirent.d_name, xdirp->dirData.cFileName));
-		xdirp->dir.dirent.d_namlen = strlen (xdirp->dirData.cFileName);
-		xdirp->dir.dirent.d_reclen = sizeof (struct direct) - (MAXNAMLEN + 1) +
-		    ((((xdirp->dir.dirent.d_namlen + 1) + 3) / 4) * 4);
-
-		return &(xdirp->dir.dirent);
-	}
-	else
-	{
-		return NULL;
-	}
-}
-/*
- * Close a directory
- */
-void closedir (DIR * dirp)
-{
-	BOOL rc;
-	XDIR *xdirp = (XDIR *) dirp;
-
-	assert (strcmp (xdirp->dir.dirid, "DIR") == 0);
-	rc = FindClose (xdirp->dirHandle);
-	free (xdirp->pathname);
-	free (xdirp);
-	dirp = NULL;
-}
-
-
-char getopt (int argc, char *argv[], char *opts)
-{
-	static int sp = 1;
-	register int c;
-	register char *cp;
-
-	if (sp == 1)
-		if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0')
-			return (EOF);
-		else if (strcmp (argv[optind], "--") == 0)
-		{
-			optind++;
-			return (EOF);
-		}
-	optopt = c = argv[optind][sp];
-	if (c == ':' || (cp = strchr (opts, c)) == NULL)
-	{
-		ERR (": illegal option -- ", c);
-		if (argv[optind][++sp] == '\0')
-		{
-			optind++;
-			sp = 1;
-		}
-		return ('?');
-	}
-	if (*++cp == ':')
-	{
-		if (argv[optind][sp + 1] != '\0')
-			optarg = &argv[optind++][sp + 1];
-		else if (++optind >= argc)
-		{
-			ERR (": option requires an argument -- ", c);
-			sp = 1;
-			return ('?');
-		}
-		else
-			optarg = argv[optind++];
-		sp = 1;
-	}
-	else
-	{
-		if (argv[optind][++sp] == '\0')
-		{
-			sp = 1;
-			optind++;
-		}
-		optarg = NULL;
-	}
-	return (c);
-}
-/*
- * joinpath tacks a file (or sub dir) on to the end of a directory name.
- * Have to check existing / or \ to avoid doubling them.
- */
-
-void joinpath ( char *str, char *dir, char *file)
-{
-	char c;
-	struct passwd *pw;
-
-	if (strlen (dir) == 0)
-	{
-		strcpy (str, file);
-		return;
-	}
-
-	if (file[0] == '.')
-		file++;
-
-	if (dir[0] == '~')
-	{
-		if (no_pw.pw_dir == NULL)
-			pw = getpwnam(getlogin());
-		else
-			pw = &no_pw;
-
-		strcpy(str, pw->pw_dir);
-		dir++;
-		str += strlen(str);
-	}
-
-	c = dir[strlen (dir) - 1];
-	if (c == '/' || c == '\\')
-	{
-		sprintf (str, "%s%s", dir, file);
-	}
-	else
-	{
-		sprintf (str, "%s\\%s", dir, file);
-	}
-}
-
-int make_post_cmd ( char *cmd, char *name)
-{
-	char *p;
-
-	if ((p = getenv (ENV_VAR_POSTER)) != (char *) 0)
-	{
-		sprintf (cmd, p, name);
-	}
-	else
-	{
-		sprintf (cmd, DEFAULT_POSTER, name);
-	}
-
-	return 0;
-}
-
-long getpid () { return GetCurrentProcessId (); }
-int getgid ()	{ return 1; }
-int getuid ()	{ return 1; }
-int setgid (int id)	{ return 1; }
-int setuid (int id)	{ return 1; }
-int getegid ()	{ return 1; }
-int geteuid ()	{ return 1; }
-
-#pragma warning( disable: 4035 )
-struct passwd *getpwuid(int id)
-{
-	fprintf(stderr, "\nYou must set the environment variable USERNAME");
-	exit(1);
-}
-#pragma warning( default: 4035 )
-
-char * getlogin (void)
-{
-	return getenv("USERNAME");
-}
-
-
-struct passwd * getpwnam ( const char *name)
-{
-	char *env;
-
-	if ( !(env=getenv("USERNAME")) )
-	{
-		fprintf(stderr, "\nYou must set the environment variable USERNAME");
-		exit(1);
-	}
-
-	no_pw.pw_name = no_pw.pw_gecos = env;
-
-	if ( !(env=getenv("HOMEDRIVE")) )
-	{
-		fprintf(stderr, "\nYou must set the environment variable HOMEDRIVE");
-		exit(1);
-	}
-	strcpy(szHomeDir, env);
-
-	if ( !(env=getenv("HOMEPATH")) )
-	{
-		fprintf(stderr, "\nYou must set the environment variable HOMEPATH");
-		exit(1);
-	}
-	strcat(szHomeDir, env);
-	no_pw.pw_dir = szHomeDir;
-
-	return &no_pw;
-}
-
-
-void setup_screen()
-{
-	int cols, lines;
-
-	cmd_line = FALSE;
-//	setupterm();
-	cols = cCOLS;
-	lines = cLINES;
-	ClearScreen();
-	set_win_size(&lines,&cols);
-	refresh();
-}
-
-void set_xclick_on()
-{
-}
-
-void set_xclick_off()
-{
-}
-
-
-// Curses functionality
-
-void cursoron(void)
-{
-	CONSOLE_CURSOR_INFO ccinfo;
-
-	if (GetConsoleCursorInfo(hConOut, &ccinfo))
-		{
-		ccinfo.bVisible = TRUE;
-		SetConsoleCursorInfo(hConOut, &ccinfo);
-		}
-}
-
-void cursoroff(void)
-{
-	CONSOLE_CURSOR_INFO ccinfo;
-
-	if (GetConsoleCursorInfo(hConOut, &ccinfo))
-		{
-		ccinfo.bVisible = FALSE;
-		SetConsoleCursorInfo(hConOut, &ccinfo);
-		}
-}
-
-void GetConsoleCursorPosition(HANDLE hCon, COORD *pCoord)
-{
-	CONSOLE_SCREEN_BUFFER_INFO csbi;
-	assert(pCoord);
-
-	GetConsoleScreenBufferInfo( hCon, &csbi);
-	*pCoord = csbi.dwCursorPosition;
-}
-
-void StartInverse(void)
-{
-	curAttr = baseAttr;
-	ToggleInverse();
-}
-
-void EndInverse(void)
-{
-	curAttr = baseAttr;
-	SetConsoleTextAttribute(hConOut, curAttr);
-}
-
-void ToggleInverse(void)
-{
-	short color = curAttr & 0x00FF;
-	curAttr = (curAttr & 0xFF00) | (color >> 4) | ((color & 0x000F) << 4);
-
-	SetConsoleTextAttribute(hConOut, curAttr);
-}
-
-
-void MoveCursor(int y, int x)
-{
-	COORD dwOrigin;
-	dwOrigin.X = curX = x;
-	dwOrigin.Y = curY = y;
-	SetConsoleCursorPosition (hConOut, dwOrigin);
-}
-
-void addch(UCHAR c)
-{
-	assert(hConOut != NULL);
-
-	switch(c)
-	{
-		case '\n':
-			MoveCursor(curY+1, curX);
-			break;
-
-		case '\r':
-			MoveCursor(curY, 0);
-			break;
-
-		case '\b':
-			if (curX>0)
-				MoveCursor(curY, curX-1);
-			break;
-
-		default:
-			{
-				DWORD cchWritten;
-
-				WriteConsole(hConOut, &c, 1, &cchWritten, NULL);
-				if (curX++ >= cCOLS)
-				{
-					curX = 0;
-					curY++;
-				}
-			}
-			break;
-	}
-}
-
-
-// Print a line of text and draw to the end of the line
-#undef addline
-void addline (unsigned char *lpszStr)
-{
-	DWORD cchWritten;
-	COORD pt;
-	INT ich = strlen(lpszStr);
-
-	if (lpszStr[ich - 2] == '\r')
-		ich -= 2;
-
-	assert(hConOut != NULL);
-
-	WriteConsole(hConOut, lpszStr, ich, &cchWritten, NULL);
-
-	GetConsoleCursorPosition(hConOut, &pt);
-	MoveCursor( pt.Y, pt.X);
-
-	CleartoEOLN();
-}
-
-void addstr(unsigned char *lpszStr)
-{
-	DWORD cchWritten;
-	COORD pt;
-
-	assert(hConOut != NULL);
-
-	WriteConsole(hConOut, lpszStr, strlen(lpszStr), &cchWritten, NULL);
-
-	GetConsoleCursorPosition(hConOut, &pt);
-	MoveCursor( pt.Y, pt.X);
-}
-
-void CleartoEOS(void)
-{
-	CONSOLE_SCREEN_BUFFER_INFO csInfo;
-	DWORD cCharCells;	/* number of character cells to write to	*/
-	COORD coordChar;	/* x- and y-coordinates of first cell	*/
-	DWORD cWritten;
-
-	coordChar.X = 0;
-	coordChar.Y = curY;
-
-	cCharCells = cCOLS * (cLINES+1-curY);
-
-	GetConsoleScreenBufferInfo (hConOut, &csInfo);
-
-	baseAttr = curAttr = csInfo.wAttributes;
-
-	FillConsoleOutputCharacter(hConOut, ' ',     cCharCells, coordChar, &cWritten);
-	FillConsoleOutputAttribute(hConOut, curAttr, cCharCells, coordChar, &cWritten);
-}
-
-void CleartoEOLN(void)
-{
-	DWORD cCharCells;	/* number of character cells to write to	*/
-	COORD coordChar;	/* x- and y-coordinates of first cell	*/
-	DWORD cWritten;
-
-	coordChar.X = curX;
-	coordChar.Y = curY;
-
-	cCharCells = cCOLS - curX;
-
-	FillConsoleOutputCharacter(hConOut, ' ',     cCharCells, coordChar, &cWritten);
-	FillConsoleOutputAttribute(hConOut, curAttr, cCharCells, coordChar, &cWritten);
-}
-
-
-int InitScreen(void)
-{
-	hConIn = GetStdHandle (STD_INPUT_HANDLE);
-	hConOut = GetStdHandle (STD_OUTPUT_HANDLE);
-
-	GetConsoleScreenBufferInfo (hConOut, &csInfo);
-
-	baseAttr = curAttr = csInfo.wAttributes;
-#ifdef USE_WINDOW_BUFFER_SIZE
-	cLINES = csInfo.dwSize.Y - 1;
-	cCOLS = csInfo.dwSize.X;
-#else
-	{
-	COORD wCoord;
-
-	cLINES = csInfo.srWindow.Bottom - csInfo.srWindow.Top;
-	cCOLS = csInfo.srWindow.Right - csInfo.srWindow.Left + 1;
-	wCoord.Y = cLINES;
-	wCoord.X = cCOLS;
-	SetConsoleScreenBufferSize (hConOut, wCoord);
-	}
-#endif
-
-	return -1;
-}
-
-void ClearScreen(void)
-{
-	MoveCursor( 0,0 );
-	CleartoEOS();
-}
-
-void refresh(void)
-{
-}
-
-void InitWin(void)
-{
-}
-
-void EndWin(void)
-{
-#ifndef USE_WINDOW_BUFFER_SIZE
-	COORD wCoord;
-
-	wCoord.Y = csInfo.dwSize.Y;
-	wCoord.X = csInfo.dwSize.X;
-	SetConsoleScreenBufferSize (hConOut, wCoord);
-#endif
-}
-
-int RawState(void)
-{
-	return raw;
-}
-
-void Raw(int f)
-{
-	raw = f;
-}
-
-int ReadCh (void)
-{
-	INPUT_RECORD irBuffer;
-	DWORD cRead;
-	BOOL fOkay;
-
-	DWORD dwMode;
-	DWORD dwModeSave = 0L;
-
-	assert(hConIn != NULL);
-
-	if (GetConsoleMode (hConIn, &dwMode))
-	{
-		dwModeSave = dwMode;
-		dwMode &= ~ENABLE_LINE_INPUT;
-		if (raw)
-			dwMode &= ~ENABLE_ECHO_INPUT;
-		SetConsoleMode (hConIn, dwMode);
-	}
-
-	do
-	{
-		WaitForSingleObject( hConIn, INFINITE );
-		fOkay = ReadConsoleInput( hConIn, &irBuffer, 1, &cRead);
-	} while(
-		(irBuffer.EventType != KEY_EVENT) ||
-		(!irBuffer.Event.KeyEvent.bKeyDown) ||
-		((irBuffer.Event.KeyEvent.wVirtualKeyCode >= VK_SHIFT) &&
-		(irBuffer.Event.KeyEvent.wVirtualKeyCode <= VK_CAPITAL)) );
-
-	if (dwModeSave)
-		SetConsoleMode (hConIn, dwModeSave);
-
-	if (irBuffer.Event.KeyEvent.uChar.AsciiChar)
-	{
-		return (char) irBuffer.Event.KeyEvent.uChar.AsciiChar;
-	}
-	else
-	{
-		if ((irBuffer.Event.KeyEvent.wVirtualKeyCode > VK_SPACE) &&
-			(irBuffer.Event.KeyEvent.wVirtualKeyCode < VK_HELP))
-		{
-			return (char) irBuffer.Event.KeyEvent.wVirtualKeyCode | 0x80;
-		}
-		else
-		{
-			return irBuffer.Event.KeyEvent.wVirtualKeyCode;
-		}
-	}
-}
-
-/*
- * Rename, clobber the new file if it exists.
- */
-int win32rename(char *src, char *dest)
-	{
-	if (MoveFile(src,dest))
-		return 0;
-	else
-		{
-		int rc=GetLastError();
-		return -1;
-		}
-	}
-
-/*
- * Stuff for handling NT's inability to unlink an open file...  Grabbed from
- * AMI sources.
- */
-
-#define NUM_TEMP_FP 6
-static struct {
-    FILE *fp;
-    char name[PATH_LEN];
-} temp_fp[NUM_TEMP_FP];
-
-void log_unlink(FILE *fp, char *fname)
-{   int i;
-    for (i=0; i<NUM_TEMP_FP; i++) {
-        if (temp_fp[i].fp == (FILE *) 0) {
-            temp_fp[i].fp = fp;
-            strcpy (temp_fp[i].name, fname);
-            break;
-        }
-    }
-}
-
-#undef fclose
-
-int
-tmp_close(FILE *fp)
-{   int i, ret;
-
-    ret = fclose(fp);
-    for (i=0; i<NUM_TEMP_FP; i++) {
-        if (temp_fp[i].fp == fp) {
-            unlink (temp_fp[i].name);
-            temp_fp[i].fp = (FILE *) 0;
-            break;
-        }
-    }
-    return ret;
-}
-
-
-#ifdef DEBUG
-void DebugAssertDialog(LPSTR szMessage, DWORD dwLine, LPSTR szFile)
-	{
-	char szMessageBuf[256];
-	UINT uType;
-
-	sprintf(szMessageBuf, "%s at line %ld of %s", szMessage, dwLine, szFile);
-
-	uType = MB_SYSTEMMODAL | MB_ICONSTOP | MB_OKCANCEL;
-	if (MessageBox(NULL, (LPTSTR) szMessageBuf, (LPTSTR) "Assert Failed", uType) == IDCANCEL)
-    	DebugBreak();
-	}
-#endif
-
-#endif /* WIN32 */
diff -Nur tin-980117/src/win32tcp.c tin-980202/src/win32tcp.c
--- tin-980117/src/win32tcp.c	Fri Dec 26 03:45:13 1997
+++ tin-980202/src/win32tcp.c	Thu Jan  1 01:00:00 1970
@@ -1,110 +0,0 @@
-/*
- *  Project   : tin - a Usenet reader
- *  Module    : win32tcp.c
- *  Author    : N.Ellis
- *  Created   : 01-10-94
- *  Updated   : 07-11-94
- *  Notes     :
- *  Copyright : (c) Copyright 1991-94 by Nigel Ellis
- *              You may  freely  copy or  redistribute  this software,
- *              so  long as there is no profit made from its use, sale
- *              trade or  reproduction.  You may not change this copy-
- *              right notice, and it must be included in any copy made
- */
-
-#include "tin.h"
-
-#if defined(WIN32) && defined(NNTP_ABLE)
-
-#include "win32tcp.h"
-#include <winsock.h>
-
-#define	cmemBlock	(8*1024)
-static char memBlock[cmemBlock+4];
-static UINT imemBlock = 0;
-static UINT iendBlock = 0;
-
-static TCP mytcp;
-
-static int sock_dups;
-
-int s_init()
-{
-	WSADATA wsaData;
-	if ( WSAStartup( MAKEWORD(1,1), &wsaData) != 0)
-	{
-		return 0;
-	}
-	return 1;
-}
-
-TCP *s_fdopen(int s, const char *mode)
-{
-	mytcp.fd = s;
-	return &mytcp;
-}
-
-void s_fclose(TCP *tp)
-{
-	s_close(tp->fd);
-}
-
-void s_close(int s)
-{
-	if (--sock_dups[s] <= 0)
-		closesocket(s);
-}
-
-int s_dup(int fd)
-{
-	sock_dups[fd]++;
-	return fd;
-}
-
-char *s_gets(LPSTR nntp_line, DWORD length, TCP *tp)
-{
-	DWORD cbRead = 0, cb;
-	char *pEol;
-
-	if ( imemBlock == iendBlock )
-	{
-		pEol = 0;
-	}
-	else
-	{
-		pEol = strstr(memBlock+imemBlock, "\r\n");	/* search for a newline */
-		if (pEol > memBlock+iendBlock-2)			/* if one was found outside the buffer */
-			pEol = 0;								/* then we didn't really find one */
-	}
-
-	if ( !pEol)
-	{
-		iendBlock -= imemBlock;
-		if ( iendBlock)
-			memcpy( memBlock, memBlock+imemBlock, iendBlock );
-		imemBlock = 0;
-		do {
-			cbRead = recv( nntp_rd_fp, memBlock+iendBlock, cmemBlock - iendBlock, 0);
-			if (cbRead == 0 || cbRead == SOCKET_ERROR)
-			{	errno = SOCKET_ERROR;
-				return (char *)NULL;
-			}
-
-			iendBlock += cbRead;
-
-			pEol = strstr(memBlock, "\r\n");				// search for a newline
-		} while( pEol > memBlock+iendBlock-2);
-	}
-
-	cb = pEol - (memBlock+imemBlock);
-
-	memcpy (nntp_line, memBlock+imemBlock, cb);
-	nntp_line[cb] = '\0';
-	imemBlock += cb + 2;
-
-	assert(imemBlock<=iendBlock);
-
-	return nntp_line;
-}
-
-#endif /* WIN32 */
diff -Nur tin-980117/tools/metamutt tin-980202/tools/metamutt
--- tin-980117/tools/metamutt	Thu Jan  1 01:00:00 1970
+++ tin-980202/tools/metamutt	Thu Jan 22 15:02:22 1998
@@ -0,0 +1,44 @@
+#! /bin/sh
+#
+# $Id: metamutt,v 1.4 1998/01/20 11:04:25 roland Exp $
+#
+# This should become a replacement of metamail, using the mail reader
+# mutt. The options of metamail are not yet implemented, but it should
+# work as a filter without any problems.
+#
+# (c) 1997,98 Roland Rosenfeld <roland@spinnaker.rhein.de>
+#
+# Most recent version can be found at http://www.rhein.de/~roland/mutt/metamutt
+#
+
+TMP=/tmp/metamutt.$$
+trap "rm -f $TMP*; exit" 0 1 2 15
+
+# ignore options:
+for parameter 
+do
+    case $1 in 
+        -- ) shift; break;;
+        -e|-p ) shift;;
+        -m ) shift 2;;
+        * )  break;;
+    esac
+done
+
+# create special muttrc for metamutt:
+cat > $TMP-rc<<EOF
+source ~/.muttrc
+set pager_index_lines=0
+bind pager i quit
+bind pager q quit
+bind pager x quit
+bind index q quit
+push "\n"
+EOF
+
+# create a mbox message:
+echo "From PIPE `date`" > $TMP-mbox
+cat $* - | sed 's/^From />From /' >> $TMP-mbox
+
+# run mutt on mbox message with special muttrc:
+mutt -F $TMP-rc -R -f $TMP-mbox </dev/tty >/dev/tty
diff -Nur tin-980117/vms/dir.h tin-980202/vms/dir.h
--- tin-980117/vms/dir.h	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/dir.h	Thu Jun 15 02:28:34 1995
@@ -0,0 +1,109 @@
+/* GNU Emacs VMS directory definition file.
+   Copyright (C) 1986 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 1, or (at your option)
+any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs; see the file COPYING.  If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+/*
+ * Files-11 Ver. 2 directory structure (VMS V4.x - long names)
+ */
+#ifndef DIR$K_LENGTH
+
+#define	DIR$C_FID	0
+#define	DIR$C_LINKNAME	1
+#define	DIR$K_LENGTH	6
+#define	DIR$C_LENGTH	6
+#define	DIR$S_DIRDEF	6
+#define	DIR$W_SIZE	0
+#define	DIR$W_VERLIMIT	2
+#define	DIR$B_FLAGS	4
+#define	DIR$S_TYPE	3
+#define	DIR$V_TYPE	0
+#define	DIR$V_NEXTREC	6
+#define	DIR$V_PREVREC	7
+#define	DIR$B_NAMECOUNT	5
+#define	DIR$S_NAME	80
+#define	DIR$T_NAME	6
+
+#define	DIR$K_VERSION	8
+#define	DIR$C_VERSION	8
+#define	DIR$S_DIRDEF1	8
+#define	DIR$W_VERSION	0
+#define	DIR$S_FID	6
+#define	DIR$W_FID	2
+#define	DIR$W_FID_NUM	2
+#define	DIR$W_FID_SEQ	4
+#define	DIR$W_FID_RVN	6
+#define	DIR$B_FID_RVN	6
+#define	DIR$B_FID_NMX	7
+
+#define	DIR$S_DIRDEF2	1
+#define	DIR$T_LINKNAME	0
+
+typedef struct dir$_name {
+/*  short dir$w_size;		 if you read with RMS, it eats this... */
+  short dir$w_verlimit;			/* maximum number of versions */
+  union {
+    unsigned char dir_b_flags;
+#define dir$b_flags dir__b_flags.dir_b_flags
+    struct {
+      unsigned char dir_v_type: DIR$S_TYPE;
+#define dir$v_type dir__b_flags.dir___b_flags.dir_v_type
+      unsigned char: 3;
+      unsigned char dir_v_nextrec: 1;
+#define dir$v_nextrec dir__b_flags.dir___b_flags.dir_v_nextrec
+      unsigned char dir_v_prevrec: 1;
+#define dir$v_prevrec dir__b_flags.dir___b_flags.dir_v_prevrec
+    } dir___b_flags;
+  } dir__b_flags;
+  unsigned char dir$b_namecount;
+#if defined(__GNUC__)
+  char dir$t_name[0];
+#elif defined(__DECC)
+  char *dir$t_name;
+#else
+  char dir$t_name[];
+#endif
+} dir$_dirdef;		/* only the fixed first part */
+
+typedef struct dir$_version {
+  short dir$w_version;
+  short dir$w_fid_num;
+  short dir$w_fid_seq;
+  union {
+    short dir_w_fid_rvn;
+#define dir$w_fid_rvn dir__w_fid_rvn.dir_w_fid_rvn
+    struct {
+      char dir_b_fid_rvn;
+#define dir$b_fid_rvn dir__w_fid_rvn.dir___w_fid_rvn.dir_b_fid_rvn
+      char dir_b_fid_nmx;
+#define dir$b_fid_nmx dir__w_fid_rvn.dir___w_fid_rvn.dir_b_fid_nmx
+    } dir___w_fid_rvn;
+  } dir__w_fid_rvn;
+} dir$_dirdef1;		/* one for each version of the file */
+
+typedef
+struct dir$_linkname {
+#ifdef __GNUC__
+  char    dir$t_linkname[0];
+#elif __DECC
+  char    *dir$t_linkname;
+#else
+  char    dir$t_linkname[];
+#endif
+} dir$_dirdef2;
+
+#endif
diff -Nur tin-980117/vms/filetypes.h tin-980202/vms/filetypes.h
--- tin-980117/vms/filetypes.h	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/filetypes.h	Thu Jun 15 02:28:34 1995
@@ -0,0 +1,13 @@
+/* Define the symbols for various file types.
+   These are not included in POSIX.  */
+
+#ifndef S_IFMT
+#define	S_IFMT	0170000		/* type of file */
+#define S_IFDIR	0040000	/* directory */
+#define S_IFCHR	0020000	/* character special */
+#define S_IFBLK	0060000	/* block special */
+#define S_IFREG	0100000	/* regular */
+#define S_IFIFO	0010000	/* fifo */
+#define S_IFNAM 0050000 /* special named file */
+#endif /* not S_IFMT */
+
diff -Nur tin-980117/vms/getopt.c tin-980202/vms/getopt.c
--- tin-980117/vms/getopt.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/getopt.c	Thu Apr 13 23:25:32 1995
@@ -0,0 +1,755 @@
+/* Getopt for GNU.
+   NOTE: getopt is now part of the C library, so if you don't know what
+   "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
+   before changing it!
+
+   Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
+   	Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License
+   as published by the Free Software Foundation; either version 2, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef __STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+#ifndef const
+#define const
+#endif
+#endif
+
+/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.  */
+#ifndef _NO_PROTO
+#define _NO_PROTO
+#endif
+
+#include <stdio.h>
+#ifdef VMS
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+   actually compiling the library itself.  This code is part of the GNU C
+   Library, but also included in many other GNU distributions.  Compiling
+   and linking in this code is a waste when using the GNU C library
+   (especially if it is a shared library).  Rather than having every GNU
+   program understand `configure --with-gnu-libc' and omit the object files,
+   it is simpler to just do this in the source for each such file.  */
+
+#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
+
+
+/* This needs to come after some library #include
+   to get __GNU_LIBRARY__ defined.  */
+#ifdef	__GNU_LIBRARY__
+/* Don't include stdlib.h for non-GNU C libraries because some of them
+   contain conflicting prototypes for getopt.  */
+#include <stdlib.h>
+#endif	/* GNU C library.  */
+
+/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
+   long-named option.  Because this is not POSIX.2 compliant, it is
+   being phased out.  */
+/* #define GETOPT_COMPAT */
+
+/* This version of `getopt' appears to the caller like standard Unix `getopt'
+   but it behaves differently for the user, since it allows the user
+   to intersperse the options with the other arguments.
+
+   As `getopt' works, it permutes the elements of ARGV so that,
+   when it is done, all the options precede everything else.  Thus
+   all application programs are extended to handle flexible argument order.
+
+   Setting the environment variable POSIXLY_CORRECT disables permutation.
+   Then the behavior is completely standard.
+
+   GNU application programs can use a third alternative mode in which
+   they can distinguish the relative order of options and other arguments.  */
+
+#include "getopt.h"
+
+/* For communication from `getopt' to the caller.
+   When `getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when `ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+char *optarg = 0;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to `getopt'.
+
+   On entry to `getopt', zero means this is the first call; initialize.
+
+   When `getopt' returns EOF, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, `optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+/* XXX 1003.2 says this must be 1 before any call.  */
+int optind = 0;
+
+/* The next char to be scanned in the option-element
+   in which the last option character we returned was found.
+   This allows us to pick up the scan where we left off.
+
+   If this is zero, or a null string, it means resume the scan
+   by advancing to the next ARGV-element.  */
+
+static char *nextchar;
+
+/* Callers store zero here to inhibit the error message
+   for unrecognized options.  */
+
+int opterr = 1;
+
+/* Set to an option character which was unrecognized.
+   This must be initialized on some systems to avoid linking in the
+   system's own getopt implementation.  */
+
+int optopt = '?';
+
+/* Describe how to deal with options that follow non-option ARGV-elements.
+
+   If the caller did not specify anything,
+   the default is REQUIRE_ORDER if the environment variable
+   POSIXLY_CORRECT is defined, PERMUTE otherwise.
+
+   REQUIRE_ORDER means don't recognize them as options;
+   stop option processing when the first non-option is seen.
+   This is what Unix does.
+   This mode of operation is selected by either setting the environment
+   variable POSIXLY_CORRECT, or using `+' as the first character
+   of the list of option characters.
+
+   PERMUTE is the default.  We permute the contents of ARGV as we scan,
+   so that eventually all the non-options are at the end.  This allows options
+   to be given in any order, even with programs that were not written to
+   expect this.
+
+   RETURN_IN_ORDER is an option available to programs that were written
+   to expect options and other ARGV-elements in any order and that care about
+   the ordering of the two.  We describe each non-option ARGV-element
+   as if it were the argument of an option with character code 1.
+   Using `-' as the first character of the list of option characters
+   selects this mode of operation.
+
+   The special argument `--' forces an end of option-scanning regardless
+   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
+   `--' can cause `getopt' to return EOF with `optind' != ARGC.  */
+
+static enum
+{
+  REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+} ordering;
+
+#ifdef	__GNU_LIBRARY__
+/* We want to avoid inclusion of string.h with non-GNU libraries
+   because there are many ways it can cause trouble.
+   On some systems, it contains special magic macros that don't work
+   in GCC.  */
+#include <string.h>
+#define	my_index	strchr
+#else
+
+/* Avoid depending on library functions or files
+   whose names are inconsistent.  */
+
+char *getenv ();
+
+static char *
+my_index (str, chr)
+     const char *str;
+     int chr;
+{
+  while (*str)
+    {
+      if (*str == chr)
+	return (char *) str;
+      str++;
+    }
+  return 0;
+}
+
+/* If using GCC, we can safely declare strlen this way.
+   If not using GCC, it is ok not to declare it.
+   (Supposedly there are some machines where it might get a warning,
+   but changing this conditional to __STDC__ is too risky.)  */
+#ifdef __GNUC__
+#ifdef IN_GCC
+#include "gstddef.h"
+#else
+#include <stddef.h>
+#endif
+extern size_t strlen (const char *);
+#endif
+
+#endif				/* GNU C library.  */
+
+/* Handle permutation of arguments.  */
+
+/* Describe the part of ARGV that contains non-options that have
+   been skipped.  `first_nonopt' is the index in ARGV of the first of them;
+   `last_nonopt' is the index after the last of them.  */
+
+static int first_nonopt;
+static int last_nonopt;
+
+/* Exchange two adjacent subsequences of ARGV.
+   One subsequence is elements [first_nonopt,last_nonopt)
+   which contains all the non-options that have been skipped so far.
+   The other is elements [last_nonopt,optind), which contains all
+   the options processed since those non-options were skipped.
+
+   `first_nonopt' and `last_nonopt' are relocated so that they describe
+   the new indices of the non-options in ARGV after they are moved.  */
+
+static void
+exchange (argv)
+     char **argv;
+{
+  int bottom = first_nonopt;
+  int middle = last_nonopt;
+  int top = optind;
+  char *tem;
+
+  /* Exchange the shorter segment with the far end of the longer segment.
+     That puts the shorter segment into the right place.
+     It leaves the longer segment in the right place overall,
+     but it consists of two parts that need to be swapped next.  */
+
+  while (top > middle && middle > bottom)
+    {
+      if (top - middle > middle - bottom)
+	{
+	  /* Bottom segment is the short one.  */
+	  int len = middle - bottom;
+	  register int i;
+
+	  /* Swap it with the top part of the top segment.  */
+	  for (i = 0; i < len; i++)
+	    {
+	      tem = argv[bottom + i];
+	      argv[bottom + i] = argv[top - (middle - bottom) + i];
+	      argv[top - (middle - bottom) + i] = tem;
+	    }
+	  /* Exclude the moved bottom segment from further swapping.  */
+	  top -= len;
+	}
+      else
+	{
+	  /* Top segment is the short one.  */
+	  int len = top - middle;
+	  register int i;
+
+	  /* Swap it with the bottom part of the bottom segment.  */
+	  for (i = 0; i < len; i++)
+	    {
+	      tem = argv[bottom + i];
+	      argv[bottom + i] = argv[middle + i];
+	      argv[middle + i] = tem;
+	    }
+	  /* Exclude the moved top segment from further swapping.  */
+	  bottom += len;
+	}
+    }
+
+  /* Update records for the slots the non-options now occupy.  */
+
+  first_nonopt += (optind - last_nonopt);
+  last_nonopt = optind;
+}
+
+/* Scan elements of ARGV (whose length is ARGC) for option characters
+   given in OPTSTRING.
+
+   If an element of ARGV starts with '-', and is not exactly "-" or "--",
+   then it is an option element.  The characters of this element
+   (aside from the initial '-') are option characters.  If `getopt'
+   is called repeatedly, it returns successively each of the option characters
+   from each of the option elements.
+
+   If `getopt' finds another option character, it returns that character,
+   updating `optind' and `nextchar' so that the next call to `getopt' can
+   resume the scan with the following option character or ARGV-element.
+
+   If there are no more option characters, `getopt' returns `EOF'.
+   Then `optind' is the index in ARGV of the first ARGV-element
+   that is not an option.  (The ARGV-elements have been permuted
+   so that those that are not options now come last.)
+
+   OPTSTRING is a string containing the legitimate option characters.
+   If an option character is seen that is not listed in OPTSTRING,
+   return '?' after printing an error message.  If you set `opterr' to
+   zero, the error message is suppressed but we still return '?'.
+
+   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
+   so the following text in the same ARGV-element, or the text of the following
+   ARGV-element, is returned in `optarg'.  Two colons mean an option that
+   wants an optional arg; if there is text in the current ARGV-element,
+   it is returned in `optarg', otherwise `optarg' is set to zero.
+
+   If OPTSTRING starts with `-' or `+', it requests different methods of
+   handling the non-option ARGV-elements.
+   See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
+
+   Long-named options begin with `--' instead of `-'.
+   Their names may be abbreviated as long as the abbreviation is unique
+   or is an exact match for some defined option.  If they have an
+   argument, it follows the option name in the same ARGV-element, separated
+   from the option name by a `=', or else the in next ARGV-element.
+   When `getopt' finds a long-named option, it returns 0 if that option's
+   `flag' field is nonzero, the value of the option's `val' field
+   if the `flag' field is zero.
+
+   The elements of ARGV aren't really const, because we permute them.
+   But we pretend they're const in the prototype to be compatible
+   with other systems.
+
+   LONGOPTS is a vector of `struct option' terminated by an
+   element containing a name which is zero.
+
+   LONGIND returns the index in LONGOPT of the long-named option found.
+   It is only valid when a long-named option has been found by the most
+   recent call.
+
+   If LONG_ONLY is nonzero, '-' as well as '--' can introduce
+   long-named options.  */
+
+int
+_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+     const struct option *longopts;
+     int *longind;
+     int long_only;
+{
+  int option_index;
+
+  optarg = 0;
+
+  /* Initialize the internal data when the first call is made.
+     Start processing options with ARGV-element 1 (since ARGV-element 0
+     is the program name); the sequence of previously skipped
+     non-option ARGV-elements is empty.  */
+
+  if (optind == 0)
+    {
+      first_nonopt = last_nonopt = optind = 1;
+
+      nextchar = NULL;
+
+      /* Determine how to handle the ordering of options and nonoptions.  */
+
+      if (optstring[0] == '-')
+	{
+	  ordering = RETURN_IN_ORDER;
+	  ++optstring;
+	}
+      else if (optstring[0] == '+')
+	{
+	  ordering = REQUIRE_ORDER;
+	  ++optstring;
+	}
+      else if (getenv ("POSIXLY_CORRECT") != NULL)
+	ordering = REQUIRE_ORDER;
+      else
+	ordering = PERMUTE;
+    }
+
+  if (nextchar == NULL || *nextchar == '\0')
+    {
+      if (ordering == PERMUTE)
+	{
+	  /* If we have just processed some options following some non-options,
+	     exchange them so that the options come first.  */
+
+	  if (first_nonopt != last_nonopt && last_nonopt != optind)
+	    exchange ((char **) argv);
+	  else if (last_nonopt != optind)
+	    first_nonopt = optind;
+
+	  /* Now skip any additional non-options
+	     and extend the range of non-options previously skipped.  */
+
+	  while (optind < argc
+		 && (argv[optind][0] != '-' || argv[optind][1] == '\0')
+#ifdef GETOPT_COMPAT
+		 && (longopts == NULL
+		     || argv[optind][0] != '+' || argv[optind][1] == '\0')
+#endif				/* GETOPT_COMPAT */
+		 )
+	    optind++;
+	  last_nonopt = optind;
+	}
+
+      /* Special ARGV-element `--' means premature end of options.
+	 Skip it like a null option,
+	 then exchange with previous non-options as if it were an option,
+	 then skip everything else like a non-option.  */
+
+      if (optind != argc && !strcmp (argv[optind], "--"))
+	{
+	  optind++;
+
+	  if (first_nonopt != last_nonopt && last_nonopt != optind)
+	    exchange ((char **) argv);
+	  else if (first_nonopt == last_nonopt)
+	    first_nonopt = optind;
+	  last_nonopt = argc;
+
+	  optind = argc;
+	}
+
+      /* If we have done all the ARGV-elements, stop the scan
+	 and back over any non-options that we skipped and permuted.  */
+
+      if (optind == argc)
+	{
+	  /* Set the next-arg-index to point at the non-options
+	     that we previously skipped, so the caller will digest them.  */
+	  if (first_nonopt != last_nonopt)
+	    optind = first_nonopt;
+	  return EOF;
+	}
+
+      /* If we have come to a non-option and did not permute it,
+	 either stop the scan or describe it to the caller and pass it by.  */
+
+      if ((argv[optind][0] != '-' || argv[optind][1] == '\0')
+#ifdef GETOPT_COMPAT
+	  && (longopts == NULL
+	      || argv[optind][0] != '+' || argv[optind][1] == '\0')
+#endif				/* GETOPT_COMPAT */
+	  )
+	{
+	  if (ordering == REQUIRE_ORDER)
+	    return EOF;
+	  optarg = argv[optind++];
+	  return 1;
+	}
+
+      /* We have found another option-ARGV-element.
+	 Start decoding its characters.  */
+
+      nextchar = (argv[optind] + 1
+		  + (longopts != NULL && argv[optind][1] == '-'));
+    }
+
+  if (longopts != NULL
+      && ((argv[optind][0] == '-'
+	   && (argv[optind][1] == '-' || long_only))
+#ifdef GETOPT_COMPAT
+	  || argv[optind][0] == '+'
+#endif				/* GETOPT_COMPAT */
+	  ))
+    {
+      const struct option *p;
+      char *s = nextchar;
+      int exact = 0;
+      int ambig = 0;
+      const struct option *pfound = NULL;
+      int indfound;
+
+      while (*s && *s != '=')
+	s++;
+
+      /* Test all options for either exact match or abbreviated matches.  */
+      for (p = longopts, option_index = 0; p->name;
+	   p++, option_index++)
+	if (!strncmp (p->name, nextchar, s - nextchar))
+	  {
+	    if (s - nextchar == strlen (p->name))
+	      {
+		/* Exact match found.  */
+		pfound = p;
+		indfound = option_index;
+		exact = 1;
+		break;
+	      }
+	    else if (pfound == NULL)
+	      {
+		/* First nonexact match found.  */
+		pfound = p;
+		indfound = option_index;
+	      }
+	    else
+	      /* Second nonexact match found.  */
+	      ambig = 1;
+	  }
+
+      if (ambig && !exact)
+	{
+	  if (opterr)
+	    fprintf (stderr, "%s: option `%s' is ambiguous\n",
+		     argv[0], argv[optind]);
+	  nextchar += strlen (nextchar);
+	  optind++;
+	  return '?';
+	}
+
+      if (pfound != NULL)
+	{
+	  option_index = indfound;
+	  optind++;
+	  if (*s)
+	    {
+	      /* Don't test has_arg with >, because some C compilers don't
+		 allow it to be used on enums.  */
+	      if (pfound->has_arg)
+		optarg = s + 1;
+	      else
+		{
+		  if (opterr)
+		    {
+		      if (argv[optind - 1][1] == '-')
+			/* --option */
+			fprintf (stderr,
+				 "%s: option `--%s' doesn't allow an argument\n",
+				 argv[0], pfound->name);
+		      else
+			/* +option or -option */
+			fprintf (stderr,
+			     "%s: option `%c%s' doesn't allow an argument\n",
+			     argv[0], argv[optind - 1][0], pfound->name);
+		    }
+		  nextchar += strlen (nextchar);
+		  return '?';
+		}
+	    }
+	  else if (pfound->has_arg == 1)
+	    {
+	      if (optind < argc)
+		optarg = argv[optind++];
+	      else
+		{
+		  if (opterr)
+		    fprintf (stderr, "%s: option `%s' requires an argument\n",
+			     argv[0], argv[optind - 1]);
+		  nextchar += strlen (nextchar);
+		  return optstring[0] == ':' ? ':' : '?';
+		}
+	    }
+	  nextchar += strlen (nextchar);
+	  if (longind != NULL)
+	    *longind = option_index;
+	  if (pfound->flag)
+	    {
+	      *(pfound->flag) = pfound->val;
+	      return 0;
+	    }
+	  return pfound->val;
+	}
+      /* Can't find it as a long option.  If this is not getopt_long_only,
+	 or the option starts with '--' or is not a valid short
+	 option, then it's an error.
+	 Otherwise interpret it as a short option.  */
+      if (!long_only || argv[optind][1] == '-'
+#ifdef GETOPT_COMPAT
+	  || argv[optind][0] == '+'
+#endif				/* GETOPT_COMPAT */
+	  || my_index (optstring, *nextchar) == NULL)
+	{
+	  if (opterr)
+	    {
+	      if (argv[optind][1] == '-')
+		/* --option */
+		fprintf (stderr, "%s: unrecognized option `--%s'\n",
+			 argv[0], nextchar);
+	      else
+		/* +option or -option */
+		fprintf (stderr, "%s: unrecognized option `%c%s'\n",
+			 argv[0], argv[optind][0], nextchar);
+	    }
+	  nextchar = (char *) "";
+	  optind++;
+	  return '?';
+	}
+    }
+
+  /* Look at and handle the next option-character.  */
+
+  {
+    char c = *nextchar++;
+    char *temp = my_index (optstring, c);
+
+    /* Increment `optind' when we start to process its last character.  */
+    if (*nextchar == '\0')
+      ++optind;
+
+    if (temp == NULL || c == ':')
+      {
+	if (opterr)
+	  {
+#if 0
+	    if (c < 040 || c >= 0177)
+	      fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
+		       argv[0], c);
+	    else
+	      fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c);
+#else
+	    /* 1003.2 specifies the format of this message.  */
+	    fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
+#endif
+	  }
+	optopt = c;
+	return '?';
+      }
+    if (temp[1] == ':')
+      {
+	if (temp[2] == ':')
+	  {
+	    /* This is an option that accepts an argument optionally.  */
+	    if (*nextchar != '\0')
+	      {
+		optarg = nextchar;
+		optind++;
+	      }
+	    else
+	      optarg = 0;
+	    nextchar = NULL;
+	  }
+	else
+	  {
+	    /* This is an option that requires an argument.  */
+	    if (*nextchar != '\0')
+	      {
+		optarg = nextchar;
+		/* If we end this ARGV-element by taking the rest as an arg,
+		   we must advance to the next element now.  */
+		optind++;
+	      }
+	    else if (optind == argc)
+	      {
+		if (opterr)
+		  {
+#if 0
+		    fprintf (stderr, "%s: option `-%c' requires an argument\n",
+			     argv[0], c);
+#else
+		    /* 1003.2 specifies the format of this message.  */
+		    fprintf (stderr, "%s: option requires an argument -- %c\n",
+			     argv[0], c);
+#endif
+		  }
+		optopt = c;
+		if (optstring[0] == ':')
+		  c = ':';
+		else
+		  c = '?';
+	      }
+	    else
+	      /* We already incremented `optind' once;
+		 increment it again when taking next ARGV-elt as argument.  */
+	      optarg = argv[optind++];
+	    nextchar = NULL;
+	  }
+      }
+    return c;
+  }
+}
+
+int
+getopt (argc, argv, optstring)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+{
+  return _getopt_internal (argc, argv, optstring,
+			   (const struct option *) 0,
+			   (int *) 0,
+			   0);
+}
+
+#endif	/* _LIBC or not __GNU_LIBRARY__.  */
+
+#ifdef TEST
+
+/* Compile with -DTEST to make an executable for use in testing
+   the above definition of `getopt'.  */
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+
+      c = getopt (argc, argv, "abc:d:0123456789");
+      if (c == EOF)
+	break;
+
+      switch (c)
+	{
+	case '0':
+	case '1':
+	case '2':
+	case '3':
+	case '4':
+	case '5':
+	case '6':
+	case '7':
+	case '8':
+	case '9':
+	  if (digit_optind != 0 && digit_optind != this_option_optind)
+	    printf ("digits occur in two different argv-elements.\n");
+	  digit_optind = this_option_optind;
+	  printf ("option %c\n", c);
+	  break;
+
+	case 'a':
+	  printf ("option a\n");
+	  break;
+
+	case 'b':
+	  printf ("option b\n");
+	  break;
+
+	case 'c':
+	  printf ("option c with value `%s'\n", optarg);
+	  break;
+
+	case '?':
+	  break;
+
+	default:
+	  printf ("?? getopt returned character code 0%o ??\n", c);
+	}
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+	printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
diff -Nur tin-980117/vms/getopt.h tin-980202/vms/getopt.h
--- tin-980117/vms/getopt.h	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/getopt.h	Wed Nov 26 01:24:32 1997
@@ -0,0 +1,131 @@
+/* Declarations for getopt.
+   Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License
+   as published by the Free Software Foundation; either version 2, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#ifndef __UNISTD_LOADED
+#ifndef _GETOPT_H
+#define _GETOPT_H 1
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/* For communication from `getopt' to the caller.
+   When `getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when `ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+extern char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to `getopt'.
+
+   On entry to `getopt', zero means this is the first call; initialize.
+
+   When `getopt' returns EOF, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, `optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+extern int optind;
+
+/* Callers store zero here to inhibit the error message `getopt' prints
+   for unrecognized options.  */
+
+extern int opterr;
+
+/* Set to an option character which was unrecognized.  */
+
+extern int optopt;
+
+/* Describe the long-named options requested by the application.
+   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
+   of `struct option' terminated by an element containing a name which is
+   zero.
+
+   The field `has_arg' is:
+   no_argument		(or 0) if the option does not take an argument,
+   required_argument	(or 1) if the option requires an argument,
+   optional_argument 	(or 2) if the option takes an optional argument.
+
+   If the field `flag' is not NULL, it points to a variable that is set
+   to the value given in the field `val' when the option is found, but
+   left unchanged if the option is not found.
+
+   To have a long-named option do something other than set an `int' to
+   a compiled-in constant, such as set a value from `optarg', set the
+   option's `flag' field to zero and its `val' field to a nonzero
+   value (the equivalent single-letter option character, if there is
+   one).  For long options that have a zero `flag' field, `getopt'
+   returns the contents of the `val' field.  */
+
+struct option
+{
+#if	__STDC__
+  const char *name;
+#else
+  char *name;
+#endif
+  /* has_arg can't be an enum because some compilers complain about
+     type mismatches in all the code that assumes it is an int.  */
+  int has_arg;
+  int *flag;
+  int val;
+};
+
+/* Names for the values of the `has_arg' field of `struct option'.  */
+
+#define	no_argument		0
+#define required_argument	1
+#define optional_argument	2
+
+#if __STDC__
+#if defined(__GNU_LIBRARY__)
+/* Many other libraries have conflicting prototypes for getopt, with
+   differences in the consts, in stdlib.h.  To avoid compilation
+   errors, only prototype getopt for the GNU C library.  */
+extern int getopt (int argc, char *const *argv, const char *shortopts);
+#else /* not __GNU_LIBRARY__ */
+extern int getopt ();
+#endif /* not __GNU_LIBRARY__ */
+extern int getopt_long (int argc, char *const *argv, const char *shortopts,
+		        const struct option *longopts, int *longind);
+extern int getopt_long_only (int argc, char *const *argv,
+			     const char *shortopts,
+		             const struct option *longopts, int *longind);
+
+/* Internal only.  Users should not call this directly.  */
+extern int _getopt_internal (int argc, char *const *argv,
+			     const char *shortopts,
+		             const struct option *longopts, int *longind,
+			     int long_only);
+#else /* not __STDC__ */
+extern int getopt ();
+extern int getopt_long ();
+extern int getopt_long_only ();
+
+extern int _getopt_internal ();
+#endif /* not __STDC__ */
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif /* _GETOPT_H */
+#endif /* __UNISTD_LOADED */
diff -Nur tin-980117/vms/getopt1.c tin-980202/vms/getopt1.c
--- tin-980117/vms/getopt1.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/getopt1.c	Thu Jan 13 23:02:38 1994
@@ -0,0 +1,180 @@
+/* getopt_long and getopt_long_only entry points for GNU getopt.
+   Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
+	Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License
+   as published by the Free Software Foundation; either version 2, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "getopt.h"
+
+#ifndef __STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+#ifndef const
+#define const
+#endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+   actually compiling the library itself.  This code is part of the GNU C
+   Library, but also included in many other GNU distributions.  Compiling
+   and linking in this code is a waste when using the GNU C library
+   (especially if it is a shared library).  Rather than having every GNU
+   program understand `configure --with-gnu-libc' and omit the object files,
+   it is simpler to just do this in the source for each such file.  */
+
+#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
+
+
+/* This needs to come after some library #include
+   to get __GNU_LIBRARY__ defined.  */
+#ifdef __GNU_LIBRARY__
+#include <stdlib.h>
+#else
+char *getenv ();
+#endif
+
+#ifndef	NULL
+#define NULL 0
+#endif
+
+int
+getopt_long (argc, argv, options, long_options, opt_index)
+     int argc;
+     char *const *argv;
+     const char *options;
+     const struct option *long_options;
+     int *opt_index;
+{
+  return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
+}
+
+/* Like getopt_long, but '-' as well as '--' can indicate a long option.
+   If an option that starts with '-' (not '--') doesn't match a long option,
+   but does match a short option, it is parsed as a short option
+   instead.  */
+
+int
+getopt_long_only (argc, argv, options, long_options, opt_index)
+     int argc;
+     char *const *argv;
+     const char *options;
+     const struct option *long_options;
+     int *opt_index;
+{
+  return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
+}
+
+
+#endif	/* _LIBC or not __GNU_LIBRARY__.  */
+
+#ifdef TEST
+
+#include <stdio.h>
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+      int option_index = 0;
+      static struct option long_options[] =
+      {
+	{"add", 1, 0, 0},
+	{"append", 0, 0, 0},
+	{"delete", 1, 0, 0},
+	{"verbose", 0, 0, 0},
+	{"create", 0, 0, 0},
+	{"file", 1, 0, 0},
+	{0, 0, 0, 0}
+      };
+
+      c = getopt_long (argc, argv, "abc:d:0123456789",
+		       long_options, &option_index);
+      if (c == EOF)
+	break;
+
+      switch (c)
+	{
+	case 0:
+	  printf ("option %s", long_options[option_index].name);
+	  if (optarg)
+	    printf (" with arg %s", optarg);
+	  printf ("\n");
+	  break;
+
+	case '0':
+	case '1':
+	case '2':
+	case '3':
+	case '4':
+	case '5':
+	case '6':
+	case '7':
+	case '8':
+	case '9':
+	  if (digit_optind != 0 && digit_optind != this_option_optind)
+	    printf ("digits occur in two different argv-elements.\n");
+	  digit_optind = this_option_optind;
+	  printf ("option %c\n", c);
+	  break;
+
+	case 'a':
+	  printf ("option a\n");
+	  break;
+
+	case 'b':
+	  printf ("option b\n");
+	  break;
+
+	case 'c':
+	  printf ("option c with value `%s'\n", optarg);
+	  break;
+
+	case 'd':
+	  printf ("option d with value `%s'\n", optarg);
+	  break;
+
+	case '?':
+	  break;
+
+	default:
+	  printf ("?? getopt returned character code 0%o ??\n", c);
+	}
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+	printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
diff -Nur tin-980117/vms/getpass.c tin-980202/vms/getpass.c
--- tin-980117/vms/getpass.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/getpass.c	Sun Feb  1 08:15:40 1998
@@ -0,0 +1,99 @@
+/*
+SYNOPSIS
+     #include <stdlib.h>
+
+     char *getpass(const char *prompt);
+
+MT-LEVEL
+     Unsafe
+
+DESCRIPTION
+     getpass() reads up  to  a  newline  or  EOF  from  the  file
+     SYS$INPUT,  after prompting on the standard error output with
+     the null-terminated string prompt and disabling echoing.   A
+     pointer is returned to a null-terminated string of at most 8
+     characters.  If SYS$INPUT cannot be opened, a null pointer is
+     returned.
+
+FILES
+    SYS$INPUT
+
+NOTES
+     The return value points to  static  data  whose  content  is
+     overwritten by each call.
+
+AUTHOR
+    Michael Stenns
+
+COPYRIGHT
+    (c) 1997    The content of this file is in the public domain.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+#include <descrip.h>
+#include <iodef.h>
+#include <ssdef.h>
+
+typedef struct
+{
+   short cond_value;
+   short count;
+   int info;
+} io_statblk;
+
+char *getpass(const char *prompt)
+{
+  static char password[64];
+  char cMyChar = ' ', Backstr[] = {8,32,8,0};
+  int pw_len = 0, status;
+  io_statblk status_block;
+  short int in_chan = 0;
+  short int out_chan = 0;
+
+  memset (password, '\0', sizeof password);
+  sys$assign (desz("SYS$INPUT"), &in_chan,0,0);
+  sys$assign (desz("SYS$ERROR"), &out_chan,0,0);
+  /*  Queue the I/O.  */
+  fprintf (stderr,"\n%s",prompt); fflush(stderr);
+  while ( !iscntrl(cMyChar) && (pw_len < (sizeof password / sizeof (char) - 1)))
+  {
+    if ( status = (sys$qiow (0, in_chan, IO$_READVBLK|IO$M_NOFILTR|IO$M_NOECHO,
+                       &status_block,0,0,
+                       &cMyChar,1,0,0,0,0)) != SS$_NORMAL)
+    {
+      fprintf (stderr,"\n%s\n",vms_errmsg (status_block.cond_value));
+      cMyChar = '\r';
+    }
+    else
+    {
+      if ((cMyChar == 127) || (cMyChar == 8))
+      {
+        cMyChar = ' ';
+        password[pw_len] = '\0';
+        if (pw_len)
+        {
+          pw_len--;
+          sys$qiow (0, out_chan, IO$_WRITEVBLK,
+                   &status_block,0,0,
+                   Backstr,3,0,0,0,0);
+        }
+      }
+      else
+      {
+        password[pw_len++] = cMyChar;
+        sys$qiow (0, out_chan, IO$_WRITEVBLK,
+                 &status_block,0,0,
+                 "*",1,0,0,0,0);
+      }
+    }
+  }
+  while (pw_len < 8) password[pw_len++] = ' ';
+  password[--pw_len] = '\0';
+  sys$dassgn (in_chan);
+  sys$dassgn (out_chan);
+  fprintf (stderr,"\n");
+  return password;
+}
diff -Nur tin-980117/vms/isxterm.c tin-980202/vms/isxterm.c
--- tin-980117/vms/isxterm.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/isxterm.c	Sun Jan 18 00:38:52 1998
@@ -0,0 +1,31 @@
+
+#include <descrip.h>
+#include <iodef.h>
+#include <ssdef.h>
+#include <stsdef.h>
+#include <stdio.h>
+#include <X11/Xos.h>
+#include <X11/Xlib.h>
+
+#ifndef TRUE
+#define TRUE 1
+#define FALSE 0
+#endif
+
+is_xterm()
+{
+    Display *dpy;                       /* X connection */
+    char *displayname = NULL;           /* server to contact */
+
+#ifdef __alpha
+    dpy = XOpenDisplay (displayname);
+    if (!dpy)
+      return FALSE;
+
+    XCloseDisplay (dpy);
+    return TRUE;
+#else
+    return FALSE;
+#endif
+}
+
diff -Nur tin-980117/vms/libvms.mms tin-980202/vms/libvms.mms
--- tin-980117/vms/libvms.mms	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/libvms.mms	Sat Jan 31 20:23:44 1998
@@ -0,0 +1,72 @@
+#
+# DESCRIP.MMS for VMS routines of TIN
+#
+
+.IFDEF VAXC
+CC = cc
+CDEFS = /include=([-.include],[-.vms],[-.PCRE])/nowarning/list/show=expans
+.ELSE
+.IFDEF GNUC
+CC = gcc
+CDEFS = /include=([-.include],[-.vms],[-.PCRE])
+.ELSE
+CC = cc/decc
+CDEFS = /include=([-.include],[-.vms],[-.PCRE])/nowarning/list/show=expans
+.ENDIF
+.ENDIF
+
+.IFDEF DEBUG
+DBG             = /debug /nooptim
+.ELSE # not debug
+
+.IFDEF VAXC
+DBG             = /optim
+.ELSE
+.IFDEF GNUC
+DBG             = /optim=2
+.ELSE
+DBG             = /optim
+.ENDIF
+.ENDIF
+
+.ENDIF
+
+.IFDEF VAXC
+OPTS            =
+.ELSE
+.IFDEF GNUC
+OPTS            =
+.ELSE
+OPTS            = /warning=(disable=implicitfunc) /prefix=all
+.ENDIF
+.ENDIF
+
+
+# CFLAGS= $(DBG) $(OPTS) /include=([])
+CFLAGS= $(DBG) $(OPTS) $(CDEFS)
+
+
+OBJECTS = $(MODULES:.obj)
+
+LIB = libvms$(OLB)
+
+all : $(LIB)($(MODULES))
+    @ WRITE SYS$OUTPUT "Built $(LIB)"
+
+clean :
+    @ WRITE SYS$OUTPUT "Cleaning $(LIB)"
+    @ if f$search("*.obj;*") .nes. "" then Delete/Log *.obj;*
+    @ if f$search("*.olb;*") .nes. "" then Delete/Log *.olb;*
+    @ if f$search("*.lis;*") .nes. "" then Delete/Log *.lis;*
+    @ if f$search("tin.opt;*") .nes. "" then Purge/Log tin.opt
+
+.IFDEF DECC
+.FIRST :
+
+.ELSE
+.FIRST :
+        define sys sys$library
+
+.LAST :
+        deassign sys
+.ENDIF
diff -Nur tin-980117/vms/ndir.h tin-980202/vms/ndir.h
--- tin-980117/vms/ndir.h	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/ndir.h	Thu Jun 15 02:28:34 1995
@@ -0,0 +1,51 @@
+/*
+	<dir.h> -- definitions for 4.2BSD-compatible directory access
+
+	last edit:	09-Jul-1983	D A Gwyn
+*/
+
+#ifdef VMS
+#ifndef FAB$C_BID
+#include <fab.h>
+#endif
+#ifndef NAM$C_BID
+#include <nam.h>
+#endif
+#ifndef RMS$_SUC
+#include <rmsdef.h>
+#endif
+#include "dir.h"
+#endif /* VMS */
+
+#define DIRBLKSIZ	512		/* size of directory block */
+#ifdef VMS
+#define MAXNAMLEN	(DIR$S_NAME + 7) /* 80 plus room for version #.  */
+#define MAXFULLSPEC	NAM$C_MAXRSS /* Maximum full spec */
+#else
+#define MAXNAMLEN	15		/* maximum filename length */
+#endif /* VMS */
+	/* NOTE:  MAXNAMLEN must be one less than a multiple of 4 */
+
+struct direct				/* data from readdir() */
+	{
+	long		d_ino;		/* inode number of entry */
+	unsigned short	d_reclen;	/* length of this record */
+	unsigned short	d_namlen;	/* length of string in d_name */
+	char		d_name[MAXNAMLEN+1];	/* name of file */
+	};
+
+typedef struct
+	{
+	int	dd_fd;			/* file descriptor */
+	int	dd_loc;			/* offset in block */
+	int	dd_size;		/* amount of valid data */
+	char	dd_buf[DIRBLKSIZ];	/* directory block */
+	}	DIR;			/* stream data from opendir() */
+
+extern DIR		*opendir();
+extern struct direct	*readdir();
+extern long		telldir();
+extern void		seekdir();
+extern void		closedir();
+
+#define rewinddir( dirp )	seekdir( dirp, 0L )
diff -Nur tin-980117/vms/parsdate.c tin-980202/vms/parsdate.c
--- tin-980117/vms/parsdate.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/parsdate.c	Thu Jan 22 02:43:18 1998
@@ -0,0 +1,1757 @@
+
+/*  A Bison parser, made from parsdate.y
+ with Bison version Bison version A2.3 (Andrew Consortium)
+  */
+
+#define YYBISON 1  /* Identify Bison output.  */
+
+#define	tDAY	258
+#define	tDAYZONE	259
+#define	tMERIDIAN	260
+#define	tMONTH	261
+#define	tMONTH_UNIT	262
+#define	tSEC_UNIT	263
+#define	tSNUMBER	264
+#define	tUNUMBER	265
+#define	tZONE	266
+#define	tDST	267
+
+#line 1 "parsdate.y"
+
+/*
+ *  Project   : tin - a Usenet reader
+ *  Module    : parsedate.y
+ *  Author    : S.Bellovin & R.$alz & J.Berets & P.Eggert
+ *  Created   : 01-08-90
+ *  Updated   : 23-09-94
+ *  Notes     : This grammar has 6 shift/reduce conflicts.
+ *              Originally written by Steven M. Bellovin <smb@research.att.com>
+ *              while at the University of North Carolina at Chapel Hill.
+ *              Later tweaked by a couple of people on Usenet.  Completely
+ *              overhauled by Rich $alz <rsalz@osf.org> and Jim Berets
+ *              <jberets@bbn.com> in August, 1990.
+ *              Further revised (removed obsolete constructs and cleaned up
+ *              timezone names) in August, 1991, by Rich.
+ *              Paul Eggert <eggert@twinsun.com> helped in September 1992.
+ *              Roland Rosenfeld added MET DST code in April 1994.
+ *  Revision  : 1.13
+ *  Copyright : This code is in the public domain and has no copyright.
+ */
+
+/* SUPPRESS 530 *//* Empty body for statement */
+/* SUPPRESS 593 on yyerrlab *//* Label was not used */
+/* SUPPRESS 593 on yynewstate *//* Label was not used */
+/* SUPPRESS 595 on yypvt *//* Automatic variable may be used before set */
+
+#include "tin.h"
+
+/*
+**  Get the number of elements in a fixed-size array, or a pointer just
+**  past the end of it.
+*/
+#define ENDOF(array)	(&array[SIZEOF(array)])
+
+#define CTYPE(isXXXXX, c) (((unsigned char)(c) < 128) && isXXXXX((c)))
+
+typedef char	*STRING;
+
+#define yyparse		date_parse
+#define yylex		date_lex
+#define yyerror		date_error
+
+
+    /* See the LeapYears table in Convert. */
+#define EPOCH		1970
+#define END_OF_TIME	2038
+
+    /* Constants for general time calculations. */
+#define DST_OFFSET	1
+#define SECSPERDAY	(24L * 60L * 60L)
+    /* Readability for TABLE stuff. */
+#define HOUR(x)		(x * 60)
+
+#define LPAREN		'('
+#define RPAREN		')'
+#define IS7BIT(x)	((unsigned int)(x) < 0200)
+
+
+/*
+**  Daylight-savings mode:  on, off, or not yet known.
+*/
+typedef enum _DSTMODE {
+    DSTon, DSToff, DSTmaybe
+} DSTMODE;
+
+/*
+**  Meridian:  am, pm, or 24-hour style.
+*/
+typedef enum _MERIDIAN {
+    MERam, MERpm, MER24
+} MERIDIAN;
+
+
+/*
+**  Global variables.  We could get rid of most of them by using a yacc
+**  union, but this is more efficient.  (This routine predates the
+**  yacc %union construct.)
+*/
+static char	*yyInput;
+static DSTMODE	yyDSTmode;
+static int	yyHaveDate;
+static int	yyHaveRel;
+static int	yyHaveTime;
+static time_t	yyTimezone;
+static time_t	yyDay;
+static time_t	yyHour;
+static time_t	yyMinutes;
+static time_t	yyMonth;
+static time_t	yySeconds;
+static time_t	yyYear;
+static MERIDIAN	yyMeridian;
+static time_t	yyRelMonth;
+static time_t	yyRelSeconds;
+
+static time_t	ToSeconds(time_t, time_t, time_t, MERIDIAN);
+static time_t	Convert(time_t, time_t, time_t, time_t, time_t, time_t, MERIDIAN, DSTMODE);
+static time_t	DSTcorrect(time_t, time_t);
+static time_t	RelativeMonth(time_t, time_t);
+static int	LookupWord(char	*, int);
+static int	date_lex(void);
+
+/*
+ * The 'date_error()' function is declared here to work around a defect in
+ * bison 1.22, which redefines 'const' further down in this file, making it
+ * impossible to put a prototype here, and the function later.  We're using
+ * 'const' on the parameter to quiet gcc's -Wwrite-strings warning.
+ */
+/* ARGSUSED */
+static void
+date_error(const char *s)
+{
+    /* NOTREACHED */
+}
+
+
+#line 117 "parsdate.y"
+typedef union {
+    time_t		Number;
+    enum _MERIDIAN	Meridian;
+} YYSTYPE;
+#include <stdio.h>
+
+#ifndef __cplusplus
+#ifndef __STDC__
+#define const
+#endif
+#endif
+
+
+
+#define	YYFINAL		45
+#define	YYFLAG		-32768
+#define	YYNTBASE	16
+
+#define YYTRANSLATE(x) ((unsigned)(x) <= 267 ? yytranslate[x] : 24)
+
+static const char yytranslate[] = {     0,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,    15,     2,     2,    14,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,    13,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
+     6,     7,     8,     9,    10,    11,    12
+};
+
+#if YYDEBUG != 0
+static const short yyprhs[] = {     0,
+     0,     1,     4,     6,     9,    11,    13,    16,    21,    26,
+    33,    40,    42,    44,    47,    50,    52,    54,    58,    64,
+    67,    72,    75,    79,    85,    88,    91,    94,    97,    98
+};
+
+static const short yyrhs[] = {    -1,
+    16,    17,     0,    18,     0,    18,    19,     0,    21,     0,
+    22,     0,    10,    23,     0,    10,    13,    10,    23,     0,
+    10,    13,    10,    20,     0,    10,    13,    10,    13,    10,
+    23,     0,    10,    13,    10,    13,    10,    20,     0,    11,
+     0,     4,     0,     4,    12,     0,    11,    20,     0,    20,
+     0,     9,     0,    10,    14,    10,     0,    10,    14,    10,
+    14,    10,     0,     6,    10,     0,     6,    10,    15,    10,
+     0,    10,     6,     0,    10,     6,    10,     0,     3,    15,
+    10,     6,    10,     0,     9,     8,     0,    10,     8,     0,
+     9,     7,     0,    10,     7,     0,     0,     5,     0
+};
+
+#endif
+
+#if YYDEBUG != 0
+static const short yyrline[] = { 0,
+   131,   132,   135,   144,   148,   151,   156,   168,   174,   181,
+   187,   197,   201,   205,   209,   217,   223,   244,   248,   260,
+   264,   269,   273,   278,   285,   288,   291,   294,   299,   302
+};
+#endif
+
+
+#if YYDEBUG != 0
+
+static const char * const yytname[] = {   "$","error","$illegal.","tDAY","tDAYZONE",
+"tMERIDIAN","tMONTH","tMONTH_UNIT","tSEC_UNIT","tSNUMBER","tUNUMBER","tZONE",
+"tDST","':'","'/'","','","spec","item","time","zone","numzone","date","rel",
+"o_merid", NULL
+};
+#endif
+
+static const short yyr1[] = {     0,
+    16,    16,    17,    17,    17,    17,    18,    18,    18,    18,
+    18,    19,    19,    19,    19,    19,    20,    21,    21,    21,
+    21,    21,    21,    21,    22,    22,    22,    22,    23,    23
+};
+
+static const short yyr2[] = {     0,
+     0,     2,     1,     2,     1,     1,     2,     4,     4,     6,
+     6,     1,     1,     2,     2,     1,     1,     3,     5,     2,
+     4,     2,     3,     5,     2,     2,     2,     2,     0,     1
+};
+
+static const short yydefact[] = {     1,
+     0,     0,     0,     0,    29,     2,     3,     5,     6,     0,
+    20,    27,    25,    30,    22,    28,    26,     0,     0,     7,
+    13,    17,    12,     4,    16,     0,     0,    23,    29,    18,
+    14,    15,     0,    21,     0,     9,     8,     0,    24,    29,
+    19,    11,    10,     0,     0
+};
+
+static const short yydefgoto[] = {     1,
+     6,     7,    24,    25,     8,     9,    20
+};
+
+static const short yypact[] = {-32768,
+     4,    -7,     1,    -5,    13,-32768,    25,-32768,-32768,     5,
+     7,-32768,-32768,-32768,     6,-32768,-32768,    15,    20,-32768,
+    11,-32768,    22,-32768,-32768,    27,    28,-32768,    19,    21,
+-32768,-32768,    29,-32768,    30,-32768,-32768,    31,-32768,     0,
+-32768,-32768,-32768,    37,-32768
+};
+
+static const short yypgoto[] = {-32768,
+-32768,-32768,-32768,   -23,-32768,-32768,   -28
+};
+
+
+#define	YYLAST		41
+
+
+static const short yytable[] = {    32,
+    37,    12,    13,    44,    14,    36,     2,    10,    22,     3,
+    11,    43,     4,     5,    26,    28,    42,    14,    15,    16,
+    17,    27,    31,    14,    29,    18,    19,    22,    21,    30,
+    22,    35,    33,    22,    38,    23,    45,    34,    39,    40,
+    41
+};
+
+static const short yycheck[] = {    23,
+    29,     7,     8,     0,     5,    29,     3,    15,     9,     6,
+    10,    40,     9,    10,    10,    10,    40,     5,     6,     7,
+     8,    15,    12,     5,    10,    13,    14,     9,     4,    10,
+     9,    13,     6,     9,    14,    11,     0,    10,    10,    10,
+    10
+};
+/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
+#line 3 "bison.simple"
+
+/* Skeleton output parser for bison,
+   Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 1, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+
+#ifndef alloca
+#if defined  VMS && !defined __GNUC__ /* M.St. */
+#include <builtins.h>
+#define alloca __alloca
+#endif
+#ifdef __GNUC__
+#define alloca __builtin_alloca
+#else /* not GNU C.  */
+#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
+#include <alloca.h>
+#else /* not sparc */
+#if defined (MSDOS) && !defined (__TURBOC__)
+#include <malloc.h>
+#else /* not MSDOS, or __TURBOC__ */
+#if defined(_AIX)
+#include <malloc.h>
+ #pragma alloca
+#else /* not MSDOS, __TURBOC__, or _AIX */
+#ifdef __hpux
+#ifdef __cplusplus
+extern "C" {
+void *alloca (unsigned int);
+};
+#else /* not __cplusplus */
+void *alloca ();
+#endif /* not __cplusplus */
+#endif /* __hpux */
+#endif /* not _AIX */
+#endif /* not MSDOS, or __TURBOC__ */
+#endif /* not sparc.  */
+#endif /* not GNU C.  */
+#endif /* alloca not defined.  */
+
+/* This is the parser code that is written into each bison parser
+  when the %semantic_parser declaration is not specified in the grammar.
+  It was written by Richard Stallman by simplifying the hairy parser
+  used when %semantic_parser is specified.  */
+
+/* Note: there must be only one dollar sign in this file.
+   It is replaced by the list of actions, each action
+   as one case of the switch.  */
+
+#define yyerrok		(yyerrstatus = 0)
+#define yyclearin	(yychar = YYEMPTY)
+#define YYEMPTY		-2
+#define YYEOF		0
+#define YYACCEPT	return(0)
+#define YYABORT 	return(1)
+#define YYERROR		goto yyerrlab1
+/* Like YYERROR except do call yyerror.
+   This remains here temporarily to ease the
+   transition to the new meaning of YYERROR, for GCC.
+   Once GCC version 2 has supplanted version 1, this can go.  */
+#define YYFAIL		goto yyerrlab
+#define YYRECOVERING()  (!!yyerrstatus)
+#define YYBACKUP(token, value) \
+do								\
+  if (yychar == YYEMPTY && yylen == 1)				\
+    { yychar = (token), yylval = (value);			\
+      yychar1 = YYTRANSLATE (yychar);				\
+      YYPOPSTACK;						\
+      goto yybackup;						\
+    }								\
+  else								\
+    { yyerror ("syntax error: cannot back up"); YYERROR; }	\
+while (0)
+
+#define YYTERROR	1
+#define YYERRCODE	256
+
+#ifndef YYPURE
+#define YYLEX		yylex()
+#endif
+
+#ifdef YYPURE
+#ifdef YYLSP_NEEDED
+#define YYLEX		yylex(&yylval, &yylloc)
+#else
+#define YYLEX		yylex(&yylval)
+#endif
+#endif
+
+/* If nonreentrant, generate the variables here */
+
+#ifndef YYPURE
+
+int	yychar;			/*  the lookahead symbol		*/
+YYSTYPE	yylval;			/*  the semantic value of the		*/
+				/*  lookahead symbol			*/
+
+#ifdef YYLSP_NEEDED
+YYLTYPE yylloc;			/*  location data for the lookahead	*/
+				/*  symbol				*/
+#endif
+
+int yynerrs;			/*  number of parse errors so far       */
+#endif  /* not YYPURE */
+
+#if YYDEBUG != 0
+int yydebug;			/*  nonzero means print parse trace	*/
+/* Since this is uninitialized, it does not stop multiple parsers
+   from coexisting.  */
+#endif
+
+/*  YYINITDEPTH indicates the initial size of the parser's stacks	*/
+
+#ifndef	YYINITDEPTH
+#define YYINITDEPTH 200
+#endif
+
+/*  YYMAXDEPTH is the maximum size the stacks can grow to
+    (effective only if the built-in stack extension method is used).  */
+
+#if YYMAXDEPTH == 0
+#undef YYMAXDEPTH
+#endif
+
+#ifndef YYMAXDEPTH
+#define YYMAXDEPTH 10000
+#endif
+
+/* Prevent warning if -Wstrict-prototypes.  */
+#ifdef __GNUC__
+int yyparse (void);
+#endif
+
+#if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
+#define __yy_bcopy(FROM,TO,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
+#else				/* not GNU C or C++ */
+#ifndef __cplusplus
+
+/* This is the most reliable way to avoid incompatibilities
+   in available built-in functions on various systems.  */
+static void
+__yy_bcopy (from, to, count)
+     char *from;
+     char *to;
+     int count;
+{
+  register char *f = from;
+  register char *t = to;
+  register int i = count;
+
+  while (i-- > 0)
+    *t++ = *f++;
+}
+
+#else /* __cplusplus */
+
+/* This is the most reliable way to avoid incompatibilities
+   in available built-in functions on various systems.  */
+static void
+__yy_bcopy (char *from, char *to, int count)
+{
+  register char *f = from;
+  register char *t = to;
+  register int i = count;
+
+  while (i-- > 0)
+    *t++ = *f++;
+}
+
+#endif
+#endif
+
+#line 184 "bison.simple"
+int
+yyparse()
+{
+  register int yystate;
+  register int yyn;
+  register short *yyssp;
+  register YYSTYPE *yyvsp;
+  int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
+  int yychar1 = 0;		/*  lookahead token as an internal (translated) token number */
+
+  short	yyssa[YYINITDEPTH];	/*  the state stack			*/
+  YYSTYPE yyvsa[YYINITDEPTH];	/*  the semantic value stack		*/
+
+  short *yyss = yyssa;		/*  refer to the stacks thru separate pointers */
+  YYSTYPE *yyvs = yyvsa;	/*  to allow yyoverflow to reallocate them elsewhere */
+
+#ifdef YYLSP_NEEDED
+  YYLTYPE yylsa[YYINITDEPTH];	/*  the location stack			*/
+  YYLTYPE *yyls = yylsa;
+  YYLTYPE *yylsp;
+
+#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
+#else
+#define YYPOPSTACK   (yyvsp--, yyssp--)
+#endif
+
+  int yystacksize = YYINITDEPTH;
+
+#ifdef YYPURE
+  int yychar;
+  YYSTYPE yylval;
+  int yynerrs;
+#ifdef YYLSP_NEEDED
+  YYLTYPE yylloc;
+#endif
+#endif
+
+  YYSTYPE yyval;		/*  the variable used to return		*/
+				/*  semantic values from the action	*/
+				/*  routines				*/
+
+  int yylen;
+
+#if YYDEBUG != 0
+  if (yydebug)
+    fprintf(stderr, "Starting parse\n");
+#endif
+
+  yystate = 0;
+  yyerrstatus = 0;
+  yynerrs = 0;
+  yychar = YYEMPTY;		/* Cause a token to be read.  */
+
+  /* Initialize stack pointers.
+     Waste one element of value and location stack
+     so that they stay on the same level as the state stack.
+     The wasted elements are never initialized.  */
+
+  yyssp = yyss - 1;
+  yyvsp = yyvs;
+#ifdef YYLSP_NEEDED
+  yylsp = yyls;
+#endif
+
+/* Push a new state, which is found in  yystate  .  */
+/* In all cases, when you get here, the value and location stacks
+   have just been pushed. so pushing a state here evens the stacks.  */
+yynewstate:
+
+  *++yyssp = yystate;
+
+  if (yyssp >= yyss + yystacksize - 1)
+    {
+      /* Give user a chance to reallocate the stack */
+      /* Use copies of these so that the &'s don't force the real ones into memory. */
+      YYSTYPE *yyvs1 = yyvs;
+      short *yyss1 = yyss;
+#ifdef YYLSP_NEEDED
+      YYLTYPE *yyls1 = yyls;
+#endif
+
+      /* Get the current used size of the three stacks, in elements.  */
+      int size = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+      /* Each stack pointer address is followed by the size of
+	 the data in use in that stack, in bytes.  */
+#ifdef YYLSP_NEEDED
+      /* This used to be a conditional around just the two extra args,
+	 but that might be undefined if yyoverflow is a macro.  */
+      yyoverflow("parser stack overflow",
+		 &yyss1, size * sizeof (*yyssp),
+		 &yyvs1, size * sizeof (*yyvsp),
+		 &yyls1, size * sizeof (*yylsp),
+		 &yystacksize);
+#else
+      yyoverflow("parser stack overflow",
+		 &yyss1, size * sizeof (*yyssp),
+		 &yyvs1, size * sizeof (*yyvsp),
+		 &yystacksize);
+#endif
+
+      yyss = yyss1; yyvs = yyvs1;
+#ifdef YYLSP_NEEDED
+      yyls = yyls1;
+#endif
+#else /* no yyoverflow */
+      /* Extend the stack our own way.  */
+      if (yystacksize >= YYMAXDEPTH)
+	{
+	  yyerror("parser stack overflow");
+	  return 2;
+	}
+      yystacksize *= 2;
+      if (yystacksize > YYMAXDEPTH)
+	yystacksize = YYMAXDEPTH;
+      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
+      __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
+      yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
+      __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
+#ifdef YYLSP_NEEDED
+      yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
+      __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
+#endif
+#endif /* no yyoverflow */
+
+      yyssp = yyss + size - 1;
+      yyvsp = yyvs + size - 1;
+#ifdef YYLSP_NEEDED
+      yylsp = yyls + size - 1;
+#endif
+
+#if YYDEBUG != 0
+      if (yydebug)
+	fprintf(stderr, "Stack size increased to %d\n", yystacksize);
+#endif
+
+      if (yyssp >= yyss + yystacksize - 1)
+	YYABORT;
+    }
+
+#if YYDEBUG != 0
+  if (yydebug)
+    fprintf(stderr, "Entering state %d\n", yystate);
+#endif
+
+  goto yybackup;
+ yybackup:
+
+/* Do appropriate processing given the current state.  */
+/* Read a lookahead token if we need one and don't already have one.  */
+/* yyresume: */
+
+  /* First try to decide what to do without reference to lookahead token.  */
+
+  yyn = yypact[yystate];
+  if (yyn == YYFLAG)
+    goto yydefault;
+
+  /* Not known => get a lookahead token if don't already have one.  */
+
+  /* yychar is either YYEMPTY or YYEOF
+     or a valid token in external form.  */
+
+  if (yychar == YYEMPTY)
+    {
+#if YYDEBUG != 0
+      if (yydebug)
+	fprintf(stderr, "Reading a token: ");
+#endif
+      yychar = YYLEX;
+    }
+
+  /* Convert token to internal form (in yychar1) for indexing tables with */
+
+  if (yychar <= 0)		/* This means end of input. */
+    {
+      yychar1 = 0;
+      yychar = YYEOF;		/* Don't call YYLEX any more */
+
+#if YYDEBUG != 0
+      if (yydebug)
+	fprintf(stderr, "Now at end of input.\n");
+#endif
+    }
+  else
+    {
+      yychar1 = YYTRANSLATE(yychar);
+
+#if YYDEBUG != 0
+      if (yydebug)
+	{
+	  fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
+	  /* Give the individual parser a way to print the precise meaning
+	     of a token, for further debugging info.  */
+#ifdef YYPRINT
+	  YYPRINT (stderr, yychar, yylval);
+#endif
+	  fprintf (stderr, ")\n");
+	}
+#endif
+    }
+
+  yyn += yychar1;
+  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
+    goto yydefault;
+
+  yyn = yytable[yyn];
+
+  /* yyn is what to do for this token type in this state.
+     Negative => reduce, -yyn is rule number.
+     Positive => shift, yyn is new state.
+       New state is final state => don't bother to shift,
+       just return success.
+     0, or most negative number => error.  */
+
+  if (yyn < 0)
+    {
+      if (yyn == YYFLAG)
+	goto yyerrlab;
+      yyn = -yyn;
+      goto yyreduce;
+    }
+  else if (yyn == 0)
+    goto yyerrlab;
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+  /* Shift the lookahead token.  */
+
+#if YYDEBUG != 0
+  if (yydebug)
+    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
+#endif
+
+  /* Discard the token being shifted unless it is eof.  */
+  if (yychar != YYEOF)
+    yychar = YYEMPTY;
+
+  *++yyvsp = yylval;
+#ifdef YYLSP_NEEDED
+  *++yylsp = yylloc;
+#endif
+
+  /* count tokens shifted since error; after three, turn off error status.  */
+  if (yyerrstatus) yyerrstatus--;
+
+  yystate = yyn;
+  goto yynewstate;
+
+/* Do the default action for the current state.  */
+yydefault:
+
+  yyn = yydefact[yystate];
+  if (yyn == 0)
+    goto yyerrlab;
+
+/* Do a reduction.  yyn is the number of a rule to reduce with.  */
+yyreduce:
+  yylen = yyr2[yyn];
+  if (yylen > 0)
+    yyval = yyvsp[1-yylen]; /* implement default value of the action */
+
+#if YYDEBUG != 0
+  if (yydebug)
+    {
+      int i;
+
+      fprintf (stderr, "Reducing via rule %d (line %d), ",
+	       yyn, yyrline[yyn]);
+
+      /* Print the symbols being reduced, and their result.  */
+      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
+	fprintf (stderr, "%s ", yytname[yyrhs[i]]);
+      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
+    }
+#endif
+
+
+  switch (yyn) {
+
+case 3:
+#line 135 "parsdate.y"
+{
+	    yyHaveTime++;
+#if	defined(lint)
+	    /* I am compulsive about lint natterings... */
+	    if (yyHaveTime == -1) {
+		YYERROR;
+	    }
+#endif	/* defined(lint) */
+	;
+    break;}
+case 4:
+#line 144 "parsdate.y"
+{
+	    yyHaveTime++;
+	    yyTimezone = yyvsp[0].Number;
+	;
+    break;}
+case 5:
+#line 148 "parsdate.y"
+{
+	    yyHaveDate++;
+	;
+    break;}
+case 6:
+#line 151 "parsdate.y"
+{
+	    yyHaveRel = 1;
+	;
+    break;}
+case 7:
+#line 156 "parsdate.y"
+{
+	    if (yyvsp[-1].Number < 100) {
+		yyHour = yyvsp[-1].Number;
+		yyMinutes = 0;
+	    }
+	    else {
+		yyHour = yyvsp[-1].Number / 100;
+		yyMinutes = yyvsp[-1].Number % 100;
+	    }
+	    yySeconds = 0;
+	    yyMeridian = yyvsp[0].Meridian;
+	;
+    break;}
+case 8:
+#line 168 "parsdate.y"
+{
+	    yyHour = yyvsp[-3].Number;
+	    yyMinutes = yyvsp[-1].Number;
+	    yySeconds = 0;
+	    yyMeridian = yyvsp[0].Meridian;
+	;
+    break;}
+case 9:
+#line 174 "parsdate.y"
+{
+	    yyHour = yyvsp[-3].Number;
+	    yyMinutes = yyvsp[-1].Number;
+	    yyTimezone = yyvsp[0].Number;
+	    yyMeridian = MER24;
+	    yyDSTmode = DSToff;
+	;
+    break;}
+case 10:
+#line 181 "parsdate.y"
+{
+	    yyHour = yyvsp[-5].Number;
+	    yyMinutes = yyvsp[-3].Number;
+	    yySeconds = yyvsp[-1].Number;
+	    yyMeridian = yyvsp[0].Meridian;
+	;
+    break;}
+case 11:
+#line 187 "parsdate.y"
+{
+	    yyHour = yyvsp[-5].Number;
+	    yyMinutes = yyvsp[-3].Number;
+	    yySeconds = yyvsp[-1].Number;
+	    yyTimezone = yyvsp[0].Number;
+	    yyMeridian = MER24;
+	    yyDSTmode = DSToff;
+	;
+    break;}
+case 12:
+#line 197 "parsdate.y"
+{
+	    yyval.Number = yyvsp[0].Number;
+	    yyDSTmode = DSToff;
+	;
+    break;}
+case 13:
+#line 201 "parsdate.y"
+{
+	    yyval.Number = yyvsp[0].Number;
+	    yyDSTmode = DSTon;
+	;
+    break;}
+case 14:
+#line 205 "parsdate.y"
+{
+	    yyTimezone = yyvsp[-1].Number;
+	    yyDSTmode = DSTon;
+	;
+    break;}
+case 15:
+#line 209 "parsdate.y"
+{
+	    /* Only allow "GMT+300" and "GMT-0800" */
+	    if (yyvsp[-1].Number != 0) {
+		YYABORT;
+	    }
+	    yyval.Number = yyvsp[0].Number;
+	    yyDSTmode = DSToff;
+	;
+    break;}
+case 16:
+#line 217 "parsdate.y"
+{
+	    yyval.Number = yyvsp[0].Number;
+	    yyDSTmode = DSToff;
+	;
+    break;}
+case 17:
+#line 223 "parsdate.y"
+{
+	    int	i;
+
+	    /* Unix and GMT and numeric timezones -- a little confusing. */
+	    if (yyvsp[0].Number < 0) {
+		/* Don't work with negative modulus. */
+		yyvsp[0].Number = -yyvsp[0].Number;
+	 	if (yyvsp[0].Number > 9999 || (i = yyvsp[0].Number % 100) >= 60) {
+	 		YYABORT;
+	 	}
+		yyval.Number = (yyvsp[0].Number / 100) * 60 + i;
+	    }
+	    else {
+	 	if (yyvsp[0].Number > 9999 || (i = yyvsp[0].Number % 100) >= 60) {
+	 		YYABORT;
+	 	}
+		yyval.Number = -((yyvsp[0].Number / 100) * 60 + i);
+	    }
+	;
+    break;}
+case 18:
+#line 244 "parsdate.y"
+{
+	    yyMonth = yyvsp[-2].Number;
+	    yyDay = yyvsp[0].Number;
+	;
+    break;}
+case 19:
+#line 248 "parsdate.y"
+{
+	    if (yyvsp[-4].Number > 100) {
+		yyYear = yyvsp[-4].Number;
+		yyMonth = yyvsp[-2].Number;
+		yyDay = yyvsp[0].Number;
+	    }
+	    else {
+		yyMonth = yyvsp[-4].Number;
+		yyDay = yyvsp[-2].Number;
+		yyYear = yyvsp[0].Number;
+	    }
+	;
+    break;}
+case 20:
+#line 260 "parsdate.y"
+{
+	    yyMonth = yyvsp[-1].Number;
+	    yyDay = yyvsp[0].Number;
+	;
+    break;}
+case 21:
+#line 264 "parsdate.y"
+{
+	    yyMonth = yyvsp[-3].Number;
+	    yyDay = yyvsp[-2].Number;
+	    yyYear = yyvsp[0].Number;
+	;
+    break;}
+case 22:
+#line 269 "parsdate.y"
+{
+	    yyDay = yyvsp[-1].Number;
+	    yyMonth = yyvsp[0].Number;
+	;
+    break;}
+case 23:
+#line 273 "parsdate.y"
+{
+	    yyDay = yyvsp[-2].Number;
+	    yyMonth = yyvsp[-1].Number;
+	    yyYear = yyvsp[0].Number;
+	;
+    break;}
+case 24:
+#line 278 "parsdate.y"
+{
+	    yyDay = yyvsp[-2].Number;
+	    yyMonth = yyvsp[-1].Number;
+	    yyYear = yyvsp[0].Number;
+	;
+    break;}
+case 25:
+#line 285 "parsdate.y"
+{
+	    yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number;
+	;
+    break;}
+case 26:
+#line 288 "parsdate.y"
+{
+	    yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number;
+	;
+    break;}
+case 27:
+#line 291 "parsdate.y"
+{
+	    yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
+	;
+    break;}
+case 28:
+#line 294 "parsdate.y"
+{
+	    yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
+	;
+    break;}
+case 29:
+#line 299 "parsdate.y"
+{
+	    yyval.Meridian = MER24;
+	;
+    break;}
+case 30:
+#line 302 "parsdate.y"
+{
+	    yyval.Meridian = yyvsp[0].Meridian;
+	;
+    break;}
+}
+   /* the action file gets copied in in place of this dollarsign */
+#line 465 "bison.simple"
+
+  yyvsp -= yylen;
+  yyssp -= yylen;
+#ifdef YYLSP_NEEDED
+  yylsp -= yylen;
+#endif
+
+#if YYDEBUG != 0
+  if (yydebug)
+    {
+      short *ssp1 = yyss - 1;
+      fprintf (stderr, "state stack now");
+      while (ssp1 != yyssp)
+	fprintf (stderr, " %d", *++ssp1);
+      fprintf (stderr, "\n");
+    }
+#endif
+
+  *++yyvsp = yyval;
+
+#ifdef YYLSP_NEEDED
+  yylsp++;
+  if (yylen == 0)
+    {
+      yylsp->first_line = yylloc.first_line;
+      yylsp->first_column = yylloc.first_column;
+      yylsp->last_line = (yylsp-1)->last_line;
+      yylsp->last_column = (yylsp-1)->last_column;
+      yylsp->text = 0;
+    }
+  else
+    {
+      yylsp->last_line = (yylsp+yylen-1)->last_line;
+      yylsp->last_column = (yylsp+yylen-1)->last_column;
+    }
+#endif
+
+  /* Now "shift" the result of the reduction.
+     Determine what state that goes to,
+     based on the state we popped back to
+     and the rule number reduced by.  */
+
+  yyn = yyr1[yyn];
+
+  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
+  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+    yystate = yytable[yystate];
+  else
+    yystate = yydefgoto[yyn - YYNTBASE];
+
+  goto yynewstate;
+
+yyerrlab:   /* here on detecting error */
+
+  if (! yyerrstatus)
+    /* If not already recovering from an error, report this error.  */
+    {
+      ++yynerrs;
+
+#ifdef YYERROR_VERBOSE
+      yyn = yypact[yystate];
+
+      if (yyn > YYFLAG && yyn < YYLAST)
+	{
+	  int size = 0;
+	  char *msg;
+	  int x, count;
+
+	  count = 0;
+	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
+	  for (x = (yyn < 0 ? -yyn : 0);
+	       x < (sizeof(yytname) / sizeof(char *)); x++)
+	    if (yycheck[x + yyn] == x)
+	      size += strlen(yytname[x]) + 15, count++;
+	  msg = (char *) malloc(size + 15);
+	  if (msg != 0)
+	    {
+	      strcpy(msg, "parse error");
+
+	      if (count < 5)
+		{
+		  count = 0;
+		  for (x = (yyn < 0 ? -yyn : 0);
+		       x < (sizeof(yytname) / sizeof(char *)); x++)
+		    if (yycheck[x + yyn] == x)
+		      {
+			strcat(msg, count == 0 ? ", expecting `" : " or `");
+			strcat(msg, yytname[x]);
+			strcat(msg, "'");
+			count++;
+		      }
+		}
+	      yyerror(msg);
+	      free(msg);
+	    }
+	  else
+	    yyerror ("parse error; also virtual memory exceeded");
+	}
+      else
+#endif /* YYERROR_VERBOSE */
+	yyerror("parse error");
+    }
+
+  goto yyerrlab1;
+yyerrlab1:   /* here on error raised explicitly by an action */
+
+  if (yyerrstatus == 3)
+    {
+      /* if just tried and failed to reuse lookahead token after an error, discard it.  */
+
+      /* return failure if at end of input */
+      if (yychar == YYEOF)
+	YYABORT;
+
+#if YYDEBUG != 0
+      if (yydebug)
+	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
+#endif
+
+      yychar = YYEMPTY;
+    }
+
+  /* Else will try to reuse lookahead token
+     after shifting the error token.  */
+
+  yyerrstatus = 3;		/* Each real token shifted decrements this */
+
+  goto yyerrhandle;
+
+yyerrdefault:  /* current state does not do anything special for the error token. */
+
+#if 0
+  /* This is wrong; only states that explicitly want error tokens
+     should shift them.  */
+  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
+  if (yyn) goto yydefault;
+#endif
+
+yyerrpop:   /* pop the current state because it cannot handle the error token */
+
+  if (yyssp == yyss) YYABORT;
+  yyvsp--;
+  yystate = *--yyssp;
+#ifdef YYLSP_NEEDED
+  yylsp--;
+#endif
+
+#if YYDEBUG != 0
+  if (yydebug)
+    {
+      short *ssp1 = yyss - 1;
+      fprintf (stderr, "Error: state stack now");
+      while (ssp1 != yyssp)
+	fprintf (stderr, " %d", *++ssp1);
+      fprintf (stderr, "\n");
+    }
+#endif
+
+yyerrhandle:
+
+  yyn = yypact[yystate];
+  if (yyn == YYFLAG)
+    goto yyerrdefault;
+
+  yyn += YYTERROR;
+  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
+    goto yyerrdefault;
+
+  yyn = yytable[yyn];
+  if (yyn < 0)
+    {
+      if (yyn == YYFLAG)
+	goto yyerrpop;
+      yyn = -yyn;
+      goto yyreduce;
+    }
+  else if (yyn == 0)
+    goto yyerrpop;
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+#if YYDEBUG != 0
+  if (yydebug)
+    fprintf(stderr, "Shifting error token, ");
+#endif
+
+  *++yyvsp = yylval;
+#ifdef YYLSP_NEEDED
+  *++yylsp = yylloc;
+#endif
+
+  yystate = yyn;
+  goto yynewstate;
+}
+
+#line 307 "parsdate.y"
+
+
+/*
+**  An entry in the lexical lookup table.
+*/
+typedef struct _TABLE {
+    const char *name;
+    int		type;
+    time_t	value;
+} TABLE;
+
+/* Month and day table. */
+static const TABLE MonthDayTable[] = {
+    { "january",	tMONTH,  1 },
+    { "february",	tMONTH,  2 },
+    { "march",		tMONTH,  3 },
+    { "april",		tMONTH,  4 },
+    { "may",		tMONTH,  5 },
+    { "june",		tMONTH,  6 },
+    { "july",		tMONTH,  7 },
+    { "august",		tMONTH,  8 },
+    { "september",	tMONTH,  9 },
+    { "october",	tMONTH, 10 },
+    { "november",	tMONTH, 11 },
+    { "december",	tMONTH, 12 },
+	/* The value of the day isn't used... */
+    { "sunday",		tDAY, 0 },
+    { "monday",		tDAY, 0 },
+    { "tuesday",	tDAY, 0 },
+    { "wednesday",	tDAY, 0 },
+    { "thursday",	tDAY, 0 },
+    { "friday",		tDAY, 0 },
+    { "saturday",	tDAY, 0 },
+};
+
+/* Time units table. */
+static const TABLE	UnitsTable[] = {
+    { "year",		tMONTH_UNIT,	12 },
+    { "month",		tMONTH_UNIT,	1 },
+    { "week",		tSEC_UNIT,	7 * 24 * 60 * 60 },
+    { "day",		tSEC_UNIT,	1 * 24 * 60 * 60 },
+    { "hour",		tSEC_UNIT,	60 * 60 },
+    { "minute",		tSEC_UNIT,	60 },
+    { "min",		tSEC_UNIT,	60 },
+    { "second",		tSEC_UNIT,	1 },
+    { "sec",		tSEC_UNIT,	1 },
+};
+
+/* Timezone table. */
+static const TABLE	TimezoneTable[] = {
+    { "gmt",	tZONE,     HOUR( 0) },	/* Greenwich Mean */
+    { "ut",	tZONE,     HOUR( 0) },	/* Universal */
+    { "utc",	tZONE,     HOUR( 0) },	/* Universal Coordinated */
+    { "cut",	tZONE,     HOUR( 0) },	/* Coordinated Universal */
+    { "z",	tZONE,     HOUR( 0) },	/* Greenwich Mean */
+    { "wet",	tZONE,     HOUR( 0) },	/* Western European */
+    { "bst",	tDAYZONE,  HOUR( 0) },	/* British Summer */
+    { "nst",	tZONE,     HOUR(3)+30 }, /* Newfoundland Standard */
+    { "ndt",	tDAYZONE,  HOUR(3)+30 }, /* Newfoundland Daylight */
+    { "ast",	tZONE,     HOUR( 4) },	/* Atlantic Standard */
+    { "adt",	tDAYZONE,  HOUR( 4) },	/* Atlantic Daylight */
+    { "est",	tZONE,     HOUR( 5) },	/* Eastern Standard */
+    { "edt",	tDAYZONE,  HOUR( 5) },	/* Eastern Daylight */
+    { "cst",	tZONE,     HOUR( 6) },	/* Central Standard */
+    { "cdt",	tDAYZONE,  HOUR( 6) },	/* Central Daylight */
+    { "mst",	tZONE,     HOUR( 7) },	/* Mountain Standard */
+    { "mdt",	tDAYZONE,  HOUR( 7) },	/* Mountain Daylight */
+    { "pst",	tZONE,     HOUR( 8) },	/* Pacific Standard */
+    { "pdt",	tDAYZONE,  HOUR( 8) },	/* Pacific Daylight */
+    { "yst",	tZONE,     HOUR( 9) },	/* Yukon Standard */
+    { "ydt",	tDAYZONE,  HOUR( 9) },	/* Yukon Daylight */
+    { "akst",	tZONE,     HOUR( 9) },	/* Alaska Standard */
+    { "akdt",	tDAYZONE,  HOUR( 9) },	/* Alaska Daylight */
+    { "hst",	tZONE,     HOUR(10) },	/* Hawaii Standard */
+    { "hast",	tZONE,     HOUR(10) },	/* Hawaii-Aleutian Standard */
+    { "hadt",	tDAYZONE,  HOUR(10) },	/* Hawaii-Aleutian Daylight */
+    { "ces",	tDAYZONE,  -HOUR(1) },	/* Central European Summer */
+    { "cest",	tDAYZONE,  -HOUR(1) },	/* Central European Summer */
+    { "mez",	tZONE,     -HOUR(1) },	/* Middle European */
+    { "mezt",	tDAYZONE,  -HOUR(1) },	/* Middle European Summer */
+    { "cet",	tZONE,     -HOUR(1) },	/* Central European */
+    { "met",	tZONE,     -HOUR(1) },	/* Middle European */
+/* Additional aliases for MET / MET DST *************************************/
+    { "mez",    tZONE,     -HOUR(1) },  /* Middle European */
+    { "mewt",   tZONE,     -HOUR(1) },  /* Middle European Winter */
+    { "mest",   tDAYZONE,  -HOUR(1) },  /* Middle European Summer */
+    { "mes",    tDAYZONE,  -HOUR(1) },  /* Middle European Summer */
+    { "mesz",   tDAYZONE,  -HOUR(1) },  /* Middle European Summer */
+    { "msz",    tDAYZONE,  -HOUR(1) },  /* Middle European Summer */
+    { "metdst", tDAYZONE,  -HOUR(1) },  /* Middle European Summer */
+/****************************************************************************/
+    { "eet",	tZONE,     -HOUR(2) },	/* Eastern Europe */
+    { "msk",	tZONE,     -HOUR(3) },	/* Moscow Winter */
+    { "msd",	tDAYZONE,  -HOUR(3) },	/* Moscow Summer */
+    { "wast",	tZONE,     -HOUR(8) },	/* West Australian Standard */
+    { "wadt",	tDAYZONE,  -HOUR(8) },	/* West Australian Daylight */
+    { "hkt",	tZONE,     -HOUR(8) },	/* Hong Kong */
+    { "cct",	tZONE,     -HOUR(8) },	/* China Coast */
+    { "jst",	tZONE,     -HOUR(9) },	/* Japan Standard */
+    { "kst",	tZONE,     -HOUR(9) },	/* Korean Standard */
+    { "kdt",	tZONE,     -HOUR(9) },	/* Korean Daylight */
+    { "cast",	tZONE,     -(HOUR(9)+30) }, /* Central Australian Standard */
+    { "cadt",	tDAYZONE,  -(HOUR(9)+30) }, /* Central Australian Daylight */
+    { "east",	tZONE,     -HOUR(10) },	/* Eastern Australian Standard */
+    { "eadt",	tDAYZONE,  -HOUR(10) },	/* Eastern Australian Daylight */
+    { "nzst",	tZONE,     -HOUR(12) },	/* New Zealand Standard */
+    { "nzdt",	tDAYZONE,  -HOUR(12) },	/* New Zealand Daylight */
+
+    /* For completeness we include the following entries. */
+#if	0
+
+    /* Duplicate names.  Either they conflict with a zone listed above
+     * (which is either more likely to be seen or just been in circulation
+     * longer), or they conflict with another zone in this section and
+     * we could not reasonably choose one over the other. */
+    { "fst",	tZONE,     HOUR( 2) },	/* Fernando De Noronha Standard */
+    { "fdt",	tDAYZONE,  HOUR( 2) },	/* Fernando De Noronha Daylight */
+    { "bst",	tZONE,     HOUR( 3) },	/* Brazil Standard */
+    { "est",	tZONE,     HOUR( 3) },	/* Eastern Standard (Brazil) */
+    { "edt",	tDAYZONE,  HOUR( 3) },	/* Eastern Daylight (Brazil) */
+    { "wst",	tZONE,     HOUR( 4) },	/* Western Standard (Brazil) */
+    { "wdt",	tDAYZONE,  HOUR( 4) },	/* Western Daylight (Brazil) */
+    { "cst",	tZONE,     HOUR( 5) },	/* Chile Standard */
+    { "cdt",	tDAYZONE,  HOUR( 5) },	/* Chile Daylight */
+    { "ast",	tZONE,     HOUR( 5) },	/* Acre Standard */
+    { "adt",	tDAYZONE,  HOUR( 5) },	/* Acre Daylight */
+    { "cst",	tZONE,     HOUR( 5) },	/* Cuba Standard */
+    { "cdt",	tDAYZONE,  HOUR( 5) },	/* Cuba Daylight */
+    { "est",	tZONE,     HOUR( 6) },	/* Easter Island Standard */
+    { "edt",	tDAYZONE,  HOUR( 6) },	/* Easter Island Daylight */
+    { "sst",	tZONE,     HOUR(11) },	/* Samoa Standard */
+    { "ist",	tZONE,     -HOUR(2) },	/* Israel Standard */
+    { "idt",	tDAYZONE,  -HOUR(2) },	/* Israel Daylight */
+    { "idt",	tDAYZONE,  -(HOUR(3)+30) }, /* Iran Daylight */
+    { "ist",	tZONE,     -(HOUR(3)+30) }, /* Iran Standard */
+    { "cst",	 tZONE,     -HOUR(8) },	/* China Standard */
+    { "cdt",	 tDAYZONE,  -HOUR(8) },	/* China Daylight */
+    { "sst",	 tZONE,     -HOUR(8) },	/* Singapore Standard */
+
+    /* Dubious (e.g., not in Olson's TIMEZONE package) or obsolete. */
+    { "gst",	tZONE,     HOUR( 3) },	/* Greenland Standard */
+    { "wat",	tZONE,     -HOUR(1) },	/* West Africa */
+    { "at",	tZONE,     HOUR( 2) },	/* Azores */
+    { "gst",	tZONE,     -HOUR(10) },	/* Guam Standard */
+    { "nft",	tZONE,     HOUR(3)+30 }, /* Newfoundland */
+    { "idlw",	tZONE,     HOUR(12) },	/* International Date Line West */
+    { "mewt",	tZONE,     -HOUR(1) },	/* Middle European Winter */
+    { "mest",	tDAYZONE,  -HOUR(1) },	/* Middle European Summer */
+    { "swt",	tZONE,     -HOUR(1) },	/* Swedish Winter */
+    { "sst",	tDAYZONE,  -HOUR(1) },	/* Swedish Summer */
+    { "fwt",	tZONE,     -HOUR(1) },	/* French Winter */
+    { "fst",	tDAYZONE,  -HOUR(1) },	/* French Summer */
+    { "bt",	tZONE,     -HOUR(3) },	/* Baghdad */
+    { "it",	tZONE,     -(HOUR(3)+30) }, /* Iran */
+    { "zp4",	tZONE,     -HOUR(4) },	/* USSR Zone 3 */
+    { "zp5",	tZONE,     -HOUR(5) },	/* USSR Zone 4 */
+    { "ist",	tZONE,     -(HOUR(5)+30) }, /* Indian Standard */
+    { "zp6",	tZONE,     -HOUR(6) },	/* USSR Zone 5 */
+    { "nst",	tZONE,     -HOUR(7) },	/* North Sumatra */
+    { "sst",	tZONE,     -HOUR(7) },	/* South Sumatra */
+    { "jt",	tZONE,     -(HOUR(7)+30) }, /* Java (3pm in Cronusland!) */
+    { "nzt",	tZONE,     -HOUR(12) },	/* New Zealand */
+    { "idle",	tZONE,     -HOUR(12) },	/* International Date Line East */
+    { "cat",	tZONE,     HOUR(10) },	/* -- expired 1967 */
+    { "nt",	tZONE,     HOUR(11) },	/* -- expired 1967 */
+    { "ahst",	tZONE,     HOUR(10) },	/* -- expired 1983 */
+    { "hdt",	tDAYZONE,  HOUR(10) },	/* -- expired 1986 */
+#endif	/* 0 */
+};
+
+static time_t
+ToSeconds(
+    time_t	Hours,
+    time_t	Minutes,
+    time_t	Seconds,
+    MERIDIAN	Meridian)
+{
+    if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 61)
+	return -1;
+    if (Meridian == MER24) {
+	if (Hours < 0 || Hours > 23)
+	    return -1;
+    }
+    else {
+	if (Hours < 1 || Hours > 12)
+		return -1;
+	if (Hours == 12)
+		Hours = 0;
+	if (Meridian == MERpm)
+		Hours += 12;
+    }
+    return (Hours * 60L + Minutes) * 60L + Seconds;
+}
+
+
+static time_t
+Convert(
+    time_t	Month,
+    time_t	Day,
+    time_t	Year,
+    time_t	Hours,
+    time_t	Minutes,
+    time_t	Seconds,
+    MERIDIAN	Meridian,
+    DSTMODE	dst)
+{
+    static const int	DaysNormal[13] = {
+	0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+    };
+    static const int	DaysLeap[13] = {
+	0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+    };
+    static const int	LeapYears[] = {
+	1972, 1976, 1980, 1984, 1988, 1992, 1996,
+	2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036
+    };
+    register const int	*yp;
+    register const int	*mp;
+    register time_t	Julian;
+    register int	i;
+    time_t		tod;
+
+    if (Year < 0)
+	Year = -Year;
+    if (Year < 100)
+	Year += 1900;
+    if (Year < EPOCH)
+	Year += 100;
+    for (mp = DaysNormal, yp = LeapYears; yp < ENDOF(LeapYears); yp++)
+	if (Year == *yp) {
+	    mp = DaysLeap;
+	    break;
+	}
+    if (Year < EPOCH || Year > END_OF_TIME
+     || Month < 1 || Month > 12
+     /* NOSTRICT *//* conversion from long may lose accuracy */
+     || Day < 1 || Day > mp[(int)Month])
+	return -1;
+
+    Julian = Day - 1 + (Year - EPOCH) * 365;
+    for (yp = LeapYears; yp < ENDOF(LeapYears); yp++, Julian++)
+	if (Year <= *yp)
+	    break;
+    for (i = 1; i < Month; i++)
+	Julian += *++mp;
+    Julian *= SECSPERDAY;
+    Julian += yyTimezone * 60L;
+    if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)
+	return -1;
+    Julian += tod;
+    tod = Julian;
+    if (dst == DSTon || (dst == DSTmaybe && localtime(&tod)->tm_isdst))
+	Julian -= DST_OFFSET * 60 * 60;
+    return Julian;
+}
+
+
+static time_t
+DSTcorrect(
+    time_t	Start,
+    time_t	Future)
+{
+    time_t	StartDay;
+    time_t	FutureDay;
+
+    StartDay = (localtime(&Start)->tm_hour + 1) % 24;
+    FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
+    return (Future - Start) + (StartDay - FutureDay) * DST_OFFSET * 60 * 60;
+}
+
+
+static time_t
+RelativeMonth(
+    time_t	Start,
+    time_t	RelMonth)
+{
+    struct tm	*tm;
+    time_t	Month;
+    time_t	Year;
+
+    tm = localtime(&Start);
+    Month = 12 * tm->tm_year + tm->tm_mon + RelMonth;
+    Year = Month / 12;
+    Month = Month % 12 + 1;
+    return DSTcorrect(Start,
+	    Convert(Month, (time_t)tm->tm_mday, Year,
+		(time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec,
+		MER24, DSTmaybe));
+}
+
+
+static int
+LookupWord(
+    char		*buff,
+    register int	length)
+{
+    register char	*p;
+    register const char *q;
+    register const TABLE *tp;
+    register int	c;
+
+    p = buff;
+    c = p[0];
+
+    /* See if we have an abbreviation for a month. */
+    if (length == 3 || (length == 4 && p[3] == '.'))
+	for (tp = MonthDayTable; tp < ENDOF(MonthDayTable); tp++) {
+	    q = tp->name;
+	    if (c == q[0] && p[1] == q[1] && p[2] == q[2]) {
+		yylval.Number = tp->value;
+		return tp->type;
+	    }
+	}
+    else
+	for (tp = MonthDayTable; tp < ENDOF(MonthDayTable); tp++)
+	    if (c == tp->name[0] && strcmp(p, tp->name) == 0) {
+		yylval.Number = tp->value;
+		return tp->type;
+	    }
+
+    /* Try for a timezone. */
+    for (tp = TimezoneTable; tp < ENDOF(TimezoneTable); tp++)
+	if (c == tp->name[0] && p[1] == tp->name[1]
+	 && strcmp(p, tp->name) == 0) {
+	    yylval.Number = tp->value;
+	    return tp->type;
+	}
+
+    if (strcmp(buff, "dst") == 0)
+      return tDST;
+
+    /* Try the units table. */
+    for (tp = UnitsTable; tp < ENDOF(UnitsTable); tp++)
+	if (c == tp->name[0] && strcmp(p, tp->name) == 0) {
+	    yylval.Number = tp->value;
+	    return tp->type;
+	}
+
+    /* Strip off any plural and try the units table again. */
+    if (--length > 0 && p[length] == 's') {
+	p[length] = '\0';
+	for (tp = UnitsTable; tp < ENDOF(UnitsTable); tp++)
+	    if (c == tp->name[0] && strcmp(p, tp->name) == 0) {
+		p[length] = 's';
+		yylval.Number = tp->value;
+		return tp->type;
+	    }
+	p[length] = 's';
+    }
+    length++;
+
+    /* Drop out any periods. */
+    for (p = buff, q = (STRING)buff; *q; q++)
+	if (*q != '.')
+	    *p++ = *q;
+    *p = '\0';
+
+    /* Try the meridians. */
+    if (buff[1] == 'm' && buff[2] == '\0') {
+	if (buff[0] == 'a') {
+	    yylval.Meridian = MERam;
+	    return tMERIDIAN;
+	}
+	if (buff[0] == 'p') {
+	    yylval.Meridian = MERpm;
+	    return tMERIDIAN;
+	}
+    }
+
+    /* If we saw any periods, try the timezones again. */
+    if (p - buff != length) {
+	c = buff[0];
+	for (p = buff, tp = TimezoneTable; tp < ENDOF(TimezoneTable); tp++)
+	    if (c == tp->name[0] && p[1] == tp->name[1]
+	    && strcmp(p, tp->name) == 0) {
+		yylval.Number = tp->value;
+		return tp->type;
+	    }
+    }
+
+    /* Unknown word -- assume GMT timezone. */
+    yylval.Number = 0;
+    return tZONE;
+}
+
+
+static int
+date_lex(void)
+{
+    register char	c;
+    register char	*p;
+    char		buff[20];
+    register int	sign;
+    register int	i;
+    register int	nesting;
+
+    forever {
+	/* Get first character after the whitespace. */
+	forever {
+	    while (CTYPE(isspace, *yyInput))
+		yyInput++;
+	    c = *yyInput;
+
+	    /* Ignore RFC 822 comments, typically time zone names. */
+	    if (c != LPAREN)
+		break;
+	    for (nesting = 1; (c = *++yyInput) != RPAREN || --nesting; )
+		if (c == LPAREN)
+		    nesting++;
+		else if (!IS7BIT(c) || c == '\0' || c == '\r'
+		     || (c == '\\' && ((c = *++yyInput) == '\0' || !IS7BIT(c))))
+		    /* Lexical error: bad comment. */
+		    return '?';
+	    yyInput++;
+	}
+
+	/* A number? */
+	if (CTYPE(isdigit, c) || c == '-' || c == '+') {
+	    if (c == '-' || c == '+') {
+		sign = c == '-' ? -1 : 1;
+		yyInput++;
+		if (!CTYPE(isdigit, *yyInput))
+		    /* Skip the plus or minus sign. */
+		    continue;
+	    }
+	    else
+		sign = 0;
+	    for (i = 0; (c = *yyInput++) != '\0' && CTYPE(isdigit, c); )
+		i = 10 * i + c - '0';
+	    yyInput--;
+	    yylval.Number = sign < 0 ? -i : i;
+	    return sign ? tSNUMBER : tUNUMBER;
+	}
+
+	/* A word? */
+	if (CTYPE(isalpha, c)) {
+	    for (p = buff; (c = *yyInput++) == '.' || CTYPE(isalpha, c); )
+		if (p < &buff[sizeof buff - 1])
+		    *p++ = CTYPE(isupper, c) ? tolower(c) : c;
+	    *p = '\0';
+	    yyInput--;
+	    return LookupWord(buff, p - buff);
+	}
+
+	return *yyInput++;
+    }
+}
+
+
+int
+GetTimeInfo(
+    TIMEINFO		*Now)
+{
+    static time_t	LastTime;
+    static long		LastTzone;
+    struct tm		*tm;
+#if	defined(HAVE_GETTIMEOFDAY)
+    struct timeval	tv;
+#endif	/* defined(HAVE_GETTIMEOFDAY) */
+#if	defined(DONT_HAVE_TM_GMTOFF)
+    struct tm		local;
+    struct tm		gmt;
+#endif	/* !defined(DONT_HAVE_TM_GMTOFF) */
+
+    /* Get the basic time. */
+#if	defined(HAVE_GETTIMEOFDAY)
+    if (gettimeofday(&tv, (struct timezone *)NULL) == -1)
+	return -1;
+    Now->time = tv.tv_sec;
+    Now->usec = tv.tv_usec;
+#else
+    /* Can't check for -1 since that might be a time, I guess. */
+    (void)time(&Now->time);
+    Now->usec = 0;
+#endif	/* defined(HAVE_GETTIMEOFDAY) */
+
+    /* Now get the timezone if it's been an hour since the last time. */
+    if (Now->time - LastTime > 60 * 60) {
+	LastTime = Now->time;
+	if ((tm = localtime(&Now->time)) == NULL)
+	    return -1;
+#if	defined(DONT_HAVE_TM_GMTOFF)
+	/* To get the timezone, compare localtime with GMT. */
+	local = *tm;
+	if ((tm = gmtime(&Now->time)) == NULL)
+	    return -1;
+	gmt = *tm;
+
+	/* Assume we are never more than 24 hours away. */
+	LastTzone = gmt.tm_yday - local.tm_yday;
+	if (LastTzone > 1)
+	    LastTzone = -24;
+	else if (LastTzone < -1)
+	    LastTzone = 24;
+	else
+	    LastTzone *= 24;
+
+	/* Scale in the hours and minutes; ignore seconds. */
+	LastTzone += gmt.tm_hour - local.tm_hour;
+	LastTzone *= 60;
+	LastTzone += gmt.tm_min - local.tm_min;
+#else
+	LastTzone =  (0 - tm->tm_gmtoff) / 60;
+#endif	/* defined(DONT_HAVE_TM_GMTOFF) */
+    }
+    Now->tzone = LastTzone;
+    return 0;
+}
+
+
+time_t
+parsedate(
+    char		*p,
+    TIMEINFO		*now)
+{
+    struct tm		*tm;
+    TIMEINFO		ti;
+    time_t		Start;
+
+    yyInput = p;
+    if (now == NULL) {
+	now = &ti;
+	(void)GetTimeInfo(&ti);
+    }
+
+    tm = localtime(&now->time);
+    yyYear = tm->tm_year;
+    yyMonth = tm->tm_mon + 1;
+    yyDay = tm->tm_mday;
+    yyTimezone = now->tzone;
+    if(tm->tm_isdst)                   /* Correct timezone offset for DST */
+      yyTimezone += DST_OFFSET * 60;
+    yyDSTmode = DSTmaybe;
+    yyHour = 0;
+    yyMinutes = 0;
+    yySeconds = 0;
+    yyMeridian = MER24;
+    yyRelSeconds = 0;
+    yyRelMonth = 0;
+    yyHaveDate = 0;
+    yyHaveRel = 0;
+    yyHaveTime = 0;
+
+    if (date_parse() || yyHaveTime > 1 || yyHaveDate > 1)
+	return -1;
+
+    if (yyHaveDate || yyHaveTime) {
+	Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds,
+		    yyMeridian, yyDSTmode);
+	if (Start < 0)
+	    return -1;
+    }
+    else {
+	Start = now->time;
+	if (!yyHaveRel)
+	    Start -= (tm->tm_hour * 60L + tm->tm_min) * 60L + tm->tm_sec;
+    }
+
+    Start += yyRelSeconds;
+    if (yyRelMonth)
+	Start += RelativeMonth(Start, yyRelMonth);
+
+    /* Have to do *something* with a legitimate -1 so it's distinguishable
+     * from the error return value.  (Alternately could set errno on error.) */
+    return Start == -1 ? 0 : Start;
+}
diff -Nur tin-980117/vms/parse.c tin-980202/vms/parse.c
--- tin-980117/vms/parse.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/parse.c	Sun Feb  1 08:16:19 1998
@@ -0,0 +1,91 @@
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <rmsdef.h>
+#include <fab.h>
+#include <nam.h>
+#ifdef __GNUC__
+#include <vms/rms$routines.h>
+#endif
+#include "parse.h"
+
+struct filespec *sysparse(char *filename)
+{
+  struct FAB fab = cc$rms_fab;
+  struct NAM nam = cc$rms_nam;
+  static struct filespec spec;
+  char *ptr1, *ptr2;
+  char *ptr;
+  char fname[255];
+
+  int len, idx;
+
+  ptr = (char *)&fname;
+  strcpy(ptr, filename);
+
+  if (strcmp(ptr, "~") == 0)
+    strcpy(ptr, getenv("HOME"));
+  if (ptr1 = (char *)strstr(ptr, "[000000]["))
+   {
+    ptr2 = ptr1+8;
+    memmove(ptr1, ptr2, strlen(ptr2)+1);
+   }
+  while (ptr1 = (char *)strstr(ptr, "]["))
+   {  /* Remove any "]["'s in the string */
+    ptr2 = ptr1+2;
+    memmove(ptr1, ptr2, strlen(ptr2)+1);
+   } /* while */
+
+  for (idx=0;idx<strlen(ptr);idx++)
+   {
+    switch(ptr[idx])
+     {
+      case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G':
+      case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N':
+      case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U':
+      case 'V': case 'W': case 'X': case 'Y': case 'Z':
+      case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g':
+      case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
+      case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u':
+      case 'v': case 'w': case 'x': case 'y': case 'z':
+      case '0': case '1': case '2': case '3': case '4': case '5': case '6':
+      case '7': case '8': case '9':
+      case '$': case '-': case '_': case '[': case ']': case '<': case '>':
+      case ';': case '.': case ':':
+            break;
+      default : ptr[idx] = '$';     /* for the moment */
+     }
+   }
+
+  fab.fab$l_fna = ptr;
+  fab.fab$b_fns = strlen(ptr);
+  fab.fab$l_nam = &nam;
+  fab.fab$l_fop = FAB$M_NAM;
+  nam.nam$l_esa = spec.full;
+  nam.nam$b_ess = sizeof spec.full;
+  nam.nam$b_nop |= NAM$M_SYNCHK;
+
+  if (sys$parse(&fab, 0, 0) == RMS$_NORMAL) {
+    len = nam.nam$b_esl - 1;
+    if (spec.full[len] == ';' && spec.full[len - 1] == '.')
+      len -= 2;
+    spec.full[len + 1] = '\0';
+    if (nam.nam$b_dev > 0)
+      sprintf(spec.dev, "%*.*s", nam.nam$b_dev, nam.nam$b_dev, nam.nam$l_dev);
+    else
+      spec.dev[0] = 0;
+    if (nam.nam$b_dir > 0)
+      sprintf(spec.dir, "%*.*s", nam.nam$b_dir, nam.nam$b_dir, nam.nam$l_dir);
+    else
+      spec.dir[0] = 0;
+    if (nam.nam$b_name > 0)
+      sprintf(spec.filename, "%*.*s%*.*s", nam.nam$b_name, nam.nam$b_name,
+	      nam.nam$l_name, nam.nam$b_type, nam.nam$b_type, nam.nam$l_type);
+    else
+      spec.filename[0] = 0;
+    return &spec;
+  } else {
+    fprintf(stderr, "SYS$PARSE failed on %s\n", ptr);
+    exit(0);
+  }
+}
diff -Nur tin-980117/vms/parse.h tin-980202/vms/parse.h
--- tin-980117/vms/parse.h	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/parse.h	Thu Jun 15 02:28:34 1995
@@ -0,0 +1,10 @@
+#include <nam.h>
+
+struct filespec {
+  char dev[32];
+  char dir[256];
+  char filename[100];
+  char full[NAM$C_MAXRSS];
+};
+
+struct filespec *sysparse(char *filename);
diff -Nur tin-980117/vms/pwd.h tin-980202/vms/pwd.h
--- tin-980117/vms/pwd.h	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/pwd.h	Thu Jun 15 02:28:34 1995
@@ -0,0 +1,34 @@
+/* GNU Emacs password definition file.
+   Copyright (C) 1986 Free Software Foundation.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 1, or (at your option)
+any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs; see the file COPYING.  If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#ifdef VMS
+/* On VMS, we read the UAF file and emulate some of the necessary
+   fields for Emacs. */
+#include "uaf.h"
+
+struct passwd {
+  char pw_name[UAF$S_USERNAME+1];
+  char pw_passwd[UAF$S_PWD];
+  short pw_uid;
+  short pw_gid;
+  char pw_gecos[UAF$S_OWNER+1];
+  char pw_dir[UAF$S_DEFDEV+UAF$S_DEFDIR+1];
+  char pw_shell[UAF$S_DEFCLI+1];
+};
+#endif /* VMS */
diff -Nur tin-980117/vms/qsort.c tin-980202/vms/qsort.c
--- tin-980117/vms/qsort.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/qsort.c	Thu Jun 15 02:28:40 1995
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)qsort.c	5.1 (Berkeley) 6/5/85";
+#endif /* not lint */
+
+/*
+ * qsort.c:
+ * Our own version of the system qsort routine which is faster by an average
+ * of 25%, with lows and highs of 10% and 50%.
+ * The THRESHold below is the insertion sort threshold, and has been adjusted
+ * for records of size 48 bytes.
+ * The MTHREShold is where we stop finding a better median.
+ */
+
+#define		THRESH		4		/* threshold for insertion */
+#define		MTHRESH		6		/* threshold for median */
+
+static  int		(*qcmp)();		/* the comparison routine */
+static  int		qsz;			/* size of each record */
+static  int		thresh;			/* THRESHold in chars */
+static  int		mthresh;		/* MTHRESHold in chars */
+static void qst(char *base, char *max);
+
+/*
+ * my_qsort:
+ * First, set up some global parameters for qst to share.  Then, quicksort
+ * with qst(), and then a cleanup insertion sort ourselves.  Sound simple?
+ * It's not...
+ */
+
+void my_qsort(char *base, int n, int size, int (*compar)())
+{
+	register char c, *i, *j, *lo, *hi;
+	char *min, *max;
+
+	if (n <= 1)
+		return;
+	qsz = size;
+	qcmp = compar;
+	thresh = qsz * THRESH;
+	mthresh = qsz * MTHRESH;
+	max = base + n * qsz;
+	if (n >= THRESH) {
+		qst(base, max);
+		hi = base + thresh;
+	} else {
+		hi = max;
+	}
+	/*
+	 * First put smallest element, which must be in the first THRESH, in
+	 * the first position as a sentinel.  This is done just by searching
+	 * the first THRESH elements (or the first n if n < THRESH), finding
+	 * the min, and swapping it into the first position.
+	 */
+	for (j = lo = base; (lo += qsz) < hi; )
+		if ((*qcmp)(j, lo) > 0)
+			j = lo;
+	if (j != base) {
+		/* swap j into place */
+		for (i = base, hi = base + qsz; i < hi; ) {
+			c = *j;
+			*j++ = *i;
+			*i++ = c;
+		}
+	}
+	/*
+	 * With our sentinel in place, we now run the following hyper-fast
+	 * insertion sort.  For each remaining element, min, from [1] to [n-1],
+	 * set hi to the index of the element AFTER which this one goes.
+	 * Then, do the standard insertion sort shift on a character at a time
+	 * basis for each element in the frob.
+	 */
+	for (min = base; (hi = min += qsz) < max; ) {
+		while ((*qcmp)(hi -= qsz, min) > 0)
+			/* void */;
+		if ((hi += qsz) != min) {
+			for (lo = min + qsz; --lo >= min; ) {
+				c = *lo;
+				for (i = j = lo; (j -= qsz) >= hi; i = j)
+					*i = *j;
+				*i = c;
+			}
+		}
+	}
+}
+
+/*
+ * qst:
+ * Do a quicksort
+ * First, find the median element, and put that one in the first place as the
+ * discriminator.  (This "median" is just the median of the first, last and
+ * middle elements).  (Using this median instead of the first element is a big
+ * win).  Then, the usual partitioning/swapping, followed by moving the
+ * discriminator into the right place.  Then, figure out the sizes of the two
+ * partions, do the smaller one recursively and the larger one via a repeat of
+ * this code.  Stopping when there are less than THRESH elements in a partition
+ * and cleaning up with an insertion sort (in our caller) is a huge win.
+ * All data swaps are done in-line, which is space-losing but time-saving.
+ * (And there are only three places where this is done).
+ */
+
+static void qst(char *base, char *max)
+{
+	register char c, *i, *j, *jj;
+	register int ii;
+	char *mid, *tmp;
+	int lo, hi;
+
+	/*
+	 * At the top here, lo is the number of characters of elements in the
+	 * current partition.  (Which should be max - base).
+	 * Find the median of the first, last, and middle element and make
+	 * that the middle element.  Set j to largest of first and middle.
+	 * If max is larger than that guy, then it's that guy, else compare
+	 * max with loser of first and take larger.  Things are set up to
+	 * prefer the middle, then the first in case of ties.
+	 */
+	lo = max - base;		/* number of elements as chars */
+	do	{
+		mid = i = base + qsz * ((lo / qsz) >> 1);
+		if (lo >= mthresh) {
+			j = ((*qcmp)((jj = base), i) > 0 ? jj : i);
+			if ((*qcmp)(j, (tmp = max - qsz)) > 0) {
+				/* switch to first loser */
+				j = (j == jj ? i : jj);
+				if ((*qcmp)(j, tmp) < 0)
+					j = tmp;
+			}
+			if (j != i) {
+				ii = qsz;
+				do	{
+					c = *i;
+					*i++ = *j;
+					*j++ = c;
+				} while (--ii);
+			}
+		}
+		/*
+		 * Semi-standard quicksort partitioning/swapping
+		 */
+		for (i = base, j = max - qsz; ; ) {
+			while (i < mid && (*qcmp)(i, mid) <= 0)
+				i += qsz;
+			while (j > mid) {
+				if ((*qcmp)(mid, j) <= 0) {
+					j -= qsz;
+					continue;
+				}
+				tmp = i + qsz;	/* value of i after swap */
+				if (i == mid) {
+					/* j <-> mid, new mid is j */
+					mid = jj = j;
+				} else {
+					/* i <-> j */
+					jj = j;
+					j -= qsz;
+				}
+				goto swap;
+			}
+			if (i == mid) {
+				break;
+			} else {
+				/* i <-> mid, new mid is i */
+				jj = mid;
+				tmp = mid = i;	/* value of i after swap */
+				j -= qsz;
+			}
+		swap:
+			ii = qsz;
+			do	{
+				c = *i;
+				*i++ = *jj;
+				*jj++ = c;
+			} while (--ii);
+			i = tmp;
+		}
+		/*
+		 * Look at sizes of the two partitions, do the smaller
+		 * one first by recursion, then do the larger one by
+		 * making sure lo is its size, base and max are update
+		 * correctly, and branching back.  But only repeat
+		 * (recursively or by branching) if the partition is
+		 * of at least size THRESH.
+		 */
+		i = (j = mid) + qsz;
+		if ((lo = j - base) <= (hi = max - i)) {
+			if (lo >= thresh)
+				qst(base, j);
+			base = i;
+			lo = hi;
+		} else {
+			if (hi >= thresh)
+				qst(i, max);
+			max = j;
+		}
+	} while (lo >= thresh);
+}
diff -Nur tin-980117/vms/select.h tin-980202/vms/select.h
--- tin-980117/vms/select.h	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/select.h	Thu Jan 15 01:37:54 1998
@@ -0,0 +1,26 @@
+#define NBBY	8		/* number of bits in a byte */
+/*
+ * Select uses bit masks of file descriptors in longs.
+ * These macros manipulate such bit fields (the filesystem macros use chars).
+ * FD_SETSIZE may be defined by the user, but the default here
+ * should be >= CHANNELCNT (SYSGEN parameter)
+ */
+#ifndef FD_SETSIZE
+#define FD_SETSIZE	512
+#endif
+#define CHANNELSIZE	16	/* Size of a channel */
+
+typedef long	fd_mask;
+#define NFDBITS (sizeof(fd_mask) * NBBY)	/* bits per mask */
+#ifndef howmany
+#define howmany(x, y)	(((x)+((y)-1))/(y))
+#endif
+
+typedef struct fd_set {
+	fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
+} fd_set;
+
+#define FD_SET(n, p)	((p)->fds_bits[(n)/CHANNELSIZE/NFDBITS] |= (1 << (((n)/CHANNELSIZE) % NFDBITS)))
+#define FD_CLR(n, p)	((p)->fds_bits[(n)/CHANNELSIZE/NFDBITS] &= ~(1 << (((n)/CHANNELSIZE) % NFDBITS)))
+#define FD_ISSET(n, p)	((!((n) % CHANNELSIZE)) && ((p)->fds_bits[(n)/CHANNELSIZE/NFDBITS] & (1 << (((n)/CHANNELSIZE) % NFDBITS))))
+#define FD_ZERO(p)	memset((char *)(p),'\0',sizeof(*(p)))
diff -Nur tin-980117/vms/strings.h tin-980202/vms/strings.h
--- tin-980117/vms/strings.h	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/strings.h	Thu Jun 15 02:28:34 1995
@@ -0,0 +1,32 @@
+#ifndef __STRING_LOADED
+#define __STRING_LOADED	1
+
+/*	STRING - V3.0 - String handling function definitions	*/
+
+#pragma nostandard
+#include stddef
+#pragma standard
+
+char   *strcpy	(char *s1, const char *s2);
+char   *strncpy	(char *s1, const char *s2, size_t n);
+char   *strcat	(char *s1, const char *s2);
+char   *strncat	(char *s1, const char *s2, size_t n);
+int	strcmp	(const char *s1, const char *s2);
+int	strncmp	(const char *s1, const char *s2, size_t n);
+char   *strchr	(const char *s, int character);
+char   *strrchr	(const char *s, int character);
+size_t	strspn	(const char *s1, const char *s2);
+size_t	strcspn	(const char *s1, const char *s2);
+size_t	strlen	(const char *s);
+char   *strpbrk	(const char *s1, const char *s2);
+char   *strstr	(const char *s1, const char *s2);
+char   *strtok	(char *s1, const char *s2);
+char   *strerror(int errnum, ...);
+
+int	memcmp	(const void *s1, const void *s2, size_t size);
+void   *memchr	(const void *s1, int c, size_t size);
+void   *memcpy	(void *s1, const void *s2, size_t size);
+void   *memmove	(void *s1, const void *s2, size_t size);
+void   *memset	(void *s, int character, size_t size);
+
+#endif					/* __STRING_LOADED */
diff -Nur tin-980117/vms/uaf.h tin-980202/vms/uaf.h
--- tin-980117/vms/uaf.h	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/uaf.h	Thu Jun 15 02:28:34 1995
@@ -0,0 +1,295 @@
+/* GNU Emacs VMS UAF definition file.
+   Copyright (C) 1986 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 1, or (at your option)
+any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs; see the file COPYING.  If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+/*
+ * User Authorization File record formats
+ */
+#ifndef UAF$K_LENGTH
+
+struct UAF {
+#define	UAF$C_USER_ID	1
+#define	UAF$C_VERSION1	1
+#define	UAF$C_KEYED_PART	52
+#define	UAF$C_AD_II	0
+#define	UAF$C_PURDY	1
+#define	UAF$C_PURDY_V	2
+#define	UAF$K_FIXED	644
+#define	UAF$C_FIXED	644
+#define	UAF$K_LENGTH	1412
+#define	UAF$C_LENGTH	1412
+#define	UAF$S_UAFDEF	1412
+#define	UAF$B_RTYPE	0
+  char uaf$b_rtype;
+#define	UAF$B_VERSION	1
+  char uaf$b_version;
+#define	UAF$W_USRDATOFF	2
+  short	uaf$w_usrdatoff;
+#define	UAF$S_USERNAME	32
+#define	UAF$T_USERNAME	4
+#define	UAF$T_USERNAME_TAG	35
+  char uaf$t_username[UAF$S_USERNAME];
+#define	UAF$L_UIC	36
+#define	UAF$W_MEM	36
+#define	UAF$W_GRP	38
+  union {
+    long uaf_l_uic;
+#define	uaf$l_uic	uaf_u_uic.uaf_l_uic
+    struct {
+      short uaf_w_mem;
+      short uaf_w_grp;
+#define	uaf$w_mem	uaf_u_uic.uaf_u_mem_grp.uaf_w_mem
+#define	uaf$w_grp	uaf_u_uic.uaf_u_mem_grp.uaf_w_grp
+    } uaf_u_mem_grp;
+  } uaf_u_uic;
+#define	UAF$L_SUB_ID	40
+  long	uaf$l_sub_id;
+#define	UAF$S_PARENT_ID	8
+#define	UAF$Q_PARENT_ID	44
+  char	uaf$q_parent_id[UAF$S_PARENT_ID];
+#define	UAF$S_ACCOUNT	32
+#define	UAF$T_ACCOUNT	52
+  char	uaf$t_account[UAF$S_ACCOUNT];
+#define	UAF$S_OWNER	32
+#define	UAF$T_OWNER	84
+  char	uaf$t_owner[UAF$S_OWNER];
+#define	UAF$S_DEFDEV	32
+#define	UAF$T_DEFDEV	116
+  char	uaf$t_defdev[UAF$S_DEFDEV];
+#define	UAF$S_DEFDIR	64
+#define	UAF$T_DEFDIR	148
+  char	uaf$t_defdir[UAF$S_DEFDIR];
+#define	UAF$S_LGICMD	64
+#define	UAF$T_LGICMD	212
+  char	uaf$t_lgicmd[UAF$S_LGICMD];
+#define	UAF$S_DEFCLI	32
+#define	UAF$T_DEFCLI	276
+  char	uaf$t_defcli[UAF$S_DEFCLI];
+#define	UAF$S_CLITABLES	32
+#define	UAF$T_CLITABLES	308
+  char	uaf$t_clitables[UAF$S_CLITABLES];
+#define	UAF$S_PWD	8
+#define	UAF$Q_PWD	340
+#define	UAF$L_PWD	340
+  char	uaf$q_pwd[UAF$S_PWD];
+#define uaf$l_pwd	uaf$q_pwd[0]
+#define	UAF$S_PWD2	8
+#define	UAF$Q_PWD2	348
+  char	uaf$q_pwd2[UAF$S_PWD2];
+#define	UAF$W_LOGFAILS	356
+  short	uaf$w_logfails;
+#define	UAF$W_SALT	358
+  short	uaf$w_salt;
+#define	UAF$B_ENCRYPT	360
+  char	uaf$b_encrypt;
+#define	UAF$B_ENCRYPT2	361
+  char	uaf$b_encrypt2;
+#define	UAF$B_PWD_LENGTH	362
+  char	uaf$b_pwd_length;
+#define	UAF$S_EXPIRATION	8
+#define	UAF$Q_EXPIRATION	364
+  char	uaf$q_expiration[UAF$S_EXPIRATION];
+#define	UAF$S_PWD_LIFETIME	8
+#define	UAF$Q_PWD_LIFETIME	372
+  char	uaf$q_pwd_lifetime[UAF$S_PWD_LIFETIME];
+#define	UAF$S_PWD_DATE	8
+#define	UAF$Q_PWD_DATE	380
+  char	uaf$q_pwd_date[UAF$S_PWD_DATE];
+#define	UAF$S_PWD2_DATE	8
+#define	UAF$Q_PWD2_DATE	388
+  char	uaf$q_pwd2_date[UAF$S_PWD2_DATE];
+#define	UAF$S_LASTLOGIN_I	8
+#define	UAF$Q_LASTLOGIN_I	396
+  char	uaf$q_lastlogin_i[UAF$S_LASTLOGIN_I];
+#define	UAF$S_LASTLOGIN_N	8
+#define	UAF$Q_LASTLOGIN_N	404
+  char	uaf$q_lastlogin_n[UAF$S_LASTLOGIN_N];
+#define	UAF$S_PRIV	8
+#define	UAF$Q_PRIV	412
+  char	uaf$q_priv[UAF$S_PRIV];
+#define	UAF$S_DEF_PRIV	8
+#define	UAF$Q_DEF_PRIV	420
+  char	uaf$q_def_priv[UAF$S_DEF_PRIV];
+#define	UAF$S_MIN_CLASS	20
+#define	UAF$R_MIN_CLASS	428
+  char	uaf$r_min_class[UAF$S_MIN_CLASS];
+#define	UAF$S_MAX_CLASS	20
+#define	UAF$R_MAX_CLASS	448
+  char	uaf$r_max_class[UAF$S_MAX_CLASS];
+#define	UAF$L_FLAGS	468
+#define	UAF$V_DISCTLY	0
+#define	UAF$V_DEFCLI	1
+#define	UAF$V_LOCKPWD	2
+#define	UAF$V_CAPTIVE	3
+#define	UAF$V_DISACNT	4
+#define	UAF$V_DISWELCOM	5
+#define	UAF$V_DISMAIL	6
+#define	UAF$V_NOMAIL	7
+#define	UAF$V_GENPWD	8
+#define	UAF$V_PWD_EXPIRED	9
+#define	UAF$V_PWD2_EXPIRED	10
+#define	UAF$V_AUDIT	11
+#define	UAF$V_DISREPORT	12
+#define	UAF$V_DISRECONNECT	13
+  union {
+    unsigned long	uaf_l_flags;
+#define uaf$l_flags uaf_u_flags.uaf_l_flags
+    struct {
+      unsigned long
+	uaf_v_disctly : 1,
+#define uaf$v_disctly uaf_u_flags.uaf_v_flags.uaf_v_disctly
+      uaf_v_defcli : 1,
+#define uaf$v_defcli uaf_u_flags.uaf_v_flags.uaf_v_discli
+      uaf_v_lockpwd : 1,
+#define uaf$v_lockpwd uaf_u_flags.uaf_v_flags.uaf_v_lockpwd
+      uaf_v_captive : 1,
+#define uaf$v_captive uaf_u_flags.uaf_v_flags.uaf_v_captive
+      uaf_v_disacnt : 1,
+#define uaf$v_disacnt uaf_u_flags.uaf_v_flags.uaf_v_disacnt
+      uaf_v_diswelcom : 1,
+#define uaf$v_diswelcom uaf_u_flags.uaf_v_flags.uaf_v_diswelcom
+      uaf_v_dismail : 1,
+#define uaf$v_dismail uaf_u_flags.uaf_v_flags.uaf_v_dismail
+      uaf_v_nomail : 1,
+#define uaf$v_nomail uaf_u_flags.uaf_v_flags.uaf_v_nomail
+      uaf_v_genpwd : 1,
+#define uaf$v_genpwd uaf_u_flags.uaf_v_flags.uaf_v_genpwd
+      uaf_v_pwd_expired : 1,
+#define uaf$v_pwd_expired uaf_u_flags.uaf_v_flags.uaf_v_pwd_expired
+      uaf_v_pwd2_expired : 1,
+#define uaf$v_pwd2_expired uaf_u_flags.uaf_v_flags.uaf_v_pwd2_expired
+      uaf_v_audit : 1,
+#define uaf$v_audit uaf_u_flags.uaf_v_flags.uaf_v_audit
+      uaf_v_disreport : 1,
+#define uaf$v_disreport uaf_u_flags.uaf_v_flags.uaf_v_disreport
+      uaf_v_disreconnect : 1;
+#define uaf$v_disreconnect uaf_u_flags.uaf_v_flags.uaf_v_disreconnect
+    } uaf_v_flags;
+  } uaf_u_flags;
+#define	UAF$S_NETWORK_ACCESS_P	3
+#define	UAF$B_NETWORK_ACCESS_P	472
+  char	uaf$b_network_access_p[UAF$S_NETWORK_ACCESS_P];
+#define	UAF$S_NETWORK_ACCESS_S	3
+#define	UAF$B_NETWORK_ACCESS_S	475
+  char	uaf$b_network_access_s[UAF$S_NETWORK_ACCESS_S];
+#define	UAF$S_BATCH_ACCESS_P	3
+#define	UAF$B_BATCH_ACCESS_P	478
+  char	uaf$b_batch_access_p[UAF$S_BATCH_ACCESS_P];
+#define	UAF$S_BATCH_ACCESS_S	3
+#define	UAF$B_BATCH_ACCESS_S	481
+  char	uaf$b_batch_access_s[UAF$S_BATCH_ACCESS_S];
+#define	UAF$S_LOCAL_ACCESS_P	3
+#define	UAF$B_LOCAL_ACCESS_P	484
+  char	uaf$b_local_access_p[UAF$S_LOCAL_ACCESS_P];
+#define	UAF$S_LOCAL_ACCESS_S	3
+#define	UAF$B_LOCAL_ACCESS_S	487
+  char	uaf$b_local_access_s[UAF$S_LOCAL_ACCESS_S];
+#define	UAF$S_DIALUP_ACCESS_P	3
+#define	UAF$B_DIALUP_ACCESS_P	490
+  char	uaf$b_dialup_access_p[UAF$S_DIALUP_ACCESS_P];
+#define	UAF$S_DIALUP_ACCESS_S	3
+#define	UAF$B_DIALUP_ACCESS_S	493
+  char	uaf$b_dialup_access_s[UAF$S_DIALUP_ACCESS_S];
+#define	UAF$S_REMOTE_ACCESS_P	3
+#define	UAF$B_REMOTE_ACCESS_P	496
+  char	uaf$b_remote_access_p[UAF$S_REMOTE_ACCESS_P];
+#define	UAF$S_REMOTE_ACCESS_S	3
+#define	UAF$B_REMOTE_ACCESS_S	499
+  char	uaf$b_remote_access_s[UAF$S_REMOTE_ACCESS_S];
+#define	UAF$B_PRIMEDAYS	514
+#define	UAF$V_MONDAY	0
+#define	UAF$V_TUESDAY	1
+#define	UAF$V_WEDNESDAY	2
+#define	UAF$V_THURSDAY	3
+#define	UAF$V_FRIDAY	4
+#define	UAF$V_SATURDAY	5
+#define	UAF$V_SUNDAY	6
+  union {
+    unsigned char	uaf_b_primedays;
+#define uaf$b_primedays uaf_u_primedays.uaf_b_primedays
+    unsigned char
+      uaf_v_monday : 1,
+#define uaf$v_monday uaf_u_primedays.uaf_v_monday
+    uaf_v_tuesday : 1,
+#define uaf$v_tuesday uaf_u_primedays.uaf_v_tuesday
+    uaf_v_wednesday : 1,
+#define uaf$v_wednesday uaf_u_primedays.uaf_v_wednesday
+    uaf_v_thursday : 1,
+#define uaf$v_thursday uaf_u_primedays.uaf_v_thrusday
+    uaf_v_friday : 1,
+#define uaf$v_friday uaf_u_primedays.uaf_v_friday
+    uaf_v_saturday : 1,
+#define uaf$v_saturday uaf_u_primedays.uaf_v_saturday
+    uav_v_sunday : 1;
+#define uaf$v_sunday uaf_u_primedays.uaf_v_sunday
+  } uaf_u_primedays;
+#define	UAF$B_PRI	516
+  char	uaf$b_pri;
+#define	UAF$B_QUEPRI	517
+  char	uaf$b_quepri;
+#define	UAF$W_MAXJOBS	518
+  short	uaf$w_maxjobs;
+#define	UAF$W_MAXACCTJOBS	520
+  short	uaf$w_maxacctjobs;
+#define	UAF$W_MAXDETACH	522
+  short	uaf$w_maxdetach;
+#define	UAF$W_PRCCNT	524
+  short	uaf$w_prccnt;
+#define	UAF$W_BIOLM	526
+  short	uaf$w_biolm;
+#define	UAF$W_DIOLM	528
+  short	uaf$w_diolm;
+#define	UAF$W_TQCNT	530
+  short	uaf$w_twcnt;
+#define	UAF$W_ASTLM	532
+  short	uaf$w_astlm;
+#define	UAF$W_ENQLM	534
+  short	uaf$w_enqlm;
+#define	UAF$W_FILLM	536
+  short	uaf$w_fillm;
+#define	UAF$W_SHRFILLM	538
+  short	uaf$w_shrfillm;
+#define	UAF$L_WSQUOTA	540
+  long	uaf$l_wsquota;
+#define	UAF$L_DFWSCNT	544
+  long	uaf$l_dfwscnt;
+#define	UAF$L_WSEXTENT	548
+  long	uaf$l_wsextent;
+#define	UAF$L_PGFLQUOTA	552
+  long	uaf$l_pgflquota;
+#define	UAF$L_CPUTIM	556
+  long	uaf$l_cputim;
+#define	UAF$L_BYTLM	560
+  long	uaf$l_bytlm;
+#define	UAF$L_PBYTLM	564
+  long	uaf$l_pbytlm;
+#define	UAF$L_JTQUOTA	568
+  long	uaf$l_jtquota;
+#define	UAF$W_PROXY_LIM	572
+  short	uaf$w_proxy_lim;
+#define	UAF$W_PROXIES	574
+  short	uaf$w_proxies;
+#define	UAF$W_ACCOUNT_LIM	576
+  short	uaf$w_account_lim;
+#define	UAF$W_ACCOUNTS	578
+  short	uaf$w_accounts;
+  char	uaf$b_fixed[UAF$C_FIXED - UAF$W_ACCOUNTS + 2];
+  char	uaf$b_usrdata[UAF$C_LENGTH - UAF$C_FIXED];
+};
+
+#endif /* not UAF$K_LENGTH */
diff -Nur tin-980117/vms/vms.c tin-980202/vms/vms.c
--- tin-980117/vms/vms.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/vms.c	Sun Feb  1 08:17:23 1998
@@ -0,0 +1,350 @@
+/*
+ *  Project   : tin - a Usenet reader
+ *  Module    : vms.c
+ *  Author    : Andrew Greer
+ *  Created   : 19-06-95
+ *  Updated   : 24-01-98  by Michael Stenns
+ *  Notes     :
+ *  Copyright : (c) Copyright 1991-95 by Iain Lea & Andrew Greer
+ *              You may  freely  copy or  redistribute  this software,
+ *              so  long as there is no profit made from its use, sale
+ *              trade or  reproduction.  You may not change this copy-
+ *              right notice, and it must be included in any copy made
+ */
+
+#ifdef VMS
+#include <stdio.h>
+#include <descrip.h>
+#include <iodef.h>
+#include <ssdef.h>
+#include <uaidef.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/file.h>
+#ifdef __GNUC__
+#include <vms/sys$routines.h>
+#else
+#include <starlet.h>
+#endif
+#include "tin.h"
+
+/* local prototypes */
+char * lower (char * str);
+static int vms_open_channel (char * device);
+
+/* global variables for current module */
+static int stdin_chan = 0;  /* vms channel to sys$input */
+static int stdin_ef   = 0;  /* event flag for read from stdin_chan */
+
+/* Get the name of current user */
+char *
+getlogin (void)
+{
+	char *p;
+
+	if ((p = getenv ("USER")) == NULL) {
+		return ( (char *) 0);
+	}
+
+	return (p);
+}
+
+
+/* return a pointer to string descriptor for zero terminated strings */
+struct dsc$descriptor *desz(char *c$_str)
+{
+  static struct dsc$descriptor c$_tmpdesc;
+
+  c$_tmpdesc.dsc$w_length = strlen(c$_str);
+  c$_tmpdesc.dsc$b_dtype  = DSC$K_DTYPE_T;
+  c$_tmpdesc.dsc$b_class  = DSC$K_CLASS_S;
+  c$_tmpdesc.dsc$a_pointer= c$_str;
+  return(&c$_tmpdesc);
+}
+
+
+/*
+ * Author: unknown
+ * Last edit: M. Stenns  (Oct 1997)
+ * Comment:
+ * returns the process owner (Owner field in uaf)
+ */
+char *get_uaf_fullname()
+{
+  static char uaf_owner[40];
+  int i,status;
+
+  struct item_list {
+    short bl, ic;
+    char *ba;
+    short *rl;
+  } getuai_itmlist[] = {
+    {
+      sizeof uaf_owner - 1,
+      UAI$_OWNER,
+      uaf_owner,
+      0
+    },
+    { 0, 0, 0, 0}
+  };
+
+  memset (uaf_owner, '\0', sizeof uaf_owner);
+  status = sys$getuai(0,0,desz(cuserid(NULL)),getuai_itmlist,0,0,0);
+  if (!(status & 1)) strcpy (uaf_owner, cuserid(NULL));
+
+  for (i=0;uaf_owner[i] && iscntrl(uaf_owner[i]);i++);
+  return &uaf_owner[i];
+}
+
+/* Converts "TOD_MCQUILLIN" to "Tod McQuillin" */
+char *fix_fullname(char *p)
+{
+  char *tmp;
+
+  if (p && *p) {
+    while ((tmp = strchr(p,'_'))) *tmp = ' ';
+    tmp = lower(p);
+    if (*tmp) *tmp = toupper (*tmp);
+    while ((tmp = strchr(tmp,' '))) {
+      tmp++;
+      if (*tmp) *tmp = toupper (*tmp);
+    }
+    if ((tmp = strstr(p, "Mc"))) {
+      tmp += 2;
+      if (*tmp) *tmp = toupper (*tmp);
+    }
+    tmp = p + strlen(p) - 1;
+    while ((tmp > p) && isspace(*tmp)) *tmp-- = '\0';
+  }
+
+  return p;
+}
+
+#ifndef INDEX_DAEMON
+
+int tputs (char * str, int zzz, OutcPtr func)
+{
+	if (! str) {
+		return(0);
+	}
+	if (func == outchar) {
+		fputs (str, stdout);
+	} else {
+		while (*str) {
+			if (*str == '\n') {
+				func('\r');
+			}
+			func(*str++);
+		}
+	}
+	return(0);
+}
+
+#endif
+
+FILE *
+popen (
+	char *command,
+	char *mode)
+{
+	return ((FILE *) 0);
+}
+
+
+void
+pclose (FILE *pipe)
+{
+	return;
+}
+
+void tzset(void)
+{
+	return;
+}
+
+void
+make_post_cmd (cmd, name)
+	char *cmd;
+	char *name;
+{
+	char *p;
+
+	if ((p = getenv (ENV_VAR_POSTER)) != (char *) 0) {
+		sprintf (cmd, p, name);
+	} else {
+		sprintf (cmd, DEFAULT_POSTER, name);
+	}
+	return;
+}
+
+
+/*
+ * vms_open_channel (char * device)
+ *
+ * Opens a channel to the device specified as argument.
+ * Return value:
+ *  VMS channel number
+ */
+
+static int vms_open_channel (char * device)
+{
+  int channel = 0;
+  int status;
+
+  status = sys$assign (desz(device), &channel,0,0);
+  if ((status & 1) != 1)
+  {
+     perror ("cannot assgin channel to sys$input");
+     exit (EXIT_FAILURE);
+  }
+  status = lib$get_ef (&stdin_ef);
+  if ((status & 1) != 1)
+  {
+     perror ("cannot get event flag");
+     exit (EXIT_FAILURE);
+  }
+  return channel;
+}
+
+/*
+ * int vms_close_stdin (void)
+ *
+ * frees the resources used by ReadCh() and ReadChNowait()
+ */
+int vms_close_stdin (void)
+{
+  int status;
+
+  status = sys$cancel (stdin_chan);
+  if ((status & 1) != 1)
+  {
+     perror ("cannot cancel I/O request");
+     return status;
+  }
+
+  status = sys$dassgn (stdin_chan);
+  if ((status & 1) != 1)
+  {
+     perror ("cannot close channel");
+     return status;
+  }
+  stdin_chan = 0;
+
+  status = lib$free_ef (&stdin_ef);
+  if ((status & 1) != 1)
+  {
+     perror ("cannot free event flag");
+     exit (EXIT_FAILURE);
+  }
+  stdin_ef = 0;
+
+  return status;
+}
+
+/*
+ * Read character from termianl without echo
+ * Return zero if no input hanging
+ */
+int ReadChNowait (void)
+{
+  static int tt_char = 0;
+  static short int iosb[4] = {1,0,0,0};
+  int character     = 0;
+  int status = SS$_NORMAL;
+
+  if (!stdin_chan) stdin_chan = vms_open_channel ("sys$input");
+
+  if (iosb[0])  /* no qio pending */
+  {
+    if (iosb[0] == SS$_TIMEOUT)
+      character = 0;
+    else if (iosb[0] != SS$_NORMAL)
+      character = EOF;
+    else
+      character = tt_char;
+
+    status = sys$qio (stdin_ef, stdin_chan,
+                     IO$_READVBLK|IO$M_NOFILTR|IO$M_NOECHO|IO$M_TIMED,
+                     iosb,0,0,
+                     &tt_char,1,1,0,0,0);
+    if (status != SS$_NORMAL)
+    {
+      fprintf (stderr,"sys$qiow failed in ReadCh ()\n");
+      exit (status);
+    }
+  }
+
+  return character;
+}
+
+
+/*
+ * Read character from termianl without echo
+ */
+int ReadCh (void)
+{
+  int character     = 0;
+  int status = SS$_NORMAL;
+  short int iosb[4];
+
+  while ((status == SS$_NORMAL) && !character)
+  {
+    character = ReadChNowait();
+    if (!character) status = sys$waitfr (stdin_ef);
+  }
+  return character;
+}
+
+
+/* ======================================================================== */
+/* lower - convert string to lowercase */
+/* ======================================================================== */
+char * lower (char * str)
+{
+char * tmp;
+
+ /* convert to lower */
+ if (str)
+ {
+    for (tmp = str; *tmp; tmp++) *tmp = tolower (*tmp);
+ }
+ return str;
+}
+
+
+/******************************************************************************
+ * vms_errmsg converts errno to an readable string
+ * return values:
+ *   the converted string
+ *****************************************************************************/
+char * vms_errmsg (int error_number)
+{
+  char * message;
+
+  message = strerror(errno);
+  if (!message) message = "unknown error code";
+  return message;
+}
+
+/*
+ *  setenv (char *name, char *value, int notused)
+ */
+int setenv (char *name, char *value, int notused)
+{
+  int status = 0;
+  char command[LEN];
+
+  if (name && value)
+  {
+    if (sprintf(command,"define/nolog/job %s \"%s\" ",name,value) > sizeof command)
+    {
+	fprintf (stderr, "FATAL buffer overflow in setenv");
+	tin_done (EXIT_FAILURE);
+    }
+    status = system(command);
+  }
+  return status;
+}
+
+
+#endif /* VMS */
diff -Nur tin-980117/vms/vmsdir.c tin-980202/vms/vmsdir.c
--- tin-980117/vms/vmsdir.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/vmsdir.c	Sun Feb  1 08:17:40 1998
@@ -0,0 +1,130 @@
+#include <errno.h>
+#include <unixio.h>
+#include <stdlib.h>
+#include "strings.h"
+#include <sys/stat.h>
+#include "ndir.h"
+
+int sys_read (int fildes, char *buf, unsigned int nbyte);
+
+int
+/* VARARGS 2 */
+sys_open (path, oflag, mode)
+     char *path;
+     int oflag, mode;
+{
+  register int rtnval;
+
+  while ((rtnval = open (path, oflag, mode)) == -1
+	 && (errno == EINTR));
+  return (rtnval);
+}
+
+int sys_close (int fd)
+{
+  register int rtnval;
+
+  while ((rtnval = close (fd)) == -1
+	 && (errno == EINTR));
+  return rtnval;
+}
+
+DIR *
+opendir (filename)
+     char *filename;	/* name of directory */
+{
+  register DIR *dirp;		/* -> malloc'ed storage */
+  register int fd;		/* file descriptor for read */
+  struct stat sbuf;		/* result of fstat() */
+
+  fd = sys_open (filename, 0);
+  if (fd < 0)
+    return 0;
+
+  if (fstat (fd, &sbuf) < 0
+      || (sbuf.st_mode & S_IFMT) != S_IFDIR
+      || (dirp = (DIR *) malloc (sizeof (DIR))) == 0)
+    {
+      sys_close (fd);
+      return 0;		/* bad luck today */
+    }
+
+  dirp->dd_fd = fd;
+  dirp->dd_loc = dirp->dd_size = 0;	/* refill needed */
+
+  return dirp;
+}
+
+void
+closedir (dirp)
+     register DIR *dirp;		/* stream from opendir() */
+{
+  sys_close (dirp->dd_fd);
+  free ((char *) dirp);
+}
+
+struct direct dir_static;	/* simulated directory contents */
+
+/* ARGUSED */
+struct direct *
+readdir (dirp)
+     register DIR *dirp;	/* stream from opendir() */
+{
+#ifndef VMS
+  register struct olddir *dp;	/* -> directory data */
+#else /* VMS */
+  register struct dir$_name *dp; /* -> directory data */
+  register struct dir$_version *dv; /* -> version data */
+#endif /* VMS */
+
+  for (; ;)
+    {
+      if (dirp->dd_loc >= dirp->dd_size)
+	dirp->dd_loc = dirp->dd_size = 0;
+
+      if (dirp->dd_size == 0 	/* refill buffer */
+	  && (dirp->dd_size = sys_read (dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ)) <= 0)
+	return 0;
+
+#ifndef VMS
+      dp = (struct olddir *) &dirp->dd_buf[dirp->dd_loc];
+      dirp->dd_loc += sizeof (struct olddir);
+
+      if (dp->od_ino != 0)	/* not deleted entry */
+	{
+	  dir_static.d_ino = dp->od_ino;
+	  strncpy (dir_static.d_name, dp->od_name, DIRSIZ);
+	  dir_static.d_name[DIRSIZ] = '\0';
+	  dir_static.d_namlen = strlen (dir_static.d_name);
+	  dir_static.d_reclen = sizeof (struct direct)
+	    - MAXNAMLEN + 3
+	      + dir_static.d_namlen - dir_static.d_namlen % 4;
+	  return &dir_static;	/* -> simulated structure */
+	}
+#else /* VMS */
+      dp = (struct dir$_name *) dirp->dd_buf;
+      if (dirp->dd_loc == 0)
+	dirp->dd_loc = (dp->dir$b_namecount&1) ? dp->dir$b_namecount + 1
+	  : dp->dir$b_namecount;
+      dv = (struct dir$_version *)&dp->dir$t_name[dirp->dd_loc];
+      dir_static.d_ino = dv->dir$w_fid_num;
+      dir_static.d_namlen = dp->dir$b_namecount;
+      dir_static.d_reclen = sizeof (struct direct)
+	- MAXNAMLEN + 3
+	  + dir_static.d_namlen - dir_static.d_namlen % 4;
+      strncpy (dir_static.d_name, dp->dir$t_name, dp->dir$b_namecount);
+      dir_static.d_name[dir_static.d_namlen] = '\0';
+      dirp->dd_loc = dirp->dd_size; /* only one record at a time */
+      return &dir_static;
+#endif /* VMS */
+    }
+}
+
+int sys_read (int fildes, char *buf, unsigned int nbyte)
+{
+  register int rtnval;
+
+  while ((rtnval = read (fildes, buf, nbyte)) == -1
+	 && (errno == EINTR));
+  return (rtnval);
+}
diff -Nur tin-980117/vms/vmsfile.c tin-980202/vms/vmsfile.c
--- tin-980117/vms/vmsfile.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/vmsfile.c	Thu Jun 15 02:28:40 1995
@@ -0,0 +1,82 @@
+#include <string.h>
+#include <stdio.h>
+#include "parse.h"
+
+#if 0
+extern char *strdup();
+
+char **split(char *spliton, char *target)
+{
+  static char *buffer[100];
+  static char *t = 0;
+  char **p;
+
+  if (t)
+    free(t);
+
+
+  while ((t = strdup(target)) == NULL)
+    sleep(2);			/* just wait for out of memory condition
+				   to go away */
+
+  for (p = &buffer[0], *p = strtok(t, spliton);
+       *p;
+       *(++p) = strtok(NULL, spliton)) ;
+
+  return buffer;
+}
+#endif
+
+void joinpath(char *result, const char *dir, const char *file)
+{
+  struct filespec *spec;
+  char tmpdir[255], tmpfile[255];
+  char *ptr1, *ptr2;
+
+  strcpy(tmpdir, dir);
+  strcpy(tmpfile, file);
+
+  if (strlen (tmpdir) == 0) {
+    strcpy (result, tmpfile);
+    return;
+  }
+  if (tmpfile[0] == '[')
+   {
+    strcat(tmpdir,tmpfile);
+    tmpfile[0] = '\0';
+   }
+  spec = sysparse(tmpdir);
+  sprintf(result, "%s%s%s", spec->dev, spec->dir, tmpfile);
+  if (spec->filename[0]) {
+    fprintf(stderr, "joinpath: throwing away filename %s\n", spec->filename);
+  }
+}
+
+void joindir(char *result, const char *dir, const char *file)
+{
+  struct filespec *spec;
+  int i;
+  char tmpdir[255], tmpfile[255];
+
+  strcpy(tmpdir, dir);
+  strcpy(tmpfile, file);
+
+  if (strlen (tmpdir) == 0) {
+    sprintf(result, "[%s]", tmpfile);
+    return;
+  }
+  spec = sysparse(tmpdir);
+  i = strlen(spec->dir);
+  if (spec->dir[i-1] == ']') {
+    spec->dir[i-1] = 0;
+    sprintf(result, "%s%s.%s]", spec->dev, spec->dir, tmpfile);
+    if (spec->filename[0]) {
+      fprintf(stderr, "joinpath: throwing away filename %s\n", spec->filename);
+    }
+  } else {
+    fprintf(stderr, "joinpath: dir %s didn't end with ']' (passed %s)\n",
+	    spec->dir, tmpfile);
+    exit(0);
+  }
+}
+
diff -Nur tin-980117/vms/vmspwd.c tin-980202/vms/vmspwd.c
--- tin-980117/vms/vmspwd.c	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/vmspwd.c	Sun Feb  1 08:17:57 1998
@@ -0,0 +1,248 @@
+#include <stdlib.h>
+#include <unixlib.h>
+#include "pwd.h"
+
+unsigned
+sys_getuid ()
+{
+  return (getgid () << 16) | getuid ();
+}
+
+/* Define this symbol to actually read SYSUAF.DAT.  This requires either
+   SYSPRV or a readable SYSUAF.DAT. */
+
+#ifdef READ_SYSUAF
+/*
+ * getuaf.c
+ *
+ * Routine to read the VMS User Authorization File and return
+ * a specific user's record.
+ */
+
+static struct UAF retuaf;
+
+struct UAF *
+get_uaf_name (uname)
+     char * uname;
+{
+  register status;
+  struct FAB uaf_fab;
+  struct RAB uaf_rab;
+
+  uaf_fab = cc$rms_fab;
+  uaf_rab = cc$rms_rab;
+  /* initialize fab fields */
+  uaf_fab.fab$l_fna = "SYS$SYSTEM:SYSUAF.DAT";
+  uaf_fab.fab$b_fns = 21;
+  uaf_fab.fab$b_fac = FAB$M_GET;
+  uaf_fab.fab$b_org = FAB$C_IDX;
+  uaf_fab.fab$b_shr = FAB$M_GET|FAB$M_PUT|FAB$M_UPD|FAB$M_DEL;
+  /* initialize rab fields */
+  uaf_rab.rab$l_fab = &uaf_fab;
+  /* open the User Authorization File */
+  status = sys$open (&uaf_fab);
+  if (!(status&1))
+    {
+      errno = EVMSERR;
+      vaxc$errno = status;
+      return 0;
+    }
+  status = sys$connect (&uaf_rab);
+  if (!(status&1))
+    {
+      errno = EVMSERR;
+      vaxc$errno = status;
+      return 0;
+    }
+  /* read the requested record - index is in uname */
+  uaf_rab.rab$l_kbf = uname;
+  uaf_rab.rab$b_ksz = strlen (uname);
+  uaf_rab.rab$b_rac = RAB$C_KEY;
+  uaf_rab.rab$l_ubf = (char *)&retuaf;
+  uaf_rab.rab$w_usz = sizeof retuaf;
+  status = sys$get (&uaf_rab);
+  if (!(status&1))
+    {
+      errno = EVMSERR;
+      vaxc$errno = status;
+      return 0;
+    }
+  /* close the User Authorization File */
+  status = sys$disconnect (&uaf_rab);
+  if (!(status&1))
+    {
+      errno = EVMSERR;
+      vaxc$errno = status;
+      return 0;
+    }
+  status = sys$close (&uaf_fab);
+  if (!(status&1))
+    {
+      errno = EVMSERR;
+      vaxc$errno = status;
+      return 0;
+    }
+  return &retuaf;
+}
+
+struct UAF *
+get_uaf_uic (uic)
+     unsigned long uic;
+{
+  register status;
+  struct FAB uaf_fab;
+  struct RAB uaf_rab;
+
+  uaf_fab = cc$rms_fab;
+  uaf_rab = cc$rms_rab;
+  /* initialize fab fields */
+  uaf_fab.fab$l_fna = "SYS$SYSTEM:SYSUAF.DAT";
+  uaf_fab.fab$b_fns = 21;
+  uaf_fab.fab$b_fac = FAB$M_GET;
+  uaf_fab.fab$b_org = FAB$C_IDX;
+  uaf_fab.fab$b_shr = FAB$M_GET|FAB$M_PUT|FAB$M_UPD|FAB$M_DEL;
+  /* initialize rab fields */
+  uaf_rab.rab$l_fab = &uaf_fab;
+  /* open the User Authorization File */
+  status = sys$open (&uaf_fab);
+  if (!(status&1))
+    {
+      errno = EVMSERR;
+      vaxc$errno = status;
+      return 0;
+    }
+  status = sys$connect (&uaf_rab);
+  if (!(status&1))
+    {
+      errno = EVMSERR;
+      vaxc$errno = status;
+      return 0;
+    }
+  /* read the requested record - index is in uic */
+  uaf_rab.rab$b_krf = 1;	/* 1st alternate key */
+  uaf_rab.rab$l_kbf = (char *) &uic;
+  uaf_rab.rab$b_ksz = sizeof uic;
+  uaf_rab.rab$b_rac = RAB$C_KEY;
+  uaf_rab.rab$l_ubf = (char *)&retuaf;
+  uaf_rab.rab$w_usz = sizeof retuaf;
+  status = sys$get (&uaf_rab);
+  if (!(status&1))
+    {
+      errno = EVMSERR;
+      vaxc$errno = status;
+      return 0;
+    }
+  /* close the User Authorization File */
+  status = sys$disconnect (&uaf_rab);
+  if (!(status&1))
+    {
+      errno = EVMSERR;
+      vaxc$errno = status;
+      return 0;
+    }
+  status = sys$close (&uaf_fab);
+  if (!(status&1))
+    {
+      errno = EVMSERR;
+      vaxc$errno = status;
+      return 0;
+    }
+  return &retuaf;
+}
+
+static struct passwd retpw;
+
+struct passwd *
+cnv_uaf_pw (up)
+     struct UAF * up;
+{
+  char * ptr;
+
+  /* copy these out first because if the username is 32 chars, the next
+     section will overwrite the first byte of the UIC */
+  retpw.pw_uid = up->uaf$w_mem;
+  retpw.pw_gid = up->uaf$w_grp;
+
+  /* I suppose this is not the best style, to possibly overwrite one
+     byte beyond the end of the field, but what the heck... */
+  ptr = &up->uaf$t_username[UAF$S_USERNAME];
+  while (ptr[-1] == ' ')
+    ptr--;
+  *ptr = '\0';
+  strcpy (retpw.pw_name, up->uaf$t_username);
+
+  /* the rest of these are counted ascii strings */
+  strncpy (retpw.pw_gecos, &up->uaf$t_owner[1], up->uaf$t_owner[0]);
+  retpw.pw_gecos[up->uaf$t_owner[0]] = '\0';
+  strncpy (retpw.pw_dir, &up->uaf$t_defdev[1], up->uaf$t_defdev[0]);
+  retpw.pw_dir[up->uaf$t_defdev[0]] = '\0';
+  strncat (retpw.pw_dir, &up->uaf$t_defdir[1], up->uaf$t_defdir[0]);
+  retpw.pw_dir[up->uaf$t_defdev[0] + up->uaf$t_defdir[0]] = '\0';
+  strncpy (retpw.pw_shell, &up->uaf$t_defcli[1], up->uaf$t_defcli[0]);
+  retpw.pw_shell[up->uaf$t_defcli[0]] = '\0';
+
+  return &retpw;
+}
+#else /* not READ_SYSUAF */
+static struct passwd retpw;
+#endif /* not READ_SYSUAF */
+
+struct passwd *
+getpwnam (name)
+     char * name;
+{
+#ifdef READ_SYSUAF
+  struct UAF *up;
+#else
+  unsigned char * full;
+#endif /* READ_SYSUAF */
+  char *ptr = name;
+
+  while (*ptr)
+    {
+      if ('a' <= *ptr && *ptr <= 'z')
+	*ptr -= 040;
+      ptr++;
+    }
+#ifdef READ_SYSUAF
+  if (!(up = get_uaf_name (name)))
+    return 0;
+  return cnv_uaf_pw (up);
+#else
+  if (strcmp (name, getenv ("USER")) == 0)
+    {
+      retpw.pw_uid = getuid ();
+      retpw.pw_gid = getgid ();
+      strcpy (retpw.pw_name, name);
+      if ((full = (unsigned char*) getenv ("FULLNAME")))
+	strcpy (retpw.pw_gecos, full);
+      else
+	*retpw.pw_gecos = '\0';
+      strcpy (retpw.pw_dir, getenv ("HOME"));
+      *retpw.pw_shell = '\0';
+      return &retpw;
+    }
+  else
+    return 0;
+#endif /* not READ_SYSUAF */
+}
+
+struct passwd *
+getpwuid (uid)
+     unsigned long uid;
+{
+#ifdef READ_SYSUAF
+  struct UAF * up;
+
+  if (!(up = get_uaf_uic (uid)))
+    return 0;
+  return cnv_uaf_pw (up);
+#else
+  if (uid == sys_getuid ())
+    {
+      return getpwnam (getenv ("USER"));
+    }
+  else
+    return 0;
+#endif /* not READ_SYSUAF */
+}
diff -Nur tin-980117/vms/vmstimval.h tin-980202/vms/vmstimval.h
--- tin-980117/vms/vmstimval.h	Thu Jan  1 01:00:00 1970
+++ tin-980202/vms/vmstimval.h	Thu Jun 15 02:28:34 1995
@@ -0,0 +1,20 @@
+#ifndef VMSTIMEVAL_H
+#define VMSTIMEVAL_H
+
+/* In VMS, the timeval structure doesn't really exist, so let's define it.
+
+   Warning: timeval IS defined in the UCX socket.h, so your compiler might
+	get screwed! The UCX definition is exactly the same as the one below
+*/
+
+struct timeval {
+  long tv_sec;
+  long tv_usec;
+};
+
+struct timezone {
+  int tz_minuteswest;
+  int tz_dsttime;
+};
+
+#endif
