This is patch Elm 2.4 PL25 -> Elm 2.4ME+ PL50 (25)
Warning: Elm 2.4ME+ is UNOFFICIAL!

                                        - K E H <hurtta+elm@ozone.FMI.FI>
-------------------------------------------------------------------------------
Index: elm2.4.ME+.50/hdrs/patchlevel.h
*** elm2.4.25/hdrs/patchlevel.h	Mon Dec  4 17:50:56 1995
--- elm2.4.ME+.50/hdrs/patchlevel.h	Tue Nov 17 21:14:08 1998
***************
*** 1 ****
! #define PATCHLEVEL "25"
--- 1,6 ----
! #define PATCHLEVEL        "50 (25)"
! #define LAST_REPORT_TIME  942862610
! #define BUG_REPORT_ADDR   "Kari Hurtta <hurtta+elm@ozone.FMI.FI>"
! #define VERS_DATE	  "Nov, 1998"	/* for elm -v option */
! #define WHAT_STRING	\
! 	"@(#) Version 2.4(ME+), USENET supported version, released Nov, 1998"
Index: elm2.4.ME+.50/README.ME+
*** /tmp/8255-very-long-file-name-NULL-comes-in-here	Sun Nov 22 09:14:43 1998
--- elm2.4.ME+.50/README.ME+	Tue Nov 17 21:14:08 1998
***************
*** 0 ****
--- 1,1962 ----
+ $Header: /data/cvsroot/mail/elmme+/README.ME+,v 1.11 1998/11/17 18:20:24 hurtta Exp $
+ 
+ Version Elm2.4ME+ PL0 (25) is based to version Elm2.4 PL24 ME8b+.
+ Version Elm2.4 PL24 ME8b+ is based to version Elm2.4 PL24 ME8b.
+ 
+ Version Elm2.4 PL24 ME8b is done by Michael Elkins <elkins.aero.org>.
+ For details, look file ANNOUNCE.ME
+ 
+ [ Michael Elkins posted equivalent of MIME code in Elm2.4 PL24 ME8b 
+   to Elm Development Cordinator. Later changes are not posted to
+   Elm Development Cordinator. ]
+    
+ Version Elm2.4 PL24 ME8b is based to version Elm2.4 PL24.
+ Version Elm2.4ME+ PLx (25) includes patch of version Elm2.4 PL25.
+ 
+ Changes of Elm2.4ME+ PL50 (25) compared to Elm2.4ME+ PL49 (25)
+ --------------------------------------------------------------
+ 
+ 	- elm -vvvv now print names of some configuration files
+ 	- elm -vvvvv prints some configuration data (mainly
+           locale dependent data)
+ 
+         - "When I use the keys '+' or '-' in an empty attachment 
+            list elm exits with a segmentation violation. This seems 
+            to occur because the variable 'ptrs' points to NULL (and 
+            'ptr_max' is equal to 0) which is not checked.
+ 
+           The following patch fixes this bug."
+          From: Henrik Pletat <pletat@informatik.hu-berlin.de>
+ 
+ 	- Added locale_init() to lib/read_rc.c and moved to
+ 	 catopen and setlocale to it.
+ 
+ 	- Added mapping from LC_CTYPE locale to display_charset.
+          Mapping is done on file $lib/elm.mimecharsets or on 
+          .elm/mime.charsets
+ 
+        - Special value DISPLAY on elmrc variable charset
+          means that use display_charset.
+ 
+ 	- Moved variable substitution from Configure to
+           ConfTool/Substitute (called automatically)
+ 
+         - Ctrl-U and Ctrl-D on builtin++ pager was working
+           inconsistently.
+          Problem reported by: Andrew J. Piziali <andy@piziali.dv.org>
+ 
+ Changes of Elm2.4ME+ PL49 (25) compared to Elm2.4ME+ PL48 (25)
+ --------------------------------------------------------------
+ 
+         - Put ME+ to under of CVS. Because revision numbers 
+           changed there was need of changing header text of files.
+ 
+         - "It fixes a small problem with the date representation 
+            in the upper right corner.  Currently, times like
+            "09:08:02" are displayed as " 9: 8: 2".  This is because 
+            src/date.c uses the format "%2.2d:%2.2d:%2.2d" which is 
+            not supported by elm_vmessage() (gets interpreted as 
+            "%2d:%2d:%2d").  The patch changes this to "%02d:%02d:%02d" 
+            (this is used everywhere else anyway), which fixes the
+           problem."
+          From: Gertjan van Oosten <gertjan@West.NL>
+ 
+         - If To: is empty and I have sender, show sender of mail
+           (DisplayAddrress (lib/dispaddr.c) was not correctly 
+            detectection empty To: -header.)
+          
+ Changes of Elm2.4ME+ PL48 (25) compared to Elm2.4ME+ PL47 (25)
+ --------------------------------------------------------------
+ 
+         - Changed to and cc field on header_rec to include 
+           result of break_down_address 
+         - Added to_matches and cc_matches to pattern.c
+ 
+         - moved and reimplemented forwarded from utils/newmail.c 
+           and src/addr_util.c to lib/forwarded.c 
+         
+         - shift_lower needs const for argument
+ 
+         - Add buffer overflow check to stip_parens() and get_parens()
+           (lib/striparens.c)
+         
+         - Moved main part of parse_arpa_date() to new routine
+           parse_date_time (lib_/parsarpdat.c) and let parse_arpa_date()
+           to call that routine.
+ 
+         - Reimplemented process_expiration_date() (src/expires.c).
+           Original code did not handled 4 number years and was broken
+           on year 2000. New code uses just parse_date_time() --
+           However it accepts expiration times where date part
+           is only given from RFC 822 date-time format.
+ 
+         - Now real_from() (lib/realfrom.c) assumes local timezone,
+           if timezone is not given, because From mailbox separator
+           is normally inserted locally.
+         
+         - There was "multi-character character constant" -warning 
+           coming from src/mkhdrs.c
+           Reported by: Witold Witkowski <yawitkow@cyf-kr.edu.pl>
+ 
+         - "If you switch to the option editor screen, change 
+            "O)utbound mail saved" from "=sent" to "=sent" (i.e. 
+            enter the displayed character sequence), return to the 
+            index, and then mail a message, the outgoing message 
+            will be saved in a file named ~/=sent rather than in
+            ~/Mail/sent.  The equal sign is not getting expanded 
+            to the user's mail folder directory."
+           Reported by: Andrew J. Piziali <andy@elijah.dv.org>
+ 
+         - "I suggest checking and accepting (extending) existing PATH"
+           From: Witold Witkowski <yawitkow@cyf-kr.edu.pl>
+         > Moved $PATH to beginning of initial PATH of Configure
+ 
+ Changes of Elm2.4ME+ PL47 (25) compared to Elm2.4ME+ PL46 (25)
+ --------------------------------------------------------------
+ 
+         - Do not treate characters > 127 as controls (allow
+           they on words of phrases)
+ 
+         - Fix name of "Forwarded message from" -text
+ 
+ Changes of Elm2.4ME+ PL46 (25) compared to Elm2.4ME+ PL45 (25)
+ --------------------------------------------------------------
+ 
+         - Split break_down_address to look_special_tokens(),
+           scanned_to_phrase(), scanned_to_str() routines
+           and reimplement break_down_address as state machine
+           (4 states, 6 terminals).
+         > Now phrase from group -syntax is ignored and
+           route from address is dropped.
+ 
+         - strtok(), strpbrk(), strstr() was declared in both 
+           of elmlib.h and defs.h (remove later declaration).
+          Noted by: John Goerzen <jgoerzen@complete.org>,
+                    Emmanuel Bigler <bigler@alpha.univ-fcomte.fr>
+ 
+         - Changed from field on header_rec to include 
+           result of break_down_address (instead of just fullname).
+         - "From " address is stored to new env_from field
+         > Sorting based on sender uses first "From " address
+           and then parsed From: -header (fullname and then address)
+         > Limit with 'from' now works both of full name and address
+           and it uses now MIME-decoded full name. Also "From "
+           address is considered.
+         - get_return (on returnaddr.c) is simplified. Now it uses
+           stored (and parsed) From: -header from from field of header_rec
+ 
+         - Assume INTERNET (style addresses). Remove question from
+           Configure and all ifdefs.
+ 
+         - Assume USE_EMBEDDED_ADDRESS (From: and Reply-Top:). Remove
+           question from Configure and all ifdefs.
+ 
+         - Call user_init(), init_defaults() and read_rc_file() on 
+           newmail.
+ 
+ Changes of Elm2.4ME+ PL45 (25) compared to Elm2.4ME+ PL44 (25)
+ --------------------------------------------------------------
+ 
+         - skip_envelope on melib/parse_util.c was not skipping
+           ">From " -lines.
+ 
+         - Save composition filename to global variable
+           (so it does not need to be genrated in signal handler
+            for removal)
+ 
+ Changes of Elm2.4ME+ PL44 (25) compared to Elm2.4ME+ PL43 (25)
+ --------------------------------------------------------------
+ 
+         - Added lib/getaddr.c (break_down_address, 
+           free_addr_list)
+         - Moved rfc822_tokenize, remove_space_tokenized,
+           free_rfc822tokenized from melib/parse_util.c
+           to lib/getaddr.c
+         - Reimplemented parse_arpa_who (lib/parsarpwho.c)
+           and get_address_from (lib/getaddrfrm.c) with
+           break_down_address
+         - Added size argument to (get_address_from)
+ 
+         - replace break_down_to_list (src/reply.c) with 
+           break_down_address
+ 
+         - "patch-hmo-1 extends the '#' debug menu, showing 
+            all defined message flags, in the order present 
+            in hdrs/defs.h."
+           From: Helge Oldach <hmo@sep.hamburg.com>
+ 
+ Changes of Elm2.4ME+ PL43 (25) compared to Elm2.4ME+ PL42 (25)
+ --------------------------------------------------------------
+ 
+         - print attachment instead of just printing [skipping...]
+           message when printing from atttachment -menu
+ 
+         - Changes calling sequence of Write_to_screen
+         - Added some messages to message catalog
+         - Added PutLineX to curses.c
+         - Dropped Putline1, PutLine2, PutLine3 to favor
+           PutLineX
+ 
+         - Remove hostname initialization from fastmail,
+           fastmail now calls read_rc -routines
+ 
+ Changes of Elm2.4ME+ PL42 (25) compared to Elm2.4ME+ PL41 (25)
+ --------------------------------------------------------------
+ 
+         - Tweak little (add missing space) to build_header_line
+ 
+         - "When I'm in the attach menu before sending a mail and 
+            I use the delete function on the LAST attachment, the 
+            cursor diappears. Trying then to move up the cursor 
+            elm exits with a sigmentation violation.
+ 
+            This error appears in several versions of elm."
+           From: Henrik Pletat <pletat@informatik.hu-berlin.de>
+ 
+         - Fix call of parse_arpa_who in figure_out_addressee, which
+           caused that To -address in 'frm' was truncated.
+ 
+         - Change days_ahead to return year in 4 numbers and simplify it.
+         - Some year 2000 fixes for src/date.c
+         - Make elm_date_str to return year in 4 numbers
+ 
+         [ Undo Elm2.4ME+ PL41h patch before installing this patch. ]
+ 
+ Changes of Elm2.4ME+ PL41h (25) compared to Elm2.4ME+ PL41 (25)
+ --------------------------------------------------------------
+ 
+         - Tweak little (add missing space) to build_header_line
+ 
+ Changes of Elm2.4ME+ PL41 (25) compared to Elm2.4ME+ PL40 (25)
+ --------------------------------------------------------------
+ 
+         [ Warning: This is so much changes (and some are 
+           incomplete) so this this quite sure more buggy than
+           PL40. ]
+ 
+         - "it's not "a X-Windows" but rather "an X-Windows"; and 
+            BTW, it's not "X-Windows" at all cause that term simply 
+            does not exist (cf. man X).  Simply replay "an X-Windows" 
+            by "an X11". Thanks."
+           From: (sender's name lost)
+ 
+         ( I managed to delete hurtta+elm Mailbox, so resend
+           your mails if they are sent between 1998-03-04 and
+           1998-04-04. )
+ 
+         - Added some messages to message catalog
+ 
+         - iprintf.c dropped (so far) -- it is not used (at least yet)
+ 
+         - elm_sfprintf, elm_message
+         > Global change: Most of sprintf calls replaced with elm_sfrpintf
+ 
+         - Do not longer test existence of mkdir()
+ 
+         - "this is another very simple fix that repairs this:
+            posixsig.c:89: warning: preprocessing directive not 
+               recognized within macro arg"
+           From: Helge Oldach <hmo@sep.hamburg.com>
+ 
+         - Dropped error1, error2, error3 to favor lib_error
+ 
+         - Changed how menu2.c works (and therefore changed
+           DSN and remailer menus.)
+ 
+         - Tweak parsearpawho 
+         > Now From: is not assument to be part of buffer
+         > from in header struct is now mime decoded
+         > That is now mime encoded when generating comment to
+           reply address.
+ 
+         - Handles now phrases on From: -header which uses
+           continuation lines
+ 
+         - Dropped get_real_name -- it is it is at least
+           equal broken than parse_arpa_who
+ 
+         - ' added to set of characters which need quotation because 
+           sendmail otherwise will quote words which includes ' on 
+           phrases -- even that ' is not special character -- and that 
+           way destroy MIME encoding.
+       
+         - MIME decoding is now done when showing values in header menu
+           (for address headers)
+ 
+         - MIME encoding also full name got from gecos field of passwd
+ 
+         - MIME encode also name entered to comments in header edit screen
+           (for address headers)
+ 
+ Changes of Elm2.4ME+ PL40 (25) compared to Elm2.4ME+ PL39 (25)
+ --------------------------------------------------------------
+ 
+         - Enumerated options 
+           userlevel:            beginner        intermediate    expert
+           noencoding:           pass-7bit       pass-8bit       pass-binary
+ 
+         - Move reading of elmrc to elmlib and put elm tools to read
+           elmrc. This may make to some time in future to possible
+           to do binary distributions of elm.
+         > pmalloc.c moved from src/ to lib/
+ 
+         - Added option elm -vvv
+ 
+         - Add routine lib_error (lib/output.c)
+ 
+         - Added some messages to message catalog
+ 
+         - "I have a nice patch to elm-me+-2.4pl25ME+39:
+            If you press (l)imit and then type "thread", all messages 
+            with the same subject are shown. A leading "Re: " is stripped.
+ 
+            That is usefull for (large) mailing lists, where you don't read 
+            all messages. (It's like the thread command in most net news 
+            readers)"
+           From: Christian Hammers <ch@lathspell.westend.com>
+ 
+         - "I have determined what the problem is.  When you `bounce' a 
+            message elm fails to strip the `From ' line from the top of 
+            the message.  This causes Smail to think that the message is 
+            an incoming UUCP transmission.  Smail uses the `From ' line 
+            to build the new return path using a !, getting a wrong answer.
+ 
+            Elm should strip the `From ' from bounced messages."
+           From: Ian Jackson <ian@chiark.greenend.org.uk>
+         > Added CM_REMOVE_ENVELOPE flag to call of copy_message
+           in remail.c in case of INTERNET is defined 
+           (From comments it looks that passing of "From " is done
+            by purpose: "For those cases when you want to have a 
+            message continue along to another person in such a way 
+            as they end up receiving it with the return address the 
+            person YOU received the mail from")
+ 
+         - Elm -v now prints warning "Elm is not intended to be 
+           distributed in binary form.  If that is done, then it 
+           is very likely that compile time configuration does not
+           match to your system."
+ 
+ Changes of Elm2.4ME+ PL39 (25) compared to Elm2.4ME+ PL38 (25)
+ --------------------------------------------------------------
+ 
+         - "The filter included in elm-2.4ME+37 also appears to
+            be vulnerable to the "save_embedded_address()" attack,
+            but not to the "get_filter_rules()" attack."
+           From: KSR[T] <ksrt@DEC.NET>
+         > I didn't used supplied patch. Instead I added bound
+           check to one loop in save_embedded_address (I was
+           added it to one loop but was missed other loop. )
+         > Note that Makefile will not compile ot install filter
+           -- that is intentionally (it was dropped because of
+           security problems)
+ 
+         - "here is another small fix relative to elm-2.4ME+37. 
+            This is relevant for empty folders with keepempty=OFF. 
+            Previously an empty folder was deleted *only* when this 
+            folder was left with all (and >= 1) messages marked 
+            'deleted'. Now an already empty folder is also deleted 
+            upon quit or change to another folder."
+           From: Helge Oldach <hmo@sep.hamburg.com>
+         > I didn't used supplied patch. Instead I modified leave_mbox.
+ 
+         - Added elmrc -option "dsn-success"
+ 
+         - "it looks like that the help function in change folders 
+            of this used version (2.4me+38) doesn't work."
+           Reported by: Roeland Th. Jansen <bengel@grobbebol.xs4all.nl>
+         > init_helpmsg was called with wrong number of parameters.
+ 
+ Changes of Elm2.4ME+ PL38 (25) compared to Elm2.4ME+ PL37 (25)
+ --------------------------------------------------------------
+ 
+         - getarpdate generated date wrongly in year 2000
+ 
+         - "Here's another small fix which allows elm to deal more 
+            reasonably with empty last name/first name/comment fields 
+            in the alias file. This is intended for situations where 
+            people use mail addresses which already include the full 
+            name (like: Helge.Oldach@sep.hamburg.com), so that 
+            duplicating the last name and first name on the alias list 
+            seems not reasonable. If one just leaves the last name/first 
+            name/comment fields empty like in:
+ 
+                 hmo =  = Helge.Oldach@sep.hamburg.com
+ 
+            then the alias screen will display nothing but the alias, 
+            which doesn't tell anything. This patch makes elm display 
+            the actual mail address instead of an empty last name/first 
+            name/comment field.
+ 
+            It also fixes the display of such empty fields when displaying
+            the actual address while sending a mail ("Message addressed as:
+            Helge.Oldach@sep.hamburg.com ()") - the empty brackets won't 
+            appear in this case."
+           From: Helge Oldach <hmo@sep.hamburg.com>
+ 
+         - "background_wait_time should be background-wait-time in 
+            doc/elmrc-info, otherwise the elmrc update function (elm -w) 
+            won't copy the comment."
+           From: Helge Oldach <hmo@sep.hamburg.com>
+ 
+         - "It wasn't properly truncating the subject line if 
+            the rest of the header was longer than 44 characters"
+           From: Guy Harris <guy@netapp.com>
+ 
+         - If msgcat.c will be compiled, don't include <nl_types.h>
+           In that situation always include "elm_nl_types.h"
+ 
+         - rfc822_tokenize, remove_space_tokenized, free_rfc822tokenized,
+           strmcat
+ 
+ Changes of Elm2.4ME+ PL37 (25) compared to Elm2.4ME+ PL36 (25)
+ --------------------------------------------------------------
+ 
+         - include <sys.wait.h> in defs.h
+ 
+         - include <sys/wait.h> in lib/posixsig.c on Ultrix V4.4
+           From: Bernhard Simon <bs@bsws.edvz.tuwien.ac.at>
+ 
+         - "The latest elm.me has a nl_types.h include which on 
+            Digital UNIX is conflicting with a system include having 
+            the same name, which is of course needed for proper 
+            compilation :(."
+           From: Christophe Wolfhugel <wolf@pasteur.fr>
+         > Rename nl_types.h to elm_nl_types.h
+         > There was wrong number of argument in catgets
+           call in iprintf.c [ not currently used ]
+           From: Christophe Wolfhugel <wolf@pasteur.fr>
+ 
+         - Changes for configure to run in Dec Unix (OSF1)
+           "-  cc -std (to have prototypes)
+            -  nm_opts='' for DEC Unix or it gives wrong output with -p 
+               and Configure won't see some functions (like strspn)
+            -  signal hardcoded, because cc -E or cpp or DEC Unix does not 
+               pass the   standard defines (the ones put by cc -std) and we 
+               will miss the signal prototype anyway :(."
+           From: Christophe Wolfhugel <wolf@pasteur.fr>
+ 
+         - Some changes that Elm compiles cleanly on Digital Unix (OSF1)
+           [ It was not defining __STDC__, but was complaining
+             if char * argument was given to unsigned char * argument
+             of function (and opposite) ]
+ 
+         - Digital Unix (OSF1) was defineing macto BSD (sig!)
+           Renamed BSD macro to BSD_TYPE
+ 
+ Changes of Elm2.4ME+ PL36 (25) compared to Elm2.4ME+ PL35 (25)
+ --------------------------------------------------------------
+ 
+         - "If the mail transport agent (MTA) is missing, elm
+            silently fails.  No message is delivered and no warning or 
+            error message is displayed."
+           From: Jan Prikryl <prikryl@cg.tuwien.ac.at>, 
+                 Andrew J. Piziali <andy@elijah.dv.org>
+         > Return status of process was decoded incorrectly.
+         > Also errno status was written to wrong end of report -pipe.
+ 
+         - Redraw screen also if old position was on screen
+           when new mail arrives.
+ 
+         - Dropped return_value_of from curses.c
+ 
+         - Support arrow cursor on attachment menu
+ 
+         - "I recently tried to run the Configure script on AIXv4.2.1 which 
+            failed trying to extract the function names out of libc.a. 
+            I updated the script so it will work on AIX."
+          From: Will Fiveash <will@austin.ibm.com>
+ 
+         - "Also, I am including my file locking patch so that
+            elm will lock a folder when trying to save or copy to it."
+           From: Will Fiveash <will@austin.ibm.com>
+         > Added elmrc option lock-in-copy, that locking is done if
+           this option is TRUE (default).
+         * NOTICE: This does not work with dot-locking
+         * NOTICE: This is usefull only with folders which elm
+                   treats as mailboxes, because folder are not
+                   locked (when visited). 
+ 
+         - Changed can_open to use my_wait and prepared for EINTR
+ 
+         - Dropped move_old_files_to_new()
+ 
+ Changes of Elm2.4ME+ PL35 (25) compared to Elm2.4ME+ PL34 (25)
+ --------------------------------------------------------------
+ 
+         - "I've built elm-2.4.ME+3[34] under SunOS 4.1.2 using 
+            libc 1.1.7 and gcc-2.7.2 and can't actually open a mail 
+            file with them. "
+           From: Dave Rynne <dave@funcom.ie>
+         - wait in can_access was not prepared for EINTR
+         - can_access was not using my_wait
+           [ And why can_access just not use access system call?
+             -- it used real uid and gid anyway!!!! ]
+ 
+         - "The run_state structure declared in me.h has a member 
+            called "errno". However, it is unsafe to use errno as an 
+            identifier under some Unices, e.g. when errno is a macro.  
+            Here is a patch against PL34 which renames the struct member."
+          From: Jesse Thilo <jthilo@early.com>
+          [ It turns out that culprit is Linux libc 6 ]
+ 
+         - Add support for multipart/alternative. Elmrc
+           variable pagealternative is added. If that is TRUE (default),
+           and at least one subpart of multipart/alternative is displayable
+           metamail is not called. If that is FALSE, metamail is not called
+           if all subparts of multipart/alternative are displayable.
+ 
+ Changes of Elm2.4ME+ PL34 (25) compared to Elm2.4ME+ PL33 (25)
+ ---------------------------------------------------------------
+ 
+         - Print "Elm: Unsupported locale (check $LANG)" if setlocale
+           fails. 
+           Suggested by: Michael Rudolf <mich@mich.isdn.cs.tu-berlin.de>
+ 
+         - "I've found a bug in the Configure script for elm2.4.ME+.33:
+            when Configure asks for the metamail path and the path doesn't
+            exist elm asks you: "File ... doesn't exist.  Use that name 
+            anyway?", if you answer 'y' then metamail_path is set 
+            to 'y'. I think that's not the desired action... :)"
+          From: Jose A. Rodriguez <Jose.Rodriguez@ac.upc.es>
+ 
+         - Add elmrc -varaible pgp. This gives path to PGP.
+           If "none", pgp is not called. Also checked that 
+           pgp is executable with given path.
+           Suggested by: John Goerzen <jgoerzen@complete.org>
+ 
+         - check with can_open that debug file can be opened.
+ 
+         - -A (attach) option didn't used "~/.elm/mime.types" file.
+           Reported by: Andrew J. Piziali <andy@piziali.dv.org>
+          
+ Changes of Elm2.4ME+ PL33 (25) compared to Elm2.4ME+ PL32 (25)
+ --------------------------------------------------------------
+ 
+         - Content-Disposition: inline; filename = "filename"
+           was not parsed correctly.
+           Reported by: Jussi Kaurola <kaurola@ozone.FMI.FI>
+ 
+         - Remove NIS tests from Configure. $passcat was not used
+         ( Next section "set up shell script to do ~ expansion"
+           may perhaps need it, but actually it does not use it. )
+           Hint from: Jerzy Sobczyk <J.Sobczyk@ia.pw.edu.pl>
+         > Now sun is always added to from of $libswanted
+ 
+         - Added elmrc option background-wait-time (default 2 seconds)
+           If = 0  wait mailer to completion
+              > 0  wait background-wait-time seconds for completion
+                   if not completed in this time, let it go to background
+ 
+                 (completion of mailing is still reported if user have
+                  not exited from elm in that time when mailer have completed)
+           Suggested by: Heiko W.Rupp <hwr@pilhuhn.de>
+                         Daniel C. Sobral <dcs@gns.com.br>
+         * THIS option is supported only in POSIX systems
+         > Added my_wait to lib/posigsig.c
+ 
+         - Added VOLATILE to defs.h
+         > to resize_screen, redraw_screen (elm.h, headers.h)
+ 
+         - "When I tried to compile elm2.4.ME+.32 for Digital Unix 4.0 I got
+            a few compiler errors. The problem is that ANSIC/not ANSIC headers
+            are not in sync...
+ 
+            They are fixed with this patch (for lib/iprintf.c file)"
+           From: Jose A. Rodriguez <Jose.Rodriguez@ac.upc.es>
+         * Actually this (ELMCHAR, iprintf) code isn't yet in use
+ 
+         - "The bug was that filter truncated the "Saved folder" to 
+            only 3 chars (out of the full path). To fix it, just change 
+            the following line in 'utils.c' in the filter directory"
+           From: From: Yuval Shamir <yuvals@iil.intel.com>
+           [ Suggested fix was incorrect. ]
+ 
+         > Notice: filter code is not tested (and compilation
+           of it is commented out from Makefile in all ME+)
+ 
+ Changes of Elm2.4ME+ PL32 (25) compared to Elm2.4ME+ PL31 (25)
+ ---------------------------------------------------------------
+ 
+         - Incorrect Content-length: -header was causing corruption
+           of folders.
+           From: Guy Harris <guy@netapp.com>
+ 
+         - argv_from_to was not handled ',' in comments correctly.
+           Detected from report of Gary Casterline 
+                 <casterln@nature.Berkeley.EDU>
+         > Use rfc822_toklen instead of len_next_part
+ 
+         - SECURITY: strcpy -> strfcpy changes of Elm2.4ME+ PL29 (25)
+           was not done for curses.c in this source tree.
+           Bug report on List <BUGTRAQ@NETSPACE.ORG>.
+           From: John Goerzen <jgoerzen@happy.cs.twsu.edu>
+ 
+         - Some changes on curses.c (bl -- bell)
+ 
+         - Change output of option -v
+ 
+         - "If you use 'answer -u', then every user name is truncated to 
+            three letters." ... "Change line 232 to: " ...
+           From: Jean-Pierre Radley <jpr@jpr.com>
+           [ Suggested fix was incorrect. ]
+ 
+         - "Configure always has had a problem on Linux systems, 
+            extracting names in a usuable format (from /usr/lib/libc.so).
+            The following small change fixes this."
+           From: Bauke Jan Douma <bjdouma@xs4all.nl>
+ 
+         - "In Solaris enviroment NIS+ is now used instead of Yellow 
+            Pages so I have modified Configure to reflect this and 
+            allow to use niscat in the same fashion as ypcat was."
+           From: Jerzy Sobczyk <J.Sobczyk@ia.pw.edu.pl>
+           [ Undone in PL33 ]
+ 
+         - Compilation of filter (actions.c) fail.
+           Reported by: Arnout Boer <arnoutb@xs4all.nl>
+ 
+         - Typo mismatch in lib/strftime.c
+           From: Yuval Shamir <yuvals@iil.intel.com>
+         - [wordwrap.c, bultin editor] 
+           "Wordwrap and delete at the 
+            beginning of the line does not work in PL31. Fix is below."
+           From: "Zoltan T. Hidvegi" <hzoli@VNET.IBM.COM> 
+           [ I didn't used supplied patch. ]
+ 
+         - [builtin editor] There was 'sizeof buffer' instead of 
+           'buffer_size' in get_with_expansion()
+ 
+         - Add same fflush -fix to remail.c which is in mailmsg2.c
+ 
+ Changes of Elm2.4ME+ PL31H (25) compared to Elm2.4ME+ PL31 (25)
+ ---------------------------------------------------------------
+ 
+         [ This is out of branch patch. ]
+ 
+         - Incorrect Content-length: -header was causing corruption
+           of folders.
+           From: Guy Harris <guy@netapp.com>
+ 
+         - argv_from_to was not handled ',' in comments correctly.
+           Detected from report of Gary Casterline 
+                 <casterln@nature.Berkeley.EDU>
+         > Use rfc822_toklen instead of len_next_part
+ 
+ Changes of Elm2.4ME+ PL31 (25) compared to Elm2.4ME+ PL30 (25)
+ --------------------------------------------------------------
+ 
+         - Print "Warning: BINARY data? Check Content-Type!"
+           when trying send binary (*) data as text in attachment
+           menu.
+ 
+         (*) binary = not fill requirements of "7bit" and "8bit".
+ 
+         - Convert some system_call() to use 
+           start_run() ... wait_end() instead.
+ 
+         - optionally_enter() in pgp_decode.c was called without 
+           size -argument
+ 
+         - "The problem appears to be that when a "FILE *" is rewound, 
+            the underlying file is not, causing mail messages to be empty. "
+           Reported by: Jon Harder <Jon.Harder@mennolink.org>
+           [ Now input file descriptor is fflush'ed -- this should 
+             synzronize it.
+           ]
+ 
+ 
+         - "I often mail PGP-encrypted attachments to people with the 
+            appropriate content type.  If I want to review the attachment 
+            before sending it, I go the to a)ttachments screen, select the 
+            attachment of interest, and press <Enter>. Elm prompts me for a 
+            pass phrase because I always encrypt using my public key along 
+            with the recipient's.  If I mistype my pass phrase, I cannot use
+            control-F (^F) to cause Elm to forget the cached pass phrase from 
+            either the attachments screen or the send screen.
+ 
+            I wish ^F were recognized on those two screen also."
+           Suggested by: Andrew J. Piziali <andy@piziali.dv.org>
+         * Added ^F to verify_transmission, attachment menu, and to 
+           showmsg_c.c
+ 
+ Changes of Elm2.4ME+ PL30 (25) compared to Elm2.4ME+ PL29 (25)
+ --------------------------------------------------------------
+ 
+         - mailerflags -array (argument vector) was not NULL
+           terminated in remail.c.
+ 
+         - Elm was not recognized SortBy (and aliassortby) keywords
+           [ strfcpy was got size of pointer instead of array size
+             in read_rc.c ]
+           Reported by: "Ralf S. Engelschall" <rse@engelschall.com>
+ 
+         - Fixed some error messages in read_rc.c
+ 
+         - "The problem is that 'case:' statement use int range, so
+            0xFC02 expanded to 0x0000FC02, not to 0xFFFFFC02,
+            but xxx->magic value is short and expanded to 0xFFFFxxxx,
+            so comparation is unsuccessful.
+            Fix is simple: direct cast to short."
+           From: "Andrey A. Chernov" <ache@nagual.ru>
+           [ I don't actually used that fix. Instead I changed magic
+             values to 'unsigned short' in elmlib.h. Now they 
+             are used same way as in melib.h. ]
+         * Actually this (ELMCHAR) code isn't yet in use
+ 
+ Changes of Elm2.4ME+ PL29 (25) compared to Elm2.4ME+ PL28 (25)
+ --------------------------------------------------------------
+ 
+         [ Warning: This is so much changes (and some are 
+           incomplete) so this this quite sure more buggy than
+           PL28. ]
+ 
+         - SECURITY: Elm was passing `shell command` without
+                     quotation to shell when invoking sendmail.
+           Reported by: Wolfgang Ley <ley@cert.dfn.de>
+                  from: "Computer Emergency Response Team, Germany"
+                         <dfncert@cert.dfn.de>
+           (Originally from: Dirk Nimmich <nimmich@uni-muenster.de> )
+         > Don't use shell when calling sendmail (or other mailers)
+         - quote_args() dropped from strings.c
+         - now elm waits until sendmail returns
+           (and simple not put it background without checking
+            if mailing succees)
+         > Now -V option of Elm works better
+ 
+         - Small change in displaying of multipart messages
+ 
+         - (mime_decode.c) Use in_state_seekable instead of 
+                 testing magic agaist STATE_in_file
+ 
+         - Move state.c from src/ to melib/
+ 
+         - New header files melib.h and elmlib.h
+ 
+         - Add routine strfcat to strfcpy.c
+ 
+         - get_folder_type is litle more smarter to detect files
+           in mail directory
+ 
+         - d)omainze removed from header config -menu
+ 
+         - Don't ask shell in configure -- take shell from passwd
+           If passwd is used, default value for elmrc is null string
+           If $SHELL env variable is used, defaualt value for elmrc is 
+                 $SHELL string
+ 
+         - If $EDITOR env varaible is used, default value for elmrc is
+                 $EDITOR string
+ 
+         - Default to p)gp if replying to pgp encoded message
+           (in verify_transmission -menu)
+ 
+         - Remove bounceback variable and bouncebk.c
+ 
+         - [defs.h] In IRIX define 'int32' by using 'int32_t'
+           Warning: If you have compiled Elm with ABI=-64
+                    (default on IRIX64), this changes on disk
+                    format of aliases database
+         * Actual use inttypes.h 
+           (does not work if -cckr is used,
+           (also can't be used in IRIX 5.3 because of conflicts
+            with sys/types.h -- ARGH!)
+ 
+         - Removed references to VMS and EUNICE from Configure
+ 
+         - Removed I_STDARG -- 
+                 now if ANSI_C is defined stdarg.h is used,
+                 otherwise varargs.h is used
+ 
+         - Add do { .... } while(0) to dprint -macro
+ 
+         - Global change: Use strfcpy instead of strcpy
+                     and: Use strfcat (new routine) instead of strcat
+           (but sprintf -calls are still untouched!)
+ 
+         [ Undo Elm2.4ME+ PL28s patch before installing this patch. ]
+ 
+ Changes of Elm2.4ME+ PL28s (25) compared to Elm2.4ME+ PL28 (25)
+ --------------------------------------------------------------
+ 
+         - SECURITY: Elm was passing `shell command` without
+                     quotation to shell when invoking sendmail.
+           Reported by: Wolfgang Ley <ley@cert.dfn.de>
+                  from: "Computer Emergency Response Team, Germany"
+                         <dfncert@cert.dfn.de>
+           (Originally from: Dirk Nimmich <nimmich@uni-muenster.de> )
+         > Quote ` -character
+ 
+ Changes of Elm2.4ME+ PL28 (25) compared to Elm2.4ME+ PL27 (25)
+ --------------------------------------------------------------
+ 
+         - mailerflags was too short for DSN flags
+ 
+ Changes of Elm2.4ME+ PL27 (25) compared to Elm2.4ME+ PL26 (25)
+ --------------------------------------------------------------
+ 
+         - 'hdr -> magic = NULL;' should be 'hdr -> magic = 0;'
+            in parse_util.c
+            Noted by: "Andrew J. Piziali" <andy@piziali.dv.org>
+ 
+         -  "Change Elm to exit after printing the error message, rather than
+             continuing and erasing the screen message and all, if it 
+             encounters an error when reading your "elmrc" file."
+            From: Guy Harris <guy@netapp.com>
+         * But do not do this if in batch mode!
+         * Don't exit if there is errors in global elmrc!
+         * Let user save new .elm/elmrc with option -w
+ 
+         - state_read_headers was building next_header chain
+           incorrectly (and possible other chains also).
+ 
+         - add_paramater_t routine (wrapper for add_parameter)
+           to mime_encode.c
+ 
+         - Let user attach files with option -A
+           To get this work correctly, user needs to have
+           mapping file extension -> mime/type in
+           his .elm/elmrc
+ 
+         - Added field magic to mime_t and routine mime_panic.
+           Now it is possible to get error message MIME_PANIC
+           if in mime structure in memory is something wrong
+           (analogy to STATE PANIC and HEADER PANIC).
+ 
+         - Size of forwarded mail in message/rfc822 was not set 
+           correctly in Elm2.4ME+ PL23.
+ 
+         - Added DSN (Delivery Status Notification) Configure
+           menu to verify_tranmission. You need sendmail 8.8
+           to get this.
+ 
+         - In menu of verify_transmission, show
+           a)attachments option also in user level = 0, if there
+           is attachments.
+         - In menu of verify_transmission, show
+           p)gp option also in user level = 0, if original message
+           was pgp -encoded (when replying).
+         - In menu of verify_transmission, show
+           D)SN option also in user level = 0 if there is dsn settings
+           (does not apply now).
+ 
+ Changes of Elm2.4ME+ PL26 (25) compared to Elm2.4ME+ PL25 (25)
+ --------------------------------------------------------------
+ 
+         - Adding final \n\n was badly broken in copy_message()
+           Reported by: Eilon Gishri <eilon@ibm.net.il>
+ 
+         - Try fixing handling of null bodys in read_headers()
+           { newmbox.c } in some cases. Perhaps this brokes
+           nothing?
+ 
+         - rfc1522_encode_text failed to \0 terminate Subject
+           From: Claus Assmann <ca@informatik.uni-kiel.de>
+ 
+         - PGP fails to check signature if KEEPBINARY=ON
+           From: Heiko W. Rupp <hwr@xlink.net>
+ 
+         - Created new directory melib and made archive libme.a.
+           Some code is moved to that directory. You need to
+           create that directory before applying path!
+ 
+ Changes of Elm2.4ME+ PL25 (25) compared to Elm2.4ME+ PL24 (25)
+ --------------------------------------------------------------
+ 
+         - Problem with screen size (elm_LINES and elm_COLUMNS
+           are inconsistent).
+           [ I was commented out line what was comment
+                       /* kludge for HP Window system? ... */
+             in PL23. VERY misleading........................
+ 
+             I HATE this.         - K E H <hurtta@ozone.FMI.FI>
+           ]
+           
+ 
+         - Fix release month
+ 
+ Changes of Elm2.4ME+ PL24 (25) compared to Elm2.4ME+ PL23 (25)
+ --------------------------------------------------------------
+ 
+         - ks/ke capabilities are optional. They are not present
+           in ANSI -terminal.
+           From: "Andrey A. Chernov" <ache@nagual.ru>
+ 
+         - X-ELM-OSV was not correctly parsed
+ 
+ Changes of Elm2.4ME+ PL23 (25) compared to Elm2.4ME+ PL22 (25)
+ --------------------------------------------------------------
+ 
+         - Add a new config variable, called askpgpsig. 
+           When set to ON, Elm will ask for a username to 
+           sign pgp messages with. 
+           From: Guido van Rooij <guido@gvr.win.tue.nl>
+ 
+         - menu2.c: ch must be int, or comparations with -1 (EOF) 
+           and 257 (REDRAW_MARK) produce wrong results.
+           From: Andrey A. Chernov <ache@nagual.ru>
+           From: Guy Harris <guy@netapp.com>
+ 
+         - In "do_pipe()", "redraw" was both a variable and a label.
+           From: Guy Harris <guy@netapp.com>
+ 
+         - If you've set characters such as the word-erase or 
+           reprint character to non-standard values, use your values, 
+           not the standard ones.
+           From: Guy Harris <guy@netapp.com>
+           [ Added also !escaped test, because now these characters can 
+             be printable. ]
+ 
+         - Moved processing of cursor keys to ReadCh
+           (old cursor key handling was buggy).
+         > HP's shoftkeys are not supported:
+            No options: -k -K
+            No elmrc variables: softkeys keypad
+         > Recognized keys are:
+                 Key             tercap name     terminfo name
+                 -----           -----------     -------------
+                 UP arrow        ku              kcuu1
+                 DOWN arrow      kd              kcud1
+                 LEFT arrow      kl              kcub1
+                 RIGHT arrow     kr              kcuf1
+                 PAGE UP         kP              kpp
+                 PAGE DOWN       kN              knp
+                 HOME            kh              khome
+                 HELP            %1              khlp
+                 FIND            @0              kfnd
+         > To get keys to use, your $TERM variable must point 
+           termcap/terminfo defination what includes these keys.
+           Notice that 'vt100' does not include other than cursor
+           keys. You must perhaps make new defination, for example
+           terminal type 'vt100-plus' :-) For terminfo use 'tic' and
+           'infocmp' -commands.
+ 
+         - state operations are moved outside of #ifdef MIME ... #endif
+         - Added new routines state_write_headers, state_read_headers,
+           delete_headers, locate_header and find_header to
+           parse_util.c. read_header_line is now implemented with routine
+           state_read_hdr_line. file_read_headers is implemented with routine
+           state_read_headers.
+         > Now included RFC 822 parts have printed text
+           -- Start of included mail From: xxxxx
+           instead of
+           -- Start of included mail.
+         - Rewritten read_mime_header to use file_read_headers, mainly by 
+           dividing it to new routine parse_mime_headers
+         > Rewritten rfc822_parse. Now non-mime messages inside of
+           message/rfc822 should be handled more correctly.
+         - Setting elmrc variable 
+           require-mime-version-for-body-encoding to FALSE causes
+           that almost all messages are treated as MIME -messages and
+           MIME-Version is not required for these (in top level
+           or inside of message/rfc822).
+ 
+         - Add  flag CM_REMOVE_ENVELOPE for copy_message
+         > make message/RFC822 attachment when forwarding with copy_message
+ 
+         - Make wait() in matapager restart in case of EINTR error
+ 
+         - Do MIME Part 2 (RFC 1522) decoding even when not MIME
+           even when not Mime-Version -header is present 
+           (If you want olf behauviour, set elmrc variable
+            require-mime-version-for-hdr-encoding to TRUE).
+           Header decoding is not done if sending elm was 
+           disabled to do MIME Part 2 (RFC 1522) encoding
+           (as set in elmrc variable nohdrencoding). That 
+           information is carried in header X-ELM-OSV:
+           (Our standard violations).
+ 
+         - quoted-printable-decode was not decoding zero length part
+           correctly.
+         > Indicate with length == -1 as not set instead of length == 0
+ 
+         - Added symbolics values RHL_MARK_FOLDING and RHL_CHECK_HEADER
+           for flags of read_header_line. Now read_header_line check
+           header for carefully. Side effect: If there is spaces before
+           ':' in header, them are deleted (assuming RHL_CHECK_HEADER).
+ 
+         - Add to mime_types[] following non-standard main content types:
+           x-world, model
+ 
+ Changes of Elm2.4ME+ PL22 (25) compared to Elm2.4ME+ PL21 (25)
+ --------------------------------------------------------------
+ 
+         [ Warning: There is quite much changes in
+           user interface, so perhaps there is bugs. ]
+ 
+         > Changes in Makefile.SH -- remember to run
+           'Configure' or 'Configure -d' or 'Configure -S'
+ 
+         - 'ch' need to be 'int' in alias()
+         - 'cmd' need to be 'int' in MenuLoop()
+         - 'ch' need to be 'int' in generic_menu()
+           Problem noted by: Claus Assmann <ca@informatik.uni-kiel.de>
+ 
+         - There was unwanted trigraph in run_decoder()
+           Problem noted by: Claus Assmann <ca@informatik.uni-kiel.de>
+ 
+         - There was missing 'default:' in state_put()
+           Problem noted by: Claus Assmann <ca@informatik.uni-kiel.de>
+           Problem noted by: Guy Harris <guy@netapp.com>
+ 
+         - rename 'timeout' to 'elm_timeout' to get rid out linker warning
+         - rename 'filter' to 'elm_filter' to get rid out linker warning
+         - rename 'LINES' to 'elm_LINES' to get rid out linker warning
+           (These are defined also in libtermlib.so)
+ 
+         - rename 'COLUMNS' to 'elm_COLUMNS' to match 'elm_LINES'
+ 
+         - If there is Raw(ON) in parent in metapager(), then
+           also Raw(OFF) must be in parent
+           Noted by (?): Jurgen Fluk <louis@dachau.marco.de>
+ 
+         - Replace some getchar()s with ReadCh(REDRAW_MARK)
+           in syscall.c
+ 
+         - Replace some getchar()s with ReadCh(REDRAW_MARK)
+           in read_rc.c
+ 
+         - Replace some getchar()s with ReadCh(REDRAW_MARK)
+           in alias.c
+ 
+         - Replace some getchar() with ReadCh(REDRAW_MARK)
+           in utils.c
+ 
+         - Use type application/X-ELM-encode with
+           [enclode] ... [clear] if message is multipart
+           (Elm 2.4ME+ PL6 should know this type, but there
+            was error is some versions of ME+ in mime_notplain).
+ 
+         - mime_notplain was returning TRUE (should be FALSE) 
+           for application/X-ELM-encode.
+ 
+         - The builtin++ pager clears the screen before displaying the 
+           first screen of the message; however, the metapager wasn't 
+           clearing the screen before running the external pager, which 
+           left some junk on the screen.
+           From: Guy Harris <guy@netapp.com>
+ 
+         - Convert optionally_enter to use flag bits and
+           now it returns REDRAW_MARK in most places when redraw
+           is needed
+ 
+         - LOCK_DIR removed from Configure / config.h.SH
+ 
+         - Rememmber if last Configure run there was answer
+           'none' for additional librariers
+ 
+         - Some new checks in Makefile (or actually in Makefile.SH), 
+           Configure is run lately (that confih.sh or Makefile or
+           config.h are not stale)
+           
+ 
+ Changes of Elm2.4ME+ PL21 (25) compared to Elm2.4ME+ PL20 (25)
+ --------------------------------------------------------------
+ 
+         - More Configure fixes for IRIX 6.2
+ 
+         - PGP signed messages (with type text/plain) was not handled
+           correctly.
+           Noted by: Volker Paulsen <Volker.Paulsen@gmd.de>
+ 
+         - Just a short one-liner to fix the display:  
+           When you leave the key selection menu in 
+           pgp_mail_public_key() with `q' (i.e., don't mail a key), 
+           this routine currently returns 0.  This means that the main list
+           won't be redrawn and seems to be a bug.
+           From: Thomas Roessler <roessler@sobolev.rhein.de>
+ 
+         - read_number should create buffer of size SLEN, not NLEN
+           since it uses optionally_enter() which assumes that the 
+           buffer has length SLEN
+           From: Thomas Roessler <roessler@sobolev.rhein.de>
+ 
+         - Additionally, one might want to have the pgp functions 
+           in the help menu.
+           From: Thomas Roessler <roessler@sobolev.rhein.de>
+           
+ Changes of Elm2.4ME+ PL20 (25) compared to Elm2.4ME+ PL19 (25)
+ --------------------------------------------------------------
+ 
+         [ There is changes of error handling of leave_mbox --
+           so report, if you lost mail... ]
+ 
+         - Look also termlib.so and curses.so in Configure
+ 
+         - Remove PGP test from need_meta in showmsg.c
+           (It was causing that metamail was not called for 
+            multipart/signed what isn't supported.)
+ 
+         - Move metamail flags before PGP flags in show_message
+           in screen.c 
+ 
+         - lib/safeopen.c need to be added to MANIFEST
+           Noted by: Keith Manley <kmanley@bits.fc.hp.com>
+ 
+         - Elm as acting quite oddly if ending boundary of multipart
+           structure was missing.
+           Detected from report of: Rolf Larsson <rln@ludd.luth.se>
+ 
+         - Add sleep_message() to out_utils.c
+ 
+         - Detect if there is read error in newmbox!
+ 
+         - Check read errors also in some other places....
+ 
+         - Changes in leave_mbox -- now it returns with value -2 if
+            it fails to leave folder
+ 
+         - SIGUSR1 and SIGUSR2 is anly handled when in prompt
+           (because otherwise we can be in wrong state --
+            for example in middle in resync.)
+ 
+         - Check in ReadCh if it was called from GetPrompt
+           (GetPrompt want to see EINTR error!)
+ 
+         - ReadCh takes now redraw flag: Either 0 or REDRAW_MARK.
+           Now elm is able in many places automatically redraw screen
+           when elm resumes after suspending.
+ 
+         - skip_envelope() to parse_util.c
+ 
+         - Use skip_envelope() in get_and_expand_everybody() and
+           handle_reply_to() -- now elm should not be confused
+           with MMDF envelope of mail
+           Reported by: { Unknown -- mail lost }
+ 
+ Changes of Elm2.4ME+ PL19 (25) compared to Elm2.4ME+ PL18 (25)
+ --------------------------------------------------------------
+ 
+         - Fix SIGSEGV (with application/pgp; format=mime)
+ 
+         - With application/pgp; format=mime in included mime type
+           nested structures was not parsed (actually that was causing
+           SIGSEGV)
+ 
+         - recognize application/pgp; x-action=signclear
+ 
+         - Add "-- Start of included mail." and "-- End of included mail."
+           texts.
+ 
+ Changes of Elm2.4ME+ PL18 (25) compared to Elm2.4ME+ PL17 (25)
+ --------------------------------------------------------------
+ 
+         [ This patch includes very many changes, so perhaps there
+           are bugs ... ]
+ 
+         - Clean up some of the questions in the "Configure" script.
+           From: Guy Harris <guy@netapp.com>
+ 
+         - Added a '-S' option to the Configure script to just redo the
+           "variable substitutions on .SH files" that the script performs
+           at the end.  "I found this extremely useful, as I often made
+           changes to the config.sh (for instance, the 'optimize' flags),
+           and I wanted to re-create the Makefiles without running the
+           entire Configure script all over again."
+         - Also added '-h' option to report usage and available options to
+           Configure script.
+           From: Will Day <willday@rom.oit.gatech.edu>
+ 
+         - Add support for a "mailpermissions" variable in your "elmrc" file 
+           that can be set to specify the permissions to be used when creating 
+           a new mail folder.  The syntax to use when specifying the permissions
+           is *not* numeric, it's an "ls"-style string such as "rw-rw----", and
+           the default is "rw-------".
+           From: Guy Harris <guy@netapp.com>
+ 
+         - (Elm)HelpViewAttach was missing from s_elm.m
+ 
+         - Have the NLS stuff make "s_elmalias.h" from "s_elmalias.m".
+           From: Guy Harris <guy@netapp.com>
+ 
+         - Fix up "gencat" to compile on systems that don't do ANSI C 
+           (e.g., SunOS 4.1[.x] when using the bundled C compiler).
+           From: Guy Harris <guy@netapp.com>
+ 
+         - Some additions to help text of Elm
+ 
+         - Reconstruct mime_send_t.  There was wrong type when multipart
+           message was sent and pgp was used.
+           Noted by: J. Porter Clark <jpc@hammer.msfc.nasa.gov>
+ 
+         - Added elmrc option: "quoteforward", which will let the user 
+           restore the behavior of original elm when forwarding messages 
+           - that is, to quote them like replies.  
+           "I wanted this available, because usually when I forward a 
+            message, I will comment various lines, and if it's not quoted 
+            like a reply, my comments can be confused with the forwarded 
+            message (and I didn't want to have to manually comment the 
+            message every time)."
+           From: Will Day <willday@rom.oit.gatech.edu>
+ 
+         - convert mail() and send_msg() to use binary flags. 
+           Get rid of global variable "forwarding".
+ 
+         - Added safeopen_rdwr() call yet some places.
+           "While browsing through elm me+ xyz kh's source code, 
+            I stumbled across an invocation of tempnam() in a 
+            somewhat insecure environment:  In mailmsg2.c, it's 
+            output is used as argument to fopen(...,"w+").  This is
+            dangerous, since it may allow other users to access those 
+            temporary files."
+           From: Thomas Roessler <roessler@sobolev.rhein.de>
+         > Also use open_end_update() call, then code is cleaner
+           [ In suplied patch there was possibility that elm destroyes
+             =sent folder... ]
+ 
+         - Modification for Configure: On a Linux system which uses 
+           ELF-format shared libaries, the library symbols do not have 
+           an underscore prepended to them.
+           "I simply removed the [._] part from the sed expression.  This
+            makes everything compile and run happily on my machine, 
+            but if you want to correct this problem in your distribution, 
+            you would probably want to keep the old rule as well, to keep 
+            it from breaking elsewhere."
+           Noted by: Matthew Hunt <hunt@mph124.rh.psu.edu>
+ 
+         - "The second patch (re-)enables the use of the `T' key in the menu 
+            at the end of a message (tag + next).  This used to work in 
+            earlier releases of elm."
+           From: J Wunsch <j@uriah.heep.sax.de>
+ 
+         - "I think there is a small bug in metapager.c which has the 
+            consequence that the pager menu is sometimes displayed on the 
+            wrong screen page. The patch below fixes this behaviour."
+          From: Thomas Roessler <roessler@sobolev.rhein.de>
+ 
+          [ This patch little questionable -- 'ti' is "string to begin
+            brograms that use cup" (cursor addressing) and 'te' is
+            "string to end programs rhat use cup" -- problem is
+            that xterm uses ti/te to swap screen page... ]
+ 
+         - "Additionally, there is still an ugly timezone bug in elm-me+; 
+            the old patch for elm 2.4 applies cleanly to the current me+ 
+            version."
+           Noted by: Thomas Roessler <roessler@sobolev.rhein.de>
+         > Fix timezone:
+           "OK...here is the fix for the wierd timezone shifting.  
+            Besides the botched month parameter, the year also was wrong.
+ 
+            This patch better documents the input parameters to the 
+            lib/date_util.c procedures, and fixes get_tz_mins() to avoid 
+            a wierd offset shifting problem.  Thanks to Thomas Roessler 
+            <roessler@sobolev.rhein.de> for chasing down the cause of the 
+            problem."
+          From: Chip Rosenthal <chip@unicom.com>
+ 
+         - Fix dangling pointer bug in attach_viewer!
+ 
+         - Recognize text/x-pgp.
+           From: Guido van Rooij <guido@gvr.win.tue.nl>
+           [ + #ifdef USE_PGP added ]
+         > If type was text/x-pgp, don't consider case 
+           that PGP file is binary
+ 
+         - Don't convert application/x-pgp* to application/pgp
+           in newmbox.c -- instead recognize it in mime_decode.
+ 
+         - Don't reset type_opts when converting text/plain to
+           application/pgp.
+           [ That change was buggy -- fixed in PL21 ]
+ 
+         - Move "Decrypting message..." and "Checking signature..."
+           messages to another place.
+ 
+ Changes of Elm2.4ME+ PL17 (25) compared to Elm2.4ME+ PL16 (25)
+ --------------------------------------------------------------
+ 
+         -  Some systems use OXTABS bit instead of TABDLY
+           [ Various paches for *BSD ]
+           From: Ollivier Robert <roberto@keltia.freenix.fr>
+           From: Jeff Thieleke <thieleke@lust.isca.uiowa.edu>
+           From: Andrey A. Chernov <ache@astral.msk.su>
+ 
+         - Undone HP-UX change for ANSI_C
+           "This is mostly incorrect.  We figured out that 
+            the problem was the -traditional flag that was included 
+            by default when compiling with gcc."
+           Noted by: Jeff Thieleke <thieleke@lust.isca.uiowa.edu>
+ 
+         - Removed -traditional from gcc flags in Configure
+           "The real fix would be to remove the default CFLAGS when 
+            compiling with gcc, since they probably aren't needed any more."
+           Suggested by: Jeff Thieleke <thieleke@lust.isca.uiowa.edu>
+ 
+         - Don't allow change a filename of forwarded mail in attachment
+           menu.
+ 
+         - If content-transfer-encoding is unknown when saving attachment,
+           treate it as binary.
+ 
+         - Don't allow change filename in attachment menu to non-existent
+ 
+ Changes of Elm2.4ME+ PL16 (25) compared to Elm2.4ME+ PL15 (25)
+ --------------------------------------------------------------
+ 
+         [ Warning: state routines are rewritten -- so look below
+           what to do if you get STATE PANIC message ... ]
+ 
+         - Add #include "headers.h" to safeopen.c to get rid
+           out one stupid compiler warning
+           Urged by: Andrew J. Piziali <andy@daldd.sc.ti.com>
+ 
+         - struct state is divided to two structs: struct in_state
+           and struct out_state. Large modifications to state
+           routines (state.c). 
+ 
+           If you get message STATE PANIC: Bad magic number
+           compile elm with debugging -g and -DDEBUG
+           and run elm with -d11 and try get it repeated.
+           Now STATE PANIC should cause producing of core file.
+           
+           Look with debugger where that STACE PANIC accured (ask
+           stack trace from debugger) and look also file ~/ELM:debug.info
+ 
+         - If terminal driver is expanding tabs, do not print
+           them -- instead jump to correct location
+ 
+         - "HP-UX apparently doesn't declare __STDC__ (like AIX), 
+            so compiling with cc or gcc fails in src/init.c at the getgid(), 
+            getuid() prototypes."
+           From: Jeff Thieleke <thieleke@icaen.uiowa.edu>
+           [ Undone in ME+ PL17 ]
+ 
+         - If you sign 8-bit mail, it will be later encoded with
+           quoted-printable or base64 (by elm or by sendmail).
+           Thus 'invalidating' because pgp_decode does not undo contet-
+           transfer encoding before calling PGP.
+           Noted by: Zoltan Hidvegi <hzoli@cs.elte.hu>
+           Noted by: Hans-Christoph Wirth <hansi@dianoia.mayn.de>
+         * Now content-transfer-encoding is decoded before bodypart
+           is passed to pgp (it also now work, when *.pgp file
+           is encoded with base64).
+         > That decoding is done via temporary file -- perhaps I
+           some time stack state routines so temporary file is not needed
+           and decoding of content-ttransfer-encodings are done during
+           reading.
+         > If I some day get implemented MIME/PGP then 8-bit mail is always
+           encoded with quoted printable and then passed to PGP for signing.
+ 
+         - Display text before PGP armor if elmrc variable showpgppreamble
+           is set (default). Binary PGP files are detected by looking first
+           byte (after decoding content-transfer-encoding).
+ 
+         - Fix to PL15 fix: "Elm fail in resyncing if mailfile is created 
+           after initial entering to mailbox." -- previous fix can cuase
+           elm exiting with message 
+           "What's this?  The temp folder already exists??" and then
+           "Ahhhh... I give up."
+           Perhaps noted by: Andrew J. Piziali <andy@daldd.sc.ti.com>
+ 
+         - SECURITY: Elm was running PGP as setgid mail (by using popen)
+           when searching matching keys -- converting to use 
+                 pipe - fork - setgid (groupid) - execl
+ 
+         - Need pass +language=en to PGP when searching matching keys
+           Noted by: Boris Staeblow <balu@reido.in-berlin.de>
+ 
+         - Initialize last (extra) element also to NULL in DynamicArray
+           so that DestroyDynamicArray works (lib/dynarray.c)
+           -- was causing SIGSEGV in GetPGPKey
+ 
+         [ Undo Elm2.4ME+ PL15s patch before installing this patch. ]
+ 
+ Changes of Elm2.4ME+ PL15s (25) compared to Elm2.4ME+ PL15 (25)
+ ---------------------------------------------------------------
+ 
+         - SECURITY: Elm was running PGP as setgid mail (by using popen)
+           when searching matching keys -- converting to use 
+                 pipe - fork - setgid (groupid) - execl
+ 
+ Changes of Elm2.4ME+ PL15 (25) compared to Elm2.4ME+ PL14 (25)
+ --------------------------------------------------------------
+ 
+         [ Warning: This is perhaps more buggy than PL14. ]
+ 
+         - Some changes in Makefiles, Configure
+         - Change of temporary mbox name, put temporary mbox to
+           back to temp directory (from home directory)
+         - lib/safeopen.c
+         - can_open(filename,"sw") checks if creating of _new_ file
+            is possible (O_EXCL) -- and use that in leavembox.c
+            Side-effect: New file is created
+         - use isprint((unsigned char)ch) in src/curses.c
+         - "I removed all fopen(file, "w") where file was a filename in /tmp 
+            and replaced these with a safeopen(file) call.  These changes 
+            should be also applied to the vanilla elm source."
+         - "Also there are some minor bugfixes for PL11.  
+            Elm did not asked my PGP password when I wanted to 
+            read a PGP encrypted mail since it wrongly thought
+            that the mail is only signed but not encrypted.  
+            That's the most serious bug."
+         - "I add a ClearScreen() before the fork in pgp_decrypt_init() 
+            to make the screen look clearer."
+            From: Zoltan Hidvegi <hzoli@cs.elte.hu>
+ 
+         - Routine safeopen_rdwr added to safeopen.c 
+ 
+         - Test agaist special modes was WRONG in leavembox.c
+                 (it was 0x7000 and it should be 07000)
+         - Treate files with special modes as SPOOL files (newmbox.c)
+         - Handle 'intelligent' way also SPOOL files what haven't in mailhome
+         - Restore also special modes of file if file is not executable
+         - Don't chown file if owner is already correct -- it resets
+           special modes
+         * With these changes it is possible to redirect sendmail aliases
+           to files (mode 04600) and cause that elm does not reset setgid
+           bit (what is required to be set, before sendmail accepts forwarding
+           to no world writable files).
+ 
+         - Multiple To: -headers was cauisng of trashing of memory
+           and SIGSEGV
+           Noted by: Richard Allen <ra@rhi.hi.is>
+ 
+         - Elm fail in resyncing if mailfile is created after initial
+           entering to mailbox.
+           Noted by: Miroslav Ruda <ruda@ics.muni.cz>
+           { I didn't used suplied patch. }
+ 
+         - Elm fails to create received -folder
+           Noted by: Jussi Kaurola <kaurola@dionysos.FMI.FI>
+         - Added function open_end_update to file_util.c
+ 
+         - Replace iscntrl((unsigned char)*pending) with
+           !isprint((unsigned char)*pending) in builtin++.c
+           because Configure asks that is isprint 
+           working with 8-bit values, but it does not ask about iscntrl
+ 
+         * Notice: Seems that someones does not agreed with interpretation
+           of ASCII_CTYPE defination. My interpretation is:
+ 
+                 ASCII_CTYPE defined:    isprint works only with arguments
+                                         0-127
+ 
+                 Conclusion:             We can't test that is characters in
+                                         range 128-255 printable or not, so
+                                         don't print them
+ 
+           ASCII_CTYPE is defined when you answer "no" to following question:
+           "Should Elm assume that isprint() won't break on 
+             non-ASCII characters?"
+ 
+           To get 8-bit characters to work you need:
+                 1) 8-bit clean ctype functions and macros
+                 2) ASCII_CTYPE is not defined
+                 3) setlocale exists (Configure have found locale.h;
+                    that is: I_LOCALE is defined)
+                 4) Correct locale defination (environment variable
+                         $LANG or $LC_CTYPE usually)
+                    Look manual page of setlocale
+                 - If you are not using builtin(++) pager in Elm, thinks
+                   can go more complicated -- all pagers does not use
+                   locale definations
+ 
+         - Use kill(getpid(), SIGSTOP) instead of  kill(0, SIGSTOP)
+           so that delivering of mail does not stop when user suspends
+           Elm.
+           Reported by: Richard J. Auletta <rauletta@erebor.cudenver.edu>
+ 
+ Changes of Elm2.4ME+ PL14 (25) compared to Elm2.4ME+ PL13 (25)
+ --------------------------------------------------------------
+ 
+         - PGP signed (or encrypted) MIME mail was not quoted when 
+           replying. Quick fix for pgp_decode in pgp.c. It still 
+           perhaps have broken...
+ 
+ Changes of Elm2.4ME+ PL13 (25) compared to Elm2.4ME+ PL12 (25)
+ --------------------------------------------------------------
+ 
+         - Compiler was giving warning that 'char *' and
+           'unsigned char *' are not assignment-compatible
+           (for code in mime_encode.c)
+           Noted by: Arkady Altman <aya@cae.cig.mot.com>
+ 
+         - Include headers of forwarded message to editor
+           buffer even when you have noheader = ON
+           (that is in situation mimeforward = OFF).
+           That is now controlled with elmrc variable "noheaderfwd"
+           (default: OFF)
+ 
+         - Elm was getting SIGSEGV in remailer_parse_opts in remailer.c
+           Noted by: V Menayang <victor@slip-50-11.ots.utexas.edu>
+           [ Notice that this REMAILER code is still broken! ]
+ 
+         - remailer.c was calling finger without resetting egid!
+ 
+         - FreeBSD changes to utils/newmail.c also pertain to NetBSD
+           From: Jeff Thieleke <thieleke@icaen.uiowa.edu>
+ 
+ Changes of Elm2.4ME+ PL12 (25) compared to Elm2.4ME+ PL11 (25)
+ --------------------------------------------------------------
+ 
+         Warning: This version is probably much more buggy
+                  than PL11 !!
+ 
+         - The blank line between two messages in a folder 
+           was missing.
+           Noted by: Juergen Obermann <Juergen.Obermann@hrz.uni-giessen.de>
+ 
+         - If nohdrencoding = TRUE and there is 8bit  characters in subject,
+           treat as there was 8bit characters in body.
+           From: Andrey A. Chernov <ache@astral.msk.su>
+           [ This does not work very well... ie. It works only when
+             Content-Type is Text/plain. ]
+           " Before RFC 1522 issued, too many users (f.e. Russian users) use
+             8bit chars in Subject: header field. There is a lots of 8bit 
+             capable MUA & MTA exists now, much more then RFC1522 compatible 
+             ones. In existent variant when you enter 8bit subject with ASCII 
+             body result content charset stays as ASCII, it makes impossible to
+             recognize Subject: charset. I UNDERSTAND that my method violates 
+             MIME slightly (no 8bit characters must be in header field) but it 
+             is adoptation of real life practic."
+ 
+         - Add /usr/sbin to default path, there is sendmail on FreeBSD
+         - Disable national extensions of 'date'
+         - Add FreeBSD lock directory
+         - Add KOI8-R charset to user prompt, it is officially registered, 
+           RFC1700
+         - Fix utime_buffer declaration for FreeBSD
+         - Allow mailbox editing for Expert user level only. Total disabling
+           of this option makes life harder for experienced users and total
+           enabling cause accidental 'e' hitting damage novice users mailboxes.
+           It seems that enabling it for Expert user leve is the best solution.
+           From: Andrey A. Chernov <ache@astral.msk.su>
+ 
+         - "I also discovered another small 'bug'... Michael Elkins changed 
+            someday in pgp.c a get_address_from() call to a simple strcpy() 
+            which caused my pgp not to find my secret key because of a 
+            leading blank:
+            " Volker Paulsen <paulsen@gmd.de>"
+             ^
+            After I changed it back to get_address_from() the leading blank
+            becomes removed and pgp matches the key correctly against its key
+            ring ."
+           From: Volker Paulsen <Volker.Paulsen@gmd.de>
+ 
+         - Add binary -flag for header_rec. No longer hack for remail.c.
+ 
+         - Make more clear what part of message was PGP signed or encrypted.
+           (Why pgp returns exit status 0 even when signature doesn not
+            match???)
+ 
+         - Some massive rewriting of copy_message. Now should decoding of
+           RFC 1522 encoding work correctly when replying (and forwarding).
+           Side effects:
+                 - Headers which have longer than 32 KB after unfolding
+                   are truncated
+                 - Exact folding is not preserved
+ 
+ Changes of Elm2.4ME+ PL11 (25) compared to Elm2.4ME+ PL10 (25)
+ --------------------------------------------------------------
+ 
+         - Elm wrote incorrect Content-Length: -header when 
+           updating Status: -header
+           Noted by: Juergen Obermann <Juergen.Obermann@hrz.uni-giessen.de>
+           [ That content-length is lightly too big and is not fixed
+             if it is last mail in folder (it is not big enough that
+             newmbox.c notices) also incorrent Content-Length: -header
+             causes in other situations that it is ignored. This causes
+             problems when "From ":s are not escaped. ]
+ 
+ Changes of Elm2.4ME+ PL10 (25) compared to Elm2.4ME+ PL9 (25)
+ -------------------------------------------------------------
+ 
+         - CM_DISPLAYING was wrong value in hdrs/defs.h
+ 
+         - Elm was corrupting folder by adding number to end of mail...
+           And therefore causes that next mail does not start
+           with "From " in folder.
+           Noted by: Volker Paulsen <Volker.Paulsen@gmd.de>
+ 
+         - REMAILER code does not compile.
+           From: Andrey A. Chernov <ache@astral.msk.su>
+           From: Arkady Altman <aya@cae.cig.mot.com> 
+ 
+ Changes of Elm2.4ME+ PL9 (25) compared to Elm2.4ME+ PL8 (25)
+ ------------------------------------------------------------
+ 
+         - Attach viewer does not completely fill header_rec 
+           so "lines" was uninitiazed, which may cause
+           "metapager()" to choose randomly whether to use the 
+           built-in pager or not, if you haven't set "pager" to 
+           "builtin" or "internal". Now structure is pre-initialized
+           completely. "lines" is set to number of bytes / 60
+           (not saticfactory, but actually metapager should use 
+            number of lines in decoded message -- 
+           not in original anyway.)
+           Prompted by: Guy Harris <guy@netapp.com>
+ 
+ Changes of Elm2.4ME+ PL8 (25) compared to Elm2.4ME+ PL7 (25)
+ ------------------------------------------------------------
+ 
+         - In syscall.c, around line 180, the space for p 
+           was allocated but the actual string was never built.
+           From: Mark Johnson <Mark.Johnson@ustc.vlsi.COM>
+         
+         - At the end of a message with the buildin pager I 
+           sometimes get the prompt "MORE (you've seen 101%):"
+           and I can not read the next message with 
+           pressing the space bar.
+           From: Juergen Obermann <Juergen.Obermann@hrz.uni-giessen.de>
+ 
+         - "rfc822_reap_comments()" wasn't properly handling 
+           Content-Type: headers like
+ 
+           Content-Type: Multipart/Mixed;
+                 boundary="--Next_Part(Wed_Feb_14_09:54:49_1996)--"
+ 
+           because it didn't realize that the ")" in the boundary 
+           was inside a quote, and therefore should be copied rather 
+           than being stripped out.
+           From: Guy Harris <guy@netapp.com>
+ 
+         - It wasn't RFC 1522-decoding the name in the "From:" header 
+           when it put in the "Forwarded message from" and 
+           "End of forwarded message from" lines.
+           From: Guy Harris <guy@netapp.com>
+ 
+         - Put defualt disposition for attachment to be 'attachment'
+           when sending.
+ 
+         - Check that attachment is not deleted before mail is sent.
+ 
+         - Because copy_message is now called from metapager, it
+           needs two more arguments (mailfile and current_header).
+           I hope that this change breaks nothing! 
+           Detected from report of: Mark Johnson <Mark.Johnson@ustc.vlsi.COM>
+ 
+ Changes of Elm2.4ME+ PL7 (25) compared to Elm2.4ME+ PL6 (25)
+ ------------------------------------------------------------
+ 
+         - Incorrect subject
+ 
+ Changes of Elm2.4ME+ PL6 (25) compared to Elm2.4ME+ PL5 (25)
+ ------------------------------------------------------------
+ 
+         - Sometimes extra newline was added when message or
+           body of it was copied.
+ 
+               > copy_message in fileio.c was gone too hairy.
+                 Tried to reorganize it. I hope that nothing
+                 breaks.
+ 
+               > Semantic of flag CM_DECODE is now changed.
+ 
+               > Now message is decoded before replying and forwarding
+                 (excpet when mime_forward is true -- forwarded message
+                 as attachment is not decoded).
+ 
+               > Well, now [encode] [clear] does not work when metamail
+                 is called.
+ 
+               > [encode] ... [clear] is now internally handled as
+                 application/X-ELM-encode (in MIME -message)
+ 
+         - Do RFC 1522 decoding only in MIME messages.
+ 
+         - builtin++ code in metapager was broken [encode] ... [clear] 
+ 
+               > I simplified metapager. I hope that nothing
+                 breaks.
+ 
+         > Notice that [encode] ... [clear] is broken when sending
+           multipart messages.
+ 
+         - Now also headers of message/rfc822 are prefixed when replying
+ 
+         - Nicer printing of folded headers (in metapager and rfc822_decode)
+ 
+         - Letter 'e' (= uses Elm's [encode] ... [clear]) added to status
+           letter of mailbox menu.
+ 
+ Changes of Elm2.4ME+ PL5 (25) compared to Elm2.4ME+ PL4 (25)
+ ------------------------------------------------------------
+ 
+         - "nohdrencoding" was in wrong place in list
+ 
+         - To instead of From in headers was always displayed:
+           From: Petr Lampa <lampa@fee.vutbr.cz>
+ 
+         - There was some confusion in (char *) versus (unsigned char *)
+           in rfc1522_encode_text.
+           Pointed by: Petr Lampa <lampa@fee.vutbr.cz>
+ 
+         - Replaced check of R_OK with ECCESS_EXISTS in can_save 
+           in attach_menu.c
+ 
+         - Reordering of attach_viewer so metamail is not called 
+           when it isn't needed (new defination of 'pagemultipart'
+           was broken it.)
+ 
+         - Message "Parsing MIME structure..." is printed
+ 
+         - Added to some unlink and elm_chown calls to attach_menu.c
+ 
+         - Now prints "Executing metamail..." if metamail is called for
+           display message.
+ 
+         - Tried fix MIME decoding of headers in copy_message
+           (well, it still can't work correctly.)
+ 
+         - MIME (RFC 1522) encoding of In-Reply-To -header
+ 
+                 > Address headers and headers from .elm/elmheaders are still
+                   not encoded.
+ 
+         - Don't try print To: address in menu if it does not exists.
+ 
+ Changes of Elm2.4ME+ PL4 (25) compared to Elm2.4ME+ PL3 (25)
+ ------------------------------------------------------------
+ 
+         [ Warning: This is perhaps more buggy than PL 3 (25). ]
+ 
+         * Sending of simple Text/Plain messages with quoted-printable encoding
+           was broken when remailer -code was added.
+           Noted by: Petr Lampa <lampa@fee.vutbr.cz>
+ 
+         - In the index screen Tag all, Delete all and Undelete all 
+           didn't show the new status of the messages.
+           From: Juergen Obermann <Juergen.Obermann@hrz.uni-giessen.de>
+ 
+         - In readmsg the Cc-header line is always shown.
+           From: Juergen Obermann <Juergen.Obermann@hrz.uni-giessen.de>
+           [ This should be also posted to Elm Development Cordinator ]
+ 
+         - Add a "Status: RO" line to all outgoing messages (when the "copy" 
+           option is turned on), so that they do not show up as "New" when you 
+           look at a folder.
+           From: Pete Wenzel <pete@stc.com> 
+ 
+         - The macro X_OK is undefined in some systems. 
+           Use EXECUTE_ACCESS instead.
+           From: Gunnar Ekolin <ekolin@carlstedt.se>
+ 
+         > Failing to include <unistd.h>. 
+           Test agaist I_UNISTD instead of ANSI_C.
+           Noted by: Petr Lampa <lampa@fee.vutbr.cz>
+ 
+         > Now EXECUTE_ACCESS, WRITE_ACCESS, READ_ACCESS, ACCESS_EXISTS,
+           EDIT_ACCESS is defined in terms of X_OK, W_OK, R_OK, F_OK
+           from unistd.h (if available)
+ 
+         - Fix defination in hdrs/mcprt.h to match with lib/mcprt.c
+           From: Claus Assmann <ca@informatik.uni-kiel.de>
+ 
+         - DisplayAddress not work (well, I really not used that patch).
+           That needs still reconsideration.
+           From: Claus Assmann <ca@informatik.uni-kiel.de>
+ 
+         - Mime (RFC 1522) encoding of following headers:
+                 - From  (fullname)
+                 - Subject
+                 - Content-Description
+ 
+                 Encoding of In-Reply-To, To, CC or headers in 
+                 .elm/elmheaders is NOT done.
+ 
+         - New elmrc variable "nohdrencoding". If this variable is TRUE,
+           then MIME encoding of headers isn't done.
+ 
+         - Wrong tests with allow_no_encoding in src/mailmsg2.c.
+           Noted by: Petr Lampa <lampa@fee.vutbr.cz>
+ 
+         - Use strincmp for lib/strincmp.c instead of strcasecmp.
+           Noted by: Petr Lampa <lampa@fee.vutbr.cz>
+ 
+         - Added check for write errors in mime_encode.c
+         
+ Changes of Elm2.4ME+ PL3 (25) compared to Elm2.4ME+ PL2 (25)
+ ------------------------------------------------------------
+ 
+         - Fix to builtin++.c SIGSEGV fix
+ 
+ Changes of Elm2.4ME+ PL2 (25) compared to Elm2.4ME+ PL1 (25)
+ ------------------------------------------------------------
+ 
+         - Really fix In-Reply-To -header
+           [ This is also posted to Elm Development Cordinator ]
+ 
+ Changes of Elm2.4ME+ PL1 (25) compared to Elm2.4ME+ PL0 (25)
+ ------------------------------------------------------------
+ 
+         - SIGSEGV in builtin++.c when looking full headers of mail
+           and Ctrl-L was hit.
+ 
+         - Typo in remailer.c (causes that it don't link)
+           From: Ollivier Robert <roberto@keltia.freenix.fr>
+ 
+         - Ultrix patch from comp.mail.elm
+           From: John Simonson <gort@wildcat.ceas.rochester.edu>,
+                 Sydney Weinstein <syd@myxa.com>, 
+                 Bill Gianopoulos <wag@swl.msd.ray.com>
+ 
+         - Now Elm's Configure search for metamail -program
+ 
+         - DisplayAddress: Don't munge sender with get_real_name
+ 
+         - Elm was generating syntactically incorrect In-Reply-To -headers
+ 
+         - Because some peoples seems have trashed src/state.c that patch
+           includes file src/state.c.PL1. 
+           If src/state.c.PL1 and src/state.c don't have identical,
+           use command: mv src/state.c.PL1 src/state.c
+           otherwise:   rm src/state.c.PL1
+ 
+         - SIGSEGV when hitting 'G' in builtin++.c
+ 
+ 
+ Changes of Elm2.4ME+ PL0 (25) compared to version Elm2.4 PL24 ME8b+
+ -------------------------------------------------------------------
+ 
+         - Added (security) patch PL24 -> PL25 and 
+           added same kind (security) fixes for MIME code
+ 
+         - Version number is now formed with new style :-)
+ 
+         - elmrc -variable 'displaycharset' is propgated to
+           environment variable $MM_CHARSET when calling metamail.
+           Environment variable $MM_CHARSET overwrides default value
+           of 'displaycharset'.
+ 
+         - New elmrc -variable 'metamail'. So now you not need define
+           environment variable $NOMETAMAIL, if you want compile Elm
+           with MIME support, and you don't have metamail. Special values:
+                 none            Don't call metamail
+                 metamail        Call metamail, if environment variable
+                                 $NOMETAMAIL is not defined
+                 /path           Call tiss, if this is executable
+ 
+         - Meaning of elmrc -variable 'pagemultipart' is changed. If
+           this is FALSE (default), then call metamail if elm can't
+           handle all subpart of multipart -type or if type is other
+           than multipart/mixed, multipart/digest or multipart/report.
+           If 'pagemultipart' is TRUE, then always handle multipart type
+           without metamail (and treate unknown subtypes as multipart/mixed).
+ 
+           Decision can Elm handle that type, is done when message is 
+           displayed. So there is now 'M' -letter (= metamail needed) in
+           multipart mails until message is displayed even when Elm can
+           show it (that is because that defination is recursive and
+           requires parsing of structure of message.)
+ 
+         - Multipart/digest now works correctly when viewing attachment
+           what we have sending and we have put type for it to be 
+           Multipart/mixed.
+ 
+         - Configure now tries test if sendmail supports -B8BITMIME and
+           -BBINARYMIME (unlikely).
+ 
+         - Makefile now don't compile or install 'filter' because security
+           problems in it.
+ 
+ Changes of Elm2.4 PL24 ME8b+ compared to version Elm2.4 PL24 ME8b
+ -----------------------------------------------------------------
+ 
+         - New version of my Reply-To patch included
+           [ Old version of that patch is posted to Elm Development Cordinator ]
+ 
+         - Made MIME part 2 (RFC 1522) decoding more accoriding of RFC.
+ 
+         - Some bugfixes
+ 
+ Elm mailbox menu's status letters
+ ---------------------------------
+         - First letter:         D       Deleted
+                                 E       Expired
+                                 N       New
+                                 O       Unread
+                                 r       replied
+ 
+         - Second letter:        C       Confidental
+                                 U       Urgent
+                                 P       Private         (or ...)
+                                 A       Action
+                                 F       Form letter
+                                 e       Uses Elm's [encode] ... [clear]
+                                 P       PGP message     (or ...)
+                                 S       PGP signed message
+                                 K       PGP public key
+                                 ?       MIME message with unknown
+                                                 MIME version
+                                 M       MIME message wich requires metamail
+                                                 or isn't yet parsed
+                                 m       Pre-MIME message wich requires metamail
+ 
+ New elmrc variables for Elm 2.4ME+ (compared to Elm 2.4)
+ --------------------------------------------------------
+ 
+         askpgpsig                               PGP
+         background-wait-time                    -
+         dsn-success                             MIME / DSN
+         keeppassfor                             PGP
+         lock-in-copy                            -
+         metamail                                MIME
+         mimeforward                             MIME
+         noencoding                              MIME
+         nohdrencoding                           MIME
+         noheaderfwd                             -
+         pagealternative                         MIME
+         pagemultipart                           MIME
+         pgp                                     PGP
+         quoteforward                            -
+         require-mime-version-for-body-encoding  MIME
+         require-mime-version-for-hdr-encoding   MIME
+         showpgppreamble                         PGP
+         usepgppass                              PGP
+ 
+ Obsolete elmrc variables
+ -------------------------
+         hpkeypad                                (alias to keypad)
+         hpsoftkeys                              (alias to softkeys)
+         keypad                                  -
+         softkeys                                -
+         textencoding                            MIME
+         bounce                                  (alias to bounceback)
+         bounceback                              UUCP
+ 
+ New elm options for Elm 2.4ME+ (compared to Elm 2.4)
+ ----------------------------------------------------
+ 
+         -w                      Write .elm/elmrc on startup
+         -A                      Attach file
+ 
+ Obsolete elm options
+ --------------------
+ 
+         -k                      Enable HP 2622 terminal keyboard\n\r
+         -K                      Keypad&softkeys - enable use of softkeys + "-k"
+ 
+ Options which now takes enumerated values
+ -----------------------------------------
+ 
+         userlevel               beginner, intermediate, expert
+         noencoding              pass-7bit, pass-8bit, pass-binary
+ 
+ Warnings
+ -------- 
+ 
+         - Not compiled with MMDF or REMAILER support defined, so
+           probably they don't work (or even compile).
+ 
+         - As far I know REMAILER code have newer worked. 
+           Specially: remailers are incompatible with MIME
+ 
+         - This is not tested very much so there can be bad bugs. Bug
+           Reports to: Kari E. Hurtta <hurtta+elm@ozone.FMI.FI>
+ 
+         - Decoding of MIME is not done when searching content of mail
+ 
+         - RFC 1522: Mime part 2 support is incomplete
+ 
+         - There is not support for multipart/signed and multipart/encrypted
+           (specially: no support for PGP/MIME)
+ 
+         > But anyway, Elm will newer be MIME Conformant
+ 
+         - HP's shoftkeys are no longer supported
+ 
+         - DECNET addresses like host::user may be interpreted as phrase
+           of group syntax or as route of source routed address.
+ 
+ Collector of these patches
+ --------------------------
+ 
+         Kari E. Hurtta <hurtta+elm@ozone.FMI.FI>
Index: elm2.4.ME+.50/ANNOUNCE.ME
*** /tmp/8255-very-long-file-name-NULL-comes-in-here	Sun Nov 22 09:14:43 1998
--- elm2.4.ME+.50/ANNOUNCE.ME	Tue Nov 17 21:12:53 1998
***************
*** 0 ****
--- 1,287 ----
+ 
+ This ANNOUNCE.ME is for ME patches of the 2.4 version.
+ 
+ Look file README.ME+ for the 2.4ME+ version.
+ 
+ --------------------------------------------------------------------
+ 
+ ELM 2.4 PL24 ME8
+ 
+ This is an announcement for Patchlevel ME8 for Elm 2.4pl24.
+ 
+ The most current version of this document is available via the web:
+ http://www.cs.hmc.edu/~me/elm/announce.html. You can also visit the "ME" home
+ page at http://www.cs.hmc.edu/~me/elm/me.html.
+ NOTE THAT THIS ADDRESS HAS CHANGED FROM THE PREVIOUS ANNOUNCEMENT!
+ 
+ What's new:
+ 
+    * Anonymous remailer support (plus chaining, PGP encryption & MIME support)
+    * mime.types file when guessing the content-type of an attachment.
+    * Forwarded messages can be attached as MESSAGE/RFC822 data
+    * Supports extraction of PGP public keys directly
+    * Support for application/pgp type inside multipart/mixed and message/rfc822
+      messages
+ 
+ Changes from ME7a:
+ 
+    * Replying to MULTIPART messages now works correctly.
+    * MESSAGE/RFC822 is now properly supported.
+    * BINARY encoding is better supported.
+    * Fixed bugs with BASE64 and QUOTED-PRINTABLE encodings.
+    * Enhanced attachment menu
+    * Improved interface for PGP encrypting messages
+ 
+ Where to get it:
+ 
+    * ftp://cs.hmc.edu/pub/me/elm-2.4pl24me8.tar.Z
+    * ftp://cs.hmc.edu/pub/me/elm-2.4pl24me8.tar.gz
+    * ftp://cs.hmc.edu/pub/me/elm-2.4pl24me8.diffs.Z
+    * ftp://cs.hmc.edu/pub/me/elm-2.4pl24me7a-8.diffs.Z
+ 
+ -OR-
+ 
+    * ftp://uiarchive.cso.uiuc.edu/pub/packages/mail/elm/me/elm-2.4pl24me8.tar.Z
+    * ftp://uiarchive.cso.uiuc.edu/pub/packages/mail/elm/me/elm-2.4pl24me8.tar.gz
+    * ftp://uiarchive.cso.uiuc.edu/pub/packages/mail/elm/me/elm-2.4pl24me8.diffs.Z
+    * ftp://uiarchive.cso.uiuc.edu/pub/packages/mail/elm/me/elm-2.4pl24me7a-8.diffs.Z
+ 
+ -------------------------------------------------------------------------------
+ 
+ STATUS
+ 
+ These patches are not an official release of Elm, and are not supported by the
+ Elm Development Group. Features included in this patch may or may not be
+ included in the next official release of Elm. I can say for certain that the
+ PGP portion will not. I am hoping that my MIME patches will be included in the
+ 2.5 release, but that is still an open question. Should the 2.5 release appear
+ without these patches, I plan on "porting" them and using 2.5 as the base.
+ -------------------------------------------------------------------------------
+ And now on to the interesting stuff...
+ 
+ PGP SUPPORT
+ 
+ [This work was inspired by pgpelm which was started by Mic the Missing and
+ furthur developed by Ken Cox (kenc@viewlogic.com). This version is a complete
+ rewrite of that system but looks very similar.]
+ 
+ Features include: mark on folder menu showing PGP encrypted messages and public
+ key blocks, encryption/signing of outgoing messages, decrypting/signature
+ check, mailing public key blocks, and extracting public key blocks from
+ messages. Special feature allows you to have ELM keep track of your PGP
+ passphrase so you only need to enter it a minimal number of times.
+ 
+ I have written a primer for using PGP with this version of ELM which can be
+ found at http://www.cs.hmc.edu/~me/elm/pgp.html. It contains everything you
+ need to know about how to use PGP with ELM.
+ 
+ MIME SUPPORT
+ 
+ With this version of Elm, the need for metamail is much less since it can now
+ handle the MIME encodings and multipart/* messages internally. The only case in
+ which metamail is called is when there is a content-type which Elm does not
+ understand (eg. image/*, audio/*). In most cases you will probably only receive
+ this as attachments anyway, so you might still not require metamail.
+ 
+    * Incoming Attachments
+ 
+      Access to individual portions of a MIME mulitpart message can be accessed
+      via the "Attachments" menu (type 'v' in the index menu). This brings up a
+      menu listing the attachments for the current message. You then have the
+      option of viewing or saving the attachment.
+ 
+    * Outgoing Attachments
+ 
+      In addition to using the "[include ..." construct when editing your
+      message, there is now an "Attachments" menu accesible from the "Send" menu
+      (it is abbreviated to "a)tt" because of space problems). Simply type "a"
+      to get into the Attachments menu. You may then add/delete/edit/modify
+      attachments. When possible, Elm will attempt to guess the correct
+      Content-Type (based on file extension, see the "mime.types" section below)
+      and Content-Transfer-Encoding.
+ 
+    * Automatic encoding for outgoing messages.
+ 
+      If Elm finds 8bit or control characters in text files to be attached, it
+      will automatically encode them QUOTED-PRINTABLE if Elm has been compiled
+      without the 8BITMIME option (meaning that your MTA isn't 8bit clean). This
+      behavior can be overriden with the "noencoding" elmrc option (see below)
+      in cases where your sendmail is 8bit clean, but doesn't support the
+      -B8BITMIME option.
+ 
+    * mime.types file
+ 
+      Elm now mime.types file which maps filename extensions to Content-Type
+      field when sending attachments via the new attachment menu. The format of
+      these files is as follows:
+ 
+      <extension> <content-type>
+ 
+      A hash character ('#') may be used as a comment, but it must be in the
+      first column of a line.
+ 
+      Here is an example of mime.types file:
+ 
+      # This is a commented line
+      html    text/html
+      tgz     application/octet-stream; type=tar; conversions="x-gzip"
+ 
+      Note that the content-type field is not limited to just the type/subtype
+      part; in can also include suplementary information.
+ 
+      Elm first looks to see if the user has a ~/.elm/mime.types file. If there
+      is no match, Elm will then try to read the system types file (typically
+      /usr/local/lib/elm.mimetypes). Failing that, Elm has a few builtin types
+      that it understands.
+ 
+      You might want to pick up a copy of my mime.types file as a starting point
+      for either your personal or system file at
+      http://www.cs.hmc.edu/~me/elm/mime.types.
+ 
+ REMAILER SUPPORT
+ 
+ This version of Elm has the ability to prepare messages for use with anonymous
+ remailers (if you don't know what that is, read alt.privacy.anon-server for
+ more information).
+ 
+ Elm gets its information about anonymous servers by either fingering
+ "remailer-list@kiwi.cs.berkeley.edu" or by reading ~/.elm/remailers (if this
+ file exists, it overrides the "finger" so you can still use this feature even
+ if you are not directly net connected.)
+ 
+ To send an anonymous message, first compose your message as you normally would,
+ entering the name of the person who should ultimately receive the message as
+ the To: address. Then, at the "send" menu, you can type "r" to get into the
+ "remailer" menu.
+ 
+ There are several options in this menu: remail, chain, path and encrypt.
+ The "remail" option indicates whether or not the current message will be
+ remailed.
+ 
+ "chain" indicates how many servers this message should be sent through (the
+ higher chain is, the more secure, but the tradeoff is how long until the
+ receiver gets the message).
+ 
+ "path" is where you can specify which servers you would like this message to go
+ through (this overrides "chain"). You can specify a semi-colon (";") separated
+ list of server "nicknames" here.
+ 
+ "encrypt" means that Elm should encrypt your messages with the PGP public key
+ of server you are remailing through (note that if chain > 1 or there is more
+ that one server in "path", Elm will do the "right" thing and call PGP multiple
+ times for each hop).
+ 
+ Once the desired options are set, you can quit the menu and send the message.
+ What you see next will vary... If you are a PGP user and set encrypt=TRUE in
+ the remailer menu, you will see the call(s) to pgp flash across your screen.
+ Otherwise you will most likely just see the "Mail sent." message.
+ 
+ If you have MIME defined, it should be possible for you to include attachments
+ in your anonymous mail in the normal manner. Most servers these days support
+ the "hash" option which Elm makes use of to pass the proper MIME headers.
+ 
+ NEW ELMRC OPTIONS
+ 
+    * usepgppass = [ ON | OFF ]
+      Default: usepgppass = OFF
+         o OFF: Elm does not keep your passphrase in memory. You must enter it
+           each time you want to decrypt a pgp mail.
+         o ON: Elm keep your passphrase in memory for "keeppassfor" seconds.
+    * keeppassfor = <number>
+      Default: keeppassfor = 0
+         o keeppassfor>=0: Elm will keep your passphrase in memory for seconds
+           after entering the passphrase.
+         o keeppassfor<0: Elm will keep your passphrase in memory without
+           clearing it from memory.
+    * noencoding = <level>
+      Default: noencoding = 0
+ 
+      This control makes it possible to send raw 8bit or binary data when the
+      MTA doesn't support 8BITMIME and the -B8BITMIME option or BINARYMIME and
+      the -BBINARYMIME option.
+ 
+      Possible values:
+         o  0 : Always convert 8BIT and BINARY data to QUOTED-PRINTABLE if the
+           MTA doesn't support the -B8BITMIME and -BBINARYMIME options.
+         o  1 : Allow 8bit without -B8BITMIME, but binary data is encoded
+         o  2+: Allow binary without -BBINARYMIME and and 8bit without
+           -B8BITMIME
+      It is STRONGLY recommended that it be left set to 0 unless you know what
+      you are doing!!
+    * showto = [ ON | OFF ]
+      Default: showto = OFF
+         o ON: Elm should show you who the message is addressed to rather than
+           who it is from if the message is not addressed to you.
+         o OFF: normal behavior
+    * pagemultipart = [ ON | OFF ]
+      Default: pagemultipart = ON
+         o ON: Use the internal MIME support to display MULTIPART messages
+           rather than calling metamail
+         o OFF: display MULTIPART messages with metamail
+    * mimeforward = [ ON | OFF ]
+      Default: mimeforward = OFF
+         o ON: When forwarding a message, Elm will attach as a MIME body part of
+           type MESSAGE/RFC822.
+         o OFF: Elm will include the forwarded message in your message, just
+           like it always has.
+ 
+ BUILTIN++ PAGER
+ 
+ This pager looks a lot like more, but has some of the movement features of
+ less, most notably, paging backwards through your messages. Press '?' inside of
+ the pager for a list of valid keystroke commands.
+ 
+ TAGS
+ 
+ Use the keyword "tagged" in the "Delete messages with pattern" (invoked by ^D
+ in the index menu) to delete all tagged messages.
+ 
+ You can now use the keyword "all" to tag all visible messages.
+ 
+ LIMIT FUNCTIONALITY
+ 
+    * Simple compound statements can be made using '|' (OR) and '&' (AND).
+    * The "Cc:" field is now availible for search.
+    * New keyword "tagged" for narrowing to only the currently tagged messages.
+ 
+ MISCELLANEOUS
+ 
+ '*' may be used as a wildcard in the "alternatives" list in the elmrc file. For
+ instance, "me@*.hmc.edu" would me to match the user "me" in all hosts from the
+ "hmc.edu" domain.
+ 
+ Elm will keep track of the messages which you have replied to with an 'r' mark
+ in the index menu.
+ 
+ Forwarded messages are encapsulated instead of quoted like replies:
+ 
+         ----- Forwarded message from Joe User  -----
+         [...]
+         ----- End of forwarded message from Joe User  -----
+ 
+ You can effect an automatic Bcc: line by setting the address(es) in the "BCC"
+ environment variable. Note that this is non-standard, but provided as a means
+ of accomplishing the task.
+ 
+ BUGS
+ 
+ A list of known bugs can be found at
+ http://www.cs.hmc.edu/~elkins/elm/bugs.html.
+ 
+ AUTHOR
+ 
+ Michael Elkins <elkins@aero.org>
+ Home Page: http://www.cs.hmc.edu/~me/index.html
+ 
+ If you are interested in knowing what my future plans are, you can browse my
+ "TO DO" list at http://www.cs.hmc.edu/~me/elm/todo.html
+ 
+ THANKS
+ 
+ Kari Hurrta <Kari.Hurtta@fmi.fi> has contributed a great deal to the MIME
+ support (and fixed lots of my stupid bugs ;-)
+ 
+ I would also like to thank everyone who took the time to report bugs or suggest
+ improvements!
+ -------------------------------------------------------------------------------
+ Last updated Sept 21, 1995.
Index: elm2.4.ME+.50/ChangeLog.ME
*** /tmp/8255-very-long-file-name-NULL-comes-in-here	Sun Nov 22 09:14:43 1998
--- elm2.4.ME+.50/ChangeLog.ME	Tue Nov 17 21:12:53 1998
***************
*** 0 ****
--- 1,812 ----
+ 
+ This ChangeLog.ME is for ME patches of the 2.4 version.
+ 
+ Look file README.ME+ for changes of the 2.4ME+ version.
+ 
+ -------------------------------------------------------------------------
+ 
+ -----------------
+ Changes from ME8a
+ -----------------
+ When checking to see if the subject line should be centered when displaying
+ a mail message, the weedlist check should be for "subject:", not "subject".
+ This case is more general.
+ 
+ control-F in the main menu now causes Elm to forget your passphrase.  Useful
+ for when you screw up so you don't have to exit Elm before using PGP
+ again.
+ 
+ Added a "metoo" argument in pgp_encrypt to decide whether or not the
+ +encrypttoself=on flag should be passed to pgp.  This was needed so that
+ the value of auto_cc can be overidden when remailing.
+ 
+ Added support for decoding of RFC1522 style encoded headers.  This should
+ work in the index menu, the pager, and when replying (the "attribution").
+ 
+ metapager will now recover if pgp fails by displaying the message "as is"
+ in the case where the message is only signed.
+ 
+ Simplified "pager" check in metapager since there are two pagers now.
+ 
+ Fixed problem in copy_message where the rfc822 newline at the end of the
+ headers was missing.
+ 
+ Fixed bug in menu2.c:generic_menu (used by the remailer) which caused
+ Elm to segfault when not compiled with gcc.
+ From: Andrey A. Chernov <ache@astral.msk.su>
+ 
+ Fixed problem where trailing MMDF separator was still being printed.
+ 
+ The default filename for the Content-Disposition header was not getting
+ set if the included file did not have an extension.
+ 
+ text/plain => application/pgp conversion is now NOT done for public key
+ blocks.
+ 
+ Configure now figures out where "finger" is instead of hardcoding a path
+ in remailer.c
+ 
+ Hopefully fixed definition for sleep() in defs.h.
+ 
+ Fixed bug where elm would segfault when typing ^E when there are no messages
+ in the mailbox.
+ 
+ Fixed bug where a leading space could be inserted before the real name when
+ looking up a PGP public key from the return address.
+ 
+ Fixed some of the movement commands in builtin++ so that they work now.
+ 
+ Convert application/x-pgp-* => application/pgp to decode messages generated
+ by pgpelm.
+ 
+ Fixed problem where if the signature was added after editing the message,
+ it would be written over the message right after the content length.  Fixed
+ by seeking to the end of the file after writing the content length field.
+ 
+ ----------------
+ Changes from ME8
+ ----------------
+ Fixed bug in conversion of text/plain => application/pgp in newmbox.c which
+ was causing Elm to segfault. (Thanks to Kari.Hurtta@fmi.fi)
+ 
+ Fixed bug where builtin++ segfaults when viewing zero length messages.
+ 
+ -----------------------
+ Changes from ME8alpha19
+ -----------------------
+ Fixed bug where external pager did not work with non-MIME messages when
+ USE_PGP is defined.
+ 
+ Cleaned up mime_pgp_decode so that it does not need to look at the
+ header_rec for the current message any longer.
+ 
+ Do text/plain => application/pgp conversion in newmbox.c if PGP type data
+ is discovered in the message.  This supports those who are sending PGP
+ messages but are not compliant with what Elm expects.
+ 
+ Added the control-E (extract public key) command to showmsg_c.c.
+ 
+ Security fix from Olaf Kirch <okir@monad.swb.de> which forces Elm to write
+ the temp spool mailbox in the user's home directory instead of /tmp.  This
+ prevents exploitation of symlinks to create a .rhosts in the user's 
+ directory.
+ 
+ Fixed bug in show_status where flags from the previous message were not
+ being properly cleared with USE_PGP was defined and MIME was not.
+ 
+ -----------------------
+ Changes from ME8alpha18
+ -----------------------
+ added application_decode for support of APPLICATION/* types.  Calls
+ null_decode if the subtype is unknown.
+ 
+ rfc822_decode now matches the headers against the weedlist when printing
+ out.  You can view all the headers for a message by pressing 'h' while
+ viewing a message just as you normally would.
+ 
+ added mime_pgp_decode for inline decoding of application/pgp parts.
+ application/pgp at the top level is still handled by metapager since some
+ people will be configured without MIME.  I might eventually require that
+ to use PGP, you must also define MIME, but not yet!
+ 
+ Status header was printed in the wrong place with BINARY encoding.
+ From: Kari.Hurtta@fmi.fi
+ 
+ Added the DONT_ADD_FROM and NEEDS_LONE_PERIOD_ESCAPE checks to write_encoded,
+ and other MIME text parts.
+ From: Kari.Hurtta@fmi.fi
+ 
+ Added a "type_opts" field in mime_send_t.
+ 
+ mime_write_header now just writes the MIME headers.  The code to add the
+ boundary for multipart messages and the charset for text/plain was moved into
+ mailmsg2.c.
+ 
+ Changed pgp code to set MIME fields to use add_parameter and type_opts instead
+ of directly writing to subtype.
+ 
+ Made some changes in the Content-Type for PGP messages to be more compliant
+ with the unofficial standard.
+ 
+ -----------------------
+ Changes from ME8alpha17
+ -----------------------
+ MIME header code in write_header_info() was moved to 
+ mime_write_header in mime_encode.c.  This was done to greatly simplify the
+ code, and to make it possible for me to send MIME messages with the
+ remailer code.  This will also make it possible for me to have PGP
+ encrypted MIME messages in the future.
+ 
+ Content-Length headers are generated regardless of whether or not MIME
+ is defined.
+ 
+ Lots of changes to the remailer code to make it work with MIME.
+ 
+ -----------------------
+ Changes from ME8alpha16
+ -----------------------
+ Removed Content-Length header from attachments included by the "[include ...]"
+ statement.
+ 
+ Made the existing global variables that set the toplevel Content-Length header
+ a part of mime_send_t.  This has the side effect that if MIME is not
+ defined, no Content-Length header will be added on outgoing messages.
+ 
+ Commented out the code which reads the content-length header from attachments
+ in mime_parse.c.  It should now ignore that header and figure out the length
+ in multipart_parse().
+ 
+ -----------------------
+ Changes from ME8alpha15
+ -----------------------
+ New option "mimeforward" controls whether or not forwarded messages are
+ sent as MESSAGE/RFC822 MIME messages, or are sent in the old non-MIME
+ way.
+ 
+ - Fixes for my mistakes in alpha15.
+ - text_unsupported_decode() added for printing warning message about
+ unsupported text subtypes.
+ From: Kari.Hurtta@fmi.fi
+ 
+ Changed disposition handing such that a message saying that the user should
+ type 'v' to view an attachment which is declared something other than
+ "inline".
+ 
+ -----------------------
+ Changes from ME8alpha14
+ -----------------------
+ Make sure that arguments to fseek(), etc., are type long.
+ From: Kari.Hurtta@fmi.fi
+ 
+ Added some general access commands for attachments in the attach_menu.c
+ routines.
+ From: Kari.Hurtta@fmi.fi
+ 
+ The disposition is now displayed in the little mini-header.  This looks nicer
+ than the previous message about "[Content-Disposition: attachment, skipping]".
+ 
+ select_CT_decoder now returns text_decode for all TEXT types.  My reasoning
+ here is that since the MIME spec says that all unknown subtypes of TEXT
+ should be treated as TEXT/PLAIN so long as the charset is understood, then
+ all TEXT can be treated in this manner.
+ 
+ Made sure that the pgp field of header_rec gets set to zero when initializing
+ in attach_viewer and also in newmbox.c.
+ 
+ Removed lots of unused variables.
+ 
+ Added some parentheses in places to make "gcc -Wparentheses" happy.
+ 
+ -----------------------
+ Changes from ME8alpha13
+ -----------------------
+ Forgot to initialize usepass=FALSE in pgp_decrypt_init.  This caused elm
+ to hang when trying to decode a signed message while pgp was waiting for
+ the passphrase...
+ 
+ The attachment menu should now work properly for viewing message/rfc822
+ messages with the builtin pager.
+ 
+ When attaching a message/rfc822 with the "forward" command, you should
+ now be able to perform all the actions in attach_menu() as for a "normal"
+ attachment.
+ 
+ -----------------------
+ Changes from ME8alpha12
+ -----------------------
+ Tried to fix MIME_NOTPLAIN code again.  This time MESSAGE/RFC822 will not
+ have it set, which MULTIPART will if pagemultipart=OFF.
+ 
+ Fixed attach_menu so that Elm does not segfault when you try to do an
+ operation on an attachment when there are no attachments defined.
+ 
+ Removed the MIME_NOTPLAIN flag and made it a one-bit flag in mime_t instead.
+ Removed PGP flags from defs.h and use a 3-bit field in header_rec instead.
+ These two now ensure that the "status" field of header_rec is always less
+ than 65536 so that 16bit integer machines will not have troubles.
+ 
+ Elm now pays attention to what the MIME-Version header says and passes any
+ messages with an unknown MIME-Version header value to metamail, or displays
+ an error if $NOMETAMAIL is set.
+ From: Kari.Hurtta@fmi.fi
+ 
+ -----------------------
+ Changes from ME8alpha11
+ -----------------------
+ pgp_call() now uses the expanded_* address lists so that aliases are 
+ expanded before trying to look up the ids with PGP.
+ 
+ Fixed calls in mailmsg2.c with wrong number of arguments (botched job
+ including Kari Hurtta's patch).
+ From: Kari.Hurtta@fmi.fi
+ 
+ Reordered the preMIME code in newmbox.c to make it a little more efficient.
+ 
+ Fixed bug in write_header_info() where a spurious newline was being printed
+ after the Content-Type header for TEXT.  This was causing the remaining 
+ fields not to be a part of the message header.
+ 
+ Removed check for old-style RFCXXX Mime-Version header.  I don't believe
+ anybody uses that anymore since RFC1341 has been out so long.
+ 
+ pgp_status needed to be reset when the user aborts sending a message,
+ otherwise you can't encrypt another message until you successfully send
+ another message.
+ 
+ MIME_NOTPLAIN is not set for multipart messages if "pagemultipart" is TRUE.
+ 
+ Cleaned up code for deciding if metamail mail should be called to display
+ a message in showmsg.c.  Created a need routine, need_meta(), for this
+ purpose.
+ 
+ -----------------------
+ Changes from ME8alpha10
+ -----------------------
+ Fixes to remove some global MIME variables used for composing.
+ From: Kari.Hurtta@fmi.fi
+ 
+ Added a redraw command to the attachment menu.
+ 
+ Fixed the code in newmbox.c where MIME_NOTPLAIN was not set for non-TEXT
+ content-types.  Also, check for "plain" should be "text" for old-style
+ pre-MIME content-type headers.
+ 
+ Added a print command to the attachment menu.
+ 
+ Made the remailer support a Configure option.
+ 
+ ----------------------
+ Changes from ME8alpha9
+ ----------------------
+ Use Elm's error routines in the attachment menu. 
+ Protected iscntrl() more calling isascii() before it in builtin++.
+ From: Kari Hurtta <Kari.Hurtta@fmi.fi>
+ 
+ Added bit of code lost from old showmsg.c which centers the subject line 
+ after the title line in the case where "subject" is in the weedlist.
+ 
+ Viewing attachments with metamail while in send mode now works.  It required
+ different arguments to be passed to metamail.
+ 
+ -----------------------
+ Changes from ME8alpha8a
+ -----------------------
+ mime_t_clear() now sets the defaults of TEXT/PLAIN, ENCODING_7BIT, DISP_INLINE,
+ when called.
+ 
+ More fixes from Kari Hurtta <kari.hurtta@fmi.fi>
+ 
+ Removed padding bitfield from struct mimeinfo since it isn't needed.
+ 
+ Added +clearsig=ON when adding a PGP signature to a message.
+ 
+ Added prototypes for the functions defined in pgp.c.
+ 
+ Elm will now allow you to edit the list of usernames to encrypt to when
+ using PGP.  This fixes the problem where sometimes the return address
+ doesn't match the address on the key.  However, it still requires that
+ the user know this.
+ 
+ Implemented Kari Hurtta's suggestion of using a "state" variable for the
+ MIME output when decoding messages.  This will make it easier to add new
+ extensions for output.  The state information is defined in hdrs/state.h
+ 
+ The user interface for the attachment menu now is more consistent with
+ the mailbox menu.  (Kari.Hurtta@fmi.fi)
+ 
+ User is now asked for confirmation upon deleting an attachment from the
+ attachment menu if "ask=ON" in the elmrc.
+ 
+ Fixed replying to messages with PGP signatures.  They were getting sucked
+ into the new MIME code and getting skipped as an unknown type.
+ 
+ Added new procedure to allow for extraction of PGP public keys directly
+ instead of relying on metamail.
+ 
+ If Elm can't find a PGP key that it is looking for, it now tells the user
+ which key instead of just that there was an error.
+ 
+ The user is now allowed to re-edit the filename in attach_modify() if the
+ file was not found.  This also allows a user to change the file associated
+ with an attachment.
+ 
+ Fixed very old bug of MMDF separators being printed when displaying a
+ message.
+ 
+ ----------------------
+ Changes from ME8alpha8
+ ----------------------
+ Fixed problem where you couldn't edit the default filename in attach_save().
+ 
+ ----------------------
+ Changes from ME8alpha7
+ ----------------------
+ Use safe_malloc() and safe_realloc() instead. (Kari Hurtta)
+ 
+ Fixed bug where no EOLN token was printed after the Content-Type header
+ when type_opts was NULL in attach_generate_message().
+ 
+ Reorganized struct mimeinfo so that bitfields are next to each other and
+ added padding to make them 1 byte long total.
+ 
+ -----------------------
+ Changes from ME8alpha6+
+ -----------------------
+ Reduced memory usage in "struct mimeinfo" by using bitfields or pointers
+ instead of predefined strings when possible.  Also removed the "comments"
+ fields.
+ 
+ New routine lib/strmcpy.c for doing malloc/realloc and strcpy in one shot.
+ Helps out with the above objective.
+ 
+ The attachment menu now defaults to disposition "inline" when sending
+ mail.
+ 
+ Reorganized the screen in the attachment "configuration" menu.
+ 
+ Removed code for adding "name=" field to APPLICATION/OCTET-STREAM types.
+ Uses Kari's code for Content-Disposition "filename" instead.  attach_menu()
+ still supports both for getting default filename when saving an
+ attachment.
+ 
+ Removed MIME_MULTIPART flag.  Use MIME_TYPE_MULTIPART with "type" instead.
+ 
+ Removed "encoding" field from "header_rec".  Use "encoding" in "mimeinfo"
+ instead (this was already mostly true, but there were a few cases left
+ over from the early support for encoding...)
+ 
+ ----------------------
+ Changes from ME8alpha6
+ ----------------------
+ Incorporated changes from Kari Hurtta <Kari.Hurtta@FMI.FI>.
+ Big changes are the use of Content-Disposition and routines to better parse
+ rfc822 headers.  Also fixed multi-line MIME header problem in newmbox.c
+ 
+ ----------------------
+ Changes from ME8alpha5
+ ----------------------
+ Fixed places where "/tmp" was hardcoded for temporary files instead of using
+ "temp_dir" in the ME extensions.
+ 
+ Fixed more isspace() problems with "signed char".
+ 
+ Made some formatting improvements in multipart_decode().
+ 
+ Fixed bug where multi-line Content-Type headers were not properly parsed in
+ newmbox.c.
+ 
+ Added builtin++2.c which contains a tempfile based pager which may become
+ part of the "official" distribution.  For right now it is "experimental".
+ 
+ ----------------------
+ Changes from ME8alpha4
+ ----------------------
+ Fixed attach_modify() to use ->type and ->subtype like the rest of the
+ attachment routines.
+ 
+ Viewing an attachment while sending didn't work because it read from
+ mailfile...  Now it can view external files as well.
+ 
+ Fixed problem with signed char and iscntrl() in AddLineToCache().
+ This fixes the problem with umlaut characters in some sets.
+ From: guy@netapp.com.
+ 
+ Modified mime_generate_boundary() to use mime_count as a counter so that
+ subsequent calls will generate different values.
+ 
+ Elm will now read ~/.elm/mime.types and $libdir/elm.mimetypes (system
+ mime.types file), if they exist, to map filename extensions to
+ Content-Type values when sending attachments.  The format of this file
+ is:
+ 	<suffix> <content-type>
+ There must be no line breaks in the Content-Type field.
+ Example:
+ 	tar	application/octet-stream; type=tar
+ for .tar files.
+ NOTE: data which is declared "application/octet-stream" will automatically
+       get the option "name=<default_filename>" added to it, so there is no
+       need to put it in the definition.
+ 
+ Modified attach_info() so that it uses BASE64 encoding for "application"
+ types that have 8bit or control chars in them.
+ Also, "image" automatically defaults to BASE64 without reading the file.
+ 
+ attach_save() now uses the "name=<default_filename>" field of "application"
+ types as the default filename.
+ 
+ Added '+' as a synonym for NEXT_PAGE in builtin++ per popular request.
+ 
+ attach_generate_msg() no longer puts Content-Length headers on parts that
+ it generates.
+ 
+ ----------------------
+ Changes from ME8alpha3
+ ----------------------
+ Added support for multi-line Content-Type: headers in read_headers() and
+ mime_read_headers().
+ 
+ me.h now contains prototypes for functions defined by this set of patches.
+ 
+ Fixed some problems with using PGP and remailers.
+ 
+ Fixed parsing of options in the Content-Type header so that semicolons
+ inside quotes are protected.
+ 
+ If MIME is defined, forwarded messages will be an attachment of type
+ MESSAGE/RFC822.
+ 
+ Fixed problem with viewing MULTIPART or MESSAGE/RFC822 attachments from
+ the attachment menu.
+ 
+ Replaced MIME_BOUNDARY with a function (mime_generate_boundary()) that
+ sets the global variable "mime_boundary" to generate unique multipart
+ boundaries.  This is important now that Elm will be sending out
+ MESSAGE/RFC822 data which Elm might have originally generated...
+ 
+ ----------------------
+ Changes from ME8alpha2
+ ----------------------
+ Added a second line for menu items in verify_transmission() since adding
+ the "r)emailer" option didn't fit on the first line.
+ 
+ Modified the PGP code a little for more flexibility.  You can now specify
+ a string of "ids" to encrypt with in pgp_call().
+ 
+ ---------------------
+ Changes from ME8alpha
+ ---------------------
+ The menus from attach.c and attach_send.c were combined into a single
+ menu in attach_menu.c which servers both purposes.  The difference is
+ whether or not the user is allowed to modify the given attachments.
+ 
+ The rest of attach_send.c was renamed as mime_encode.c.
+ 
+ -----------------
+ Changes from ME7a
+ -----------------
+ 
+ Added a check in quoted_printable_decode() to make sure that the index
+ into outbuf[] does not run off the end and cause problems.
+ 
+ attach_edit() didn't return TRUE after editing in one spot, which causes
+ problems on some platforms, namely Solaris.
+ From: Martin Walter <mawa@ruf.uni-freiburg.de>
+ 
+ base64_decode() was broken because it would fread() a data chunk, and 
+ wasn't always a multiple of 4 bytes, causing the decoding to break.
+ 
+ Changed char => unsigned char in most places in *_encode() to fix problems
+ with ISO characters >127.
+ 
+ Added message about PGP support for the 'elm -v' command in args.c.
+ 
+ Support for anonymous remailers. [ALPHA]
+ 
+ Major rewrite of the MIME handling code.  MULTIPART and MESSAGE/RFC822
+ messages are parsed the first time they are accessed (eg. viewed/replied)
+ and then are ready to use without parsing after that.  See mime_parse.c
+ and mime_decode.c for details.
+ 
+ From: Kari Hurtta <Kari.Hurtta@fmi.fi>
+   Put a loop around verify_transmission() so that Elm will no longer just
+   be lame when an error occurs in [include ...] statements.  (Way cool! -Ed)
+ 
+   Don't allow user read or writes files as attachmentds which he don't heve 
+   access. Notice that elm is (usually) setgid mail.
+ 
+   Consider if MTA supports 8BITMIME also when encoding attachments.
+ 
+   Now mail is encoded with quoted-printable if it includes control characters.
+   8BITMIME doesn't help in this case.
+ 
+   Attachments are checked for 8bit characters, then content-transfer-encoding
+   7bit is not allowed.
+ 
+   If any of subpart (also attachments) have content-tarnsfer-encoding 8bit
+   or binary it propagates to content-transfer-encoding of top multipart -type.
+ 
+   Now taken note of MIME's canonical encoding model:
+   - End of line in text -subtypes when they have encoded with BASE64
+     must be encoded as CR LF.
+   - Also CR and LF must be encoded in quoted-printable-encoding if
+     type have binary data (ie. not line oriented).
+   - Done mapping CR LF -> LF when decoding text -subtypes.
+ 
+   These content-transfer-encoding checks for attachments are also done
+   for [include ...] keywords when sending.
+ 
+   Now [include ...] also don't need metamail's help (they use same routines
+   than attachments menu).
+ 
+   Added configuration file option 'noencoding' (see elmrc-info for details
+   on what this does).
+ 
+ ----------------
+ Changes from ME7
+ ----------------
+ 
+ Forgot to kill the newline from the PGP output before putting it in to the
+ builtin++ pager.  This resulted in messages being displayed double-spaced.
+ Ick!
+ 
+ ----------------
+ Changes from ME6
+ ----------------
+ 
+ attach_send.c needs <sys/stat.h> on some machines.
+ 
+ Fixed initialization of arrays in attach_send.c because CC isn't quite
+ ANSI compliant.  You can only initialize static arrays.
+ From: Guy Harris <guy@netapp.com>
+ 
+ Added support for sendmail 8.7 which has support for 8BIT content 
+ encoding.  Uses the -B8BITMIME option.
+ From: Kari Hurtta <hurtta@dionysos.fmi.fi>
+ 
+ Fixed problem where QUOTED-PRINTABLE messages were not decoded when
+ replying if USE_PGP was not defined.
+ From: Kari Hurtta <hurtta@dionysos.fmi.fi>
+ 
+ [keyword ...] constructs are no longer broken when using MIME and the
+ message is to be encoded QUOTED-PRINTABLE.
+ From: Kari Hurtta <hurtta@dionysos.fmi.fi>
+ 
+ Made the QUOTED-PRINTABLE encoding routine more compliant with the
+ standard.
+ From: Kari Hurtta <hurtta@dionysos.fmi.fi>
+ 
+ Added patch to mark messages NEW in all folders (not just the SPOOL)
+ if there is no status: line.
+ NOTE: This will probably go away when 2.5 is released.  Instead, they
+ will use some sort of "magic" flag to accomplish the same thing.
+ 
+ Added check to make sure that we don't run off the end of outbuf[] in
+ base64_decode() in mime.c.
+ From: Kurt.Jaeger@rus.uni-stuttgart.de
+ 
+ Fixed type casting problem with BSD 4.4 derivatives in mime.c.
+ From: Andrey A. Chernov <ache@astral.msk.su>
+ 
+ KOI8-R added as a valid compat charset.
+ From: Andrey A. Chernov <ache@astral.msk.su>
+ 
+ builtin++ now wraps the line at the number of columns on the screen, not
+ one character before.  NewLine() apparently "does the right thing" and
+ doesn't print an extra line if the last character is in the last column.
+ From: Kari Hurtta <Kari.Hurtta@fmi.fi>
+ 
+ The arrow keys now do what they did before instead of controlling the
+ bultin++ pager.
+ 
+ builtin++ always clears the screen before displaying the next (or
+ previous) page.
+ 
+ The length of a line in the cache for builtin++ is increased to 150
+ chars because the old value of 128 didn't work with hpterms with a 
+ width of 134 chars.
+ 
+ Fixed problem where Elm would SIGBUS if you tried to use the
+ attachments menu in an empty folder.
+ From: Kari Hurtta <Kari.Hurtta@fmi.fi>
+ 
+ buf[STRING] was too short in AttachmentMenu() and caused certain Elm to
+ bomb out on certain messages which had header lines which were too
+ long.
+ 
+ AddLineToCache() can now handle multiline input.  This meant that
+ calls to it from metapager had to remove the trailing newlines.
+ 
+ Changed the MIME mini-header format in metapager().
+ 
+ attach_edit() looks more like header_edit() now.  Makes the interface
+ more consistent.
+ 
+ lib/getrealname.c needed <ctype.h> on older BSD systems.
+ 
+ Fixed nasty bug where the blank line in between the headers and the body
+ of a NEW message would get deleted when resync'ing in the spool folder.
+ 
+ Fixed infinite loop in Configure when run with the -d option.
+ 
+ ----------------
+ Changes from ME5
+ ----------------
+ 
+ Added the DoAll() call so that the keyword "all" can be used when tagging
+ or deleting.
+ 
+ Decoupled PGP and MIME support such that you don't need MIME to use PGP.
+ 
+ Added lots of error checking code in metapager.c.
+ From: guy@netapp.com (Guy Harris).
+ 
+ Fixed bug in quoted_printable_decode() where I did not convert read
+ characters to base16.
+ 
+ Added hex() function to protect index_hex from bad values.
+ 
+ metapager() prompts for a command if necessary after running the external
+ pager, just as Elm used to do.
+ 
+ Fixed the From: line in write_header_info() where I broke it before.
+ 
+ Fixed bug where the MIME multipart boundary would be written after the
+ MMDF separator when copy=ON and the message was being copied to the user's
+ desired folder.
+ 
+ Added an "Attachments" menu in verify_transmission() for including 
+ attachments.  This works in addition to the current method of using
+ "[include ..."
+ 
+ Elm now directly supports writing of BASE64 and QUOTED-PRINTABLE
+ encodings.
+ 
+ Changed the return value of match_address() to be zero, since it
+ returns an int, and NULL is not always an int.
+ From: Michael Shields <shields@tembel.org>
+ 
+ AttachViewer() now uses notplain() to determine whether or not
+ metamail is needed to view the message.
+ From: Guy Harris <guy@netapp.com>
+ 
+ needs_mmdecode() now takes the integer version of the encoding rather
+ than a string.  This avoids parsing the string twice.
+ From: Guy Harris <guy@netapp.com>
+ 
+ Elm now checks outgoing messages to see if there are any non-printable
+ characters, and if so encodes the message QUOTED-PRINTABLE.
+ 
+ Cleaned up PGP code by moving more code to pgp.c so that other files
+ require less modification (ie. the diffs will be simpler).
+ 
+ Fixed showmsg.c so that it passes anything that doesn't require metamail
+ to the metapager.  This fixed the problem where messages with no
+ Mime-Version header but had a Content-Type header wouldn't get displayed.
+ From: Guy Harris <guy@netapp.com>
+ 
+ Fixed bug in dispaddr.c so that if a message is from the user, it will
+ always use the TO address to display.
+ 
+ Moved get_real_name() to its own file in lib so it can be used by
+ dispaddr.c.
+ 
+ Modified get_real_name() so that if it sees an address like
+ "<elkins@aero.org>" it will return "elkins@aero.org" instead of a zero
+ length string.
+ 
+ ----------------
+ Changes from ME4
+ ----------------
+ 
+ Introduced the "metapager".  It replaces most of the code in showmsg.c.
+ It also takes care of all the MIME and PGP functions the bultin++ pager
+ used to perform, so that the user doesn't have to use builtin++ in those
+ cases.
+ 
+ PGP decrypting function was rewritten using pipes so no temp files are
+ required!
+ 
+ The attachment handling code was modified to handle multiline content-type
+ headers generate by such mailers as zmailer.  It also looks through each
+ modifier in the line intead of just assuming that the boundary field will
+ be the first.
+ From: guy@netapp.com (Guy Harris)
+ 
+ The "command" status line in the builtin++ pager now floats around instead
+ of always being on the bottom.  This was done to facilitate the ^L in
+ the pager so it didn't look stupid.
+ 
+ Moved the MIME QUOTED-PRINTABLE and BASE64 decoding code to mime.c so it
+ can be shared.
+ 
+ Fixed copy_message() so that it will automatically decode MIME B64 and QP
+ encodings.  This means that replies to these types of messages do what the
+ user will expect.
+ 
+ ----------------
+ Changes from ME3
+ ----------------
+ 
+ Fixed problems in builtin++.c and pgp.c where I used the return value
+ from sprintf() as a char* when in SYSV systems it returns an int. 
+ This caused Elm to seg fault while decrypting messages.
+ 
+ Configure now asks about PGP support and automatically sets up
+ config.h.  Thanks to Ken Cox (kenc@viewlogic.com) for additional help.
+ 
+ PGP messages are now automatically decrypted when replying if
+ usepgppass = ON.
+ 
+ Back to using the application/pgp format content-type.  Use
+ format=keys-only for send a public key block.
+ 
+ PGPCall() now uses the pgp option +encrypttoself=on instead of tacking
+ the username on the end of the TO list.
+ 
+ Fixed problem where any messages after sending a PGP public key had
+ the key text included before the included message text.
+ 
+ Use rename() if availible instead of copying the file in PGPCall(). 
+ Otherwise use link(), unlink().  This should be a little more
+ efficient.
+ 
+ pgp is now called with the -w (wipe) option when encrypting.
+ 
+ builtin++ can now handle text which is QUOTED-PRINTABLE or BASE64
+ encoded.
+ 
+ Fixed bug where the last line of messages was not being printed.
+ 
+ Elm will no longer seg fault if you hit return without entering your
+ PGP passphrase.
+ 
+ Discovered the +batchmode option for pgp.  This makes dealing with
+ incorrect passphrases much easier!
+ 
+ Fixed bug in builtin++ where the last line of pgp messages would be
+ printed more than once while at the end of the message under certain
+ circumstances.
+ 
+ Changed notplain() in mime.c to support message/* content-type.
+ 
+ Cleaned up the multipart handling by removing the boundary string from
+ header_rec to conserve memory.  This is now handled by builtin++ and
+ AttachMenu().
+ 
+ builtin++ can now handle multipart/digest correctly.
+ 
+ SaveAttach() no longer needs to call metamail to decode QUOTED-PRINTABLE
+ or BASE64 encodings.
+ 
+ -----------------
+ Changes from ME2a
+ -----------------
+ 
+ Elm will now keep track of your PGP passphrase for your RSA secret key.
+ To use this feature, add the line "usepgppass = ON" to your .elmrc.
+ There is also a timeout feature which will cause Elm to "forget" your
+ passphrase after so many seconds if you don't use it.  The default is
+ 300 seconds, but this can be changes by setting the variable
+ "keeppassfor" in your .elmrc.
+ 
+ The builtin++ pager was completely rewritten (again) so that it can now
+ handle normal messages, MIME multipart messages, automatic decryption
+ and automatic signature checking for PGP messages.  It also seems to be
+ lacking some of the memory allocation bugs that the previous pager had.
+ 
+ Fixed a bug in DynamicArray() which causes DestroyDynamicArray() to
+ seg fault if exactly max+n elements were allocated. (weo@recco.de)
+ 
+ ----------------
+ Changes from ME2
+ ----------------
+ 
+ It is now possible to delete all "tagged" messages by entering "tagged"
+ as the pattern to match after typing <control>-d (^D).
+ 
+ fixed a bug in the limit command where you could not "un"limit the
+ display of headers.  Thanks to guy@netapp.com (Guy Harris) for
+ pointing it out!
+ 
+ fixed a bug in is_multipart() where the "boundary" token match was
+ case-sensitive.
Index: elm2.4.ME+.50/Changes
*** elm2.4.25/Changes	Sun Dec 20 07:19:11 1992
--- elm2.4.ME+.50/Changes	Tue Nov 17 21:12:53 1998
***************
*** 1,3 ****
--- 1,9 ----
+ 
+ This Changes is for the 2.4 version.
+ 
+ Look file README.ME+ for changes of the 2.4ME+ version.
+ 
+ --------------------------------------------------------------------------
  This file describes major changes made to the Elm source distribution
  between Releases 2.3 and 2.4.  Please remember that Elm is a volunteer
  project, we did what we had time for, and perhaps, what interested us.
Index: elm2.4.ME+.50/Configure
*** elm2.4.25/Configure	Mon May 30 19:55:55 1994
--- elm2.4.ME+.50/Configure	Tue Nov 17 21:14:08 1998
***************
*** 8,21 ****
  # and edit it to reflect your system.  Some packages may include samples
  # of config.h for certain machines, so you might look for one of those.)
  #
! # $Header: /home/syd/elm.rel/RCS/Configure,v 5.38 1994/05/30 16:55:46 syd Exp $
  #
- # Yes, you may rip this off to use in other distribution packages.
- # (Note: this Configure script was generated automatically.  Rather than
- # working with this copy of Configure, you may wish to get metaconfig.)
  
  : sanity checks
! PATH=".:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin:$PATH"
  export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
  
  if test ! -t 0; then
--- 8,18 ----
  # and edit it to reflect your system.  Some packages may include samples
  # of config.h for certain machines, so you might look for one of those.)
  #
! # $Header: /data/cvsroot/mail/elmme+/Configure,v 1.10 1998/11/17 18:55:48 hurtta Exp $
  #
  
  : sanity checks
! PATH="$PATH:.:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin"
  export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
  
  if test ! -t 0; then
***************
*** 34,43 ****
      cd UU
  fi
  
! case "$1" in
! -d) shift; fastread='yes';;
  esac
  
  Log=''
  Header=''
  bin=''
--- 31,70 ----
      cd UU
  fi
  
! fastread=''
! extractsh=''
! 
! while test $# -gt 0; do
! 	case "$1" in
! 		-d) shift; fastread='yes';;
! 		-S) shift; extractsh=true;;
! 		-h) shift; error=true;;
! 		-*) echo "Configure: unknown option $1" >&2; shift; error=true;;
! 		*) break;;
! 	esac
! done
! 
! case "$error" in
! true)
!     cat >&2 << EOM
! Usage: Configure [-dS]
!   -d : use defaults for all answers.
!   -h : print this help message and exit (with an error status).
!   -S : perform variable substitutions on all .SH files
! EOM
!     exit 1
!     ;;
! esac
! 
! case "$extractsh" in
! true)
!     cd ..
!     . ConfTool/Substitute
!     exit 0
!     ;;
  esac
  
+ 
  Log=''
  Header=''
  bin=''
***************
*** 46,55 ****
  cppminus=''
  d_getopt=''
  d_memcpy=''
- d_mkdir=''
  d_rename=''
  d_symlink=''
  d_whoami=''
  n=''
  c=''
  orderlib=''
--- 73,84 ----
  cppminus=''
  d_getopt=''
  d_memcpy=''
  d_rename=''
  d_symlink=''
  d_whoami=''
+ d_poll=''
+ d_inttypes=''
+ d_nointtypes=''
  n=''
  c=''
  orderlib=''
***************
*** 56,66 ****
  ranlib=''
  package=''
  pager=''
- prefshell=''
  startsh=''
- d_eunice=''
  define=''
- eunicefix=''
  loclist=''
  expr=''
  sed=''
--- 85,92 ----
***************
*** 71,77 ****
  cp=''
  tail=''
  tr=''
- mkdir=''
  sort=''
  uniq=''
  grep=''
--- 97,102 ----
***************
*** 138,144 ****
  d_flock=''
  d_dotlock=''
  d_fcntlock=''
- lock_dir=''
  has_flock=''
  has_fcntl=''
  d_ftruncate=''
--- 163,168 ----
***************
*** 160,166 ****
  d_mallocvoid=''
  d_mboxedit=''
  d_mime=''
! defencoding=''
  defcharset=''
  defdispcharset=''
  d_mmdf=''
--- 184,194 ----
  d_mallocvoid=''
  d_mboxedit=''
  d_mime=''
! metamail_path=''
! metamail=''
! d_8bitmime=''
! d_binarymime=''
! d_dsn=''
  defcharset=''
  defdispcharset=''
  d_mmdf=''
***************
*** 190,195 ****
--- 218,224 ----
  d_strftime=''
  d_strings=''
  d_pwdinsys=''
+ d_waitpid=''
  strings=''
  includepath=''
  d_strstr=''
***************
*** 200,206 ****
  tempnamc=''
  d_termio=''
  d_termios=''
- d_useembed=''
  d_utimbuf=''
  d_vfork=''
  defbatsub=''
--- 229,234 ----
***************
*** 211,217 ****
  mydomain=''
  autohostname=''
  i_memory=''
- i_stdarg=''
  i_stdlib=''
  i_time=''
  i_systime=''
--- 239,244 ----
***************
*** 248,258 ****
  ldflags=''
  cc=''
  libs=''
  nametype=''
  d_passnames=''
  d_berknames=''
  d_usgnames=''
! passcat=''
  rmttape=''
  roff=''
  roffopts=''
--- 275,286 ----
  ldflags=''
  cc=''
  libs=''
+ noaddlib=''
  nametype=''
  d_passnames=''
  d_berknames=''
  d_usgnames=''
! # passcat=''
  rmttape=''
  roff=''
  roffopts=''
***************
*** 267,272 ****
--- 295,306 ----
  xenlf=''
  d_xenix=''
  d_bsd=''
+ d_pgp=''
+ pgp=''
+ pgp_path=''
+ d_remailer=''
+ finger=''
+ finger_path=''
  CONFIG=''
  : set package name
  package=elm2
***************
*** 273,279 ****
  
  echo " "
  echo "Beginning of configuration questions for $package kit."
- : Eunice requires " " instead of "", can you believe it
  echo " "
  
  define='define'
--- 307,312 ----
***************
*** 285,299 ****
  rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
  trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
  
- : We must find out about Eunice early
- eunicefix=':'
- if test -f /etc/unixtovms; then
-     eunicefix=/etc/unixtovms
- fi
- if test -f /etc/unixtovms.exe; then
-     eunicefix=/etc/unixtovms.exe
- fi
- 
  : Now test for existence of everything in MANIFEST
  
  echo "First let's make sure your kit is complete.  Checking..."
--- 318,323 ----
***************
*** 339,345 ****
      echo "Found bin directory"
  fi
  
! libswanted="intl nls"
  attrlist="$attrlist sgi"
  
  : some greps do not return status, grrr.
--- 363,370 ----
      echo "Found bin directory"
  fi
  
! # libswanted="intl nls"
! libswanted="sun intl nls c_s"
  attrlist="$attrlist sgi"
  
  : some greps do not return status, grrr.
***************
*** 374,380 ****
      echo "Okay, let's see if #! works on this system..."
      e=/bin/echo; test -f $e || e=/usr/bin/echo
      echo "#!$e hi" > try
-     $eunicefix try
      chmod +x try
      ./try > today
      if $contains hi today >/dev/null 2>&1; then
--- 399,404 ----
***************
*** 382,388 ****
  	sharpbang='#!'
      else
  	echo "#! $e hi" > try
- 	$eunicefix try
  	chmod +x try
  	./try > today
  	if test -s today; then
--- 406,411 ----
***************
*** 398,404 ****
      shsharp=false
      echo "exec grep -v '^#'" >spitshell
      chmod +x spitshell
-     $eunicefix spitshell
      spitshell=`pwd`/spitshell
      echo "I presume that if # doesn't work, #! won't work either!"
      sharpbang=': use '
--- 421,426 ----
***************
*** 416,422 ****
  EOSS
  
  chmod +x try
- $eunicefix try
  if ./try; then
      echo "Yup, it does."
  else
--- 438,443 ----
***************
*** 553,562 ****
  	if test -f \$dir/\$thing; then
  	    echo \$dir/\$thing
  	    exit 0
- 	elif test -f \$dir/\$thing.exe; then
- 	    : on Eunice apparently
- 	    echo \$dir/\$thing
- 	    exit 0
  	fi
  	;;
      esac
--- 574,579 ----
***************
*** 565,571 ****
  exit 1
  EOSC
  chmod +x loc
- $eunicefix loc
  loclist="
  cat
  chgrp
--- 582,587 ----
***************
*** 591,596 ****
--- 607,613 ----
  date
  emacs
  execmail
+ finger
  ispell
  line
  lint
***************
*** 597,607 ****
--- 614,626 ----
  lp
  lpr
  mailx
+ metamail
  mips
  more
  nroff
  pack
  pg
+ pgp
  pmake
  pr
  rmail
***************
*** 705,711 ****
  
  : see if date exists, if so, init c_date
  if $test ! "x$date" = "x" ; then
!     c_date=`LANGUAGE= $date`
  else
      c_date='date was unavailable at configuration'
  fi
--- 724,730 ----
  
  : see if date exists, if so, init c_date
  if $test ! "x$date" = "x" ; then
!     c_date=`LANG= LC_TIME= $date`
  else
      c_date='date was unavailable at configuration'
  fi
***************
*** 814,819 ****
--- 833,844 ----
  	echo exit 1 >bsd
  	echo exit 0 >usg
  	echo exit 1 >v7
+     elif $test "$uname_os" = "IRIX" ; then
+     : test `echo abc | tr a-z A-Z` = Abc does not work in IRIX 6.2
+ 	echo "Looks like an IRIX system, but we'll see.."
+ 	echo exit 1 >bsd
+ 	echo exit 0 >usg
+ 	echo exit 1 >v7
      else
  	echo "Looks kind of like a BSD system, but we'll see..."
  	echo exit 0 >bsd
***************
*** 826,847 ****
      echo exit 1 >usg
      echo exit 0 >v7
  fi
! case "$eunicefix" in
! *unixtovms*)
!     cat <<'EOI'
! There is, however, a strange, musty smell in the air that reminds me of
! something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
! EOI
!     echo "exit 0" >eunice
!     d_eunice="$define"
!     ;;
! *)
!     echo " "
!     echo "Congratulations.  You aren't running Eunice."
!     d_eunice="$undef"
!     echo "exit 1" >eunice
!     ;;
! esac
  if test -f /xenix; then
      echo "Actually, this looks more like a XENIX system..."
      echo "exit 0" >xenix
--- 851,857 ----
      echo exit 1 >usg
      echo exit 0 >v7
  fi
! 
  if test -f /xenix; then
      echo "Actually, this looks more like a XENIX system..."
      echo "exit 0" >xenix
***************
*** 851,857 ****
      echo "exit 1" >xenix
  fi
  chmod +x xenix
- $eunicefix xenix
  if test -f /venix; then
      echo "Actually, this looks more like a VENIX system..."
      echo "exit 0" >venix
--- 861,866 ----
***************
*** 864,873 ****
      fi
      echo "exit 1" >venix
  fi
! chmod +x bsd usg v7 eunice venix
! $eunicefix bsd usg v7 eunice venix
  rm -rf foo
! rmlist="$rmlist bsd usg v7 eunice venix xenix"
  
  : find out how to find out full name
  echo " "
--- 873,881 ----
      fi
      echo "exit 1" >venix
  fi
! chmod +x bsd usg v7 venix
  rm -rf foo
! rmlist="$rmlist bsd usg v7 venix xenix"
  
  : find out how to find out full name
  echo " "
***************
*** 881,886 ****
--- 889,896 ----
  	dflt=y
      elif xenix; then
  	dflt=y
+     elif $test "$uname_os" = "IRIX"; then
+         dflt=y
      else
  	dflt=n
      fi
***************
*** 934,967 ****
      ;;
  esac
  
- : see if we have to deal with yellow pages, if so, put sun
- : library first, as the yp password routines must override
- : the c library ones
- if $test -d /usr/etc/yp || $test -d /etc/yp; then
-     if $test "$passcat" = "ypcat passwd"; then
- 	dflt=y
-     elif $contains '^\+:' /etc/passwd; then
- 	dflt=y
-     else
- 	dflt=n
-     fi
-     rp="Are you getting the passwd file via yellow pages? [$dflt]"
-     $echo $n "$rp $c"
-     . myread
-     case "$ans" in
-     y*) passcat='ypcat passwd'
- 	case "$libswanted" in
- 	'') libswanted='sun c_s';;
- 	*)  libswanted=`$echo "$libswanted" | $sed -e 's/sun //g'`
- 	    libswanted="sun $libswanted";;
- 	esac
- 	;;
-     *) passcat='cat /etc/passwd';;
-     esac
- else
-     passcat='cat /etc/passwd'
- fi
- 
  : set up shell script to do ~ expansion
  cat >filexp <<EOSS
  $startsh
--- 944,949 ----
***************
*** 998,1004 ****
  esac
  EOSS
  chmod +x filexp
- $eunicefix filexp
  
  # determine text processor to use, default to troff if found.
  case "$roff" in
--- 980,985 ----
***************
*** 1646,1653 ****
  
  case "$ccflags" in
  '') case "$cc" in
!     *gcc*) dflt='-fpcc-struct-return -traditional';;
!     *) dflt='';;
      esac
      ;;
  *) dflt="$ccflags";;
--- 1627,1638 ----
  
  case "$ccflags" in
  '') case "$cc" in
!     *gcc*) dflt='-fpcc-struct-return';;
!     *) dflt=''
! 	if test "$uname_os" = "OSF1"; then
!            dflt='-std'
!         fi
!     ;;
      esac
      ;;
  *) dflt="$ccflags";;
***************
*** 1754,1795 ****
  case "$libswanted" in
  '') libswanted='c_s';;
  esac
! for thislib in $libswanted; do
!     case "$thislib" in
!     dbm) thatlib=ndbm;;
!     *_s) thatlib=NONE;;
!     *) thatlib="${thislib}_s";;
!     *) thatlib=NONE;;
!     esac
!     xxx=`loc lib$thislib.a X /usr/lib /usr/ccs/lib /usr/local/lib /lib`
!     if test -f $xxx; then
! 	echo "Found -l$thislib."
! 	case "$dflt" in
! 	*-l$thislib*|*-l$thatlib*);;
! 	*) dflt="$dflt -l$thislib";;
  	esac
!     else
! 	xxx=`loc lib$thislib.a X $libpth`
  	if test -f $xxx; then
! 	    echo "Found $xxx."
  	    case "$dflt" in
! 	    *$xxx*);;
! 	    *) dflt="$dflt $xxx";;
  	    esac
  	else
! 	    xxx=`loc Slib$thislib.a X $xlibpth`
  	    if test -f $xxx; then
! 		echo "Found -l$thislib."
  		case "$dflt" in
! 		*-l$thislib*|*-l$thatlib*);;
! 		*) dflt="$dflt -l$thislib";;
  		esac
  	    else
! 		echo "No -l$thislib."
  	    fi
  	fi
!     fi
! done
  set X $dflt
  shift
  dflt="$*"
--- 1739,1784 ----
  case "$libswanted" in
  '') libswanted='c_s';;
  esac
! if [ "$noaddlib" != yes ]; then
!     for thislib in $libswanted; do
! 	case "$thislib" in
! 	dbm) thatlib=ndbm;;
! 	*_s) thatlib=NONE;;
! 	*) thatlib="${thislib}_s";;
! 	*) thatlib=NONE;;
  	esac
! 	xxx=`loc lib$thislib.a X /usr/lib /usr/ccs/lib /usr/local/lib /lib`
  	if test -f $xxx; then
! 	    echo "Found -l$thislib."
  	    case "$dflt" in
! 	    *-l$thislib*|*-l$thatlib*);;
! 	    *) dflt="$dflt -l$thislib";;
  	    esac
  	else
! 	    xxx=`loc lib$thislib.a X $libpth`
  	    if test -f $xxx; then
! 		echo "Found $xxx."
  		case "$dflt" in
! 		*$xxx*);;
! 		*) dflt="$dflt $xxx";;
  		esac
  	    else
! 		xxx=`loc Slib$thislib.a X $xlibpth`
! 		if test -f $xxx; then
! 		    echo "Found -l$thislib."
! 		    case "$dflt" in
! 		    *-l$thislib*|*-l$thatlib*);;
! 		    *) dflt="$dflt -l$thislib";;
! 		    esac
! 		else
! 		    echo "No -l$thislib."
! 		fi
  	    fi
  	fi
!     done
! else
!     echo "You told last time that additional libraries are not needed!"
! fi
  set X $dflt
  shift
  dflt="$*"
***************
*** 1816,1822 ****
  $echo $n "$rp $c"
  . myread
  case "$ans" in
! none) ans='';
  esac
  libs="$ans"
  
--- 1805,1816 ----
  $echo $n "$rp $c"
  . myread
  case "$ans" in
! none|'') ans='';
!     noaddlib='yes';
!     ;;
! *)
!     noaddlib='no'
!     ;;
  esac
  libs="$ans"
  
***************
*** 1840,1849 ****
--- 1834,1847 ----
  case "$nm_opts" in
  '') if test -f /mach_boot; then
  	nm_opts=''
+     elif test "$uname_os" = "OSF1"; then
+  	nm_opts=''
      elif test -d /usr/ccs/lib; then
  	nm_opts='-p'
      elif "$mips"; then
  	nm_opts='-B'
+     elif test "$uname_os"="Linux"; then
+ 	nm_opts='-D -f sysv'
      else
  	nm_opts=''
      fi
***************
*** 1941,1947 ****
  set `echo $libc $libnames | tr ' ' '\012' | sort | uniq`
  $echo $n "Extracting names from $* for later perusal...$c"
  nm $nm_opts $* 2>/dev/null >libc.tmp
! $sed -n -e 's/^.* [ATDS]  *[_.]*//p' -e 's/^.* [ATDS] //p' <libc.tmp >libc.list
  if $contains '^printf$' libc.list >/dev/null 2>&1; then
      echo done
  elif $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' \
--- 1939,1958 ----
  set `echo $libc $libnames | tr ' ' '\012' | sort | uniq`
  $echo $n "Extracting names from $* for later perusal...$c"
  nm $nm_opts $* 2>/dev/null >libc.tmp
! if $test `uname` = "AIX" 
! then
!    cat libc.tmp |egrep '^\..* *T'|egrep -v '^\._|Srestf|Ssavef|^\.\$'|\
!       $sed -e 's/\.\(.* \)T.*/\1/' -e 's/ *//g' >libc.list
! 
!    if $test -f /lib/syscalls.exp; then
!       echo " "
!       echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." 
!       $sed -n 's/^\([^  ]*\)[    ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
!    fi
! else
!    $sed -n -e 's/^.* [ATDSUW]  *[_.]*//p' -e 's/^.* [ATDSUW] //p' <libc.tmp >libc.list
! fi
! 
  if $contains '^printf$' libc.list >/dev/null 2>&1; then
      echo done
  elif $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' \
***************
*** 1966,1971 ****
--- 1977,1986 ----
  	   <libc.tmp >libc.list; \
    $contains '^printf$' libc.list >/dev/null 2>&1; then
      echo done
+ elif $sed -n -e 's/^.* [ATDSUW]  *//p' -e 's/^.* [ATDSUW] //p' \
+ 	<libc.tmp >libc.list; \
+   $contains '^printf$' libc.list >/dev/null 2>&1; then
+     echo done
  else
      nm -p $* 2>/dev/null >libc.tmp
      $sed -n -e 's/^.* [AT]  *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
***************
*** 2175,2181 ****
  exit \$status
  EOSS
  chmod +x Cppsym
! $eunicefix Cppsym
  echo "Your C preprocessor defines the following symbols:"
  Cppsym -l $attrlist >Cppsym.true
  cat Cppsym.true
--- 2190,2196 ----
  exit \$status
  EOSS
  chmod +x Cppsym
! 
  echo "Your C preprocessor defines the following symbols:"
  Cppsym -l $attrlist >Cppsym.true
  cat Cppsym.true
***************
*** 2247,2256 ****
  
  $cat << EOM
  
! Some modern Mail Transport Agents (mailers) support the Content-Length: header.
! In doing so, they do not wish to have messages escaped to protect 'From ' lines
! in the body of the message, among other strings.  Does the Mail Transport Agent
! in use on this system honor the Content-Length: header?
  EOM
  
  echo " "
--- 2262,2273 ----
  
  $cat << EOM
  
! Some Local Delivery Agents (mailers) support the Content-Length: header. In 
! doing so, they do not wish to have messages escaped to protect 'From ' lines
! in the body of the message, among other strings.  Does the Local Delivery Agent
! in use on this system use the Content-Length: header when writing mails to
! (incoming) mailbox?
! 
  EOM
  
  echo " "
***************
*** 2459,2479 ****
      echo 'Dot lock style locking will be used'
  fi
  
- if $test -d /usr/spool/locks ; then
-     lock_dir=/usr/spool/locks
- elif $test -d /usr/spool/uucp ; then
-     lock_dir=/usr/spool/uucp
- elif $test -d /var/spool/locks ; then
-     lock_dir=/var/spool/locks
- elif $test -d /var/spool/uucp ; then
-     lock_dir=/var/spool/uucp
- else
-     lock_dir=/tmp
- fi
- echo " "
- echo "Non-mailbox locks will use the $lock_dir directory"
- echo " "
- 
  : now get the host name
  if $test "$autohostname" != "$undef" -o "$hostname" = "" ; then
      autohostname="$define"
--- 2476,2481 ----
***************
*** 2642,2647 ****
--- 2644,2692 ----
      d_whoami="$undef"
  fi
  
+ 
+ : see if there is a poll file
+ echo " "
+ if $test -r /usr/include/poll.h ; then
+     d_poll="$define"
+     echo "poll.h found."
+ else
+     d_poll="$undef"
+ fi
+ 
+ : see if there is a poll file
+ echo " "
+ if $test -r /usr/include/inttypes.h ; then
+     d_inttypes="$define"
+     echo "inttypes.h found."
+ 
+ 	case "$d_nointtypes" in
+ 		"$define") dflt=y;;
+ 		"$undef")  dflt=n;;
+ 		*)         dflt=n;;
+ 	esac
+ 
+     echo "In some systems (such as IRIX 5.3, but not in IRIX 6.2) "
+     echo "including of inttypes.h causes error (types defined also "
+     echo "in sys/types.h)"
+     echo " "
+     rp="Avoid including inttypes.h [$dflt]"
+     $echo $n "$rp $c"
+     . myread
+     case "$ans" in
+ 	[Yy]*)	
+ 		d_nointtypes="$define"
+ 		;;
+ 	*)
+ 		d_nointtypes="$undef"
+     esac
+ 
+ else
+     d_inttypes="$undef"
+     d_nointtypes="$undef"
+ fi
+ 
+ 
  : see how we will look up host name
  echo " "
  d_douname="$undef"
***************
*** 2909,2914 ****
--- 2954,2971 ----
  *)  d_mmdf="$undef";;
  esac
  
+ # BSD Sendmail installs itself either /usr/lib/sendmail, /usr/sbin/sendmail
+ # or /usr/ucblib/sendmail, prefer that over other locations
+ if [ -x  /usr/lib/sendmail ] ; then
+ 	sendmail=/usr/lib/sendmail
+ 	echo "BSD(?) sendmail is on $sendmail"
+ elif [ -x /usr/sbin/sendmail ] ; then
+ 	sendmail=/usr/sbin/sendmail
+ 	echo "BSD(?) sendmail is on $sendmail"
+ elif [ -x /usr/ucblib/sendmail ] ; then
+ 	sendmail=/usr/ucblib/sendmail
+ 	echo "BSD(?) sendmail is on $sendmail"
+ fi 
  : determine mail delivery agent for Elm to use
  case "$mailer" in
  '')
***************
*** 2964,2998 ****
      execmail=''
  fi
  
- : check for internet mailer
- case "$d_internet" in
- "$define")	dflt=y;;
- "$undef")	dflt=n;;
- *)	if $test -f "$sendmail"; then
- 	    dflt=y
- 	elif $test -f "$submit"; then
- 	    dflt=y
- 	elif $test -f "$smail"; then
- 	    dflt=y
- 	else
- 	    dflt=n
- 	fi
- 	;;
- esac
- $cat <<EOM
-  
- Some newer mailers can deliver mail to addresses of the INTERNET
- persuasion, such as user@host.domain.  Other older mailers require the
- complete uucp ! path to the destination to be specified in the address.
- EOM
- rp="Does your mailer understand INTERNET addresses? [$dflt]"
- $echo $n "$rp $c"
- . myread
- case "$ans" in
- y*) d_internet="$define";;
- *)  d_internet="$undef";;
- esac
- 
  : check for ispell spelling checker
  case "$d_ispell" in
  "$define")	dflt=y
--- 3021,3026 ----
***************
*** 3207,3224 ****
  case "$d_mime" in
  "$define") dflt=y;;
  "$undef")  dflt=n;;
! *)	   if $test -f "$metamail"; then
! 		$cat <<EOM
! 
! I've found the metamail program out there, I assume you want support for
! MIME (Multipurpose Internet Mail Extension, RFC 1341).
! 
! EOM
! 		dflt=y
! 	   else
! 		dflt=n
! 	   fi;;
! 
  esac
  $cat <<EOM
  
--- 3235,3241 ----
  case "$d_mime" in
  "$define") dflt=y;;
  "$undef")  dflt=n;;
! *)         dflt=y;;
  esac
  $cat <<EOM
  
***************
*** 3228,3247 ****
  doesn't necessarily need graphics capabilities on your display, but its
  useful.
  
- If you have installed Nathaniel Borenstein's metamail package for
- displaying MIME messages, elm can make use of it.  If you didn't
- have metamail installed you might want to obtain a copy of it.  The
- most recent version is on thumper.bellcore.com [128.96.41.1], or ask
- the archie servers for the nearest site.
- 
  Compiling elm even with MIME support enabled would not depend on the
! metamail package, but you would not be able to use nearly all of the
! MIME features as long as you don't have metamail installed.  Metamail
! with its companion programs (mmencode) must be installed somewhere in
! the search path, usually /usr/local/bin.
!   
! 
  
  EOM
  
  rp="Should support for MIME be compiled in? [$dflt]"
--- 3245,3257 ----
  doesn't necessarily need graphics capabilities on your display, but its
  useful.
  
  Compiling elm even with MIME support enabled would not depend on the
! Nathaniel Borenstein's metamail package, but you would not be able to 
! use nearly all of the MIME features as long as you don't have metamail 
! installed.  
  
+ You can also compile Elm with MIME support and tell that metamail should
+ not be used. This is configuration option.
  EOM
  
  rp="Should support for MIME be compiled in? [$dflt]"
***************
*** 3252,3260 ****
  *)  d_mime="$undef";;
  esac
  
- 
  case "$defcharset" in
! '') defcharset="US-ASCII";;
  *) defcharset="$defcharset";;
  esac
  
--- 3262,3269 ----
  *)  d_mime="$undef";;
  esac
  
  case "$defcharset" in
! '') defcharset="DISPLAY";;
  *) defcharset="$defcharset";;
  esac
  
***************
*** 3263,3284 ****
  *) defdispcharset="$defdispcharset";;
  esac
  
! case "$defencoding" in
! '') if $test "$defcharset" = "US-ASCII"; then
! 		defencoding="7bit"
! 	else
! 		defencoding="8bit"
! 	fi;;
! *) defencoding="$defencoding";;
! esac
  
  if $test "$d_mime" = "$define"; then
  	dflt="$defcharset"
  cat <<EOM
  
  The Default Character Set which should be used on outgoing messages.
! Most sites would use US-ASCII.
! 
  EOM
  	rp="Default Character Set for MIME Content-type text? [$dflt]"
  	$echo $n "$rp $c"
--- 3272,3364 ----
  *) defdispcharset="$defdispcharset";;
  esac
  
! if $test "$defdispcharset" = DISPLAY 
! then
! 	defdispcharset=ISO-8859-1
! fi
  
  if $test "$d_mime" = "$define"; then
+ 
+ case "$metamail_path" in
+ '') if test -f "$metamail" ; then
+ 	dflt="$metamail"
+ 	echo
+         echo "Metamail program found from $metamail"
+     else
+         dflt='none'
+     fi
+    ;;
+ *) dflt="$metamail_path"
+    ;;
+ esac
+ 
+ 
+ cat <<EOM
+ 
+ If you have installed Nathaniel Borenstein's metamail package for
+ displaying MIME messages, elm can make use of it.  If you didn't
+ have metamail installed you might want to obtain a copy of it.  The
+ most recent version is on thumper.bellcore.com [128.96.41.1], or ask
+ the archie servers for the nearest site.
+ 
+ This version (Elm 2.4ME+) does not use Metamail's companion programs 
+ (such as mmencode) directly, but metamail package supposes that
+ companion programs are installed to search path.
+   
+ What is the compile time default path for metamail?
+ Possible values include:
+ 	none		Don't call metamail
+ 	metamail	Call metamail if environment variable \$NOMETAMAIL
+ 			is not set.
+ 	/path		Call metamail via that path, if it is executable
+   
+ EOM
+ cont=true
+ while $test "$cont" ; do
+ 	rp="Default path for metamail? [$dflt]"
+ 	$echo $n "$rp $c"
+ 	. myread
+ 	case "$ans" in
+ 		none|metamail)
+ 			metamail_path="$ans"
+ 	    		cont=''
+ 		;;
+ 		/*)
+ 			if $test -f "$ans"; then
+ 		                metamail_path="$ans"	
+ 	    			cont=''
+ 			else
+ 	    			if $test "$fastread" = yes; then
+ 					dflt=y
+ 	    			else
+ 					dflt=n
+ 	    			fi
+ 	    			rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
+ 	    			$echo $n "$rp $c"
+ 				savedAns="$ans"
+ 	    			. myread
+ 	    			case "$ans" in
+ 	    				y*) 
+ 					metamail_path="$savedAns"
+ 					cont='';;
+ 	    			esac
+ 			fi
+ 		;;
+ 		*)
+ 			metamail_path="$ans"
+ 		;;
+ 	esac
+ done
+ 
  	dflt="$defcharset"
  cat <<EOM
  
  The Default Character Set which should be used on outgoing messages.
! Possible values include:
! 	DISPLAY		The character set, which your terminal supports
! 		        (asked in next question)
! 	US-ASCII	Some sites would use US-ASCII.
! 	ISO-8859-1	Most European sites would prefer ISO-8859-1
  EOM
  	rp="Default Character Set for MIME Content-type text? [$dflt]"
  	$echo $n "$rp $c"
***************
*** 3289,3298 ****
  	$cat <<EOM
  
  The Character Set which your terminals support. You could set this
! to one of the ISO-8859 charsets, even if you set the default for
! the Text Messages to US-ASCII, as the ISO-8859 charsets could display
! US-ASCII as well. For a X-Windows environment, ISO-8859-1 would be 
! a convenient value.
  
  EOM
  	rp="Default Character Set which could be displayed [$dflt]"
--- 3369,3387 ----
  	$cat <<EOM
  
  The Character Set which your terminals support. You could set this
! to one of the ISO-8859 charsets or KOI8-R charset, even if you set
! the default for the Text Messages to US-ASCII, as the ISO-8859 and
! KOI8-R charsets could display US-ASCII as well. For an X11
! environment, ISO-8859-1 would be a convenient value.
! 
! Default Display Character Set is overriden by environment variable
! \$MM_CHARSET if it is set (and \$NOMETAMAIL is not set.)
! 
! In systems which supports locales, mapping from LC_CTYPE to
! character set is used instead. In that case selection on here
! or on configuration file serves as default. Mapping is given 
! in file elm.mimecharsets on elm library directory or on file 
! .elm/mime.charsets
  
  EOM
  	rp="Default Character Set which could be displayed [$dflt]"
***************
*** 3300,3325 ****
  	. myread
  	defdispcharset="$ans"
  
! 	dflt="$defencoding"
! 	$cat <<EOM
! Default Content-Transfer-Encoding for MIME Content-type text.
! If you are using the default US-ASCII charset, you should use
! 7bit encoding. But if you are using some other national character
! set, 8bit is recommended, unless you are using a 7bit character set.
! For 8bit encoding your transport paths should be 8bit clean, which
! is not true all over the world. base64 or quoted-printable aren't
! yet supported for the default Content-Transfer-Encoding.
  
  EOM
! 	rp="Default Content-Transfer-Encoding for MIME Content-type text? [$dflt]"
! 	$echo $n "$rp $c"
! 	. myread
! 	defencoding="$ans"
  fi
  
! : see if mkdir exists
! set mkdir d_mkdir
! eval $inlibc
  
  : ask about newmail running in the background automatically
  case "$d_newauto" in
--- 3389,3631 ----
  	. myread
  	defdispcharset="$ans"
  
! case "$d_8bitmime" in
! "$define") dflt=y;;
! "$undef") dflt=n;;
! *)  
! if $test "$mailer" = "$sendmail" ; then
! 	echo "Testing if your mailer supports -B8BITMIME ..."
! 	if $mailer -B8BITMIME -bv root >/dev/null < /dev/null; then
! 		echo "Yup. Option -B8BITMIME perhaps works."
! 		echo "(Sendmail 8.6 will accept but ignore that option.)"
! 		dflt=y
! 	else
! 		echo "Seems that option -B8BITMIME does not work."
! 		dflt=n
! 	fi
! else
! 	echo "Can't figure how to test if your mailer supports -B8BITMIME ..."
! 	dflt=n
! fi
! ;;
! esac
! 
! cat <<EOM
! 
! If your MTA (Mail transport Agent) supports 8BITMIME ESMTP -extension
! and accepts also option -B8BITMIME (that is BODYTYPE=8BITMIME), Elm
! can left doing encoding from 8bit to quoted_printable to MTA. Otherwise
! Elm does encoding of 8bit data itself. Sendmail version 8.7 supports
! 8BITMIME -extension.
  
  EOM
! rp="MTA supports -B8BITMIME -option? [$dflt]"
! $echo $n "$rp $c"
! . myread
! case "$ans" in
! y*) d_8bitmime="$define";;
! *)  d_8bitmime="$undef";;
! esac
! 
! # If mailer don't support 8BITMIME it also don't support BINARYMIME
! case "$d_8bitmime" in
! "$define")
! 
! case "$d_binarymime" in
! "$define") dflt=y;;
! "$undef") dflt=n;;
! *)  
! if $test "$mailer" = "$sendmail" ; then
! 	echo " "
! 	echo "Testing if your mailer supports -BBINARYMIME ..."
! 	if $mailer -BBINARYMIME -bv root >/dev/null </dev/null; then
! 		echo "Yup. Option -BBINARYMIME perhaps works."
! 		echo "(Is there really MTA what supports BINARYMIME?)"
! 		dflt=y
! 	else
! 		echo "Seems that option -BBINARYMIME does not work."
! 		dflt=n
! 	fi
! else
! 	echo "Can't figure how to test if your mailer supports -BBINARYMIME ..."
! 	dflt=n
  fi
+ ;;
+ esac
  
! cat <<EOM
! 
! If your MTA (Mail transport Agent) supports BINARYMIME ESMTP -extension
! and accepts also option -BBINARYMIME (that is BODYTYPE=BINARYMIME), Elm
! can left doing encoding from BINARY to base64 or quoted-printabe to MTA. 
! Otherwise Elm does encoding of binary data itself. Passing of binary data
! requires that all text data lines are terminated with CRLF -- Unix's
! LF is NOT sufficient. Currently ELM don't use CRLF as line terminator
! in every places when using -BBINARYMIME option (so that option is only
! partially implemented by Elm). Notice also that isn't known any MTA (mailer)
! what implements BINARYMIME or accepts -BBINARYMIME option. Notice also
! that BINARYMIME is Experimental Protocol (as stated in RFC1830).
! 
! EOM
! rp="MTA supports -BBINARYMIME -option? [$dflt]"
! $echo $n "$rp $c"
! . myread
! case "$ans" in
! y*) d_binarymime="$define";;
! *)  d_binarymime="$undef";;
! esac
! 
! ;;
! *) d_binarymime="$undef";;
! esac
! 
! 
! case "$d_dsn" in
! "$define") dflt=y;;
! "$undef") dflt=n;;
! *)  
! if $test "$mailer" = "$sendmail" ; then
! 	echo " "
! 	echo "Testing if your mailer supports DSN options: -N -R -V ..."
! 	if $mailer -N success -R hdrs -V zzz -bv root  >/dev/null </dev/null
!         then
! 		echo "Yup. Options -N succees -R hdrs -V zzz perhaps works."
! 		dflt=y
! 	else
! 		echo "Seems that options -N succees -R hdrs -V zzz does not work."
! 		dflt=n
! 	fi
! else
! 	echo "Can't figure how to test if your mailer supports DSN options: -N -R -V "
! 	dflt=n
! fi
! ;;
! esac
! 
! cat <<EOF
! If your MTA (Mail transport Agent) supports DSN ESMTP -extension
! (Delivery Status Notification) and accepts also options:
! 	-N success,failure,delay/never        
! 	-R hdrs/full                              for RET= -paramater
! 	-V ...                                    for ENVID= -paramater
! Elm can use them. Sendmail 8.8 supports this (sendmail 8.7 supports
! ESMTP DSN, but it is not available via command line options).
! EOF
!     rp="MTA supports DSN via options -N -R -V ? [$dflt]"
!     $echo $n "$rp $c"
!     . myread
!     case "$ans" in
!     y*) d_dsn="$define";;
!     *)  d_dsn="$undef";;
!     esac
! else
! 
! metamail_path="none"
! d_8bitmime="$undef"
! d_binarymime="$undef"
! d_dsn="$undef"
! 
! fi
! 
! : ask about PGP support
! if $test "$d_pgp" = "$define"; then
! 	dflt=y
! 	pgp=$pgp_path
! else
! 	dflt=n
! fi
! echo ''
! rp="Should PGP (Pretty Good Privacy) support be compiled in? [$dflt]"
! echo $n "$rp $c"
! . myread
! if test "$ans" = "y"; then
! 	d_pgp="$define"
! cat <<EOM
! 
! What is the compile time default path for pgp?
! Possible values include:
! 	none		Don't call pgp
! 	/path		Call metamail via that path, if it is executable
! 
! EOM
! 	cont=true
! 	dflt="$pgp"
! 	while $test "$cont"; do
!                 rp="Where is the pgp binary located? [$dflt]"
! 		echo $n "$rp $c"
! 		. myread
! 		pgp_path="$ans"
! 		case "$ans" in
! 		none)
! 			pgp_path=none
! 			cont=''
! 			;;
! 		/*)
! 			if $test -f $ans; then
! 				cont=''
! 			else
! 				if $test "$fastread" = yes; then
! 					dflt=y
! 				else
! 					dflt=n
! 				fi
! 				rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
! 				echo $n "$rp $c"
! 				. myread
! 				case "$ans" in
! 				y*) cont='';;
! 				esac
! 			fi
! 			;;
! 		*)
! 			echo "Please give the full pathname."
! 			;;
! 		esac
! 	done
! else
! 	d_pgp="$undef"
! fi
! 
! : ask about remailer support
! if $test "$d_remailer" = "$define"; then
! 	dflt='y'
! else
! 	dflt='n'
! fi
! echo ''
! echo 'Warning: REMAILER code does not work.'
! echo ''
! rp="Should support for anonymous remailers be included? [$dflt]"
! echo $n "$rp $c"
! . myread
! if $test "$ans" = "y"; then
! 	d_remailer="$define"
! 	dflt=$finger
! 	cont=true
! 	while $test "$cont"; do
! 		rp="Where is the finger binary located? [$dflt]"
! 		echo $n "$rp $c"	
! 		. myread
! 		finger_path=$ans
! 		if $test -f $ans; then
! 			cont=''
! 		else
! 			if $test "$fastread" = yes; then
! 				dflt=y
! 			else
! 				dflt=n
! 			fi
! 			rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
! 			echo $n "$rp $c"
! 			. myread
! 			case "$ans" in
! 			y*) cont='';;
! 			esac;
! 		fi
! 	done
! else
! 	d_remailer="$undef"
! fi
  
  : ask about newmail running in the background automatically
  case "$d_newauto" in
***************
*** 3717,3722 ****
--- 4023,4035 ----
      fi
  fi
  
+ if $contains waitpid libc.list >/dev/null 2>&1; then
+     echo "waitpid() found."
+     d_waitpid="$define"
+ else
+     d_waitpid="$undef"
+ fi
+ 
  : see if strspn exists
  set strspn d_strspn
  eval $inlibc
***************
*** 3820,3856 ****
      fi
  fi
  
- : check for valid reply/to fields
- case "$d_useembed" in
- "$define")	dflt=y;;
- "$undef")	dflt=n;;
- *)	        if $test "$d_internet" = "$define" ; then
- 	            dflt=y
- 	        else
- 	            dflt=n
- 	        fi
- 	        ;;
- esac
- $cat <<EOM
-  
- One of the more annoying quirks of the UUCP network and various other
- systems that interact with it are that everyone seems to have different
- ideas about how to do routing, etc.  Therefore, a lot of times e-mail
- will arrive from off site with corrupt, unusable "Reply-To:" and "From:"
- fields.  This next question relates to whether your site is liable to
- get mangled fields or not...
- 
- Does your site receive e-mail with valid "Reply-To:" and "From:" fields?
- 
- EOM
- $echo $n "Use Reply-To: and From: addresses? [$dflt] $c"
- rp="Are Reply-to: and From: addresses reliable? [$dflt]"
- . myread
- case "$ans" in
- y*) d_useembed="$define";;
- *)  d_useembed="$undef";;
- esac
- 
  : see if getdomainname exists
  if $contains "^getdomainname\$" libc.list > /dev/null 2>&1; then
      echo "getdomainname() found"
--- 4133,4138 ----
***************
*** 4001,4007 ****
  #include <sys/types.h>
  #include <sys/stat.h>
  #define far /* to keep Xenix from complaining */
! #if (defined(BSD) || !defined(apollo))
  #  include <sys/file.h>
  #endif
  #ifdef I_TIME
--- 4283,4289 ----
  #include <sys/types.h>
  #include <sys/stat.h>
  #define far /* to keep Xenix from complaining */
! #if (defined(BSD_TYPE) || !defined(apollo))
  #  include <sys/file.h>
  #endif
  #ifdef I_TIME
***************
*** 4010,4016 ****
  #ifdef I_SYSTIME
  #  include <sys/time.h>
  #endif
! #ifdef BSD
  #  include <sys/timeb.h>
  #endif
  #ifdef I_UTIME
--- 4292,4298 ----
  #ifdef I_SYSTIME
  #  include <sys/time.h>
  #endif
! #ifdef BSD_TYPE
  #  include <sys/timeb.h>
  #endif
  #ifdef I_UTIME
***************
*** 4041,4047 ****
  		  cflags="$cflags -DI_SYSTIME"
  	      fi
  	      if $test "$d_bsd" = "$define"; then
! 		  cflags="$cflags -DBSD"
  	      fi
  	      if $cc $cflags try.c -o try >/dev/null 2>&1 ; then
  		  d_utimbuf="$define"
--- 4323,4329 ----
  		  cflags="$cflags -DI_SYSTIME"
  	      fi
  	      if $test "$d_bsd" = "$define"; then
! 		  cflags="$cflags -DBSD_TYPE"
  	      fi
  	      if $cc $cflags try.c -o try >/dev/null 2>&1 ; then
  		  d_utimbuf="$define"
***************
*** 4075,4091 ****
  	i_memory="$undef"
  fi
  
- : see if stdarg.h is in includepath
- echo " "
- i_stdarg=`loc stdarg.h "" /usr/include $includepath`
- if $test -n "$i_stdarg"; then
- 	echo "Found <stdarg.h>"
- 	i_stdarg="$define"
- else
- 	echo "Did not find <stdarg.h>"
- 	i_stdarg="$undef"
- fi
- 
  : see if unistd.h is in includepath
  echo " "
  i_unistd=`loc unistd.h "" /usr/include $includepath`
--- 4357,4362 ----
***************
*** 4100,4106 ****
  : see if signal is declared as pointer to function returning int or void
  echo " "
  $cppstdin $cppflags < /usr/include/signal.h >$$.tmp
! if $contains 'void.*[^s]signal' $$.tmp >/dev/null 2>&1 ; then
      echo "You have void (*signal())() instead of int."
      sigtype="void"
  elif $contains 'int.*[^s]signal' $$.tmp >/dev/null 2>&1 ; then
--- 4371,4380 ----
  : see if signal is declared as pointer to function returning int or void
  echo " "
  $cppstdin $cppflags < /usr/include/signal.h >$$.tmp
! if test "$uname_os" = "OSF1" ; then
!     echo "You have void (*signal())()."
!     sigtype="void"
! elif $contains 'void.*[^s]signal' $$.tmp >/dev/null 2>&1 ; then
      echo "You have void (*signal())() instead of int."
      sigtype="void"
  elif $contains 'int.*[^s]signal' $$.tmp >/dev/null 2>&1 ; then
***************
*** 4287,4292 ****
--- 4561,4635 ----
      fi
  done
  
+ if [ "$d_locale" = "$define" ] ; then
+ 	$cat <<EOM
+ 
+ Elm ME+ is ability to map locale's LC_CTYPE to MIME character set.
+ That is done via file elm.mimecharsets on elm's library directory.
+ 
+ EOM
+ 	(
+ 	cd ..
+ 	if [ -r $lib/elm.mimecharsets ] ; then
+ 		cp $lib/elm.mimecharsets bin/elm.mimecharsets
+ 	else 
+ 		cat >bin/elm.mimecharsets <<'EOM'
+ # Mapping from LC_CTYPE locale to MIME's charset values
+ # Format is:
+ #	LC_CTYPE	charset
+ # LC_CTYPE is on form
+ #	LL_cc.encoding
+ # then also following formats are available:
+ #	LL_cc		charset
+ #	LL		charset
+ #	*.encoding	charset
+ EOM
+ 	fi
+ 
+ 	values="`locale -a 2>/dev/null`"
+ 	if $test -z "$values" ; then
+ 		values="`ls /usr/lib/locale`"
+ 	fi
+ 
+ 	for lc_ctype in $values ; do
+ 		if grep "^$lc_ctype" bin/elm.mimecharsets > /dev/null; then
+ 			echo "$lc_ctype ok"
+ 		else
+ 			echo $n "Adding $lc_ctype $c"
+ 			if $test "$lc_ctype" = C -o "$defdispcharset" = "" 
+ 			then
+ 				echo "$lc_ctype US-ASCII" >> bin/elm.mimecharsets
+ 				echo "(as US-ASCII)"
+ 			elif grep "^$lc_ctype" doc/mime.charsets >> bin/elm.mimecharsets
+ 			then
+ 			    echo "   (from doc/mime.charsets)"
+ 			else
+ 				echo "$lc_ctype $defdispcharset" >> bin/elm.mimecharsets
+ 				echo "(as $defdispcharset)"
+ 			fi
+ 		fi
+ 	done
+ 
+ 	if $test -f /usr/lib/locale/locale.alias ; then
+ 	        echo "# /usr/lib/locale/locale.alias gives:" >> bin/elm.mimecharsets
+ 		sed 's/^/#/g' < /usr/lib/locale/locale.alias >> bin/elm.mimecharsets
+ 		echo "Copying /usr/lib/locale/locale.alias to elm.mimecharsets as comment"
+ 	fi
+ 
+ 	
+ 	echo 
+ 	echo "Resulting elm.mimecharsets is following:"
+ 	echo
+ 	cat bin/elm.mimecharsets
+ 	echo
+ 
+ 	rp="If you need to edit bin/elm.mimecharsets, do it as a shell escape here:"
+ 	$echo $n "$rp $c"
+ 	. UU/myread
+ 	$echo
+ 	)
+ fi
+ 
  : ask the preferred line printer and options for this system.
  case "$linepr" in
  '')
***************
*** 4348,4354 ****
  
  : ask the preferred pager for this system.
  case "$pager" in
! '') dflt="builtin+";;
  *)  dflt="$pager";;
  esac
  
--- 4691,4697 ----
  
  : ask the preferred pager for this system.
  case "$pager" in
! '') dflt="builtin++";;
  *)  dflt="$pager";;
  esac
  
***************
*** 4367,4372 ****
--- 4710,4718 ----
      builtin+)
          cont=''
  	;;
+     builtin++)
+         cont=''
+         ;;
      /*)
  	if $test -f "$ans"; then
  	    cont=''
***************
*** 4390,4434 ****
      esac
  done
  
- : find out which shell people like to use most
- case "$prefshell" in
- '')
-     if $test -f /bin/ksh; then
- 	dflt='/bin/ksh'
-     elif $test -f /bin/csh; then
- 	dflt='/bin/csh'
-     else
- 	dflt='/bin/sh'
-     fi
-     ;;
- *)  dflt="$prefshell";;
- esac
- cont=true
- while $test "$cont" ; do
-     echo " "
-     echo "Give the full path name of the shell most people like to use on your"
-     $echo $n "system: [$dflt] $c"
-     rp="Preferred shell: [$dflt]"
-     . myread
-     prefshell=$ans
-     if test -f $ans; then
- 	cont=''
-     else
- 	if $test "$fastread" = yes; then
- 	    dflt=y
- 	else
- 	    dflt=n
- 	fi
- 	rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
- 	$echo $n "$rp $c"
- 	. myread
- 	dflt=''
- 	case "$ans" in
- 	y*) cont='';;
- 	esac
-     fi
- done
- 
  : see if ar generates random libraries by itself
  echo " "
  echo "Checking how to generate random libraries on your machine..."
--- 4736,4741 ----
***************
*** 4476,4481 ****
--- 4783,4791 ----
      if $test "$ans" = x; then
          ans=`loc Slibtermlib.a x $libpth`
      fi
+     if $test "$ans" = x; then
+         ans=`loc libtermlib.so x $libpth`
+     fi
      case "$ans" in
      /usr/lib*|/usr/ccs/lib*|/lib*)
  	termlib='-ltermlib'
***************
*** 4492,4497 ****
--- 4802,4810 ----
  	if $test "$ans" = x; then
  	    ans=`loc Slibcurses.a x $libpth`
  	fi
+ 	if $test "$ans" = x; then
+ 	    ans=`loc libcurses.so x $libpth`
+ 	fi
  	case "$ans" in
  	/*)
  	    ar t $ans >grimble
***************
*** 4626,4631 ****
--- 4939,4960 ----
  #$i_systime I_SYSTIME
  #include <stdio.h>
  #include <sys/types.h>
+ 
+ 
+ #ifdef I_TIME
+ #  include <time.h>
+ #endif
+ #ifdef I_SYSTIME
+ #  include <sys/time.h>
+ #endif
+ 
+ #ifndef	_POSIX_SOURCE
+ extern struct tm *localtime();
+ extern time_t	  time();
+ #endif
+ EOF
+ cat >elmlib.h <<EOF
+ extern char *get_tz_name();
  EOF
  $echo " "
  dflt_handling=$tzname_handling
***************
*** 4647,4653 ****
  	$echo "Trying -DTZNAME_USE_$tzname_handling"
  	$cc -D_CONFIGURE -DTZNAME_USE_$tzname_handling $ccflags \
  		try.c -o try >/dev/null 2>&1
! 	if $test $? -eq 0 && ./try >try.out 2>&1 ; then
  		$echo "Alright!  That seems to have worked."
  		break
  	fi
--- 4976,4983 ----
  	$echo "Trying -DTZNAME_USE_$tzname_handling"
  	$cc -D_CONFIGURE -DTZNAME_USE_$tzname_handling $ccflags \
  		try.c -o try >/dev/null 2>&1
! 	if $test $? -eq 0 && ./try >try.out 2>&1 
!         then
  		$echo "Alright!  That seems to have worked."
  		break
  	fi
***************
*** 4663,4669 ****
  	$echo "You will have to set \"tzname_handling\" manually."
      fi
  fi
! $rm -f defs.h try.c try.o try try.out
  
  
  : the "config.over" file can be used to patch configuration changes
--- 4993,4999 ----
  	$echo "You will have to set \"tzname_handling\" manually."
      fi
  fi
! $rm -f defs.h elmlib.h try.c try.o try try.out
  
  
  : the "config.over" file can be used to patch configuration changes
***************
*** 4714,4723 ****
  cppminus='$cppminus'
  d_getopt='$d_getopt'
  d_memcpy='$d_memcpy'
- d_mkdir='$d_mkdir'
  d_rename='$d_rename'
  d_symlink='$d_symlink'
  d_whoami='$d_whoami'
  n='$n'
  c='$c'
  orderlib='$orderlib'
--- 5044,5055 ----
  cppminus='$cppminus'
  d_getopt='$d_getopt'
  d_memcpy='$d_memcpy'
  d_rename='$d_rename'
  d_symlink='$d_symlink'
  d_whoami='$d_whoami'
+ d_poll='$d_poll'
+ d_inttypes='$d_inttypes'
+ d_nointtypes='$d_nointtypes'
  n='$n'
  c='$c'
  orderlib='$orderlib'
***************
*** 4724,4734 ****
  ranlib='$ranlib'
  package='$package'
  pager='$pager'
- prefshell='$prefshell'
  startsh='$startsh'
- d_eunice='$d_eunice'
  define='$define'
- eunicefix='$eunicefix'
  loclist='$loclist'
  expr='$expr'
  sed='$sed'
--- 5056,5063 ----
***************
*** 4739,4745 ****
  cp='$cp'
  tail='$tail'
  tr='$tr'
- mkdir='$mkdir'
  sort='$sort'
  uniq='$uniq'
  grep='$grep'
--- 5068,5073 ----
***************
*** 4789,4794 ****
--- 5117,5123 ----
  compress='$compress'
  execmail='$execmail'
  libswanted='$libswanted'
+ noaddlib='$noaddlib'
  c_date='$c_date'
  d_ascii='$d_ascii'
  d_broke_ctype='$d_broke_ctype'
***************
*** 4806,4812 ****
  d_flock='$d_flock'
  d_dotlock='$d_dotlock'
  d_fcntlock='$d_fcntlock'
- lock_dir='$lock_dir'
  has_flock='$has_flock'
  has_fcntl='$has_fcntl'
  d_ftruncate='$d_ftruncate'
--- 5135,5140 ----
***************
*** 4828,4834 ****
--- 5156,5166 ----
  d_mallocvoid='$d_mallocvoid'
  d_mboxedit='$d_mboxedit'
  d_mime='$d_mime'
+ metamail_path='$metamail_path'
  defencoding='$defencoding'
+ d_8bitmime='$d_8bitmime'
+ d_binarymime='$d_binarymime'
+ d_dsn='$d_dsn'
  defcharset='$defcharset'
  defdispcharset='$defdispcharset'
  d_mmdf='$d_mmdf'
***************
*** 4850,4855 ****
--- 5182,5188 ----
  d_sighold='$d_sighold'
  d_sigprocmask='$d_sigprocmask'
  d_sigblock='$d_sigblock'
+ d_waitpid='$d_waitpid'
  d_sigaction='$d_sigaction'
  d_strcspn='$d_strcspn'
  d_strspn='$d_strspn'
***************
*** 4868,4874 ****
  tempnamc='$tempnamc'
  d_termio='$d_termio'
  d_termios='$d_termios'
- d_useembed='$d_useembed'
  d_utimbuf='$d_utimbuf'
  d_vfork='$d_vfork'
  defbatsub='$defbatsub'
--- 5201,5206 ----
***************
*** 4920,4926 ****
  d_passnames='$d_passnames'
  d_berknames='$d_berknames'
  d_usgnames='$d_usgnames'
! passcat='$passcat'
  rmttape='$rmttape'
  roff='$roff'
  roffopts='$roffopts'
--- 5252,5258 ----
  d_passnames='$d_passnames'
  d_berknames='$d_berknames'
  d_usgnames='$d_usgnames'
! # passcat='$passcat'
  rmttape='$rmttape'
  roff='$roff'
  roffopts='$roffopts'
***************
*** 4935,4940 ****
--- 5267,5278 ----
  xenlf='$xenlf'
  d_xenix='$d_xenix'
  d_bsd='$d_bsd'
+ d_pgp='$d_pgp'
+ pgp='$pgp'
+ pgp_path='$pgp_path'
+ d_remailer='$d_remailer'
+ finger='$finger'
+ finger_path='$finger_path'
  CONFIG=true
  EOT
  
***************
*** 4953,5014 ****
      eval $ans;;
  esac
  : if this fails, just run all the .SH files by hand
! . ./config.sh
! 
! echo " "
! echo "Doing variable substitutions on .SH files..."
! set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
! shift
! case $# in
! 0) set x *.SH; shift;;
! esac
! if test ! -f $1; then
!     shift
! fi
! for file in $*; do
!     case "$file" in
!     */*)
! 	dir=`$expr X$file : 'X\(.*\)/'`
! 	file=`$expr X$file : 'X.*/\(.*\)'`
! 	(cd $dir && . $file)
! 	;;
!     *)
! 	. $file
! 	;;
!     esac
! done
! if test -f config.h.SH; then
!     if test ! -f config.h; then
! 	: oops, they left it out of MANIFEST, probably, so do it anyway.
! 	. config.h.SH
!     fi
! fi
! 
! if $contains '^depend:' Makefile >/dev/null 2>&1; then
!     dflt=n
!     $cat <<EOM
! 
! Now you need to generate make dependencies by running "make depend".
! You might prefer to run it in background: "make depend > makedepend.out &"
! It can take a while, so you might not want to run it right now.
! 
! EOM
!     rp="Run make depend now? [$dflt]"
!     $echo $n "$rp $c"
!     . UU/myread
!     case "$ans" in
!     y*) make depend && echo "Now you must run a make."
! 	;;
!     *)  echo "You must run 'make depend' then 'make'."
! 	;;
!     esac
! elif test -f Makefile; then
!     echo " "
!     echo "Now you must run a make."
! else
!     echo "Done."
! fi
! 
  $rm -f kit*isdone
  : the following is currently useless
  cd UU && $rm -f $rmlist
--- 5291,5297 ----
      eval $ans;;
  esac
  : if this fails, just run all the .SH files by hand
! . ConfTool/Substitute
  $rm -f kit*isdone
  : the following is currently useless
  cd UU && $rm -f $rmlist
Index: elm2.4.ME+.50/Instruct
*** elm2.4.25/Instruct	Thu Mar 10 19:20:28 1994
--- elm2.4.ME+.50/Instruct	Tue Nov 17 21:12:53 1998
***************
*** 1,7 ****
  				Instructions
  				------------
  
! 		        Last Update: $Date: 1994/03/10 17:20:23 $
  
  
  	This file contains instructions on how to create and install
--- 1,7 ----
  				Instructions
  				------------
  
! 		        Last Update: $Date: 1998/10/15 15:36:38 $
  
  
  	This file contains instructions on how to create and install
Index: elm2.4.ME+.50/MANIFEST
*** elm2.4.25/MANIFEST	Thu Mar 10 19:14:46 1994
--- elm2.4.ME+.50/MANIFEST	Tue Nov 17 21:14:08 1998
***************
*** 1,7 ****
--- 1,11 ----
+ README.ME+
+ ANNOUNCE.ME
+ ChangeLog.ME
  Changes
  Configure
  Instruct
  MANIFEST
+ ConfTool/Substitute
  Makefile.SH
  NOTICE
  Overview
***************
*** 31,36 ****
--- 35,42 ----
  doc/frm.1
  doc/listalias.1
  doc/messages.1
+ doc/mime.types
+ doc/mime.charsets
  doc/newalias.1
  doc/newmail.1
  doc/printmail.1
***************
*** 55,64 ****
  hdrs/headers.h
  hdrs/mcprt.h
  hdrs/mcprtlib.h
  hdrs/mime.h
  hdrs/msgcat.h
  hdrs/ndbz.h
! hdrs/nl_types.h
  hdrs/patchlevel.h
  hdrs/regexp.h
  hdrs/s_aliases.h
--- 61,73 ----
  hdrs/headers.h
  hdrs/mcprt.h
  hdrs/mcprtlib.h
+ hdrs/me.h
+ hdrs/menu.h
+ hdrs/menu2.h
  hdrs/mime.h
  hdrs/msgcat.h
  hdrs/ndbz.h
! hdrs/elm_nl_types.h
  hdrs/patchlevel.h
  hdrs/regexp.h
  hdrs/s_aliases.h
***************
*** 84,89 ****
--- 93,100 ----
  lib/can_open.c
  lib/chloc.c
  lib/date_util.c
+ lib/dispaddr.c
+ lib/dynarray.c
  lib/errno.c
  lib/expand.c
  lib/figadrssee.c
***************
*** 124,133 ****
--- 135,146 ----
  lib/strftime.c
  lib/strincmp.c
  lib/striparens.c
+ lib/strmcpy.c
  lib/strstr.c
  lib/strtokq.c
  lib/tail_of.c
  lib/validname.c
+ lib/safeopen.c
  nls/C/C/C/s_aliases.m
  nls/C/C/C/s_answer.m
  nls/C/C/C/s_elm.m
***************
*** 159,166 ****
  src/alias.c
  src/aliaslib.c
  src/args.c
! src/bouncebk.c
! src/builtin.c
  src/calendar.c
  src/curses.c
  src/date.c
--- 172,179 ----
  src/alias.c
  src/aliaslib.c
  src/args.c
! src/attach_menu.c
! src/builtin++.c
  src/calendar.c
  src/curses.c
  src/date.c
***************
*** 185,200 ****
  src/lock.c
  src/mailmsg1.c
  src/mailmsg2.c
  src/mime.c
  src/mkhdrs.c
  src/newmbox.c
  src/options.c
  src/out_utils.c
  src/pattern.c
! src/pmalloc.c
  src/quit.c
  src/read_rc.c
  src/remail.c
  src/reply.c
  src/returnadd.c
  src/save_opts.c
--- 198,218 ----
  src/lock.c
  src/mailmsg1.c
  src/mailmsg2.c
+ src/menu.c
+ src/menu2.c
+ src/metapager.c
  src/mime.c
+ src/mime_encode.c
  src/mkhdrs.c
  src/newmbox.c
  src/options.c
  src/out_utils.c
  src/pattern.c
! src/pgp.c
  src/quit.c
  src/read_rc.c
  src/remail.c
+ src/remailer.c
  src/reply.c
  src/returnadd.c
  src/save_opts.c
***************
*** 227,229 ****
--- 245,263 ----
  utils/printmail.SH
  utils/prlong.c
  utils/readmsg.c
+ melib/Makefile.SH
+ melib/mime.c
+ melib/mime_decode.c
+ melib/mime_parse.c
+ melib/parse_util.c
+ melib/pgp_decode.c
+ melib/state.c
+ hdrs/melib.h
+ hdrs/elmlib.h
+ lib/read_rc.c
+ lib/output.c
+ lib/pmalloc.c
+ nls/C/C/C/s_me.m
+ hdrs/s_me.h
+ lib/getaddr.c
+ lib/forwarded.c
Index: elm2.4.ME+.50/Makefile.SH
*** elm2.4.25/Makefile.SH	Wed Apr 21 04:53:22 1993
--- elm2.4.ME+.50/Makefile.SH	Tue Nov 17 21:12:53 1998
***************
*** 21,44 ****
  echo "Extracting Makefile (with variable substitutions)"
  cat >Makefile <<!GROK!THIS!
  #
! # $Id: Makefile.SH,v 5.3 1993/04/21 01:53:10 syd Exp $
  #
  #  Makefile for the entire ELM mail system
  #
  #         (C) Copyright 1986,1987, by Dave Taylor
  #         (C) Copyright 1988-1992, USENET Community Trust
- #
- #  $Log: Makefile.SH,v $
- # Revision 5.3  1993/04/21  01:53:10  syd
- # take out parallelism, effects standard make
- #
- # Revision 5.2  1993/04/21  01:26:18  syd
- # Support parallel makes in subdirectories with e.g. "make J=2".
- # From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
- #
- # Revision 5.1  1992/10/03  22:12:17  syd
- # Initial checkin as of 2.4 Release at PL0
- #
  # 
  #
  
--- 21,32 ----
  echo "Extracting Makefile (with variable substitutions)"
  cat >Makefile <<!GROK!THIS!
  #
! # $Id: Makefile.SH,v 1.2 1998/10/20 19:57:09 hurtta Exp $
  #
  #  Makefile for the entire ELM mail system
  #
  #         (C) Copyright 1986,1987, by Dave Taylor
  #         (C) Copyright 1988-1992, USENET Community Trust
  # 
  #
  
***************
*** 65,77 ****
  default_target:	all
  
  #	Targets that are simply executed in each subordinate makefile as is
! all install uninstall lint clean:
  		cd lib; $(MAKE) $(MJ) -$(MAKEFLAGS) $@
  		cd src; $(MAKE) $(MJ) -$(MAKEFLAGS) $@
  		cd utils; $(MAKE) $(MJ) -$(MAKEFLAGS) $@
! 		cd filter; $(MAKE) $(MJ) -$(MAKEFLAGS) $@
  		cd doc; $(MAKE) $(MJ) -$(MAKEFLAGS) $@
  
  #	Targets that apply to all elm at once
  listing:
  		@$(ECHO) "Making source listing in file LISTING."
--- 53,80 ----
  default_target:	all
  
  #	Targets that are simply executed in each subordinate makefile as is
! all install uninstall lint clean: config.h config.sh Makefile
! 		cd melib; $(MAKE) $(MJ) -$(MAKEFLAGS) $@	
  		cd lib; $(MAKE) $(MJ) -$(MAKEFLAGS) $@
  		cd src; $(MAKE) $(MJ) -$(MAKEFLAGS) $@
  		cd utils; $(MAKE) $(MJ) -$(MAKEFLAGS) $@
! 		# cd filter; $(MAKE) $(MJ) -$(MAKEFLAGS) $@
  		cd doc; $(MAKE) $(MJ) -$(MAKEFLAGS) $@
  
+ # Check that config.h is up of date
+ config.h: config.h.SH config.sh
+ 	@echo "You must run 'sh Configure -S' or 'sh Configure'"
+ 	exit 1
+ 
+ # Check that config.sh is up of data
+ config.sh: Configure	
+ 	@echo "You must run 'sh Configure'"
+ 	exit 1
+ 
+ Makefile: Makefile.SH config.sh
+ 	@echo "You must run 'sh Configure -S' or 'sh Configure'"
+ 	exit 1
+ 
  #	Targets that apply to all elm at once
  listing:
  		@$(ECHO) "Making source listing in file LISTING."
***************
*** 84,92 ****
  		  $(ECHO) "ELM on the remote machine <$(REMOTE)>. If this is";\
  		  $(ECHO) "not the case, interrupt this process quickly!";\
  		  $(SLEEP) 10;)
  		cd lib; $(MAKE) $(MJ) -$(MAKEFLAGS) REMOTE=$(REMOTE) $@
  		cd src; $(MAKE) $(MJ) -$(MAKEFLAGS) REMOTE=$(REMOTE) $@
! 		cd filter; $(MAKE) $(MJ) -$(MAKEFLAGS) REMOTE=$(REMOTE) $@
  		cd utils; $(MAKE) $(MJ) -$(MAKEFLAGS) REMOTE=$(REMOTE) $@
  		cd doc; $(MAKE) $(MJ) -$(MAKEFLAGS) REMOTE=$(REMOTE) $@
  
--- 87,96 ----
  		  $(ECHO) "ELM on the remote machine <$(REMOTE)>. If this is";\
  		  $(ECHO) "not the case, interrupt this process quickly!";\
  		  $(SLEEP) 10;)
+ 		cd melib; $(MAKE) $(MJ) -$(MAKEFLAGS) REMOTE=$(REMOTE) $@
  		cd lib; $(MAKE) $(MJ) -$(MAKEFLAGS) REMOTE=$(REMOTE) $@
  		cd src; $(MAKE) $(MJ) -$(MAKEFLAGS) REMOTE=$(REMOTE) $@
! 		# cd filter; $(MAKE) $(MJ) -$(MAKEFLAGS) REMOTE=$(REMOTE) $@
  		cd utils; $(MAKE) $(MJ) -$(MAKEFLAGS) REMOTE=$(REMOTE) $@
  		cd doc; $(MAKE) $(MJ) -$(MAKEFLAGS) REMOTE=$(REMOTE) $@
  
***************
*** 111,116 ****
--- 115,121 ----
  	cd doc; $(MAKE) $(MJ) -$(MAKEFLAGS) $@
  
  elm:
+ 	cd melib; $(MAKE) $(MJ) -$(MAKEFLAGS) all
  	cd lib; $(MAKE) $(MJ) -$(MAKEFLAGS) all
  	cd src; $(MAKE) $(MJ) -$(MAKEFLAGS) all
  
***************
*** 120,126 ****
  filter: _filter
  
  _filter:
! 	cd filter; $(MAKE) $(MJ) -$(MAKEFLAGS) all
  
  #	The dummy dependency here prevents make from thinking the target is the
  #	utils directory that sits in the current directory, rather than
--- 125,131 ----
  filter: _filter
  
  _filter:
! 	# cd filter; $(MAKE) $(MJ) -$(MAKEFLAGS) all
  
  #	The dummy dependency here prevents make from thinking the target is the
  #	utils directory that sits in the current directory, rather than
Index: elm2.4.ME+.50/README
*** elm2.4.25/README	Tue May 11 06:19:23 1993
--- elm2.4.ME+.50/README	Tue Nov 17 21:12:53 1998
***************
*** 1,3 ****
--- 1,7 ----
+ This README is for the 2.4 version.
+ Look file README.ME+ for the 2.4ME+ version.
+ 
+ ------------------------------------------------------------------
  This is the 2.4 (USENET) version of the Elm Mail System
  
  See the NOTICE and Instruct files for further details.
Index: elm2.4.ME+.50/config.h.SH
*** elm2.4.25/config.h.SH	Mon May 30 19:55:57 1994
--- elm2.4.ME+.50/config.h.SH	Tue Nov 17 21:12:54 1998
***************
*** 56,68 ****
   */
  #$d_memcpy	MEMCPY		/**/
  
- /* MKDIR:
-  *	This symbol, if defined, indicates that the mkdir routine is available
-  *	to create directories.  Otherwise you should fork off a new process to
-  *	exec /bin/mkdir.
-  */
- #$d_mkdir	MKDIR		/**/
- 
  /* RENAME:
   *	This symbol, if defined, indicates that the rename routine is available
   *	to rename files.  Otherwise you should do the unlink(), link(), unlink()
--- 56,61 ----
***************
*** 82,107 ****
   */
  #$d_whoami	WHOAMI		/**/
  
! /* PREFSHELL:
!  *	This symbol contains the full name of the preferred user shell on this
!  *	system.  Usual values are /bin/csh, /bin/ksh, /bin/sh.
!  */
! #define PREFSHELL "$prefshell"		/**/
! 
! /* EUNICE:
!  *	This symbol, if defined, indicates that the program is being compiled
!  *	under the EUNICE package under VMS.  The program will need to handle
!  *	things like files that don't go away the first time you unlink them,
!  *	due to version numbering.  It will also need to compensate for lack
!  *	of a respectable link() command.
!  */
! /* VMS:
!  *	This symbol, if defined, indicates that the program is running under
!  *	VMS.  It is currently only set in conjunction with the EUNICE symbol.
   */
! #$d_eunice	EUNICE		/**/
! #$d_eunice	VMS		/**/
  
  /* CONFIGURE_DATE
   *	This symbol contains the last date that configure was run for elm -v output.
   */
--- 75,95 ----
   */
  #$d_whoami	WHOAMI		/**/
  
! /* POLL:
!  *	This symbol, if defined, indicates that the program may include
!  *	poll.h.
!  */
! #$d_poll	POLL		/**/
! 
! /* I_INTTYPES:
!  *	This symbol, if defined, indicates that the program may include
!  *	inttypes.h.
   */
! #$d_inttypes	I_INTTYPES		/**/
! #$d_nointtypes NO_INTTYPES		/**/
  
+ 
+ 
  /* CONFIGURE_DATE
   *	This symbol contains the last date that configure was run for elm -v output.
   */
***************
*** 185,194 ****
  /* USE_FCNTL_LOCKING
   *	This symbol, if defined, indicates that SYSV style fcntl file locking should be used.
   */
- /* LOCK_DIR
-  *	This symbol is the name of the lock directory for access (not mailbox) locks.
-  *	It will be /usr/spool/locks or /usr/spool/uucp
-  */
  #$d_flock	USE_FLOCK_LOCKING		/**/
  
  #$d_dotlock	USE_DOTLOCK_LOCKING		/**/
--- 173,178 ----
***************
*** 195,202 ****
  
  #$d_fcntlock	USE_FCNTL_LOCKING	/**/
  
- #define		LOCK_DIR	"$lock_dir"	/**/
- 
  /* FTRUNCATE:
   *	This symbol, if defined, indicates that the ftruncate() routine exists.
   */
--- 179,184 ----
***************
*** 235,246 ****
  #$d_index	index strchr	/* cultural */
  #$d_index	rindex strrchr	/*  differences? */
  
- /* INTERNET:
-  *	This symbol, if defined, indicates that there is a mailer available
-  *	which supports internet-style addresses (user@site.domain).
-  */
- #$d_internet	INTERNET	/**/
- 
  /* ISPELL:
   *	This symbol, if defined, indicates that the GNU ispell
   *	spelling checker that is available to Elm.
--- 217,222 ----
***************
*** 292,297 ****
--- 268,314 ----
   */
  #$d_mime	MIME	/**/
  
+ /* MIME:
+  *	This symbol defines default path to metamail.
+  *          Special values:    none         Don't call metamail
+  *                             metamail     Call metamail if environment
+  *                                          variable NOMETAMAIL is not defined
+  */                     
+ #define METAMAIL_PATH    "$metamail_path"
+ 
+ /* USE_8BITMIME
+  *     Mailer accepts -B8BITMIME option
+  *     -B == BODYTYPE
+  */
+ #$d_8bitmime     USE_8BITMIME      /**/
+ 
+ /* USE_BINARYMIME
+  *     Mailer accepts -BBINARYMIME option
+  *     -B == BODYTYPE
+  *
+  * Elm don't yet fully support BINARYMIME: it requires that lines are
+  * terminated with \r\n, Unix's \n isn't sufficient!
+  * That is only partially implemented in this version of Elm.
+  *
+  * Quote from RFC 1830 (Experimental Protocol): 
+  *  SMTP Service Extensions for Transmission of Large and Binary MIME Messages
+  *
+  *      It is important to note that when using BINARYMIME, it is
+  *      especially important to ensure that the MIME message itself is
+  *      properly formed.  In particular, it is essential that text be
+  *      canonically encoded with each line properly terminated with <CR>
+  *      <LF>.  Any transformation of text into non-canonical MIME to
+  *      observe local storage conventions must be reversed before sending
+  *      as BINARYMIME.  The usual line-oriented shortcuts will break if
+  *      used with BINARYMIME.
+  */
+ #$d_binarymime     USE_BINARYMIME      /**/
+ 
+ /*
+  *  If mailer support DSN via options -N -V -R
+  */
+ #$d_dsn            USE_DSN      /**/
+ 
  /* MMDF:
   *	This symbol, if defined, indicates that mailboxes are in
   *	the MMDF format.
***************
*** 398,403 ****
--- 415,422 ----
  
  #$d_sigprocmask	HASSIGPROCMASK	/**/
  
+ #$d_waitpid	HASWAITPID	/**/
+ 
  /* STRSPN:
   *	This symbol, if defined, indicates that the strspn() routine exists.
   */
***************
*** 469,479 ****
  
  #$d_termio	TERMIO		/**/
  
- /* USE_EMBEDDED_ADDRESSES:
-  *	This symbol, if defined, indicates that replyto: and from:
-  *	headers can be trusted.
-  */
- #$d_useembed USE_EMBEDDED_ADDRESSES	 /**/
  
  /* UTIMBUF:
   *	This symbol is defined if this system defines struct utimbuf.
--- 488,493 ----
***************
*** 517,528 ****
   */
  #$i_memory	I_MEMORY	/**/
  
- /* I_STDARG:
-  *	This symbol, if defined, indicates that the file stdarg.h
-  *	should be included instead of varargs
-  */
- #$i_stdarg	I_STDARG	/**/
- 
  /* I_STDLIB:
   *	This symbol, if defined, indicates that the file stdlib.h
   *	should be included instead of declaring the stdlib routines.
--- 531,536 ----
***************
*** 596,605 ****
   *	This symbol, if defined, indicates this is a Xenix system,
   *	for knocking  out the far keyword in selected places.
   */
! /* BSD:
   *	This symbol, if defined, indicates this is a BSD type system,
   */
  #$d_xenix	XENIX	/**/
! #$d_bsd	BSD	/**/
  
  !GROK!THIS!
--- 604,635 ----
   *	This symbol, if defined, indicates this is a Xenix system,
   *	for knocking  out the far keyword in selected places.
   */
! /* BSD_TYPE:
   *	This symbol, if defined, indicates this is a BSD type system,
   */
  #$d_xenix	XENIX	/**/
! #$d_bsd	BSD_TYPE	/**/
  
+ /* USE_PGP:
+  *	This symbol, if defined, means that PGP support should be compiled in.
+  */
+ /* PGP_PATH:
+  *	The path to the PGP binary.
+  */
+ #$d_pgp USE_PGP /**/
+ #ifdef USE_PGP
+ #define PGP_PATH "$pgp_path"
+ #endif
+ 
+ /* USE_REMAILER:
+  *	If defined, includes support for anonymous remailing, chaining, and
+  *      if USE_PGP is defined, encryption.
+  *
+  * FINGER_PATH:
+  *      Path to the finger binary.
+  */
+ #$d_remailer USE_REMAILER /**/
+ #ifdef USE_REMAILER
+ #define FINGER_PATH "$finger_path"
+ #endif
  !GROK!THIS!
Index: elm2.4.ME+.50/doc/Alias.guide
*** elm2.4.25/doc/Alias.guide	Tue Jul 20 06:02:25 1993
--- elm2.4.ME+.50/doc/Alias.guide	Tue Nov 17 21:12:54 1998
***************
*** 1,4 ****
! .\" @(#)$Id: Alias.guide,v 5.7 1993/07/20 03:02:11 syd Exp $
  .\"
  .\"  A guide to the ELM alias system and so on.
  .\"  format with:
--- 1,4 ----
! .\" @(#)$Id: Alias.guide,v 1.2 1998/10/20 19:57:19 hurtta Exp $
  .\"
  .\"  A guide to the ELM alias system and so on.
  .\"  format with:
***************
*** 6,43 ****
  .\"
  .\"  (C) Copyright 1986,1987 Dave Taylor
  .\"  (C) Copyright 1988-1992 Usenet Community Trust
! .\"  Elm is now in the public trust. Bug reports, comments, suggestions, flames
! .\"  etc. should go to:
! .\"	Syd Weinstein		elm@DSI.COM (dsinc!elm)
! .\"
! .\"  $Log: Alias.guide,v $
! .\" Revision 5.7  1993/07/20  03:02:11  syd
! .\" drop useless reference to Elm address validation
! .\" From: Syd
! .\"
! .\" Revision 5.6  1993/07/20  02:16:26  syd
! .\" Explain that newalias for global takes -g argument
! .\" From: Syd via request from Manfred Ebery
! .\"
! .\" Revision 5.5  1993/04/12  01:45:22  syd
! .\" Update for quotes
! .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
! .\"
! .\" Revision 5.4  1992/12/24  23:48:05  syd
! .\" make Nroff not use co symbol, just the word
! .\" From: Syd via request from Tim Pierce
! .\"
! .\" Revision 5.3  1992/12/20  05:06:19  syd
! .\" Here are the doc changes for my additions to the alias system and
! .\" the new switches to listalias.
! .\" From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
! .\"
! .\" Revision 5.2  1992/10/17  22:01:01  syd
! .\" corrected typos
! .\" From: David.W.Tamkin@gagme.chi.il.us (David W. Tamkin)
! .\"
! .\" Revision 5.1  1992/10/03  20:51:50  syd
! .\" Initial checkin as of 2.4 Release at PL0
  .\"
  .\"
  .\"
--- 6,12 ----
  .\"
  .\"  (C) Copyright 1986,1987 Dave Taylor
  .\"  (C) Copyright 1988-1992 Usenet Community Trust
! .\"  Elm is now in the public trust. 
  .\"
  .\"
  .\"
Index: elm2.4.ME+.50/doc/Config.guid
*** elm2.4.25/doc/Config.guid	Fri Jul 30 05:23:26 1993
--- elm2.4.ME+.50/doc/Config.guid	Tue Nov 17 21:12:54 1998
***************
*** 1,4 ****
! .\" @(#)$Id: Config.guid,v 5.9 1993/07/30 02:23:21 syd Exp $
  .\"
  .\"  A guide to the ELM alias system and so on.
  .\"  format with:
--- 1,4 ----
! .\" @(#)$Id: Config.guid,v 1.1.1.1 1998/10/15 15:36:39 hurtta Exp $
  .\"
  .\"  A guide to the ELM alias system and so on.
  .\"  format with:
***************
*** 6,52 ****
  .\"
  .\"  (C) Copyright 1986,1987 Dave Taylor
  .\"  (C) Copyright 1988-1992 Usenet Community Trust
- .\"  Elm is now in the public trust. Bug reports, comments, suggestions, flames
- .\"  etc. should go to:
- .\"	Syd Weinstein		elm@DSI.COM (dsinc!elm)
  .\"
- .\"  $Log: Config.guid,v $
- .\" Revision 5.9  1993/07/30  02:23:21  syd
- .\" fix -q to -g in newalias call
  .\"
- .\" Revision 5.8  1993/04/12  04:00:55  syd
- .\" remove unused ALIAS parameters
  .\"
- .\" Revision 5.7  1993/04/12  01:47:45  syd
- .\" Update for quotes
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
  .\"
- .\" Revision 5.6  1992/12/24  23:48:05  syd
- .\" make Nroff not use co symbol, just the word
- .\" From: Syd via request from Tim Pierce
- .\"
- .\" Revision 5.5  1992/11/27  02:51:18  syd
- .\" Make the docs catch up with the code, config.changes -> config.over
- .\" From: Syd
- .\"
- .\" Revision 5.4  1992/11/22  00:49:31  syd
- .\" Add support for a "config.over" file to override Configure decisions.
- .\" From: chip@chinacat.unicom.com (Chip Rosenthal)
- .\"
- .\" Revision 5.3  1992/10/24  13:51:44  syd
- .\" More typos
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
- .\"
- .\" Revision 5.2  1992/10/11  01:15:53  syd
- .\" A cleaned up Config.guid follows.  Corrected some spelling errors,
- .\" and played with some formatting:
- .\" From: David Barr <barr@pop.psu.edu>
- .\"
- .\" Revision 5.1  1992/10/03  20:51:50  syd
- .\" Initial checkin as of 2.4 Release at PL0
- .\"
- .\"
- .\"
  .tm Have we been run through "tbl" first?? I hope so!
  .po 1i
  .ds h0
--- 6,15 ----
***************
*** 248,263 ****
  a lone period into a period and a blank to avoid this problem.
  This symbol is ignored if the \*QHonors Content-Length: header?\*U question
  is answered \f2yes\f1.
- .sp
- .ne 4
- \f3Does your mailer understand INTERNET addresses?\f1
- .sp
- Elm works with systems that can process the \*q@\*u character of
- Internet format addresses or with the \*q!\*u format of \f2uucp\f1
- addresses.  If your MTA understands the \*q@\*u format addresses, they
- should be used and this question answered \f2yes\f1.  If messages
- bounce when you send them with \*q@\*u format addresses (such as
- \*Qelm@dsi.com\*U), then answer this question \f2no\f1.
  .sp
  .ne 4
  \f3Am I going to be running as a setgid program?\f1
--- 211,216 ----
Index: elm2.4.ME+.50/doc/Elm.cover
*** elm2.4.25/doc/Elm.cover	Sat May  8 22:58:27 1993
--- elm2.4.ME+.50/doc/Elm.cover	Tue Nov 17 21:12:54 1998
***************
*** 1,31 ****
! .\" @(#)$Id: Elm.cover,v 5.4 1993/05/08 19:58:20 syd Exp $
  .\"
  .\"  Cover sheet for the ELM mail system...
  .\"  format with 
  .\"	troff tmac.n Elm.cover > Coversheet.fmtd'
  .\"
! .\"  Elm is now in the public trust. Bug reports, comments, suggestions, flames
! .\"  etc. should go to:
! .\"	Syd Weinstein		elm@DSI.COM (dsinc!elm)
  .\"
  .\"  (C) Copyright 1986,1987 Dave Taylor
  .\"  (C) Copyright 1988-1992 Usenet Community Trust
- .\"
- .\"  $Log: Elm.cover,v $
- .\" Revision 5.4  1993/05/08  19:58:20  syd
- .\" use new quote macros
- .\" From: Syd
- .\"
- .\" Revision 5.3  1992/12/24  23:48:05  syd
- .\" make Nroff not use co symbol, just the word
- .\" From: Syd via request from Tim Pierce
- .\"
- .\" Revision 5.2  1992/10/24  14:13:39  syd
- .\" Add notice file
- .\"
- .\" Revision 5.1  1992/10/03  20:51:50  syd
- .\" Initial checkin as of 2.4 Release at PL0
- .\"
  .\" 
  .\"  
  .po 1i
--- 1,13 ----
! .\" @(#)$Id: Elm.cover,v 1.2 1998/10/20 19:57:19 hurtta Exp $
  .\"
  .\"  Cover sheet for the ELM mail system...
  .\"  format with 
  .\"	troff tmac.n Elm.cover > Coversheet.fmtd'
  .\"
! .\"  Elm is now in the public trust. 
  .\"
  .\"  (C) Copyright 1986,1987 Dave Taylor
  .\"  (C) Copyright 1988-1992 Usenet Community Trust
  .\" 
  .\"  
  .po 1i
Index: elm2.4.ME+.50/doc/Filter.guid
*** elm2.4.25/doc/Filter.guid	Fri Apr 16 07:11:54 1993
--- elm2.4.ME+.50/doc/Filter.guid	Tue Nov 17 21:12:54 1998
***************
*** 1,4 ****
! .\" @(#)$Id: Filter.guid,v 5.7 1993/04/16 04:11:29 syd Exp $
  .\"
  .\"  A guide to the Elm Filter program
  .\"  format with:
--- 1,4 ----
! .\" @(#)$Id: Filter.guid,v 1.2 1998/10/20 19:57:19 hurtta Exp $
  .\"
  .\"  A guide to the Elm Filter program
  .\"  format with:
***************
*** 7,48 ****
  .\"  (C) Copyright 1986,1987 Dave Taylor
  .\"  (C) Copyright 1988-1992 Usenet Community Trust
  .\"
! .\"  Elm is now in the public trust. Bug reports, comments, suggestions, flames
! .\"  etc. should go to:
! .\"	Syd Weinstein		elm@DSI.COM (dsinc!elm)
! .\"
! .\"  $Log: Filter.guid,v $
! .\" Revision 5.7  1993/04/16  04:11:29  syd
! .\" Fix wrong variable used in shell script
! .\" From: Bruce Tindall <sasbmt@unx.sas.com>
! .\"
! .\" Revision 5.6  1993/04/12  01:46:12  syd
! .\" Update for quotes
! .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
! .\"
! .\" Revision 5.5  1993/01/27  19:45:15  syd
! .\" Filter turns spaces in quoted strings into _ and then back again. This destroys
! .\" any _ that where there in the first place. This patch removes that.
! .\" Also fixed a minor bug where 'filter -r' wrote out the wrong thing if the
! .\" relation in a rule was '~'.
! .\" From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
! .\"
! .\" Revision 5.4  1993/01/27  19:40:01  syd
! .\" I implemented a change to filter's default verbose message format
! .\" including %x %X style date and time along with username
! .\" From: mark@drd.com (Mark Lawrence)
! .\"
! .\" Revision 5.3  1992/12/24  23:48:05  syd
! .\" make Nroff not use co symbol, just the word
! .\" From: Syd via request from Tim Pierce
! .\"
! .\" Revision 5.2  1992/11/15  01:41:50  syd
! .\" Add regexp processing to filter.
! .\" Add execc operator
! .\" From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
! .\"
! .\" Revision 5.1  1992/10/03  20:51:50  syd
! .\" Initial checkin as of 2.4 Release at PL0
  .\"
  .\"
  .po 1i
--- 7,13 ----
  .\"  (C) Copyright 1986,1987 Dave Taylor
  .\"  (C) Copyright 1988-1992 Usenet Community Trust
  .\"
! .\"  Elm is now in the public trust. 
  .\"
  .\"
  .po 1i
Index: elm2.4.ME+.50/doc/Form.guide
*** elm2.4.25/doc/Form.guide	Mon Apr 12 04:47:13 1993
--- elm2.4.ME+.50/doc/Form.guide	Tue Nov 17 21:12:54 1998
***************
*** 1,39 ****
! .\" @(#)$Id: Form.guide,v 5.4 1993/04/12 01:47:13 syd Exp $
  .\"
  .\"  A guide to using the Elm Forms mode
  .\"  format with:
  .\"	'troff tmac.n - > Forms.format'
  .\"
! .\"  Elm is now in the public trust. Bug reports, comments, suggestions, flames
! .\"  etc. should go to:
! .\"	Syd Weinstein		elm@DSI.COM (dsinc!elm)
  .\"
  .\"  Copyright (c) 1988-1992 USENET Community Trust
  .\"  Copyright (c) 1986,1987 Dave Taylor
- .\"
- .\"  $Log: Form.guide,v $
- .\" Revision 5.4  1993/04/12  01:47:13  syd
- .\" Update for quotes
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
- .\"
- .\" Revision 5.3  1992/12/24  23:48:05  syd
- .\" make Nroff not use co symbol, just the word
- .\" From: Syd via request from Tim Pierce
- .\"
- .\" Revision 5.2  1992/10/11  01:33:36  syd
- .\" fixed a bug in the .lp macro in doc/tmac.n.  The lp macros is always
- .\" called with a unit specified for the second argument, however, the
- .\" macro added a "n" unit specifier to that argument.  The following patch
- .\" fixes this problem.
- .\"
- .\" The various .guide books use the troff .tl macro liberally, but often the
- .\" extra ' characters needed at the end of the lines to explicitly specify
- .\" the trailing nulls fields were left off.  The following patch fixes the
- .\" erroneous lines.
- .\" From: Larry Philps <larryp@sco.COM>
- .\"
- .\" Revision 5.1  1992/10/03  20:51:50  syd
- .\" Initial checkin as of 2.4 Release at PL0
  .\"
  .\"
  .\"
--- 1,13 ----
! .\" @(#)$Id: Form.guide,v 1.2 1998/10/20 19:57:19 hurtta Exp $
  .\"
  .\"  A guide to using the Elm Forms mode
  .\"  format with:
  .\"	'troff tmac.n - > Forms.format'
  .\"
! .\"  Elm is now in the public trust. 
  .\"
  .\"  Copyright (c) 1988-1992 USENET Community Trust
  .\"  Copyright (c) 1986,1987 Dave Taylor
  .\"
  .\"
  .\"
Index: elm2.4.ME+.50/doc/Makefile.SH
*** elm2.4.25/doc/Makefile.SH	Thu Mar 10 19:20:29 1994
--- elm2.4.ME+.50/doc/Makefile.SH	Tue Nov 17 21:12:54 1998
***************
*** 16,82 ****
  echo "Extracting doc/Makefile (with variable substitutions)"
  cat >Makefile <<!GROK!THIS!
  #
! # $Id: Makefile.SH,v 5.12 1994/03/10 17:20:23 syd Exp $
  #
  #  Makefile for the documentation of the ELM mail system
  #
  #         (C) Copyright 1988-1992, USENET Community Trust
  #
- #  $Log: Makefile.SH,v $
- # Revision 5.12  1994/03/10  17:20:23  syd
- # Remove autoreply
- # From: Syd
  #
- # Revision 5.11  1993/04/12  02:12:07  syd
- # Added elmalias.1 man page.  Updated Users.guide to mention elmalias.
- # From: chip@chinacat.unicom.com (Chip Rosenthal)
- #
- # Revision 5.10  1993/01/20  03:11:51  syd
- # During 'make uninstall', an error occurs with the make for doc/,
- # due to a wrongly-extended "if" statement in the Makefile.
- # From: Allan Kugel <hico2!hico3!allan@tsdiag.ocpt.ccur.com>
- #
- # Revision 5.9  1992/12/13  18:00:05  syd
- # Add one more missing rm of a previously packed man page
- # From: Bo Asbjorn Muldbak <bam@jutland.ColumbiaSC.NCR.COM>
- #
- # Revision 5.8  1992/12/12  01:28:50  syd
- # Remove the old packed manual page before trying to pack the new one.
- # From: Tom Moore <tmoore@fievel.DaytonOH.NCR.COM>
- #
- # Revision 5.7  1992/12/07  05:05:27  syd
- # fix ; placement
- # From: Syd
- #
- # Revision 5.6  1992/12/07  03:28:35  syd
- # add else clause with true to TEST lines as some Makefiles exit if
- # the if construct doesnt execute a clause as the if returns an error
- # status.
- # From: Syd via requests from several people
- #
- # Revision 5.5  1992/12/07  02:17:14  syd
- # Add missing -n flag to doc makefile.
- # From: gwh@dogmatix.inmos.co.uk
- #
- # Revision 5.4  1992/11/22  00:47:02  syd
- # Change the way Configure and doc/Makefile.SH deal with installing
- # man pages.
- # From: Tom Moore <tmoore@wnas.DaytonOH.NCR.COM>
- #
- # Revision 5.3  1992/11/07  16:13:00  syd
- # Limit test arguments to -f instead of -x as several shells and
- # their resulting test commands dont have -x
- # From: Syd via request from Tim Pierce
- #
- # Revision 5.2  1992/10/30  21:06:09  syd
- # add missing MAKE variable definition
- # From: syd via note from Keith Petersen w8sdz@tacom-emh1.army.mil
- #
- # Revision 5.1  1992/10/03  20:51:50  syd
- # Initial checkin as of 2.4 Release at PL0
- #
- # 
- #
  # Variables
  #	Variables established by Configure
  CHMOD		=	$chmod
--- 16,28 ----
  echo "Extracting doc/Makefile (with variable substitutions)"
  cat >Makefile <<!GROK!THIS!
  #
! # $Id: Makefile.SH,v 1.2 1998/10/20 19:57:19 hurtta Exp $
  #
  #  Makefile for the documentation of the ELM mail system
  #
  #         (C) Copyright 1988-1992, USENET Community Trust
  #
  #
  # Variables
  #	Variables established by Configure
  CHMOD		=	$chmod
***************
*** 114,120 ****
  			$(MAN)/elm$(MANEXT)		\
  			$(MAN)/elmalias$(MANEXT)	\
  			$(MAN)/fastmail$(MANEXT)	\
- 			$(MAN)/filter$(MANEXT)		\
  			$(MAN)/frm$(MANEXT)		\
  			$(MAN)/listalias$(MANEXT)	\
  			$(MAN)/messages$(MANEXT)	\
--- 60,65 ----
***************
*** 123,128 ****
--- 68,75 ----
  			$(MAN)/printmail$(MANEXT)	\
  			$(MAN)/readmsg$(MANEXT)
  
+ #			$(MAN)/filter$(MANEXT)		
+ 
  # List of installed catman pages (except for wnemail.1 - handled differently)
  CATMAN_LIST	=	$(CATMAN)/answer$(CATMANEXT)$(SUFFIX)	\
  			$(CATMAN)/checkalias$(CATMANEXT)$(SUFFIX)\
***************
*** 129,135 ****
  			$(CATMAN)/elm$(CATMANEXT)$(SUFFIX)	\
  			$(CATMAN)/elmalias$(CATMANEXT)$(SUFFIX)\
  			$(CATMAN)/fastmail$(CATMANEXT)$(SUFFIX)	\
- 			$(CATMAN)/filter$(CATMANEXT)$(SUFFIX)	\
  			$(CATMAN)/frm$(CATMANEXT)$(SUFFIX)	\
  			$(CATMAN)/listalias$(CATMANEXT)$(SUFFIX)	\
  			$(CATMAN)/messages$(CATMANEXT)$(SUFFIX)	\
--- 76,81 ----
***************
*** 138,143 ****
--- 84,91 ----
  			$(CATMAN)/printmail$(CATMANEXT)$(SUFFIX)	\
  			$(CATMAN)/readmsg$(CATMANEXT)$(SUFFIX)
  
+ #			$(CATMAN)/filter$(CATMANEXT)$(SUFFIX)
+ 
  # List of formatted pages for catman
  FORMATTED_PAGES_LIST =	catman/answer$(CATMANEXT)$(SUFFIX)	\
  			catman/checkalias$(CATMANEXT)$(SUFFIX)\
***************
*** 144,150 ****
  			catman/elm$(CATMANEXT)$(SUFFIX)	\
  			catman/elmalias$(CATMANEXT)$(SUFFIX)\
  			catman/fastmail$(CATMANEXT)$(SUFFIX)	\
- 			catman/filter$(CATMANEXT)$(SUFFIX)	\
  			catman/frm$(CATMANEXT)$(SUFFIX)	\
  			catman/listalias$(CATMANEXT)$(SUFFIX)	\
  			catman/messages$(CATMANEXT)$(SUFFIX)	\
--- 92,97 ----
***************
*** 153,158 ****
--- 100,107 ----
  			catman/printmail$(CATMANEXT)$(SUFFIX)	\
  			catman/readmsg$(CATMANEXT)$(SUFFIX)
  
+ #			catman/filter$(CATMANEXT)$(SUFFIX)	
+ 
  # List of remotely installed man pages (except for wnemail.1 - handled
  # differently)
  REMOTE_MAN_LIST	=	$(REMOTE)$(MAN)/answer$(MANEXT)	\
***************
*** 160,166 ****
  			$(REMOTE)$(MAN)/elm$(MANEXT)		\
  			$(REMOTE)$(MAN)/elmalias$(MANEXT)	\
  			$(REMOTE)$(MAN)/fastmail$(MANEXT)	\
- 			$(REMOTE)$(MAN)/filter$(MANEXT)	\
  			$(REMOTE)$(MAN)/frm$(MANEXT)		\
  			$(REMOTE)$(MAN)/listalias$(MANEXT)	\
  			$(REMOTE)$(MAN)/messages$(MANEXT)	\
--- 109,114 ----
***************
*** 169,174 ****
--- 117,124 ----
  			$(REMOTE)$(MAN)/printmail$(MANEXT)	\
  			$(REMOTE)$(MAN)/readmsg$(MANEXT)
  
+ #			$(REMOTE)$(MAN)/filter$(MANEXT)	
+ 
  # List of files installed in LIB directory
  LIB_LIST	=	$(LIB)/elm-help.0	\
  			$(LIB)/elm-help.1	\
***************
*** 187,196 ****
  FORMATTED_LIST	=	Alias.fmtd	\
  			Config.fmtd 	\
  			Cover.fmtd	\
- 			Filter.fmtd	\
  			Form.fmtd	\
  			Ref.fmtd	\
  			Users.fmtd
  
  # Targets
  all: 
--- 137,147 ----
  FORMATTED_LIST	=	Alias.fmtd	\
  			Config.fmtd 	\
  			Cover.fmtd	\
  			Form.fmtd	\
  			Ref.fmtd	\
  			Users.fmtd
+ 
+ #			Filter.fmtd	
  
  # Targets
  all: 
Index: elm2.4.ME+.50/doc/Ref.guide
*** elm2.4.25/doc/Ref.guide	Mon Sep 20 02:43:36 1993
--- elm2.4.ME+.50/doc/Ref.guide	Tue Nov 17 21:12:54 1998
***************
*** 1,184 ****
! .\" @(#)$Id: Ref.guide,v 5.30 1993/09/19 23:43:35 syd Exp $
  .\"
  .\"  Reference guide to the Elm mail system.
  .\"  format with
  .\"      troff tmac.n Ref.guide > Ref.format
  .\"
! .\"  Elm is now in the public trust. Bug reports, comments, suggestions, flames
! .\"  etc. should go to:
! .\"	Syd Weinstein		elm@DSI.COM (dsinc!elm)
  .\"
  .\"  (C) Copyright 1986,1987 Dave Taylor
  .\"  (C) Copyright 1988-1992 Usenet Community Trust
- .\"
- .\"  $Log: Ref.guide,v $
- .\" Revision 5.30  1993/09/19  23:43:35  syd
- .\" Conform textencoding addition to style standard.
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
- .\"
- .\" Revision 5.29  1993/08/23  02:53:52  syd
- .\" Added some documentation for textencoding variable.
- .\" From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
- .\"
- .\" Revision 5.28  1993/08/10  21:25:09  syd
- .\" Correct typo and use hard spaces within quotes in *clear-weed-list* note.
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
- .\"
- .\" Revision 5.27  1993/08/03  18:56:24  syd
- .\" Added text about how the weedout list works w.r.t From: and From_
- .\" From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
- .\"
- .\" Revision 5.26  1993/07/20  02:43:05  syd
- .\" [ Patch description ]
- .\" Update the example elmrc and move a couple out of order variable
- .\" descriptions.
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
- .\"
- .\" Revision 5.25  1993/05/14  03:56:39  syd
- .\" Moved the new numeric variables to the Numeric Variables section and
- .\" applied the quoting/highlight policy to them.
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
- .\"
- .\" Revision 5.24  1993/05/08  20:08:43  syd
- .\" add sleepmsg parameter
- .\"
- .\" Revision 5.23  1993/05/08  20:00:22  syd
- .\" fix mail added >From lines
- .\" From: Syd
- .\"
- .\" Revision 5.22  1993/05/08  18:56:16  syd
- .\" created a new elmrc variable named "readmsginc".  This specifies an
- .\" increment by which the message count is updated.  If this variable is
- .\" set to, say, 25, then the message count will only be updated every 25
- .\" messages, displaying 0, 25, 50, 75, and so forth.  The default value
- .\" of 1 will cause Elm to behave exactly as it currently does in PL21.
- .\" From: Eric Peterson <epeterso@encore.com>
- .\"
- .\" Revision 5.21  1993/04/12  03:15:41  syd
- .\" These patches makes 'T' (since it was free) do a Tag and Move command in the
- .\" index and alias page, and in the builtin pager.
- .\" In the alias help in src/alias.c, there is a tolower done on the character
- .\" one wants help for.  This is clearly wrong.
- .\" From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
- .\"
- .\" Revision 5.20  1993/04/12  01:44:20  syd
- .\" Update for quotes
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
- .\"
- .\" Revision 5.19  1993/01/27  20:57:47  syd
- .\" Corrections to PL21 Alpha docs and consistent punctuation use in help files.
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
- .\"
- .\" Revision 5.18  1993/01/20  04:01:07  syd
- .\" Adds a new integer parameter builtinlines.
- .\" if (builtinlines < 0) and (the length of the message < LINES on
- .\"       screen + builtinlines) use internal.
- .\" if (builtinlines > 0) and (length of message < builtinlines)
- .\" 	use internal pager.
- .\" if (builtinlines = 0) or none of the above conditions hold, use the
- .\" external pager if defined.
- .\" From: "John P. Rouillard" <rouilj@ra.cs.umb.edu>
- .\"
- .\" Revision 5.17  1993/01/19  04:52:19  syd
- .\" 	add c)hange alias command to alias helpfile
- .\" 	if a deleted alias is changed, undelete it.  Also added the 'N'
- .\" flag to changed aliases to help remind the user.  Documented it.
- .\" Note:  if they mark the alias for deletion AFTER making the change it
- .\" WILL be deleted. (and marked accordingly)
- .\" 	modified alias mode title string to indicate when a resync was
- .\" needed.
- .\" 	allow editing alias file when none exist.
- .\" 	Now aliases are check for illegal characters (and WS) and
- .\" addresses are check for illegal WS when they are being entered.  If
- .\" anything illegal is found and message is printed and they keep entering
- .\" the item until they get it right.
- .\" 	I fixed a couple of places where int should be long to match
- .\" the declared type of alias_rec.length
- .\" From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
- .\"
- .\" Revision 5.16  1992/12/24  23:48:05  syd
- .\" make Nroff not use co symbol, just the word
- .\" From: Syd via request from Tim Pierce
- .\"
- .\" Revision 5.15  1992/12/20  05:22:13  syd
- .\" Fix formatting and typograpical problems
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
- .\"
- .\" Revision 5.14  1992/12/20  05:06:19  syd
- .\" Here are the doc changes for my additions to the alias system and
- .\" the new switches to listalias.
- .\" From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
- .\"
- .\" Revision 5.13  1992/12/12  01:27:41  syd
- .\" Make verb and pronoun agree.
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
- .\"
- .\" Revision 5.12  1992/12/07  02:41:21  syd
- .\" This implements the use of SIGUSR1 and SIGUSR2 as discussed on the
- .\" mailing list recently, and adds them to the documentation.
- .\" From: scs@lokkur.dexter.mi.us (Steve Simmons)
- .\"
- .\" Revision 5.11  1992/11/07  19:37:21  syd
- .\" Enhanced printing support.  Added "-I" to readmsg to
- .\" suppress spurious diagnostic messages.
- .\" From: chip@chinacat.unicom.com (Chip Rosenthal)
- .\"
- .\" Revision 5.10  1992/11/07  16:31:15  syd
- .\" another typo (2.4.6 Ref.guide)
- .\" From: David.W.Tamkin@gagme.chi.il.us (David W. Tamkin)
- .\"
- .\" Revision 5.9  1992/10/30  20:56:37  syd
- .\" Things I found in doc/Ref.guide looking over patches 4 & 5:
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
- .\"
- .\" Revision 5.8  1992/10/24  13:53:16  syd
- .\" I think all these are typos
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
- .\"
- .\" Revision 5.7  1992/10/24  13:44:41  syd
- .\" There is now an additional elmrc option "displaycharset", which
- .\" sets the charset supported on your terminal. This is to prevent
- .\" elm from calling out to metamail too often.
- .\" Plus a slight documentation update for MIME composition (added examples)
- .\" From: Klaus Steinberger <Klaus.Steinberger@Physik.Uni-Muenchen.DE>
- .\"
- .\" Revision 5.6  1992/10/24  13:25:41  syd
- .\" In our global elm.rc I keep the four options as below
- .\"
- .\" 	confirmappend = OFF	Don't confirm every append to any file.
- .\" 	confirmcreate = ON	Confirm creation of every new file.
- .\" 	confirmfiles = ON	Confirm append to non folder files though.
- .\" 	confirmfolders = ON	In case someone does not want to be asked
- .\" 				every time when creating a new file try
- .\" 				to confirm creation of folders though.
- .\" From: Jukka Ukkonen <ukkonen@csc.fi>
- .\"
- .\" Revision 5.5  1992/10/17  22:58:57  syd
- .\" patch to make elm use (or in my case, not use) termcap/terminfo ti/te.
- .\" From: Graham Hudspith <gwh@inmos.co.uk>
- .\"
- .\" Revision 5.4  1992/10/17  22:01:01  syd
- .\" corrected typos
- .\" From: David.W.Tamkin@gagme.chi.il.us (David W. Tamkin)
- .\"
- .\" Revision 5.3  1992/10/11  01:33:36  syd
- .\" fixed a bug in the .lp macro in doc/tmac.n.  The lp macros is always
- .\" called with a unit specified for the second argument, however, the
- .\" macro added a "n" unit specifier to that argument.  The following patch
- .\" fixes this problem.
- .\"
- .\" The various .guide books use the troff .tl macro liberally, but often the
- .\" extra ' characters needed at the end of the lines to explicitly specify
- .\" the trailing nulls fields were left off.  The following patch fixes the
- .\" erroneous lines.
- .\" From: Larry Philps <larryp@sco.COM>
- .\"
- .\" Revision 5.2  1992/10/04  01:15:43  syd
- .\" Emphasize that hostdomain, hostname and hostfullname must all be specified
- .\" if one is specified in elmrc file.
- .\"
- .\" Revision 5.1  1992/10/03  20:51:50  syd
- .\" Initial checkin as of 2.4 Release at PL0
  .\"
  .\"
  .\"
--- 1,13 ----
! .\" @(#)$Id: Ref.guide,v 1.2 1998/10/20 19:57:19 hurtta Exp $
  .\"
  .\"  Reference guide to the Elm mail system.
  .\"  format with
  .\"      troff tmac.n Ref.guide > Ref.format
  .\"
! .\"  Elm is now in the public trust. 
  .\"
  .\"  (C) Copyright 1986,1987 Dave Taylor
  .\"  (C) Copyright 1988-1992 Usenet Community Trust
  .\"
  .\"
  .\"
Index: elm2.4.ME+.50/doc/Users.guide
*** elm2.4.25/doc/Users.guide	Thu Mar 10 19:21:24 1994
--- elm2.4.ME+.50/doc/Users.guide	Tue Nov 17 21:12:54 1998
***************
*** 1,59 ****
! .\" @(#)$Id: Users.guide,v 5.9 1994/03/10 17:21:21 syd Exp $
  .\"
  .\"  Users guide to the ELM mail system.
  .\"  format with:
  .\"	'tbl Users.guide | troff tmac.n - > Users.fmtd'
  .\"
! .\"  Elm is now in the public trust. Bug reports, comments, suggestions, flames
! .\"  etc. should go to:
! .\"	Syd Weinstein		elm@DSI.COM (dsinc!elm)
  .\"
  .\"  (C) Copyright 1986,1987 Dave Taylor
  .\"  (C) Copyright 1988-1992 Usenet Community Trust
- .\"
- .\"  $Log: Users.guide,v $
- .\" Revision 5.9  1994/03/10  17:21:21  syd
- .\" remove autoreply
- .\"
- .\" Revision 5.8  1993/05/08  20:00:22  syd
- .\" fix mail added >From lines
- .\" From: Syd
- .\"
- .\" Revision 5.7  1993/04/12  02:12:07  syd
- .\" Added elmalias.1 man page.  Updated Users.guide to mention elmalias.
- .\" From: chip@chinacat.unicom.com (Chip Rosenthal)
- .\"
- .\" Revision 5.6  1993/04/12  01:42:16  syd
- .\" Update for quotes
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
- .\"
- .\" Revision 5.5  1992/12/24  23:48:05  syd
- .\" make Nroff not use co symbol, just the word
- .\" From: Syd via request from Tim Pierce
- .\"
- .\" Revision 5.4  1992/12/11  02:01:13  syd
- .\" fix Obvious typos.
- .\" From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
- .\"
- .\" Revision 5.3  1992/10/17  21:59:56  syd
- .\" Fix spelling of name
- .\" From: Larry Philps <larryp@sco.COM>
- .\"
- .\" Revision 5.2  1992/10/11  01:33:36  syd
- .\" fixed a bug in the .lp macro in doc/tmac.n.  The lp macros is always
- .\" called with a unit specified for the second argument, however, the
- .\" macro added a "n" unit specifier to that argument.  The following patch
- .\" fixes this problem.
- .\"
- .\" The various .guide books use the troff .tl macro liberally, but often the
- .\" extra ' characters needed at the end of the lines to explicitly specify
- .\" the trailing nulls fields were left off.  The following patch fixes the
- .\" erroneous lines.
- .\" From: Larry Philps <larryp@sco.COM>
- .\"
- .\" Revision 5.1  1992/10/03  20:51:50  syd
- .\" Initial checkin as of 2.4 Release at PL0
- .\"
  .\"
  .\"
  .tm I trust we've run this through "tbl" first...
--- 1,13 ----
! .\" @(#)$Id: Users.guide,v 1.2 1998/10/20 19:57:20 hurtta Exp $
  .\"
  .\"  Users guide to the ELM mail system.
  .\"  format with:
  .\"	'tbl Users.guide | troff tmac.n - > Users.fmtd'
  .\"
! .\"  Elm is now in the public trust. 
  .\"
  .\"  (C) Copyright 1986,1987 Dave Taylor
  .\"  (C) Copyright 1988-1992 Usenet Community Trust
  .\"
  .\"
  .tm I trust we've run this through "tbl" first...
Index: elm2.4.ME+.50/doc/elm-help.0
*** elm2.4.25/doc/elm-help.0	Mon Apr 12 06:13:09 1993
--- elm2.4.ME+.50/doc/elm-help.0	Tue Nov 17 21:12:54 1998
***************
*** 1,5 ****
  
!         Command                      Elm 2.4 Action
  
            <RETURN>,<SPACE>      Display current message
             |                    Pipe current message or tagged messages to
--- 1,5 ----
  
!         Command                      Elm 2.4ME+ Action
  
            <RETURN>,<SPACE>      Display current message
             |                    Pipe current message or tagged messages to
***************
*** 24,35 ****
--- 24,38 ----
             c                    Change to another folder
             d                    Delete current message
            ^D                    Delete messages with a specified pattern
+           ^E                    Extract PGP public keys from current message
             e                    Edit current folder
             f                    Forward current message
+           ^F                    Forget PGP passphrase
             g                    Group (all recipients) reply to current message
             h                    Headers displayed with message
             J                    Increment current message by one
             j, <DOWN>            Advance to next undeleted message
+           ^K                    Mail PGP public key(s)
             K                    Decrement current message by one
             k, <UP>              Advance to previous undeleted message
             l                    Limit messages by specified criteria
***************
*** 50,55 ****
--- 53,59 ----
            ^T                    Tag messages with a specified pattern
             u                    Undelete current message
            ^U                    Undelete messages with a specified pattern
+            v                    View attachments in current message.
             x, ^Q                Exit leaving folder untouched, ask permission
                                          if folder changed
             X                    Exit leaving folder untouched, unconditionally
Index: elm2.4.ME+.50/doc/elm-help.3
*** elm2.4.25/doc/elm-help.3	Mon Apr 12 06:13:10 1993
--- elm2.4.ME+.50/doc/elm-help.3	Tue Nov 17 21:12:54 1998
***************
*** 1,5 ****
  
!         Command                      Elm 2.4 Action
  
  
            <RETURN>              Display the current message,
--- 1,5 ----
  
!         Command                      Elm 2.4ME+ Action
  
  
            <RETURN>              Display the current message,
***************
*** 38,43 ****
--- 38,44 ----
             t                    Tag current message for further operations
             T                    Tag current message and go to next message
             u                    Undelete current message
+ 	   v			View attachments in current message.
             x                    Exit leaving folder untouched, ask permission
                                          if folder changed
             X                    Exit leaving folder untouched, unconditionally
Index: elm2.4.ME+.50/doc/elm.1
*** elm2.4.25/doc/elm.1	Fri Dec 25 01:46:52 1992
--- elm2.4.ME+.50/doc/elm.1	Tue Nov 17 21:12:54 1998
***************
*** 74,79 ****
--- 74,84 ----
  .B "  -a"
  Arrow - force the arrow cursor (instead of the inverse bar)
  .TP
+ .B "  -A \fIfile\fR "
+ Attach file. Look also option -i.
+ To get this to work correctly, in file "$HOME/.elm/mime.types"
+ must be mapping from extension of filename to mime type.
+ .TP
  .B "  -c"
  Checkalias - expand the following aliases and return.
  .TP
***************
*** 88,102 ****
--- 93,112 ----
  .TP
  .B "  -i \fIfile\fR  "
  Include - include prepared file in edit buffer for sending.
+ Look also option -A.
  .TP
  .B "  -?"
  Synonymous with the "-h" option.
  .TP
  .B "  -k"
+ Ignored.
+ 
  Keypad - force knowledge of HP terminal keyboard, to allow
  the use of the NEXT, PREV and HOME/SHIFT-HOME keys.
  .TP
  .B "  -K"
+ Ignored.
+ 
  Keypad + softkeys - enable use of softkeys on HP terminals only.
  .TP
  .B "  -m"
***************
*** 110,115 ****
--- 120,129 ----
  .TP
  .B "  -v"
  Version - print version and configuration information.
+ .TP
+ .B "  -w"
+ Write .elm/elmrc in startup. Useful if your .elm/elmrc 
+ have errors.
  .TP
  .B "  -z"
  Zero - don't enter \fBElm\fR if no mail is pending.
Index: elm2.4.ME+.50/doc/elmrc-info
*** elm2.4.25/doc/elmrc-info	Fri Mar 11 23:19:26 1994
--- elm2.4.ME+.50/doc/elmrc-info	Tue Nov 17 21:14:08 1998
***************
*** 1,5 ****
! #@(#)$Id: elmrc-info,v 5.11 1994/03/11 21:19:26 syd Exp $
! # Elm Version 2.4
  #
  #$HDR - magic line to mark comments to put at top of user's elmrc file.
  #
--- 1,5 ----
! #@(#)$Id: elmrc-info,v 1.2 1998/11/08 18:20:15 hurtta Exp $
! # Elm Version 2.4ME+
  #
  #$HDR - magic line to mark comments to put at top of user's elmrc file.
  #
***************
*** 15,20 ****
--- 15,21 ----
  
  shell
  # The shell to use for shell escapes
+ # If not set value from passwd is used
  
  fullname
  # The full user name for outbound mail
***************
*** 22,27 ****
--- 23,31 ----
  maildir
  # where to save my mail to, default directory is "Mail"
  
+ mailpermissions
+ # permissions to be given to newly-created saved mail files, default rw-------
+   
  tmpdir
  # where to place temporary files, default directory is "/tmp"
  
***************
*** 88,96 ****
--- 92,157 ----
  weed
  # enable the weedout list to be read?
  
+ metamail
+ # This tells path of metamail program
+ #
+ # That version (Elm 2.4ME+) does not use Metamail's companion programs 
+ # (suchs as mmencode) directly, but metamail package supposes that
+ # companion programs are installed to search path.
+ #
+ # Special values:   none		Don't call metamail
+ #		    metamail		Don't call metamail if environment
+ #						variable $NOMETAMAIL is defined
+ 
+ noencoding
+ # This control makes it possible to send raw 8bit or binary data when the MTA
+ # doesn't support 8BITMIME and the -B8BITMIME option or
+ # BINARYMIME and the -BBINARYMIME option
+ #
+ # Possible values:
+ #    pass-7bit (0)   : Always convert 8BIT and BINARY data to QUOTED-PRINTABLE 
+ #                      if the MTA doesn't support the -B8BITMIME and 
+ #                      -BBINARYMIME options.
+ #    pass-8bit (1)   : Allow 8bit without -B8BITMIME, but binary data is 
+ #                      encoded
+ #    pass-binary (2) : Allow binary without -BBINARYMIME and and 8bit without 
+ #                      -B8BITMIME
+ #
+ # It is STRONGLY recommended that it be left set to pass-7bit unless you know 
+ # what you are doing!!
+ #
+ # Elm doesn't yet fully support BINARYMIME: it requires that text lines are
+ # terminated with \r\n, Unix's \n isn't sufficient!
+ # That is only partially implemented in this version of Elm.
+ #
+ # Quote from RFC 1830 (Experimental Protocol): 
+ #  SMTP Service Extensions for Transmission of Large and Binary MIME Messages
+ #
+ #      It is important to note that when using BINARYMIME, it is
+ #      especially important to ensure that the MIME message itself is
+ #      properly formed.  In particular, it is essential that text be
+ #      canonically encoded with each line properly terminated with <CR>
+ #      <LF>.  Any transformation of text into non-canonical MIME to
+ #      observe local storage conventions must be reversed before sending
+ #      as BINARYMIME.  The usual line-oriented shortcuts will break if
+ #      used with BINARYMIME.
+ 
+ nohdrencoding
+ # Don't do MIME part 2 (RFC 1522) encoding for 8-bit headers?
+ # Because 8-bit data is not allowed in headers, 
+ # it is STRONGLY recommended that this is left set to OFF
+ 
  noheader
  # when messages are copied into the outbound buffer, don't include headers?
+ # when replying
  
+ noheaderfwd
+ # when messages are copied into the outbound buffer, don't include headers?
+ # when forwarding 	
+ # (Notice that messages are not copiend to outbound buffer when
+ #  mimeworward = ON)
+ 
+ 
  titles
  # display message title when displaying pages of message?
  
***************
*** 164,170 ****
  # do we want to be able to mail out AT&T Mail Forms?
  
  userlevel
! # are we good at it?  0=beginner, 1=intermediate, 2+ = expert!
  
  names
  # just show the names when expanding aliases?
--- 225,231 ----
  # do we want to be able to mail out AT&T Mail Forms?
  
  userlevel
! # are we good at it?  beginner (0), intermediate (1), expert (2)
  
  names
  # just show the names when expanding aliases?
***************
*** 193,203 ****
  charset
  # name of Character Set used with MIME text/plain Content-type
  # US-ASCII is default. Be aware that if you use a national charset
! # elm probably needs metamail to display US-ASCII.
  
  displaycharset
  # name of Character Set which the display supports. This is independent
! # of the above "charset".
  
  compatcharsets
  # list of Character Sets, which are more or less a superset of US-ASCII
--- 254,273 ----
  charset
  # name of Character Set used with MIME text/plain Content-type
  # US-ASCII is default. Be aware that if you use a national charset
! # elm probably needs metamail to display US-ASCII. Special value
! # DISPLAY means that Charcter Set used in content-type is same
! # which the display supports (see: displaycharset)
  
  displaycharset
  # name of Character Set which the display supports. This is independent
! # of the above "charset". This is also copied to environment variable 
! # MM_CHARSET when metamail is called. This is used only as default
! # on systems which supports locale. In these systems LC_CTYPE locale
! # is mapped to Character Set. Mapping is given in file elm.mimecharsets
! # on elm library directory or on file .elm/mime.charsets
! 
! dsn-success
! # If TRUE, success Delivery-Status-Notifications are asked by default.
  
  compatcharsets
  # list of Character Sets, which are more or less a superset of US-ASCII
***************
*** 247,250 ****
  textencoding
  # Type of encoding to be put into the MIME Content-Transfer-Encoding header.
  # Usual values are 7bit or 8bit.
! # NOTE: Elm will not encode your message based on this variable.
--- 317,391 ----
  textencoding
  # Type of encoding to be put into the MIME Content-Transfer-Encoding header.
  # Usual values are 7bit or 8bit.
! #
! # -- NOT Used in this version of elm (2.4 PL24 ME7) or ELM 2.4ME+ PLxx (25)
! # Now elm analyzes mail when sending and does that encoding of quoted-printable
! # when necessary.
! 
! showpgppreamble
! # if this variable is ON, display text before PGP armor.
! 
! showto
! # if this variable is ON, Elm will show who the message is to rather than
! # who it is from in the headers display.
! 
! usepgppass
! # If ON, Elm will prompt you for your PGP passphrase and use it whenever
! # necessary to make it more convenient to hand PGP messages.
! 
! keeppassfor
! # The number of seconds Elm should remember your passphrase.  -1 means never
! # expire it.
! 
! askpgpsig
! # If ON, Elm will prompt you for a username with which to sign the pgp
! # message
! 
! pagealternative
! # Should Elm use "pager" for display one part of multipart/alternative,
! # if there are found one part which can be displayed. If not
! # set, Elm uses "pager" for display one part of multipart/alternative,
! # if are parts are displayable.
! 
! pagemultipart
! # Should Elm use "pager" to display MIME multipart messages
! # with unknown subparts or with unknown subtype?
! 
! mimeforward
! # This option controls how Elm will forward messages when MIME is defined.
! #	ON: Causes Elm to send the message as a MIME attachment of type
! #		MESSAGE/RFC822.  Highly recommended when forwarding MIME
! #		messages so that the receiver can correctly view the message!
! #	OFF: Elm will include the forwarded message in your editor instead
! #		of making it an attachment.
! 
! quoteforward
! # Forwarded messages are quoted like replies, rather than included
! # with "Forwarded message" and "End of forwarded message" banners 
! # above and below. This don't have effect if "mimeforward" is TRUE.
! 
! require-mime-version-for-hdr-encoding
! # If set MIME Part 2 (RFC 1522) decoding is only done when MIME-version
! # header is present. Default: False
! 
! require-mime-version-for-body-encoding
! # If set MIME Part 1 (RFC 1521) decoding is only done when MIME-version
! # header is present. Default: True
! 
! background-wait-time
! # If = 0  wait mailer to completion
! #    > 0  wait background_wait_time seconds for completion
! #         if not completed in this time, let it go to background
! #
! #	  (completion of mailing is still reported if user have
! #	   not exited in that time when mailer have completed)
! 
! pgp
! # What is the path for pgp?
! # Possible values include:
! # 	none		Don't call pgp
! # 	/path		Call metamail via that path, if it is executable
! 
! lock-in-copy
! # If set, elm will lock a folder when trying to save or copy to it.
! # NOTICE: Does not work with dot-locking
Index: elm2.4.ME+.50/doc/elmrc.samp
*** elm2.4.25/doc/elmrc.samp	Sat May  8 23:08:48 1993
--- elm2.4.ME+.50/doc/elmrc.samp	Tue Nov 17 21:14:08 1998
***************
*** 1,193 ****
! #@(#)$Id: elmrc.samp,v 5.5 1993/05/08 20:08:43 syd Exp $
  #
  # .elm/elmrc - options file for the ELM mail system
  #
! # Saved automatically by ELM 2.4 for Elm Development Group
  #
  
! # For yes/no settings with ?, ON means yes, OFF means no
  
! # where to save calendar entries
! calendar = ~/.Agenda
  
! # what editor to use ("none" means simulate Berkeley Mail)
! # '%s' can be used as the temporary filename for the outgoing message
! editor = none
  
! # the character to use in the builtin editor for entering commands
! escape = ~
  
! # the full user name for outbound mail
! fullname = Elm Development Group
  
! # where to save received messages to, default file is "=received"
! receivedmail = $HOME/Mail/received
  
! # where to save my mail to, default directory is "Mail"
! maildir = /users/elmdev/Mail
  
! #directory to hold my temporary files to avoid NFS cross mount problems
! tmpdir = /users/elmdev/Mail/tmp
  
! # program to use for displaying messages ('builtin' is recommended)
! pager = builtin
  
! # prefix sequence for indenting included message text in outgoing messages...
! prefix = >_
  
! # how to print a message ('%s' is the filename)
! print = lpr -Plw2 %s
  
  # attribution string for replies ('%s' is the author of original message)
! attribution = According to %s:
! 
! # where to save copies of outgoing mail to, default file is "=sent"
! sentmail = /users/elmdev/Mail/mail.sent
  
! # the shell to use for shell escapes
! shell = /bin/csh
  
! # local ".signature" file to append to appropriate messages...
! localsignature = localsig
  
! # remote ".signature" file to append to appropriate messages...
! remotesignature =  remotesig
  
! # do we want dashes above signatures? (News 2.11 compatibility and convention)
! sigdashes = ON
  
! # how to sort folders, "Reverse Sent" by default
! sortby = Reverse-Received
  
! # should the default be to delete messages we've marked for deletion?
! alwaysdelete = ON
  
! # should the default be to store read messages to the "received" folder?
! alwaysstore = ON
  
! # should the default be to keep unread messages in the incoming mailbox?
! alwayskeep = ON
  
! # should we use the "->" rather than the inverse video bar?
! arrow = OFF
  
! # should the message disposition questions be displayed(ON) or
! # auto-answered(OFF) with the default answers when we resync or change folders?
! ask = ON
  
! # would you like to be asked for Carbon-Copies information each msg?
! askcc = ON
  
! # automatically copy message being replied to into buffer? 
! autocopy = OFF
  
! # threshold for bouncing copies of remote uucp messages...
! # zero = disable function.
! bounceback = 0
  
! # save a copy of all outbound messages?
! copy = ON
  
  # do we want to be able to mail out AT&T Mail Forms?
! forms = OFF
  
  # should we keep folders from which all messages are deleted?
! keepempty = OFF
  
! # we're running on an HP terminal and want HOME, PREV, NEXT, etc...
! keypad = OFF
  
  # should we display the three-line 'mini' menu?
! menu = ON
  
  # would you like a copy of a message you send to an alias you are on?
! metoo = OFF
  
  # when using the page commands (+ - <NEXT> <PREV>) change the current
  # message pointer...?
  movepage = ON
  
  # just show the names when expanding aliases?
! names = ON
  
  # when messages are copied into the outbound buffer, don't include headers?
! noheader = ON
  
  # start up by pointing to the first new message received, if possible?
! pointnew = ON
  
  # prompt for a command after the external pager exits?
! promptafter = ON
  
! # emulate the mailx message increment mode (only increment after something
! # has been 'done' to a message, either saved or deleted, as opposed to 
! # simply each time something is touched)?
! resolve = ON
  
! # save messages, incoming and outbound, by login name of sender/recipient?
! savename = ON
  
! # save outbound messages by login name of sender/recipient even if the
! # associated folder doesn't already exist?
! forcename = OFF
  
! # are we running on an HP terminal and want HOME, PREV, NEXT, etc...?
! # (this implies "keypad=ON" too)
! softkeys = OFF
  
! # set the main prompt timeout for resynching...
! timeout = 60
  
! # display message title when displaying pages of message?
! titles = ON
  
! # are we good at it?  0=beginner, 1=intermediate, 2+ = expert!
! userlevel = 2
  
! # enable the weedout list to be read?
! weed = ON
  
! # what headers I DON'T want to see, ever.
! weedout = "Path:" "Via:" "Sent:" "Date" "Status:" "Original" "Phase" 
! 	"Subject:" "Fruit" "Sun" "Lat" "Buzzword" "Return" "Posted" 
! 	"Telephone" "Postal-Address" "Origin" "X-Sent-By-Nmail-V" "Resent" 
! 	"X-Location" "Source" "Mood" "Neuron" "Libido" "To:" "X-Mailer:" 
! 	"Full-Name:" "X-HPMAIL" "Cc:" "cc:" "Mmdf" "Network-" "Really-" 
! 	"Sender:" "Post" "Message-" "Relay-" "Article-" "Lines:" 
! 	"Approved:" "Xref:" "Organization:" 	"*end-of-user-headers*"
  
! # alternative addresses that I could receive mail from (usually a
! # forwarding mailbox) and don't want to have listed...
! alternatives = dsidev!elmdev  dsirel!elmdev  elmdev@dsidev  elmdev%dsidev  
  
! # list of delivery precedences allowed, or empty to allow anything
! # precedence may be followed by optional ":priority" specification
! precedences = special-delivery:urgent air-mail:urgent first-class bulk junk
  
! # name of Character Set used with MIME text/plain Content-type
! # US-ASCII is default. Be aware that if you use a national charset
! # elm probably needs metamail to display US-ASCII. Elm tries to 
! # know if that charset could display US-ASCII too, but the list
! # of us-ascii compatible charsets is not yet complete
! charset=US-ASCII
  
! # name of Character Set which the display supports. This is independent
! # of the above "charset".
! displaycharset=US-ASCII
  
! # list of Character Sets, which are more or less a superset of US-ASCII
! # so we know that we can display messages with charset=US-ASCII without
! # help of metamail
! compatcharsets = ISO-8859-1 ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5 ISO-8859-6 ISO-8859-7 ISO-8859-8 ISO-8859-9
  
  # would you like to use termcap/terminfo ti/te entries?
! usetite = ON
  
! # Value by which message count is incremented while reading a new mailbox.
! # Setting this value to a number larger than one will speed up the time it
! # takes to read a large mailbox when using a slow terminal.
! readmsginc = 5
  
! # time in seconds which Elm will wait after displaying a transient message
! # and before erasing it.  Can be 0 or positive integer.
! sleepmsg = 2
--- 1,371 ----
! #@(#)$Id: elmrc.samp,v 1.2 1998/11/08 18:20:15 hurtta Exp $
  #
  # .elm/elmrc - options file for the ELM mail system
  #
! # Saved automatically by ELM 2.4ME+ PL50 (25) for Kari E. Hurtta
  #
  
! #
! # For yes/no settings, ON means yes, OFF means no.
! #
! # Lines beginning with "#" (like this one!) are comments.
! #
! # The "###" lines mean that you do not have a value set and the system
! # default will be used.  The value shown was the default at the time
! # this file was created.  Yes...the default could have changed between
! # then and now.
! #
  
! # how to sort the alias list, "Name" by default
! aliassortby = Name
  
! # name of editor to use for replies that have text
! ### alteditor = /bin/vi 
  
! # alternative addresses that I could receive mail from (usually a
! # forwarding mailbox) and don't want to have listed...
! # alternatives = 
  
! # should the default be to delete messages we've marked for deletion?
! ### alwaysdelete = OFF
  
! # should the default be to keep unread messages in the incoming mailbox?
! ### alwayskeep = ON
  
! # should the default be to store read messages to the "received" folder?
! ### alwaysstore = OFF
  
! # should we use the "->" rather than the inverse video bar?
! ### arrow = OFF
  
! # should the message disposition questions be displayed(ON) or
! # auto-answered(OFF) with the default answers when we resync or
! # change folders?
! ### ask = ON
  
! # would you like to be asked for Carbon-Copies information each msg?
! ### askcc = ON
  
! # If ON, Elm will prompt you for a username with which to sign the pgp
! # message
! ### askpgpsig = OFF
  
  # attribution string for replies ('%s' is the author of original message)
! attribution = %s:
  
! # automatically copy message being replied to into buffer?
! autocopy = ON
  
! # If = 0  wait mailer to completion
! #    > 0  wait background_wait_time seconds for completion
! #         if not completed in this time, let it go to background
! #
! #	  (completion of mailing is still reported if user have
! #	   not exited in that time when mailer have completed)
! ### background-wait-time = 2
! 
! # This is used to determine if the builtin pager should be used on some
! # messages even if you would usually use an external pager program.
! # There are two ways of determining whether the builtin pager should be
! # used. If you want any message that is shorter than "n" lines to use the
! # internal pager, set the parameter to "n".  If you want the builtin
! # pager to be used if the message is "m" lines shorter than the number of
! # lines on your screen set the parameter to be "-m".  Setting the
! # parameter to zero will result in the message always being sent through
! # your external pager.
! ### builtinlines = -3
  
! # where to save calendar entries
! ### calendar = /home/people/hurtta/
  
! # name of Character Set used with MIME text/plain Content-type
! # US-ASCII is default. Be aware that if you use a national charset
! # elm probably needs metamail to display US-ASCII. Special value
! # DISPLAY means that Charcter Set used in content-type is same
! # which the display supports (see: displaycharset)
! charset = DISPLAY
  
! # list of Character Sets, which are more or less a superset of US-ASCII
! # so we know that we can display messages with charset=US-ASCII without
! # help of metamail
! ### compatcharsets = ISO-8859-1 ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5 ISO-8859-7 ISO-8859-8 ISO-8859-9 KOI8-R X-ROMAN8
  
! # list of options that can be configured at the "o)ptions" screen
! ### configoptions = ^_defspyv_am_un_ho
  
! # Should elm always ask the user to confirm before it appends
! # messages to any existing file?
! # This is used for both folders in the user's mail directory
! # and ordinary files.
! ### confirmappend = OFF
! 
! # Should elm always ask the user to confirm before it creates
! # any new files?
! # This is used for both folders in the user's mail directory
! # and ordinary files.
! ### confirmcreate = OFF
! 
! # Should elm ask for confirmation before it appends a message
! # to an existing file that is not a folder in the user's Mail
! # directory?
! # This is used for ordinary files only and does not affect
! # folders in the user's mail directory.
! ### confirmfiles = OFF
! 
! # Should elm ask for confirmation before it creates a new folder
! # in the user's Mail directory?
! # This is used only for folders in the user's mail directory and
! # does not affect ordinary files.
! ### confirmfolders = OFF
  
! # save a copy of all outbound messages?
! copy = ON
  
! # name of Character Set which the display supports. This is independent
! # of the above "charset". This is also copied to environment variable 
! # MM_CHARSET when metamail is called. This is used only as default
! # on systems which supports locale. In these systems LC_CTYPE locale
! # is mapped to Character Set. Mapping is given in file elm.mimecharsets
! # on elm library directory or on file .elm/mime.charsets
! ### displaycharset = ISO-8859-1
  
! # If TRUE, success Delivery-Status-Notifications are asked by default.
! dsn-success = ON
  
! # name of editor for ~e command (when editor="builtin")
! ### easyeditor = emacs
  
! # what editor to use ("none" means simulate Berkeley Mail)
! ### editor = /bin/vi 
  
! # the character to use in the builtin editor for entering commands
! ### escape = ~
  
! # save outbound messages by login name of sender/recipient even if the
! # associated folder doesn't already exist?
! ### forcename = OFF
  
  # do we want to be able to mail out AT&T Mail Forms?
! ### forms = OFF
  
+ # The full user name for outbound mail
+ ### fullname = Kari E. Hurtta
+ 
  # should we keep folders from which all messages are deleted?
! ### keepempty = OFF
! 
! # The number of seconds Elm should remember your passphrase.  -1 means never
! # expire it.
! ### keeppassfor = 300
! 
! # local ".signature" file to append to appropriate messages...
! ### localsignature = 
! 
! # If set, elm will lock a folder when trying to save or copy to it.
! # NOTICE: Does not work with dot-locking
! ### lock-in-copy = ON
! 
! # where to save my mail to, default directory is "Mail"
! ### maildir = /home/people/hurtta/Mail
  
! # permissions to be given to newly-created saved mail files, default rw-------
! ### mailpermissions = rw-------
  
  # should we display the three-line 'mini' menu?
! ### menu = ON
! 
! # This tells path of metamail program
! #
! # That version (Elm 2.4ME+) does not use Metamail's companion programs 
! # (suchs as mmencode) directly, but metamail package supposes that
! # companion programs are installed to search path.
! #
! # Special values:   none		Don't call metamail
! #		    metamail		Don't call metamail if environment
! #						variable $NOMETAMAIL is defined
! ### metamail = /usr/freeware/bin/metamail
  
  # would you like a copy of a message you send to an alias you are on?
! ### metoo = OFF
  
+ # This option controls how Elm will forward messages when MIME is defined.
+ #	ON: Causes Elm to send the message as a MIME attachment of type
+ #		MESSAGE/RFC822.  Highly recommended when forwarding MIME
+ #		messages so that the receiver can correctly view the message!
+ #	OFF: Elm will include the forwarded message in your editor instead
+ #		of making it an attachment.
+ mimeforward = ON
+ 
  # when using the page commands (+ - <NEXT> <PREV>) change the current
  # message pointer...?
  movepage = ON
  
  # just show the names when expanding aliases?
! ### names = ON
! 
! # This control makes it possible to send raw 8bit or binary data when the MTA
! # doesn't support 8BITMIME and the -B8BITMIME option or
! # BINARYMIME and the -BBINARYMIME option
! #
! # Possible values:
! #    pass-7bit (0)   : Always convert 8BIT and BINARY data to QUOTED-PRINTABLE 
! #                      if the MTA doesn't support the -B8BITMIME and 
! #                      -BBINARYMIME options.
! #    pass-8bit (1)   : Allow 8bit without -B8BITMIME, but binary data is 
! #                      encoded
! #    pass-binary (2) : Allow binary without -BBINARYMIME and and 8bit without 
! #                      -B8BITMIME
! #
! # It is STRONGLY recommended that it be left set to pass-7bit unless you know 
! # what you are doing!!
! #
! # Elm doesn't yet fully support BINARYMIME: it requires that text lines are
! # terminated with \r\n, Unix's \n isn't sufficient!
! # That is only partially implemented in this version of Elm.
! #
! # Quote from RFC 1830 (Experimental Protocol): 
! #  SMTP Service Extensions for Transmission of Large and Binary MIME Messages
! #
! #      It is important to note that when using BINARYMIME, it is
! #      especially important to ensure that the MIME message itself is
! #      properly formed.  In particular, it is essential that text be
! #      canonically encoded with each line properly terminated with <CR>
! #      <LF>.  Any transformation of text into non-canonical MIME to
! #      observe local storage conventions must be reversed before sending
! #      as BINARYMIME.  The usual line-oriented shortcuts will break if
! #      used with BINARYMIME.
! ### noencoding = pass-7bit
! 
! # Don't do MIME part 2 (RFC 1522) encoding for 8-bit headers?
! # Because 8-bit data is not allowed in headers, 
! # it is STRONGLY recommended that this is left set to OFF
! ### nohdrencoding = OFF
! 
! # when messages are copied into the outbound buffer, don't include headers?
! # when replying
! ### noheader = ON
  
  # when messages are copied into the outbound buffer, don't include headers?
! # when forwarding 	
! # (Notice that messages are not copiend to outbound buffer when
! #  mimeworward = ON)
! ### noheaderfwd = OFF
! 
! # Should Elm use "pager" for display one part of multipart/alternative,
! # if there are found one part which can be displayed. If not
! # set, Elm uses "pager" for display one part of multipart/alternative,
! # if are parts are displayable.
! ### pagealternative = ON
! 
! # Should Elm use "pager" to display MIME multipart messages
! # with unknown subparts or with unknown subtype?
! ### pagemultipart = OFF
! 
! # program to use for displaying messages ('builtin' is recommended)
! pager = builtin
  
+ # What is the path for pgp?
+ # Possible values include:
+ # 	none		Don't call pgp
+ # 	/path		Call metamail via that path, if it is executable
+ pgp = /usr/local/pgp/bin/pgp
+ 
  # start up by pointing to the first new message received, if possible?
! ### pointnew = ON
! 
! # list of delivery precedences allowed, or empty to allow anything
! # precedence may be followed by optional ":priority" specification
! ### precedences = 
! 
! # prefix sequence for indenting included message text in outgoing messages...
! ### prefix = >_
! 
! # how to print a message ('%s' is the filename)
! print = mpage -o2p -Parth7bw %s
  
  # prompt for a command after the external pager exits?
! ### promptafter = ON
  
! # Forwarded messages are quoted like replies, rather than included
! # with "Forwarded message" and "End of forwarded message" banners 
! # above and below. This don't have effect if "mimeforward" is TRUE.
! ### quoteforward = OFF
  
! # Value by which message count is incremented while reading a new mailbox.
! # Setting this value to a number larger than one will speed up the time it
! # takes to read a large mailbox when using a slow terminal.
! readmsginc = 25
  
! # where to save received messages to, default file is "=received"
! ### receivedmail = =received
  
! # remote ".signature" file to append to appropriate messages...
! ### remotesignature = 
  
! # If set MIME Part 1 (RFC 1521) decoding is only done when MIME-version
! # header is present. Default: True
! ### require-mime-version-for-body-encoding = ON
! 
! # If set MIME Part 2 (RFC 1522) decoding is only done when MIME-version
! # header is present. Default: False
! ### require-mime-version-for-hdr-encoding = OFF
! 
! # emulate the mailx message increment mode (only increment after
! # something has been 'done' to a message, either saved or deleted,
! # as opposed to simply each time something is touched)?
! ### resolve = ON
  
! # save messages, incoming and outbound, by login name of sender/recipient?
! ### savename = ON
  
! # where to save copies of outgoing mail to, default file is "=sent"
! ### sentmail = =sent
  
! # The shell to use for shell escapes
! # If not set value from passwd is used
! ### shell = $SHELL
! 
! # if this variable is ON, display text before PGP armor.
! ### showpgppreamble = ON
! 
! # if this variable is ON, Elm will show who the message is to rather than
! # who it is from in the headers display.
! ### showto = OFF
  
! # do we want dashes above signatures? (News 2.11 compatibility and convention)
! ### sigdashes = ON
  
! # time in seconds which Elm will wait after displaying a transient message
! # and before erasing it.  Can be 0 or positive integer.
! ### sleepmsg = 2
  
! # how to sort folders, "Reverse Sent" by default
! sortby = Reverse-Sent
  
! # Set the main prompt timeout for resynching...
! ### timeout = 600
  
! # display message title when displaying pages of message?
! ### titles = ON
  
! # where to place temporary files, default directory is "/tmp"
! ### tmpdir = /usr/tmp/
  
+ # If ON, Elm will prompt you for your PGP passphrase and use it whenever
+ # necessary to make it more convenient to hand PGP messages.
+ usepgppass = ON
+ 
+ # are we good at it?  beginner (0), intermediate (1), expert (2)
+ userlevel = intermediate
+ 
  # would you like to use termcap/terminfo ti/te entries?
! ### usetite = ON
  
! # name of editor for ~v command (when editor="builtin")
! ### visualeditor = /bin/vi 
  
! # enable the weedout list to be read?
! ### weed = ON
! 
! # what headers I DON'T want to see, ever.
! ### weedout = "*end-of-user-headers*"
Index: elm2.4.ME+.50/doc/mime.types
*** /tmp/8255-very-long-file-name-NULL-comes-in-here	Sun Nov 22 09:14:43 1998
--- elm2.4.ME+.50/doc/mime.types	Tue Nov 17 21:12:54 1998
***************
*** 0 ****
--- 1,27 ----
+ # mime.types for Elm 2.4PL24 ME8 (or greater)
+ #
+ # Format of this file:
+ # <suffix> <content-type>
+ #
+ # Elm already has the following "builtin" definitions:
+ # ps	application/postscript
+ # gif	image/gif
+ # tiff	image/tiff
+ # jpeg	image/jpeg
+ #
+ # NOTE: data which is declared "application/octet-stream" will automatically
+ # have the "name=<default_filename>" option added to it, so you should not
+ # put it in your definitions.
+ 
+ gz	application/octet-stream
+ pbm	image/pbm
+ pgm	image/pgm
+ ppm	image/ppm
+ taz	application/octet-stream; type=tar; conversions=x-compress
+ tgz	application/octet-stream; type=tar; conversions=x-gzip
+ tar	application/octet-stream; type=tar
+ Z	application/octet-stream
+ zip	application/octet-stream; type=zip
+ 
+ # PGP users might want the following
+ pgp	application/pgp
Index: elm2.4.ME+.50/doc/tmac.n
*** elm2.4.25/doc/tmac.n	Mon Apr 12 04:35:36 1993
--- elm2.4.ME+.50/doc/tmac.n	Tue Nov 17 21:12:54 1998
***************
*** 1,4 ****
! .\" @(#)$Id: tmac.n,v 5.5 1993/04/12 01:35:29 syd Exp $
  .\" The News macro package
  .\"
  .\" This  is  the macro package that is used to format news documents.  It
--- 1,4 ----
! .\" @(#)$Id: tmac.n,v 1.1.1.1 1998/10/15 15:36:39 hurtta Exp $
  .\" The News macro package
  .\"
  .\" This  is  the macro package that is used to format news documents.  It
Index: elm2.4.ME+.50/filter/Makefile.SH
*** elm2.4.25/filter/Makefile.SH	Sun Jun  6 20:35:08 1993
--- elm2.4.ME+.50/filter/Makefile.SH	Tue Nov 17 21:12:54 1998
***************
*** 21,58 ****
  fi
  cat >Makefile <<!GROK!THIS!
  #
! # @(#)$Id: Makefile.SH,v 5.5 1993/06/06 17:35:04 syd Exp $
  #  Makefile for the Elm system filter program
  #
  #         (C) Copyright 1986,1987, by Dave Taylor
  #         (C) Copyright 1988-1992, USENET Community Trust
  #
- # Bug reports, patches, comments, suggestions should be sent to:
- #
- #	Syd Weinstein - elm@DSI.COM
- #			dsinc!elm
- #
- #  $Log: Makefile.SH,v $
- # Revision 5.5  1993/06/06  17:35:04  syd
- # Remove useless buffer.c
- #
- # Revision 5.4  1993/02/03  16:22:06  syd
- # add libutil.a as strtokq moved to lib
- #
- # Revision 5.3  1993/01/27  19:40:01  syd
- # I implemented a change to filter's default verbose message format
- # including %x %X style date and time along with username
- # From: mark@drd.com (Mark Lawrence)
  #
- # Revision 5.2  1992/11/15  01:40:43  syd
- # Add regexp processing to filter.
- # Add execc operator
- # From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
- #
- # Revision 5.1  1992/10/03  22:18:09  syd
- # Initial checkin as of 2.4 Release at PL0
- #
- #
  # Variables
  #	Variables established by Configure
  CC		=	$cc
--- 21,34 ----
  fi
  cat >Makefile <<!GROK!THIS!
  #
! # @(#)$Id: Makefile.SH,v 1.2 1998/10/20 19:57:27 hurtta Exp $
! #
  #  Makefile for the Elm system filter program
  #
  #         (C) Copyright 1986,1987, by Dave Taylor
  #         (C) Copyright 1988-1992, USENET Community Trust
  #
  #
  # Variables
  #	Variables established by Configure
  CC		=	$cc
***************
*** 86,92 ****
  #	Other variables
  BIN		=	../bin
  INCLDIR		=	../hdrs
! CFLAGS		=	$(CCFLAGS) $(OPTIMIZE) -I$(INCLDIR) $(DEBUG) $(DACSNET) 
  LINTFLAGS	=	-I$(INCLDIR)
  SHELL		=	/bin/sh
  
--- 62,68 ----
  #	Other variables
  BIN		=	../bin
  INCLDIR		=	../hdrs
! CFLAGS		=	-I$(INCLDIR) $(CCFLAGS) $(OPTIMIZE) $(DEBUG) $(DACSNET) 
  LINTFLAGS	=	-I$(INCLDIR)
  SHELL		=	/bin/sh
  
***************
*** 109,121 ****
  			rules.o		\
  			summarize.o	\
  			utils.o		\
! 			audit.o		\
! 			../lib/libutil.a
  
  # Standard targets
! all:		$(BIN)/filter
  		
! install:	$(DEST)/filter
  
  uninstall:	
  		$(RM) $(DEST)/filter
--- 85,100 ----
  			rules.o		\
  			summarize.o	\
  			utils.o		\
! 			audit.o		
  
  # Standard targets
! all:		Makefile $(BIN)/filter
  		
! install:	Makefile $(DEST)/filter
! 
! Makefile: Makefile.SH ../config.sh
! 	@echo "You must run 'sh Configure -S' or 'sh Configure'"
! 	exit 1
  
  uninstall:	
  		$(RM) $(DEST)/filter
***************
*** 162,176 ****
  			$(TOUCH) $@
  
  #	Dependencies and rules for C object files
! actions.o:		$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h
! filter.o:		$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h
! lock.o:			$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h
! parse.o:		$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h
! regexp.o:		$(INCLDIR)/defs.h $(INCLDIR)/regexp.h
! rules.o:		$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h
! summarize.o:		$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h
! utils.o:		$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h
! audit.o:		$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h
  
  #	Dependencies and rules for compiling programs
  $(BIN)/filter:	$& $(FILTER_OBJ)
--- 141,155 ----
  			$(TOUCH) $@
  
  #	Dependencies and rules for C object files
! actions.o:		$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h $(INCLDIR)/elmlib.h
! filter.o:		$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h $(INCLDIR)/elmlib.h
! lock.o:			$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h $(INCLDIR)/elmlib.h
! parse.o:		$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h $(INCLDIR)/elmlib.h
! regexp.o:		$(INCLDIR)/defs.h $(INCLDIR)/regexp.h $(INCLDIR)/elmlib.h
! rules.o:		$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h $(INCLDIR)/elmlib.h
! summarize.o:		$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h $(INCLDIR)/elmlib.h
! utils.o:		$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h $(INCLDIR)/elmlib.h
! audit.o:		$(INCLDIR)/defs.h $(INCLDIR)/filter.h $(INCLDIR)/s_filter.h $(INCLDIR)/elmlib.h
  
  #	Dependencies and rules for compiling programs
  $(BIN)/filter:	$& $(FILTER_OBJ)
Index: elm2.4.ME+.50/filter/actions.c
*** elm2.4.25/filter/actions.c	Tue Aug  3 22:28:40 1993
--- elm2.4.ME+.50/filter/actions.c	Tue Nov 17 21:12:54 1998
***************
*** 1,73 ****
  
! static char rcsid[] ="@(#)$Id: actions.c,v 5.8 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein - elm@DSI.COM
!  *			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: actions.c,v $
!  * Revision 5.8  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.7  1993/08/03  19:07:58  syd
!  * Removed bogus string lockfile.
!  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
!  *
!  * Revision 5.6  1993/04/21  01:25:45  syd
!  * I'm using Elm 2.4.21 under Linux.  Linux has no Bourne shell.  Each
!  * user installs her favorite shell as /bin/sh.  I use Bash 1.12.
!  *
!  * Elm invokes the mail transport (MTA) like so:
!  *
!  *    ( ( MTA destination; rm -f tempfile ) & ) < tempfile &
!  *
!  * This form of command doesn't work with my Bash, in which any command
!  * which is backgrounded ("&") gets its stdin attached to /dev/null.
!  *
!  * The below patch arranges for Elm to call the MTA thusly:
!  *
!  *    ( MTA destination <tempfile; rm -f tempfile ) &
!  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
!  *
!  * Revision 5.5  1993/01/27  19:40:01  syd
!  * I implemented a change to filter's default verbose message format
!  * including %x %X style date and time along with username
!  * From: mark@drd.com (Mark Lawrence)
!  *
!  * Revision 5.4  1993/01/20  03:37:16  syd
!  * Nits and typos in the NLS messages and corresponding default messages.
!  * From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
!  *
!  * Revision 5.3  1992/12/24  19:22:05  syd
!  * Quote from the filter of phrase to prevent RFC-822 parsing problems
!  * From: Syd via request from Ian Stewartson <istewart@dlvax2.datlog.co.uk>
!  *
!  * Revision 5.2  1992/12/11  02:16:08  syd
!  * remove unreachable return(0) at end of function
!  * From: Syd
!  *
!  * Revision 5.1  1992/10/03  22:18:09  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  
  /** RESULT oriented routines *chuckle*.  These routines implement the
--- 1,16 ----
  
! static char rcsid[] ="@(#)$Id: actions.c,v 1.2 1998/10/20 19:57:27 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  
  /** RESULT oriented routines *chuckle*.  These routines implement the
***************
*** 78,85 ****
--- 21,32 ----
  #include <stdio.h>
  #include <pwd.h>
  #include <fcntl.h>
+ #include <errno.h>
+ extern int errno;
  
  #include "defs.h"
+ #include "elmlib.h"
+ 
  #include "filter.h"
  #include "s_filter.h"
  
***************
*** 97,103 ****
         */
  
  	FILE *pipefd, *tempfd, *mailfd;
! 	int  in_header = TRUE, line_count = 0, mailunit, pid, statusp;
  	char tempfile[SLEN], mailbox[SLEN],
  	     buffer[VERY_LONG_STRING], *cp;
  
--- 44,51 ----
         */
  
  	FILE *pipefd, *tempfd, *mailfd;
! 	int  in_header = TRUE, line_count = 0, mailunit, pid,sig;
! 	S__ statusp;
  	char tempfile[SLEN], mailbox[SLEN],
  	     buffer[VERY_LONG_STRING], *cp;
  
***************
*** 107,113 ****
  		  date_n_user(), address);
  
  	if (! show_only) {
! 	  sprintf(tempfile, "%s.%d", filter_temp, getpid());
  
  	  if ((tempfd = fopen(tempfile, "r")) == NULL) {
  	    if (outfd != NULL)
--- 55,63 ----
  		  date_n_user(), address);
  
  	if (! show_only) {
! 	  elm_sfprintf(tempfile, sizeof tempfile,
! 		       FRM("%s.%d"), 
! 		       filter_temp, getpid());
  
  	  if ((tempfd = fopen(tempfile, "r")) == NULL) {
  	    if (outfd != NULL)
***************
*** 134,142 ****
  	    }
  
  	    if (strcmp(sendmail, mailer) == 0)
! 	      sprintf(buffer, "%s %s %s", sendmail, smflags, address);
  	    else
! 	      sprintf(buffer, "%s %s", mailer, address);
  
  	    /*
  	     * we do a fork/exec here to prevent evil people
--- 84,96 ----
  	    }
  
  	    if (strcmp(sendmail, mailer) == 0)
! 	      elm_sfprintf(buffer, sizeof buffer,
! 			   FRM("%s -oi -oem %s"), 
! 			   sendmail, address);
  	    else
! 	      elm_sfprintf(buffer, sizeof buffer,
! 			   FRM("%s %s"), 
! 			   mailer, address);
  
  	    /*
  	     * we do a fork/exec here to prevent evil people
***************
*** 145,163 ****
  	    
  	    if ( (pid=fork()) > 0 ) /* we're the parent */
  	      {
! 		    wait(&statusp);
! 		    if (statusp!=0)
  		      {
  			    fprintf(outfd,
  				    catgets(elm_msg_cat,
  					    FilterSet,FilterBadWaitStat,
  		    "filter (%s): Command \"%s\" exited with value %d\n"),
! 				    date_n_user(),buffer,statusp);
  		      }
  	      }
  	    else if (pid==0) /* we're the child */
  	      {
! 		    /* use safe permissions */
  		    
  		    setuid(user_uid);
  		    setgid(user_gid);
--- 99,134 ----
  	    
  	    if ( (pid=fork()) > 0 ) /* we're the parent */
  	      {
! 		int w;
! 		while (pid != (w = my_wait(pid,&statusp)) &&
! 		       -1 != w || EINTR == errno);
! 
! 		if (w != pid) {
! 		  fprintf(outfd,
! 			  "filter (%s): Command \"%s\", wait failed (erro = %d) \n",
! 			  date_n_user(),buffer,errno);
! 		
! 		} else {
! 		  int sig, stat;
! 		  sig = convert_status(statusp,&stat);
! 		  if (sig) {
! 		    fprintf(outfd,
! 			    "filter (%s): Command \"%s\" died with signal = %d\n",
! 			    date_n_user(),buffer,sig);
! 
! 		  } else if (stat!=0)
  		      {
  			    fprintf(outfd,
  				    catgets(elm_msg_cat,
  					    FilterSet,FilterBadWaitStat,
  		    "filter (%s): Command \"%s\" exited with value %d\n"),
! 				    date_n_user(),buffer,stat);
  		      }
+ 		}
  	      }
  	    else if (pid==0) /* we're the child */
  	      {
! 		      /* use safe permissions */
  		    
  		    setuid(user_uid);
  		    setgid(user_gid);
***************
*** 167,175 ****
  			    fprintf(outfd,catgets(elm_msg_cat,
  						  FilterSet,FilterPopenFailed,
  		  "filter (%s): popen %s failed!\n"), date_n_user(), buffer);
! 			  sprintf(buffer, "(%s %s %s < %s ; %s %s) &",
! 				  sendmail, smflags, address, tempfile,
! 				  remove_cmd, tempfile);
  			  exit(system(buffer));
  		    }
  		    
--- 138,147 ----
  			    fprintf(outfd,catgets(elm_msg_cat,
  						  FilterSet,FilterPopenFailed,
  		  "filter (%s): popen %s failed!\n"), date_n_user(), buffer);
! 			  elm_sfprintf(buffer, sizeof buffer,
! 				       FRM("(%s -oi -oem %s < %s ; %s %s) &"),
! 				       sendmail, address, tempfile,
! 				       remove_cmd, tempfile);
  			  exit(system(buffer));
  		    }
  		    
***************
*** 218,224 ****
  	  
  	  /** OTHERWISE it is to the current user... **/
  
! 	  sprintf(mailbox, "%s%s", mailhome, username);
  
  	  if (!lock()) {
  	    if (outfd != NULL) {
--- 190,198 ----
  	  
  	  /** OTHERWISE it is to the current user... **/
  
! 	  elm_sfprintf(mailbox, sizeof mailbox,
! 		       FRM("%s%s"), 
! 		       mailhome, username);
  
  	  if (!lock()) {
  	    if (outfd != NULL) {
***************
*** 256,263 ****
  	} /* end if show only */
  }
  
! save_message(foldername)
! char *foldername;
  {
  	/** Save the message in a folder.  Use full file buffering to
  	    make this work without contention problems **/
--- 230,238 ----
  	} /* end if show only */
  }
  
! int save_message(foldername, namesize)
!      char *foldername;
!      int namesize;
  {
  	/** Save the message in a folder.  Use full file buffering to
  	    make this work without contention problems **/
***************
*** 269,275 ****
  	     statusp, ret;
  
  	/* allow for ~ file names expansion in rules */
! 	(void) expand_filename(foldername);
  
  	if (verbose && outfd != NULL)
  	  fprintf(outfd, catgets(elm_msg_cat,FilterSet,FilterSavedMessage,
--- 244,250 ----
  	     statusp, ret;
  
  	/* allow for ~ file names expansion in rules */
! 	(void) expand_filename(foldername, namesize);
  
  	if (verbose && outfd != NULL)
  	  fprintf(outfd, catgets(elm_msg_cat,FilterSet,FilterSavedMessage,
***************
*** 292,298 ****
  	      
  	      if ((pid=fork()) > 0) /* we're the parent */
  	      {
! 		    wait(&statusp);
  		    return(statusp);
  			  
  	      }
--- 267,273 ----
  	      
  	      if ((pid=fork()) > 0) /* we're the parent */
  	      {
! 		    my_wait(pid,&statusp);
  		    return(statusp);
  			  
  	      }
***************
*** 351,357 ****
        char  filename[SLEN], buffer[SLEN];
        int   fdunit;
        
!       sprintf(filename, "%s.%d", filter_temp, filter_pid);
        
        if ((fdunit = open(foldername,
  			 O_APPEND | O_WRONLY | O_CREAT, 0600)) < 0) {
--- 326,334 ----
        char  filename[SLEN], buffer[SLEN];
        int   fdunit;
        
!       elm_sfprintf(filename, sizeof filename,
! 		   FRM("%s.%d"), 
! 		   filter_temp, filter_pid);
        
        if ((fdunit = open(foldername,
  			 O_APPEND | O_WRONLY | O_CREAT, 0600)) < 0) {
***************
*** 407,418 ****
  	       "filter (%s): Executing %s\n"), date_n_user(), command);
  
  	if (! show_only) {
! 	      sprintf(buffer, "%s %s.%d | %s",
! 		      cat, filter_temp, getpid(), command);
  
  	      if ( (pid=fork()) > 0) /* we're the parent */
  		{
! 		      wait(&statusp);
  		      if (statusp!=0)
  			{
  			      fprintf(outfd,
--- 384,396 ----
  	       "filter (%s): Executing %s\n"), date_n_user(), command);
  
  	if (! show_only) {
! 	      elm_sfprintf(buffer, sizeof buffer,
! 			   FRM("%s < %s.%d"),
! 			   command, filter_temp, getpid());
  
  	      if ( (pid=fork()) > 0) /* we're the parent */
  		{
! 		      my_wait(pid,&statusp);
  		      if (statusp!=0)
  			{
  			      fprintf(outfd,
***************
*** 455,461 ****
  	char  mailbox[SLEN];
  	int   mailunit;
  
! 	sprintf(mailbox, "%s/%s", home, EMERGENCY_MAILBOX);
  
  	if ((mailunit = open(mailbox, O_APPEND | O_WRONLY | O_CREAT, 0600)) < 0) {
  	  if (outfd != NULL)
--- 433,441 ----
  	char  mailbox[SLEN];
  	int   mailunit;
  
! 	elm_sfprintf(mailbox, sizeof mailbox,
! 		     FRM("%s/%s"), 
! 		     home, EMERGENCY_MAILBOX);
  
  	if ((mailunit = open(mailbox, O_APPEND | O_WRONLY | O_CREAT, 0600)) < 0) {
  	  if (outfd != NULL)
***************
*** 463,469 ****
  				 "filter (%s): Can't open %s either!!\n"),
  		    date_n_user(), mailbox);
  
! 	  sprintf(mailbox,"%s/%s", home, EMERG_MBOX); 
  
  	  if ((mailunit = open(mailbox, O_APPEND | O_WRONLY | O_CREAT, 0600)) < 0) {
  
--- 443,451 ----
  				 "filter (%s): Can't open %s either!!\n"),
  		    date_n_user(), mailbox);
  
! 	  elm_sfprintf(mailbox,sizeof mailbox,
! 		       FRM("%s/%s"), 
! 		       home, EMERG_MBOX); 
  
  	  if ((mailunit = open(mailbox, O_APPEND | O_WRONLY | O_CREAT, 0600)) < 0) {
  
***************
*** 498,500 ****
--- 480,483 ----
  	tempfd = fdopen(mailunit, "a");
  	return((FILE *) tempfd);
  }
+ 
Index: elm2.4.ME+.50/filter/audit.c
*** elm2.4.25/filter/audit.c	Tue Feb  9 21:04:48 1993
--- elm2.4.ME+.50/filter/audit.c	Tue Nov 17 21:12:54 1998
***************
*** 1,30 ****
  
! static char rcsid[] ="@(#)$Id: audit.c,v 5.3 1993/02/09 19:04:38 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein - elm@DSI.COM
!  *			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: audit.c,v $
!  * Revision 5.3  1993/02/09  19:04:38  syd
!  * use standard include method on time.h style includes
!  *
!  * Revision 5.2  1993/01/27  21:30:10  syd
!  * fix include syntax
!  *
!  * Revision 5.1  1993/01/27  19:40:18  syd
!  * Initial checkin
!  *
!  *
!  ******************************************************************************/
  
  
  /** allow date/time to be combined with username in verbose audit
--- 1,16 ----
  
! static char rcsid[] ="@(#)$Id: audit.c,v 1.2 1998/10/20 19:57:27 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  
  /** allow date/time to be combined with username in verbose audit
***************
*** 35,48 ****
  #include <fcntl.h>
  #include <errno.h>
  
- #ifdef I_TIME
- #  include <time.h>
- #endif
- #ifdef I_SYSTIME
- #  include <sys/time.h>
- #endif
- 
  #include "defs.h"
  #include "filter.h"
  #include "s_filter.h"
  
--- 21,29 ----
  #include <fcntl.h>
  #include <errno.h>
  
  #include "defs.h"
+ #include "elmlib.h"
+ 
  #include "filter.h"
  #include "s_filter.h"
  
***************
*** 54,59 ****
--- 35,41 ----
      static char     date[NLEN];
      static char    *stuff = NULL;
      time_t          now;
+     int size;
  
      now = time(NULL);
      if (!strftime(date, NLEN, "%c", localtime(&now)))
***************
*** 60,68 ****
          return (username);
      if (stuff)
          free(stuff);
!     if (!(stuff = malloc(strlen(username) + strlen(date) + 3)))
!         return (username);
!     sprintf(stuff, "%s %s", date, username);
! 	return(stuff);
  }
  
--- 42,49 ----
          return (username);
      if (stuff)
          free(stuff);
!     
!     stuff = elm_message("%s %s", date, username);
!     return(stuff);
  }
  
Index: elm2.4.ME+.50/filter/filter.c
*** elm2.4.25/filter/filter.c	Mon May 30 19:31:55 1994
--- elm2.4.ME+.50/filter/filter.c	Tue Nov 17 21:14:08 1998
***************
*** 1,62 ****
  
! static char rcsid[] ="@(#)$Id: filter.c,v 5.7 1994/05/30 16:31:40 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein - elm@DSI.COM
!  *			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: filter.c,v $
!  * Revision 5.7  1994/05/30  16:31:40  syd
!  * make getpwuid dependent on ANSI_C not posix flag
!  * From: Syd
!  *
!  * Revision 5.6  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.5  1993/06/06  17:58:20  syd
!  * make white space skipping work for blank or tab
!  *
!  * Revision 5.4  1993/01/27  19:40:01  syd
!  * I implemented a change to filter's default verbose message format
!  * including %x %X style date and time along with username
!  * From: mark@drd.com (Mark Lawrence)
!  *
!  * Revision 5.3  1992/11/15  01:40:43  syd
!  * Add regexp processing to filter.
!  * Add execc operator
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.2  1992/11/07  16:20:56  syd
!  * The first is that when doing a summary, macros are expanded when printing the
!  * rule. IMHO they should be printed as with the -r option (i.e. %t is
!  * printed as "<time>" and so on).
!  *
!  * The second one is that the summary printed "applied n time" regardless of
!  * the value of n, not "applied n times" when n > 1.
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.1  1992/10/03  22:18:09  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  
  /** This program is used as a filter within the users ``.forward'' file
--- 1,16 ----
  
! static char rcsid[] ="@(#)$Id: filter.c,v 1.3 1998/11/07 14:12:00 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.3 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  
  /** This program is used as a filter within the users ``.forward'' file
***************
*** 81,94 ****
  #include <stdio.h>
  #include <pwd.h>
  #include "defs.h"
! #ifdef I_TIME
! #  include <time.h>
! #endif
! #ifdef I_SYSTIME
! #  include <sys/time.h>
! #endif
  #include <fcntl.h>
  
  #define  MAIN_ROUTINE			/* for the filter.h file, of course! */
  #include "filter.h"
  #include "s_filter.h"
--- 35,45 ----
  #include <stdio.h>
  #include <pwd.h>
  #include "defs.h"
! #include "elmlib.h"
! 
  #include <fcntl.h>
  
+  
  #define  MAIN_ROUTINE			/* for the filter.h file, of course! */
  #include "filter.h"
  #include "s_filter.h"
***************
*** 95,103 ****
  
  extern char *date_n_user();
  
! main(argc, argv)
! int argc;
! char *argv[];
  {
  	extern char *optarg;
  	FILE   *fd;				/* for output to temp file! */
--- 46,60 ----
  
  extern char *date_n_user();
  
! static void save_from P_((char *)); /* Prototype */
! static void save_subject P_((char *));
! static void save_sender P_((char *));
! static void save_to P_((char *));
! static void save_embedded_address P_((char *, char *));
! 
! int main(argc, argv)
!      int argc;
!      char *argv[];
  {
  	extern char *optarg;
  	FILE   *fd;				/* for output to temp file! */
***************
*** 113,146 ****
  	     summary   = FALSE,			/* a summary is requested?  */
  	     c;					/* var for getopt routine   */
  
! #ifdef I_LOCALE
!         setlocale(LC_ALL, "");
! #endif
! 
!         elm_msg_cat = catopen("elm2.4", 0);
! 
  		
! 	/* first off, let's get the info from /etc/passwd */ 
! 	
! 	if ((passwd_entry = getpwuid(getuid())) == NULL) 
! 	  leave(catgets(elm_msg_cat,FilterSet,FilterCantGetPasswdEntry,
! 		"Cannot get password entry for this uid!"));
! 
! 	strcpy(home, passwd_entry->pw_dir);
! 	strcpy(username, passwd_entry->pw_name);
! 	user_uid = passwd_entry->pw_uid;
! 	user_gid = passwd_entry->pw_gid;
  	
  	/* nothing read in yet, right? */
  	outfname[0] = to[0] = filterfile[0] = '\0';
  	
- 	
- #ifdef HOSTCOMPILED
- 	strncpy(hostname, HOSTNAME, sizeof(hostname));
- #else
- 	gethostname(hostname, sizeof(hostname));
- #endif
- 
  	/* now parse the starting arguments... */
  
  	while ((c = getopt(argc, argv, "clno:qrSsvf:")) != EOF)
--- 70,86 ----
  	     summary   = FALSE,			/* a summary is requested?  */
  	     c;					/* var for getopt routine   */
  
! 	locale_init();
! 	user_init();
! 	init_defaults();
! 	read_rc_file();
  		
! 	user_uid = userid;
! 	user_gid = groupid;
  	
  	/* nothing read in yet, right? */
  	outfname[0] = to[0] = filterfile[0] = '\0';
  	
  	/* now parse the starting arguments... */
  
  	while ((c = getopt(argc, argv, "clno:qrSsvf:")) != EOF)
***************
*** 150,156 ****
  		    clear_logs = TRUE;
  		    break;
  	       case 'f' :
! 		    strcpy(filterfile,optarg);
  		    break;
  	       case 'l' :
  		    log_actions_only = TRUE;
--- 90,96 ----
  		    clear_logs = TRUE;
  		    break;
  	       case 'f' :
! 		    strfcpy(filterfile,optarg, sizeof filterfile);
  		    break;
  	       case 'l' :
  		    log_actions_only = TRUE;
***************
*** 159,165 ****
  		    show_only = TRUE;
  		    break;
  	       case 'o' :
! 		    strcpy(outfname, optarg);
  		    break;
  	       case 'q' :
  		    logging = FALSE;
--- 99,105 ----
  		    show_only = TRUE;
  		    break;
  	       case 'o' :
! 		    strfcpy(outfname, optarg, sizeof outfname);
  		    break;
  	       case 'q' :
  		    logging = FALSE;
***************
*** 191,197 ****
  
  	/* use default filter file name if none specified */
  	if (!*filterfile)
! 	     sprintf(filterfile,"%s/%s",home,FILTERFILE);
  	
  	
  	/* let's open our outfd logfile as needed... */
--- 131,139 ----
  
  	/* use default filter file name if none specified */
  	if (!*filterfile)
! 	     elm_sfprintf(filterfile,sizeof filterfile,
! 			  FRM("%s/%s"),
! 			  home,FILTERFILE);
  	
  	
  	/* let's open our outfd logfile as needed... */
***************
*** 230,244 ****
  
  	/* next, create the tempfile and save the incoming message */
  
! 	sprintf(filename, "%s.%d", filter_temp, getpid());
  
! 	if ((fd = fopen(filename,"w")) == NULL)
  	  {
! 		sprintf(buffer,
! 			catgets(elm_msg_cat,FilterSet,
! 				FilterCantOpenTempFileLeave,
! 			"Cannot open temporary file %s"),
! 				filename);
  		leave(buffer);
  	  }
  	
--- 172,188 ----
  
  	/* next, create the tempfile and save the incoming message */
  
! 	elm_sfprintf(filename, sizeof filename,
! 		     FRM("%s.%d"), 
! 		     filter_temp, getpid());
  
! 	if ((fd = safeopen(filename)) == NULL)
  	  {
! 		elm_sfprintf(buffer, sizeof buffer,
! 			     CATGETS(elm_msg_cat,FilterSet,
! 				     FilterCantOpenTempFileLeave,
! 				     "Cannot open temporary file %s"),
! 			     filename);
  		leave(buffer);
  	  }
  	
***************
*** 265,280 ****
  	    }
  	    else if (the_same(buffer, "X-Filtered-By:")) 
  	      already_been_forwarded++;	/* could be a loop here! */
- #ifdef USE_EMBEDDED_ADDRESSES
  	    else if (the_same(buffer, "From:"))
  	      save_embedded_address(buffer, "From:");
  	    else if (the_same(buffer, "Reply-To:"))
  	      save_embedded_address(buffer, "Reply-To:");
- #endif
  	    else if (strlen(buffer) < 2) 
  	      in_header = 0;
  	    else if (whitespace(buffer[0]) && in_to)
! 	      strcat(to, buffer);
  	  }
  	
            fprintf(fd, "%s\n", buffer);	/* and save it regardless! */
--- 209,222 ----
  	    }
  	    else if (the_same(buffer, "X-Filtered-By:")) 
  	      already_been_forwarded++;	/* could be a loop here! */
  	    else if (the_same(buffer, "From:"))
  	      save_embedded_address(buffer, "From:");
  	    else if (the_same(buffer, "Reply-To:"))
  	      save_embedded_address(buffer, "Reply-To:");
  	    else if (strlen(buffer) < 2) 
  	      in_header = 0;
  	    else if (whitespace(buffer[0]) && in_to)
! 	      strfcat(to, buffer, sizeof to);
  	  }
  	
            fprintf(fd, "%s\n", buffer);	/* and save it regardless! */
***************
*** 294,302 ****
  
  	  if (rule_choosen >= 0) {
  	    expand_macros(rules[rule_choosen].argument2, action_argument,
! 			rules[rule_choosen].line, printing_rules);
  	    /* Got to do this because log_msg() uses argument2 in rules[] */
! 	    strcpy(rules[rule_choosen].argument2, action_argument);
  	  }
  
  	  switch (action) {
--- 236,246 ----
  
  	  if (rule_choosen >= 0) {
  	    expand_macros(rules[rule_choosen].argument2, action_argument,
! 			  rules[rule_choosen].line, printing_rules,
! 			  sizeof action_argument);
  	    /* Got to do this because log_msg() uses argument2 in rules[] */
! 	    strfcpy(rules[rule_choosen].argument2, action_argument,
! 		    sizeof rules[rule_choosen].argument2);
  	  }
  
  	  switch (action) {
***************
*** 309,315 ****
  				    date_n_user());
  			  log_msg(DELETE_MSG);				break;
  
! 	    case SAVE   : if (save_message(rules[rule_choosen].argument2)) {
  			    mail_message(username);
  			    log_msg(FAILED_SAVE);
  			  }
--- 253,261 ----
  				    date_n_user());
  			  log_msg(DELETE_MSG);				break;
  
! 	    case SAVE   : if (save_message(rules[rule_choosen].argument2,
! 					   sizeof rules[rule_choosen].
! 					   argument2)) {
  			    mail_message(username);
  			    log_msg(FAILED_SAVE);
  			  }
***************
*** 317,323 ****
  		 	    log_msg(SAVE);
  	                  break;
  
! 	    case SAVECC : if (save_message(rules[rule_choosen].argument2))
  			    log_msg(FAILED_SAVE);
  			  else
  		            log_msg(SAVECC);
--- 263,271 ----
  		 	    log_msg(SAVE);
  	                  break;
  
! 	    case SAVECC : if (save_message(rules[rule_choosen].argument2,
! 					   sizeof rules[rule_choosen].
! 					   argument2))
  			    log_msg(FAILED_SAVE);
  			  else
  		            log_msg(SAVECC);
***************
*** 353,360 ****
  	exit(0);
  }
  
! save_from(buffer)
! char *buffer;
  {
  	/** save the SECOND word of this string as FROM **/
  
--- 301,308 ----
  	exit(0);
  }
  
! static void save_from(buffer)
!      char *buffer;
  {
  	/** save the SECOND word of this string as FROM **/
  
***************
*** 366,379 ****
  	while (whitespace(*buffer))
  	  buffer++;				/* skip delimited  */
  
! 	for (; (!whitespace(*buffer)) && *buffer; buffer++, f++) 
  	  *f = *buffer;				/* copy it and     */
  
  	*f = '\0';				/* Null terminate! */
  }
  
! save_subject(buffer)
! char *buffer;
  {
  	/** save all but the word "Subject:" for the subject **/
  
--- 314,329 ----
  	while (whitespace(*buffer))
  	  buffer++;				/* skip delimited  */
  
! 	for (; (!whitespace(*buffer)) && *buffer &&
! 	       f < from + (sizeof from -1); 
! 	     buffer++, f++) 
  	  *f = *buffer;				/* copy it and     */
  
  	*f = '\0';				/* Null terminate! */
  }
  
! static void save_subject(buffer)
!      char *buffer;
  {
  	/** save all but the word "Subject:" for the subject **/
  
***************
*** 382,392 ****
  	while (whitespace(buffer[skip]))
  		skip++;
  
! 	strcpy(subject, (char *) buffer + skip);
  }
  
! save_sender(buffer)
! char *buffer;
  {
  	/** save all but the word "Sender:" for the sender **/
  
--- 332,342 ----
  	while (whitespace(buffer[skip]))
  		skip++;
  
! 	strfcpy(subject, (char *) buffer + skip, sizeof subject);
  }
  
! static void save_sender(buffer)
!      char *buffer;
  {
  	/** save all but the word "Sender:" for the sender **/
  
***************
*** 395,405 ****
  	while (whitespace(buffer[skip]))
  		skip++;
  
! 	strcpy(sender, (char *) buffer + skip);
  }
  
! save_to(buffer)
! char *buffer;
  {
  	/** save all but the word "To:" or "Cc:" or
  	    "Apparently-To:" for the to list **/
--- 345,355 ----
  	while (whitespace(buffer[skip]))
  		skip++;
  
! 	strfcpy(sender, (char *) buffer + skip, sizeof sender);
  }
  
! static void save_to(buffer)
!      char *buffer;
  {
  	/** save all but the word "To:" or "Cc:" or
  	    "Apparently-To:" for the to list **/
***************
*** 412,426 ****
  	while (whitespace(buffer[skip]))
  		skip++;
  
  	if (*to)
! 		strcat(to, " "); /* place one blank between items */
  
! 	strcat(to, (char *) buffer + skip);
  }
  
! #ifdef USE_EMBEDDED_ADDRESSES
! 
! save_embedded_address(buffer, fieldname)
  char *buffer, *fieldname;
  {
  	/** this will replace the 'from' address with the one given, 
--- 362,375 ----
  	while (whitespace(buffer[skip]))
  		skip++;
  
+ 	/* place one blank between items */
  	if (*to)
! 		strfcat(to, " ", sizeof to); 
  
! 	strfcat(to, (char *) buffer + skip, sizeof to);
  }
  
! static void save_embedded_address(buffer, fieldname)
  char *buffer, *fieldname;
  {
  	/** this will replace the 'from' address with the one given, 
***************
*** 442,448 ****
  	  for (i=strlen(buffer)-1; buffer[i] != '<' && i > 0; i--)
  		/* nothing - just move backwards .. */ ;
  	  i++;	/* skip the leading '<' symbol */
! 	  while (buffer[i] != '>')
  	    address[j++] = buffer[i++];
  	  address[j] = '\0';
  	}
--- 391,397 ----
  	  for (i=strlen(buffer)-1; buffer[i] != '<' && i > 0; i--)
  		/* nothing - just move backwards .. */ ;
  	  i++;	/* skip the leading '<' symbol */
! 	  while (buffer[i] != '>' && j < sizeof address -1)
  	    address[j++] = buffer[i++];
  	  address[j] = '\0';
  	}
***************
*** 449,455 ****
  	else {	/* get past "from:" and copy until white space or paren hit */
  	  for (i=strlen(fieldname); whitespace(buffer[i]); i++)
  	     /* skip past that... */ ;
! 	  while (buffer[i] != '(' && ! whitespace(buffer[i]) && buffer[i]!='\0')
  	    address[j++] = buffer[i++];
  	  address[j] = '\0';
  	}
--- 398,405 ----
  	else {	/* get past "from:" and copy until white space or paren hit */
  	  for (i=strlen(fieldname); whitespace(buffer[i]); i++)
  	     /* skip past that... */ ;
! 	  while (buffer[i] != '(' && ! whitespace(buffer[i]) && 
! 		 buffer[i]!='\0' && j < sizeof address-1)
  	    address[j++] = buffer[i++];
  	  address[j] = '\0';
  	}
***************
*** 460,469 ****
  	if (processed_a_reply_to)
  	  return;	/* forget it! */
  
! 	strcpy(from, address);			/* replaced!! */
  
  	if (istrcmp(fieldname, "Reply-To:") == 0)
  	  processed_a_reply_to++;
  }
! #endif
  
--- 410,419 ----
  	if (processed_a_reply_to)
  	  return;	/* forget it! */
  
! 	strfcpy(from, address, sizeof from);			/* replaced!! */
  
  	if (istrcmp(fieldname, "Reply-To:") == 0)
  	  processed_a_reply_to++;
  }
! 
  
Index: elm2.4.ME+.50/filter/lock.c
*** elm2.4.25/filter/lock.c	Tue Jan 19 05:55:42 1993
--- elm2.4.ME+.50/filter/lock.c	Tue Nov 17 21:12:54 1998
***************
*** 1,49 ****
  
! static char rcsid[] ="@(#)$Id: lock.c,v 5.6 1993/01/19 03:55:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.6 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein - elm@DSI.COM
!  *			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: lock.c,v $
!  * Revision 5.6  1993/01/19  03:55:39  syd
!  * exitprog.c makes a reference to a null character pointer, savecopy.c
!  * tries to reference an uninitialized variable, and the previous patch to
!  * src/lock.c to get rid of an uninitialized variable compiler message
!  * needed to be put in filter/lock.c as well.
!  * From: wdh@grouper.mkt.csd.harris.com (W. David Higgins)
!  *
!  * Revision 5.5  1992/12/07  03:49:49  syd
!  * use BSD or not apollo on file.h include as its not valid
!  * for Apollos under sys5.3 compile type
!  * From: gordonb@mcil.comm.mot.com (Gordon Berkley)
!  *
!  * Revision 5.4  1992/10/17  22:35:33  syd
!  * Change lock file name to add user name on filter locking of mail spool
!  * From: Peter Brouwer <pb@idca.tds.philips.nl>
!  *
!  * Revision 5.3  1992/10/12  00:25:52  syd
!  * Lock error codes (fcntl vs flock) were backwards
!  * From: howardl@wb3ffv.ampr.org (Howard Leadmon - WB3FFV)
!  *
!  * Revision 5.2  1992/10/11  00:52:11  syd
!  * Switch to wrapper for flock and fcntl locking.
!  * Change order to fcntl first, other order blocked.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.1  1992/10/03  22:18:09  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  
  /** The lock() and unlock() routines herein duplicate exactly the
--- 1,16 ----
  
! static char rcsid[] ="@(#)$Id: lock.c,v 1.2 1998/10/20 19:57:27 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  
  /** The lock() and unlock() routines herein duplicate exactly the
***************
*** 57,62 ****
--- 24,31 ----
  #include <fcntl.h>
  #include <errno.h>
  #include "defs.h"
+ 
+ #include "elmlib.h"
  #include "filter.h"
  #include "s_filter.h"
  
***************
*** 68,74 ****
  #ifdef	USE_FLOCK_LOCKING
  #define	NEEDS_FLOCK_FD
  #include <sys/types.h>
! #  if (defined(BSD) || !defined(apollo))
  #    include <sys/file.h>
  #  endif
  #endif
--- 37,43 ----
  #ifdef	USE_FLOCK_LOCKING
  #define	NEEDS_FLOCK_FD
  #include <sys/types.h>
! #  if (defined(BSD_TYPE) || !defined(apollo))
  #    include <sys/file.h>
  #  endif
  #endif
***************
*** 188,195 ****
  	int attempts = 0, ret;
  
  #ifdef	USE_DOTLOCK_LOCKING			/* { USE_DOTLOCK_LOCKING	*/
! 	strcpy(dotlock_name,mailhome);
! 	strcat(dotlock_name,username);
  	lockfile = mk_lockname(dotlock_name);
  #ifdef PIDCHECK
  	/** first, try to read the lock file, and if possible, check the pid.
--- 157,164 ----
  	int attempts = 0, ret;
  
  #ifdef	USE_DOTLOCK_LOCKING			/* { USE_DOTLOCK_LOCKING	*/
! 	strfcpy(dotlock_name,mailhome, sizeof dotlock_name);
! 	strfcat(dotlock_name,username, sizeof dotlock_name);
  	lockfile = mk_lockname(dotlock_name);
  #ifdef PIDCHECK
  	/** first, try to read the lock file, and if possible, check the pid.
***************
*** 228,234 ****
  #endif					/* } USE_DOTLOCK_LOCKING	*/
  
  #ifdef	NEEDS_FLOCK_FD			/* { NEEDS_FLOCK_FD	*/
! 	(void)sprintf(flock_name,"%s%s",mailhome,username);
  	flock_fd = open(flock_name, O_RDWR | O_CREAT, 0600);
  
  	if ( flock_fd >= 0 ) {
--- 197,205 ----
  #endif					/* } USE_DOTLOCK_LOCKING	*/
  
  #ifdef	NEEDS_FLOCK_FD			/* { NEEDS_FLOCK_FD	*/
! 	(void)elm_sfprintf(flock_name,sizeof flock_name,
! 			   FRM("%s%s"),
! 			   mailhome,username);
  	flock_fd = open(flock_name, O_RDWR | O_CREAT, 0600);
  
  	if ( flock_fd >= 0 ) {
Index: elm2.4.ME+.50/filter/parse.c
*** elm2.4.25/filter/parse.c	Mon Sep 20 02:11:18 1993
--- elm2.4.ME+.50/filter/parse.c	Tue Nov 17 21:12:54 1998
***************
*** 1,88 ****
  
! static char rcsid[] ="@(#)$Id: parse.c,v 5.13 1993/09/19 23:11:17 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.13 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein - elm@DSI.COM
!  *			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: parse.c,v $
!  * Revision 5.13  1993/09/19  23:11:17  syd
!  * strtokq was called with the wrong number of parameters.
!  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
!  *
!  * Revision 5.12  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.11  1993/04/12  03:04:01  syd
!  * Removed a malloc of a struct condition_rec that is never used.
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.10  1993/04/12  03:03:07  syd
!  * The setting of relop to the default (EQ) was in the wrong place,
!  * causing the wrong relation to be inserted in the rule.
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.9  1993/02/03  16:22:22  syd
!  * move strtokq to lib directory
!  * From: Syd
!  *
!  * Revision 5.8  1993/01/27  19:45:15  syd
!  * Filter turns spaces in quoted strings into _ and then back again. This destroys
!  * any _ that where there in the first place. This patch removes that.
!  * Also fixed a minor bug where 'filter -r' wrote out the wrong thing if the
!  * relation in a rule was '~'.
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.7  1993/01/27  19:40:01  syd
!  * I implemented a change to filter's default verbose message format
!  * including %x %X style date and time along with username
!  * From: mark@drd.com (Mark Lawrence)
!  *
!  * Revision 5.6  1992/12/11  01:45:04  syd
!  * remove sys/types.h include, it is now included by defs.h
!  * and this routine includes defs.h or indirectly includes defs.h
!  * From: Syd
!  *
!  * Revision 5.5  1992/12/07  05:08:03  syd
!  * add sys/types for time_t
!  * From: Syd
!  *
!  * Revision 5.4  1992/11/15  01:40:43  syd
!  * Add regexp processing to filter.
!  * Add execc operator
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.3  1992/10/28  14:52:25  syd
!  * fix compiler warning
!  * From: steve@nshore.org (Stephen J. Walick)
!  *
!  * Revision 5.2  1992/10/24  14:20:24  syd
!  * remove the 25 (MAXRULES) limitation.
!  * Basically it mallocs rules in hunks of RULESINC (25) as it goes along.
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.1  1992/10/03  22:18:09  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  
  /** This is the parser for the filter program.  It accepts a wide variety of
--- 1,16 ----
  
! static char rcsid[] ="@(#)$Id: parse.c,v 1.2 1998/10/20 19:57:27 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  
  /** This is the parser for the filter program.  It accepts a wide variety of
***************
*** 95,100 ****
--- 23,30 ----
  #include <stdio.h>
  
  #include "defs.h"
+ #include "elmlib.h"
+ 
  #include "filter.h"
  #include "s_filter.h"
  
***************
*** 172,178 ****
  	struct condition_rec
  	     *cond, *newcond;
  
! 	strcpy(filename,filterfile);
  
  	if ((fd = fopen(filename,"r")) == NULL) {
  	  if (outfd != NULL)
--- 102,108 ----
  	struct condition_rec
  	     *cond, *newcond;
  
! 	strfcpy(filename,filterfile, sizeof filename);
  
  	if ((fd = fopen(filename,"r")) == NULL) {
  	  if (outfd != NULL)
***************
*** 279,285 ****
  	        cond->relation  = (not_condition? - (relop) : relop);
  		cond->regex = NULL;
  
! 		strcpy(cond->argument1, cond_argument);
  	        cond->next = NULL;
  
  	        state = READING_ACTION;
--- 209,216 ----
  	        cond->relation  = (not_condition? - (relop) : relop);
  		cond->regex = NULL;
  
! 		strfcpy(cond->argument1, cond_argument,
! 			sizeof cond->argument1);
  	        cond->next = NULL;
  
  	        state = READING_ACTION;
***************
*** 305,311 ****
  	        if (relop == NONE) relop = EQ;	/* otherwise can't do -relop */
  	        cond->relation  = (not_condition? - (relop) : relop);
  		cond->regex = NULL;
! 		strcpy(cond->argument1, cond_argument);
  	        if ((newcond = (struct condition_rec *)
  	             malloc(sizeof(struct condition_rec))) == NULL) {
  		  if (outfd != NULL)
--- 236,243 ----
  	        if (relop == NONE) relop = EQ;	/* otherwise can't do -relop */
  	        cond->relation  = (not_condition? - (relop) : relop);
  		cond->regex = NULL;
! 		strfcpy(cond->argument1, cond_argument,
! 			sizeof cond->argument1);
  	        if ((newcond = (struct condition_rec *)
  	             malloc(sizeof(struct condition_rec))) == NULL) {
  		  if (outfd != NULL)
***************
*** 367,375 ****
  		for (;;) {
  	          if ((word = strtokq(str, "/", 0)) == NULL)
  	            break;
! 		  strcat(cond_argument, word);
  		  if (word[strlen(word)-1] == '\\') /* If / was escaped ... */
! 		    strcat(cond_argument, "/");
  		  else
  		    break;
  		}
--- 299,307 ----
  		for (;;) {
  	          if ((word = strtokq(str, "/", 0)) == NULL)
  	            break;
! 		  strfcat(cond_argument, word, sizeof cond_argument);
  		  if (word[strlen(word)-1] == '\\') /* If / was escaped ... */
! 		    strfcat(cond_argument, "/", sizeof cond_argument);
  		  else
  		    break;
  		}
***************
*** 381,387 ****
  	          if ((word = strtokq(str, " ()[]\t\n", 1)) == NULL)
  	            continue;
  	        }
! 	        strcpy(cond_argument, word);
  	      }
  	      state = NEXT_CONDITION;
  	    }
--- 313,319 ----
  	          if ((word = strtokq(str, " ()[]\t\n", 1)) == NULL)
  	            continue;
  	        }
! 	        strfcpy(cond_argument, word, sizeof cond_argument);
  	      }
  	      state = NEXT_CONDITION;
  	    }
***************
*** 438,444 ****
  	    }
  	
  	    if (state == ACTION_ARGUMENT) {
! 	      strcpy(action_argument, word);
  
  	      /** add this to the rules section and alloc next... **/
  
--- 370,376 ----
  	    }
  	
  	    if (state == ACTION_ARGUMENT) {
! 	      strfcpy(action_argument, word, sizeof action_argument);
  
  	      /** add this to the rules section and alloc next... **/
  
***************
*** 450,458 ****
  	      **/
  	      if (printing_rules)
  	        expand_macros(action_argument, rules[total_rules].argument2,
! 			      line, printing_rules);
  	      else
! 		strcpy(rules[total_rules].argument2, action_argument);
  
  	      if (++total_rules >= sizeof_rules)
  	        sizeof_rules = grow(&rules, sizeof_rules, RULESINC);
--- 382,392 ----
  	      **/
  	      if (printing_rules)
  	        expand_macros(action_argument, rules[total_rules].argument2,
! 			      line, printing_rules,
! 			      sizeof rules[total_rules].argument2);
  	      else
! 		strfcpy(rules[total_rules].argument2, action_argument,
! 			sizeof rules[total_rules].argument2);
  
  	      if (++total_rules >= sizeof_rules)
  	        sizeof_rules = grow(&rules, sizeof_rules, RULESINC);
Index: elm2.4.ME+.50/filter/regexp.c
*** elm2.4.25/filter/regexp.c	Thu Jun 10 06:12:16 1993
--- elm2.4.ME+.50/filter/regexp.c	Tue Nov 17 21:12:54 1998
***************
*** 1,49 ****
  
! static char rcsid[] = "@(#)$Id: regexp.c,v 5.7 1993/06/10 03:12:10 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
   *
!  * 			Copyright (c) 1992 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: regexp.c,v $
!  * Revision 5.7  1993/06/10  03:12:10  syd
!  * Add missing rcs id lines
!  * From: Syd
!  *
!  * Revision 5.6  1992/12/11  01:45:04  syd
!  * remove sys/types.h include, it is now included by defs.h
!  * and this routine includes defs.h or indirectly includes defs.h
!  * From: Syd
!  *
!  * Revision 5.5  1992/12/07  05:10:51  syd
!  * add include of sys/types.h for time_t
!  * From: Syd
!  *
!  * Revision 5.4  1992/11/17  18:25:42  syd
!  * change to use index instead of strchr
!  * From: Syd
   *
!  * Revision 5.3  1992/11/17  04:10:01  syd
!  * The changes to filter/regexp.c are to correct compiler warnings about
!  * unreachable statements.
!  *
!  * The changes to filter/rules.c are to correct the fact that we are passing
!  * a pointer to a condition_rec structore to a function expecting a pointer to
!  * a character string.
!  * From: Tom Moore <tmoore@fievel.DaytonOH.NCR.COM>
!  *
!  * Revision 5.2  1992/11/15  01:39:31  syd
!  * add proper headers
!  *
!  *
!  ******************************************************************************/
  
  /*
   * regcomp and regexec -- regsub and regerror are elsewhere
--- 1,15 ----
  
! static char rcsid[] = "@(#)$Id: regexp.c,v 1.2 1998/10/20 19:57:27 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  * 			Copyright (c) 1992 USENET Community Trust
!  *****************************************************************************/
  
  /*
   * regcomp and regexec -- regsub and regerror are elsewhere
***************
*** 76,81 ****
--- 42,48 ----
  #include <stdio.h>
  #include "defs.h"
  #include "regexp.h"
+ #include "elmlib.h"
  
  /* #include "regmagic.h" -- Inlined here (next 5 lines) */
  /*
***************
*** 1153,1159 ****
  	register char *p;
  	static char buf[50];
  
! 	(void) strcpy(buf, ":");
  
  	switch (OP(op)) {
  	case BOL:
--- 1120,1126 ----
  	register char *p;
  	static char buf[50];
  
! 	(void) strfcpy(buf, ":", sizeof buf);
  
  	switch (OP(op)) {
  	case BOL:
***************
*** 1195,1201 ****
  	case OPEN+7:
  	case OPEN+8:
  	case OPEN+9:
! 		sprintf(buf+strlen(buf), "OPEN%d", OP(op)-OPEN);
  		p = NULL;
  		break;
  	case CLOSE+1:
--- 1162,1170 ----
  	case OPEN+7:
  	case OPEN+8:
  	case OPEN+9:
! 		elm_sfprintf(buf+strlen(buf), sizeof buf - strlen(buf),
! 			     FRM("OPEN%d"), 
! 			     OP(op)-OPEN);
  		p = NULL;
  		break;
  	case CLOSE+1:
***************
*** 1207,1213 ****
  	case CLOSE+7:
  	case CLOSE+8:
  	case CLOSE+9:
! 		sprintf(buf+strlen(buf), "CLOSE%d", OP(op)-CLOSE);
  		p = NULL;
  		break;
  	case STAR:
--- 1176,1183 ----
  	case CLOSE+7:
  	case CLOSE+8:
  	case CLOSE+9:
! 		elm_sfprintf(buf+strlen(buf), sizeof buf - strlen(buf),
! 			     FRM("CLOSE%d"), OP(op)-CLOSE);
  		p = NULL;
  		break;
  	case STAR:
***************
*** 1221,1227 ****
  		break;
  	}
  	if (p != NULL)
! 		(void) strcat(buf, p);
  	return(buf);
  }
  #endif
--- 1191,1197 ----
  		break;
  	}
  	if (p != NULL)
! 		(void) strfcat(buf, p, sizeof buf);
  	return(buf);
  }
  #endif
Index: elm2.4.ME+.50/filter/rules.c
*** elm2.4.25/filter/rules.c	Fri Mar 11 22:40:24 1994
--- elm2.4.ME+.50/filter/rules.c	Tue Nov 17 21:12:54 1998
***************
*** 1,79 ****
  
! static char rcsid[] ="@(#)$Id: rules.c,v 5.9 1994/03/11 20:40:24 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.9 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein - elm@DSI.COM
!  *			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: rules.c,v $
!  * Revision 5.9  1994/03/11  20:40:24  syd
!  * Fix where buffer was not getting null terminated during its
!  * construction, so the strcat failed (due to garbage data existing in the
!  * array at malloc() time).
!  * From: lm@yallara.cs.rmit.oz.au (Luke Mewburn)
!  *
!  * Revision 5.8  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.7  1993/01/27  19:45:15  syd
!  * Filter turns spaces in quoted strings into _ and then back again. This destroys
!  * any _ that where there in the first place. This patch removes that.
!  * Also fixed a minor bug where 'filter -r' wrote out the wrong thing if the
!  * relation in a rule was '~'.
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.6  1993/01/27  19:40:01  syd
!  * I implemented a change to filter's default verbose message format
!  * including %x %X style date and time along with username
!  * From: mark@drd.com (Mark Lawrence)
!  *
!  * Revision 5.5  1992/12/11  01:45:04  syd
!  * remove sys/types.h include, it is now included by defs.h
!  * and this routine includes defs.h or indirectly includes defs.h
!  * From: Syd
!  *
!  * Revision 5.4  1992/11/22  00:06:45  syd
!  * Fix when expanding the macro '%S', the subject line is scanned for a
!  * 'Re:', and if nothing is found, a '"Re: ' is added. But when a 'Re:'
!  * *is* found, then nothing is added, not even the '"'.
!  * From: Sigmund Austigard <austig@solan.unit.no>
!  *
!  * Revision 5.3  1992/11/17  04:10:01  syd
!  * The changes to filter/regexp.c are to correct compiler warnings about
!  * unreachable statements.
!  *
!  * The changes to filter/rules.c are to correct the fact that we are passing
!  * a pointer to a condition_rec structore to a function expecting a pointer to
!  * a character string.
!  * From: Tom Moore <tmoore@fievel.DaytonOH.NCR.COM>
!  *
!  * Revision 5.2  1992/11/15  01:40:43  syd
!  * Add regexp processing to filter.
!  * Add execc operator
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.1  1992/10/03  22:18:09  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** This file contains all the rule routines, including those that apply the
      specified rules and the routine to print the rules out.
--- 1,16 ----
  
! static char rcsid[] ="@(#)$Id: rules.c,v 1.2 1998/10/20 19:57:27 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** This file contains all the rule routines, including those that apply the
      specified rules and the routine to print the rules out.
***************
*** 80,96 ****
  
  **/
  
- #include <stdio.h>
  #include "defs.h"
  #include <pwd.h>
! #ifdef I_TIME
! #  include <time.h>
! #endif
! #ifdef I_SYSTIME
! #  include <sys/time.h>
! #endif
  #include <fcntl.h>
  
  #include "filter.h"
  #include "s_filter.h"
  
--- 17,28 ----
  
  **/
  
  #include "defs.h"
  #include <pwd.h>
! 
  #include <fcntl.h>
  
+ #include "elmlib.h"
  #include "filter.h"
  #include "s_filter.h"
  
***************
*** 209,217 ****
  	FilterRegsubNine,	"<submatch-9>",
  };
  
! expand_macros(word, buffer, line, display)
! char *word, *buffer;
! int  line, display;
  {
  	/** expand the allowable macros in the word;
  		%d	= day of the month  
--- 141,150 ----
  	FilterRegsubNine,	"<submatch-9>",
  };
  
! void expand_macros(word, buffer, line, display, size)
!      char *word, *buffer;
!      int  line, display;
!      int size;
  {
  	/** expand the allowable macros in the word;
  		%d	= day of the month  
***************
*** 238,243 ****
--- 171,178 ----
  	time_t	thetime;
  	register int i, j=0, gotten_time = 0, reading_a_percent_sign = 0,
                       len, backslashed=0, regsub;
+ 	
+ 	buffer[0] = '\0';
  
  	for (i = 0, len = strlen(word); i < len; i++) {
  	  if (reading_a_percent_sign) {
***************
*** 244,359 ****
  	    reading_a_percent_sign = 0;
  	    switch (word[i]) {
  
! 	      case 'n' : buffer[j] = '\0';
  			 if (display)
! 			   strcat(buffer,catgets(elm_msg_cat,
  						 FilterSet,FilterSender,
! 						 "<sender>"));
  			 else {
! 			   strcat(buffer, "\"");
! 			   strcat(buffer, sender);
! 			   strcat(buffer, "\"");
  			 }
  			 j = strlen(buffer);
  			 break;
  
! 	      case 'r' : buffer[j] = '\0';
  			 if (display)
! 	 		   strcat(buffer,catgets(elm_msg_cat,
! 						 FilterSet,FilterReturnAddress,
! 						 "<return-address>"));
  			 else
! 			   strcat(buffer, from);
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 's' : buffer[j] = '\0';
  			 if (display)
! 	 		   strcat(buffer,catgets(elm_msg_cat,
  						FilterSet,FilterSubject,
! 						 "<subject>"));
  			 else {
! 			   strcat(buffer, "\"");
! 			   strcat(buffer, subject);
! 			   strcat(buffer, "\"");
  			 }
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 'S' : buffer[j] = '\0';
  			 if (display)
! 	 		   strcat(buffer,catgets(elm_msg_cat,
  						 FilterSet,FilterReSubject,
! 						 "<Re: subject>"));
  			 else {
! 			   strcat(buffer, "\"");
  			   if (! the_same(subject, "Re:")) 
! 			     strcat(buffer, "Re: ");
! 			   strcat(buffer, subject);
! 			   strcat(buffer, "\"");
  			 }
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 'd' : get_the_time(); buffer[j] = '\0';
  			 if (display)
! 			   strcat(buffer,catgets(elm_msg_cat,
  						 FilterSet,FilterDayOfMonth,
! 						 "<day-of-month>"));
  			 else
! 			   strcat(buffer, itoa(timerec->tm_mday,FALSE));
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 'D' : get_the_time(); buffer[j] = '\0';
  			 if (display)
! 			   strcat(buffer,catgets(elm_msg_cat,
! 						 FilterSet,FilterDayOfWeek,
! 						 "<day-of-week>"));
  			 else
! 			   strcat(buffer, itoa(timerec->tm_wday,FALSE));
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 'm' : get_the_time(); buffer[j] = '\0';
  			 if (display)
! 			   strcat(buffer,catgets(elm_msg_cat,
! 						 FilterSet,FilterMonth,
! 						 "<month>"));
  			 else
! 			   sprintf(&buffer[j],"%2.2d",timerec->tm_mon+1);
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 'y' : get_the_time(); buffer[j] = '\0';
  			 if (display)
! 			   strcat(buffer,catgets(elm_msg_cat,
! 						 FilterSet,FilterYear,
! 						 "<year>"));
  			 else
! 			   strcat(buffer, itoa(timerec->tm_year,FALSE));
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 'h' : get_the_time(); buffer[j] = '\0';
  			 if (display)
! 			   strcat(buffer,catgets(elm_msg_cat,
! 						 FilterSet,FilterHour,
! 						 "<hour>"));
  			 else
! 			   strcat(buffer, itoa(timerec->tm_hour,FALSE));
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 't' : get_the_time(); buffer[j] = '\0';
  			 if (display)
! 			   strcat(buffer,catgets(elm_msg_cat,
! 						 FilterSet,FilterTime,
! 						 "<time>"));
  		         else {
! 			   strcat(buffer, itoa(timerec->tm_hour,FALSE));
! 			   strcat(buffer, ":");
! 			   strcat(buffer, itoa(timerec->tm_min,TRUE));
  			 }
  	                 j = strlen(buffer);
  			 break;
--- 179,309 ----
  	    reading_a_percent_sign = 0;
  	    switch (word[i]) {
  
! 	      case 'n' : 
  			 if (display)
! 			   strfcat(buffer,catgets(elm_msg_cat,
  						 FilterSet,FilterSender,
! 						 "<sender>"),
! 				   size);
  			 else {
! 			   strfcat(buffer, "\"", size);
! 			   strfcat(buffer, sender, size);
! 			   strfcat(buffer, "\"", size);
  			 }
  			 j = strlen(buffer);
  			 break;
  
! 	      case 'r' : 
  			 if (display)
! 	 		   strfcat(buffer,catgets(elm_msg_cat,
! 						  FilterSet,
! 						  FilterReturnAddress,
! 						  "<return-address>"),
! 				   size);
  			 else
! 			   strfcat(buffer, from, sizeof buffer);
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 's' : 
  			 if (display)
! 	 		   strfcat(buffer,catgets(elm_msg_cat,
  						FilterSet,FilterSubject,
! 						 "<subject>"),
! 				   size);
  			 else {
! 			   strfcat(buffer, "\"", size);
! 			   strfcat(buffer, subject, size);
! 			   strfcat(buffer, "\"", size);
  			 }
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 'S' : 
  			 if (display)
! 	 		   strfcat(buffer,catgets(elm_msg_cat,
  						 FilterSet,FilterReSubject,
! 						 "<Re: subject>"),
! 				   size);
  			 else {
! 			   strfcat(buffer, "\"", size);
  			   if (! the_same(subject, "Re:")) 
! 			     strfcat(buffer, "Re: ", size);
! 			   strfcat(buffer, subject, size);
! 			   strfcat(buffer, "\"", size);
  			 }
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 'd' : get_the_time(); 
  			 if (display)
! 			   strfcat(buffer,catgets(elm_msg_cat,
  						 FilterSet,FilterDayOfMonth,
! 						  "<day-of-month>"),
! 				   size);
  			 else
! 			   strfcat(buffer, itoa(timerec->tm_mday,FALSE),size);
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 'D' : get_the_time(); 
  			 if (display)
! 			   strfcat(buffer,catgets(elm_msg_cat,
! 						  FilterSet,FilterDayOfWeek,
! 						  "<day-of-week>"),
! 				   size);
  			 else
! 			   strfcat(buffer, itoa(timerec->tm_wday,FALSE),
! 				   size);
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 'm' : get_the_time(); 
  			 if (display)
! 			   strfcat(buffer,catgets(elm_msg_cat,
! 						  FilterSet,FilterMonth,
! 						  "<month>"),
! 				   size);
  			 else
! 			   elm_sfprintf(&buffer[j],size,
! 					FRM("%2.2d"),
! 					timerec->tm_mon+1);
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 'y' : get_the_time(); 
  			 if (display)
! 			   strfcat(buffer,catgets(elm_msg_cat,
! 						  FilterSet,FilterYear,
! 						  "<year>"),
! 				   size);
  			 else
! 			   strfcat(buffer, itoa(timerec->tm_year,FALSE),
! 				   size);
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 'h' : get_the_time(); 
  			 if (display)
! 			   strfcat(buffer,catgets(elm_msg_cat,
! 						  FilterSet,FilterHour,
! 						  "<hour>"), size);
  			 else
! 			   strfcat(buffer, itoa(timerec->tm_hour,FALSE),
! 				   size);
  	                 j = strlen(buffer);
  			 break;
  
! 	      case 't' : get_the_time(); 
  			 if (display)
! 			   strfcat(buffer,catgets(elm_msg_cat,
! 						  FilterSet,FilterTime,
! 						  "<time>"),
! 				   size);
  		         else {
! 			   strfcat(buffer, itoa(timerec->tm_hour,FALSE), size);
! 			   strfcat(buffer, ":", size);
! 			   strfcat(buffer, itoa(timerec->tm_min,TRUE), size);
  			 }
  	                 j = strlen(buffer);
  			 break;
***************
*** 365,374 ****
  			 else regsub = word[i] - '0';
  
  			 if (display) {
! 			   strcpy(buffer + j,catgets(elm_msg_cat,
! 						 FilterSet,
! 						 regmessage[regsub].id,
! 						 regmessage[regsub].str));
  			   j = strlen(buffer);
  			 } else {
  			   if (last_regexp != NULL) {
--- 315,325 ----
  			 else regsub = word[i] - '0';
  
  			 if (display) {
! 			   strfcpy(buffer,catgets(elm_msg_cat,
! 						  FilterSet,
! 						  regmessage[regsub].id,
! 						  regmessage[regsub].str),
! 				   size);
  			   j = strlen(buffer);
  			 } else {
  			   if (last_regexp != NULL) {
***************
*** 375,381 ****
  			     char *sp = last_regexp->startp[regsub];
  			     char *ep = last_regexp->endp[regsub];
  			     if (sp != NULL && ep != NULL && ep > sp)
! 			       while (sp < ep) buffer[j++] = *sp++;
  			   }
  			 }
  			 break;
--- 326,334 ----
  			     char *sp = last_regexp->startp[regsub];
  			     char *ep = last_regexp->endp[regsub];
  			     if (sp != NULL && ep != NULL && ep > sp)
! 			       while (sp < ep && j < size-2) 
! 				 buffer[j++] = *sp++;
! 			     buffer[j] = '\0';
  			   }
  			 }
  			 break;
***************
*** 391,414 ****
  	  }
  	  else if (word[i] == '%') {
  	    if (backslashed) {
!                  buffer[j++] = '%';
!                  backslashed = 0;
              } else {
  	         reading_a_percent_sign++;
  	    }
  	  } else if (word[i] == '\\') {
  	    if (backslashed) {
! 		 buffer[j++] = '\\';
! 		 backslashed = 0;
  	    } else {
  		 backslashed++;
  	    }
  	  } else {
! 	    buffer[j++] = word[i];
  	    backslashed = 0;
  	  }
  	}
- 	buffer[j] = '\0';
  }
  
  print_rules()
--- 344,375 ----
  	  }
  	  else if (word[i] == '%') {
  	    if (backslashed) {
! 	      if (j < size-2) {
! 		buffer[j++] = '%';
! 		buffer[j] = '\0';       
! 	      }
! 	      backslashed = 0;
              } else {
  	         reading_a_percent_sign++;
  	    }
  	  } else if (word[i] == '\\') {
  	    if (backslashed) {
! 	      if (j < size-2) {
! 		buffer[j++] = '\\';
! 		buffer[j] = '\0';			
! 	      }
! 	      backslashed = 0;
  	    } else {
  		 backslashed++;
  	    }
  	  } else {
! 	    if (j < size-2) {
! 	      buffer[j++] = word[i];
! 	      buffer[j] = '\0';
! 	    }
  	    backslashed = 0;
  	  }
  	}
  }
  
  print_rules()
***************
*** 478,484 ****
  	  case SUBJECT: return("subject");
  	  case LINES  : return ("lines");
  	  case CONTAINS: return("contains");
! 	  default     : sprintf(buffer, "?%d?", n); return((char *)buffer);
  	}
  }
  
--- 439,447 ----
  	  case SUBJECT: return("subject");
  	  case LINES  : return ("lines");
  	  case CONTAINS: return("contains");
! 	  default     : elm_sfprintf(buffer, sizeof buffer,
! 				     FRM("?%d?"), n); 
! 	  return((char *)buffer);
  	}
  }
  
Index: elm2.4.ME+.50/filter/summarize.c
*** elm2.4.25/filter/summarize.c	Mon Feb  8 20:38:13 1993
--- elm2.4.ME+.50/filter/summarize.c	Tue Nov 17 21:12:54 1998
***************
*** 1,57 ****
  
! static char rcsid[] ="@(#)$Id: summarize.c,v 5.8 1993/02/08 18:38:12 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein - elm@DSI.COM
!  *			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: summarize.c,v $
!  * Revision 5.8  1993/02/08  18:38:12  syd
!  * Fix to copy_file to ignore unescaped from if content_length not yet reached.
!  * Fixes to NLS messages match number of newlines between default messages
!  * and NLS messages. Also an extra ) was removed.
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.7  1993/01/27  19:40:01  syd
!  * I implemented a change to filter's default verbose message format
!  * including %x %X style date and time along with username
!  * From: mark@drd.com (Mark Lawrence)
!  *
!  * Revision 5.6  1992/12/11  01:45:04  syd
!  * remove sys/types.h include, it is now included by defs.h
!  * and this routine includes defs.h or indirectly includes defs.h
!  * From: Syd
!  *
!  * Revision 5.5  1992/12/07  05:14:19  syd
!  * add sys/types.h for time_t
!  * From: Syd
!  *
!  * Revision 5.4  1992/11/15  01:40:43  syd
!  * Add regexp processing to filter.
!  * Add execc operator
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.3  1992/11/07  20:48:55  syd
!  * fix applied rule count message
!  *
!  * Revision 5.2  1992/10/24  14:20:24  syd
!  * remove the 25 (MAXRULES) limitation.
!  * Basically it mallocs rules in hunks of RULESINC (25) as it goes along.
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.1  1992/10/03  22:18:09  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** This routine is called from the filter program (or can be called
      directly with the correct arguments) and summarizes the users filterlog
--- 1,16 ----
  
! static char rcsid[] ="@(#)$Id: summarize.c,v 1.2 1998/10/20 19:57:27 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** This routine is called from the filter program (or can be called
      directly with the correct arguments) and summarizes the users filterlog
***************
*** 67,72 ****
--- 26,33 ----
  #include <stdio.h>
  
  #include "defs.h"
+ #include "elmlib.h"
+ 
  #include "filter.h"
  #include "s_filter.h"
  
***************
*** 85,91 ****
  	     rule,
  	     *applied;
  
! 	sprintf(filename, "%s/%s", home, filtersum);
  
  	if ((fd = fopen(filename, "r")) == NULL) {
  	  if (outfd != NULL)
--- 46,54 ----
  	     rule,
  	     *applied;
  
! 	elm_sfprintf(filename, sizeof filename,
! 		     FRM("%s/%s"), 
! 		     home, filtersum);
  
  	if ((fd = fopen(filename, "r")) == NULL) {
  	  if (outfd != NULL)
***************
*** 254,260 ****
  
  	  /* next, after a ^L, include the actual log file... */
  
! 	  sprintf(filename, "%s/%s", home, filterlog);
  
  	  if ((fd = fopen(filename, "r")) == NULL) {
  	    fprintf(outfd,catgets(elm_msg_cat,
--- 217,225 ----
  
  	  /* next, after a ^L, include the actual log file... */
  
! 	  elm_sfprintf(filename, sizeof filename,
! 		       FRM("%s/%s"), 
! 		       home, filterlog);
  
  	  if ((fd = fopen(filename, "r")) == NULL) {
  	    fprintf(outfd,catgets(elm_msg_cat,
***************
*** 276,284 ****
  	/* now remove the log files, please! */
  
  	if (clear_logs) {
! 	  sprintf(filename, "%s/%s", home, filterlog);
  	  unlink(filename);
! 	  sprintf(filename, "%s/%s", home, filtersum);
  	  unlink(filename);
  	}
  
--- 241,253 ----
  	/* now remove the log files, please! */
  
  	if (clear_logs) {
! 	  elm_sfprintf(filename, sizeof filename,
! 		       FRM("%s/%s"), 
! 		       home, filterlog);
  	  unlink(filename);
! 	  elm_sfprintf(filename, sizeof filename,
! 		       FRM("%s/%s"), 
! 		       home, filtersum);
  	  unlink(filename);
  	}
  
Index: elm2.4.ME+.50/filter/utils.c
*** elm2.4.25/filter/utils.c	Tue Aug  3 22:28:42 1993
--- elm2.4.ME+.50/filter/utils.c	Tue Nov 17 21:12:54 1998
***************
*** 1,46 ****
  
! static char rcsid[] ="@(#)$Id: utils.c,v 5.4 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein - elm@DSI.COM
!  *			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: utils.c,v $
!  * Revision 5.4  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.3  1993/01/27  19:40:01  syd
!  * I implemented a change to filter's default verbose message format
!  * including %x %X style date and time along with username
!  * From: mark@drd.com (Mark Lawrence)
!  *
!  * Revision 5.2  1992/11/15  01:40:43  syd
!  * Add regexp processing to filter.
!  * Add execc operator
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.1  1992/10/03  22:18:09  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** Utility routines for the filter program...
  
--- 1,16 ----
  
! static char rcsid[] ="@(#)$Id: utils.c,v 1.2 1998/10/20 19:57:27 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** Utility routines for the filter program...
  
***************
*** 51,56 ****
--- 21,28 ----
  #include <fcntl.h>
  
  #include "defs.h"
+ #include "elmlib.h"
+ 
  #include "filter.h"
  #include "s_filter.h"
  
***************
*** 81,87 ****
  		return;
  
  	if (! show_only) {
! 	  sprintf(filename, "%s/%s", home, filtersum);	/* log action once! */
  	  if ((fd = fopen(filename, "a")) == NULL) {
  	    if (outfd != NULL)
  	      fprintf(outfd,catgets(elm_msg_cat,
--- 53,61 ----
  		return;
  
  	if (! show_only) {
! 	  elm_sfprintf(filename, sizeof filename,
! 		       FRM("%s/%s"), 
! 		       home, filtersum);	/* log action once! */
  	  if ((fd = fopen(filename, "a")) == NULL) {
  	    if (outfd != NULL)
  	      fprintf(outfd,catgets(elm_msg_cat,
***************
*** 94,100 ****
  	  fclose(fd);
  	}
  
! 	sprintf(filename, "%s/%s", home, filterlog);
  
  	if (show_only)
  	  fd = stdout;
--- 68,76 ----
  	  fclose(fd);
  	}
  
! 	elm_sfprintf(filename, sizeof filename,
! 		     FRM("%s/%s"), 
! 		     home, filterlog);
  
  	if (show_only)
  	  fd = stdout;
***************
*** 241,255 ****
   * it has been stripped down to only handle ~ expansion
   */
  
! expand_filename(filename)
! char *filename;
  {
  	/** Expands	~/	to the current user's home directory
  
  	    Side effect: strips off trailing blanks
  
- 	    Returns 	1	upon proper expansions
- 			0	upon failed expansions
  	 **/
  
  	char temp_filename[SLEN], *ptr;
--- 217,230 ----
   * it has been stripped down to only handle ~ expansion
   */
  
! void expand_filename(filename, namesize)
!      char *filename;
!      int namesize;
  {
  	/** Expands	~/	to the current user's home directory
  
  	    Side effect: strips off trailing blanks
  
  	 **/
  
  	char temp_filename[SLEN], *ptr;
***************
*** 256,262 ****
  
  	ptr = filename;
  	while (*ptr == ' ') ptr++;	/* leading spaces GONE! */
! 	strcpy(temp_filename, ptr);
  
  	/** New stuff - make sure no illegal char as last **/
  	ptr = temp_filename + strlen(temp_filename) - 1;
--- 231,237 ----
  
  	ptr = filename;
  	while (*ptr == ' ') ptr++;	/* leading spaces GONE! */
! 	strfcpy(temp_filename, ptr, sizeof temp_filename);
  
  	/** New stuff - make sure no illegal char as last **/
  	ptr = temp_filename + strlen(temp_filename) - 1;
***************
*** 269,276 ****
  
  	if ((temp_filename[0] == '~') &&
  	    (temp_filename[1] == '/')) {
! 	    sprintf(filename, "%s%s%s",
! 		  home, (lastch(home) != '/' ? "/" : ""), &temp_filename[2]);
  
  	/* any further expansion, such as = + < >
  	 * would require parsing the elmrc file
--- 244,253 ----
  
  	if ((temp_filename[0] == '~') &&
  	    (temp_filename[1] == '/')) {
! 	    elm_sfprintf(filename, namesize,
! 			 FRM("%s%s%s"),
! 			 home, (lastch(home) != '/' ? "/" : ""), 
! 			 &temp_filename[2]);
  
  	/* any further expansion, such as = + < >
  	 * would require parsing the elmrc file
***************
*** 277,283 ****
  	 */
  
  	} else
! 	  strcpy(filename, temp_filename);
  	  
- 	return(1);
  }
--- 254,263 ----
  	 */
  
  	} else
! 	  strfcpy(filename, temp_filename, namesize);
  	  
  }
+ 
+ 
+ 
+ 
Index: elm2.4.ME+.50/hdrs/curses.h
*** elm2.4.25/hdrs/curses.h	Sun Oct  4 01:35:06 1992
--- elm2.4.ME+.50/hdrs/curses.h	Tue Nov 17 21:12:54 1998
***************
*** 1,44 ****
  
! /* $Id: curses.h,v 5.1 1992/10/03 22:34:39 syd Exp $ */
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: curses.h,v $
!  * Revision 5.1  1992/10/03  22:34:39  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
! 
!      /*** Include file for seperate compilation.  ***/
  
  #define OFF		0
  #define ON 		1
  
! int  InitScreen(),      /* This must be called before anything else!! */
! 
!      ClearScreen(), 	 CleartoEOLN(),
! 
!      MoveCursor(),
! 
!      StartBold(),        EndBold(), 
!      StartUnderline(),   EndUnderline(), 
!      StartHalfbright(),  EndHalfbright(),
!      StartInverse(),     EndInverse(),
! 	
!      transmit_functions(),
! 
!      Raw(),              RawState(),
!      ReadCh();
! 
! char *return_value_of();
--- 1,47 ----
  
! /* $Id: curses.h,v 1.2 1998/10/20 19:57:35 hurtta Exp $ */
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  ****************************************************************************/
  
  #define OFF		0
  #define ON 		1
  
! #undef P_
! #ifdef __STDC__
! #define P_(x) x
! #else
! #define P_(x) ()
! #endif
! 
! extern int InitScreen P_(()),      /* This must be called before anything else!! */
!   ClearScreen P_((void)), 	 
!   CleartoEOLN P_((void)),
!   MoveCursor  P_((int, int)),
!   StartBold P_((void)),        
!   EndBold P_((void)), 
!   StartUnderline P_((void)),   
!   EndUnderline   P_((void)),
!   StartHalfbright P_((void)),  
!   EndHalfbright   P_((void)),
!   StartInverse P_((void)),     
!   EndInverse   P_((void)),
!   transmit_functions P_((int)),
!   Raw P_((int)),              
!   RawState P_((void)),
!   ReadCh P_((int));
! 
! extern void ScreenSize P_((int *lines, int *columns));
! extern void Write_to_screen P_((
! 				const char *format, const char *msg, ...
! 				));
! extern void PutLine0 P_((int, int, const char *));
! extern void PutLineX P_((int, int, const char *, const char *, ...));
Index: elm2.4.ME+.50/hdrs/defs.h
*** elm2.4.25/hdrs/defs.h	Mon Dec  4 17:50:56 1995
--- elm2.4.ME+.50/hdrs/defs.h	Tue Nov 17 21:12:55 1998
***************
*** 1,189 ****
  
! /* $Id: defs.h,v 5.35 1994/09/01 19:42:39 syd Exp $ */
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.35 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: defs.h,v $
!  * Revision 5.35  1994/09/01  19:42:39  syd
!  * Moved #defines for SETJMP & LONGJMP from src/editmsg.c to hdrs/defs.h and
!  * used them instead of (set|long)jmp directly. This makes the usage consistent
!  * and Solaris 2.3 behaves correctly w.r.t stop/continue.
!  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
!  *
!  * Revision 5.34  1994/05/15  23:10:08  syd
!  * Below are the changes required to compile/link elm 2.4 pl23 under
!  * QNX 4.2 with the Watcom 9.5 compiler (very picky).
!  * From: "Brian Campbell" <brianc@quantum>
!  *
!  * Revision 5.33  1993/09/19  23:40:48  syd
!  * Defince SEEK_SET in one of our headers as a last resort
!  * From: Syd
!  *
!  * Revision 5.32  1993/08/23  02:46:51  syd
!  * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX).
!  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
!  *
!  * Revision 5.31  1993/08/23  02:45:29  syd
!  * The macro ctrl(c) did not work correctly for a DEL character
!  * neither did it make the backward mapping from a control char
!  * to the letter that is normally used with an up-arrow prefix
!  * to represent the control character.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.30  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.29  1993/08/03  19:05:33  syd
!  * When STDC is used on Convex the feof() function is defined as
!  * a true library routine in the header files and moreover the
!  * library routine also leaks royally. It returns always 1!!
!  * So we have to use a macro. Convex naturally does not provide
!  * you with one though if you are using a STDC compiler. So we
!  * have to include one.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.28  1993/07/20  02:59:53  syd
!  * Support aliases both on 64 bit and 32 bit machines at the same time.
!  * From: Dan Mosedale <mosedale@genome.stanford.edu>
!  *
!  * Revision 5.27  1993/05/08  19:41:13  syd
!  * make it now depend on mallocvoid
!  *
!  * Revision 5.26  1993/04/16  04:16:24  syd
!  * For convex, #if-defed memcpy, memset and sleep.
!  * From: rzm@oso.chalmers.se (Rafal Maszkowski)
!  *
!  * Revision 5.25  1993/04/12  03:30:23  syd
!  * On AIX, __STDC__ is not defined but it does use unistd.h, etc.  In
!  * hdrs/def.h, ANS_C already gets defined if __STDC__ or _AIX.  But this
!  * variable then needs to be used in src/init.c and hdrs/filter.h in place
!  * of the current test for __STDC__.
!  * From:	rstory@elegant.com (Robert Story)
!  *
!  * Revision 5.24  1993/04/12  03:25:26  syd
!  * Use I_UNISTD instead of UNISTD_H
!  *
!  * Revision 5.23  1993/04/12  03:22:49  syd
!  * Add UNISTD_H to check for unistd.h include
!  * From: Syd
!  *
!  * Revision 5.22  1993/04/12  01:51:42  syd
!  * Added safe_malloc(), safe_realloc(), and safe_strdup().  They
!  * will be used in the new elmalias utility.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.21  1993/02/09  15:31:10  syd
!  * Make the str declare symbol ANSI_C, our contrived symbol
!  * so IBM compiles work ok.
!  * From: Syd
!  *
!  * Revision 5.20  1993/02/07  15:12:50  syd
!  * fix declaration of fseek, it was of the wrong type (sb int, was long)
!  *
!  * Revision 5.19  1993/02/03  17:12:53  syd
!  * move more declarations to defs.h, including sleep
!  * From: Syd
!  *
!  * Revision 5.18  1993/02/03  16:56:24  syd
!  * add unistd.h for include of lseek/fseek on stdc compilers
!  * From: Syd via prompt from mfvargo@netcom.com (Michael Vargo)
!  *
!  * Revision 5.17  1993/02/03  16:18:17  syd
!  * add strtokq
!  * From: Syd
!  *
!  * Revision 5.16  1993/01/20  03:02:19  syd
!  * Move string declarations to defs.h
!  * From: Syd
!  *
!  * Revision 5.15  1993/01/20  02:56:38  syd
!  * hide index and rindex declarations inside __STDC__ so AIX doesnt see it
!  *
!  * Revision 5.14  1993/01/19  05:07:05  syd
!  * Trim erroreous extra log entry
!  * From: Syd
!  *
!  * Revision 5.13  1993/01/19  04:47:12  syd
!  * Significant changes to provide consistent Date and From_ header
!  * cracking.  Overhauled date utilities and moved into library.  Moved
!  * real_from() into library.  Modified frm, newmail, and readmsg utilities
!  * to use library version of real_from().  Moved get_word() from Elm
!  * source into library.  Added new library routines atonum() and strfcpy().
!  * Fixed trailing backslash bug in len_next().
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.12  1993/01/05  03:36:10  syd
!  * remove leading 0s from access() defs as it confuses some
!  * compilers (and I know it shouldnt)
!  * From: Syd
!  *
!  * Revision 5.11  1992/12/11  01:58:50  syd
!  * Allow for use from restricted shell by putting SHELL=/bin/sh in the
!  * environment of spawned mail transport program.
!  * From: chip@tct.com (Chip Salzenberg)
!  *
!  * Revision 5.10  1992/12/11  01:29:27  syd
!  * add include of sys/types.h for time_t usage
!  *
!  * Revision 5.9  1992/12/07  02:47:45  syd
!  * fix time variables that are not declared time_t
!  * From: Syd via prompting from Jim Brown
!  *
!  * Revision 5.8  1992/11/26  01:46:26  syd
!  * add Decode option to copy_message, convert copy_message to
!  * use bit or for options.
!  * From: Syd and bjoerns@stud.cs.uit.no (Bjoern Stabell)
!  *
!  * Revision 5.7  1992/11/22  01:22:29  syd
!  * This mod fixes overlapping prototypes for strchr and index on
!  * Convex.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.6  1992/11/07  20:40:27  syd
!  * flag for no tite for curses calls
!  *
!  * Revision 5.5  1992/11/07  20:05:52  syd
!  * change to use header_cmp to allow for linear white space around the colon
!  * From: Syd
!  *
!  * Revision 5.4  1992/10/27  01:40:08  syd
!  * fix compilation error on posix_signals for non STDC
!  * From: tom@osf.org
!  *
!  * Revision 5.3  1992/10/25  02:01:58  syd
!  * Here are the patches to support POSIX sigaction().
!  * From: tom@osf.org
!  *
!  * Revision 5.2  1992/10/25  01:47:45  syd
!  * fixed a bug were elm didn't call metamail on messages with a characterset,
!  * which could be displayed by elm itself, but message is encoded with QP
!  * or BASE64
!  * From: Klaus Steinberger <Klaus.Steinberger@Physik.Uni-Muenchen.DE>
!  *
!  * Revision 5.1  1992/10/03  22:34:39  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /**  define file for ELM mail system.  **/
  
--- 1,16 ----
  
! /* $Id: defs.h,v 1.2 1998/10/20 19:57:35 hurtta Exp $ */
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /**  define file for ELM mail system.  **/
  
***************
*** 194,208 ****
  #include "sysdefs.h"	/* system/configurable defines */
  
  
! # define VERSION	"2.4"				/* Version number... */
! # define VERS_DATE	"November 11, 1995"		/* for elm -v option */
! # define WHAT_STRING	\
! 	"@(#) Version 2.4, USENET supported version, released November 11, 1995"
  
  #if defined(__STDC__) || defined(_AIX)
  # define ANSI_C 1
  #endif
  
  #define KLICK		25
  
  #define SLEN		256	    /* long for ensuring no overwrites... */
--- 21,38 ----
  #include "sysdefs.h"	/* system/configurable defines */
  
  
! # define VERSION	"2.4ME+"		/* Version number... */
  
  #if defined(__STDC__) || defined(_AIX)
  # define ANSI_C 1
  #endif
  
+ #if ANSI_C 
+ #define VOLATILE volatile
+ #else
+ #define VOLATILE
+ #endif
+ 
  #define KLICK		25
  
  #define SLEN		256	    /* long for ensuring no overwrites... */
***************
*** 231,238 ****
--- 61,84 ----
  #define TILDE_ESCAPE	'~'		/* escape character~    */
  #define ESCAPE		'\033'		/* the escape		*/
  
+ 
  #define NO_OP_COMMAND	'\0'		/* no-op for timeouts   */
  
+ #define READCH_MASK      0x0FFF         /* Mask flags off        */
+ #define READCH_CURSOR    0x1000         /* Return cursor keys    */      
+ #define READCH_NOCURSOR  0x2000         /* Disable cursor keys   */      
+ 
+ #define REDRAW_MARK    257              /* Artificial "char" for  redrawing */
+ #define UP_MARK        258              /* Artificial UP key    */
+ #define LEFT_MARK      259              /* Artificial LEFT key  */
+ #define RIGHT_MARK     260              /* Artificial RIGHT key */
+ #define DOWN_MARK      261              /* Artificial DOWN key  */
+ #define PAGEUP_MARK    262              /* Artificial PAGE UP key */
+ #define PAGEDOWN_MARK  263              /* Artificial PAGE DOWN key */
+ #define HELP_MARK      264              /* Artificial HELP key      */
+ #define HOME_MARK      265              /* Artificial HOME key      */
+ #define FIND_MARK      266              /* Artificial FIND key      */
+ 
  #define STANDARD_INPUT  0		/* file number of stdin */
  
  #ifndef TRUE
***************
*** 263,268 ****
--- 109,117 ----
  #define SY_ENAB_SIGHUP	(1<<2)		/* pgm to exec can handle signals    */
  #define SY_ENAB_SIGINT	(1<<3)		/*  ...and it can handle SIGINT too  */
  #define SY_DUMPSTATE	(1<<4)		/* create folder state dump file     */
+ #define SY_ENV_METAMAIL	(1<<5)		/* put MM_CHARSET to environ         */
+ #define SY_NOTTY	(1<<6)		/* no tty                    */
+ #define SY_CLRWAIT	(1<<7)		/* clr and wait 'any key' in end     */
  
  /* options to the copy_message() procedure */
  #define CM_REMOVE_HEADER	(1<<0)	/* skip header of message */
***************
*** 270,282 ****
  #define CM_UPDATE_STATUS	(1<<2)	/* Update Status: Header  */
  #define CM_MMDF_HEAD		(1<<3)	/* strip mmdf message seperator */
  #define CM_REMAIL		(1<<4)	/* Add Sender: and Orig-To: headers */
! #define CM_DECODE		(1<<5)	/* prompt for key if message is encrypted */
  
! #define EXECUTE_ACCESS	1		/* These five are 	   */
! #define WRITE_ACCESS	2		/*    for the calls	   */
! #define READ_ACCESS	4		/*       to access()       */
! #define ACCESS_EXISTS	0		/*           <etc>         */
! #define EDIT_ACCESS	6		/*  (this is r+w access)   */
  
  #define BIG_NUM		999999		/* big number!             */
  #define BIGGER_NUM	9999999 	/* bigger number!          */
--- 119,144 ----
  #define CM_UPDATE_STATUS	(1<<2)	/* Update Status: Header  */
  #define CM_MMDF_HEAD		(1<<3)	/* strip mmdf message seperator */
  #define CM_REMAIL		(1<<4)	/* Add Sender: and Orig-To: headers */
! #define CM_DECODE		(1<<5)	/* Decode MIME, PGP and elm */
! #define CM_FILT_HDR		(1<<6)  /* Filter headers (for forwarding) */
! #define CM_DISPLAYING		(1<<7)  /* Pass to MIME code */
! #define CM_REMOVE_ENVELOPE	(1<<8)	/* Remove envelope */
! 
! /* Options for mail() procedure */
! #define MAIL_COPY_MSG          (1<<0)
! #define MAIL_EDIT_MSG          (1<<1)
! #define MAIL_ISFORM            (1<<2)
! #define MAIL_REPLYING          (1<<3)
! #define MAIL_FORWARDING        (1<<4)
! #define MAIL_HAVE_ATTACHMENTS  (1<<5)    /* Flag for verify transmission */
! #define MAIL_HAVE_PGP_ENCODED  (1<<6)    /* Falg for verify transmission */
! 
! /* options to the optionally_enter() function */
! #define OE_APPEND_CURRENT      (1<<0) 
! #define OE_PASSWD              (1<<1)
! #define OE_REDRAW_MARK         (1<<2)
  
! /* xxx_ACCESS moved to down after including of unistd.h */
  
  #define BIG_NUM		999999		/* big number!             */
  #define BIGGER_NUM	9999999 	/* bigger number!          */
***************
*** 287,292 ****
--- 149,160 ----
  #define DONT_SAVE	"[no save]"
  #define DONT_SAVE2	"[nosave]"
  
+ 
+ /* They are used to support Grab_the_file in save() */
+ #define  FLOCKING_OK 0
+ #define  FLOCKING_RETRY 1
+ #define  FLOCKING_FAIL  -1
+ 
  #define alias_file	".aliases"
  #define group_file	".groups"
  #define system_file	".systems"
***************
*** 309,330 ****
  
  /** some defines for the "status" field of the header and alias record **/
  
! #define ACTION		1		/* bit masks, of course */
! #define CONFIDENTIAL	2
! #define DELETED		4
! #define EXPIRED		8
! #define FORM_LETTER	16
! #define NEW		32
! #define PRIVATE		64
! #define TAGGED		128
! #define URGENT		256
! #define VISIBLE		512
! #define UNREAD		1024
! #define STATUS_CHANGED	2048
! #define MIME_MESSAGE	4096	/* indicates existence of MIME Header */
! #define MIME_NEEDDECOD	8192	/* indicates that we need to call mmdecode */
! #define	MIME_NOTPLAIN	16384	/* indicates that we have a content-type,
! 				   for which we need metamail anyway. */
  
  /** some defines for the "type" field of the alias record **/
  
--- 177,205 ----
  
  /** some defines for the "status" field of the header and alias record **/
  
! #define ACTION               1          /* bit masks, of course */
! #define CONFIDENTIAL         2
! #define DELETED              4
! #define EXPIRED              8
! #define FORM_LETTER         16
! #define NEW                 32
! #define PRIVATE             64
! #define TAGGED             128
! #define URGENT             256
! #define VISIBLE            512
! #define UNREAD            1024
! #define REPLIED           2048
! #define MIME_MESSAGE      4096  /* indicates existence of MIME Header */
! #define PRE_MIME_CONTENT  8192
! #define MIME_UNSUPPORTED 16384
! #define NOHDRENCODING    32768
! /* Don't add values bigger than 2^15 == 32768 */
! 
! #ifdef USE_PGP
! #define PGP_MESSAGE		1
! #define PGP_SIGNED_MESSAGE	2
! #define PGP_PUBLIC_KEY		4
! #endif
  
  /** some defines for the "type" field of the alias record **/
  
***************
*** 414,419 ****
--- 289,307 ----
  extern char		*getenv();
  #endif
  
+ 
+ #ifdef I_TIME
+ #  include <time.h>
+ #endif
+ #ifdef I_SYSTIME
+ #  include <sys/time.h>
+ #endif
+ 
+ #ifndef	_POSIX_SOURCE
+ extern struct tm *localtime();
+ extern time_t	  time();
+ #endif
+ 
  /* find tab stops preceding or following a given column position 'a', where
   * the column position starts counting from 1, NOT 0!
   * The external integer "tabspacing" must be declared to use this. */
***************
*** 420,431 ****
  #define prev_tab(a)	(((((a-1)/tabspacing))*tabspacing)+1)
  #define next_tab(a)	(((((a-1)/tabspacing)+1)*tabspacing)+1)
  
- #define movement_command(c)	(c == 'j' || c == 'k' || c == ' ' || 	      \
- 				 c == BACKSPACE || c == ESCAPE || c == '*' || \
- 				 c == '-' || c == '+' || c == '=' ||          \
- 				 c == '#' || c == '@' || c == 'x' || 	      \
- 				 c == 'a' || c == 'q')
- 
  #define no_ret(s)	{ register int xyz; /* varname is for lint */	      \
  		          for (xyz=strlen(s)-1; xyz >= 0 && 		      \
  				(s[xyz] == '\r' || s[xyz] == '\n'); )	      \
--- 308,313 ----
***************
*** 506,526 ****
  #define PMALLOC_THRESHOLD	256	/* if greater, then just use malloc */
  #define PMALLOC_BUFFER_SIZE    2048	/* internal [memory] buffer size... */
  
  /** the following macro is as suggested by Larry McVoy.  Thanks! **/
  
  # ifdef DEBUG
! #  define   dprint(n,x)		{ 				\
! 				   if (debug >= n)  {		\
  				     fprintf x ; 		\
  				     fflush(debugfile);         \
  				   }				\
! 				}
  # else
  #  define   dprint(n,x)
  # endif
  
  /* some random structs... */
  
  struct header_rec {
  	int  lines;		/** # of lines in the message	**/
  	int  status;		/** Urgent, Deleted, Expired?	**/
--- 388,455 ----
  #define PMALLOC_THRESHOLD	256	/* if greater, then just use malloc */
  #define PMALLOC_BUFFER_SIZE    2048	/* internal [memory] buffer size... */
  
+ /* Flags for  classify_header in parse_util.c */
+ 
+ #define HDR_TEXT       1
+ #define HDR_STRUCTURED 2
+ #define HDR_PHRASE     4
+ #define HDR_COMMENT    8     /* inside of comment -- for rfc1522_encode_text */
+ 
  /** the following macro is as suggested by Larry McVoy.  Thanks! **/
  
  # ifdef DEBUG
! #  define   dprint(n,x)		do { 				\
! 				   if (debug >= n && debugfile)  {  \
  				     fprintf x ; 		\
  				     fflush(debugfile);         \
  				   }				\
! 				} while(0)
  # else
  #  define   dprint(n,x)
  # endif
  
+ /* Values for dsn flag */
+ #define DSN_FULL    1
+ #define DSN_HDRS    2
+ #define DSN_SUCCESS 4
+ #define DSN_FAILURE 8
+ #define DSN_DELAY   16
+ #define DSN_NEVER   32
+ 
  /* some random structs... */
  
+ #ifdef MIME
+ #define MIME_magic              0xFD00
+ typedef struct mimeinfo {
+   unsigned short magic;         /* MIME_magic */
+   unsigned char  type;          /* see mime.h for MIME_TYPE_* */
+   unsigned int disposition : 1; /* DISP_INLINE or DISP_ATTACH */
+   unsigned int unlink : 1;      /* used to mark that the file should be
+                                  * unlinked after sending the attachment */
+   unsigned int notplain : 1;
+ 
+   char subtype[WLEN];
+   char *type_opts;
+   char *disposition_opts;
+   char *description;
+ 
+   int encoding;      /* Notice: ENCODING_ILLEGAL == -1, ENCODING_* in mime.h */
+   long length;
+   long begin_offset; /* the beginning of the attachment (includes headers) */
+   long offset;       /* where the real data starts */
+   int flags;
+ 
+   struct mimeinfo *parts; /* If this is a multipart message, pointer
+                            * to the list of parts contained inside it */
+   
+   struct mimeinfo *next; /* pointer to the next attachment in the list */
+   
+   /* These next fields are only used when sending multipart messages. */
+   char *pathname;
+   struct mimeinfo *prev;
+ } mime_t;
+ #endif
+ 
  struct header_rec {
  	int  lines;		/** # of lines in the message	**/
  	int  status;		/** Urgent, Deleted, Expired?	**/
***************
*** 531,538 ****
  	long content_length;	/** content_length in bytes from message header	**/
  	long offset;		/** offset in bytes of message	**/
  	time_t received_time;	/** when elm received here	**/
! 	char from[STRING];	/** who sent the message?	**/
! 	char to[STRING];	/** who it was sent to		**/
  	char messageid[STRING];	/** the Message-ID: value	**/
  	char time_zone[12];	/**                incl. tz	**/
  	time_t time_sent;	/** gmt when sent for sorting	**/
--- 460,469 ----
  	long content_length;	/** content_length in bytes from message header	**/
  	long offset;		/** offset in bytes of message	**/
  	time_t received_time;	/** when elm received here	**/
!         char env_from[STRING];  /* sender from "From "          */
! 	struct addr_item *from;	/** who sent the message?	**/
! 	struct addr_item *to;	/** who it was sent to		**/
!         struct addr_item *cc;
  	char messageid[STRING];	/** the Message-ID: value	**/
  	char time_zone[12];	/**                incl. tz	**/
  	time_t time_sent;	/** gmt when sent for sorting	**/
***************
*** 540,553 ****
--- 471,528 ----
  	time_t tz_offset;	/** offset to gmt of time sent	**/
  	char subject[STRING];   /** The subject of the mail	**/
  	char mailx_status[WLEN];/** mailx status flags (RO...)	**/
+ #ifdef MIME
+ 	mime_t mime_rec;        /** MIME information for this message **/
+ #endif
+ #ifdef USE_PGP
+ 	unsigned int pgp : 3;
+ #endif
+ 	unsigned int binary :1;  /* Binary message -- headers are terminated
+ 				  * with \r\n 
+ 				  */
         };
  
+ #if  ANSI_C
+ # include <stdarg.h>
+ # define Va_start(a,b) va_start(a,b)
+ #else
+ # include <varargs.h>
+ # define Va_start(a,b) va_start(a)
+ #endif
+ 
+ /* inttypes.h includes stdarg.h, so it conflicts with varargs.h 
+  *
+  * varargs.h does not work in 64 bit IRIXes...
+  */
+ 
+ /* inttypes.h can't be used if it conflicts with sys/types.h
+  *
+  * unfortunately sys/types.h does not define uint16_t (in IRIX 5.3),
+  * but including of inttypes.h causes compilation error!
+  */
+ 
+ #if defined(I_INTTYPES) && ANSI_C && !defined(NO_INTTYPES)
+ 
+ #include <inttypes.h>
+ 
+ /* For support 64 bit IRIXes also */
+ #define int32 int32_t
+ #define uint16 uint16_t
+ 
+ #else /* I_INTTYPES */
+ 
  #ifdef __alpha
  #define int32 int
+ #define uint16 unsigned short    /* is this correct? */
  #else
+ 
  #define int32 long
+ #define uint16 unsigned short
+ 
  #endif
  
+ #endif /* I_INTTYPES */
+ 
  struct alias_disk_rec {
  	int32 status;			/* DELETED, TAGGED, VISIBLE, ...     */
  	int32 alias;			/* alias name                        */
***************
*** 621,672 ****
  #  endif
  #endif
  
! #ifndef ANSI_C   /* ANSI puts these in string.h */
  char *index(), *rindex(); /* names will be traslated by define in config.h */
! char *strtok(), *strcpy(), *strcat(), *strncpy(); /* more in string.h in ANSI */
  long lseek();
  int fseek();
- #if defined(__convexc__)
- unsigned sleep();
- #else
- unsigned long sleep();
  #endif
  #else
! #  ifdef I_UNISTD /* unistd.h available */
! #    include <unistd.h> /* ansi C puts sleep, lseek and fseek in unistd.h */
! #  else /* I_UNISTD */
! long lseek();
! int fseek();
! unsigned long sleep();
! #  endif /* I_UNISTD */
  #endif
  char *strtokq(); /* our own quote minding strtok */
  
- #ifndef STRSTR
- char *strstr();
- #endif
  
  #ifdef I_LOCALE
  #include <locale.h>
  #endif
  
  #ifdef I_NL_TYPES
  #include <nl_types.h>
  #else
! #include "../hdrs/nl_types.h"
  #endif
  
- #ifndef	USENLS
  #define MCprintf printf
  #define MCfprintf fprintf
  #define MCsprintf sprintf
! #else
  #include "mcprt.h"
- #endif
  
  #ifdef POSIX_SIGNALS
  #define signal posix_signal
! #if ANSI_C
  extern SIGHAND_TYPE (*posix_signal(int, SIGHAND_TYPE (*)(int)))(int);
  #else	/* ANSI_C */
  extern SIGHAND_TYPE (*posix_signal())();
--- 596,655 ----
  #  endif
  #endif
  
! #ifdef I_UNISTD
! #include <unistd.h>
! #else
! unsigned sleep();
  char *index(), *rindex(); /* names will be traslated by define in config.h */
! char *strcpy(), *strcat(), *strncpy(); /* more in string.h in ANSI */
  long lseek();
  int fseek();
  #endif
+ 
+ /* Defined in unistd.h ... */
+ #ifdef F_OK
+ #define EXECUTE_ACCESS  X_OK
+ #define WRITE_ACCESS    W_OK
+ #define READ_ACCESS     R_OK
+ #define ACCESS_EXISTS   F_OK
+ #define EDIT_ACCESS     (W_OK|R_OK)
  #else
! #define EXECUTE_ACCESS	1		/* These five are 	   */
! #define WRITE_ACCESS	2		/*    for the calls	   */
! #define READ_ACCESS	4		/*       to access()       */
! #define ACCESS_EXISTS	0		/*           <etc>         */
! #define EDIT_ACCESS	6		/*  (this is r+w access)   */
  #endif
+ 
  char *strtokq(); /* our own quote minding strtok */
  
  
  #ifdef I_LOCALE
  #include <locale.h>
  #endif
  
+ #ifndef	USENLS
+ 
  #ifdef I_NL_TYPES
  #include <nl_types.h>
  #else
! #include "elm_nl_types.h"
  #endif
  
  #define MCprintf printf
  #define MCfprintf fprintf
  #define MCsprintf sprintf
! 
! #else /* USENLS */
! 
! #include "elm_nl_types.h"
  #include "mcprt.h"
  
+ #endif /* USENLS */
+ 
  #ifdef POSIX_SIGNALS
  #define signal posix_signal
! #ifdef ANSI_C
  extern SIGHAND_TYPE (*posix_signal(int, SIGHAND_TYPE (*)(int)))(int);
  #else	/* ANSI_C */
  extern SIGHAND_TYPE (*posix_signal())();
***************
*** 690,695 ****
--- 673,686 ----
  # define LONGJMP(env,val)	longjmp((env), (val))
  #endif
  
+ #if defined(POSIX_SIGNALS) && defined(HASWAITPID)
+ #define BACKGROUD_PROCESSES               /* Only with POSIX signals */
+ #endif
+ 
+ #if defined(HASWAITPID) || defined(BSD_TYPE) 
+ #include <sys/wait.h>
+ #endif
+ 
  /*
   * Some of the old BSD ctype conversion macros corrupted characters.
   * We will substitute our own versions if required.
***************
*** 737,743 ****
  char *shift_lower();
  char *strip_commas();
  char *strip_parens();
- char *strpbrk();
  char *qstrpbrk();
  char *strfcpy();
  char *strtok();
--- 728,733 ----
***************
*** 746,751 ****
--- 736,745 ----
  char *pmalloc();
  char *header_cmp();
  char *safe_strdup();
+ 
+ FILE *safeopen();
+ FILE *safeopen_rdwr();
+ FILE *open_end_update();
  
  malloc_t safe_malloc();
  malloc_t safe_realloc();
Index: elm2.4.ME+.50/hdrs/elm.h
*** elm2.4.25/hdrs/elm.h	Thu Sep  1 22:42:40 1994
--- elm2.4.ME+.50/hdrs/elm.h	Tue Nov 17 21:14:08 1998
***************
*** 1,85 ****
  
! /* $Id: elm.h,v 5.12 1994/09/01 19:42:39 syd Exp $ */
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: elm.h,v $
!  * Revision 5.12  1994/09/01  19:42:39  syd
!  * Moved #defines for SETJMP & LONGJMP from src/editmsg.c to hdrs/defs.h and
!  * used them instead of (set|long)jmp directly. This makes the usage consistent
!  * and Solaris 2.3 behaves correctly w.r.t stop/continue.
!  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
!  *
!  * Revision 5.11  1994/08/30  18:16:05  syd
!  * Fix up Solaris and SVR4 signal handling for timeout
!  * From: Syd
!  *
!  * Revision 5.10  1993/08/10  18:49:32  syd
!  * When an environment variable was given as the tmpdir definition the src
!  * and dest overlapped in expand_env.  This made elm produce a garbage
!  * expansion because expand_env cannot cope with overlapping src and
!  * dest.  I added a new variable raw_temp_dir to keep src and dest not to
!  * overlap.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.9  1993/05/08  20:03:12  syd
!  * add sleepmsg to list
!  *
!  * Revision 5.8  1993/05/08  18:56:16  syd
!  * created a new elmrc variable named "readmsginc".  This specifies an
!  * increment by which the message count is updated.  If this variable is
!  * set to, say, 25, then the message count will only be updated every 25
!  * messages, displaying 0, 25, 50, 75, and so forth.  The default value
!  * of 1 will cause Elm to behave exactly as it currently does in PL21.
!  * From: Eric Peterson <epeterso@encore.com>
!  *
!  * Revision 5.7  1993/01/20  17:37:56  syd
!  * fix spacing of =- to avoid compiler warnings
!  *
!  * Revision 5.6  1993/01/20  04:01:07  syd
!  * Adds a new integer parameter builtinlines.
!  * if (builtinlines < 0) and (the length of the message < LINES on
!  *       screen + builtinlines) use internal.
!  * if (builtinlines > 0) and (length of message < builtinlines)
!  * 	use internal pager.
!  * if (builtinlines = 0) or none of the above conditions hold, use the
!  * external pager if defined.
!  * From: "John P. Rouillard" <rouilj@ra.cs.umb.edu>
!  *
!  * Revision 5.5  1992/10/25  02:38:27  syd
!  * Add missing new flags for new elmrc options for confirm
!  * From: Syd
!  *
!  * Revision 5.4  1992/10/24  13:44:41  syd
!  * There is now an additional elmrc option "displaycharset", which
!  * sets the charset supported on your terminal. This is to prevent
!  * elm from calling out to metamail too often.
!  * Plus a slight documentation update for MIME composition (added examples)
!  * From: Klaus Steinberger <Klaus.Steinberger@Physik.Uni-Muenchen.DE>
!  *
!  * Revision 5.3  1992/10/24  13:35:39  syd
!  * changes found by using codecenter on Elm 2.4.3
!  * From: Graham Hudspith <gwh@inmos.co.uk>
!  *
!  * Revision 5.2  1992/10/17  22:58:57  syd
!  * patch to make elm use (or in my case, not use) termcap/terminfo ti/te.
!  * From: Graham Hudspith <gwh@inmos.co.uk>
!  *
!  * Revision 5.1  1992/10/03  22:34:39  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /**  Main header file for ELM mail system.  **/
  
--- 1,16 ----
  
! /* $Id: elm.h,v 1.3 1998/11/07 14:12:04 hurtta Exp $ */
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.3 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /**  Main header file for ELM mail system.  **/
  
***************
*** 89,97 ****
  #include <errno.h>
  #include <signal.h>
  
! #include "../hdrs/curses.h"
! #include "../hdrs/defs.h"
  #include <setjmp.h>
  
  /******** static character string containing the version number  *******/
  
--- 20,31 ----
  #include <errno.h>
  #include <signal.h>
  
! #include "curses.h"
! #include "defs.h"
  #include <setjmp.h>
+ /*
+ #include "melib.h"
+ */
  
  /******** static character string containing the version number  *******/
  
***************
*** 104,109 ****
--- 38,44 ----
  
  /******** global variables accessable by all pieces of the program *******/
  
+ 
  int check_size = 0;		/* don't start mailer if no mail */
  int current = 0;		/* current message number  */
  int header_page = 0;     	/* current header page     */
***************
*** 116,177 ****
  int sendmail_verbose = 0;       /* Extended mail debugging */
  int redraw = 0,	 		/* do we need to rewrite the entire screen? */
      nucurr = 0,	 		/* change list or just the current pointer...   */
!     nufoot = 0,	 		/* clear lines 16 thru bottom and new menu  */
!     readmsginc = 1,		/* increment of msg cnt when reading new mbox */
!     sleepmsg = 2;		/* time to sleep for messages being overwritten on screen */
  #ifdef MIME
! char charset[SLEN] = {0};		/* name of character set */
! char display_charset[SLEN] = {0};	/* the charset, the display supports */
! char charset_compatlist[SLEN] = {0};	/* list of charsets which are a
! 					   superset of us-ascii */
! char text_encoding[SLEN] = {0};	/* default encoding for text/plain */
  #endif
  char cur_folder[SLEN] = {0};	/* name of current folder */
  char cur_tempfolder[SLEN] = {0};/* name of temp folder open for a mailbox */
! char defaultfile[SLEN] = {0};	/* name of default folder */
! char temp_dir[SLEN] = {0};      /* name of temp directory */
! char raw_temp_dir[SLEN] = {0};  /* unexpanded name of temp directory */
! char hostname[SLEN] = {0};	/* name of machine we're on*/
! char hostdomain[SLEN] = {0};	/* name of domain we're in */
! char hostfullname[SLEN] = {0};	/* name of FQDN we're in */
  char item[WLEN] = "message";	/* either "message" or "alias" */
  char items[WLEN] = "messages";	/* plural: either "messages" or "aliases" */
  char Item[WLEN] = "Message";	/* CAP: either "Message" or "Alias" */
  char Items[WLEN] = "Messages";	/* CAP-plural: either "Messages" or "Aliases" */
  char Prompt[WLEN] = "Command: ";	/* Menu Prompt: either "Command" or "Alias" */
! char username[SLEN] = {0};	/* return address name!    */
! char full_username[SLEN] = {0};	/* Full username - gecos   */
! char home[SLEN] = {0};		/* home directory of user  */
! char folders[SLEN] = {0};	/* folder home directory   */
! char raw_folders[SLEN] = {0};	/* unexpanded folder home directory   */
! char recvd_mail[SLEN] = {0};	/* folder for storing received mail     */
! char raw_recvdmail[SLEN] = {0};	/* unexpanded recvd_mail name */
! char editor[SLEN] = {0};	/* editor for outgoing mail*/
! char raw_editor[SLEN] = {0};	/* unexpanded editor for outgoing mail*/
! char alternative_editor[SLEN] = {0};	/* alternative editor...   */
! char printout[SLEN] = {0};	/* how to print messages   */
! char raw_printout[SLEN] = {0};	/* unexpanded how to print messages   */
! char sent_mail[SLEN] = {0};	/* name of file to save copies to */
! char raw_sentmail[SLEN] = {0};	/* unexpanded name of file to save to */
! char calendar_file[SLEN] = {0};	/* name of file for clndr  */
! char raw_calendar_file[SLEN] = {0};	/* unexpanded name of file for clndr  */
! char attribution[SLEN] = {0};	/* attribution string for replies     */
! char prefixchars[SLEN] = "> ";	/* prefix char(s) for msgs */
! char shell[SLEN] = {0};		/* current system shell    */
! char raw_shell[SLEN] = {0};	/* unexpanded current system shell    */
! char pager[SLEN] = {0};		/* what pager to use       */
! char raw_pager[SLEN] = {0};	/* unexpanded what pager to use       */
  char batch_subject[SLEN] = {0};	/* subject buffer for batchmail */
  char included_file[SLEN] = {0};	/* prepared file to include in the edit buf */
! char local_signature[SLEN] = {0};	/* local msg signature file     */
! char raw_local_signature[SLEN] = {0};	/* unexpanded local msg signature file     */
! char remote_signature[SLEN] = {0};	/* remote msg signature file    */
! char raw_remote_signature[SLEN] = {0};	/* unexpanded remote msg signature file    */
  char version_buff[NLEN] = {0};	/* version buffer */
! char e_editor[SLEN] = {0};	/* "~e" editor...   */
! char v_editor[SLEN] = {0};	/* "~v" editor...   */
! char config_options[SLEN] = {0};	/* which options are in o)ptions */
! char allowed_precedences[SLEN] = {0};	/* list of precedences user may specify */
   
  char *def_ans_yes;		/* default yes answer - single char, lc	*/
  char *def_ans_no;		/* default no answer - single char, lc	*/
--- 51,117 ----
  int sendmail_verbose = 0;       /* Extended mail debugging */
  int redraw = 0,	 		/* do we need to rewrite the entire screen? */
      nucurr = 0,	 		/* change list or just the current pointer...   */
!     nufoot = 0;	 		/* clear lines 16 thru bottom and new menu  */
! 
! 
  #ifdef MIME
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
  #endif
  char cur_folder[SLEN] = {0};	/* name of current folder */
  char cur_tempfolder[SLEN] = {0};/* name of temp folder open for a mailbox */
! char cur_editfile[SLEN] = {0};  /* editor buffer */
! 
! 
! 
! 
! 
  char item[WLEN] = "message";	/* either "message" or "alias" */
  char items[WLEN] = "messages";	/* plural: either "messages" or "aliases" */
  char Item[WLEN] = "Message";	/* CAP: either "Message" or "Alias" */
  char Items[WLEN] = "Messages";	/* CAP-plural: either "Messages" or "Aliases" */
  char Prompt[WLEN] = "Command: ";	/* Menu Prompt: either "Command" or "Alias" */
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
  char batch_subject[SLEN] = {0};	/* subject buffer for batchmail */
  char included_file[SLEN] = {0};	/* prepared file to include in the edit buf */
! #ifdef MIME
! mime_t *attach_files = NULL;    /* prepare attachments for sending */
! #endif
! 
! 
! 
! 
  char version_buff[NLEN] = {0};	/* version buffer */
! 
! 
! 
! 
   
  char *def_ans_yes;		/* default yes answer - single char, lc	*/
  char *def_ans_no;		/* default no answer - single char, lc	*/
***************
*** 190,278 ****
  char *copied_word;		/* copied */
  
  char backspace,			/* the current backspace char */
-      escape_char = TILDE_ESCAPE,/* '~' or something else..    */
-      kill_line;			/* the current kill-line char */
  
! char up[SHORT] = {0},		/* cursor control seq's    */
!      down[SHORT] = {0},
!      left[SHORT] = {0},
!      right[SHORT] = {0};
! int  cursor_control = FALSE;	/* cursor control avail?   */
  
  int  has_highlighting = FALSE;	/* highlighting available? */
  
! char *weedlist[MAX_IN_WEEDLIST] = {0};
! int  weedcount;
  
! int allow_forms = NO;		/* flag: are AT&T Mail forms okay?  */
! int mini_menu = 1;		/* flag: menu specified?	    */
! int metoo = 0;			/* flag: copy me on mail to alias?  */
! int prompt_after_pager = 1;	/* flag: prompt after pager exits   */
  int folder_type = 0;		/* flag: type of folder		    */
! int auto_copy = 0;		/* flag: automatically copy source? */
! int filter = 1;			/* flag: weed out header lines?	    */
! int resolve_mode = 1;		/* flag: delete saved mail?	    */
! int auto_cc = 0;		/* flag: mail copy to user?	    */
! int noheader = 1;		/* flag: copy + header to file?     */
! int title_messages = 1;		/* flag: title message display?     */
! int forwarding = 0;		/* flag: are we forwarding the msg? */
! int hp_terminal = 0;		/* flag: are we on HP term?	    */
! int hp_softkeys = 0;		/* flag: are there softkeys?        */
! int save_by_name = 1;		/* flag: save mail by login name?   */
! int force_name = 0;		/* flag: save by name forced?	    */
  int mail_only = 0;		/* flag: send mail then leave?      */
  int check_only = 0;		/* flag: check aliases then leave?  */
  int batch_only = 0;		/* flag: send without prompting?    */
! int move_when_paged = 0;	/* flag: move when '+' or '-' used? */
! int point_to_new = 1;		/* flag: start pointing at new msg? */
! int builtin_lines= -3;		/* int: if < 0 use builtin if message
! 					shorter than LINES+builtin_lines
! 					else use pager. If > 0 use builtin
! 					if message has fewer than # of lines */
! int bounceback = 0;		/* flag: bounce copy off remote?    */
! int always_keep = 1;		/* flag: always keep unread msgs?   */
! int always_store = 0;		/* flag: always store read msgs?    */
! int always_del = 0;		/* flag: always delete marked msgs? */
! int arrow_cursor = 0;		/* flag: use "->" cursor regardless?*/
! int debug = 0; 			/* flag: default is no debug!       */
! int user_level = 0;		/* flag: how good is the user?      */
  int selected = 0;		/* flag: used for select stuff      */
! int names_only = 1;		/* flag: display user names only?   */
! int question_me = 1;		/* flag: ask questions as we leave? */
! int keep_empty_files = 0;	/* flag: leave empty folder files? */
! int clear_pages = 0;		/* flag: act like "page" (more -c)? */
! int prompt_for_cc = 1;		/* flag: ask user for "cc:" value?  */
! int sig_dashes = 1;		/* flag: include dashes above sigs? */
! int use_tite = 1;		/* flag: use termcap/terminfo ti/te?*/
! int confirm_append = 0;		/* flag: confirm append to folder?  */
! int confirm_create = 0;		/* flag: confirm create new folder? */
! int confirm_files = 0;		/* flag: confirm files for append?  */
! int confirm_folders = 0;	/* flag: confirm folders for create?*/
  
- int sortby = REVERSE SENT_DATE;	/* how to sort incoming mail...     */
- int alias_sortby = NAME_SORT;	/* how to sort aliases...           */
  
- long timeout = 600L;		/* timeout (secs) on main prompt    */
  
  /** set up some default values for a 'typical' terminal *snicker* **/
  
! int LINES=23;			/** lines per screen      **/
! int COLUMNS=80;			/** columns per page      **/
  #ifdef SIGWINCH
! int resize_screen = 0;		/** SIGWINCH occured?	  **/
  #endif
  
  long size_of_pathfd;		/** size of pathfile, 0 if none **/
  
  FILE *mailfile;			/* current folder	    */
- FILE *debugfile;		/* file for debug output    */
  FILE *pathfd;			/* path alias file          */
  FILE *domainfd;			/* domain file		    */
- nl_catd elm_msg_cat = 0;	/* message catalog	    */
  
  long mailfile_size;		/* size of current mailfile */
  
! int   max_headers = 0;		/* number of headers allocated */
  
  struct header_rec **headers;    /* array of header structure pointers */
  
--- 130,220 ----
  char *copied_word;		/* copied */
  
  char backspace,			/* the current backspace char */
  
!      kill_line,			/* the current kill-line char */
!      word_erase,		/* the current word-erase char */
!      interrupt_char,		/* the current interrupt char */
!      reprint_char,		/* the current reprint-line char */
!      eof_char;			/* the current end-of-file char */
  
  int  has_highlighting = FALSE;	/* highlighting available? */
  
! 
! 
! 
  
! 
! int write_elmrc = 0;            /* flag: write elmrc in starting    */
! 
! 
  int folder_type = 0;		/* flag: type of folder		    */
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
  int mail_only = 0;		/* flag: send mail then leave?      */
  int check_only = 0;		/* flag: check aliases then leave?  */
  int batch_only = 0;		/* flag: send without prompting?    */
! 
! 
! 
! 
! 
! 
! 
! 
! 
  int selected = 0;		/* flag: used for select stuff      */
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
  
  
  
+ 
+ 
+ 
+ 
+ 
+ 
+ 
  /** set up some default values for a 'typical' terminal *snicker* **/
  
! int elm_LINES=23;		/** lines per screen      **/
! int elm_COLUMNS=80;		/** columns per page      **/
  #ifdef SIGWINCH
! VOLATILE int resize_screen = 0;		/** SIGWINCH occured?	  **/
! #endif
! VOLATILE int redraw_screen = 0;          /* Elm suspended?          */
! #ifdef BACKGROUD_PROCESSES       
! VOLATILE int handle_sigchld = 0;       /* got SIGCHLD */
! 
  #endif
  
+ 
  long size_of_pathfd;		/** size of pathfile, 0 if none **/
  
  FILE *mailfile;			/* current folder	    */
  FILE *pathfd;			/* path alias file          */
  FILE *domainfd;			/* domain file		    */
  
  long mailfile_size;		/* size of current mailfile */
  
! int   max_headers = 0;		/* number of headers alloated */
  
  struct header_rec **headers;    /* array of header structure pointers */
  
***************
*** 279,294 ****
  struct alias_rec **aliases;     /* for the alias menu */
  int   max_aliases = 0;		/* number of aliases allocated */
  
- struct addr_rec *alternative_addresses;	/* how else do we get mail? */
  
  int system_data = -1;		/* fileno of system data file */
  int user_data = -1;		/* fileno of user data file   */
  
! int userid;			/* uid for current user	      */
! int groupid;			/* groupid for current user   */
! #ifdef SAVE_GROUP_MAILBOX_ID
! int mailgroupid;		/* groupid for current user   */
! #endif
  
  JMP_BUF GetPromptBuf;		/* setjmp buffer */
  int InGetPrompt;		/* set if in GetPrompt() in read() */
--- 221,260 ----
  struct alias_rec **aliases;     /* for the alias menu */
  int   max_aliases = 0;		/* number of aliases allocated */
  
  
+ 
  int system_data = -1;		/* fileno of system data file */
  int user_data = -1;		/* fileno of user data file   */
  
! 
! 
! 
! 
  
+ 
  JMP_BUF GetPromptBuf;		/* setjmp buffer */
  int InGetPrompt;		/* set if in GetPrompt() in read() */
+ #ifdef USE_PGP
+ 
+ int pgp_status=0;    /* var to keep track of pgp internals */
+ 
+ 
+ 
+ 
+ #endif
+ int me_retcode;
+ 
+ #ifdef MIME
+ 
+ 
+ 
+ 
+ short mime_count = 0; /* A counter used so that each call to
+                        * mime_generate_boundary() returns a unique value.
+                        */
+ mime_t *attachments = NULL;
+ 
+ #endif
+ #ifdef USE_REMAILER
+ int remailing;
+ #endif
Index: elm2.4.ME+.50/hdrs/elmutil.h
*** elm2.4.25/hdrs/elmutil.h	Sun Oct  4 01:35:07 1992
--- elm2.4.ME+.50/hdrs/elmutil.h	Tue Nov 17 21:14:08 1998
***************
*** 1,24 ****
  
! /* $Id: elmutil.h,v 5.1 1992/10/03 22:34:39 syd Exp $ */
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: elmutil.h,v $
!  * Revision 5.1  1992/10/03  22:34:39  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /**  Main header file for ELM utilities.  **/
  
--- 1,16 ----
  
! /* $Id: elmutil.h,v 1.3 1998/11/07 14:12:04 hurtta Exp $ */
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.3 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /**  Main header file for ELM utilities.  **/
  
***************
*** 28,35 ****
  #include <errno.h>
  #include <signal.h>
  
! #include "../hdrs/curses.h"
! #include "../hdrs/defs.h"
  
  /******** static character string containing the version number  *******/
  
--- 20,30 ----
  #include <errno.h>
  #include <signal.h>
  
! #include "curses.h"
! #include "defs.h"
! 
! #include "patchlevel.h"
! #include "elmlib.h"
  
  /******** static character string containing the version number  *******/
  
***************
*** 42,57 ****
  
  /******** global variables accessable by all pieces of the program *******/
  
! char hostname[SLEN] = {0};      /* name of machine we're on*/
! char hostdomain[SLEN] = {0};    /* name of domain we're in */
! char hostfullname[SLEN] = {0};  /* name of FQDN we're in */
! char username[SLEN] = {0};      /* return address name!    */
! char full_username[SLEN] = {0}; /* Full username - gecos   */
! nl_catd elm_msg_cat = 0;	/* message catalog	    */
! int userid;			/* uid for current user	      */
! int groupid;			/* groupid for current user   */
  
- struct addr_rec *alternative_addresses = NULL;	/* can't do it without elmrc */
  
  extern char *gcos_name();
  extern char *get_full_name();
--- 37,52 ----
  
  /******** global variables accessable by all pieces of the program *******/
  
! 
! 
! 
! 
! 
! 
! 
! 
! 
  
  
  extern char *gcos_name();
  extern char *get_full_name();
Index: elm2.4.ME+.50/hdrs/filter.h
*** elm2.4.25/hdrs/filter.h	Tue Aug  3 22:28:44 1993
--- elm2.4.ME+.50/hdrs/filter.h	Tue Nov 17 21:14:08 1998
***************
*** 1,83 ****
  
! /* $Id: filter.h,v 5.11 1993/08/03 19:28:39 syd Exp $ */
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.11 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: filter.h,v $
!  * Revision 5.11  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.10  1993/06/06  17:34:40  syd
!  * remove useless _vbuf definition
!  *
!  * Revision 5.9  1993/04/16  04:16:24  syd
!  * For convex, #if-defed memcpy, memset and sleep.
!  * From: rzm@oso.chalmers.se (Rafal Maszkowski)
!  *
!  * Revision 5.8  1993/04/12  03:30:23  syd
!  * On AIX, __STDC__ is not defined but it does use unistd.h, etc.  In
!  * hdrs/def.h, ANS_C already gets defined if __STDC__ or _AIX.  But this
!  * variable then needs to be used in src/init.c and hdrs/filter.h in place
!  * of the current test for __STDC__.
!  * From:	rstory@elegant.com (Robert Story)
!  *
!  * Revision 5.7  1993/04/12  03:25:26  syd
!  * Use I_UNISTD instead of UNISTD_H
!  *
!  * Revision 5.6  1993/04/12  03:22:49  syd
!  * Add UNISTD_H to check for unistd.h include
!  * From: Syd
!  *
!  * Revision 5.5  1993/02/03  17:12:53  syd
!  * move more declarations to defs.h, including sleep
!  * From: Syd
!  *
!  * Revision 5.4  1993/01/27  19:45:15  syd
!  * Filter turns spaces in quoted strings into _ and then back again. This destroys
!  * any _ that where there in the first place. This patch removes that.
!  * Also fixed a minor bug where 'filter -r' wrote out the wrong thing if the
!  * relation in a rule was '~'.
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.3  1992/11/15  01:42:57  syd
!  * Add regexp processing to filter.
!  * Add execc operator
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.2  1992/10/24  14:20:24  syd
!  * remove the 25 (MAXRULES) limitation.
!  * Basically it mallocs rules in hunks of RULESINC (25) as it goes along.
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.1  1992/10/03  22:34:39  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** Headers for the filter program.
  
  **/
  
  #include "regexp.h"
  
  /** define a few handy macros for later use... **/
--- 1,22 ----
  
! /* $Id: filter.h,v 1.3 1998/11/07 14:12:04 hurtta Exp $ */
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.3 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** Headers for the filter program.
  
  **/
  
+ #include <stdio.h>
  #include "regexp.h"
  
  /** define a few handy macros for later use... **/
***************
*** 153,162 ****
  
  #ifdef MAIN_ROUTINE
  
- char home[SLEN],				/* the users home directory */
-      hostname[SLEN],			/* the machine name...      */
-      username[SLEN];			/* the users login name...  */
- 
  char to[VERY_LONG_STRING], 
       from[LONG_STRING], 
       subject[LONG_STRING],		/* from current message     */
--- 92,97 ----
***************
*** 165,171 ****
  FILE *outfd;
  char outfname[SLEN];
  char filterfile[SLEN];
- nl_catd elm_msg_cat = 0;			/* message catalog          */
  
  int  total_rules = 0,				/* how many rules to check  */
       sizeof_rules = 0,				/* how big is rules array?  */
--- 100,105 ----
***************
*** 184,193 ****
    
  #else
  
- extern char home[SLEN],				/* the users home directory */
-             hostname[SLEN],			/* the machine name...      */
-             username[SLEN];			/* the users login name...  */
  
  extern char to[VERY_LONG_STRING], 
              from[LONG_STRING], 
  	    subject[LONG_STRING],		/* from current message     */
--- 118,126 ----
    
  #else
  
  
+ 
+ 
  extern char to[VERY_LONG_STRING], 
              from[LONG_STRING], 
  	    subject[LONG_STRING],		/* from current message     */
***************
*** 196,202 ****
  extern FILE *outfd;
  extern char outfname[SLEN];
  extern char filterfile[SLEN];
- extern nl_catd elm_msg_cat;			/* message catalog          */
  
  extern int total_rules,				/* how many rules to check  */
             sizeof_rules,			/* how big is rules array?  */
--- 129,134 ----
***************
*** 241,254 ****
  
  char *itoa();
  
! #ifdef	ANSI_C		/*{ANSI_C*/
  #include <string.h>
! #  ifdef I_UNISTD /* unistd.h available */
  #    include <unistd.h>
! #  else /* I_UNISTD */
! unsigned long sleep();
! #  endif /* I_UNISTD */
! #else				/*}ANSI_C{*/
  unsigned short getuid();
  
  #if defined(__convexc__)
--- 173,186 ----
  
  char *itoa();
  
! #ifdef	ANSI_C		
  #include <string.h>
! #endif
! 
! # ifdef I_UNISTD /* unistd.h available */
  #    include <unistd.h>
! # else
! 
  unsigned short getuid();
  
  #if defined(__convexc__)
***************
*** 259,268 ****
  
  char *strcpy(), *strcat();
  
! #ifdef BSD
! 	
!   FILE *popen();
  
! #endif
  
- #endif				/*}ANSI_C*/
--- 191,201 ----
  
  char *strcpy(), *strcat();
  
! #endif		
  
! extern void expand_macros P_((char *, char *, int, int, int));
! extern void expand_filename P_((char *filename, int namesize));
! extern int save_message P_((char *foldername, int namesize));
! 
! 
  
Index: elm2.4.ME+.50/hdrs/headers.h
*** elm2.4.25/hdrs/headers.h	Thu Sep  1 22:42:40 1994
--- elm2.4.ME+.50/hdrs/headers.h	Tue Nov 17 21:14:08 1998
***************
*** 1,86 ****
  
! /* $Id: headers.h,v 5.13 1994/09/01 19:42:39 syd Exp $ */
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.13 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: headers.h,v $
!  * Revision 5.13  1994/09/01  19:42:39  syd
!  * Moved #defines for SETJMP & LONGJMP from src/editmsg.c to hdrs/defs.h and
!  * used them instead of (set|long)jmp directly. This makes the usage consistent
!  * and Solaris 2.3 behaves correctly w.r.t stop/continue.
!  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
!  *
!  * Revision 5.12  1994/08/30  18:16:05  syd
!  * Fix up Solaris and SVR4 signal handling for timeout
!  * From: Syd
!  *
!  * Revision 5.11  1993/08/10  20:49:40  syd
!  * Add raw_temp_dir
!  *
!  * Revision 5.10  1993/05/08  20:03:12  syd
!  * add sleepmsg to list
!  *
!  * Revision 5.9  1993/05/08  18:56:16  syd
!  * created a new elmrc variable named "readmsginc".  This specifies an
!  * increment by which the message count is updated.  If this variable is
!  * set to, say, 25, then the message count will only be updated every 25
!  * messages, displaying 0, 25, 50, 75, and so forth.  The default value
!  * of 1 will cause Elm to behave exactly as it currently does in PL21.
!  * From: Eric Peterson <epeterso@encore.com>
!  *
!  * Revision 5.8  1993/04/21  01:24:54  syd
!  * It's very non-portable, and fairly dangerous, to ass_u_me that you
!  * know what's inside a FILE.  So don't #define clearerr().
!  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
!  *
!  * Revision 5.7  1993/01/20  04:01:07  syd
!  * Adds a new integer parameter builtinlines.
!  * if (builtinlines < 0) and (the length of the message < LINES on
!  *       screen + builtinlines) use internal.
!  * if (builtinlines > 0) and (length of message < builtinlines)
!  * 	use internal pager.
!  * if (builtinlines = 0) or none of the above conditions hold, use the
!  * external pager if defined.
!  * From: "John P. Rouillard" <rouilj@ra.cs.umb.edu>
!  *
!  * Revision 5.6  1992/10/30  21:47:30  syd
!  * Use copy_message in mime shows to get encode processing
!  * From: bjoerns@stud.cs.uit.no (Bjoern Stabell)
!  *
!  * Revision 5.5  1992/10/25  02:38:27  syd
!  * Add missing new flags for new elmrc options for confirm
!  * From: Syd
!  *
!  * Revision 5.4  1992/10/24  13:44:41  syd
!  * There is now an additional elmrc option "displaycharset", which
!  * sets the charset supported on your terminal. This is to prevent
!  * elm from calling out to metamail too often.
!  * Plus a slight documentation update for MIME composition (added examples)
!  * From: Klaus Steinberger <Klaus.Steinberger@Physik.Uni-Muenchen.DE>
!  *
!  * Revision 5.3  1992/10/24  13:35:39  syd
!  * changes found by using codecenter on Elm 2.4.3
!  * From: Graham Hudspith <gwh@inmos.co.uk>
!  *
!  * Revision 5.2  1992/10/17  22:58:57  syd
!  * patch to make elm use (or in my case, not use) termcap/terminfo ti/te.
!  * From: Graham Hudspith <gwh@inmos.co.uk>
!  *
!  * Revision 5.1  1992/10/03  22:34:39  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /**  This is the header file for ELM mail system.  **/
  
--- 1,16 ----
  
! /* $Id: headers.h,v 1.3 1998/11/07 14:12:04 hurtta Exp $ */
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.3 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /**  This is the header file for ELM mail system.  **/
  
***************
*** 97,104 ****
--- 27,39 ----
  #include "mime.h"
  #endif
  
+ #include "elmlib.h"
+ /*
+ #include "me.h"
+ */
  /******** global variables accessable by all pieces of the program *******/
  
+ 
  extern int check_size;		/* don't start mailer if no mail */
  extern int current;		/* current message number  */
  extern int header_page;         /* current header page     */
***************
*** 111,172 ****
  extern int sendmail_verbose;    /* Allow extended debugging on sendmail */
  extern int redraw, 		/** do we need to rewrite the entire screen? **/
             nucurr, 		/** change list or just the current pointer  **/
!            nufoot, 		/** clear lines 16 thru bottom and new menu  **/
! 	   readmsginc,		/* msg cnt increment during new mbox read */
! 	   sleepmsg;		/* time to sleep for messages being overwritten on screen */
  #ifdef MIME
! extern char charset[SLEN];	/* name of character set */
! extern char display_charset[SLEN];	/* name of character set */
! extern char charset_compatlist[SLEN];	/* list of charsets which are a
! 					   superset of us-ascii */
  extern char text_encoding[SLEN];	/* default encoding for text/plain */
  #endif
! extern char cur_folder[SLEN];	/* name of current folder */
  extern char cur_tempfolder[SLEN]; /* name of temp folder open for a mailbox */
! extern char defaultfile[SLEN];	/* name of default folder */
! extern char temp_dir[SLEN];     /* name of temp directory */
! extern char raw_temp_dir[SLEN]; /* unexpanded name of temp directory */
! extern char hostname[SLEN];	/* name of machine we're on*/
! extern char hostdomain[SLEN];	/* name of domain we're in */
! extern char hostfullname[SLEN]; /* name of FQDN we're in */
  extern char item[WLEN];		/* either "message" or "alias" */
  extern char items[WLEN];	/* plural: either "messages" or "aliases" */
  extern char Item[WLEN];		/* CAP: either "Message" or "Alias" */
  extern char Items[WLEN];	/* CAP-plural: either "Messages" or "Aliases" */
  extern char Prompt[WLEN];	/* Menu Prompt: either "Command" or "Alias" */
! extern char username[SLEN];	/* return address name!    */
! extern char full_username[SLEN];/* Full username - gecos   */
! extern char home[SLEN];		/* home directory of user  */
! extern char folders[SLEN];	/* folder home directory   */
! extern char raw_folders[SLEN];	/* unexpanded folder home directory   */
! extern char recvd_mail[SLEN];	/* folder for storing received mail	*/
! extern char raw_recvdmail[SLEN];/* unexpanded recvd_mail name */
! extern char editor[SLEN];	/* default editor for mail */
! extern char raw_editor[SLEN];	/* unexpanded default editor for mail */
! extern char alternative_editor[SLEN];/* the 'other' editor */
! extern char printout[SLEN];	/* how to print messages   */
! extern char raw_printout[SLEN];	/* unexpanded how to print messages   */
! extern char sent_mail[SLEN];	/* name of file to save copies to */
! extern char raw_sentmail[SLEN];	/* unexpanded name of file to save to */
! extern char calendar_file[SLEN];/* name of file for clndr  */
! extern char raw_calendar_file[SLEN];/* unexpanded name of file for clndr  */
! extern char attribution[SLEN];  /* attribution string for replies     */
! extern char prefixchars[SLEN];	/* prefix char(s) for msgs */
! extern char shell[SLEN];	/* default system shell    */
! extern char raw_shell[SLEN];	/* unexpanded default system shell    */
! extern char pager[SLEN];	/* what pager to use...    */
! extern char raw_pager[SLEN];	/* unexpanded what pager to use...    */
  extern char batch_subject[SLEN];/* subject buffer for batchmail */
  extern char included_file[SLEN];/* name of file to place in edit buf */
! extern char local_signature[SLEN];/* local msg signature file   */
! extern char raw_local_signature[SLEN];/* unexpanded local msg signature file */
! extern char remote_signature[SLEN];/* remote msg signature file */
! extern char raw_remote_signature[SLEN];/* unexpanded remote msg signature file*/
  extern char version_buff[NLEN]; /* version buffer */
! extern char e_editor[SLEN];	/* "~e" editor...   */
! extern char v_editor[SLEN];	/* "~v" editor...   */
! extern char config_options[SLEN];	/* which options are in o)ptions */
! extern char allowed_precedences[SLEN];	/* list of precedences user may specify */
  extern char *def_ans_yes;	/* default yes answer - single char, lc	*/
  extern char *def_ans_no;	/* default no answer - single char, lc	*/
  extern char *nls_deleted;	/* [deleted] */
--- 46,117 ----
  extern int sendmail_verbose;    /* Allow extended debugging on sendmail */
  extern int redraw, 		/** do we need to rewrite the entire screen? **/
             nucurr, 		/** change list or just the current pointer  **/
!            nufoot; 		/** clear lines 16 thru bottom and new menu  **/
! 
! 
  #ifdef MIME
! 
! 
! 
! 
  extern char text_encoding[SLEN];	/* default encoding for text/plain */
+ 
+ 
+ 
+ 
+ 
+ 
+ 
  #endif
! extern char cur_folder[SLEN];	  /* name of current folder */
  extern char cur_tempfolder[SLEN]; /* name of temp folder open for a mailbox */
! extern char defaultfile[SLEN];	  /* name of default folder */
! extern char cur_editfile[SLEN];   /* editor buffer */
! 
! 
! 
! 
  extern char item[WLEN];		/* either "message" or "alias" */
  extern char items[WLEN];	/* plural: either "messages" or "aliases" */
  extern char Item[WLEN];		/* CAP: either "Message" or "Alias" */
  extern char Items[WLEN];	/* CAP-plural: either "Messages" or "Aliases" */
  extern char Prompt[WLEN];	/* Menu Prompt: either "Command" or "Alias" */
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
  extern char batch_subject[SLEN];/* subject buffer for batchmail */
  extern char included_file[SLEN];/* name of file to place in edit buf */
! #ifdef MIME
! extern mime_t *attach_files;    /* prepare attachments for sending */
! #endif
! 
! 
! 
! 
  extern char version_buff[NLEN]; /* version buffer */
! 
! 
! 
! 
  extern char *def_ans_yes;	/* default yes answer - single char, lc	*/
  extern char *def_ans_no;	/* default no answer - single char, lc	*/
  extern char *nls_deleted;	/* [deleted] */
***************
*** 184,265 ****
  extern char *copied_word;	/* copied */
  
  extern char backspace,		/* the current backspace char  */
- 	    escape_char,	/* '~' or something else...    */
- 	    kill_line;		/* the current kill_line char  */
  
! extern char up[SHORT], 
! 	    down[SHORT],
! 	    left[SHORT],
! 	    right[SHORT];	/* cursor control seq's    */
! extern int  cursor_control;	/* cursor control avail?   */
  
  extern int  has_highlighting;	/* highlighting available? */
  
  /** the following two are for arbitrary weedout lists.. **/
  
! extern char *weedlist[MAX_IN_WEEDLIST];
! extern int  weedcount;		/* how many headers to check?        */
  
! extern int  allow_forms;	/* flag: are AT&T Mail forms okay?    */
! extern int  prompt_after_pager;	/* flag: prompt after pager exits     */
! extern int  mini_menu;		/* flag: display menu?     	      */
! extern int  metoo;		/* flag: copy me on mail to alias?    */
  extern int  folder_type;	/* flag: type of folder		      */
! extern int  auto_copy;		/* flag: auto copy source into reply? */
! extern int  filter;		/* flag: weed out header lines?	      */
! extern int  resolve_mode;	/* flag: resolve before moving mode?  */
! extern int  auto_cc;		/* flag: mail copy to yourself?       */
! extern int  noheader;		/* flag: copy + header to file?       */
! extern int  title_messages;	/* flag: title message display?       */
! extern int  forwarding;		/* flag: are we forwarding the msg?   */
! extern int  hp_terminal;	/* flag: are we on an hp terminal?    */
! extern int  hp_softkeys;	/* flag: are there softkeys?          */
! extern int  save_by_name;  	/* flag: save mail by login name?     */
! extern int  force_name;		/* flag: save by name forced?	      */
  extern int  mail_only;		/* flag: send mail then leave?        */
  extern int  check_only;		/* flag: check aliases and leave?     */
  extern int  batch_only;		/* flag: send without prompting?      */
! extern int  move_when_paged;	/* flag: move when '+' or '-' used?   */
! extern int  point_to_new;	/* flag: start pointing at new msgs?  */
! extern int  builtin_lines;	/* int use builtin pager?             */
! extern int  bounceback;		/* flag: bounce copy off remote?      */
! extern int  always_keep;	/* flag: always keep unread msgs?     */
! extern int  always_store;	/* flag: always store read mail?      */
! extern int  always_del;		/* flag: always delete marked msgs?   */
! extern int  arrow_cursor;	/* flag: use "->" regardless?	      */
! extern int  debug;		/* flag: debugging mode on?           */
! extern int  user_level;		/* flag: how knowledgable is user?    */
  extern int  selected;		/* flag: used for select stuff        */
! extern int  names_only;		/* flag: display names but no addrs?  */
! extern int  question_me;	/* flag: ask questions as we leave?   */
! extern int  keep_empty_files;	/* flag: keep empty files??	      */
! extern int  clear_pages;	/* flag: clear screen w/ builtin pgr? */
! extern int  prompt_for_cc;	/* flag: prompt user for 'cc' value?  */
! extern int  sig_dashes;		/* flag: put dashes above signature?  */
! extern int  use_tite;		/* flag: use termcap/terminfo ti/te?  */
! extern int  confirm_append;	/* flag: confirm append to folder?    */
! extern int  confirm_create;	/* flag: confirm create new folder?   */
! extern int  confirm_files;	/* flag: confirm files for append?    */
! extern int  confirm_folders;	/* flag: confirm folders for create?  */
  
- extern int  sortby;		/* how to sort folders	      */
- extern int  alias_sortby;	/* how to sort aliases        */
  
- extern long timeout;		/* seconds for main level timeout     */
  
! extern int LINES;		/** lines per screen    **/
! extern int COLUMNS;		/** columns per line    **/
  #ifdef SIGWINCH
! extern int resize_screen;	/** SIGWINCH occured?   **/
  #endif
  
  extern long size_of_pathfd;	/** size of pathfile, 0 if none **/
  
  extern FILE *mailfile;		/* current folder 	    */
! extern FILE *debugfile;		/* file for debut output    */
  extern FILE *pathfd;		/* path alias file          */
  extern FILE *domainfd;		/* domains file 	    */
- extern nl_catd elm_msg_cat;	/* message catalog	    */
  
  extern long mailfile_size;	/* size of current mailfile */
  
--- 129,220 ----
  extern char *copied_word;	/* copied */
  
  extern char backspace,		/* the current backspace char  */
  
! 	    kill_line,		/* the current kill_line char  */
!   	    word_erase,		/* the current word-erase char */
!   	    interrupt_char,	/* the current interrupt char */
!   	    reprint_char,	/* the current reprint-line char */
!   	    eof_char;		/* the current end-of-file char */
  
  extern int  has_highlighting;	/* highlighting available? */
  
  /** the following two are for arbitrary weedout lists.. **/
  
! 
! 
  
! 
! 
! 
! 
  extern int  folder_type;	/* flag: type of folder		      */
! extern int  write_elmrc;        /* flag: write elmrc in starting      */
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
  extern int  mail_only;		/* flag: send mail then leave?        */
  extern int  check_only;		/* flag: check aliases and leave?     */
  extern int  batch_only;		/* flag: send without prompting?      */
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
  extern int  selected;		/* flag: used for select stuff        */
! 
! 
! 
! 
! 
! 
! 
! 
! 
  
  
  
! 
! 
! 
! 
! 
! 
! 
! #ifdef USE_DSN
! 
! #endif
! 
! 
! extern int elm_LINES;		/** lines per screen    **/
! extern int elm_COLUMNS;		/** columns per line    **/
  #ifdef SIGWINCH
! VOLATILE extern int resize_screen;	/** SIGWINCH occured?   **/
! #endif
! VOLATILE extern int redraw_screen;	/** Elm suspended?   **/
! #ifdef BACKGROUD_PROCESSES       
! extern VOLATILE int handle_sigchld;       /* got SIGCHLD */
! 
  #endif
  
  extern long size_of_pathfd;	/** size of pathfile, 0 if none **/
  
  extern FILE *mailfile;		/* current folder 	    */
! 
  extern FILE *pathfd;		/* path alias file          */
  extern FILE *domainfd;		/* domains file 	    */
  
  extern long mailfile_size;	/* size of current mailfile */
  
***************
*** 270,285 ****
  extern struct alias_rec **aliases; /* for the alias menu */
  extern int    max_aliases;	/* number of aliases allocated */
  
! extern struct addr_rec *alternative_addresses;	/* how else do we get mail? */
  
  extern int system_data;		/* fileno of system data file */
  extern int user_data;		/* fileno of user data file   */
  
! extern int userid;		/* uid for current user	      */
! extern int groupid;		/* groupid for current user   */
! #ifdef SAVE_GROUP_MAILBOX_ID
! extern int mailgroupid;		/* groupid for current user   */
! #endif
  
  extern JMP_BUF GetPromptBuf;	/* setjmp buffer */
  extern int InGetPrompt;		/* set if in GetPrompt() in read() */
--- 225,258 ----
  extern struct alias_rec **aliases; /* for the alias menu */
  extern int    max_aliases;	/* number of aliases allocated */
  
! 
  
  extern int system_data;		/* fileno of system data file */
  extern int user_data;		/* fileno of user data file   */
  
! 
  
+ 
+ 
+ 
  extern JMP_BUF GetPromptBuf;	/* setjmp buffer */
  extern int InGetPrompt;		/* set if in GetPrompt() in read() */
+ #ifdef USE_PGP
+ 
+ extern int pgp_status;
+ 
+ extern int pgp_keeppassfor; /* how long to keep it before expiring */
+ 
+ 
+ 
+ #endif
+ 
+ extern int me_retcode;
+ #ifdef MIME
+ 
+ 
+ 
+ 
+ extern char *mime_types[];
+ 
+ #endif
Index: elm2.4.ME+.50/hdrs/mcprt.h
*** elm2.4.25/hdrs/mcprt.h	Thu Jun 30 19:42:29 1994
--- elm2.4.ME+.50/hdrs/mcprt.h	Tue Nov 17 21:12:54 1998
***************
*** 48,54 ****
  #include <stdio.h>
  
  #ifdef USENLS
! #  ifdef ANSI_C
  extern int     	MCprintf(char *fmt, ...);
  extern int     	MCfprintf(FILE *fptr, char *fmt, ...);
  extern int     	MCsprintf(char *cptr, char *fmt, ...);
--- 48,54 ----
  #include <stdio.h>
  
  #ifdef USENLS
! #  if ANSI_C 
  extern int     	MCprintf(char *fmt, ...);
  extern int     	MCfprintf(FILE *fptr, char *fmt, ...);
  extern int     	MCsprintf(char *cptr, char *fmt, ...);
Index: elm2.4.ME+.50/hdrs/mcprtlib.h
*** elm2.4.25/hdrs/mcprtlib.h	Mon Aug 23 05:48:18 1993
--- elm2.4.ME+.50/hdrs/mcprtlib.h	Tue Nov 17 21:12:54 1998
***************
*** 49,61 ****
  /* taken from Xm/lib/VaSimple.h
     currently no one defines MISSING_STDARG_H */
   
- #ifdef	I_STDARG
- # include <stdarg.h>
- # define Va_start(a,b) va_start(a,b)
- #else
- # include <varargs.h>
- # define Va_start(a,b) va_start(a)
- #endif
  
  #define MCFree		0x0010			/* Reminder to MCPrintFree */
  #define MCCatalog	0x0100			/* Probably came from catalog */
--- 49,54 ----
Index: elm2.4.ME+.50/hdrs/me.h
*** /tmp/8255-very-long-file-name-NULL-comes-in-here	Sun Nov 22 09:14:43 1998
--- elm2.4.ME+.50/hdrs/me.h	Tue Nov 17 21:12:54 1998
***************
*** 0 ****
--- 1,299 ----
+ /* $Id: me.h,v 1.3 1998/10/20 20:04:45 hurtta Exp $ */
+ 
+ /******************************************************************************
+  *  The Elm (ME+) Mail System  -  $Revision: 1.3 $   $State: Exp $
+  *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  *
+  *  Initially written by: Michael Elkins <elkins@aero.org>, 1995
+  *****************************************************************************/
+ 
+ #include "melib.h"
+ 
+ #define PUBLIC 
+ 
+ /* curses.c */
+ 
+ extern int ReadCh            P_((int));
+ 
+ /* args.c */
+ 
+ extern char * parse_arguments P_((int, char *[], char *, int *, int));
+ 
+ /* init.c */
+ void initialize P_((char *, int));
+ 
+ /* elm.c */
+ extern void motion P_((int));
+ 
+ /* in_utils.c */
+ 
+ extern int want_to          P_((char *, int, int, int));
+ extern int read_number      P_((int, char *));
+ extern int optionally_enter P_((char *, int, int, int, int));
+ extern int pattern_enter    P_((char *, char *, int, int, char *, int, int));
+ extern int GetPrompt        P_((void));
+ 
+ /* out_utils.c */
+ 
+ extern void sleep_message P_((void));
+ extern int  error P_((const char *s));
+ extern void out_util_setup();
+ 
+ /* pattern.c */
+ 
+ extern int from_matches P_((int message_number, char *pat));
+ extern int to_matches P_((int message_number, char *pat));
+ extern int cc_matches P_((int message_number, char *pat));
+ extern int subject_matches P_((int message_number, char *pat));
+ 
+ /* addr_util.c */
+ 
+ extern int build_address P_((char *, char *, int, int ));
+ extern struct address_list * address_list_from_string P_((const char *s));
+ extern int fix_arpa_address P_((char *address, int size));
+ 
+ /* Alias.c */
+ 
+ extern void alias P_((void));
+ 
+ /* a_screen.c */
+ 
+ extern void build_alias_line P_((char *buffer,
+ 				 struct alias_rec *entry,
+ 				 int message_number, int highlight,
+ 				 int buffer_size));
+ 
+ 
+ /* file.c */
+ 
+ int expand_filename P_((char *, int, int));
+ void init_helpmsg P_(( char *, char *, int, int ));
+ 
+ /* fileutil.c */
+ 
+ extern FILE *open_end_update P_((char *));
+ 
+ /* src/remailer.c */
+ 
+ #ifdef USE_REMAILER
+ #ifdef MIME
+ extern int remailer_copy_message_across P_((FILE *, FILE *, int, mime_send_t *));
+ #else
+ extern int remailer_copy_message_across P_((FILE *, FILE *, int));
+ #endif
+ extern int remailer_proc P_((void));
+ #endif 
+ 
+ #ifdef USE_PGP
+ /* pgp.c */
+ extern int pgp_encrypt			P_((char *, char *, char *, int, int));
+ extern int pgp_menu			P_((char *));
+ extern int pgp_extract_public_key	P_((void));
+ #endif
+ 
+ /* read_rc.c */
+ 
+ extern void directory_check     P_((void));
+ 
+ 
+ 
+ extern int metapager		P_((FILE *, struct header_rec *, int));
+ extern int builtinplusplus	P_((FILE *, long, int, char **, int));
+ 
+ /* mime.c */
+ 
+ extern int have_metamail        P_((void));
+ 
+ /* strings.c */
+ 
+ extern char **argv_from_to      P_((char *to));
+ 
+ /* fileio.h */
+ extern void copy_message P_((FILE *, struct header_rec *,
+ 			     char *, FILE *, int));
+ 
+ extern void copy_plain P_((char *,FILE *,int, struct header_rec *, FILE *));
+ #ifdef MIME
+ extern void copy_mime P_((char *,FILE *,int, struct header_rec *, FILE *));
+ #endif
+ 
+ typedef void copy_decoder P_((char *,FILE *,int, struct header_rec *, FILE *));
+ typedef copy_decoder *copy_decoder_t;
+ extern copy_decoder_t select_copy_decoder P_((struct header_rec *));
+ 
+ /* newmbox.c */
+ 
+ extern void header_zero P_((struct header_rec *));
+ extern void header_clear P_((struct header_rec *));
+ 
+ #ifdef MIME
+ extern int is_pre_mime_content_type P_((mime_t *,char *));
+ #endif /* MIME */
+ 
+ /* file_util.c */
+ 
+ extern long fsize P_((FILE *));
+ extern long bytes P_((char *));
+ 
+ /* mailmsg1.c */
+ 
+ extern void output_abbreviated_to P_((char *address));
+ 
+ #ifdef FFR_NOT
+ 
+ struct mailing_headers {
+   char subject[SLEN];
+   char in_reply_to[SLEN];
+   char expires[SLEN];
+   char action[SLEN]; 
+   char priority[SLEN];
+   char reply_to[SLEN];
+  
+   struct address_list *to;
+   struct address_list *cc;
+  
+   char user_defined_header[SLEN];
+   struct address_list *bcc;
+   char precedence[SLEN];
+   char expires_days[SLEN];
+ };
+ extern void zero_mailing_headers P_((struct mailing_headers *hdrs));
+ 
+ #endif
+ 
+ int send_msg            P_((char *, char *, char *, int, int));
+ int copy_the_msg        P_((int *,int));
+ int get_to P_((char *, char *, int, int)); 
+ 
+ /* mailmsg2.c */
+ 
+ int mail P_((struct header_rec *, int, int));
+ int mail_form P_((struct header_rec *, char *, char *));
+ 
+ /* aliaslib.c */
+ 
+ extern char *get_alias_address P_((
+ 				   char *name, /* name to expand as an alias */
+ 				   int mailing, /* TRUE to fully expand group names & recursive aliases */
+ 				   int *too_longp /* error code if expansion overflows buffer             */
+ 				   ));
+ 
+ /* syscall.c */
+ #ifdef BACKGROUD_PROCESSES
+ extern void init_backgroud_handling P_((void));
+ #endif
+ 
+ extern int system_call    P_((char *, int));
+ 
+ #ifdef BACKGROUD_PROCESSES      
+ struct process_list;
+ struct run_state;
+ 
+ typedef void end_handler P_((FILE *fd, char * title, struct run_state *rs,
+ 			     int ret, int exit_stat));
+ 
+ extern void sigchld_handler P_((void));
+ extern int maybe_background P_((struct run_state *rs, int *exit_code,
+ 				FILE *fd, char *title, end_handler *func));
+ #endif
+ 
+ struct run_state {
+   int pid;
+   int save_errno;
+   int raw;
+   int options;
+ #ifdef BACKGROUD_PROCESSES      
+   struct process_list *listptr;
+ #endif
+ };
+ 
+ extern int start_run        P_((struct run_state *rs, int options,
+ 				char * argv[], int infd, int outfd));
+ extern int run_already_done P_((struct run_state *rs, int *exit_code));
+ extern int wait_end         P_((struct run_state *rs, int *exit_code));
+ extern char ** join_argv    P_((char * argv1[], char * argv2[]));
+ 
+ /* lib/errno.c */
+ 
+ extern char *error_description P_((int));
+ 
+ /* savecopy.c */
+ 
+ extern int name_copy_file P_((char *, int));
+ 
+ #ifdef MIME
+ 
+ 
+ extern int save_copy		P_((char *, char *, char *, char *, 
+ 				       char *, int, mime_send_t *));
+ extern int append_copy_to_file	P_((char *, char *, char *, char *, 
+ 				       char *, int, mime_send_t *));
+ extern FILE *write_header_info	P_((char *, char *, char *, char *, 
+ 				       int, int, mime_send_t *));
+ extern int copy_message_across	P_((FILE *, FILE *, int, mime_send_t *));
+ 
+ /* mime.c */
+ 
+ extern int check_for_multipart	P_((FILE *, mime_send_t *));
+ extern int Include_Part		P_((FILE *, char *, int, mime_send_t *, int));
+ extern int needs_encoding       P_((FILE *));
+ 
+ /* mime_encode.c */
+ 
+ extern void attach_generate_message P_((mime_t *, FILE *, int, mime_send_t *));
+ extern void base64_encode	    P_((FILE *, FILE *, int, mime_send_t *));
+ extern void line_quoted_printable_encode P_((char *, FILE *, int, int,
+ 					       int, mime_send_t *));
+ extern void quoted_printable_encode	P_((FILE *, FILE *, int, int,
+ 						mime_send_t *));
+ extern int is_text_type			P_((char *, char *, int));
+ extern char *mime_generate_boundary	P_((char *, int));
+ extern void add_parameter		P_((char *,char *,char *,int, int));
+ extern void add_parameter_t             P_((mime_t *, char *, char *, int));
+ 
+ extern void print_EOLN			P_((FILE *,int));
+ extern int update_encoding		P_((int *,int));
+ extern void write_encoded   P_((FILE *, FILE *, int, int, int, mime_send_t *));
+ extern void mime_write_header		P_((FILE *, mime_send_t *, int));
+ extern void rfc1522_encode_text         P_((char *,int,const char *,int));
+ 
+ /* attach_menu.c */
+ 
+ extern mime_t *attach_menu		P_((mime_t *, int));
+ extern int Attach_it                    P_((char *));
+ extern int Check_attachments            P_((void));
+ #endif
+ 
+ /* returnadd.c */
+ extern int get_return                   P_((char *, int, int));
+ 
+ /* lock.c */
+ 
+ extern int Grab_the_file P_((int flock_fd));
+ extern int Release_the_file P_((int flock_fd));
+ extern int unlock P_((int interrupt));
+ 
+ /* utils.c */
+ 
+ extern void emergency_exit P_((int interrupt));
+ extern void leave P_((int interrupt));
+ 
+ /* date.c */
+ 
+ extern void days_ahead P_((int days, char *buffer, int size));
+ extern char * elm_date_str P_((char *buf, time_t seconds, int size));
+ 
+ /* expires.h */
+ 
+ extern void process_expiration_date P_((char *date,
+ 					int  *message_status));
+ 
+ 
+ /* reply.c */
+ 
+ extern int get_return_name P_((
+ 			       char *address, char *name,
+ 			       int   trans_to_lowercase,
+ 			       int size));
+ 
Index: elm2.4.ME+.50/hdrs/menu.h
*** /tmp/8255-very-long-file-name-NULL-comes-in-here	Sun Nov 22 09:14:43 1998
--- elm2.4.ME+.50/hdrs/menu.h	Tue Nov 17 21:12:55 1998
***************
*** 0 ****
--- 1,24 ----
+ /* $Id: menu.h,v 1.2 1998/10/20 19:57:35 hurtta Exp $
+  *
+  * Initially written by: Michael Elkins <elkins@aero.org>, 17 May 1995.
+  */
+ 
+ /* returns the number of the current selection from the menu */
+ #define MenuCurrent(X) X.current
+ 
+ /* this will make MenuLoop() update the screen on the next call */
+ #define MenuUpdate(X) (X.update = 1)
+ 
+ struct menu_object {
+   char **data;
+   char *title;
+   char *prompt;
+   char *help;
+   int prompt_length;
+   int len;
+   int max;
+   int current;
+   int pagetop; /* the index of the first entry on this page */
+   unsigned int update : 1;
+ };
+ typedef struct menu_object menu_t;
Index: elm2.4.ME+.50/hdrs/menu2.h
*** /tmp/8255-very-long-file-name-NULL-comes-in-here	Sun Nov 22 09:14:43 1998
--- elm2.4.ME+.50/hdrs/menu2.h	Tue Nov 17 21:12:55 1998
***************
*** 0 ****
--- 1,12 ----
+ struct menu_item {
+   char *option;
+   char key;
+   char offset;
+   char type;
+   union ptrs { 
+     char *c;
+     int *i; /* used by BOL and INT */
+   } d;
+   int size;
+ };
+ 
Index: elm2.4.ME+.50/hdrs/mime.h
*** elm2.4.25/hdrs/mime.h	Sat Nov  7 22:50:23 1992
--- elm2.4.ME+.50/hdrs/mime.h	Tue Nov 17 21:12:55 1998
***************
*** 1,42 ****
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
   *
!  * 			Copyright (c) 1988-1992 USENET Community Trust
!  * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
   ******************************************************************************
!  * $Log: mime.h,v $
!  * Revision 5.3  1992/11/07  20:50:08  syd
!  * add some new names to make header_cmp use easier
!  * From: Syd
!  *
!  * Revision 5.2  1992/10/25  01:47:45  syd
!  * fixed a bug were elm didn't call metamail on messages with a characterset,
!  * which could be displayed by elm itself, but message is encoded with QP
!  * or BASE64
!  * From: Klaus Steinberger <Klaus.Steinberger@Physik.Uni-Muenchen.DE>
!  *
!  * Revision 5.1  1992/10/03  22:34:39  syd
!  * Initial checkin as of 2.4 Release at PL0
   *
!  *
!  ******************************************************************************/
  
  #define	MIME_HEADER	"MIME-Version: 1.0"
  #define	MIME_HEADER_NAME	"MIME-Version"
  #define	MIME_HEADER_VERSION	"1.0"
- #define	MIME_OLDVERSION	"MIME-Version: RFCXXXX"
- #define	MIME_HEADER_OLDVERSION	"RFCXXXX"
  #define	MIME_INCLUDE	"[include"
- #define MIME_BOUNDARY	"%#%record%#%"	/* default boundary */
  #define	MIME_CONTENTTYPE	"Content-Type:"
  #define	MIME_HEADER_CONTENTTYPE	"Content-Type"
  #define	MIME_CONTENTENCOD	"Content-Transfer-Encoding:"
  #define	MIME_HEADER_CONTENTENCOD	"Content-Transfer-Encoding"
  
  /* Encoding types */
--- 1,23 ----
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
   ******************************************************************************
!  *  The Elm Mail System 
   *
!  * 			Copyright (c) 1988-1992 USENET Community Trust
!  * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  #define	MIME_HEADER	"MIME-Version: 1.0"
  #define	MIME_HEADER_NAME	"MIME-Version"
  #define	MIME_HEADER_VERSION	"1.0"
  #define	MIME_INCLUDE	"[include"
  #define	MIME_CONTENTTYPE	"Content-Type:"
+ #define	MIME_CONTENTTYPE_LEN	13
  #define	MIME_HEADER_CONTENTTYPE	"Content-Type"
  #define	MIME_CONTENTENCOD	"Content-Transfer-Encoding:"
+ #define	MIME_CONTENTENCOD_LEN	26
  #define	MIME_HEADER_CONTENTENCOD	"Content-Transfer-Encoding"
  
  /* Encoding types */
***************
*** 50,62 ****
  #define	ENCODING_BASE64	5
  #define	ENCODING_EXPERIMENTAL	6
  
! #define	ENC_NAME_7BIT	"7bit"
! #define	ENC_NAME_8BIT	"8bit"
! #define	ENC_NAME_BINARY	"binary"
! #define	ENC_NAME_QUOTED "quoted-printable"
! #define	ENC_NAME_BASE64	"base64"
! 
! /* default charsets, which are a superset of US-ASCII, so we did not
     have to go out to metamail for us-ascii */
  
! #define COMPAT_CHARSETS "ISO-8859-1 ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5 ISO-8859-7 ISO-8859-8 ISO-8859-9"
--- 31,104 ----
  #define	ENCODING_BASE64	5
  #define	ENCODING_EXPERIMENTAL	6
  
! /* Default charsets, which are a superset of US-ASCII, so we do not
     have to go out to metamail for us-ascii */
  
! #define COMPAT_CHARSETS "ISO-8859-1 ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5 ISO-8859-7 ISO-8859-8 ISO-8859-9 KOI8-R"
! 
! /* These are for figuring out what the encoding on outgoing messages should
!  * be.
!  */
! #define HAVE_8BIT 1
! #define HAVE_CTRL 4
! #define HAVE_BINARY 8
! 
! /* Possible major types in Content-Type field. */
! #define MIME_TYPE_UNKNOWN	0
! #define MIME_TYPE_APPLICATION	1
! #define MIME_TYPE_AUDIO		2
! #define MIME_TYPE_IMAGE		3
! #define MIME_TYPE_MESSAGE	4
! #define MIME_TYPE_MULTIPART	5
! #define MIME_TYPE_TEXT		6
! #define MIME_TYPE_VIDEO		7
! 
! /* Values for the "flag" field in "mimeinfo" */
! #define MIME_RFC822      1
! #define MIME_MIXED       2
! #define MIME_DIGEST      4
! #define MIME_ALTERNATIVE 8
! 
! /* Content-Disposition */
! #define DISP_INLINE	0
! #define DISP_ATTACH	1
! 
! #define DISPOSITION(x) (x == DISP_INLINE ? "inline" : "attachment")
! #define TYPE(x) (mime_types[(x)])
! #define NONULL(x) (x ? x : "")
! #define ENCODING(x) (x >= 0 ? mime_encode_names[x] : "<ILLEGAL>")
! extern char *mime_encode_names[]; /* defined in mime.c */
! 
! typedef struct mime_send {    /* Mime parameters for this mail */
! 
!   /* Information for multipart  */
!   int encoding_top; /* Encoding for top multipart type.
!                      * ENCODING_8BIT:   add content_transfer_encoding: 8bit
!                      *                  pass -B8BITMIME to mailer
!                      * ENCODING_BINARY: add content_transfer_encoding: binary
! 		     *                  pass -BBINARYMIME to mailer
!                      */
!   char mime_boundary[STRING];
!   char type_opts_top[STRING];
! 
!   /* Information for text parts */
!   int encoding_text;/* Encoding of text parts (nt attachments)
! 		     * ENCODING_QUOTED: 
! 		     *         add content_transfer_encoding: quoted-printable
! 		     * ENCODING_8BIT:
! 		     *         add content_transfer_encoding: 8bit
! 		     */
!   int need_enc;     /* Bitmask: HAVE_8BIT:   have 8-bit data
! 		     *          HAVE_BINARY: have 'binary' data
! 		     *          HAVE_CTRL:   have control characters
! 		     */
!   char * Charset;   /* Charset of text */
!   unsigned int type_text : 3;
!   char         subtype_text[STRING];
!   char         type_opts_text[STRING];
! 
!   int msg_is_multipart;
!   char encoded_subject[LONG_STRING];
!   char encoded_fullname[STRING];
!   char encoded_in_reply_to[LONG_STRING];
! } mime_send_t;
Index: elm2.4.ME+.50/hdrs/ndbz.h
*** elm2.4.25/hdrs/ndbz.h	Tue Jul 20 05:59:54 1993
--- elm2.4.ME+.50/hdrs/ndbz.h	Tue Nov 17 21:12:55 1998
***************
*** 1,33 ****
  
! /* $Id: ndbz.h,v 5.3 1993/07/20 02:59:53 syd Exp $ */
! 
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: ndbz.h,v $
!  * Revision 5.3  1993/07/20  02:59:53  syd
!  * Support aliases both on 64 bit and 32 bit machines at the same time.
!  * From: Dan Mosedale <mosedale@genome.stanford.edu>
!  *
!  * Revision 5.2  1992/10/11  01:46:35  syd
!  * change dbm name to dbz to avoid conflicts with partial call
!  * ins from shared librarys, and from mixing code with yp code.
!  * From: Syd via prompt from Jess Anderson
!  *
!  * Revision 5.1  1992/10/03  22:34:39  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /**  define file for ndbz for mail system.  **/
  
--- 1,15 ----
+ /* $Id: ndbz.h,v 1.2 1998/10/20 19:57:35 hurtta Exp $ */
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
!  *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /**  define file for ndbz for mail system.  **/
  
***************
*** 133,153 ****
  	int dbz_written;		/* has a store() been done? */
  	} DBZ;
  
  /* standard dbz functions */
! extern DBZ *dbz_open();
! extern datum dbz_fetch();
! extern int dbz_store();
  extern int dbz_delete();	/* not in dbz */
  extern datum dbz_firstkey();	/* not in dbz */
  extern datum dbz_nextkey();	/* not in dbz */
! extern int dbz_close();		/* in dbz, but not in old dbm */
  
  /* new stuff for dbz */
! extern DBZ *dbz_fresh();
! extern DBZ *dbz_again();
! extern int dbz_sync();
! extern long dbz_size();
! extern int dbz_incore();
  extern int dbz_cancel();
  extern int dbz_debug();
  
--- 115,142 ----
  	int dbz_written;		/* has a store() been done? */
  	} DBZ;
  
+ #undef P_
+ #ifdef __STDC__
+ #define P_(x) x
+ #else
+ #define P_(x) ()
+ #endif
+ 
  /* standard dbz functions */
! extern DBZ *dbz_open          P_((char *,int, int));
! extern datum dbz_fetch        P_((DBZ *,datum));
! extern int dbz_store          P_((DBZ *,datum,datum));
  extern int dbz_delete();	/* not in dbz */
  extern datum dbz_firstkey();	/* not in dbz */
  extern datum dbz_nextkey();	/* not in dbz */
! extern int dbz_close          P_((DBZ *));     /* in dbz, but not in old dbm */
  
  /* new stuff for dbz */
! extern DBZ *dbz_fresh         P_((char *,long,int,of_t));
! extern DBZ *dbz_again         P_((char *,char *));
! extern int dbz_sync           P_((DBZ *));
! extern long dbz_size          P_((long));
! extern int dbz_incore         P_((int));
  extern int dbz_cancel();
  extern int dbz_debug();
  
Index: elm2.4.ME+.50/hdrs/nl_types.h
*** elm2.4.25/hdrs/nl_types.h	Sun Oct  4 01:35:10 1992
--- /tmp/8255-very-long-file-name-NULL-comes-in-here	Sun Nov 22 09:14:43 1998
***************
*** 1,46 ****
- #ifndef __nl_typesh
- #define __nl_typesh
- 
- 
- /***********************************************************
- Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
- 
-                         All Rights Reserved
- 
- Permission to use, copy, modify, and distribute this software and its
- documentation for any purpose and without fee is hereby granted,
- provided that the above copyright notice appear in all copies and that
- both that copyright notice and this permission notice appear in
- supporting documentation, and that Alfalfa's name not be used in
- advertising or publicity pertaining to distribution of the software
- without specific, written prior permission.
- 
- ALPHALPHA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- ALPHALPHA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- SOFTWARE.
- 
- If you make any modifications, bugfixes or other changes to this software
- we'd appreciate it if you could send a copy to us so we can keep things
- up-to-date.  Many thanks.
- 				Kee Hinckley
- 				Alfalfa Software, Inc.
- 				267 Allston St., #3
- 				Cambridge, MA 02139  USA
- 				nazgul@alfalfa.com
-     
- ******************************************************************/
- 
- #define	NL_SETD	0
- 
- typedef	long	nl_catd;
- typedef long	nl_item;
- 
-     extern nl_catd 	catopen();
-     extern char		*catgets();
-     extern void		catclose();
- 
- #endif
--- 0 ----
Index: elm2.4.ME+.50/hdrs/elm_nl_types.h
*** /tmp/8255-very-long-file-name-NULL-comes-in-here	Sun Nov 22 09:14:43 1998
--- elm2.4.ME+.50/hdrs/elm_nl_types.h	Tue Nov 17 21:12:55 1998
***************
*** 0 ****
--- 1,46 ----
+ #ifndef __nl_typesh
+ #define __nl_typesh
+ 
+ 
+ /***********************************************************
+ Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
+ 
+                         All Rights Reserved
+ 
+ Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose and without fee is hereby granted,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation, and that Alfalfa's name not be used in
+ advertising or publicity pertaining to distribution of the software
+ without specific, written prior permission.
+ 
+ ALPHALPHA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ ALPHALPHA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ SOFTWARE.
+ 
+ If you make any modifications, bugfixes or other changes to this software
+ we'd appreciate it if you could send a copy to us so we can keep things
+ up-to-date.  Many thanks.
+ 				Kee Hinckley
+ 				Alfalfa Software, Inc.
+ 				267 Allston St., #3
+ 				Cambridge, MA 02139  USA
+ 				nazgul@alfalfa.com
+     
+ ******************************************************************/
+ 
+ #define	NL_SETD	0
+ 
+ typedef	long	nl_catd;
+ typedef long	nl_item;
+ 
+     extern nl_catd 	catopen();
+     extern char		*catgets();
+     extern void		catclose();
+ 
+ #endif
Index: elm2.4.ME+.50/hdrs/regexp.h
*** elm2.4.25/hdrs/regexp.h	Sun Nov 15 03:38:25 1992
--- elm2.4.ME+.50/hdrs/regexp.h	Tue Nov 17 21:12:55 1998
***************
*** 1,26 ****
  
! /* $Id: regexp.h,v 5.3 1992/11/15 01:38:23 syd Exp $ */
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
   *
!  * 			Copyright (c) 1992 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: regexp.h,v $
!  * Revision 5.3  1992/11/15  01:38:23  syd
!  * fix headers
   *
!  * Revision 5.2  1992/11/15  01:37:57  syd
!  * add proper headers
!  *
!  *
!  ******************************************************************************/
  
  /*
   * Definitions etc. for regexp(3) routines.
--- 1,15 ----
  
! /* $Id: regexp.h,v 1.2 1998/10/20 19:57:35 hurtta Exp $ */
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  * 			Copyright (c) 1992 USENET Community Trust
!  *****************************************************************************/
  
  /*
   * Definitions etc. for regexp(3) routines.
Index: elm2.4.ME+.50/hdrs/s_aliases.h
*** elm2.4.25/hdrs/s_aliases.h	Mon Apr 12 07:14:23 1993
--- elm2.4.ME+.50/hdrs/s_aliases.h	Tue Nov 17 21:12:55 1998
***************
*** 1,4 ****
- /* s_aliases.h created from s_aliases.us by gencat on Mon Apr 12 00:14:23 EDT 1993 */
  
  #define AliasesSet	0x5
  #define AliasesDelete	0x1
--- 1,3 ----
***************
*** 120,122 ****
--- 119,122 ----
  #define AliasesHelpc	0x8e
  #define AliasesHelpT	0x8f
  #define AliasesModified	0x90
+ #define AliasesAddressAs1	0x91
Index: elm2.4.ME+.50/hdrs/s_answer.h
*** elm2.4.25/hdrs/s_answer.h	Sun Oct  4 01:35:11 1992
--- elm2.4.ME+.50/hdrs/s_answer.h	Tue Nov 17 21:12:55 1998
***************
*** 1,4 ****
- /* s_answer.h created from s_answer.us by gencat on Sat Oct  3 18:33:40 EDT 1992 */
  
  #define AnswerSet	0xb
  #define AnswerQuitWord	0x1
--- 1,3 ----
Index: elm2.4.ME+.50/hdrs/s_elm.h
*** elm2.4.25/hdrs/s_elm.h	Tue Aug  3 21:58:35 1993
--- elm2.4.ME+.50/hdrs/s_elm.h	Tue Nov 17 21:12:55 1998
***************
*** 1,4 ****
- /* s_elm.h created from s_elm.us by gencat on Tue Aug  3 14:58:35 EDT 1993 */
  
  #define ElmSet	0x3
  #define ElmYes	0x1
--- 1,3 ----
***************
*** 226,233 ****
  #define ElmHdrmenuPrecedenceBadValue	0xef
  #define ElmHdrmenuUserdefNotAlnum	0xf0
  #define ElmHdrmenuUserdefMissingColon	0xf1
- #define ElmHdrmenuDomInstruct	0xf2
- #define ElmHdrmenuDomPrompt	0xf3
  #define ElmHelpMessage	0xff
  #define ElmHelpPrompt	0x100
  #define ElmHelpUnknownCommand	0x101
--- 225,230 ----
***************
*** 759,761 ****
--- 756,923 ----
  #define ElmVfyMenuSndFgt	0x34e
  #define ElmVfyMessageKept	0x34f
  #define ElmVfyNoFieldsInForm	0x350
+ #define ElmHelpViewAttach	0x351
+ #define ElmBadModeInElmrc	0x352
+ #define ElmBadKeyInElmrc	0x353
+ #define ElmSendingMailBackground	0x354
+ #define ElmResendingMailBackground	0x355
+ #define ElmCouldntLockFolder	0x356
+ #define ElmIncludeBINARY	0x357
+ #define ElmInclude8BIT	0x358
+ #define ElmDoesnt8BIT	0x359
+ #define ElmDoesntBINARY	0x35a
+ #define ElmDontEncoding	0x35b
+ #define ElmCantMetamail	0x35c
+ #define ElmFolderRemoved	0x35d
+ #define ElmBadEKeyInElmrc	0x35e
+ #define ElmBadEKeyValues	0x35f
+ #define ElmLongValueInElmrc	0x360
+ #define ElmBackgroundLLT	0x361
+ #define ElmErrorReading	0x362
+ #define ElmErrorReadableUser	0x363
+ #define ElmCantOpenAttach	0x364
+ #define ElmInternalnoFD	0x365
+ #define ElmFailedSeekAttach	0x366
+ #define ElmWriteErrorAttach	0x367
+ #define ElmErrorCreatTempfile	0x368
+ #define ElmJobSpooled	0x369
+ #define ElmErrorPrinting	0x36a
+ #define ElmNoPermissionWrite	0x36b
+ #define ElmErrorOpening	0x36c
+ #define ElmUnsupportedEncoding	0x36d
+ #define ElmErrorSaving	0x36e
+ #define ElmMailSaved	0x36f
+ #define ElmCantStat	0x370
+ #define ElmCouldOpenReading	0x371
+ #define ElmStrucredNoEncoding	0x372
+ #define ElmNotKnowPrint	0x373
+ #define ElmMailNotSaved	0x374
+ #define ElmCantRenameTmpFile	0x375
+ #define ElmCantLinkTmpFile	0x376
+ #define ElmCantUnLinkTmpFile	0x377
+ #define ElmPgpNonZeroValue	0x378
+ #define ElmRunningPgp	0x379
+ #define ElmFailSignal	0x37a
+ #define ElmFailErrno	0x37b
+ #define ElmPgpErrorStatus	0x37c
+ #define ElmPgpDone	0x37d
+ #define ElmLostErrno	0x37e
+ #define ElmCantStart	0x37f
+ #define ElmOpenTmpWriting	0x380
+ #define ElmCantChangeFilename	0x381
+ #define ElmErrorAccess	0x382
+ #define ElmWarningBINARY	0x383
+ #define ElmStructuredNoencoding	0x384
+ #define ElmStructuredLeaf	0x385
+ #define ElmUnknownCommand2	0x386
+ #define ElmFileNotExist	0x387
+ #define ElmCantStatFile	0x388
+ #define ElmNotReadableByUser	0x389
+ #define ElmCheckingEncoding	0x38a
+ #define ElmCantOpenFile	0x38b
+ #define ElmNoAttachments	0x38c
+ #define ElmLastAttachment	0x38d
+ #define ElmFirstAttachment	0x38e
+ #define ElmPassphraseForgotten	0x38f
+ #define ElmUnknownCommand3	0x390
+ #define ElmBuiltInMore	0x391
+ #define ElmPgpMultipleKeys	0x392
+ #define ElmPgpPublicKey	0x393
+ #define ElmRemailTo	0x394
+ #define ElmMsgDeleted	0x395
+ #define ElmMsgsDeleted	0x396
+ #define ElmPagerStatDeleted	0x397
+ #define ElmPagerStatMessage	0x398
+ #define ElmPagerFailedTmpFile	0x399
+ #define ElmAttachMenu	0x39a
+ #define ElmErrorReadMailfile	0x39b
+ #define ElmForwardedMesg	0x39c
+ #define ElmMailTo	0x39d
+ #define ElmFailFileForward	0x39e
+ #define ElmUsingUNKNOWN8BIT	0x39f
+ #define ElmFixInclude	0x3a0
+ #define ElmAccessAttach	0x3a1
+ #define ElmBadAttach	0x3a2
+ #define ElmPgpAlreadyEncSig	0x3a3
+ #define ElmFailedSeekBytes	0x3a4
+ #define ElmPgpNoMatch	0x3a5
+ #define ElmHeaderUsingUNKNOWN8BIT	0x3a6
+ #define ElmHeaderBadCharset	0x3a7
+ #define ElmErrorOpeningName	0x3a8
+ #define ElmErrorWhenReading	0x3a9
+ #define ElmFailedLeaveFolder	0x3aa
+ #define ElmFailedResyncFolder	0x3ab
+ #define ElmALERTMailfileShrinken	0x3ac
+ #define ElmNoFolderEditing	0x3ad
+ #define ElmNoPgpPublicKeys	0x3ae
+ #define ElmNoMIMEMessage	0x3b1
+ #define ElmNoMessages	0x3b2
+ #define ElmDecryptBadPGP	0x3b3
+ #define ElmDecryptFailInitPGP	0x3b4
+ #define ElmDecryptFailInitPGPRaw	0x3b5
+ #define ElmDecryptEndRaw	0x3b6
+ #define ElmSigaction	0x3b7
+ #define ElmReadFailedCopy	0x3b8
+ #define ElmFingering	0x3b9
+ #define ElmRemailerReading	0x3ba
+ #define ElmRemailerCoulntTime	0x3bb
+ #define ElmRemailerCouldntList	0x3bc
+ #define ElmRemailerErrorTemp	0x3bd
+ #define ElmRemailerErrorTempRename	0x3be
+ #define ElmRemailerDatabase	0x3bf
+ #define ElmRemailerFind	0x3c0
+ #define ElmRemailerTempWriting	0x3c1
+ #define ElmRemailerFormating	0x3c2
+ #define ElmRemailerTempRead	0x3c3
+ #define ElmBuiltinHelpTitle	0x3c4
+ #define ElmBuiltinHelpKeyA	0x3c5
+ #define ElmBuiltinHelpSpace	0x3c6
+ #define ElmBuiltinHelpMinus	0x3c7
+ #define ElmBuiltinHelpReturn	0x3c8
+ #define ElmBuiltinHelpq	0x3c9
+ #define ElmBuiltinHelpDiv	0x3ca
+ #define ElmBuiltinHelpArr	0x3cb
+ #define ElmBuiltinHelpG	0x3cc
+ #define ElmBuiltinHelpCtrlL	0x3cd
+ #define ElmBuiltinHelpCtrlP	0x3ce
+ #define ElmBuiltinHelpCtrlD	0x3cf
+ #define ElmBuiltinHelpCtrlU	0x3d0
+ #define ElmBuiltinHelpQuestion	0x3d1
+ #define ElmBuiltinMore0	0x3d2
+ #define ElmBuiltinCommandi	0x3d3
+ #define ElmPgpEncrypt	0x3d4
+ #define ElmPgpSign	0x3d5
+ #define ElmPgpSignEncrypt	0x3d6
+ #define ElmWriteFMimeEncode	0x3d7
+ #define ElmWriteFWriteEncoded	0x3d8
+ #define ElmExtractPGPKey	0x3d9
+ #define ElmDebugHeader	0x3da
+ #define ElmVfyMenuAtttach	0x3db
+ #define ElmVfyMenuDsn	0x3dc
+ #define ElmVfyMenuSend	0x3dd
+ #define ElmVfyMenuForget	0x3de
+ #define ElmVfyMenuCopyFile	0x3df
+ #define ElmVfyMenuEdit	0x3e0
+ #define ElmVfyMenuHeaders	0x3e1
+ #define ElmVfyMenuIspell2	0x3e2
+ #define ElmVfyMenuPgp	0x3e3
+ #define ElmMenu2True	0x3e4
+ #define ElmMenu2False	0x3e5
+ #define ElmBuiltinHelpPressRet	0x3e6
+ #define ElmBuiltinNotFound	0x3e7
+ #define ElmBuiltinSearch	0x3e8
+ #define ElmPgpTo	0x3e9
+ #define ElmPgpFrom	0x3ea
+ #define ElmPgpP	0x3eb
+ #define ElmPgpEntUser	0x3ec
+ #define ElmDbxCurrMsgNum	0x3ed
+ #define ElmDbxHdrPage	0x3ee
+ #define ElmDbxCurrMailFile	0x3ef
+ #define ElmDbxPressAnyKey	0x3f0
+ #define ElmTerminatedWithSignal	0x3f1
+ #define ElmExitedWithStatus	0x3f2
+ #define ElmDoneCont	0x3f3
+ #define ElmMetaPagePressAnyKey	0x3f4
+ #define ElmToParen	0x3f5
+ #define ElmToNoParen	0x3f6
+ #define ElmToNoParen2	0x3f7
Index: elm2.4.ME+.50/hdrs/s_elmalias.h
*** elm2.4.25/hdrs/s_elmalias.h	Mon Apr 12 05:10:16 1993
--- elm2.4.ME+.50/hdrs/s_elmalias.h	Tue Nov 17 21:12:55 1998
***************
*** 1,4 ****
- /* s_elmalias.h created from s_elmalias.us by gencat on Sun Apr 11 22:03:05 EDT 1993 */
  
  #define ElmaliasSet	0x4
  #define ElmaliasUsage	0x1
--- 1,3 ----
Index: elm2.4.ME+.50/hdrs/s_elmrc.h
*** elm2.4.25/hdrs/s_elmrc.h	Fri Mar 11 23:18:49 1994
--- elm2.4.ME+.50/hdrs/s_elmrc.h	Tue Nov 17 21:12:55 1998
***************
*** 1,4 ****
- /* s_elmrc.h created from s_elmrc.us by gencat on Fri Mar 11 16:18:48 EST 1994 */
  
  #define ElmrcSet	0x1
  #define ElmrcExpandHome	0x1
--- 1,3 ----
Index: elm2.4.ME+.50/hdrs/s_error.h
*** elm2.4.25/hdrs/s_error.h	Sun Oct  4 01:35:12 1992
--- elm2.4.ME+.50/hdrs/s_error.h	Tue Nov 17 21:12:55 1998
***************
*** 1,4 ****
- /* s_error.h created from s_error.us by gencat on Sat Oct  3 18:34:12 EDT 1992 */
  
  #define ErrorSet	0x2
  #define ErrorGetoptReq	0x1
--- 1,3 ----
Index: elm2.4.ME+.50/hdrs/s_fastmail.h
*** elm2.4.25/hdrs/s_fastmail.h	Sun Oct  4 01:35:13 1992
--- elm2.4.ME+.50/hdrs/s_fastmail.h	Tue Nov 17 21:12:55 1998
***************
*** 1,4 ****
- /* s_fastmail.h created from s_fastmail.us by gencat on Sat Oct  3 18:34:11 EDT 1992 */
  
  #define FastmailSet	0x12
  #define FastmailCantFindFile	0x1
--- 1,3 ----
Index: elm2.4.ME+.50/hdrs/s_filter.h
*** elm2.4.25/hdrs/s_filter.h	Sun Nov 15 04:02:01 1992
--- elm2.4.ME+.50/hdrs/s_filter.h	Tue Nov 17 21:12:55 1998
***************
*** 1,4 ****
- /* s_filter.h created from s_filter.us by gencat on Sat Nov 14 21:02:00 EST 1992 */
  
  #define FilterSet	0x10
  #define FilterCantGetPasswdEntry	0x1
--- 1,3 ----
Index: elm2.4.ME+.50/hdrs/s_from.h
*** elm2.4.25/hdrs/s_from.h	Mon May 31 22:36:00 1993
--- elm2.4.ME+.50/hdrs/s_from.h	Tue Nov 17 21:12:54 1998
***************
*** 1,4 ****
- /* s_from.h created from s_from.us by gencat on Mon May 31 15:36:00 EDT 1993 */
  
  #define FromSet	0x11
  #define FromForMoreInfo	0x1
--- 1,3 ----
Index: elm2.4.ME+.50/hdrs/s_newalias.h
*** elm2.4.25/hdrs/s_newalias.h	Fri Dec 11 05:04:45 1992
--- elm2.4.ME+.50/hdrs/s_newalias.h	Tue Nov 17 21:12:55 1998
***************
*** 1,4 ****
- /* s_newalias.h created from s_newalias.us by gencat on Thu Dec 10 22:04:44 EST 1992 */
  
  #define NewaliasSet	0xc
  #define NewaliasUsage	0x1
--- 1,3 ----
Index: elm2.4.ME+.50/hdrs/s_newmail.h
*** elm2.4.25/hdrs/s_newmail.h	Tue Nov 17 21:24:10 1992
--- elm2.4.ME+.50/hdrs/s_newmail.h	Tue Nov 17 21:12:55 1998
***************
*** 1,4 ****
- /* s_newmail.h created from s_newmail.us by gencat on Sat Oct  3 18:34:18 EDT 1992 */
  
  #define NewmailSet	0xd
  #define NewmailNoSubject	0x1
--- 1,3 ----
Index: elm2.4.ME+.50/hdrs/s_readmsg.h
*** elm2.4.25/hdrs/s_readmsg.h	Sun Oct  4 01:35:16 1992
--- elm2.4.ME+.50/hdrs/s_readmsg.h	Tue Nov 17 21:12:54 1998
***************
*** 1,4 ****
- /* s_readmsg.h created from s_readmsg.us by gencat on Sat Oct  3 18:34:19 EDT 1992 */
  
  #define ReadmsgSet	0x13
  #define ReadmsgUsage	0x1
--- 1,3 ----
Index: elm2.4.ME+.50/hdrs/save_opts.h
*** elm2.4.25/hdrs/save_opts.h	Tue Aug 10 21:49:32 1993
--- elm2.4.ME+.50/hdrs/save_opts.h	Tue Nov 17 21:14:08 1998
***************
*** 1,75 ****
  
! /* @(#)$Id: save_opts.h,v 5.10 1993/08/10 18:49:32 syd Exp $ */
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: save_opts.h,v $
!  * Revision 5.10  1993/08/10  18:49:32  syd
!  * When an environment variable was given as the tmpdir definition the src
!  * and dest overlapped in expand_env.  This made elm produce a garbage
!  * expansion because expand_env cannot cope with overlapping src and
!  * dest.  I added a new variable raw_temp_dir to keep src and dest not to
!  * overlap.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.9  1993/06/12  05:28:06  syd
!  * Missing checkin
!  *
!  * Revision 5.8  1993/05/08  18:56:16  syd
!  * created a new elmrc variable named "readmsginc".  This specifies an
!  * increment by which the message count is updated.  If this variable is
!  * set to, say, 25, then the message count will only be updated every 25
!  * messages, displaying 0, 25, 50, 75, and so forth.  The default value
!  * of 1 will cause Elm to behave exactly as it currently does in PL21.
!  * From: Eric Peterson <epeterso@encore.com>
!  *
!  * Revision 5.7  1993/01/20  04:01:07  syd
!  * Adds a new integer parameter builtinlines.
!  * if (builtinlines < 0) and (the length of the message < LINES on
!  *       screen + builtinlines) use internal.
!  * if (builtinlines > 0) and (length of message < builtinlines)
!  * 	use internal pager.
!  * if (builtinlines = 0) or none of the above conditions hold, use the
!  * external pager if defined.
!  * From: "John P. Rouillard" <rouilj@ra.cs.umb.edu>
!  *
!  * Revision 5.6  1992/10/25  02:43:50  syd
!  * fix typo
!  *
!  * Revision 5.5  1992/10/25  02:38:27  syd
!  * Add missing new flags for new elmrc options for confirm
!  * From: Syd
!  *
!  * Revision 5.4  1992/10/24  13:44:41  syd
!  * There is now an additional elmrc option "displaycharset", which
!  * sets the charset supported on your terminal. This is to prevent
!  * elm from calling out to metamail too often.
!  * Plus a slight documentation update for MIME composition (added examples)
!  * From: Klaus Steinberger <Klaus.Steinberger@Physik.Uni-Muenchen.DE>
!  *
!  * Revision 5.3  1992/10/17  22:58:57  syd
!  * patch to make elm use (or in my case, not use) termcap/terminfo ti/te.
!  * From: Graham Hudspith <gwh@inmos.co.uk>
!  *
!  * Revision 5.2  1992/10/17  22:42:24  syd
!  * Add flags to read_rc to support command line overrides of the option.
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.1  1992/10/03  22:34:39  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /*
   *	Defines for the storage of options portion of the Elm system.
--- 1,16 ----
  
! /* @(#)$Id: save_opts.h,v 1.3 1998/11/08 18:21:22 hurtta Exp $ */
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.3 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /*
   *	Defines for the storage of options portion of the Elm system.
***************
*** 95,100 ****
--- 36,42 ----
  #define DT_SRT 7 /* sort-by code */
  #define DT_MLT 8 /* multiple destinations for data */
  #define DT_ASR 9 /* sort-by code */
+ #define DT_PRM 10 /* file permissions */
  #define DT_MASK 037 /* mask for data type */
  #define FL_LOCAL 0040          /* flag if changed */
  #define FL_NOSPC 0100          /* flag if preserve blanks as "_" */
***************
*** 102,107 ****
--- 44,54 ----
  #define FL_OR    0400          /* flag if boolean value may have been set */
  #define FL_AND  01000          /* flag if boolean value may have been unset */
  
+ typedef struct {
+    int nlen;
+    char **list;
+ }  enumerate_list;
+ 
  typedef struct { 
  	char 	name[NLEN]; 	/* name of instruction */
  	long 	offset;		/* offset into elmrc-info file */
***************
*** 115,120 ****
--- 62,69 ----
            struct addr_rec **alts;
            int 	*sort;
            } val;
+           int size_val;
+           enumerate_list   *e_ptr;
  	} save_info_recs;
  
  /*
***************
*** 127,132 ****
--- 76,83 ----
  	long 	offset;		/* offset into elmrc-info file */
          int	flags;	/* DT_STR, DT_NUM, DT_BOL, etc */
          char 	*str;
+         int              size_val;
+         enumerate_list   *e_ptr;
  	} save_info_recs_init;
  
  #define SAVE_INFO_STR(x) (save_info[x].val.str)
***************
*** 137,144 ****
  #define SAVE_INFO_ALT(x) (save_info[x].val.alts)
  #define SAVE_INFO_SRT(x) (save_info[x].val.sort)
  #define SAVE_INFO_ASR(x) (save_info[x].val.sort)
! #define SAVE_INFO_SYN(x) ((char *)save_info[x].val.str)
! #define SAVE_INFO_MLT(x) ((char **)save_info[x].val.weed)
  
  #ifdef SAVE_OPTS
  
--- 88,95 ----
  #define SAVE_INFO_ALT(x) (save_info[x].val.alts)
  #define SAVE_INFO_SRT(x) (save_info[x].val.sort)
  #define SAVE_INFO_ASR(x) (save_info[x].val.sort)
! #define SAVE_INFO_SYN(x) (save_info[x].val.str)
! #define SAVE_INFO_MLT(x) (save_info[x].val.weed)
  
  #ifdef SAVE_OPTS
  
***************
*** 148,253 ****
  char *SIGS[]={"remotesignature","localsignature",NULL},
  	*ALWAYS[]={"alwayskeep","alwaysstore",NULL};
  
  save_info_recs_init save_info_data[] = {
! {"aliassortby",		-1L,DT_ASR,(char *)&alias_sortby},
! {"alteditor",		-1L,DT_STR,alternative_editor},
! {"alternatives",	-1L,DT_ALT,(char *)&alternative_addresses},
! {"alwaysdelete",	-1L,DT_BOL,(char *)&always_del},
! {"alwayskeep",		-1L,DT_BOL,(char *)&always_keep},
! {"alwaysleave",		-1L,DT_MLT,(char *)ALWAYS},
! {"alwaysstore",		-1L,DT_BOL,(char *)&always_store},
! {"arrow",		-1L,DT_BOL|FL_OR,(char *)&arrow_cursor},
! {"ask",			-1L,DT_BOL,(char *)&question_me},
! {"askcc",		-1L,DT_BOL,(char *)&prompt_for_cc},
! {"attribution",		-1L,DT_STR,attribution},
! {"auto_cc",		-1L,DT_SYN,"copy"},
! {"autocopy",		-1L,DT_BOL,(char *)&auto_copy},
! {"bounce",		-1L,DT_SYN,"bounceback"},
! {"bounceback",		-1L,DT_NUM,(char *)&bounceback},
! {"builtinlines",	-1L,DT_NUM,(char *)&builtin_lines},
! {"calendar",		-1L,DT_STR,raw_calendar_file},
! {"cc",			-1L,DT_SYN,"askcc"},
! #ifdef MIME
! {"charset",		-1L,DT_STR,charset},
! {"compatcharsets",		-1L,DT_STR,charset_compatlist},
! #endif
! {"configoptions",	-1L,DT_STR,config_options},
! {"confirmappend",	-1L,DT_BOL,(char *)&confirm_append},
! {"confirmcreate",	-1L,DT_BOL,(char *)&confirm_create},
! {"confirmfiles",	-1L,DT_BOL,(char *)&confirm_files},
! {"confirmfolders",	-1L,DT_BOL,(char *)&confirm_folders},
! {"copy",		-1L,DT_BOL,(char *)&auto_cc},
! {"delete",		-1L,DT_SYN,"alwaysdelete"},
! #ifdef MIME
! {"displaycharset",	-1L,DT_STR,display_charset},
! #endif
! {"easyeditor",		-1L,DT_STR,e_editor},
! {"editor",		-1L,DT_STR,raw_editor},
! {"escape",		-1L,DT_CHR,(char *)&escape_char},
! {"folders",		-1L,DT_SYN,"maildir"},
! {"forcename",		-1L,DT_BOL,(char *)&force_name},
! {"form",		-1L,DT_SYN,"forms"},
! {"forms",		-1L,DT_BOL,(char *)&allow_forms},
! {"fullname",		-1L,DT_STR,full_username},
! {"hostdomain",		-1L,DT_STR|FL_SYS,hostdomain},
! {"hostfullname",	-1L,DT_STR|FL_SYS,hostfullname},
! {"hostname",		-1L,DT_STR|FL_SYS,hostname},
! {"hpkeypad",		-1L,DT_SYN,"keypad"},
! {"hpsoftkeys",		-1L,DT_SYN,"softkeys"},
! {"keep",		-1L,DT_SYN,"keepempty"},
! {"keepempty",		-1L,DT_BOL,(char *)&keep_empty_files},
! {"keypad",		-1L,DT_BOL|FL_OR,(char *)&hp_terminal},
! {"localsignature",	-1L,DT_STR,raw_local_signature},
! {"mailbox",		-1L,DT_SYN,"receivedmail"},
! {"maildir",		-1L,DT_STR,raw_folders},
! {"mailedit",		-1L,DT_SYN,"editor"},
! {"menu",		-1L,DT_BOL|FL_AND,(char *)&mini_menu},
! {"menus",		-1L,DT_SYN,"menu"},
! {"metoo",		-1L,DT_BOL,(char *)&metoo},
! {"movepage",		-1L,DT_BOL,(char *)&move_when_paged},
! {"movewhenpaged",	-1L,DT_SYN,"movepage"},
! {"name",		-1L,DT_SYN,"fullname"},
! {"names",		-1L,DT_BOL,(char *)&names_only},
! {"noheader",		-1L,DT_BOL,(char *)&noheader},
! {"page",		-1L,DT_SYN,"pager"},
! {"pager",		-1L,DT_STR,raw_pager},
! {"pointnew",		-1L,DT_BOL,(char *)&point_to_new},
! {"pointtonew",		-1L,DT_SYN,"pointnew"},
! {"precedences",		-1L,DT_STR,allowed_precedences},
! {"prefix",		-1L,DT_STR|FL_NOSPC,prefixchars},
! {"print",		-1L,DT_STR,raw_printout},
! {"printmail",		-1L,DT_SYN,"print"},
! {"promptafter",		-1L,DT_BOL,(char *)&prompt_after_pager},
! {"question",		-1L,DT_SYN,"ask"},
! {"readmsginc",		-1L,DT_NUM,(char *)&readmsginc},
! {"receivedmail",	-1L,DT_STR,raw_recvdmail},
! {"remotesignature",	-1L,DT_STR,raw_remote_signature},
! {"resolve",		-1L,DT_BOL,(char *)&resolve_mode},
! {"savebyname",		-1L,DT_SYN,"savename"},
! {"savemail",		-1L,DT_SYN,"sentmail"},
! {"savename",		-1L,DT_BOL,(char *)&save_by_name},
! {"saveto",		-1L,DT_SYN,"sentmail"},
! {"sentmail",		-1L,DT_STR,raw_sentmail},
! {"shell",		-1L,DT_STR,raw_shell},
! {"sigdashes",		-1L,DT_BOL,(char *)&sig_dashes},
! {"signature",		-1L,DT_MLT,(char *)SIGS},
! {"sleepmsg",		-1L,DT_NUM,(char *)&sleepmsg},
! {"softkeys",		-1L,DT_BOL|FL_OR,(char *)&hp_softkeys},
! {"sort",		-1L,DT_SYN,"sortby"},
! {"sortby",		-1L,DT_SRT,(char *)&sortby},
! {"store",		-1L,DT_SYN,"alwaysstore"},
! #ifdef MIME
! {"textencoding", -1L,DT_STR,text_encoding},
! #endif
! {"timeout",		-1L,DT_NUM,(char *)&timeout},
! {"titles",		-1L,DT_BOL,(char *)&title_messages},
! {"tmpdir",		-1L,DT_STR,raw_temp_dir},
! {"userlevel",		-1L,DT_NUM,(char *)&user_level},
! {"username",		-1L,DT_SYN,"fullname"},
! {"usetite",		-1L,DT_BOL|FL_AND,(char *)&use_tite},
! {"visualeditor",	-1L,DT_STR,v_editor},
! {"weed",		-1L,DT_BOL,(char *)&filter},
! {"weedout",		-1L,DT_WEE,(char *)weedlist},
  };
  int NUMBER_OF_SAVEABLE_OPTIONS=(sizeof(save_info_data)/sizeof(save_info_recs_init));
  save_info_recs *save_info = (save_info_recs *) save_info_data;
--- 99,271 ----
  char *SIGS[]={"remotesignature","localsignature",NULL},
  	*ALWAYS[]={"alwayskeep","alwaysstore",NULL};
  
+ static char * USERLEVELS[] = { "beginner", "intermediate", "expert", NULL };
+ static enumerate_list USERLEVEL = {3, &(USERLEVELS[0]) };
+ 
+ static char * NOENCODINGS[] = { "pass-7bit", "pass-8bit", "pass-binary", NULL };
+ static enumerate_list NOENCODING = {3, &(NOENCODINGS[0]) };
+ 
  save_info_recs_init save_info_data[] = {
! {"aliassortby",		-1L,DT_ASR,(char *)&alias_sortby, 0, NULL},
! {"alteditor",		-1L,DT_STR,alternative_editor,
!    sizeof alternative_editor, NULL},
! {"alternatives",	-1L,DT_ALT,(char *)&alternative_addresses, 0, NULL},
! {"alwaysdelete",	-1L,DT_BOL,(char *)&always_del, 0, NULL},
! {"alwayskeep",		-1L,DT_BOL,(char *)&always_keep, 0, NULL},
! {"alwaysleave",		-1L,DT_MLT,(char *)ALWAYS, 0, NULL},
! {"alwaysstore",		-1L,DT_BOL,(char *)&always_store, 0, NULL},
! {"arrow",		-1L,DT_BOL|FL_OR,(char *)&arrow_cursor, 0, NULL},
! {"ask",			-1L,DT_BOL,(char *)&question_me, 0,   NULL},
! {"askcc",		-1L,DT_BOL,(char *)&prompt_for_cc, 0, NULL},
! #ifdef USE_PGP
! {"askpgpsig",		-1L,DT_BOL,(char *)&pgp_askpgpsig, 0, NULL},
! #endif
! {"attribution",		-1L,DT_STR,attribution, sizeof attribution, NULL},
! {"auto-cc",		-1L,DT_SYN,"copy", 0, NULL},
! {"autocopy",		-1L,DT_BOL,(char *)&auto_copy, 0, NULL},
! #ifdef BACKGROUD_PROCESSES       
! { "background-wait-time",-1L,DT_NUM,(char *)&background_wait_time, 0, NULL }, 
! #endif
!   /* {"bounce",		-1L,DT_SYN,"bounceback", 0, NULL},
!      {"bounceback",		-1L,DT_NUM,(char *)&bounceback, 0, NULL},
!      */
! {"builtinlines",	-1L,DT_NUM,(char *)&builtin_lines, 0, NULL},
! {"calendar",		-1L,DT_STR,raw_calendar_file, 
!    sizeof raw_calendar_file, NULL},
! {"cc",			-1L,DT_SYN,"askcc", 0, NULL},
! #ifdef MIME
! {"charset",		-1L,DT_STR,raw_charset, sizeof raw_charset, NULL},
! {"compatcharsets",		-1L,DT_STR,charset_compatlist,
!    sizeof charset_compatlist, NULL},
! #endif
! {"configoptions",	-1L,DT_STR,config_options, sizeof config_options, 
!    NULL},
! {"confirmappend",	-1L,DT_BOL,(char *)&confirm_append, 0, NULL},
! {"confirmcreate",	-1L,DT_BOL,(char *)&confirm_create, 0, NULL},
! {"confirmfiles",	-1L,DT_BOL,(char *)&confirm_files, 0, NULL},
! {"confirmfolders",	-1L,DT_BOL,(char *)&confirm_folders, 0, NULL},
! {"copy",		-1L,DT_BOL,(char *)&auto_cc, 0, NULL},
! {"delete",		-1L,DT_SYN,"alwaysdelete",   0, NULL},
! #ifdef MIME
! {"displaycharset",	-1L,DT_STR,raw_display_charset,
!    sizeof raw_display_charset, NULL},
! #endif
! #ifdef USE_DSN
! {"dsn-success",         -1L,DT_BOL,(char *)&DSN_success, 0, NULL },
! #endif
! {"easyeditor",		-1L,DT_STR,e_editor,   sizeof e_editor,   NULL},
! {"editor",		-1L,DT_STR,raw_editor, sizeof raw_editor, NULL},
! {"escape",		-1L,DT_CHR,(char *)&escape_char, 0,       NULL},
! {"folders",		-1L,DT_SYN,"maildir", 0,                  NULL},
! {"forcename",		-1L,DT_BOL,(char *)&force_name, 0,        NULL},
! {"form",		-1L,DT_SYN,"forms", 0,                    NULL},
! {"forms",		-1L,DT_BOL,(char *)&allow_forms, 0,       NULL},
! {"fullname",		-1L,DT_STR,full_username, sizeof full_username, NULL},
! {"hostdomain",		-1L,DT_STR|FL_SYS,hostdomain,   sizeof hostdomain, 
!    NULL},
! {"hostfullname",	-1L,DT_STR|FL_SYS,hostfullname, sizeof hostfullname, 
!    NULL},
! {"hostname",		-1L,DT_STR|FL_SYS,hostname,     sizeof hostname, 
!    NULL},
!   /* {"hpkeypad",		-1L,DT_SYN,"keypad", 0, NULL}, */
!   /* {"hpsoftkeys",		-1L,DT_SYN,"softkeys", 0, NULL}, */
! {"keep",		-1L,DT_SYN,"keepempty", 0, NULL},
! {"keepempty",		-1L,DT_BOL,(char *)&keep_empty_files, 0, NULL},
! #ifdef USE_PGP
! {"keeppassfor", -1L,DT_NUM,(char *)&pgp_keeppassfor, 0, NULL},
! #endif
!   /* {"keypad",		-1L,DT_BOL|FL_OR,(char *)&hp_terminal, 0, NULL}, */
! {"localsignature",	-1L,DT_STR,raw_local_signature, 
!    sizeof raw_local_signature, NULL},
! {"lock-in-copy",        -1L,DT_BOL,(char *)&lock_in_copy,0, NULL},
! {"mailbox",		-1L,DT_SYN,"receivedmail", 0, NULL},
! {"maildir",		-1L,DT_STR,raw_folders, sizeof raw_folders, NULL},
! {"mailedit",		-1L,DT_SYN,"editor", 0, NULL},
! {"mailpermissions",	-1L,DT_PRM,(char *)&mail_permissions, 0, NULL},
! {"menu",		-1L,DT_BOL|FL_AND,(char *)&mini_menu, 0, NULL},
! {"menus",		-1L,DT_SYN,"menu", 0, NULL},
! #ifdef MIME
! {"metamail",		-1L,DT_STR,raw_metamail_path, 
!    sizeof raw_metamail_path, NULL},
! #endif
! {"metoo",		-1L,DT_BOL,(char *)&metoo, 0, NULL},
! #ifdef MIME
! {"mimeforward",		-1L,DT_BOL,(char *)&mimeforward, 0, NULL},
! #endif
! {"movepage",		-1L,DT_BOL,(char *)&move_when_paged, 0, NULL},
! {"movewhenpaged",	-1L,DT_SYN,"movepage", 0, NULL},
! {"name",		-1L,DT_SYN,"fullname", 0, NULL},
! {"names",		-1L,DT_BOL,(char *)&names_only, 0, NULL},
! #ifdef MIME
! {"noencoding",-1L,DT_NUM,(char *)&allow_no_encoding, 0, &NOENCODING},
!                                  /* 1 (8bit): Allow 8bit without -B8BITMIME
!                                   * 2 (biary): Allow binary without -BBINARYMIME and
!                                   *    and 8bit without -B8BITMIME */
! {"nohdrencoding",       -1L,DT_BOL,(char *)&allow_no_hdrencoding, 0, NULL},
! #endif /* MIME **/
! {"noheader",		-1L,DT_BOL,(char *)&noheader, 0, NULL},
! {"noheaderfwd",		-1L,DT_BOL,(char *)&noheaderfwd, 0, NULL},
! {"page",		-1L,DT_SYN,"pager", 0, NULL},
! #ifdef MIME
! {"pagealternative",	-1L,DT_BOL,(char *)&pagealternative, 0, NULL},
! {"pagemultipart",	-1L,DT_BOL,(char *)&pagemultipart, 0, NULL},
! #endif /* MIME */
! {"pager",		-1L,DT_STR,raw_pager, sizeof raw_pager, NULL},
! #ifdef USE_PGP
! {"pgp",		        -1L,DT_STR,raw_pgp_path, sizeof raw_pgp_path, NULL},
! #endif
! {"pointnew",		-1L,DT_BOL,(char *)&point_to_new, 0, NULL},
! {"pointtonew",		-1L,DT_SYN,"pointnew", 0, NULL},
! {"precedences",		-1L,DT_STR,allowed_precedences, 
!    sizeof allowed_precedences, NULL},
! {"prefix",		-1L,DT_STR|FL_NOSPC,prefixchars,
!    sizeof prefixchars, NULL},
! {"print",		-1L,DT_STR,raw_printout, sizeof raw_printout, NULL},
! {"printmail",		-1L,DT_SYN,"print", 0, NULL},
! {"promptafter",		-1L,DT_BOL,(char *)&prompt_after_pager, 0, NULL},
! {"question",		-1L,DT_SYN,"ask", 0, NULL},
! {"quoteforward",	-1L,DT_BOL,(char *)&quote_forward, 0, NULL},
! {"readmsginc",		-1L,DT_NUM,(char *)&readmsginc, 0, NULL},
! {"receivedmail",	-1L,DT_STR,raw_recvdmail, sizeof raw_recvdmail, NULL},
! {"remotesignature",	-1L,DT_STR,raw_remote_signature, 
!    sizeof raw_remote_signature, NULL},
! #ifdef MIME
! {"require-mime-version-for-body-encoding",
!    -1L,DT_BOL,(char *)&req_mime_bodyencoding, 0, NULL},
! {"require-mime-version-for-hdr-encoding",
!    -1L,DT_BOL,(char *)&req_mime_hdrencoding, 0, NULL},
! #endif
! {"resolve",		-1L,DT_BOL,(char *)&resolve_mode, 0, NULL},
! {"savebyname",		-1L,DT_SYN,"savename", 0, NULL},
! {"savemail",		-1L,DT_SYN,"sentmail", 0, NULL},
! {"savename",		-1L,DT_BOL,(char *)&save_by_name, 0, NULL},
! {"saveto",		-1L,DT_SYN,"sentmail", 0, NULL},
! {"sentmail",		-1L,DT_STR,raw_sentmail, sizeof raw_sentmail, NULL},
! {"shell",		-1L,DT_STR,raw_shell, sizeof raw_shell, NULL},
! #ifdef USE_PGP
! {"showpgppreamble",	-1L,DT_BOL,(char *)&pgp_noarmor, 0, NULL},
! #endif
! {"showto",		-1L,DT_BOL,(char *)&showto, 0, NULL},
! {"sigdashes",		-1L,DT_BOL,(char *)&sig_dashes, 0, NULL},
! {"signature",		-1L,DT_MLT,(char *)SIGS, 0, NULL},
! {"sleepmsg",		-1L,DT_NUM,(char *)&sleepmsg, 0, NULL},
!   /* {"softkeys",		-1L,DT_BOL|FL_OR,(char *)&hp_softkeys, 0, 
!      NULL}, */
! {"sort",		-1L,DT_SYN,"sortby", 0, NULL},
! {"sortby",		-1L,DT_SRT,(char *)&sortby, 0, NULL},
! {"store",		-1L,DT_SYN,"alwaysstore", 0, NULL},
! {"timeout",		-1L,DT_NUM,(char *)&elm_timeout, 0, NULL},
! {"titles",		-1L,DT_BOL,(char *)&title_messages, 0, NULL},
! {"tmpdir",		-1L,DT_STR,raw_temp_dir, sizeof raw_temp_dir, NULL},
! #ifdef USE_PGP
! {"usepgppass",          -1L,DT_BOL,(char *)&pgp_keeppass, 0, NULL},
! #endif
! {"userlevel",		-1L,DT_NUM,(char *)&user_level, 0, &USERLEVEL},
! {"username",		-1L,DT_SYN,"fullname", 0, NULL},
! {"usetite",		-1L,DT_BOL|FL_AND,(char *)&use_tite, 0, NULL},
! {"visualeditor",	-1L,DT_STR,v_editor, sizeof v_editor, NULL},
! {"weed",		-1L,DT_BOL,(char *)&elm_filter, 0, NULL},
! {"weedout",		-1L,DT_WEE,(char *)weedlist, 0, NULL},
  };
  int NUMBER_OF_SAVEABLE_OPTIONS=(sizeof(save_info_data)/sizeof(save_info_recs_init));
  save_info_recs *save_info = (save_info_recs *) save_info_data;
Index: elm2.4.ME+.50/hdrs/sysdefs.SH
*** elm2.4.25/hdrs/sysdefs.SH	Thu Dec 24 21:24:11 1992
--- elm2.4.ME+.50/hdrs/sysdefs.SH	Tue Nov 17 21:14:08 1998
***************
*** 16,60 ****
  
  echo "Extracting hdrs/sysdefs.h (with variable substitutions)"
  sed <<!GROK!THIS! >sysdefs.h -e 's!^#undef!/\*#undef!'
! /* $Id: sysdefs.SH,v 5.4 1992/12/24 19:24:10 syd Exp $ */
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: sysdefs.SH,v $
!  * Revision 5.4  1992/12/24  19:24:10  syd
!  * EDITOROPTS and DEFEDITOR appear to be unused but here is
!  * a patch to make use of $editoropts.
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.3  1992/11/22  01:14:20  syd
!  * Allow SCO MMDF to use the mmdf library for mailer via execmail.
!  * From: Larry Philps <larryp@sco.com>
!  *
!  * Revision 5.2  1992/10/24  13:44:41  syd
!  * There is now an additional elmrc option "displaycharset", which
!  * sets the charset supported on your terminal. This is to prevent
!  * elm from calling out to metamail too often.
!  * Plus a slight documentation update for MIME composition (added examples)
!  * From: Klaus Steinberger <Klaus.Steinberger@Physik.Uni-Muenchen.DE>
!  *
!  * Revision 5.1  1992/10/03  22:34:39  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /**  System level, configurable, defines for the ELM mail system.  **/
  
- 
  #define MAX_IN_WEEDLIST 150	/* max headers to weed out               */
  
  #define MAX_HOPS	35	/* max hops in return addr to E)veryone  */
--- 16,35 ----
  
  echo "Extracting hdrs/sysdefs.h (with variable substitutions)"
  sed <<!GROK!THIS! >sysdefs.h -e 's!^#undef!/\*#undef!'
! /* $Id: sysdefs.SH,v 1.4 1998/11/08 18:21:22 hurtta Exp $ */
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.4 $   $State: Exp $
!  *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /**  System level, configurable, defines for the ELM mail system.  **/
  
  #define MAX_IN_WEEDLIST 150	/* max headers to weed out               */
  
  #define MAX_HOPS	35	/* max hops in return addr to E)veryone  */
***************
*** 78,91 ****
  
  ****************************************************************************/
  
! #define system_text_file        "$lib/aliases.text"
! #define system_data_file        "$lib/aliases"
! #define system_rc_file		"$lib/elm.rc"
! 
! #define ALIAS_TEXT		".elm/aliases.text"
! #define ALIAS_DATA		".elm/aliases"
  
! #define hostdomfile             "$lib/domain"
  
  /** where to put the output of the elm -d command... (in home dir) **/
  #define DEBUGFILE	"ELM:debug.info"
--- 53,70 ----
  
  ****************************************************************************/
  
! #define SYSTEM_TEXT_FILE        "$lib/aliases.text"
! #define SYSTEM_DATA_FILE        "$lib/aliases"
! #define SYSTEM_RC_FILE		"$lib/elm.rc"
! #define SYSTEM_MIME_TYPES	"$lib/elm.mimetypes"
! #define SYSTEM_MIME_CHARSETS    "$lib/elm.mimecharsets"
! 
! #define USER_ALIAS_TEXT		".elm/aliases.text"
! #define USER_ALIAS_DATA		".elm/aliases"
! #define USER_MIME_TYPES	        ".elm/mime.types"
! #define USER_MIME_CHARSETS	".elm/mime.charsets"
  
! #define HOSTDOMFILE             "$lib/domain"
  
  /** where to put the output of the elm -d command... (in home dir) **/
  #define DEBUGFILE	"ELM:debug.info"
***************
*** 97,103 ****
  #define temp_mbox	"mbox."
  #define temp_print      "print."
  #define temp_edit	"elm-edit"
! #define temp_uuname	"uuname."
  #define temp_state	"est."
  
  #define emacs_editor	"$emacs"
--- 76,82 ----
  #define temp_mbox	"mbox."
  #define temp_print      "print."
  #define temp_edit	"elm-edit"
! /* #define temp_uuname	"uuname." */
  #define temp_state	"est."
  
  #define emacs_editor	"$emacs"
***************
*** 106,130 ****
  #define default_editor	"$defeditor $editoropts"
  #define mailhome	"$maildir/"
  
- #define default_shell	"$prefshell"
  #define default_pager	"$pager"
  #define default_printout	"$cat %s | $linepr"
  
  #define default_charset	"$defcharset"
! #define default_display_charset	"$defdispcharset"
! #define default_encoding	"$defencoding"
  #define execmail	"$execmail"
- #define emflags		""
- #define emflagsv	"-d"		/* Verbose voyuer mode */
- #define emflagmt	"-m"		/* metoo copy to sender */
  
  #define sendmail	"$sendmail"
- #define smflags		"-oi -oem"	/* ignore dots and mail back errors */
- #define smflagsv	"-oi -oem -v"	/* Verbose voyuer mode */
- #define smflagmt	" -om"		/* metoo copy to sender */
  #define submitmail	"$submit"
  #define submitflags	"-mlrnvxto,cc*"
- #define submitflags_s	"-mlrnv"
  #define mailer		"$mailer"
  
  #define mailx		"$mailx"
--- 85,100 ----
  #define default_editor	"$defeditor $editoropts"
  #define mailhome	"$maildir/"
  
  #define default_pager	"$pager"
  #define default_printout	"$cat %s | $linepr"
  
  #define default_charset	"$defcharset"
! #define DEFAULT_DISPLAY_CHARSET	"$defdispcharset"
  #define execmail	"$execmail"
  
  #define sendmail	"$sendmail"
  #define submitmail	"$submit"
  #define submitflags	"-mlrnvxto,cc*"
  #define mailer		"$mailer"
  
  #define mailx		"$mailx"
***************
*** 134,142 ****
  
  #define ELMRC_INFO	"$lib/elmrc-info"
  
! #define elmrcfile	".elm/elmrc"
  #define old_elmrcfile	".elm/elmrc.old"
! #define mailheaders	".elm/elmheaders"
  #define dead_letter	"Canceled.mail"
  
  #define unedited_mail	"emergency.mbox"
--- 104,112 ----
  
  #define ELMRC_INFO	"$lib/elmrc-info"
  
! #define ELMRCFILE	".elm/elmrc"
  #define old_elmrcfile	".elm/elmrc.old"
! #define MAILHEADERS	".elm/elmheaders"
  #define dead_letter	"Canceled.mail"
  
  #define unedited_mail	"emergency.mbox"
***************
*** 145,154 ****
  #define readmsg		"readmsg"
  
  #define remove_cmd	"$rm -f"	/* how to remove a file */
! #define cat		"$cat"		/* how to display files */
  #define sed_cmd		"$sed"		/* how to access sed */
  #define move_cmd	"$mv"		/* how to access sed */
! #define uuname		"$uuname"	/* how to get a uuname  */
  
  #define MSG_SEPARATOR	"\001\001\001\001\n"	/* mmdf message seperator */
  
--- 115,124 ----
  #define readmsg		"readmsg"
  
  #define remove_cmd	"$rm -f"	/* how to remove a file */
! /* #define cat		"$cat"		/* how to display files */
  #define sed_cmd		"$sed"		/* how to access sed */
  #define move_cmd	"$mv"		/* how to access sed */
! /* #define uuname		"$uuname"	/* how to get a uuname  */
  
  #define MSG_SEPARATOR	"\001\001\001\001\n"	/* mmdf message seperator */
  
Index: elm2.4.ME+.50/lib/Makefile.SH
*** elm2.4.25/lib/Makefile.SH	Tue Aug  3 22:28:46 1993
--- elm2.4.ME+.50/lib/Makefile.SH	Tue Nov 17 21:12:55 1998
***************
*** 36,42 ****
  
  echo "Extracting lib/Makefile (with variable substitutions)"
  cat >Makefile <<!GROK!THIS!
! # $Id: Makefile.SH,v 5.15 1993/08/03 19:28:39 syd Exp $
  #
  #  Makefile for the ELM mail program.
  #
--- 36,42 ----
  
  echo "Extracting lib/Makefile (with variable substitutions)"
  cat >Makefile <<!GROK!THIS!
! # $Id: Makefile.SH,v 1.1.1.1 1998/10/15 15:36:40 hurtta Exp $
  #
  #  Makefile for the ELM mail program.
  #
***************
*** 43,141 ****
  #	Copyright (c) 1986,1987 Dave Taylor
  #	Copyright (c) 1988-1992 USENET Community Trust
  #
- # Bug reports, patches, comments, suggestions should be sent to:
  #
- #	Syd Weinstein - elm@DSI.COM
- #			dsinc!elm
  #
- # $Log: Makefile.SH,v $
- # Revision 5.15  1993/08/03  19:28:39  syd
- # Elm tries to replace the system toupper() and tolower() on current
- # BSD systems, which is unnecessary.  Even worse, the replacements
- # collide during linking with routines in isctype.o.  This patch adds
- # a Configure test to determine whether replacements are really needed
- # (BROKE_CTYPE definition).  The <ctype.h> header file is now included
- # globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
- # there.  Inclusion of <ctype.h> was removed from *all* the individual
- # files, and the toupper() and tolower() routines in lib/opt_utils.c
- # were dropped.
- # From: chip@chinacat.unicom.com (Chip Rosenthal)
- #
- # Revision 5.14  1993/08/03  19:17:33  syd
- # Implement new timezone handling.  New file lib/get_tz.c with new timezone
- # routines.  Added new TZMINS_USE_xxxxxx and TZNAME_USE_xxxxxx configuration
- # definitions.  Obsoleted TZNAME, ALTCHECK, and TZ_MINUTESWEST configuration
- # definitions.  Updated Configure.  Modified lib/getarpdate.c and
- # lib/strftime.c to use new timezone routines.
- #
- # From: chip@chinacat.unicom.com (Chip Rosenthal)
- #
- # Revision 5.13  1993/08/02  18:14:35  syd
- # add missing references for mcprt.c/mcprtlib.c to defs.h
- # From: Syd
- #
- # Revision 5.12  1993/06/10  03:02:46  syd
- # break_down_tolist() tried to blindly split address lists at "," which
- # caused bogus results with addreses that had a comma inside a comment
- # or quoted text, such as "user@domain (Last, First)".  This patch steps
- # through the address in quanta of RFC-822 tokens when searching for a
- # delimiting comma.  It also adds "rfc822_toklen()" to the library to
- # get that length.
- # From: chip@chinacat.unicom.com (Chip Rosenthal)
- #
- # Revision 5.11  1993/04/12  01:51:42  syd
- # Added safe_malloc(), safe_realloc(), and safe_strdup().  They
- # will be used in the new elmalias utility.
- # From: chip@chinacat.unicom.com (Chip Rosenthal)
- #
- # Revision 5.10  1993/02/03  16:21:03  syd
- # add strtokq
- # From: Syd
- #
- # Revision 5.9  1993/01/27  18:52:03  syd
- # add strftime as optional component
- #
- # Revision 5.8  1993/01/19  05:07:05  syd
- # Trim erroreous extra log entry
- # From: Syd
- #
- # Revision 5.7  1993/01/19  04:47:12  syd
- # Significant changes to provide consistent Date and From_ header
- # cracking.  Overhauled date utilities and moved into library.  Moved
- # real_from() into library.  Modified frm, newmail, and readmsg utilities
- # to use library version of real_from().  Moved get_word() from Elm
- # source into library.  Added new library routines atonum() and strfcpy().
- # Fixed trailing backslash bug in len_next().
- # From: chip@chinacat.unicom.com (Chip Rosenthal)
- #
- # Revision 5.6  1992/12/24  19:33:59  syd
- # tune dependency list further
- # From: Syd
- #
- # Revision 5.5  1992/12/24  19:30:46  syd
- # Make all object depend on config.h, so a reconfig for a new
- # arch in shared sources (or copied sources) forces a recompile
- # of all modules.
- # From: Syd
- #
- # Revision 5.4  1992/12/20  05:15:58  syd
- # Add a c)hange alias, -u and -t options to listalias to list only user
- # and only system aliases respectively.
- # From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
- #
- # Revision 5.3  1992/11/07  20:07:23  syd
- # Add header_cmp routine
- # From: Syd
- #
- # Revision 5.2  1992/10/27  01:43:40  syd
- # Move posix_signal to lib directory
- # From: tom@osf.org
- #
- # Revision 5.1  1992/10/03  22:41:36  syd
- # Initial checkin as of 2.4 Release at PL0
- #
- #
- #
  # Variables
  #	Variables established by Configure
  AR		=	ar
--- 43,50 ----
***************
*** 172,178 ****
  # DACSNET	=	-DACSNET
  
  #	Other general variables
! CFLAGS		=	$(CCFLAGS) $(OPTIMIZE) -I$(INCLDIR) $(DEBUG) $(DACSNET) 
  INCLDIR		=	../hdrs
  LINTFLAGS	=	-I$(INCLDIR)
  SHELL		=	/bin/sh
--- 81,87 ----
  # DACSNET	=	-DACSNET
  
  #	Other general variables
! CFLAGS		=	-I$(INCLDIR) $(CCFLAGS) $(OPTIMIZE) $(DEBUG) $(DACSNET) 
  INCLDIR		=	../hdrs
  LINTFLAGS	=	-I$(INCLDIR)
  SHELL		=	/bin/sh
***************
*** 188,197 ****
--- 97,111 ----
  			can_open.c	\
  			chloc.c		\
  			date_util.c	\
+ 			dispaddr.c	\
+ 			dynarray.c	\
  			errno.c		\
  			expand.c	\
  			figadrssee.c	\
+ 			forwarded.c     \
  			gcos_name.c	\
+ 			getaddr.c	\
+ 			getaddr.c	\
  			getaddrfrm.c	\
  			getarpdate.c	\
  			getfullnam.c	\
***************
*** 209,220 ****
--- 123,137 ----
  			ndbz.c		\
  			okay_addr.c	\
  			opt_utils.c	\
+ 			output.c        \
  			parsarpdat.c	\
  			parsarpwho.c	\
+ 			pmalloc.c	\
  			posixsig.c	\
  			putenv.c	\
  			realfrom.c	\
  			qstrings.c	\
+ 			read_rc.c       \
  			remfirstwd.c	\
  			reverse.c	\
  			rfc822tlen.c	\
***************
*** 225,233 ****
  			striparens.c	\
  			$(STRSRC)	\
  			$(FTIMESRC)	\
  			strtokq.c	\
  			tail_of.c	\
! 			validname.c
  
  LIB_OBJ		=	add_site.o	\
  			addrmchusr.o	\
--- 142,152 ----
  			striparens.c	\
  			$(STRSRC)	\
  			$(FTIMESRC)	\
+ 			strmcpy.c	\
  			strtokq.c	\
  			tail_of.c	\
! 			validname.c	\
! 			safeopen.c
  
  LIB_OBJ		=	add_site.o	\
  			addrmchusr.o	\
***************
*** 239,249 ****
--- 158,172 ----
  			can_open.o	\
  			chloc.o		\
  			date_util.o	\
+ 			dispaddr.o	\
+ 			dynarray.o	\
  			errno.o		\
  			expand.o	\
  			figadrssee.o	\
+ 			forwarded.o     \
  			gcos_name.o	\
  			get_tz.o	\
+ 			getaddr.o	\
  			getaddrfrm.o	\
  			getarpdate.o	\
  			getfullnam.o	\
***************
*** 260,270 ****
--- 183,196 ----
  			ndbz.o		\
  			okay_addr.o	\
  			opt_utils.o	\
+ 			output.o	\
  			parsarpdat.o	\
  			parsarpwho.o	\
+ 			pmalloc.o	\
  			posixsig.o	\
  			putenv.o	\
  			qstrings.o	\
+ 			read_rc.o	\
  			realfrom.o	\
  			remfirstwd.o	\
  			reverse.o	\
***************
*** 276,288 ****
  			striparens.o	\
  			$(STROBJ)	\
  			$(FTIMEOBJ)	\
  			strtokq.o	\
  			tail_of.o	\
! 			validname.o
  
! all:			libutil.a
  
! install:		libutil.a
  
  uninstall:		libutil.a
  
--- 202,216 ----
  			striparens.o	\
  			$(STROBJ)	\
  			$(FTIMEOBJ)	\
+ 			strmcpy.o	\
  			strtokq.o	\
  			tail_of.o	\
! 			validname.o	\
! 			safeopen.o
  
! all:			Makefile libutil.a
  
! install:		Makefile libutil.a
  
  uninstall:		libutil.a
  
***************
*** 290,295 ****
--- 218,227 ----
  			$(AR) r $@ $?
  			$(RANLIB) $@
  
+ Makefile: Makefile.SH ../config.sh
+ 	@echo "You must run 'sh Configure -S' or 'sh Configure'"
+ 	exit 1
+ 
  lint:		
  		$(LINT) $(LINTFLAGS) $(LIB_SRC) > LINT.OUT
  
***************
*** 307,317 ****
  			$(CHMOD) u+w $@
  			$(TOUCH) $@
  
! $(INCLDIR)/elm.h:	$(INCLDIR)/curses.h $(INCLDIR)/defs.h
  			$(CHMOD) u+w $@
  			$(TOUCH) $@
  
! $(INCLDIR)/headers.h:	$(INCLDIR)/curses.h $(INCLDIR)/defs.h
  			$(CHMOD) u+w $@
  			$(TOUCH) $@
  
--- 239,249 ----
  			$(CHMOD) u+w $@
  			$(TOUCH) $@
  
! $(INCLDIR)/elm.h:	$(INCLDIR)/curses.h $(INCLDIR)/defs.h $(INCLDIR)/melib.h
  			$(CHMOD) u+w $@
  			$(TOUCH) $@
  
! $(INCLDIR)/headers.h:	$(INCLDIR)/curses.h $(INCLDIR)/defs.h $(INCLDIR)/elmlib.h $(INCLDIR)/me.h
  			$(CHMOD) u+w $@
  			$(TOUCH) $@
  
***************
*** 318,324 ****
  #	Dependencies of C object files
  add_site.o:	$(INCLDIR)/headers.h
  addrmchusr.o:	$(INCLDIR)/headers.h
! atonum.o:	$(INCLDIR)/defs.h
  mk_aliases.o:	$(INCLDIR)/headers.h $(INCLDIR)/ndbz.h $(INCLDIR)/s_newalias.h
  aliasdb.o:	$(INCLDIR)/headers.h $(INCLDIR)/ndbz.h
  mk_lockname.o:	$(INCLDIR)/headers.h
--- 250,256 ----
  #	Dependencies of C object files
  add_site.o:	$(INCLDIR)/headers.h
  addrmchusr.o:	$(INCLDIR)/headers.h
! atonum.o:	$(INCLDIR)/defs.h $(INCLDIR)/elmlib.h
  mk_aliases.o:	$(INCLDIR)/headers.h $(INCLDIR)/ndbz.h $(INCLDIR)/s_newalias.h
  aliasdb.o:	$(INCLDIR)/headers.h $(INCLDIR)/ndbz.h
  mk_lockname.o:	$(INCLDIR)/headers.h
***************
*** 326,369 ****
  can_open.o:	$(INCLDIR)/headers.h
  chloc.o:	$(INCLDIR)/headers.h
  date_util.o:	$(INCLDIR)/headers.h
  errno.o:	$(INCLDIR)/headers.h
! expand.o:	$(INCLDIR)/defs.h $(INCLDIR)/s_elmrc.h
  figadrssee.o:	$(INCLDIR)/headers.h
  gcos_name.o:	$(INCLDIR)/headers.h
! get_tz.o:	$(INCLDIR)/defs.h
  getaddrfrm.o:	$(INCLDIR)/headers.h
  getarpdate.o:	$(INCLDIR)/headers.h
  getfullnam.o:	$(INCLDIR)/headers.h
! getword.o:	$(INCLDIR)/defs.h
  header_cmp.o:	$(INCLDIR)/headers.h
  in_list.o:	$(INCLDIR)/headers.h
  in_string.o:	$(INCLDIR)/headers.h
  istrcmp.o:	$(INCLDIR)/headers.h
! ldstate.o:	$(INCLDIR)/defs.h
! len_next.o:	../config.h
! mail_gets.o:	../config.h
  mcprt.o:	$(INCLDIR)/mcprt.h $(INCLDIR)/mcprtlib.h $(INCLDIR)/defs.h
! mcprtlib.o:	$(INCLDIR)/mcprtlib.h $(INCLDIR)/nl_types.h $(INCLDIR)/defs.h
  move_left.o:	$(INCLDIR)/headers.h
! msgcat.o:	$(INCLDIR)/msgcat.h $(INCLDIR)/nl_types.h
  ndbz.o:		$(INCLDIR)/headers.h $(INCLDIR)/ndbz.h
  okay_addr.o:	$(INCLDIR)/headers.h
  opt_utils.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_error.h
  parsarpdat.o:	$(INCLDIR)/headers.h
  parsarpwho.o:	$(INCLDIR)/headers.h
  posixsig.o:	$(INCLDIR)/headers.h
  putenv.o:	$(INCLDIR)/headers.h
  realfrom.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! qstrings.o:	../config.h
  remfirstwd.o:	$(INCLDIR)/headers.h
  reverse.o:	$(INCLDIR)/headers.h
! safemalloc.o:	$(INCLDIR)/defs.h
  shiftlower.o:	$(INCLDIR)/headers.h
  strincmp.o:	$(INCLDIR)/headers.h
  striparens.o:	$(INCLDIR)/headers.h
  strstr.o:	$(INCLDIR)/headers.h
  strtokq.o:	$(INCLDIR)/headers.h
  tail_of.o:	$(INCLDIR)/headers.h
! validname.o:	$(INCLDIR)/defs.h
  
  !NO!SUBS!
--- 258,309 ----
  can_open.o:	$(INCLDIR)/headers.h
  chloc.o:	$(INCLDIR)/headers.h
  date_util.o:	$(INCLDIR)/headers.h
+ dispaddr.o:     $(INCLDIR)/headers.h
  errno.o:	$(INCLDIR)/headers.h
! expand.o:	$(INCLDIR)/defs.h $(INCLDIR)/s_elmrc.h $(INCLDIR)/elmlib.h
  figadrssee.o:	$(INCLDIR)/headers.h
+ forwarded.o:	$(INCLDIR)/headers.h
  gcos_name.o:	$(INCLDIR)/headers.h
! get_tz.o:	$(INCLDIR)/defs.h $(INCLDIR)/elmlib.h
! getaddr.o:	$(INCLDIR)/headers.h
  getaddrfrm.o:	$(INCLDIR)/headers.h
  getarpdate.o:	$(INCLDIR)/headers.h
  getfullnam.o:	$(INCLDIR)/headers.h
! getword.o:	$(INCLDIR)/defs.h $(INCLDIR)/elmlib.h
  header_cmp.o:	$(INCLDIR)/headers.h
  in_list.o:	$(INCLDIR)/headers.h
  in_string.o:	$(INCLDIR)/headers.h
  istrcmp.o:	$(INCLDIR)/headers.h
! ldstate.o:	$(INCLDIR)/defs.h $(INCLDIR)/elmlib.h
! len_next.o:	$(INCLDIR)/defs.h $(INCLDIR)/elmlib.h
! mail_gets.o:	$(INCLDIR)/defs.h $(INCLDIR)/elmlib.h
  mcprt.o:	$(INCLDIR)/mcprt.h $(INCLDIR)/mcprtlib.h $(INCLDIR)/defs.h
! mcprtlib.o:	$(INCLDIR)/mcprtlib.h $(INCLDIR)/defs.h
  move_left.o:	$(INCLDIR)/headers.h
! msgcat.o:	$(INCLDIR)/msgcat.h $(INCLDIR)/defs.h $(INCLDIR)/elmlib.h
  ndbz.o:		$(INCLDIR)/headers.h $(INCLDIR)/ndbz.h
  okay_addr.o:	$(INCLDIR)/headers.h
  opt_utils.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_error.h
+ output.o:	$(INCLDIR)/headers.h
  parsarpdat.o:	$(INCLDIR)/headers.h
  parsarpwho.o:	$(INCLDIR)/headers.h
+ pmalloc.o:	$(INCLDIR)/defs.h $(INCLDIR)/s_elm.h
  posixsig.o:	$(INCLDIR)/headers.h
  putenv.o:	$(INCLDIR)/headers.h
+ read_rc.o:      $(INCLDIR)/headers.h $(INCLDIR)/save_opts.h $(INCLDIR)/s_elm.h
  realfrom.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! qstrings.o:	$(INCLDIR)/defs.h $(INCLDIR)/elmlib.h
  remfirstwd.o:	$(INCLDIR)/headers.h
  reverse.o:	$(INCLDIR)/headers.h
! safemalloc.o:	$(INCLDIR)/defs.h $(INCLDIR)/elmlib.h
  shiftlower.o:	$(INCLDIR)/headers.h
+ strfcpy.o:      $(INCLDIR)/defs.h $(INCLDIR)/elmlib.h
+ strmcpy.o:      $(INCLDIR)/defs.h $(INCLDIR)/elmlib.h
  strincmp.o:	$(INCLDIR)/headers.h
  striparens.o:	$(INCLDIR)/headers.h
  strstr.o:	$(INCLDIR)/headers.h
  strtokq.o:	$(INCLDIR)/headers.h
  tail_of.o:	$(INCLDIR)/headers.h
! validname.o:	$(INCLDIR)/defs.h $(INCLDIR)/elmlib.h
  
  !NO!SUBS!
Index: elm2.4.ME+.50/lib/add_site.c
*** elm2.4.25/lib/add_site.c	Sun Oct  4 01:42:21 1992
--- elm2.4.ME+.50/lib/add_site.c	Tue Nov 17 21:12:56 1998
***************
*** 1,24 ****
  
! static char rcsid[] = "@(#)$Id: add_site.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: add_site.c,v $
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: add_site.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 26,33 ****
  
  #include "headers.h"
  
! add_site(buffer, site, lastsite)
! char *buffer, *site, *lastsite;
  {
  	/** add site to buffer, unless site is 'uucp' or site is
  	    the same as lastsite.   If not, set lastsite to site.
--- 18,26 ----
  
  #include "headers.h"
  
! int add_site(buffer, site, lastsite, size)
!      char *buffer, *site, *lastsite;
!      int  size;
  {
  	/** add site to buffer, unless site is 'uucp' or site is
  	    the same as lastsite.   If not, set lastsite to site.
***************
*** 41,51 ****
  	if (istrcmp(stripped, "uucp") != 0)
  	  if (strcmp(stripped, lastsite) != 0) {
  	    if (buffer[0] == '\0')
! 	      strcpy(buffer, stripped);         /* first in list! */
  	    else {
! 	      sprintf(local_buffer,"%s!%s", buffer, stripped);
! 	      strcpy(buffer, local_buffer);
  	    }
! 	    strcpy(lastsite, stripped); /* don't want THIS twice! */
  	  }
  }
--- 34,51 ----
  	if (istrcmp(stripped, "uucp") != 0)
  	  if (strcmp(stripped, lastsite) != 0) {
  	    if (buffer[0] == '\0')
! 	      strfcpy(buffer, stripped, size);         /* first in list! */
  	    else {
! 	      elm_sfprintf(local_buffer,sizeof local_buffer,
! 			   FRM("%.*s!%.*s"), 
! 			   sizeof local_buffer /2 -2, buffer, 
! 			   sizeof local_buffer /2 -2, stripped);
! 	      strfcpy(buffer, local_buffer, size);
  	    }
! 	    strfcpy(lastsite, stripped, size); /* don't want THIS twice! */
  	  }
+ 	return 0;
  }
+ 
+ 
+ 
Index: elm2.4.ME+.50/lib/addrmchusr.c
*** elm2.4.25/lib/addrmchusr.c	Sun Oct  4 01:42:21 1992
--- elm2.4.ME+.50/lib/addrmchusr.c	Tue Nov 17 21:12:55 1998
***************
*** 1,24 ****
  
! static char rcsid[] = "@(#)$Id: addrmchusr.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: addrmchusr.c,v $
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: addrmchusr.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 26,38 ****
  
  #include "headers.h"
  
! int
! addr_matches_user(addr,user)
! register char *addr, *user;
  {
  	int len = strlen(user);
! 	static char c_before[] = "!:%";	/* these can appear before a username */
! 	static char c_after[] = ":%@";	/* these can appear after a username  */
  
  	do {
  	  if ( strncmp(addr,user,len) == 0 ) {
--- 18,31 ----
  
  #include "headers.h"
  
! int addr_matches_user(addr,user)
!      char *addr, *user;
  {
  	int len = strlen(user);
! 	/* these can appear before a username */
! 	static char c_before[] = "!:%";	
! 	/* these can appear after a username  */
! 	static char c_after[] = ":%@";	
  
  	do {
  	  if ( strncmp(addr,user,len) == 0 ) {
Index: elm2.4.ME+.50/lib/aliasdb.c
*** elm2.4.25/lib/aliasdb.c	Mon Sep 20 02:41:00 1993
--- elm2.4.ME+.50/lib/aliasdb.c	Tue Nov 17 21:12:55 1998
***************
*** 1,63 ****
  
! static char rcsid[] = "@(#)$Id: aliasdb.c,v 5.8 1993/09/19 23:40:48 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: aliasdb.c,v $
!  * Revision 5.8  1993/09/19  23:40:48  syd
!  * Defince SEEK_SET in one of our headers as a last resort
!  * From: Syd
!  *
!  * Revision 5.7  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.6  1993/07/20  02:59:53  syd
!  * Support aliases both on 64 bit and 32 bit machines at the same time.
!  * From: Dan Mosedale <mosedale@genome.stanford.edu>
!  *
!  * Revision 5.5  1993/06/10  03:12:10  syd
!  * Add missing rcs id lines
!  * From: Syd
!  *
!  * Revision 5.4  1993/06/10  02:58:26  syd
!  * Correct problem in fetch_alias() with alias record fixup that caused
!  * core dump on machines with pointers larger than int.  This problem
!  * was reported on comp.mail.elm by Richard Eckman and Jim Brown.  Simplify
!  * get_one_alias() by having it use fetch_alias().
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.3  1993/04/21  01:40:12  syd
!  * add seekset define
!  *
!  * Revision 5.2  1993/04/12  01:53:38  syd
!  * Added fetch_alias() and next_addr_in_list() routines for use in
!  * new elmalias utility.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.1  1992/12/20  05:14:05  syd
!  * Initial checkin
!  *
!  *
!  ******************************************************************************/
  
  /** Alias interface with dbz routines.
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: aliasdb.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** Alias interface with dbz routines.
  
***************
*** 71,77 ****
  #include "headers.h"
  #include "ndbz.h"
  
! #ifdef BSD
  #  include <sys/file.h>
  #endif
  
--- 24,30 ----
  #include "headers.h"
  #include "ndbz.h"
  
! #ifdef BSD_TYPE
  #  include <sys/file.h>
  #endif
  
***************
*** 81,89 ****
  
  static of_t			/* transformed result */
  bytemap(ino, map1, map2)
! of_t ino;
! int *map1;
! int *map2;
  {
  	union oc {
  		of_t o;
--- 34,42 ----
  
  static of_t			/* transformed result */
  bytemap(ino, map1, map2)
!      of_t ino;
!      int *map1;
!      int *map2;
  {
  	union oc {
  		of_t o;
***************
*** 99,107 ****
  	return(out.o);
  }
  
! read_one_alias(db, adr)
! DBZ *db;
! struct alias_disk_rec *adr;
  {
  /*
   *	Read an alias (name, address, etc.) from the data file
--- 52,60 ----
  	return(out.o);
  }
  
! int read_one_alias(db, adr)
!      DBZ *db;
!      struct alias_disk_rec *adr;
  {
  /*
   *	Read an alias (name, address, etc.) from the data file
***************
*** 144,151 ****
   * reached, a NULL is returned.
   */
  struct alias_rec *fetch_alias(db, alias)
! DBZ *db;
! char *alias;
  {
  	datum key, val;
  	struct alias_disk_rec adrec;
--- 97,104 ----
   * reached, a NULL is returned.
   */
  struct alias_rec *fetch_alias(db, alias)
!      DBZ *db;
!      char *alias;
  {
  	datum key, val;
  	struct alias_disk_rec adrec;
***************
*** 245,251 ****
   * Return NULL when list finished.  This routine scribbles on the list.
   */
  char *next_addr_in_list(aptr)
! char **aptr;
  {
  	register char *front, *back;
  
--- 198,204 ----
   * Return NULL when list finished.  This routine scribbles on the list.
   */
  char *next_addr_in_list(aptr)
!      char **aptr;
  {
  	register char *front, *back;
  
Index: elm2.4.ME+.50/lib/atonum.c
*** elm2.4.25/lib/atonum.c	Tue Aug  3 22:28:47 1993
--- elm2.4.ME+.50/lib/atonum.c	Tue Nov 17 21:12:56 1998
***************
*** 1,37 ****
  
! static char rcsid[] = "@(#)$Id: atonum.c,v 5.2 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
   *
!  * 			Copyright (c) 1993 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: atonum.c,v $
!  * Revision 5.2  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
   *
!  * Revision 5.1  1993/01/19  04:46:21  syd
!  * Initial Checkin
!  *
!  *
!  ******************************************************************************/
  
  #include "defs.h"
  
  /*
   * This is similar to atoi(), but it complains if the string
--- 1,18 ----
  
! static char rcsid[] = "@(#)$Id: atonum.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  * 			Copyright (c) 1993 USENET Community Trust
!  *****************************************************************************/
  
  #include "defs.h"
+ #include "elmlib.h"
  
  /*
   * This is similar to atoi(), but it complains if the string
***************
*** 39,45 ****
   * value on success, -1 on error.
   */
  int atonum(str)
! register char *str;
  {
      register int value;
  
--- 20,26 ----
   * value on success, -1 on error.
   */
  int atonum(str)
!      char *str;
  {
      register int value;
  
Index: elm2.4.ME+.50/lib/can_access.c
*** elm2.4.25/lib/can_access.c	Mon Aug 23 05:46:07 1993
--- elm2.4.ME+.50/lib/can_access.c	Tue Nov 17 21:12:55 1998
***************
*** 1,75 ****
  
! static char rcsid[] = "@(#)$Id: can_access.c,v 5.8 1993/08/23 02:46:07 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: can_access.c,v $
!  * Revision 5.8  1993/08/23  02:46:07  syd
!  * Don't declare _exit() if <unistd.h> already did it.
!  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
!  *
!  * Revision 5.7  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.6  1993/05/14  03:52:10  syd
!  * When compiled on a POSIX host PL22 failed checking whether the file is
!  * readable and a regular file or not. There was one `!' missing in the
!  * `if (S_ISREG(mode))' test which should read `if (! S_ISREG(mode))'.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.5  1993/05/08  19:16:41  syd
!  * Remove symlink code from can_access, we dont care if its a symlink
!  * only if we can access the file pointed to by the symlink anyway and
!  * stat resolves to that file.
!  *
!  * Revision 5.4  1993/04/12  04:08:36  syd
!  * Fix if alignment
!  *
!  * Revision 5.3  1993/04/12  03:33:39  syd
!  * the posix macros to interpret the result of the stat-call.
!  * From: vogt@isa.de (Gerald Vogt)
!  *
!  * Revision 5.2  1992/12/12  01:29:26  syd
!  * Fix double inclusion of sys/types.h
!  * From: Tom Moore <tmoore@wnas.DaytonOH.NCR.COM>
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** can_access - can this user access this file using their normal uid/gid
  
  **/
  
  #include "headers.h"
  #include <sys/stat.h>
  #include <errno.h>
  
- #ifdef BSD
- # include <sys/wait.h>
- #endif
- 
  #ifndef I_UNISTD
  void _exit();
  #endif
--- 1,32 ----
  
! static char rcsid[] = "@(#)$Id: can_access.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** can_access - can this user access this file using their normal uid/gid
  
  **/
  
+ /* WHAT HELL THIS IS!
+  *
+  * access -system call uses real uid / gid anyway !!!!!
+  *
+  *                              - K E H <hurtta@ozone.FMI.FI>
+  */
+ 
  #include "headers.h"
  #include <sys/stat.h>
  #include <errno.h>
  
  #ifndef I_UNISTD
  void _exit();
  #endif
***************
*** 76,96 ****
  
  extern int errno;		/* system error number */
  
! int
! can_access(file, mode)
! char *file; 
! int   mode;
  {
  	/** returns ZERO iff user can access file or "errno" otherwise **/
  
  	int the_stat = 0, pid, w; 
  	struct stat stat_buf;
! #if defined(BSD) && !defined(WEXITSTATUS)
  	union wait status;
  #else
  	int status;
  #endif
- 	register SIGHAND_TYPE (*istat)(), (*qstat)();
  	
  #ifdef VFORK
  	if ((pid = vfork()) == 0) {
--- 33,51 ----
  
  extern int errno;		/* system error number */
  
! int can_access(file, mode)
!      char *file; 
!      int   mode;
  {
  	/** returns ZERO iff user can access file or "errno" otherwise **/
  
  	int the_stat = 0, pid, w; 
  	struct stat stat_buf;
! #if defined(BSD_TYPE) && !defined(WEXITSTATUS)
  	union wait status;
  #else
  	int status;
  #endif
  	
  #ifdef VFORK
  	if ((pid = vfork()) == 0) {
***************
*** 109,133 ****
  	  _exit(127);
  	}
  
! 	istat = signal(SIGINT, SIG_IGN);
! 	qstat = signal(SIGQUIT, SIG_IGN);
  
- 	while ((w = wait(&status)) != pid && w != -1)
- 		;
  
! #if	defined(WEXITSTATUS)
! 	/* Use POSIX macro if defined */
! 	the_stat = WEXITSTATUS(status);
! #else
! #ifdef BSD
! 	the_stat = status.w_retcode;
! #else
! 	the_stat = status >> 8;
! #endif
! #endif	/*WEXITSTATUS*/
  
- 	signal(SIGINT, istat);
- 	signal(SIGQUIT, qstat);
  	if (the_stat == 0) {
  	  if (stat(file, &stat_buf) == 0) {
  #ifndef _POSIX_SOURCE
--- 64,85 ----
  	  _exit(127);
  	}
  
! 	errno = 0;
! 	while ((w = my_wait(pid,&status)) != pid && w != -1 || 
! 	       EINTR == errno)
! 	  ;
  
  
! 	if (w == -1) {
! 	  the_stat = errno;
! 	  if (!the_stat)
! 	    the_stat = 1;
! 	} else {
! 	  int sig = convert_status(status,&the_stat);
! 	  if (sig)
! 	    the_stat = 1;
! 	}
  
  	if (the_stat == 0) {
  	  if (stat(file, &stat_buf) == 0) {
  #ifndef _POSIX_SOURCE
***************
*** 145,147 ****
--- 97,101 ----
  
  	return(the_stat);
  }
+ 
+ 
Index: elm2.4.ME+.50/lib/can_open.c
*** elm2.4.25/lib/can_open.c	Mon Aug 23 05:46:08 1993
--- elm2.4.ME+.50/lib/can_open.c	Tue Nov 17 21:12:56 1998
***************
*** 1,44 ****
  
! static char rcsid[] = "@(#)$Id: can_open.c,v 5.4 1993/08/23 02:46:07 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: can_open.c,v $
!  * Revision 5.4  1993/08/23  02:46:07  syd
!  * Don't declare _exit() if <unistd.h> already did it.
!  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
!  *
!  * Revision 5.3  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.2  1992/12/12  01:29:26  syd
!  * Fix double inclusion of sys/types.h
!  * From: Tom Moore <tmoore@wnas.DaytonOH.NCR.COM>
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** can_open - can this user open this file using their normal uid/gid
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: can_open.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** can_open - can this user open this file using their normal uid/gid
  
***************
*** 48,57 ****
  #include <sys/stat.h>
  #include <errno.h>
  
- #ifdef BSD
- # include <sys/wait.h>
- #endif
- 
  #ifndef I_UNISTD
  void _exit();
  #endif
--- 20,25 ----
***************
*** 58,66 ****
  
  extern int errno;		/* system error number */
  
! int
! can_open(file, mode)
! char *file, *mode;
  {
  	/** Returns 0 iff user can open the file.  This is not
  	    the same as can_access - it's used for when the file might
--- 26,33 ----
  
  extern int errno;		/* system error number */
  
! int can_open(file, mode)
!      char *file, *mode;
  {
  	/** Returns 0 iff user can open the file.  This is not
  	    the same as can_access - it's used for when the file might
***************
*** 67,79 ****
  	    not exist... **/
  
  	FILE *fd;
! 	int the_stat = 0, pid, w, preexisted = 0; 
! #if defined(BSD) && !defined(WEXITSTATUS)
! 	union wait status;
! #else
! 	int status;
! #endif
! 	register SIGHAND_TYPE (*istat)(), (*qstat)();
  	
  #ifdef VFORK
  	if ((pid = vfork()) == 0) {
--- 34,41 ----
  	    not exist... **/
  
  	FILE *fd;
! 	int the_stat = 0, pid, w, preexisted = 0,sig;
! 	S__ status;
  	
  #ifdef VFORK
  	if ((pid = vfork()) == 0) {
***************
*** 83,88 ****
--- 45,61 ----
  	  setgid(groupid);
  	  setuid(userid);		/** back to normal userid **/
  	  errno = 0;
+ 	  if (mode[0] == 's' && mode[1] == 'w' && ! mode[2]) {
+ 	      int filedes = open(file, O_WRONLY | O_CREAT | O_EXCL, 0600);
+ 	      if (filedes < 0 &&
+ 		  (unlink(file) ||
+ 		   (filedes = open(file, O_WRONLY|O_CREAT|O_EXCL, 0600)) < 0))
+ 		  _exit(errno);
+ 	      else {
+ 		  close(filedes);
+ 		  _exit(0);
+ 	      }
+ 	  }
  	  if (access(file, ACCESS_EXISTS) == 0)
  	    preexisted = 1;
  	  if ((fd = fopen(file, mode)) == NULL)
***************
*** 96,119 ****
  	  _exit(127);
  	}
  
! 	istat = signal(SIGINT, SIG_IGN);
! 	qstat = signal(SIGQUIT, SIG_IGN);
! 
! 	while ((w = wait(&status)) != pid && w != -1)
! 		;
! 
! #ifdef WEXITSTATUS
! 	the_stat = WEXITSTATUS(status);
! #else
! #ifdef BSD
! 	the_stat = status.w_retcode;
! #else
! 	the_stat = status >> 8;
! #endif
! #endif /*WEXITSTATUS*/
! 	
! 	signal(SIGINT, istat);
! 	signal(SIGQUIT, qstat);
! 
  	return(the_stat);
  }
--- 69,82 ----
  	  _exit(127);
  	}
  
! 	errno = 0;
! 	while ((w = my_wait(pid,&status)) != pid && w != -1 ||
! 	       EINTR == errno)
! 	  ;
! 
! 	sig = convert_status(status,&the_stat);
! 	if (sig)
! 	  the_stat = 1;
! 	dprint(1,(debugfile,"can_open(%s,%s) = %d\n",file,mode,the_stat));
  	return(the_stat);
  }
Index: elm2.4.ME+.50/lib/chloc.c
*** elm2.4.25/lib/chloc.c	Sun Oct  4 01:42:22 1992
--- elm2.4.ME+.50/lib/chloc.c	Tue Nov 17 21:12:56 1998
***************
*** 1,24 ****
  
! static char rcsid[] = "@(#)$Id: chloc.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: chloc.c,v $
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: chloc.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 26,38 ****
  
  #include "headers.h"
  
! int
! chloc(string, ch)
! char *string;
! register char ch;
  {
  	/** returns the index of ch in string, or -1 if not in string **/
! 	register char *s;
  
  	for (s = string; *s; s++)
  		if (*s == ch)
--- 18,38 ----
  
  #include "headers.h"
  
! /* Is this really needed? This does same than strchr or index, except
!  *  that return type is different.
!  *
!  *                          - K E H <hurtta@ozone.FMI.FI>
!  */
! 
! /* Argument (second) can't be char because there is both prototype and
!  * non-prototype declaration.
!  */
! int chloc(string, ch)
!      char *string;
!      int ch;
  {
  	/** returns the index of ch in string, or -1 if not in string **/
! 	char *s;
  
  	for (s = string; *s; s++)
  		if (*s == ch)
***************
*** 40,49 ****
  	return(-1);
  }
  
! int
! qchloc(string, ch)
! char *string;
! register char ch;
  {
  	/* returns the index of ch in string, or -1 if not in string
           * skips over quoted portions of the string
--- 40,48 ----
  	return(-1);
  }
  
! int qchloc(string, ch)
!      char *string;
!      int ch;
  {
  	/* returns the index of ch in string, or -1 if not in string
           * skips over quoted portions of the string
Index: elm2.4.ME+.50/lib/date_util.c
*** elm2.4.25/lib/date_util.c	Tue Aug  3 22:28:48 1993
--- elm2.4.ME+.50/lib/date_util.c	Tue Nov 17 21:12:56 1998
***************
*** 1,42 ****
  
! static char rcsid[] = "@(#)$Id: date_util.c,v 5.3 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
   *
!  * 			Copyright (c) 1993 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: date_util.c,v $
!  * Revision 5.3  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.2  1993/01/27  20:54:24  syd
!  * There is a small bug in this routine in Chip's PL21 patch.  The code
!  * calls atonum to convert the 4 digit timezone field.  However this field
!  * is actually of the form HHMM, not a decimal number, so for example
!  * -0500 was being converted to -500 rather than the correct -300.
!  * From: Larry Philps <larryp@sco.COM>
   *
!  * Revision 5.1  1993/01/19  04:46:21  syd
!  * Initial Checkin
!  *
!  *
!  ******************************************************************************/
  
  #include "headers.h"
  
--- 1,15 ----
  
! static char rcsid[] = "@(#)$Id: date_util.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  * 			Copyright (c) 1993 USENET Community Trust
!  *****************************************************************************/
  
  #include "headers.h"
  
***************
*** 130,137 ****
  
  
  int cvt_dayname_to_daynum(str, day_p)
! char *str;
! int *day_p;
  {
      /*
       * Convert a day name to number (Sun = 1).  Only the first three
--- 103,110 ----
  
  
  int cvt_dayname_to_daynum(str, day_p)
!      char *str;
!      int *day_p;
  {
      /*
       * Convert a day name to number (Sun = 1).  Only the first three
***************
*** 153,163 ****
      return FALSE;
  }
  
- 
- 
  int cvt_monthname_to_monthnum(str, month_p)
! char *str;
! int *month_p;
  {
      /*
       * Convert a month name to number (Jan = 1).  Only the first three
--- 126,134 ----
      return FALSE;
  }
  
  int cvt_monthname_to_monthnum(str, month_p)
!      char *str;
!      int *month_p;
  {
      /*
       * Convert a month name to number (Jan = 1).  Only the first three
***************
*** 179,188 ****
      return FALSE;
  }
  
- 
  int cvt_yearstr_to_yearnum(str, year_p)
! char *str;
! int *year_p;
  {
      /*
       * Convert a year from a string to a number.  We will add the century
--- 150,158 ----
      return FALSE;
  }
  
  int cvt_yearstr_to_yearnum(str, year_p)
!      char *str;
!      int *year_p;
  {
      /*
       * Convert a year from a string to a number.  We will add the century
***************
*** 211,223 ****
      return FALSE;
  }
  
- 
  int cvt_mmddyy_to_dayofyear(month, dayofmon, year, dayofyear_p)
! int month, dayofmon, year, *dayofyear_p;
  {
      /*
!      * Convert numeric month, day of month, and year to day of year
!      * (Jan 1 = 0).  Always returns TRUE.
       */
  
      int dayofyear, i;
--- 181,192 ----
      return FALSE;
  }
  
  int cvt_mmddyy_to_dayofyear(month, dayofmon, year, dayofyear_p)
!      int month, dayofmon, year, *dayofyear_p;
  {
      /*
!      * Convert numeric month (1-12), day of month (1-31), and year (with
!      * century) to day of year (Jan 1 = 0).  Always returns TRUE.
       */
  
      int dayofyear, i;
***************
*** 229,238 ****
      return TRUE;
  }
  
! 
! int cvt_timezone_to_offset(str, mins_p)
! char *str;
! int *mins_p;
  {
      /*
       * Convert a timezone to a number of minutes *east* of gmt.  The
--- 198,207 ----
      return TRUE;
  }
  
! int cvt_timezone_to_offset(str, mins_p, size)
!      char *str;
!      int *mins_p;
!      int size;
  {
      /*
       * Convert a timezone to a number of minutes *east* of gmt.  The
***************
*** 252,258 ****
      if ((*str == '+' || *str == '-') && (tz = cvt_numtz_to_mins(str+1)) >= 0) {
  	switch (strlen(str)) {
  	case 3:					/* +NN		*/
! 	    (void) strcat(str, "00");		/*  make +NN00	*/
  	    tz *= 60;
  	    break;
  	case 5:					/* +NNNN	*/
--- 221,227 ----
      if ((*str == '+' || *str == '-') && (tz = cvt_numtz_to_mins(str+1)) >= 0) {
  	switch (strlen(str)) {
  	case 3:					/* +NN		*/
! 	    (void) strfcat(str, "00", size);		/*  make +NN00	*/
  	    tz *= 60;
  	    break;
  	case 5:					/* +NNNN	*/
***************
*** 271,276 ****
--- 240,246 ----
      if (*str == '-') {
  	tz = -1;
  	++str;
+ 	size--;
      } else {
  	tz = 1;
      }
***************
*** 294,302 ****
      return FALSE;
  }
  
- 
  int cvt_numtz_to_mins(str)
! char *str;
  {
      /*
       * Convert an HHMM string to minutes.  Check to make sure that the
--- 264,271 ----
      return FALSE;
  }
  
  int cvt_numtz_to_mins(str)
!      char *str;
  {
      /*
       * Convert an HHMM string to minutes.  Check to make sure that the
***************
*** 336,345 ****
      return -1;
  }
  
- 
  int cvt_timestr_to_hhmmss(str, hours_p, mins_p, secs_p)
! char *str;
! int *hours_p, *mins_p, *secs_p;
  {
      /*
       * Convert a HH:MM[:SS] time specification to hours, minutes, seconds.
--- 305,313 ----
      return -1;
  }
  
  int cvt_timestr_to_hhmmss(str, hours_p, mins_p, secs_p)
!      char *str;
!      int *hours_p, *mins_p, *secs_p;
  {
      /*
       * Convert a HH:MM[:SS] time specification to hours, minutes, seconds.
***************
*** 406,417 ****
      return FALSE;
  }
  
- 
  long make_gmttime(year, month, day, hours, mins, secs)
! int year, month, day, hours, mins, secs;
  {
      /*
!      * Convert date specification to seconds since epoch (1 Jan 1970 00:00).
       */
  
      long days_since_epoch, secs_since_midnight;
--- 374,385 ----
      return FALSE;
  }
  
  long make_gmttime(year, month, day, hours, mins, secs)
!      int year, month, day, hours, mins, secs;
  {
      /*
!      * Convert date specification (year with century, month 1-12, day 1-31,
!      * and HH:MM:SS) to seconds since epoch (1 Jan 1970 00:00).
       */
  
      long days_since_epoch, secs_since_midnight;
***************
*** 438,512 ****
       */
      return days_since_epoch*(24*60*60) + secs_since_midnight;
  }
- 
- 
- #ifdef _TEST /*{*/
- 
- int getitem(prompt, item)
- char *prompt, *item;
- {
- 	char buf[1024];
- 	printf("%s [%s] > ", prompt, item);
- 	fflush(stdout);
- 	if (gets(buf) == NULL)
- 		return -1;
- 	if (buf[0] != '\0')
- 		(void) strcpy(item, buf);
- 	return 0;
- }
- 
- main()
- {
- 	char dowstr[256], domstr[256], monstr[256], yrstr[256],
- 		tzstr[256], timestr[256];
- 	int dow, dom, mon, yr, tzmins, dayofyr, hrs, mins, secs;
- 	long gmttime;
- 	extern char *ctime();
- 
- 	(void) strcpy(dowstr, "Monday");
- 	(void) strcpy(domstr, "1");
- 	(void) strcpy(monstr, "January");
- 	(void) strcpy(yrstr, "1980");
- 	(void) strcpy(tzstr, "GMT");
- 	(void) strcpy(timestr, "00:00:00");
- 
- 	for (;;) {
- 		if (getitem("day of week", dowstr) != 0)
- 			break;
- 		if (getitem("month", monstr) != 0)
- 			break;
- 		if (getitem("day", domstr) != 0)
- 			break;
- 		if (getitem("year", yrstr) != 0)
- 			break;
- 		if (getitem("timezone", tzstr) != 0)
- 			break;
- 		if (getitem("time", timestr) != 0)
- 			break;
- 		if (!cvt_dayname_to_daynum(dowstr, &dow))
- 			fputs("cvt_dayname_to_daynum failed\n", stderr);
- 		if (!cvt_monthname_to_monthnum(monstr, &mon))
- 			fputs("cvt_monthname_to_monthnum failed\n", stderr);
- 		dom = atoi(domstr);
- 		if (!cvt_yearstr_to_yearnum(yrstr, &yr))
- 			fputs("cvt_yearstr_to_yearnum failed\n", stderr);
- 		if (!cvt_timezone_to_offset(tzstr, &tzmins))
- 			fputs("cvt_timezone_to_offset failed\n", stderr);
- 		if (!cvt_mmddyy_to_dayofyear(mon, dom, yr, &dayofyr))
- 			fputs("cvt_mmddyy_to_dayofyear failed\n", stderr);
- 		if (!cvt_timestr_to_hhmmss(timestr, &hrs, &mins, &secs))
- 			fputs("cvt_timestr_to_hhmmss failed\n", stderr);
- 		gmttime = make_gmttime(yr, mon, dom, hrs, mins+tzmins, secs);
- 		printf("date=%04d/%02d/%02d  time=%02d:%02d:%02d  tzmins=%d\n",
- 			yr, mon, dom, hrs, mins, secs, tzmins);
- 		printf("day-of-week=%d day-of-year=%d gmttime=%ld gmtdate=%s",
- 			dow, dayofyr, gmttime, ctime(&gmttime));
- 		putchar('\n');
- 	}
- 
- 	putchar('\n');
- 	exit(0);
- }
- 
- #endif /*}_TEST*/
  
--- 406,409 ----
Index: elm2.4.ME+.50/lib/dispaddr.c
*** /tmp/8255-very-long-file-name-NULL-comes-in-here	Sun Nov 22 09:14:43 1998
--- elm2.4.ME+.50/lib/dispaddr.c	Tue Nov 17 21:14:08 1998
***************
*** 0 ****
--- 1,107 ----
+ static char rcsid[] = "@(#)$Id: dispaddr.c,v 1.3 1998/11/16 17:08:30 hurtta Exp $";
+ 
+ /******************************************************************************
+  *  The Elm (ME+) Mail System  -  $Revision: 1.3 $   $State: Exp $
+  *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  *
+  *  Initially written by: Michael Elkins <elkins@aero.org>, 1995
+  *****************************************************************************/
+ 
+ #include "headers.h"
+ #include "me.h"
+ 
+ static void addr_to_str P_((char *f, int size, struct addr_item *addr));
+ static void addr_to_str(f,size,addr)
+      char *f; 
+      int size; 
+      struct addr_item *addr;
+ {
+   struct addr_item *ptr;
+ 
+   f[0] = '\0';
+   for (ptr=addr; ptr && ptr->addr; ptr++) {
+     char * t = ptr->fullname;
+     if (!t[0])
+       t = ptr->addr;
+     if (ptr == addr)
+       strfcpy(f, t, size);
+     else {
+       strfcat(f, ", ", size);
+       strfcat(f, t, size);
+     }
+   }
+ }
+ 
+ int
+ DisplayAddress (h, f, size, decoder)
+      struct header_rec *h;
+      char *f;
+      int size;
+      decode_who decoder;
+ {
+   int i = 0, using_to = 0;
+   struct addr_item *p,*ptr;
+   int okay_to = 1, okay_cc = 1;
+   
+   f[0] = '\0';
+   
+   if (!h->to ||
+       !h->to->addr ||
+       !h->to->fullname) {
+     /* No To: address, must select From: address anyway.... */
+     goto was_from;
+   }
+ 
+   for (p = h->from; p && p->addr && p->fullname; p++)
+     if (addr_matches_user (p->addr, username) ||
+ 	0 == strincmp(p->fullname, full_username,STRING))
+       break;
+ 
+   for (ptr = h->to; ptr && ptr->addr && ptr->fullname; ptr++)
+     if (!okay_address(ptr->addr, h->env_from))
+       okay_to = 0;
+ 
+   for (ptr = h->cc; ptr && ptr->addr && ptr->fullname; ptr++)
+     if (!okay_address(ptr->addr, h->env_from))
+       okay_cc = 0;
+ 
+ 
+   if (p && p->addr && p->fullname ||
+       addr_matches_user (h->env_from, username)) {
+     /* I sent this message.  Use the TO address.  
+      * (perhaps I have also receiver... hmm.)
+      */
+     f[0] = '\0';
+     addr_to_str(f,size,h->to);
+     if (f[0])
+       using_to = TRUE;
+   }
+   else if (okay_to && okay_cc) {
+ 
+     /* This message is not addressed to me. */
+ 
+     if (showto) {
+       f[0] = '\0';
+       addr_to_str(f,size,h->to);
+       if (f[0])
+ 	using_to = TRUE;
+       else
+ 	goto was_from;
+     } else 
+       goto was_from;
+       
+   }
+   else { /* This message is addressed to me (or sender of mail). */
+   was_from:
+     addr_to_str(f,size,h->from);
+     if (f[0] == '\0')
+       strfcpy (f, h->env_from, size);
+     if (f[0] == '\0' || 0 == strcmp(f,"<>"))
+       strfcpy (f, "Mailer Daemon", size);
+   }
+ 
+   return(using_to);
+ }
+ 
+ 
Index: elm2.4.ME+.50/lib/dynarray.c
*** /tmp/8255-very-long-file-name-NULL-comes-in-here	Sun Nov 22 09:14:43 1998
--- elm2.4.ME+.50/lib/dynarray.c	Tue Nov 17 21:12:55 1998
***************
*** 0 ****
--- 1,52 ----
+ /* $Id: dynarray.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $
+  *
+  * Initially written by: Michael Elkins <elkins@aero.org>, 1995/06/01
+  */
+ 
+ /** routines for handling of dynamic arrays **/
+ 
+ char **
+ DynamicArray (p, record_size, max, n)
+ char **p;
+ int record_size;
+ int *max;
+ int n;
+ {
+ 	int newmax, j;
+ 	char **c;
+ 
+ 	newmax = *max + n;
+ 
+ 	if (!p)
+ 		c = (char**)safe_malloc(record_size * (n+1));
+ 	else
+ 		c = (char**)safe_realloc(p, record_size * (newmax+1));
+ 
+ 	if (!c)
+ 		return(0);
+ 
+ 	/* We reserver in above (newmax+1) elements --
+ 	 * element c[newmax] must be always NULL so DestroyDynamicArray
+ 	 * works.
+ 	 */
+ 	for (j = *max ; j <= newmax ; j++)
+ 		c[j] = 0;
+ 
+ 	*max = newmax;
+ 
+ 	return(c);
+ }
+ 
+ void
+ DestroyDynamicArray (p)
+ char **p;
+ {
+ 	char **b;
+ 
+ 	if (!p)
+ 		return;
+ 	b = p;
+ 	while (*b)
+ 		free(*b++);
+ 	free(p);
+ }
Index: elm2.4.ME+.50/lib/errno.c
*** elm2.4.25/lib/errno.c	Thu Sep  1 22:42:07 1994
--- elm2.4.ME+.50/lib/errno.c	Tue Nov 17 21:12:55 1998
***************
*** 1,36 ****
  
! static char rcsid[] = "@(#)$Id: errno.c,v 5.4 1994/09/01 19:42:07 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: errno.c,v $
!  * Revision 5.4  1994/09/01  19:42:07  syd
!  * Add extern declaration of strerror to avoid compiler warning.
!  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
!  *
!  * Revision 5.3  1993/04/21  01:58:20  syd
!  * change to detect strerror routine
!  * From: Syd
!  *
!  * Revision 5.2  1993/04/21  01:25:11  syd
!  * Use strerror() with ANSI compilers.
!  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** This routine maps error numbers to error names and error messages.
      These are all directly ripped out of the include file errno.h, and
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: errno.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** This routine maps error numbers to error names and error messages.
      These are all directly ripped out of the include file errno.h, and
***************
*** 42,47 ****
--- 22,28 ----
  **/
  
  #include "headers.h"
+ #include "me.h"
  
  #ifndef STRERROR
  #ifdef ERRLST
***************
*** 92,98 ****
  #endif /* STRERROR */
  
  char *error_description(errnumber)
! int errnumber;
  {
  #ifdef STRERROR
  
--- 73,79 ----
  #endif /* STRERROR */
  
  char *error_description(errnumber)
!      int errnumber;
  {
  #ifdef STRERROR
  
***************
*** 105,111 ****
  	static char buffer[50];
  
  	if (errnumber < 0 || errnumber >= sys_nerr)  {
! 	  sprintf(buffer,"ERR-UNKNOWN (%d)", errnumber);
  	  return(buffer);
  	}
  
--- 86,93 ----
  	static char buffer[50];
  
  	if (errnumber < 0 || errnumber >= sys_nerr)  {
! 	  elm_sfprintf(buffer,sizeof buffer,
! 		       FRM("ERR-UNKNOWN (%d)"), errnumber);
  	  return(buffer);
  	}
  
Index: elm2.4.ME+.50/lib/expand.c
*** elm2.4.25/lib/expand.c	Mon Sep 20 02:38:55 1993
--- elm2.4.ME+.50/lib/expand.c	Tue Nov 17 21:12:55 1998
***************
*** 1,38 ****
  
! static char rcsid[] = "@(#)$Id: expand.c,v 5.4 1993/09/19 23:38:55 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: expand.c,v $
!  * Revision 5.4  1993/09/19  23:38:55  syd
!  * expand() didn't read the global rc file if the user elmrc didn't exist or
!  * didn't have an entry for maildir.
!  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
!  *
!  * Revision 5.3  1992/12/11  01:45:04  syd
!  * remove sys/types.h include, it is now included by defs.h
!  * and this routine includes defs.h or indirectly includes defs.h
!  * From: Syd
!  *
!  * Revision 5.2  1992/12/07  04:48:15  syd
!  * add include of types.h to get time_t define
!  * From: Syd
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** This is a library routine for the various utilities that allows
      users to have the standard 'Elm' folder directory nomenclature
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: expand.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** This is a library routine for the various utilities that allows
      users to have the standard 'Elm' folder directory nomenclature
***************
*** 44,182 ****
  #include <stdio.h>
  #include "defs.h"
  #include "s_elmrc.h"
  
  extern nl_catd elm_msg_cat;	/* message catalog	    */
  
! char *expand_define();
! 
! static char*
! expand_maildir(rcfile, filename, buffer)
! FILE *rcfile;
! char *filename;
! char *buffer;
  {
! 	char *home = NULL, *bufptr;
! 	int  foundit = 0;
  
! 	bufptr = (char *) buffer;		/* same address */
! 	
! 	while (! foundit && mail_gets(buffer, SLEN, rcfile) != 0) {
! 	  if (strncmp(buffer, "maildir", 7) == 0 ||
! 	      strncmp(buffer, "folders", 7) == 0) {
! 	    while (*bufptr != '=' && *bufptr) 
! 	      bufptr++;
! 	    bufptr++;			/* skip the equals sign */
! 	    while (whitespace(*bufptr) && *bufptr)
! 	      bufptr++; 
! 	    home = bufptr;		/* remember this address */
! 
! 	    while (! whitespace(*bufptr) && *bufptr != '\n')
! 	      bufptr++;
! 
! 	    *bufptr = '\0';		/* remove trailing space */
! 	    foundit++;
! 	  }
! 	}
! 
! 	return home;
! }
! 
! int
! expand(filename)
! char *filename;
! {
! 	/** Expand the filename since the first character is a meta-
! 	    character that should expand to the "maildir" variable
! 	    in the users ".elmrc" file or in the global rc file...
! 
! 	    Note: this is a brute force way of getting the entry out 
! 	    of the .elmrc file, and isn't recommended for the faint 
! 	    of heart!
! 	**/
! 
! 	FILE *rcfile;
! 	char  buffer[SLEN], *home, *expanded_dir;
! 
! 	if ((home = getenv("HOME")) == NULL) {
! 	  printf(catgets(elm_msg_cat, ElmrcSet, ElmrcExpandHome,
! 	     "Can't expand environment variable $HOME to find .elmrc file!\n"));
! 	  return(NO);
! 	}
! 
! 	sprintf(buffer, "%s/%s", home, elmrcfile);
! 
! 	home = NULL;
! 	if ((rcfile = fopen(buffer, "r")) != NULL) {
! 	  home = expand_maildir(rcfile, filename, buffer);
! 	  fclose(rcfile);
! 	}
! 
! 	if (home == NULL) { /* elmrc didn't exist or maildir wasn't in it */
! 	  if ((rcfile = fopen(system_rc_file, "r")) != NULL) {
! 	    home = expand_maildir(rcfile, filename, buffer);
! 	    fclose(rcfile);
! 	  }
! 	}
! 
! 	if (home == NULL) {
! 	  /* Didn't find it, use default */
! 	  sprintf(buffer, "~/%s", default_folders);
! 	  home = buffer;
! 	}
! 
! 	/** Home now points to the string containing your maildir, with
! 	    no leading or trailing white space...
! 	**/
! 
! 	if ((expanded_dir = expand_define(home)) == NULL)
! 		return(NO);
! 
! 	sprintf(buffer, "%s%s%s", expanded_dir, 
! 		(expanded_dir[strlen(expanded_dir)-1] == '/' ||
! 		filename[0] == '/') ? "" : "/", (char *) filename+1);
! 
! 	strcpy(filename, buffer);
! 	return(YES);
  }
  
- char *expand_define(maildir)
- char *maildir;
- {
- 	/** This routine expands any occurances of "~" or "$var" in
- 	    the users definition of their maildir directory out of
- 	    their .elmrc file.
- 
- 	    Again, another routine not for the weak of heart or staunch
- 	    of will!
- 	**/
- 
- 	static char buffer[SLEN];	/* static buffer AIEE!! */
- 	char   name[SLEN],		/* dynamic buffer!! (?) */
- 	       *nameptr,	       /*  pointer to name??     */
- 	       *value;		      /* char pointer for munging */
- 
- 	if (*maildir == '~') 
- 	  sprintf(buffer, "%s%s", getenv("HOME"), ++maildir);
- 	else if (*maildir == '$') { 	/* shell variable */
- 
- 	  /** break it into a single word - the variable name **/
- 
- 	  strcpy(name, (char *) maildir + 1);	/* hurl the '$' */
- 	  nameptr = (char *) name;
- 	  while (*nameptr != '/' && *nameptr) nameptr++;
- 	  *nameptr = '\0';	/* null terminate */
- 	  
- 	  /** got word "name" for expansion **/
- 
- 	  if ((value = getenv(name)) == NULL) {
- 	    printf(catgets(elm_msg_cat, ElmrcSet, ElmrcExpandShell,
- 		    "Couldn't expand shell variable $%s in .elmrc!\n"),
- 		    name);
- 	    return(NULL);
- 	  }
- 	  sprintf(buffer, "%s%s", value, maildir + strlen(name) + 1);
- 	}
- 	else strcpy(buffer, maildir);
- 
- 	return( ( char *) buffer);
- }
--- 22,45 ----
  #include <stdio.h>
  #include "defs.h"
  #include "s_elmrc.h"
+ #include "elmlib.h"
  
  extern nl_catd elm_msg_cat;	/* message catalog	    */
  
! int expand(filename, size)
!      char *filename;
!      int size;
  {
!   char  buffer[SLEN];
  
!   strfcpy(buffer,folders, sizeof buffer);
!   if (folders[0] && folders[strlen(folders)-1] != '/' &&
!       filename[0] != '/')
!     strfcat(buffer, "/", sizeof buffer);
!   
!   strfcat(buffer,filename+1, sizeof buffer);
!   
!   strfcpy(filename, buffer, size);
!   return(YES);
  }
  
Index: elm2.4.ME+.50/lib/figadrssee.c
*** elm2.4.25/lib/figadrssee.c	Sat Jun 12 08:33:39 1993
--- elm2.4.ME+.50/lib/figadrssee.c	Tue Nov 17 21:12:56 1998
***************
*** 1,33 ****
  
! static char rcsid[] = "@(#)$Id: figadrssee.c,v 5.3 1993/06/12 05:33:32 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: figadrssee.c,v $
!  * Revision 5.3  1993/06/12  05:33:32  syd
!  * Remove useless auto
!  * From: Syd
!  *
!  * Revision 5.2  1993/02/03  16:25:45  syd
!  * Adresses with double quoted strings that contains comma was parsed
!  * wrongly by break_down_tolist() and figure_out_addressee().
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: figadrssee.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 35,43 ****
  
  #include "headers.h"
  
! figure_out_addressee(buffer, mail_to)
! char *buffer;
! char *mail_to;
  {
  	/** This routine steps through all the addresses in the "To:"
  	    list, initially setting it to the first entry (if mail_to
--- 18,27 ----
  
  #include "headers.h"
  
! void figure_out_addressee(buffer, mail_to, size)
!      char *buffer;
!      char *mail_to;
!      int size;
  {
  	/** This routine steps through all the addresses in the "To:"
  	    list, initially setting it to the first entry (if mail_to
***************
*** 55,76 ****
  	while ((address = strtokq(bufptr, ",\t\n\r", 1)) != NULL) {
  
  	  if (! okay_address(address, "don't match me!")) {
! 	    strcpy(mail_to, username);	/* it's to YOU! */
  	    return;
  	  }
  	  else if (strlen(mail_to) == 0) {	/* it's SOMEthing! */
  	
! 	    /** this next bit is kinda gory, but allows us to use the
! 		existing routines to parse the address - by pretending
! 		it's a From: line and going from there...
! 		Ah well - you get what you pay for, right?
! 	    **/
! 
! 	      if (strlen(address) > (sizeof mybuf) - 7)	/* ensure it ain't */
! 		address[(sizeof mybuf)-7] = '\0';	/*  too long mon!  */
! 
! 	      sprintf(mybuf, "From: %s", address);
! 	      parse_arpa_who(mybuf, mail_to, TRUE);
  	  }
  
  	  bufptr = (char *) NULL;	/* set to null */
--- 39,52 ----
  	while ((address = strtokq(bufptr, ",\t\n\r", 1)) != NULL) {
  
  	  if (! okay_address(address, "don't match me!")) {
! 	    strfcpy(mail_to, username, size);	/* it's to YOU! */
  	    return;
  	  }
  	  else if (strlen(mail_to) == 0) {	/* it's SOMEthing! */
  	
! 	      parse_arpa_who(address, mail_to, 
! 			     decode_who_none,
! 			     size);
  	  }
  
  	  bufptr = (char *) NULL;	/* set to null */
***************
*** 78,80 ****
--- 54,59 ----
  
  	return;
  }
+ 
+ 
+ 
Index: elm2.4.ME+.50/lib/gcos_name.c
*** elm2.4.25/lib/gcos_name.c	Tue Aug  3 22:28:49 1993
--- elm2.4.ME+.50/lib/gcos_name.c	Tue Nov 17 21:12:56 1998
***************
*** 1,39 ****
! static char rcsid[] = "@(#)$Id: gcos_name.c,v 5.3 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: gcos_name.c,v $
!  * Revision 5.3  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.2  1993/01/20  03:02:19  syd
!  * Move string declarations to defs.h
!  * From: Syd
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,15 ----
! static char rcsid[] = "@(#)$Id: gcos_name.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 41,49 ****
  
  #include "headers.h"
  
! char *
! gcos_name(gcos_field, logname)
! char *logname, *gcos_field;
  {
      /** Return the full name found in a passwd file gcos field **/
  
--- 17,24 ----
  
  #include "headers.h"
  
! char * gcos_name(gcos_field, logname)
!      char *logname, *gcos_field;
  {
      /** Return the full name found in a passwd file gcos field **/
  
Index: elm2.4.ME+.50/lib/get_tz.c
*** elm2.4.25/lib/get_tz.c	Mon May 30 19:53:43 1994
--- elm2.4.ME+.50/lib/get_tz.c	Tue Nov 17 21:12:56 1998
***************
*** 1,61 ****
  
! static char rcsid[] = "@(#)$Id: get_tz.c,v 5.4 1994/05/30 16:53:35 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
   *
!  * 			Copyright (c) 1992, 1993 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: get_tz.c,v $
!  * Revision 5.4  1994/05/30  16:53:35  syd
!  * back out revision, uses local defs.h
!  *
!  * Revision 5.3  1994/05/30  16:46:07  syd
!  * I had to add a region of conditional compilation around "defs.h"
!  * to make Configure work correctly with the TZNAME_USE_xxxx stuff.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.2  1994/03/11  20:55:23  syd
!  * Replaced the get_tz_mins() routine in lib/get_tz.c with a portable
!  * version that requires no configuration.  Rewrote the test case in
!  * lib/get_tz.c, and also wrote in support to simplify configuration
!  * tests.  Dropped TZMINS_USE_XXXX configuration parameter.  Simplified
!  * timezone determination in Configure.  The new get_tz_mins() introduces
!  * two side effects.  First it steps on the static data returned by
!  * localtime().  Second, it uses a routine in lib/date_util.c, which
!  * requires debug initializations.  Rewrote get_arpa_date() to work around
!  * the first issue.  Rather than doing the same for lib/strftime.c, just
!  * removed the timezone stuff with a conditional compile.  Elm does not
!  * use it.  Added debugging initializations to util/fastmail.c.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
   *
!  * Revision 5.1  1993/08/10  18:56:53  syd
!  * Initial Checkin
!  *
!  *
!  ******************************************************************************/
  
  #include "defs.h"
! 
! #ifdef I_TIME
! #  include <time.h>
! #endif
! #ifdef I_SYSTIME
! #  include <sys/time.h>
! #endif
! 
! #ifndef	_POSIX_SOURCE
! extern struct tm *localtime();
! extern struct tm *gmtime();
! extern time_t	  time();
! #endif
! 
  
  #ifdef _CONFIGURE
  /*
--- 1,18 ----
  
! static char rcsid[] = "@(#)$Id: get_tz.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  * 			Copyright (c) 1992, 1993 USENET Community Trust
!  *****************************************************************************/
  
  #include "defs.h"
! #include "elmlib.h"
  
  #ifdef _CONFIGURE
  /*
***************
*** 96,106 ****
  	time(&tval);
  
  	tm = localtime(&tval);
! 	t1 = make_gmttime(tm->tm_year, tm->tm_mon, tm->tm_mday,
  		tm->tm_hour, tm->tm_min, tm->tm_sec);
  
  	tm = gmtime(&tval);
! 	t2 = make_gmttime(tm->tm_year, tm->tm_mon, tm->tm_mday,
  		tm->tm_hour, tm->tm_min, tm->tm_sec);
  
  	return (int) ((t2-t1)/60);
--- 53,63 ----
  	time(&tval);
  
  	tm = localtime(&tval);
! 	t1 = make_gmttime(1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday,
  		tm->tm_hour, tm->tm_min, tm->tm_sec);
  
  	tm = gmtime(&tval);
! 	t2 = make_gmttime(1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday,
  		tm->tm_hour, tm->tm_min, tm->tm_sec);
  
  	return (int) ((t2-t1)/60);
***************
*** 129,135 ****
   */
  
  char *get_tz_name(tm)
! struct tm *tm;
  {
  
  	if (tm == 0) {
--- 86,92 ----
   */
  
  char *get_tz_name(tm)
!      struct tm *tm;
  {
  
  	if (tm == 0) {
Index: elm2.4.ME+.50/lib/getaddrfrm.c
*** elm2.4.25/lib/getaddrfrm.c	Tue Aug  3 22:28:49 1993
--- elm2.4.ME+.50/lib/getaddrfrm.c	Tue Nov 17 21:12:55 1998
***************
*** 1,45 ****
  
! static char rcsid[] = "@(#)$Id: getaddrfrm.c,v 5.4 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: getaddrfrm.c,v $
!  * Revision 5.4  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.3  1993/05/16  20:55:52  syd
!  * Fix bug where text following "<" within double-quote delimited comment
!  * is taken as an address.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.2  1992/11/07  20:05:52  syd
!  * change to use header_cmp to allow for linear white space around the colon
!  * From: Syd
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: getaddrfrm.c,v 1.2 1998/10/20 19:57:46 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 47,107 ****
  
  #include "headers.h"
  
! #ifdef USE_EMBEDDED_ADDRESSES
! 
! get_address_from(line, buffer)
! char *line, *buffer;
  {
! 	/** This routine extracts the address from either a 'From:' line
! 	    or a 'Reply-To:' line.  The strategy is as follows:  if the
! 	    line contains a '<', then the stuff enclosed is returned.
! 	    Otherwise we go through the line and strip out comments
! 	    and return that.  White space will be elided from the result.
  	**/
  
!     register char *s;
!     register int l;
  
!     /**  Skip start of line over prefix, e.g. "From:".  **/
!     if ((s = index(line, ':')) != NULL)
! 	line = s + 1;
! 
!     /*
!      * If there is a '<' then copy from it to '>' into the buffer.  We
!      * used to search with an "index()", but we need to handle RFC-822
!      * conventions (e.g. "<" within a double-quote comment) correctly.
!      */
!     for (s = line ; *s != '\0' && *s != '<' ; s += len_next_part(s))
! 	;
!     if (*s == '<') {
! 	++s;
! 	while (*s != '\0' && *s != '>') {
! 	    if ((l = len_next_part(s)) == 1 && isspace(*s)) {
! 		++s; /* elide embedded whitespace */
! 	    } else {
! 		while (--l >= 0)
! 		    *buffer++ = *s++;
! 	    }
! 	}
! 	*buffer = '\0';
! 	return;
!     }
  
!     /**  Otherwise, strip comments and get address with whitespace elided.  **/
!     s = strip_parens(line);
!     while (*s != '\0') {
! 	l = len_next_part(s);
! 	if (l == 1) {
! 	  if ( !isspace(*s) )
! 	    *buffer++ = *s;
! 	  s++;
! 	} else {
! 	  while (--l >= 0)
! 	    *buffer++ = *s++;
! 	}
      }
-     *buffer = '\0';
  
  }
  
! #endif
--- 18,63 ----
  
  #include "headers.h"
  
! void get_address_from(line, buffer, size)
!      char *line, *buffer;
!      int size;
  {
! 	/** This routine extracts the address from a 'From:' line
  	**/
  
!   struct addr_item * list;
  
!   dprint(12,(debugfile,
! 	     "get_address_from: line=%.100s, size=%d\n",
! 	     line,size));
! 
!   no_ret(line);		/* blow away '\n' char! */
! 
!   list = break_down_address(line,decode_who_none);
! 
!   buffer[0]='\0';
! 
!   if (list) {
!     struct addr_item * ptr;
  
!     for (ptr=list; ptr->addr; ptr++) {
!       char *t = ptr->addr;
!       if (ptr == list)
! 	strfcpy(buffer, t, size);
!       else {
! 	strfcat(buffer, ", ", size);
! 	strfcat(buffer, t, size);
!       }
      }
  
+   } 
+ 
+   free_addr_items(list);
+ 
+   dprint(12,(debugfile,
+ 	     "get_address_from: buffer=%.100s\n",
+ 	     buffer));
  }
  
! 
! 
Index: elm2.4.ME+.50/lib/getarpdate.c
*** elm2.4.25/lib/getarpdate.c	Fri Mar 11 22:55:24 1994
--- elm2.4.ME+.50/lib/getarpdate.c	Tue Nov 17 21:12:56 1998
***************
*** 1,91 ****
! static char rcsid[] = "@(#)$Id: getarpdate.c,v 5.10 1994/03/11 20:55:23 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: getarpdate.c,v $
!  * Revision 5.10  1994/03/11  20:55:23  syd
!  * Replaced the get_tz_mins() routine in lib/get_tz.c with a portable
!  * version that requires no configuration.  Rewrote the test case in
!  * lib/get_tz.c, and also wrote in support to simplify configuration
!  * tests.  Dropped TZMINS_USE_XXXX configuration parameter.  Simplified
!  * timezone determination in Configure.  The new get_tz_mins() introduces
!  * two side effects.  First it steps on the static data returned by
!  * localtime().  Second, it uses a routine in lib/date_util.c, which
!  * requires debug initializations.  Rewrote get_arpa_date() to work around
!  * the first issue.  Rather than doing the same for lib/strftime.c, just
!  * removed the timezone stuff with a conditional compile.  Elm does not
!  * use it.  Added debugging initializations to util/fastmail.c.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.9  1993/08/03  19:17:33  syd
!  * Implement new timezone handling.  New file lib/get_tz.c with new timezone
!  * routines.  Added new TZMINS_USE_xxxxxx and TZNAME_USE_xxxxxx configuration
!  * definitions.  Obsoleted TZNAME, ALTCHECK, and TZ_MINUTESWEST configuration
!  * definitions.  Updated Configure.  Modified lib/getarpdate.c and
!  * lib/strftime.c to use new timezone routines.
!  *
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.8  1993/05/08  19:22:46  syd
!  * On the DEC Alpha, OSF/1 the following change made things happy.
!  * From: dave@opus.csd.uwm.edu (Dave Rasmussen)
!  *
!  * Revision 5.7  1993/04/21  01:45:39  syd
!  * Try and get getarpdate to work on AIX
!  * From: "William F. Pemberton" <wfp5p@holmes.acc.virginia.edu>
!  *
!  * Revision 5.6  1993/04/16  03:42:38  syd
!  * As per "William F. Pemberton" <wfp5p@holmes.acc.virginia.edu>
!  * IBMs have the date already adjusted for dst in the min decode
!  * From: Syd
!  *
!  * Revision 5.5  1992/12/12  01:29:26  syd
!  * Fix double inclusion of sys/types.h
!  * From: Tom Moore <tmoore@wnas.DaytonOH.NCR.COM>
!  *
!  * Revision 5.4  1992/11/15  02:18:15  syd
!  * Change most of the rest of the BSDs to TZNAME
!  * From: Syd
!  *
!  * Revision 5.3  1992/11/15  02:10:58  syd
!  * change tzname ifdef from ndefBSD to ifdef TZNAME on its own
!  * configure variable
!  * From: Syd
!  *
!  * Revision 5.2  1992/11/07  19:27:30  syd
!  * Symbol change for AIX370
!  * From: uri@watson.ibm.com
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  #include "headers.h"
  
- #ifdef I_TIME
- #  include <time.h>
- #endif
- #ifdef I_SYSTIME
- #  include <sys/time.h>
- #endif
- 
- #ifndef	_POSIX_SOURCE
- extern struct tm *localtime();
- extern time_t	  time();
- #endif
- 
  static char *arpa_dayname[] = { "Sun", "Mon", "Tue", "Wed", "Thu",
  		  "Fri", "Sat", "" };
  
--- 1,18 ----
! static char rcsid[] = "@(#)$Id: getarpdate.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  #include "headers.h"
  
  static char *arpa_dayname[] = { "Sun", "Mon", "Tue", "Wed", "Thu",
  		  "Fri", "Sat", "" };
  
***************
*** 95,102 ****
  extern int get_tz_mins();
  extern char *get_tz_name();
  
! char *
! get_arpa_date()
  {
  	/** returns an ARPA standard date.  The format for the date
  	    according to DARPA document RFC-822 is exemplified by;
--- 22,28 ----
  extern int get_tz_mins();
  extern char *get_tz_name();
  
! char * get_arpa_date()
  {
  	/** returns an ARPA standard date.  The format for the date
  	    according to DARPA document RFC-822 is exemplified by;
***************
*** 103,108 ****
--- 29,39 ----
  
  	       	      Mon, 12 Aug 85 6:29:08 MST
  
+ 
+ 	    Actually generates following kind result:
+                       
+                       Mon, 12 Aug 1985 6:29:0 +0400 (MST)
+ 
  	**/
  
  	static char buffer[SLEN];	/* static character buffer       */
***************
*** 119,126 ****
  	(void) time(&curr_time);
  	curr_tm = *localtime(&curr_time);
  
! 	if ((year = curr_tm.tm_year) < 100)
! 		year += 1900;
  
  	if ((tzmin = -get_tz_mins()) >= 0) {
  		tzsign = '+';
--- 50,56 ----
  	(void) time(&curr_time);
  	curr_tm = *localtime(&curr_time);
  
! 	year = curr_tm.tm_year + 1900;
  
  	if ((tzmin = -get_tz_mins()) >= 0) {
  		tzsign = '+';
***************
*** 129,139 ****
  		tzmin = -tzmin;
  	}
  
! 	sprintf(buffer, "%s, %d %s %d %02d:%02d:%02d %c%02d%02d (%s)",
! 	  arpa_dayname[curr_tm.tm_wday],
! 	  curr_tm.tm_mday, arpa_monname[curr_tm.tm_mon], year,
! 	  curr_tm.tm_hour, curr_tm.tm_min, curr_tm.tm_sec,
! 	  tzsign, tzmin / 60, tzmin % 60, get_tz_name(&curr_tm));
  	
  	return buffer;
  }
--- 59,70 ----
  		tzmin = -tzmin;
  	}
  
! 	elm_sfprintf(buffer, sizeof buffer,
! 		     FRM("%s, %d %s %d %02d:%02d:%02d %c%02d%02d (%s)"),
! 		     arpa_dayname[curr_tm.tm_wday],
! 		     curr_tm.tm_mday, arpa_monname[curr_tm.tm_mon], year,
! 		     curr_tm.tm_hour, curr_tm.tm_min, curr_tm.tm_sec,
! 		     tzsign, tzmin / 60, tzmin % 60, get_tz_name(&curr_tm));
  	
  	return buffer;
  }
Index: elm2.4.ME+.50/lib/getfullnam.c
*** elm2.4.25/lib/getfullnam.c	Sun Oct  4 01:42:24 1992
--- elm2.4.ME+.50/lib/getfullnam.c	Tue Nov 17 21:12:56 1998
***************
*** 1,24 ****
  
! static char rcsid[] = "@(#)$Id: getfullnam.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: getfullnam.c,v $
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: getfullnam.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 33,41 ****
  
  char *gcos_name();
  
! char *
! get_full_name(logname)
! char *logname;
  {
  	/* return a pointer to the full user name for the passed logname
  	 * or NULL if cannot be found
--- 25,32 ----
  
  char *gcos_name();
  
! char * get_full_name(logname)
!      char *logname;
  {
  	/* return a pointer to the full user name for the passed logname
  	 * or NULL if cannot be found
***************
*** 53,61 ****
  	if((pass = getpwnam(logname)) == NULL)
  	  return(NULL);
  #ifdef PASSNAMES	/* get full_username from gcos field */
! 	strcpy(fullname, gcos_name(pass->pw_gecos, logname));
  #else			/* get full_username from ~/.fullname file */
! 	sprintf(fullnamefile, "%s/.fullname", pass->pw_dir);
  
  	if(can_access(fullnamefile, READ_ACCESS) != 0)
  	  return(NULL);		/* fullname file not accessible to user */
--- 44,54 ----
  	if((pass = getpwnam(logname)) == NULL)
  	  return(NULL);
  #ifdef PASSNAMES	/* get full_username from gcos field */
! 	strfcpy(fullname, gcos_name(pass->pw_gecos, logname),
! 		sizeof fullname);
  #else			/* get full_username from ~/.fullname file */
! 	elm_sfprintf(fullnamefile, sizeof fullnamefile,
! 		     FRM("%s/.fullname"), pass->pw_dir);
  
  	if(can_access(fullnamefile, READ_ACCESS) != 0)
  	  return(NULL);		/* fullname file not accessible to user */
Index: elm2.4.ME+.50/lib/getword.c
*** elm2.4.25/lib/getword.c	Tue Aug  3 22:28:50 1993
--- elm2.4.ME+.50/lib/getword.c	Tue Nov 17 21:12:56 1998
***************
*** 1,44 ****
  
! static char rcsid[] = "@(#)$Id: getword.c,v 5.2 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
   *
!  * 			Copyright (c) 1993 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: getword.c,v $
!  * Revision 5.2  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
   *
!  * Revision 5.1  1993/01/19  04:46:21  syd
!  * Initial Checkin
!  *
!  *
!  ******************************************************************************/
  
  #include <stdio.h>
  #include "defs.h"
  
  int get_word(buffer, start, word, wordlen)
! char *buffer;
! int start;
! char *word;
! int wordlen;
  {
      /*
       * Extracts the next white-space delimited word from the "buffer"
--- 1,25 ----
  
! static char rcsid[] = "@(#)$Id: getword.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  * 			Copyright (c) 1993 USENET Community Trust
!  *****************************************************************************/
  
  #include <stdio.h>
  #include "defs.h"
+ #include "elmlib.h"
  
  int get_word(buffer, start, word, wordlen)
!      const char *buffer;
!      int start;
!      char *word;
!      int wordlen;
  {
      /*
       * Extracts the next white-space delimited word from the "buffer"
***************
*** 51,58 ****
       * in the buffer then -1 is returned.
       */
  
!     register int len;
!     register char *p;
  
      for (p = buffer+start ; isspace(*p) ; ++p)
  	;
--- 32,39 ----
       * in the buffer then -1 is returned.
       */
  
!     int len;
!     const char *p;
  
      for (p = buffer+start ; isspace(*p) ; ++p)
  	;
Index: elm2.4.ME+.50/lib/header_cmp.c
*** elm2.4.25/lib/header_cmp.c	Tue Aug  3 22:28:50 1993
--- elm2.4.ME+.50/lib/header_cmp.c	Tue Nov 17 21:12:56 1998
***************
*** 1,38 ****
! static char rcsid[] = "@(#)$Id: header_cmp.c,v 5.3 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: header_cmp.c,v $
!  * Revision 5.3  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.2  1992/11/07  20:59:49  syd
!  * fix typo
!  *
!  * Revision 5.1  1992/11/07  20:16:29  syd
!  * Initial Checkin
!  *
!  *
!  ******************************************************************************/
  
  /** 
  	compare a header, ignoring case and allowing linear white space
--- 1,15 ----
! static char rcsid[] = "@(#)$Id: header_cmp.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  	compare a header, ignoring case and allowing linear white space
***************
*** 45,54 ****
  
  #include "headers.h"
  
! 
! char *
! header_cmp(header, prefix, suffix)
! register char *header, *prefix, *suffix;
  {
  	int len;
  
--- 22,29 ----
  
  #include "headers.h"
  
! char * header_cmp(header, prefix, suffix)
!      char *header, *prefix, *suffix;
  {
  	int len;
  
Index: elm2.4.ME+.50/lib/in_list.c
*** elm2.4.25/lib/in_list.c	Sun Oct  4 01:42:24 1992
--- elm2.4.ME+.50/lib/in_list.c	Tue Nov 17 21:12:56 1998
***************
*** 1,23 ****
! static char rcsid[] = "@(#)$Id: in_list.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: in_list.c,v $
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,15 ----
! static char rcsid[] = "@(#)$Id: in_list.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 25,35 ****
  
  #include "headers.h"
  
! 
! int
! in_list(list, target)
! char *list, *target;
! 
  {
  	/* Returns TRUE iff target is an item in the list - case ignored.
  	 * If target is simple (an atom of an address) match must be exact.
--- 17,29 ----
  
  #include "headers.h"
  
! /* in_list should use quoted -variants (strtokq, ...)
!  *                            - K E H <hurtta@ozone.FMI.FI>
!  */
! 
! int in_list(list, target)
!      char *list;
!      const char *target;
  {
  	/* Returns TRUE iff target is an item in the list - case ignored.
  	 * If target is simple (an atom of an address) match must be exact.
***************
*** 59,71 ****
  				lower_list[VERY_LONG_STRING],
  				lower_target[SLEN];
  
! 	rest_of_list = strcpy(lower_list, shift_lower(list));
! 	strcpy(lower_target, shift_lower(target));
  	while((next_item = strtok(rest_of_list, ", \t\n")) != NULL) {
  	    /* see if target matches the whole item */
  	    if(strcmp(next_item, lower_target) == 0)
  		return(TRUE);
  
  	    if(strpbrk(lower_target,"!@%:") != NULL) {
  
  	      /* Target is complex */
--- 53,71 ----
  				lower_list[VERY_LONG_STRING],
  				lower_target[SLEN];
  
! 	rest_of_list = strfcpy(lower_list, shift_lower(list),
! 			       sizeof lower_list);
! 	strfcpy(lower_target, shift_lower(target), 
! 		sizeof lower_target);
  	while((next_item = strtok(rest_of_list, ", \t\n")) != NULL) {
  	    /* see if target matches the whole item */
  	    if(strcmp(next_item, lower_target) == 0)
  		return(TRUE);
  
+             if(index(lower_target,'*')!=0){
+ 	      if (globmatch(next_item,lower_target))
+                 return(TRUE);
+             } else
  	    if(strpbrk(lower_target,"!@%:") != NULL) {
  
  	      /* Target is complex */
***************
*** 85,88 ****
--- 85,123 ----
  	    rest_of_list = NULL;
  	}
  	return(FALSE);
+ }
+ 
+ int globmatch (string, pat)
+      char *string, *pat;
+ {
+   char buf[1024];
+   int i=0,j=0,k,offset=0;
+   
+   for (;;) {
+     k=0;
+     while (pat[j]!='*' && pat[j]!='\0') {
+       buf[k++]=pat[j++];
+     }
+     buf[k]='\0';
+ 
+     /* check everything up to the first '*' */
+     if (strncmp(string+offset,buf,i=strlen(buf))!=0)
+       return(FALSE);
+ 
+     /* if we have run out of pattern, then the string matches... */
+     if (pat[j]=='\0' || pat[j+1]=='\0')
+       return(TRUE);
+ 
+     ++j; /* advance to the next 'real' character in the pattern */
+ 
+     /* ffwd to the next real char that matches */
+     while (string[i] != pat[j]) {
+       /* if we still have pattern, but no string, then it doesn't match */
+       if (string[i]=='\0')
+ 	return(FALSE);
+       i++;
+     }
+     offset+=i;
+   }
+   /* not reached */
  }
Index: elm2.4.ME+.50/lib/in_string.c
*** elm2.4.25/lib/in_string.c	Sun Oct  4 01:42:24 1992
--- elm2.4.ME+.50/lib/in_string.c	Tue Nov 17 21:12:56 1998
***************
*** 1,23 ****
! static char rcsid[] = "@(#)$Id: in_string.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: in_string.c,v $
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,15 ----
! static char rcsid[] = "@(#)$Id: in_string.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 25,34 ****
  
  #include "headers.h"
  
  
! int 
! in_string(buffer, pattern)
! char *buffer, *pattern;
  {
  	/** Returns TRUE iff pattern occurs IN IT'S ENTIRETY in buffer. **/ 
  
--- 17,28 ----
  
  #include "headers.h"
  
+ /* Is that needed? This is almost same as strstr (except return type).
+  *                                     - K E H <hurtta@ozone.FMI.FI> 
+  */
  
! int in_string(buffer, pattern)
!      char *buffer, *pattern;
  {
  	/** Returns TRUE iff pattern occurs IN IT'S ENTIRETY in buffer. **/ 
  
Index: elm2.4.ME+.50/lib/istrcmp.c
*** elm2.4.25/lib/istrcmp.c	Tue Aug  3 22:28:51 1993
--- elm2.4.ME+.50/lib/istrcmp.c	Tue Nov 17 21:12:55 1998
***************
*** 1,35 ****
! static char rcsid[] = "@(#)$Id: istrcmp.c,v 5.2 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: istrcmp.c,v $
!  * Revision 5.2  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,15 ----
! static char rcsid[] = "@(#)$Id: istrcmp.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 36,45 ****
  **/
  
  #include "headers.h"
  
! int
! istrcmp(s1,s2)
! register char *s1, *s2;
  {
  	/* case insensitive comparison */
  	register int d;
--- 16,26 ----
  **/
  
  #include "headers.h"
+ #include "me.h"
  
! /* This is same than strcasecmp.   - K E H <hurtta@ozone.FMI.FI>  */
! int istrcmp(s1,s2)
!      register char *s1, *s2;
  {
  	/* case insensitive comparison */
  	register int d;
Index: elm2.4.ME+.50/lib/ldstate.c
*** elm2.4.25/lib/ldstate.c	Fri Mar 11 23:01:35 1994
--- elm2.4.ME+.50/lib/ldstate.c	Tue Nov 17 21:12:55 1998
***************
*** 1,50 ****
  
! static char rcsid[] = "@(#)$Id: ldstate.c,v 5.7 1994/03/11 21:01:35 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
   *
!  *			Copyright (c) 1992 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: ldstate.c,v $
!  * Revision 5.7  1994/03/11  21:01:35  syd
!  * detect whether atol() is a macro
!  * From: Mitch DSouza <m.dsouza@mrc-applied-psychology.cambridge.ac.uk>
!  *
!  * Revision 5.6  1993/08/23  02:46:51  syd
!  * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX).
!  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
!  *
!  * Revision 5.5  1993/02/03  15:26:13  syd
!  * protect atol in ifndef __STDC__ as some make it a macro, and its in stdlib.h
!  *
!  * Revision 5.4  1992/12/24  21:48:07  syd
!  * Make fgetline elm_fgetline, as BSD 4.4 now has such a routine, and
!  * it causes compile problems.
!  * From: Syd
   *
!  * Revision 5.3  1992/12/11  01:45:04  syd
!  * remove sys/types.h include, it is now included by defs.h
!  * and this routine includes defs.h or indirectly includes defs.h
!  * From: Syd
!  *
!  * Revision 5.2  1992/12/07  04:51:34  syd
!  * add sys/types.h for time_t declaration
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
- #include <stdio.h>
  #include "defs.h"
  
  /*
   * Retrieve Elm folder state.
--- 1,18 ----
  
! static char rcsid[] = "@(#)$Id: ldstate.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  *			Copyright (c) 1992 USENET Community Trust
!  *****************************************************************************/
  
  #include "defs.h"
+ #include "elmlib.h"
  
  /*
   * Retrieve Elm folder state.
***************
*** 70,78 ****
  #endif
  
  static char *elm_fgetline(buf, buflen, fp)
! char *buf;
! unsigned buflen;
! FILE *fp;
  {
      if (fgets(buf, buflen, fp) == NULL)
  	return (char *) NULL;
--- 38,46 ----
  #endif
  
  static char *elm_fgetline(buf, buflen, fp)
!      char *buf;
!      unsigned buflen;
!      FILE *fp;
  {
      if (fgets(buf, buflen, fp) == NULL)
  	return (char *) NULL;
***************
*** 80,91 ****
      return buf;
  }
  
- 
  int load_folder_state_file(fst)
! struct folder_state *fst;
  {
      char buf[SLEN], *state_fname;
!     int status, i;
      FILE *fp;
  
      /* clear out the folder status record */
--- 48,58 ----
      return buf;
  }
  
  int load_folder_state_file(fst)
!      struct folder_state *fst;
  {
      char buf[SLEN], *state_fname;
!     int status, i, Len;
      FILE *fp;
  
      /* clear out the folder status record */
***************
*** 107,115 ****
      /* retrieve pathname of the folder */
      if (elm_fgetline(buf, sizeof(buf), fp) == NULL || buf[0] != 'F')
  	goto done;
!     if ((fst->folder_name = malloc(strlen(buf+1) + 1)) == NULL)
  	goto done;
!     (void) strcpy(fst->folder_name, buf+1);
  
      /* retrieve number of messages in the folder */
      if (elm_fgetline(buf, sizeof(buf), fp) == NULL || buf[0] != 'N')
--- 74,83 ----
      /* retrieve pathname of the folder */
      if (elm_fgetline(buf, sizeof(buf), fp) == NULL || buf[0] != 'F')
  	goto done;
!     Len = strlen(buf+1) + 1;
!     if ((fst->folder_name = malloc(Len)) == NULL)
  	goto done;
!     strfcpy(fst->folder_name, buf+1, Len);
  
      /* retrieve number of messages in the folder */
      if (elm_fgetline(buf, sizeof(buf), fp) == NULL || buf[0] != 'N')
Index: elm2.4.ME+.50/lib/len_next.c
*** elm2.4.25/lib/len_next.c	Tue Aug  3 22:28:51 1993
--- elm2.4.ME+.50/lib/len_next.c	Tue Nov 17 21:12:55 1998
***************
*** 1,52 ****
  
! static char rcsid[] = "@(#)$Id: len_next.c,v 5.5 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
   *
!  * 			Copyright (c) 1992 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: len_next.c,v $
!  * Revision 5.5  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.4  1993/04/12  01:27:30  syd
!  * len_next_part() was botching quote-delimited strings.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.3  1993/01/19  05:07:05  syd
!  * Trim erroreous extra log entry
!  * From: Syd
   *
!  * Revision 5.2  1993/01/19  04:47:12  syd
!  * Significant changes to provide consistent Date and From_ header
!  * cracking.  Overhauled date utilities and moved into library.  Moved
!  * real_from() into library.  Modified frm, newmail, and readmsg utilities
!  * to use library version of real_from().  Moved get_word() from Elm
!  * source into library.  Added new library routines atonum() and strfcpy().
!  * Fixed trailing backslash bug in len_next().
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** get the length of the next part of the address/data field
  
--- 1,15 ----
  
! static char rcsid[] = "@(#)$Id: len_next.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  * 			Copyright (c) 1992 USENET Community Trust
!  *****************************************************************************/
  
  /** get the length of the next part of the address/data field
  
***************
*** 66,77 ****
  
  **/
  
  
! int
! len_next_part(str)
! register char *str;
  {
! 	register char *s;
  
  	switch (*str) {
  
--- 29,41 ----
  
  **/
  
+ #include "defs.h"
+ #include "elmlib.h"
  
! int len_next_part(str)
!      const char *str;
  {
! 	const char *s;
  
  	switch (*str) {
  
Index: elm2.4.ME+.50/lib/mail_gets.c
*** elm2.4.25/lib/mail_gets.c	Tue Aug  3 22:28:52 1993
--- elm2.4.ME+.50/lib/mail_gets.c	Tue Nov 17 21:12:56 1998
***************
*** 1,51 ****
  
! static char rcsid[] = "@(#)$Id: mail_gets.c,v 5.4 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
   *
!  * 			Copyright (c) 1992 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: mail_gets.c,v $
!  * Revision 5.4  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.3  1993/08/03  19:05:33  syd
!  * When STDC is used on Convex the feof() function is defined as
!  * a true library routine in the header files and moreover the
!  * library routine also leaks royally. It returns always 1!!
!  * So we have to use a macro. Convex naturally does not provide
!  * you with one though if you are using a STDC compiler. So we
!  * have to include one.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
   *
!  * Revision 5.2  1993/04/12  01:13:30  syd
!  * In some cases, with certain editors, the user can create an
!  * aliases.text file in which the last line is terminated with an EOF but
!  * doesn't have a '\n'.  Currently, elm with complain that the line is
!  * too long.
!  * From: "William F. Pemberton" <wfp5p@holmes.acc.virginia.edu>
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** get a line from the mail file, but be tolerant of nulls
  
--- 1,15 ----
  
! static char rcsid[] = "@(#)$Id: mail_gets.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  * 			Copyright (c) 1992 USENET Community Trust
!  *****************************************************************************/
  
  /** get a line from the mail file, but be tolerant of nulls
  
***************
*** 55,66 ****
  
  #include <stdio.h>
  #include "defs.h"
  
! int
! mail_gets(buffer, size, mailfile)
! char *buffer;
! int size;
! FILE *mailfile;
  {
  	register int line_bytes = 0, ch;
  	register char *c = buffer;
--- 19,30 ----
  
  #include <stdio.h>
  #include "defs.h"
+ #include "elmlib.h"
  
! int mail_gets(buffer, size, mailfile)
!      char *buffer;
!      int size;
!      FILE *mailfile;
  {
  	register int line_bytes = 0, ch;
  	register char *c = buffer;
Index: elm2.4.ME+.50/lib/mcprt.c
*** elm2.4.25/lib/mcprt.c	Thu Jun 30 19:44:02 1994
--- elm2.4.ME+.50/lib/mcprt.c	Tue Nov 17 21:12:55 1998
***************
*** 1,5 ****
  
! static char rcsid[] = "@(#)$Id: mcprt.c,v 5.6 1994/06/30 16:43:14 syd Exp $";
  
  /***********************************************************
  Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
--- 1,5 ----
  
! static char rcsid[] = "@(#)$Id: mcprt.c,v 1.1.1.1 1998/10/15 15:36:39 hurtta Exp $";
  
  /***********************************************************
  Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
***************
*** 49,55 ****
  #include "mcprt.h"
  #include "mcprtlib.h"
  
! #ifdef	ANSI_C
  int	MCprintf(char *fmt, ...)
  #else
  int	MCprintf(fmt, va_alist)
--- 49,55 ----
  #include "mcprt.h"
  #include "mcprtlib.h"
  
! #if	ANSI_C 
  int	MCprintf(char *fmt, ...)
  #else
  int	MCprintf(fmt, va_alist)
***************
*** 71,77 ****
      return len;
  }
  
! #ifdef	ANSI_C
  int	MCfprintf(FILE *fptr, char *fmt, ...)
  #else
  int	MCfprintf(fptr, fmt, va_alist)
--- 71,77 ----
      return len;
  }
  
! #if	ANSI_C 
  int	MCfprintf(FILE *fptr, char *fmt, ...)
  #else
  int	MCfprintf(fptr, fmt, va_alist)
***************
*** 94,100 ****
      return len;
  }
  
! #ifdef	ANSI_C
  int	MCsprintf(char *cptr, char *fmt, ...)
  #else
  int	MCsprintf(cptr, fmt, va_alist)
--- 94,100 ----
      return len;
  }
  
! #if	ANSI_C 
  int	MCsprintf(char *cptr, char *fmt, ...)
  #else
  int	MCsprintf(cptr, fmt, va_alist)
***************
*** 120,122 ****
--- 120,123 ----
  
      return len;
  }
+ 
Index: elm2.4.ME+.50/lib/mcprtlib.c
*** elm2.4.25/lib/mcprtlib.c	Mon Aug 23 05:54:32 1993
--- elm2.4.ME+.50/lib/mcprtlib.c	Tue Nov 17 21:12:55 1998
***************
*** 1,5 ****
  
! static char rcsid[] = "@(#)$Id: mcprtlib.c,v 5.5 1993/08/23 02:54:31 syd Exp $";
  
  /***********************************************************
  Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
--- 1,5 ----
  
! static char rcsid[] = "@(#)$Id: mcprtlib.c,v 1.1.1.1 1998/10/15 15:36:40 hurtta Exp $";
  
  /***********************************************************
  Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
***************
*** 53,59 ****
--- 53,61 ----
  
  #include "mcprtlib.h"
  #ifdef CATGETS
+ /*
  # include "nl_types.h"
+ */
  # ifndef MCMakeId
  #  define MCMakeId(s,m)	(unsigned long)(((unsigned short)s<<(sizeof(short)*8))\
  					|(unsigned short)m)
Index: elm2.4.ME+.50/lib/mk_aliases.c
*** elm2.4.25/lib/mk_aliases.c	Tue Aug  3 22:28:53 1993
--- elm2.4.ME+.50/lib/mk_aliases.c	Tue Nov 17 21:12:56 1998
***************
*** 1,118 ****
  
! static char rcsid[] = "@(#)$Id: mk_aliases.c,v 5.15 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.15 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: mk_aliases.c,v $
!  * Revision 5.15  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.14  1993/07/20  02:59:53  syd
!  * Support aliases both on 64 bit and 32 bit machines at the same time.
!  * From: Dan Mosedale <mosedale@genome.stanford.edu>
!  *
!  * Revision 5.13  1993/07/20  01:45:56  syd
!  * When resyncing aliases from elm, and there was aliases to delete,
!  * the alias.pag file could be corrupted since file_offset wasn't set to zero.
!  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
!  *
!  * Revision 5.12  1993/05/08  20:25:33  syd
!  * Add sleepmsg to control transient message delays
!  * From: Syd
!  *
!  * Revision 5.11  1993/04/12  01:06:42  syd
!  * If I have two aliases of the same name the duplicate is caught *but
!  * still written to the data file*!!!
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.10  1993/02/08  01:11:49  syd
!  * Make alias names consistently handled as lower case.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.9  1993/01/20  03:37:16  syd
!  * Nits and typos in the NLS messages and corresponding default messages.
!  * From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
!  *
!  * Revision 5.8  1993/01/19  04:52:19  syd
!  * 	add c)hange alias command to alias helpfile
!  * 	if a deleted alias is changed, undelete it.  Also added the 'N'
!  * flag to changed aliases to help remind the user.  Documented it.
!  * Note:  if they mark the alias for deletion AFTER making the change it
!  * WILL be deleted. (and marked accordingly)
!  * 	modified alias mode title string to indicate when a resync was
!  * needed.
!  * 	allow editing alias file when none exist.
!  * 	Now aliases are check for illegal characters (and WS) and
!  * addresses are check for illegal WS when they are being entered.  If
!  * anything illegal is found and message is printed and they keep entering
!  * the item until they get it right.
!  * 	I fixed a couple of places where int should be long to match
!  * the declared type of alias_rec.length
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.7  1993/01/05  17:52:14  syd
!  * Add missing quote check to whitespace error check loop
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.6  1992/12/11  02:10:24  syd
!  * Make Elm complain about spaces that are not after commas in
!  * alias and address lists
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.5  1992/12/11  02:09:06  syd
!  * Fix where the user creates a first new alias, then deletes it, the
!  * alias stays on screen, but the file really will be empty if it was the
!  * last alias, so the retry to delete gives 'cannot open ...file' messages
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.4  1992/11/15  01:15:28  syd
!  * The alias message_count isn't set to zero if the last alias has
!  * been deleted from the alias table. As no aliases are reread from
!  * the aliases database the message_count is left as it was before.
!  *
!  * Fixed that the function do_newalias() sometimes returns without freeing
!  * the buffer allocated before. The patch adds these free calls.
!  *
!  * When you erroneously type a number in your folder elm asks you for
!  * a new current message number. But now if you erase this one number
!  * and leave the string empty elm will set the new current message to
!  * the second message on our sun4! The patch adds a check for an empty
!  * string and returns the current number if no number was entered.
!  * From: vogt@isa.de (Gerald Vogt)
!  *
!  * Revision 5.3  1992/11/07  16:32:14  syd
!  * comments should be allowed anywhere in the alias file.
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.2  1992/10/11  01:46:35  syd
!  * change dbm name to dbz to avoid conflicts with partial call
!  * ins from shared librarys, and from mixing code with yp code.
!  * From: Syd via prompt from Jess Anderson
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** Install a new set of aliases for the 'Elm' mailer. 
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: mk_aliases.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** Install a new set of aliases for the 'Elm' mailer. 
  
***************
*** 133,139 ****
  #include "s_newalias.h"
  #include "ndbz.h"
  
! #ifdef BSD
  #  include <sys/file.h>
  #endif
  
--- 31,37 ----
  #include "s_newalias.h"
  #include "ndbz.h"
  
! #ifdef BSD_TYPE
  #  include <sys/file.h>
  #endif
  
***************
*** 157,164 ****
  
  int
  get_alias(file, fromelm)
! FILE *file;
! int fromelm;
  {
  	/* load buffer with the next complete alias from the file.
  	   (this can include reading in multiple lines and appending
--- 55,62 ----
  
  int
  get_alias(file, fromelm)
!      FILE *file;
!      int fromelm;
  {
  	/* load buffer with the next complete alias from the file.
  	   (this can include reading in multiple lines and appending
***************
*** 179,185 ****
  
  	if (get_line(file, mybuffer, TRUE, fromelm) == -1) 
  	    return(-1);
! 	strcpy(buffer, mybuffer);
  	len = strlen(buffer);
  
  	/** now read in the rest (if there is any!) **/
--- 77,83 ----
  
  	if (get_line(file, mybuffer, TRUE, fromelm) == -1) 
  	    return(-1);
! 	strfcpy(buffer, mybuffer, buffer_size);
  	len = strlen(buffer);
  
  	/** now read in the rest (if there is any!) **/
***************
*** 197,214 ****
  	      *--s = ' ';
  	      len += strlen(s);
  	      if (len >= buffer_size) {
! 	          sprintf(msg_buff, catgets(elm_msg_cat,
! 	                  NewaliasSet, NewaliasLineToLong,
! 	              "Line + continuations exceeds maximum length of %ld:"),
! 	              buffer_size);
! 	          error(msg_buff);
! 	          if (fromelm && sleepmsg > 0)
! 	              sleep(sleepmsg);
! 	          sprintf(msg_buff, "%.40s", buffer);
! 	          error(msg_buff);
! 		  err_flag++;
  	      } else
! 		  strcat(buffer, s);
  	  }
  	} while (! done);
  	
--- 95,110 ----
  	      *--s = ' ';
  	      len += strlen(s);
  	      if (len >= buffer_size) {
! 		lib_error(CATGETS(elm_msg_cat,
! 				  NewaliasSet, NewaliasLineToLong,
! 				  "Line + continuations exceeds maximum length of %ld:"),
! 			  buffer_size);
! 		if (fromelm && sleepmsg > 0)
! 		  sleep(sleepmsg);
! 		lib_error(FRM("%.40s"), buffer);
! 		err_flag++;
  	      } else
! 		strfcat(buffer, s, buffer_size);
  	  }
  	} while (! done);
  	
***************
*** 215,225 ****
  	return(0);	/* no sweat! */
  }
  
! int
! get_line(file, buffer, first_line, fromelm)
! FILE *file;
! char *buffer;
! int  first_line, fromelm;
  {
  /*
   *	Read line from file.
--- 111,120 ----
  	return(0);	/* no sweat! */
  }
  
! int get_line(file, buffer, first_line, fromelm)
!      FILE *file;
!      char *buffer;
!      int  first_line, fromelm;
  {
  /*
   *	Read line from file.
***************
*** 247,264 ****
  	  if (len > 0) {
  	    if (buffer[len - 1] != '\n') {
  	      if (fromelm) {
! 		  error(catgets(elm_msg_cat, NewaliasSet, NewaliasSplitShort,
! 		  "Line too long, split using continuation line format:"));
  		  if (sleepmsg > 0)
  			  sleep(sleepmsg);
- 		  sprintf(msg_buff, "%.40s", buffer);
  	      }
  	      else {
! 		  sprintf(msg_buff, catgets(elm_msg_cat,
! 			  NewaliasSet, NewaliasSplit,
! 		  "Line too long, split using continuation line format (starting line\nwith whitespace):\n%.40s\n"), buffer);
  	      }
- 	      error(msg_buff);
  	      err_flag++;
  	      return(-1);
  	    }
--- 142,159 ----
  	  if (len > 0) {
  	    if (buffer[len - 1] != '\n') {
  	      if (fromelm) {
! 		  lib_error(CATGETS(elm_msg_cat, NewaliasSet, 
! 				    NewaliasSplitShort,
! 				    "Line too long, split using continuation line format:"));
  		  if (sleepmsg > 0)
  			  sleep(sleepmsg);
  	      }
  	      else {
! 		  lib_error(CATGETS(elm_msg_cat,
! 				    NewaliasSet, NewaliasSplit,
! 				    "Line too long, split using continuation line format (starting line\nwith whitespace):\n%.40s\n"), 
! 			    buffer);
  	      }
  	      err_flag++;
  	      return(-1);
  	    }
***************
*** 276,284 ****
  	return(0);
  }
  
! void
! de_escape(the_string)
! char *the_string;
  {
  	register char *s, *out;
  
--- 171,178 ----
  	return(0);
  }
  
! void de_escape(the_string)
!      char *the_string;
  {
  	register char *s, *out;
  
***************
*** 293,302 ****
  	return;
  }
  
! int
! add_to_hash_table(word, offset)
! char *word;
! int32  offset;
  {
  	datum	key, value, ovalue;
  	int32	off;
--- 187,195 ----
  	return;
  }
  
! int add_to_hash_table(word, offset)
!      char *word;
!      int32  offset;
  {
  	datum	key, value, ovalue;
  	int32	off;
***************
*** 309,327 ****
  
  	ovalue = dbz_fetch(aliases_hash, key);
  	if (ovalue.dptr != NULL) {
! 	    sprintf(msg_buff, catgets(elm_msg_cat,
! 	            NewaliasSet, NewaliasDupAlias,
! 		    "** Duplicate alias '%s' in file.  Multiples ignored."),
! 		word);
! 	    error(msg_buff);
  	    return(-1);
  	}
  
  	if (dbz_store(aliases_hash, key, value) < 0) {
! 	    sprintf(msg_buff, catgets(elm_msg_cat,
! 	            NewaliasSet, NewaliasErrWrite,
! 		    "** Error writing alias '%s'."), word);
! 	    error(msg_buff);
  	    err_flag++;
  	    return(-1);
  	}
--- 202,218 ----
  
  	ovalue = dbz_fetch(aliases_hash, key);
  	if (ovalue.dptr != NULL) {
! 	    lib_error(CATGETS(elm_msg_cat,
! 			      NewaliasSet, NewaliasDupAlias,
! 			      "** Duplicate alias '%s' in file.  Multiples ignored."),
! 		      word);
  	    return(-1);
  	}
  
  	if (dbz_store(aliases_hash, key, value) < 0) {
! 	    lib_error(CATGETS(elm_msg_cat,
! 			      NewaliasSet, NewaliasErrWrite,
! 			      "** Error writing alias '%s'."), word);
  	    err_flag++;
  	    return(-1);
  	}
***************
*** 333,345 ****
  
  }
  
! void
! add_to_table(data, aliases, lastn, firstn, comment, addresses)
! FILE *data;
! register char *aliases, *lastn, *firstn, *comment, *addresses;
  {
  	struct alias_disk_rec	alias;
! 	register char	*s;
  /*
   *	crack the information into an alias_rec structure, then add the entry
   *	each alias at a time to the dbz file.
--- 224,235 ----
  
  }
  
! void add_to_table(data, aliases, lastn, firstn, comment, addresses)
!      FILE *data;
!      char *aliases, *lastn, *firstn, *comment, *addresses;
  {
  	struct alias_disk_rec	alias;
! 	char	*s;
  /*
   *	crack the information into an alias_rec structure, then add the entry
   *	each alias at a time to the dbz file.
***************
*** 402,410 ****
  
  }	
  
! int
! check_alias(aliases)
! char *aliases;
  {
  /*
   *	Check and make sure this is a legal alias.
--- 292,299 ----
  
  }	
  
! int check_alias(aliases)
!      char *aliases;
  {
  /*
   *	Check and make sure this is a legal alias.
***************
*** 434,444 ****
   *	up and doesn't display well at all.
   */
  	if (badws_flg) {
! 	    sprintf(msg_buff, catgets(elm_msg_cat,
! 	        NewaliasSet, NewaliasAliasWSNotAllowed,
! 	        "Error - whitespace in alias '%.30s' is not allowed."),
! 	        aliases);
! 	    error(msg_buff);
  	    return(-1);
  	}
  
--- 323,332 ----
   *	up and doesn't display well at all.
   */
  	if (badws_flg) {
! 	    lib_error(CATGETS(elm_msg_cat,
! 			      NewaliasSet, NewaliasAliasWSNotAllowed,
! 			      "Error - whitespace in alias '%.30s' is not allowed."),
! 		      aliases);
  	    return(-1);
  	}
  
***************
*** 447,465 ****
   */
  	for (s = aliases; *s != '\0' && (ok_alias_char(*s)||*s==','); ++s ) ;
  	if ( *s != '\0' ) {
! 	    MCsprintf(msg_buff, catgets(elm_msg_cat,
! 	            NewaliasSet, NewaliasCharNotSupported,
! 		    "Error - character '%c' in alias '%s' is not supported."),
  	        *s, aliases);
- 	    error(msg_buff);
  	    return(-1);
  	}
  	return(0);
  }
  
! int
! check_address(addresses)
! char *addresses;
  {
  
  	register char *s, *out;
--- 335,351 ----
   */
  	for (s = aliases; *s != '\0' && (ok_alias_char(*s)||*s==','); ++s ) ;
  	if ( *s != '\0' ) {
! 	   lib_error(CATGETS(elm_msg_cat,
! 			     NewaliasSet, NewaliasCharNotSupported,
! 			     "Error - character '%c' in alias '%s' is not supported."),
  	        *s, aliases);
  	    return(-1);
  	}
  	return(0);
  }
  
! int check_address(addresses)
!      char *addresses;
  {
  
  	register char *s, *out;
***************
*** 492,510 ****
   *	up and doesn't display well at all.
   */
  	if (badws_flg) {
! 	    sprintf(msg_buff, catgets(elm_msg_cat,
! 	        NewaliasSet, NewaliasAddressWSNotAllowed,
! 	        "Error - whitespace in address '%.30s' is not allowed."),
  	        addresses);
- 	    error(msg_buff);
  	    return(-1);
  	}
  	return(0);
  }
  
! void
! put_alias(data)
! FILE *data;
  {
  /*
   *	parse the buffer into aliases, names, comments and addresses
--- 378,394 ----
   *	up and doesn't display well at all.
   */
  	if (badws_flg) {
! 	    lib_error(CATGETS(elm_msg_cat,
! 			      NewaliasSet, NewaliasAddressWSNotAllowed,
! 			      "Error - whitespace in address '%.30s' is not allowed."),
  	        addresses);
  	    return(-1);
  	}
  	return(0);
  }
  
! void put_alias(data)
!      FILE *data;
  {
  /*
   *	parse the buffer into aliases, names, comments and addresses
***************
*** 519,529 ****
   */
  	aliases = buffer;
  	if ((s = index(buffer, '=')) == NULL) {
! 	    sprintf(msg_buff, catgets(elm_msg_cat,
! 	            NewaliasSet, NewaliasNoFieldSep,
! 	            "Error - alias \"%.40s\" missing '=' field separator."),
  	        aliases);
- 	    error(msg_buff);
  	    err_flag++;
  	    return;
  	}
--- 403,412 ----
   */
  	aliases = buffer;
  	if ((s = index(buffer, '=')) == NULL) {
! 	    lib_error(CATGETS(elm_msg_cat,
! 			      NewaliasSet, NewaliasNoFieldSep,
! 			      "Error - alias \"%.40s\" missing '=' field separator."),
  	        aliases);
  	    err_flag++;
  	    return;
  	}
***************
*** 563,573 ****
  	}
  
  	if (*s != '=') {
! 	    sprintf(msg_buff, catgets(elm_msg_cat,
! 	            NewaliasSet, NewaliasNoFieldSep,
! 		    "Error - alias \"%.40s\" missing '=' field separator."),
! 		aliases);
! 	    error(msg_buff);
  	    err_flag++;
  	    return;
  	}
--- 446,455 ----
  	}
  
  	if (*s != '=') {
! 	    lib_error(CATGETS(elm_msg_cat,
! 			      NewaliasSet, NewaliasNoFieldSep,
! 			      "Error - alias \"%.40s\" missing '=' field separator."),
! 		      aliases);
  	    err_flag++;
  	    return;
  	}
***************
*** 670,679 ****
  	add_to_table(data, aliases, lastn, firstn, comment, addresses);
  }
  
! int
! do_newalias(inputname, dataname, fromelm, textwarn)
! char *inputname, *dataname;
! int fromelm, textwarn;
  {
  	FILE *in, *data;
  
--- 552,562 ----
  	add_to_table(data, aliases, lastn, firstn, comment, addresses);
  }
  
! static void delete_alias_files P_((char *, int)); /* Prototype */
! 
! int do_newalias(inputname, dataname, fromelm, textwarn)
!      char *inputname, *dataname;
!      int fromelm, textwarn;
  {
  	FILE *in, *data;
  
***************
*** 699,731 ****
  	if ((in = fopen(inputname,"r")) == NULL) {
  	    if ( textwarn )
  	    {
! 	        sprintf(msg_buff, catgets(elm_msg_cat,
! 	            NewaliasSet, NewaliasNoOpenIn,
! 	            "Couldn't open %s for input!"), inputname);
  	    }
  	    else {
  	        *msg_buff = '\0';
  	    }
- 	    error(msg_buff);
  	    free(buffer);
  	    return(-1);
  	}
  
  	if ((aliases_hash = dbz_fresh(dataname, 4999, 0, 0)) == NULL) {
! 	    MCsprintf(msg_buff, catgets(elm_msg_cat,
! 	            NewaliasSet, NewaliasNoOpendbz,
! 		    "Couldn't open %s.pag or %s.dir for output!"),
! 	        dataname, dataname);
! 	    error(msg_buff);
  	    free(buffer);
  	    return(-1);
  	}
  
  	if ((data = fopen(dataname, "w")) == NULL) {
! 	    sprintf(msg_buff, catgets(elm_msg_cat,
! 	            NewaliasSet, NewaliasNoOpenOut,
! 	            "Couldn't open %s for output!"), dataname);
! 	    error(msg_buff);
  	    free(buffer);
  	    return(-1);
  	}
--- 582,612 ----
  	if ((in = fopen(inputname,"r")) == NULL) {
  	    if ( textwarn )
  	    {
! 	       lib_error(CATGETS(elm_msg_cat,
! 				 NewaliasSet, NewaliasNoOpenIn,
! 				 "Couldn't open %s for input!"), 
! 			 inputname);
  	    }
  	    else {
  	        *msg_buff = '\0';
  	    }
  	    free(buffer);
  	    return(-1);
  	}
  
  	if ((aliases_hash = dbz_fresh(dataname, 4999, 0, 0)) == NULL) {
! 	    lib_error(CATGETS(elm_msg_cat,
! 			      NewaliasSet, NewaliasNoOpendbz,
! 			      "Couldn't open %s.pag or %s.dir for output!"),
! 		      dataname, dataname);
  	    free(buffer);
  	    return(-1);
  	}
  
  	if ((data = fopen(dataname, "w")) == NULL) {
! 	    lib_error(CATGETS(elm_msg_cat,
! 			      NewaliasSet, NewaliasNoOpenOut,
! 			      "Couldn't open %s for output!"), dataname);
  	    free(buffer);
  	    return(-1);
  	}
***************
*** 763,771 ****
  	/*NOTREACHED*/
  }
  
! delete_alias_files(dataname, fromelm)
! char *dataname;
! int fromelm;
  {
  /*
   *	This routine remove all the alias hash and data files.
--- 644,652 ----
  	/*NOTREACHED*/
  }
  
! static void delete_alias_files(dataname, fromelm)
!      char *dataname;
!      int fromelm;
  {
  /*
   *	This routine remove all the alias hash and data files.
***************
*** 776,808 ****
  	char fname[SLEN];
  
  	if (unlink(dataname)) {
! 	  sprintf(msg_buff,
! 		catgets(elm_msg_cat, NewaliasSet, NewaliasCouldntDeleteData,
! 		"Could not delete alias data file %s!"), fname);
! 	  error(msg_buff);
  	  if (fromelm && sleepmsg > 0)
  		sleep(sleepmsg);
  	}
  
! 	sprintf(fname,"%s.dir", dataname);
  	if (unlink(fname)) {
! 	  sprintf(msg_buff,
! 		catgets(elm_msg_cat, NewaliasSet, NewaliasCouldntDeleteHash,
! 		"Could not delete alias hash file %s!"), fname);
! 	  error(msg_buff);
  	  if (fromelm && sleepmsg > 0)
  		sleep(sleepmsg);
  	}
  
! 	sprintf(fname,"%s.pag", dataname);
  	if (unlink(fname)) {
! 	  sprintf(msg_buff,
! 		catgets(elm_msg_cat, NewaliasSet, NewaliasCouldntDeleteHash,
! 		"Could not delete alias hash file %s!"), fname);
! 	  error(msg_buff);
  	  if (fromelm && sleepmsg > 0)
! 		sleep(sleepmsg);
  	}
  
  }
  
--- 657,694 ----
  	char fname[SLEN];
  
  	if (unlink(dataname)) {
! 	  lib_error(
! 		    CATGETS(elm_msg_cat, NewaliasSet, 
! 			    NewaliasCouldntDeleteData,
! 			"Could not delete alias data file %s!"), 
! 		    fname);
  	  if (fromelm && sleepmsg > 0)
  		sleep(sleepmsg);
  	}
  
! 	elm_sfprintf(fname,sizeof fname,FRM("%s.dir"), dataname);
  	if (unlink(fname)) {
! 	  lib_error(
! 		    CATGETS(elm_msg_cat, NewaliasSet, 
! 			    NewaliasCouldntDeleteHash,
! 			    "Could not delete alias hash file %s!"), 
! 		    fname);
  	  if (fromelm && sleepmsg > 0)
  		sleep(sleepmsg);
  	}
  
! 	elm_sfprintf(fname,sizeof fname,FRM("%s.pag"), dataname);
  	if (unlink(fname)) {
! 	  lib_error(
! 		    CATGETS(elm_msg_cat, NewaliasSet, 
! 			    NewaliasCouldntDeleteHash,
! 			    "Could not delete alias hash file %s!"), fname);
  	  if (fromelm && sleepmsg > 0)
! 	    sleep(sleepmsg);
  	}
  
  }
+ 
+ 
+ 
  
Index: elm2.4.ME+.50/lib/mk_lockname.c
*** elm2.4.25/lib/mk_lockname.c	Sun Oct  4 01:42:26 1992
--- elm2.4.ME+.50/lib/mk_lockname.c	Tue Nov 17 21:12:56 1998
***************
*** 1,34 ****
  
! static char rcsid[] = "@(#)$Id: mk_lockname.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: mk_lockname.c,v $
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  #include <stdio.h>
  #include <fcntl.h>
  #include <errno.h>
! #include "defs.h"
  
  static char lock_name[SLEN];
  
  char * mk_lockname(file_to_lock)
! char *file_to_lock;
  {
        /** Create the proper name of the lock file for file_to_lock,
              which is presumed to be a spool file full path (see
--- 1,26 ----
  
! static char rcsid[] = "@(#)$Id: mk_lockname.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  #include <stdio.h>
  #include <fcntl.h>
  #include <errno.h>
! #include "headers.h"
  
  static char lock_name[SLEN];
  
  char * mk_lockname(file_to_lock)
!      char *file_to_lock;
  {
        /** Create the proper name of the lock file for file_to_lock,
              which is presumed to be a spool file full path (see
***************
*** 38,47 ****
  
  #ifdef XENIX
          /* lock is /tmp/[basename of file_to_lock].mlk */
!         sprintf(lock_name, "/tmp/%.10s.mlk", rindex(file_to_lock, '/')+1);
  #else
          /* lock is [file_to_lock].lock */
!         sprintf(lock_name, "%s.lock", file_to_lock);
  #endif
          return(lock_name);
  }
--- 30,41 ----
  
  #ifdef XENIX
          /* lock is /tmp/[basename of file_to_lock].mlk */
!         elm_sfprintf(lock_name, sizeof lock_name,
! 		     FRM("/tmp/%.10s.mlk"), rindex(file_to_lock, '/')+1);
  #else
          /* lock is [file_to_lock].lock */
!         elm_sfprintf(lock_name, sizeof lock_name,
! 		     FRM("%s.lock"), file_to_lock);
  #endif
          return(lock_name);
  }
Index: elm2.4.ME+.50/lib/move_left.c
*** elm2.4.25/lib/move_left.c	Sun Oct  4 01:42:26 1992
--- elm2.4.ME+.50/lib/move_left.c	Tue Nov 17 21:12:56 1998
***************
*** 1,23 ****
! static char rcsid[] = "@(#)$Id: move_left.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: move_left.c,v $
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,15 ----
! static char rcsid[] = "@(#)$Id: move_left.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 26,34 ****
  #include "headers.h"
  
  
! move_left(string, chars)
! char *string;
! int  chars;
  {
  	/** moves string chars characters to the left DESTRUCTIVELY **/
  
--- 18,26 ----
  #include "headers.h"
  
  
! void move_left(string, chars)
!      char *string;
!      int  chars;
  {
  	/** moves string chars characters to the left DESTRUCTIVELY **/
  
Index: elm2.4.ME+.50/lib/msgcat.c
*** elm2.4.25/lib/msgcat.c	Thu Jun 10 06:12:20 1993
--- elm2.4.ME+.50/lib/msgcat.c	Tue Nov 17 21:12:55 1998
***************
*** 1,5 ****
  
! static char rcsid[] = "@(#)$Id: msgcat.c,v 5.2 1993/06/10 03:12:10 syd Exp $";
  
  /* -*- c++ -*- */
  
--- 1,5 ----
  
! static char rcsid[] = "@(#)$Id: msgcat.c,v 1.1.1.1 1998/10/15 15:36:40 hurtta Exp $";
  
  /* -*- c++ -*- */
  
***************
*** 50,70 ****
   * to add an error handling routine.
   */
  
  #include "nl_types.h"
  #include "msgcat.h"
  
! #ifdef BSD
  #include <sys/file.h>
  #include <sys/param.h>
  #endif
  #include <sys/stat.h>
  #include <fcntl.h>
- #include <stdio.h>
  
- #ifdef MIPS
- #include <unistd.h>
- #endif
- 
  #ifndef True
  # define True	~0
  # define False	0
--- 50,70 ----
   * to add an error handling routine.
   */
  
+ #include "defs.h"
+ #include "elmlib.h"
+ 
+ /*
  #include "nl_types.h"
+ */
  #include "msgcat.h"
  
! #ifdef BSD_TYPE
  #include <sys/file.h>
  #include <sys/param.h>
  #endif
  #include <sys/stat.h>
  #include <fcntl.h>
  
  #ifndef True
  # define True	~0
  # define False	0
***************
*** 86,93 ****
  static nl_catd loadCat();
  static nl_catd loadSet();
  
- extern char *malloc(), *getenv();
-     
  nl_catd 	catopen( name, type)
  char *name;
  int type;
--- 86,91 ----
***************
*** 109,120 ****
  	    nlspath = "/nlslib/%L/%N.cat:/nlslib/%N/%L";
  	}
  	if (MCAppPath) {
! 	    tmppath = (char *) malloc(strlen(nlspath) + strlen(MCAppPath) + 3);
  	    if (!tmppath) return(NLERR);
! 	    strcpy(tmppath, nlspath);
  	    if (tmppath[strlen(tmppath)-1] != ':' && *MCAppPath != ':')
! 	      strcat(tmppath, ":");
! 	    strcat(tmppath, MCAppPath);
  	    nlspath = tmppath;
  	}
  	
--- 107,119 ----
  	    nlspath = "/nlslib/%L/%N.cat:/nlslib/%N/%L";
  	}
  	if (MCAppPath) {
! 	    int Len = strlen(nlspath) + strlen(MCAppPath) + 3;
! 	    tmppath = (char *) malloc(Len);
  	    if (!tmppath) return(NLERR);
! 	    strfcpy(tmppath, nlspath, Len);
  	    if (tmppath[strlen(tmppath)-1] != ':' && *MCAppPath != ':')
! 	      strfcat(tmppath, ":", Len);
! 	    strfcat(tmppath, MCAppPath, Len);
  	    nlspath = tmppath;
  	}
  	
***************
*** 121,127 ****
  	len = strlen(nlspath);
  	base = cptr = (char *) malloc(len + 2);
  	if (!base) return(NLERR);
! 	strcpy(cptr, nlspath);
  	cptr[len] = ':';
  	cptr[len+1] = '\0';
          
--- 120,126 ----
  	len = strlen(nlspath);
  	base = cptr = (char *) malloc(len + 2);
  	if (!base) return(NLERR);
! 	strfcpy(cptr, nlspath,len+2);
  	cptr[len] = ':';
  	cptr[len+1] = '\0';
          
***************
*** 132,145 ****
  		    if (*nlspath == '%') {
  			if (*(nlspath + 1) == 'L') {
  			    ++nlspath;
! 			    strcpy(pathP, lang);
! 			    pathP += strlen(lang);
  			} else if (*(nlspath + 1) == 'N') {
  			    ++nlspath;
! 			    strcpy(pathP, name);
! 			    pathP += strlen(name);
! 			} else *(pathP++) = *nlspath;
! 		    } else *(pathP++) = *nlspath;
  		}
  		*pathP = '\0';
  		if (stat(path, &sbuf) == 0) {
--- 131,148 ----
  		    if (*nlspath == '%') {
  			if (*(nlspath + 1) == 'L') {
  			    ++nlspath;
! 			    strfcpy(pathP, lang, 
! 				    sizeof path - (pathP-path));
! 			    pathP += strlen(pathP);
  			} else if (*(nlspath + 1) == 'N') {
  			    ++nlspath;
! 			    strfcpy(pathP, name,
! 				    sizeof path - (pathP-path));
! 			    pathP += strlen(pathP);
! 			} else if (pathP < path + sizeof path -1)
! 			  *(pathP++) = *nlspath;
! 		    } else if (pathP < path + sizeof path -1)
! 		      *(pathP++) = *nlspath;
  		}
  		*pathP = '\0';
  		if (stat(path, &sbuf) == 0) {
***************
*** 283,289 ****
      for (i = 0; i < cat->numSets; ++i) {
  	set = cat->sets + i;
  	if (!set->invalid) {
! 	    free(set->data);
  	    free(set->u.msgs);
  	}
      }
--- 286,292 ----
      for (i = 0; i < cat->numSets; ++i) {
  	set = cat->sets + i;
  	if (!set->invalid) {
! 	    free(set->data.ptr);
  	    free(set->u.msgs);
  	}
      }
Index: elm2.4.ME+.50/lib/ndbz.c
*** elm2.4.25/lib/ndbz.c	Fri Mar 11 23:34:01 1994
--- elm2.4.ME+.50/lib/ndbz.c	Tue Nov 17 21:12:55 1998
***************
*** 1,78 ****
! static char rcsid[] = "@(#)$Id: ndbz.c,v 5.12 1994/03/11 21:01:35 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: ndbz.c,v $
!  * Revision 5.12  1994/03/11  21:01:35  syd
!  * detect whether atol() is a macro
!  * From: Mitch DSouza <m.dsouza@mrc-applied-psychology.cambridge.ac.uk>
!  *
!  * Revision 5.11  1993/08/23  02:46:51  syd
!  * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX).
!  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
!  *
!  * Revision 5.10  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.9  1993/08/03  19:22:01  syd
!  * Add proper casts to free() calls to suppress warnings.
!  * Properly cast return types.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.8  1993/07/20  02:59:53  syd
!  * Support aliases both on 64 bit and 32 bit machines at the same time.
!  * From: Dan Mosedale <mosedale@genome.stanford.edu>
!  *
!  * Revision 5.7  1993/06/09  23:41:34  syd
!  * Add frees of db structure on failed dbz_open
!  * From: Syd
!  *
!  * Revision 5.6  1993/02/08  00:18:11  syd
!  * fix taghere to be || instead of | and paren to make
!  * it catch duplicates again, as per testing.
!  * From: Syd and Chip Rosenthal
!  *
!  * Revision 5.5  1993/02/03  15:26:13  syd
!  * protect atol in ifndef __STDC__ as some make it a macro, and its in stdlib.h
!  *
!  * Revision 5.4  1993/01/27  20:40:10  syd
!  * make code match cnews dbz, remove extra | taghere in search,
!  * that was causing a compiler error anyway, as improper code
!  * From: Syd, via prompt from Denis Lambot
!  *
!  * Revision 5.3  1992/12/12  01:29:26  syd
!  * Fix double inclusion of sys/types.h
!  * From: Tom Moore <tmoore@wnas.DaytonOH.NCR.COM>
!  *
!  * Revision 5.2  1992/10/11  01:46:35  syd
!  * change dbm name to dbz to avoid conflicts with partial call
!  * ins from shared librarys, and from mixing code with yp code.
!  * From: Syd via prompt from Jess Anderson
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  	multi-database dbm replacement
--- 1,15 ----
! static char rcsid[] = "@(#)$Id: ndbz.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  	multi-database dbm replacement
***************
*** 302,311 ****
   */
  DBZ *				/* NULL for failure, !NULL for success */
  dbz_fresh(name, size, fs, tagmask)
! char *name;			/* base name; .dir and .pag must exist */
! long size;			/* table size (0 means default) */
! int fs;				/* field-separator character in base file */
! of_t tagmask;			/* 0 default, 1 no tags */
  {
  	register char *fn;
  	struct dbzconfig c;
--- 239,248 ----
   */
  DBZ *				/* NULL for failure, !NULL for success */
  dbz_fresh(name, size, fs, tagmask)
!      char *name;		/* base name; .dir and .pag must exist */
!      long size;			/* table size (0 means default) */
!      int fs;		        /* field-separator character in base file */
!      of_t tagmask;		/* 0 default, 1 no tags */
  {
  	register char *fn;
  	struct dbzconfig c;
***************
*** 383,391 ****
  /*
   - dbz_size - what's a good table size to hold this many entries?
   */
! long
! dbzsize(contents)
! long contents;			/* 0 means what's the default */
  {
  	register long n;
  
--- 320,327 ----
  /*
   - dbz_size - what's a good table size to hold this many entries?
   */
! long dbzsize(contents)
!      long contents;			/* 0 means what's the default */
  {
  	register long n;
  
***************
*** 444,451 ****
   */
  DBZ *				/* NULL for failure, !NULL for success */
  dbz_again(name, oldname)
! char *name;			/* base name; .dir and .pag must exist */
! char *oldname;			/* base name; all must exist */
  {
  	register char *fn;
  	struct dbzconfig c;
--- 380,387 ----
   */
  DBZ *				/* NULL for failure, !NULL for success */
  dbz_again(name, oldname)
!      char *name;		/* base name; .dir and .pag must exist */
!      char *oldname;	        /* base name; all must exist */
  {
  	register char *fn;
  	struct dbzconfig c;
***************
*** 672,682 ****
  char *s2;
  {
  	register char *p;
  
! 	p = malloc((size_t)strlen(s1) + (size_t)strlen(s2) + 1);
  	if (p != NULL) {
! 		(void) strcpy(p, s1);
! 		(void) strcat(p, s2);
  	} else {
  		dprint(5, (debugfile, "enstring(%s, %s) out of memory\n", s1, s2));
  	}
--- 608,619 ----
  char *s2;
  {
  	register char *p;
+ 	size_t Len = strlen(s1) + strlen(s2) + 1;
  
! 	p = malloc(Len);
  	if (p != NULL) {
! 		(void) strfcpy(p, s1, Len);
! 		(void) strfcat(p, s2, Len);
  	} else {
  		dprint(5, (debugfile, "enstring(%s, %s) out of memory\n", s1, s2));
  	}
***************
*** 686,694 ****
  /*
   - dbz_close - close a database
   */
! int
! dbz_close(db)
! register DBZ *db;
  {
  	register int ret = 0;
  
--- 623,630 ----
  /*
   - dbz_close - close a database
   */
! int dbz_close(db)
!      DBZ *db;
  {
  	register int ret = 0;
  
***************
*** 732,740 ****
  /*
   - dbz_sync - push all in-core data out to disk
   */
! int
! dbz_sync(db)
! register DBZ *db;
  {
  	register int ret = 0;
  
--- 668,675 ----
  /*
   - dbz_sync - push all in-core data out to disk
   */
! int dbz_sync(db)
!      DBZ *db;
  {
  	register int ret = 0;
  
***************
*** 787,794 ****
   */
  datum				/* dptr NULL, dsize 0 means failure */
  dbz_fetch(db, key)
! register DBZ *db;
! datum key;
  {
  	char buffer[DBZMAXKEY + 1];
  	static of_t key_ptr;		/* return value points here */
--- 722,729 ----
   */
  datum				/* dptr NULL, dsize 0 means failure */
  dbz_fetch(db, key)
!      DBZ *db;
!      datum key;
  {
  	char buffer[DBZMAXKEY + 1];
  	static of_t key_ptr;		/* return value points here */
***************
*** 890,898 ****
   */
  int				/* 0 success, -1 failure */
  dbz_store(db, key, data)
! register DBZ *db;
! datum key;
! datum data;
  {
  	of_t value;
  
--- 825,833 ----
   */
  int				/* 0 success, -1 failure */
  dbz_store(db, key, data)
!      DBZ *db;
!      datum key;
!      datum data;
  {
  	of_t value;
  
***************
*** 942,948 ****
   */
  int				/* old setting */
  dbz_incore(value)
! int value;
  {
  	register int old = default_incore;
  
--- 877,883 ----
   */
  int				/* old setting */
  dbz_incore(value)
!      int value;
  {
  	register int old = default_incore;
  
Index: elm2.4.ME+.50/lib/okay_addr.c
*** elm2.4.25/lib/okay_addr.c	Sun Oct  4 01:42:27 1992
--- elm2.4.ME+.50/lib/okay_addr.c	Tue Nov 17 21:12:56 1998
***************
*** 1,23 ****
! static char rcsid[] = "@(#)$Id: okay_addr.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: okay_addr.c,v $
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,15 ----
! static char rcsid[] = "@(#)$Id: okay_addr.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 26,34 ****
  #include "headers.h"
  
  
! int
! okay_address(address, return_address)
! char *address, *return_address;
  {
  	/** This routine checks to ensure that the address we just got
  	    from the "To:" or "Cc:" line isn't us AND isn't the person	
--- 18,25 ----
  #include "headers.h"
  
  
! int okay_address(address, return_address)
!      char *address, *return_address;
  {
  	/** This routine checks to ensure that the address we just got
  	    from the "To:" or "Cc:" line isn't us AND isn't the person	
***************
*** 43,61 ****
  	if(in_list(address, username))
  	  return(FALSE);
  
! 	sprintf(our_address, "%s!%s", hostname, username);
  	if (in_list(address, our_address))
  	  return(FALSE);
  
! 	sprintf(our_address, "%s!%s", hostfullname, username);
  	if (in_list(address, our_address))
  	  return(FALSE);
  
! 	sprintf(our_address, "%s@%s", username, hostname);
  	if (in_list(address, our_address))
  	  return(FALSE);
  
! 	sprintf(our_address, "%s@%s", username, hostfullname);
  	if (in_list(address, our_address))
  	  return(FALSE);
  
--- 34,56 ----
  	if(in_list(address, username))
  	  return(FALSE);
  
! 	elm_sfprintf(our_address, sizeof our_address,
! 		     FRM("%s!%s"), hostname, username);
  	if (in_list(address, our_address))
  	  return(FALSE);
  
! 	elm_sfprintf(our_address, sizeof our_address,
! 		     FRM("%s!%s"), hostfullname, username);
  	if (in_list(address, our_address))
  	  return(FALSE);
  
! 	elm_sfprintf(our_address, sizeof our_address, 
! 		     FRM("%s@%s"), username, hostname);
  	if (in_list(address, our_address))
  	  return(FALSE);
  
! 	elm_sfprintf(our_address, sizeof our_address,
! 		     FRM("%s@%s"), username, hostfullname);
  	if (in_list(address, our_address))
  	  return(FALSE);
  
***************
*** 69,71 ****
--- 64,67 ----
  
  	return(TRUE);
  }
+ 
Index: elm2.4.ME+.50/lib/opt_utils.c
*** elm2.4.25/lib/opt_utils.c	Mon May 30 19:31:56 1994
--- elm2.4.ME+.50/lib/opt_utils.c	Tue Nov 17 21:12:56 1998
***************
*** 1,69 ****
  
! static char rcsid[] = "@(#)$Id: opt_utils.c,v 5.9 1994/05/30 16:31:40 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.9 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: opt_utils.c,v $
!  * Revision 5.9  1994/05/30  16:31:40  syd
!  * make getpwuid dependent on ANSI_C not posix flag
!  * From: Syd
!  *
!  * Revision 5.8  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.7  1993/01/20  03:02:19  syd
!  * Move string declarations to defs.h
!  * From: Syd
!  *
!  * Revision 5.6  1993/01/19  05:07:05  syd
!  * Trim erroreous extra log entry
!  * From: Syd
!  *
!  * Revision 5.5  1993/01/19  04:47:12  syd
!  * Significant changes to provide consistent Date and From_ header
!  * cracking.  Overhauled date utilities and moved into library.  Moved
!  * real_from() into library.  Modified frm, newmail, and readmsg utilities
!  * to use library version of real_from().  Moved get_word() from Elm
!  * source into library.  Added new library routines atonum() and strfcpy().
!  * Fixed trailing backslash bug in len_next().
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.4  1992/12/12  01:29:26  syd
!  * Fix double inclusion of sys/types.h
!  * From: Tom Moore <tmoore@wnas.DaytonOH.NCR.COM>
!  *
!  * Revision 5.3  1992/10/30  21:49:38  syd
!  * Add init of buf
!  * From: Syd via request from hessmann@unipas.fmi.uni-passau.de (Georg Hessmann)
!  *
!  * Revision 5.2  1992/10/24  13:06:23  syd
!  * make getdomainname optional
!  * From: Syd
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** This file contains routines that might be needed for the various
       machines that the mailer can run on.  Please check the Makefile
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: opt_utils.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** This file contains routines that might be needed for the various
       machines that the mailer can run on.  Please check the Makefile
***************
*** 88,96 ****
  
  #ifndef GETHOSTNAME
  
! gethostname(cur_hostname,size) /* get name of current host */
! char *cur_hostname;
! int size;
  {
  	/** Return the name of the current host machine. **/
  
--- 35,43 ----
  
  #ifndef GETHOSTNAME
  
! int gethostname(cur_hostname,size) /* get name of current host */
!      char *cur_hostname;
!      int size;
  {
  	/** Return the name of the current host machine. **/
  
***************
*** 133,141 ****
  #endif  /* GETHOSTNAME */
  
  
! gethostdomain(hostdom, size)    /* get domain of current host */
! char *hostdom;
! int size;
  {
  	char    buf[64];
  	FILE    *fp;
--- 80,88 ----
  #endif  /* GETHOSTNAME */
  
  
! int gethostdomain(hostdom, size)    /* get domain of current host */
!      char *hostdom;
!      int size;
  {
  	char    buf[64];
  	FILE    *fp;
***************
*** 202,208 ****
      if (returnonly) {
        return(name);
      } else {
!       strcpy(uname, name);
        return name;
      }
    } 
--- 149,155 ----
      if (returnonly) {
        return(name);
      } else {
!       strfcpy(uname, name, L_cuserid);
        return name;
      }
    } 
***************
*** 215,221 ****
  	  }
  	else 
  	  {
! 	    strcpy(uname, password_entry->pw_name);
  	    return name;
  	  }
        } 
--- 162,168 ----
  	  }
  	else 
  	  {
! 	    strfcpy(uname, password_entry->pw_name, L_cuserid);
  	    return name;
  	  }
        } 
***************
*** 231,237 ****
  #ifndef STRTOK
  
  char *strtok(source, keys)
! char *source, *keys;
  {
  	/** This function returns a pointer to the next word in source
  	    with the string considered broken up at the characters 
--- 178,184 ----
  #ifndef STRTOK
  
  char *strtok(source, keys)
!      char *source, *keys;
  {
  	/** This function returns a pointer to the next word in source
  	    with the string considered broken up at the characters 
***************
*** 280,286 ****
  #ifndef STRPBRK
  
  char *strpbrk(source, keys)
! char *source, *keys;
  {
  	/** Returns a pointer to the first character of source that is any
  	    of the specified keys, or NULL if none of the keys are present
--- 227,233 ----
  #ifndef STRPBRK
  
  char *strpbrk(source, keys)
!      char *source, *keys;
  {
  	/** Returns a pointer to the first character of source that is any
  	    of the specified keys, or NULL if none of the keys are present
***************
*** 302,309 ****
  
  #ifndef STRSPN
  
! strspn(source, keys)
! char *source, *keys;
  {
  	/** This function returns the length of the substring of
  	    'source' (starting at zero) that consists ENTIRELY of
--- 249,256 ----
  
  #ifndef STRSPN
  
! int strspn(source, keys)
!      char *source, *keys;
  {
  	/** This function returns the length of the substring of
  	    'source' (starting at zero) that consists ENTIRELY of
***************
*** 328,335 ****
  
  #ifndef STRCSPN
  
! strcspn(source, keys)
! char *source, *keys;
  {
  	/** This function returns the length of the substring of
  	    'source' (starting at zero) that consists entirely of
--- 275,282 ----
  
  #ifndef STRCSPN
  
! int strcspn(source, keys)
!      char *source, *keys;
  {
  	/** This function returns the length of the substring of
  	    'source' (starting at zero) that consists entirely of
***************
*** 358,367 ****
  static int cnt = 0;
  
  char *tempnam( dir, pfx)
!  char *dir, *pfx;
  {
  	char space[SLEN];
  	char *newspace;
  
  	if (dir == NULL) {
  		dir = "/usr/tmp";
--- 305,315 ----
  static int cnt = 0;
  
  char *tempnam( dir, pfx)
!      char *dir, *pfx;
  {
  	char space[SLEN];
  	char *newspace;
+ 	int Len;
  
  	if (dir == NULL) {
  		dir = "/usr/tmp";
***************
*** 373,384 ****
  		pfx = "";
  	}
  
! 	sprintf(space, "%s%s%d.%d", dir, pfx, getpid(), cnt);
  	cnt++;
  	
! 	newspace = malloc(strlen(space) + 1);
  	if (newspace != NULL) {
! 		strcpy(newspace, space);
  	}
  	return newspace;
  }
--- 321,334 ----
  		pfx = "";
  	}
  
! 	elm_sfprintf(space, sizeof space,
! 		     FRM("%s%s%d.%d"), dir, pfx, getpid(), cnt);
  	cnt++;
  	
! 	Len = strlen(space) + 1;
! 	newspace = malloc(Len);
  	if (newspace != NULL) {
! 		strfcpy(newspace, space, Len);
  	}
  	return newspace;
  }
***************
*** 405,414 ****
  int	optopt;
  char	*optarg;
  
! int
! getopt(argc, argv, opts)
! int	argc;
! char	**argv, *opts;
  {
  	static int sp = 1;
  	register int c;
--- 355,363 ----
  int	optopt;
  char	*optarg;
  
! int getopt(argc, argv, opts)
!      int	argc;
!      char	**argv, *opts;
  {
  	static int sp = 1;
  	register int c;
Index: elm2.4.ME+.50/lib/parsarpdat.c
*** elm2.4.25/lib/parsarpdat.c	Tue Aug  3 22:28:55 1993
--- elm2.4.ME+.50/lib/parsarpdat.c	Tue Nov 17 21:12:55 1998
***************
*** 1,39 ****
  
! static char rcsid[] = "@(#)$Id: parsarpdat.c,v 5.3 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
   *
!  * 			Copyright (c) 1993 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: parsarpdat.c,v $
!  * Revision 5.3  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.2  1993/04/12  02:16:32  syd
!  * Fix year handling bug in date(1) time formats.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.1  1993/01/19  04:46:21  syd
!  * Initial Checkin
   *
!  *
!  ******************************************************************************/
  
  
  #include "headers.h"
--- 1,15 ----
  
! static char rcsid[] = "@(#)$Id: parsarpdat.c,v 1.2 1998/10/20 19:57:47 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  * 			Copyright (c) 1993 USENET Community Trust
!  *****************************************************************************/
  
  
  #include "headers.h"
***************
*** 77,238 ****
  						 ;  hours+min. (HHMM)
  */
  
! 
! int parse_arpa_date(str, entry)
! char *str;
! struct header_rec *entry;
  {
!     /*
!      * Parse a date field in either RFC-822 or Unix date(1) format.
!      * We will fill in the "time_zone", "tz_offset", and "time_sent"
!      * parts of the "entry" structure.  Return TRUE on success, FALSE
!      * on failure.
!      */
! 
!     char field[STRING], save_tz[STRING];
!     int month, day, year, hours, mins, secs, tz, len, i;
! 
      /*
!      * Since this is an RFC-822 field, there might be parenthetical
!      * comments.  Yank them out.  Note that strip_parens() returns
!      * a pointer to static data.
       */
!     str = strip_parens(str);
! 
      /*
!      * The first field is an optional day of the week.  If it exists
!      * it is supposed to have a trailing comma by RFC-822, but we won't
!      * complain if it doesn't.  If the date string was generated by
!      * the Unix date(1) command then it won't have the comma.  We don't
!      * do anything with this information, just skip over it if it exists.
       */
-     if ((len = get_word(str, 0, field, sizeof(field))) < 0)
- 	goto failed;
-     if (cvt_dayname_to_daynum(field, &i))
- 	str += len;
  
!     /*
!      * Peek at the next character to determine what format to
!      * parse the rest of the line as.
!      */
!     while (isspace(*str))
! 	++str;
!     if (!isdigit(*str)) {
! 
! 	/*
! 	 * Parse the line in Unix date(1) format.  The syntax is:
! 	 *
! 	 *	month day hh:mm:ss [tz] year
! 	 *
! 	 * e.g. "Jun 21 06:45:44 CDT 1989".  The timezone is optional.
! 	 */
! 
! 	dprint(7, (debugfile,
! 	    "parse_arpa_date parsing \"%s\" in time(1) format\n", str));
! 
! 	/* <month> */
! 	if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 		!cvt_monthname_to_monthnum(field, &month))
! 	    goto failed;
! 	str += len;
! 
! 	/* <day> */
! 	if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 		(day = atonum(field)) < 0)
! 	    goto failed;
! 	str += len;
! 
! 	/* <hh:mm:ss> */
! 	if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 		!cvt_timestr_to_hhmmss(field, &hours, &mins, &secs))
! 	    goto failed;
! 	str += len;
! 
! 	/* optional <tz> */
! 	save_tz[0] = save_tz[1] = '\0';
! 	tz = 0;
! 	while ((len = get_word(str, 0, field, sizeof(field))) > 0 &&
! 		cvt_timezone_to_offset(field, &i)) {
! 	    (void) strcat(save_tz, " ");
! 	    (void) strcat(save_tz, field);
! 	    tz += i;
! 	    str += len;
! 	}
! 
! 	/* <year> */
! 	if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 		(year = atonum(field)) < 0)
! 	    goto failed;
! 	str += len;
! 
! 	/* there might be more...but we ignore it */
! 
!     } else {
! 
! 	/*
! 	 * Parse the line in RFC-822 format.  The syntax is:
! 	 *
! 	 *	day month year hh:mm:ss zone
! 	 *
! 	 * e.g. "17 Nov 92 23:34:25 CST".
! 	 */
! 
! 	dprint(7, (debugfile,
! 	    "parse_arpa_date parsing \"%s\" in RFC-822 format\n", str));
! 
! 	/* <day> */
! 	if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 		(day = atonum(field)) < 0)
! 	    goto failed;
! 	str += len;
! 
! 	/* <month> */
! 	if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 		!cvt_monthname_to_monthnum(field, &month))
! 	    goto failed;
! 	str += len;
! 
! 	/* <year> */
! 	if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 		!cvt_yearstr_to_yearnum(field, &year))
! 	    goto failed;
! 	str += len;
! 
! 	/* <hh:mm:ss> */
! 	if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 		!cvt_timestr_to_hhmmss(field, &hours, &mins, &secs))
! 	    goto failed;
! 	str += len;
! 
! 	/* <tz> - silently ignore bogus or missing timezones */
! 	save_tz[0] = save_tz[1] = '\0';
! 	tz = 0;
! 	while ((len = get_word(str, 0, field, sizeof(field))) > 0 &&
! 		cvt_timezone_to_offset(field, &i)) {
! 	    (void) strcat(save_tz, " ");
! 	    (void) strcat(save_tz, field);
! 	    tz += i;
! 	    str += len;
! 	}
  
! 	/* there might be more...but we ignore it */
  
!     }
  
!     strfcpy(entry->time_zone, save_tz+1, sizeof(entry->time_zone));
!     entry->tz_offset = tz*60;
!     entry->time_sent = make_gmttime(year, month, day, hours, mins-tz, secs);
  
      dprint(7, (debugfile, "  year=%d month=%d day=%d\n", year, month, day));
      dprint(7, (debugfile, "  hours=%d mins=%d secs=%d tz=%d\n",
  	hours, mins, secs, tz));
      dprint(7, (debugfile, "  return success\n"));
      return TRUE;
  
  failed:
!     dprint(4, (debugfile, "parse_arpa_date failed at \"%s\"\n",
  	(len <= 0 ? "<premature eol>" : field)));
      return FALSE;
  }
  
  #ifdef _TEST
--- 53,252 ----
  						 ;  hours+min. (HHMM)
  */
  
! int parse_date_time(str,time_zone,size_time_zone,tz_offset, time_result)
!      const char *str;
!      char *time_zone; 
!      int size_time_zone;
!      time_t *tz_offset; 
!      time_t *time_result; 
  {
!   /*
!    * Parse a date field in either RFC-822 or Unix date(1) format.
!    */
! 
!   char field[STRING], save_tz[STRING];
!   int month, day, year, hours, mins, secs, tz, len, i;
!   
!   /*
!    * Since this is an RFC-822 field, there might be parenthetical
!    * comments.  Yank them out.  Note that strip_parens() returns
!    * a pointer to static data.
!    */
!   str = strip_parens(str);
! 
!   /*
!    * The first field is an optional day of the week.  If it exists
!    * it is supposed to have a trailing comma by RFC-822, but we won't
!    * complain if it doesn't.  If the date string was generated by
!    * the Unix date(1) command then it won't have the comma.  We don't
!    * do anything with this information, just skip over it if it exists.
!    */
!   if ((len = get_word(str, 0, field, sizeof(field))) < 0)
!     goto failed;
!   if (cvt_dayname_to_daynum(field, &i))
!     str += len;
! 
!   /*
!    * Peek at the next character to determine what format to
!    * parse the rest of the line as.
!    */
!   while (isspace(*str))
!     ++str;
!   if (!isdigit(*str)) {
!     
      /*
!      * Parse the line in Unix date(1) format.  The syntax is:
!      *
!      *	month day hh:mm:ss [tz] year
!      *
!      * e.g. "Jun 21 06:45:44 CDT 1989".  The timezone is optional.
       */
!     
!     dprint(7, (debugfile,
! 	       "parse_date_time parsing \"%s\" in time(1) format\n", str));
!     
!     /* <month> */
!     if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 	!cvt_monthname_to_monthnum(field, &month))
!       goto failed;
!     str += len;
!     
!     /* <day> */
!     if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 	(day = atonum(field)) < 0)
!       goto failed;
!     str += len;
!     
!     /* <hh:mm:ss> */
!     if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 	!cvt_timestr_to_hhmmss(field, &hours, &mins, &secs))
!       goto failed;
!     str += len;
!     
!     /* optional <tz> */
!     save_tz[0] = save_tz[1] = '\0';
!     tz = 0;
!     while ((len = get_word(str, 0, field, sizeof(field))) > 0 &&
! 	   cvt_timezone_to_offset(field, &i, sizeof field)) {
!       (void) strfcat(save_tz, " ", sizeof save_tz);
!       (void) strfcat(save_tz, field, sizeof save_tz);
!       tz += i;
!       str += len;
!     }
!     
!     /* <year> */
!     if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 	(year = atonum(field)) < 0)
!       goto failed;
!     str += len;
!     
!     /* there might be more...but we ignore it */
!     
!   } else {
!     
      /*
!      * Parse the line in RFC-822 format.  The syntax is:
!      *
!      *	day month year hh:mm:ss zone
!      *
!      * e.g. "17 Nov 92 23:34:25 CST".
       */
  
!     dprint(7, (debugfile,
! 	       "parse_date_time parsing \"%s\" in RFC-822 format\n", str));
!     
!     /* <day> */
!     if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 	(day = atonum(field)) < 0)
!       goto failed;
!     str += len;
!     
!     /* <month> */
!     if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 	!cvt_monthname_to_monthnum(field, &month))
!       goto failed;
!     str += len;
! 
!     /* <year> */
!     if ((len = get_word(str, 0, field, sizeof(field))) < 0 ||
! 	!cvt_yearstr_to_yearnum(field, &year))
!       goto failed;
!     str += len;
! 
!     /* <hh:mm:ss> */
!     if ((len = get_word(str, 0, field, sizeof(field))) < 0) {
!       /* on expires header there is no necessary time -part */
!       save_tz[0] = save_tz[1] = '\0';
!       tz = 0;
!       hours = 0;
!       mins = 0;
!       secs = 0;
!       dprint(7, (debugfile, "  only date given (no time and timezone)\n"));
!       goto notime;
!     }
!     if (!cvt_timestr_to_hhmmss(field, &hours, &mins, &secs))
!       goto failed;
!     str += len;
!     
!     /* <tz> - silently ignore bogus or missing timezones */
!     save_tz[0] = save_tz[1] = '\0';
!     tz = 0;
!     while ((len = get_word(str, 0, field, sizeof(field))) > 0 &&
! 	   cvt_timezone_to_offset(field, &i, sizeof field)) {
!       (void) strfcat(save_tz, " ", sizeof save_tz);
!       (void) strfcat(save_tz, field, sizeof save_tz);
!       tz += i;
!       str += len;
!     }
!     
!     /* there might be more...but we ignore it */
  
!   }
  
! notime:
  
!   if (time_zone)
!     strfcpy(time_zone, save_tz+1, size_time_zone);
!   if (tz_offset)
!     *tz_offset = tz*60;
!   *time_result = make_gmttime(year, month, day, hours, mins-tz, secs);
  
      dprint(7, (debugfile, "  year=%d month=%d day=%d\n", year, month, day));
      dprint(7, (debugfile, "  hours=%d mins=%d secs=%d tz=%d\n",
  	hours, mins, secs, tz));
+     dprint(7, (debugfile, "  time_result=%ld\n",(long)*time_result));
      dprint(7, (debugfile, "  return success\n"));
      return TRUE;
  
  failed:
!     dprint(4, (debugfile, "parse_date_time failed at \"%s\"\n",
  	(len <= 0 ? "<premature eol>" : field)));
      return FALSE;
+ 
+ }
+ 
+ int parse_arpa_date(src, entry)
+      char *src;
+      struct header_rec *entry;
+ {
+     /*
+      * Parse a date field in either RFC-822 or Unix date(1) format.
+      * We will fill in the "time_zone", "tz_offset", and "time_sent"
+      * parts of the "entry" structure.  Return TRUE on success, FALSE
+      * on failure.
+      */
+ 
+ 
+   if (parse_date_time(src,
+ 		      entry->time_zone,sizeof(entry->time_zone),
+ 		      &(entry->tz_offset), &(entry->time_sent))) {
+     dprint(7, (debugfile,
+ 	       "parse_arpa_date SUCCESS for %s\n",src));
+     return TRUE;
+   }
+   dprint(7, (debugfile,
+ 	     "parse_arpa_date failed for %s\n",src));
+   return FALSE;
  }
  
  #ifdef _TEST
Index: elm2.4.ME+.50/lib/parsarpwho.c
*** elm2.4.25/lib/parsarpwho.c	Tue Jul 20 05:06:41 1993
--- elm2.4.ME+.50/lib/parsarpwho.c	Tue Nov 17 21:12:55 1998
***************
*** 1,41 ****
  
! static char rcsid[] = "@(#)$Id: parsarpwho.c,v 5.4 1993/07/20 02:06:13 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: parsarpwho.c,v $
!  * Revision 5.4  1993/07/20  02:06:13  syd
!  * Changes for vms problem
!  * From: M.  Anio
!  *
!  * Revision 5.3  1993/01/19  05:07:05  syd
!  * Trim erroreous extra log entry
!  * From: Syd
!  *
!  * Revision 5.2  1993/01/19  04:47:12  syd
!  * Significant changes to provide consistent Date and From_ header
!  * cracking.  Overhauled date utilities and moved into library.  Moved
!  * real_from() into library.  Modified frm, newmail, and readmsg utilities
!  * to use library version of real_from().  Moved get_word() from Elm
!  * source into library.  Added new library routines atonum() and strfcpy().
!  * Fixed trailing backslash bug in len_next().
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,12 ----
  
! static char rcsid[] = "@(#)$Id: parsarpwho.c,v 1.1.1.1 1998/10/15 15:36:39 hurtta Exp $";
  
! /******************************************************************************
   *
+  * This code is reimpleted. Original code was following copyright:
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 43,155 ****
  
  #include "headers.h"
  
! parse_arpa_who(buffer, newfrom, is_really_a_to)
! char *buffer, *newfrom;
! int is_really_a_to;
  {
! 	/** try to parse the 'From:' line given... It can be in one of
! 	    two formats:
! 		From: Dave Taylor <hplabs!dat>
! 	    or  From: hplabs!dat (Dave Taylor)
! 
! 	    Added: removes quotes if name is quoted (12/12)
! 	     HOWEVER:  From: "NAME \"VMS USER\"" <USER@VMS>
! 	           must be handled delicately !
! 	    Added: only copies STRING characters...
! 	    Added: if no comment part, copy address instead! 
! 	    Added: if is_really_a_to, this is really a 'to' line
! 		   and treat as if we allow embedded addresses
! 	**/
! 
! 	int use_embedded_addresses;
! 	char temp_buffer[LONG_STRING], *temp;
! 	register int i, j = 0, in_parens;
! 
! 	temp = (char *) temp_buffer;
! 	temp[0] = '\0';
! 
! 	no_ret(buffer);		/* blow away '\n' char! */
! 
! 	if (lastch(buffer) == '>') {
! 	  for (i=strlen("From: "); buffer[i] != '\0' && buffer[i] != '<' &&
! 	       buffer[i] != '('; i++)
! 	    temp[j++] = buffer[i];
! 	  temp[j] = '\0';
! 	}
! 	else if (lastch(buffer) == ')') {
! 	  in_parens = 1;
! 	  for (i=strlen(buffer)-2; buffer[i] != '\0' && buffer[i] != '<'; i--) {
! 	    switch(buffer[i]) {
! 	    case ')':	in_parens++;
! 			break;
! 	    case '(':	in_parens--;
! 			break;
! 	    }
! 	    if(!in_parens) break;
! 	    temp[j++] = buffer[i];
! 	  }
! 	  temp[j] = '\0';
! 	  reverse(temp);
! 	}
! 
! #ifdef USE_EMBEDDED_ADDRESSES
! 	use_embedded_addresses = TRUE;
! #else
! 	use_embedded_addresses = FALSE;
! #endif
! 
! 	if(use_embedded_addresses || is_really_a_to) {
! 	  /** if we have a null string at this point, we must just have a 
! 	      From: line that contains an address only.  At this point we
! 	      can have one of a few possibilities...
! 
! 		  From: address
! 		  From: <address>
! 		  From: address ()
! 	  **/
! 	    
! 	  if (strlen(temp) == 0) {
! 	    if (lastch(buffer) != '>') {       
! 	      for (i=strlen("From:");buffer[i] != '\0' && buffer[i] != '('; i++)
! 		temp[j++] = buffer[i];
! 	      temp[j] = '\0';
! 	    }
! 	    else {	/* get outta '<>' pair, please! */
! 	      for (i=strlen(buffer)-2;buffer[i] != '<' && buffer[i] != ':';i--)
! 		temp[j++] = buffer[i];
! 	      temp[j] = '\0';
! 	      reverse(temp);
! 	    }
! 	  }
! 	}
! 	  
! 	if (strlen(temp) > 0) {		/* mess with buffer... */
! 
! 	  /* remove leading spaces and ONE quote... */
! 
! 	  while (whitespace(temp[0]))
! 	    temp = (char *) (temp + 1);		/* increment address! */
! 	  if (temp[0] == '"')
! 	    temp = (char *) (temp + 1);		/* increment address! */
! 	  while (whitespace(temp[0]))
! 	    temp = (char *) (temp + 1);		/* increment address! */
! 
! 	  /* remove trailing spaces and ONE quote... */
! 
! 	  i = strlen(temp) - 1;
! 
! 	  while (i >= 0 && (whitespace(temp[i])))
! 	   temp[i--] = '\0';
! 	  /* Can delete ONE trailing quote, NOT THEM ALL!
! 	     Assuming the incoming quotes were all right.. [mea@utu.fi] */
! 	  if (i >= 0 && temp[i] == '"')
! 	   temp[i--] = '\0';
! 	  while (i >= 0 && (whitespace(temp[i])))
! 	   temp[i--] = '\0';
! 
! 	  /* if anything is left, let's change 'from' value! */
! 
! 	  if (strlen(temp) > 0)
! 	    strfcpy(newfrom, temp, STRING);
! 	}
  }
--- 14,71 ----
  
  #include "headers.h"
  
! void decode_who_none (class,bfr, size)
!      int class;
!      char *bfr;
!      int size;
! {
!   if (class != 0) {
!     bfr++;
!     size--;
!   }
!   return;
! }
! 
! /* This perhaps should go away.   - K E H <hurtta@ozone.FMI.FI> */
! 
! void parse_arpa_who(buffer, newfrom, decoder, size)
!      char *buffer, *newfrom;
!      decode_who decoder;
!      int size;
  {
! 
!   struct addr_item * list;
! 
!   dprint(12,(debugfile,
! 	     "parse_arpa_who: buffer=%.100s, newfrom=%.100s, size=%d\n",
! 	     buffer,newfrom,size));
! 
!   no_ret(buffer);		/* blow away '\n' char! */
! 
!   list = break_down_address(buffer,decoder);
! 	
!   if (list) {
!     struct addr_item * ptr;
! 
!     for (ptr=list; ptr->addr; ptr++) {
!       char * t = ptr->fullname;
!       if (!t[0])
! 	t = ptr->addr;
!       if (ptr == list)
! 	strfcpy(newfrom, t, size);
!       else {
! 	strfcat(newfrom, ", ", size);
! 	strfcat(newfrom, t, size);
!       }
!     }
!     dprint(12,(debugfile,
! 	       "parse_arpa_who: setting newfrom=%.100s\n",
! 	       newfrom))	    ;
!   }
!   
!   free_addr_items(list);
  }
+ 
+ 
+ 
+ 
Index: elm2.4.ME+.50/lib/posixsig.c
*** elm2.4.25/lib/posixsig.c	Mon Aug 23 05:46:55 1993
--- elm2.4.ME+.50/lib/posixsig.c	Tue Nov 17 21:12:55 1998
***************
*** 1,56 ****
  
! static char rcsid[] = "@(#)$Id: posixsig.c,v 5.8 1993/08/23 02:46:51 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: posixsig.c,v $
!  * Revision 5.8  1993/08/23  02:46:51  syd
!  * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX).
!  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
!  *
!  * Revision 5.7  1993/08/03  20:14:49  syd
!  * Fix where some systems name SIG_ERR BADSIG
!  * From: Syd
!  *
!  * Revision 5.6  1993/04/21  01:16:45  syd
!  * SunOS 4.1.3 uses the BSD convention for signal handling in system
!  * calls like read. The system call resumes when the signal handler
!  * returns unless the SA_INTERRUPT flag is set. Thus to make elm resize
!  * it's window after a SIGWINCH this flag must be set.
!  * From: vogt@isa.de (Gerald Vogt)
!  *
!  * Revision 5.5  1992/12/24  21:44:49  syd
!  * Add apollo check
!  * From: Syd
!  *
!  * Revision 5.4  1992/12/07  03:13:08  syd
!  * Add code to work around SunOS and sigalrm not returning EINTR
!  * From: Chip, Tom, Steve, Et. Al.
!  *
!  * Revision 5.3  1992/11/07  19:30:01  syd
!  * Fix redefinition complaint by SCO 3.2v2.0.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.2  1992/10/27  16:08:32  syd
!  * Fix non ansi declaration
!  * From: tom@osf.org
!  *
!  * Revision 5.1  1992/10/27  01:43:56  syd
!  * Initial Checkin
!  * Moved from src/signals.c
!  *
!  *
!  ******************************************************************************/
  
  /** Duplicate the old signal() call with POSIX sigaction
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: posixsig.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** Duplicate the old signal() call with POSIX sigaction
  
***************
*** 105,107 ****
--- 65,167 ----
  	    return(oact.sa_handler);
  }
  #endif /* POSIX_SIGNALS */
+ 
+ extern int errno;
+ 
+ #ifdef BACKGROUD_PROCESSES       /* We assume POSIX in here */
+ 
+ int my_wait (pid,statptr)
+      int pid; 
+ #if defined(BSD_TYPE) && !defined(WEXITSTATUS)
+      union wait *statptr;
+ #else
+      int *statptr;
+ #endif
+ {
+   int ret,err;
+   dprint(10, (debugfile, "my_wait(%d,...) ... with BACKGROUD_PROCESSES\n", 
+ 	      pid));
+   errno = 0;
+   ret = waitpid(pid,statptr,0);
+   err = errno;
+ 
+ #if defined(BSD_TYPE) && !defined(WEXITSTATUS)
+   dprint(10, (debugfile, "my_wait(%d,*statptr=%d) = %d\n", pid,
+ 	      statptr->w_status,ret));
+ #else
+   dprint(10, (debugfile, "my_wait(%d,*statptr=%d) = %d\n", pid,
+ 	      *statptr,ret));
+ #endif
+ 
+   if (err) {
+     dprint(10, (debugfile, " *** errno=%d (%s)\n",err,
+ 		error_description(err)));
+   }
+   errno = err;
+   return ret;
+ }
+ 
+ #else
+ 
+ int my_wait (pid,statptr)
+      int pid; 
+ #if defined(BSD_TYPE) && !defined(WEXITSTATUS)
+      union wait *statptr;
+ #else
+      int *statptr;
+ #endif
+ {
+   int ret,err;
+   dprint(10, (debugfile, "my_wait(%d,...) ... no BACKGROUD_PROCESSES\n", pid));
+   errno = 0;
+   ret = wait(statptr);
+   err = errno;
+   dprint(10, (debugfile, "my_wait(%d,*statptr=%d) = %d\n", pid,
+ #if defined(BSD_TYPE) && !defined(WEXITSTATUS)
+ 	      statptr->w_status
+ #else
+ 	      *statptr
+ #endif
+ 	      ,ret));
+   if (err) {
+     dprint(10, (debugfile, " *** errno=%d (%s)\n",err,
+ 		error_description(err)));
+   }
+   errno = err;
+   return ret;
+ 
+ }
+ #endif
+ 
+ int convert_status(status,exit_code) 
+ #if defined(BSD_TYPE) && !defined(WEXITSTATUS)
+      union wait status;
+ #else
+      int status;
+ #endif
+      int *exit_code;
+ {
+   int sig;
+ #ifdef	WEXITSTATUS
+   *exit_code = WEXITSTATUS(status);
+   if (WIFSIGNALED(status)) {
+      sig        = WTERMSIG(status);
+      dprint(10, (debugfile, "convert_status: TERMINATED WITH SIGNAL %d\n",
+                  sig));
+   } else
+      sig        = 0;
+ #else
+ # ifdef	BSD_TYPE
+   *exit_code = status.w_retcode;
+   sig        = status.w_termsig;
+ # else
+   *exit_code = status >> 8;
+   sig        = status & 128;
+ # endif
+ #endif
+ 
+   dprint(10, (debugfile, "convert_status=%d (sig): exit_code=%d\n", 
+ 	      sig,*exit_code));
+ 
+   return sig;
+ }
Index: elm2.4.ME+.50/lib/putenv.c
*** elm2.4.25/lib/putenv.c	Sun Oct  4 01:42:28 1992
--- elm2.4.ME+.50/lib/putenv.c	Tue Nov 17 21:12:55 1998
***************
*** 1,23 ****
  
! static char rcsid[] = "@(#)$Id: putenv.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
!  *			Copyright (c) 1992 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: putenv.c,v $
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
   *
!  *
!  ******************************************************************************/
  
  /*
   * This code was stolen from cnews.  Modified to make "newenv" static so
--- 1,15 ----
  
! static char rcsid[] = "@(#)$Id: putenv.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  *			Copyright (c) 1992 USENET Community Trust
!  *****************************************************************************/
  
  /*
   * This code was stolen from cnews.  Modified to make "newenv" static so
***************
*** 34,42 ****
  #define WORKED 0
  #define FAILED 1
  
! int
! putenv(var)			/* put var in the environment */
! char *var;
  {
  	register char **envp;
  	register int oldenvcnt;
--- 26,33 ----
  #define WORKED 0
  #define FAILED 1
  
! int putenv(var)			/* put var in the environment */
!      char *var;
  {
  	register char **envp;
  	register int oldenvcnt;
Index: elm2.4.ME+.50/lib/qstrings.c
*** elm2.4.25/lib/qstrings.c	Tue Aug  3 22:28:56 1993
--- elm2.4.ME+.50/lib/qstrings.c	Tue Nov 17 21:12:55 1998
***************
*** 1,36 ****
  
! static char rcsid[] = "@(#)$Id: qstrings.c,v 5.2 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: qstrings.c,v $
!  * Revision 5.2  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** This file contains equivalent routines to the string routines, but
       modifed to handle quoted strings.
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: qstrings.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** This file contains equivalent routines to the string routines, but
       modifed to handle quoted strings.
***************
*** 37,46 ****
  
  **/
  
! #include "headers.h"
  
  char *qstrpbrk(source, keys)
! char *source, *keys;
  {
  	/** Returns a pointer to the first character of source that is any
  	    of the specified keys, or NULL if none of the keys are present
--- 17,27 ----
  
  **/
  
! #include "defs.h"
! #include "elmlib.h"
  
  char *qstrpbrk(source, keys)
!      char *source, *keys;
  {
  	/** Returns a pointer to the first character of source that is any
  	    of the specified keys, or NULL if none of the keys are present
***************
*** 64,72 ****
  	return(NULL);
  }
  
! int
! qstrspn(source, keys)
! char *source, *keys;
  {
  	/** This function returns the length of the substring of
  	    'source' (starting at zero) that consists ENTIRELY of
--- 45,52 ----
  	return(NULL);
  }
  
! int qstrspn(source, keys)
!      char *source, *keys;
  {
  	/** This function returns the length of the substring of
  	    'source' (starting at zero) that consists ENTIRELY of
***************
*** 91,99 ****
  	return(loc);
  }
  
! int
! qstrcspn(source, keys)
! char *source, *keys;
  {
  	/** This function returns the length of the substring of
  	    'source' (starting at zero) that consists entirely of
--- 71,78 ----
  	return(loc);
  }
  
! int qstrcspn(source, keys)
!      char *source, *keys;
  {
  	/** This function returns the length of the substring of
  	    'source' (starting at zero) that consists entirely of
Index: elm2.4.ME+.50/lib/realfrom.c
*** elm2.4.25/lib/realfrom.c	Tue Aug 30 18:11:20 1994
--- elm2.4.ME+.50/lib/realfrom.c	Tue Nov 17 21:12:55 1998
***************
*** 1,62 ****
  
! static char rcsid[] = "@(#)$Id: realfrom.c,v 5.5 1994/08/30 15:11:20 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
   *
!  * 			Copyright (c) 1993 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: realfrom.c,v $
!  * Revision 5.5  1994/08/30  15:11:20  syd
!  * Work around null from names by looking to see whether the second or
!  * third field is a valid month and using that to determine if there
!  * is an address.
!  * From: alex@samwise.dccs.upenn.edu (Alex Garthwaite)
!  *
!  * Revision 5.4  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.3  1993/05/08  17:09:56  syd
!  * Fix problem where "<space>From" was recognized as a valid "From_" line.
!  * From: decwrl!decvax!gatech!WLK.COM!chip (Chip Rosenthal)
!  *
!  * Revision 5.2  1993/04/12  01:24:59  syd
!  * Have real_from() ignore bogus timezones in From_ lines
!  * rather than bailing out with an error.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.1  1993/01/19  04:46:21  syd
!  * Initial Checkin
   *
!  *
!  ******************************************************************************/
  
  
  #include "headers.h"
  
- 
  extern long make_gmttime();
  
! 
! int
! real_from(buffer, entry)
! char *buffer;
! struct header_rec *entry;
  {
  
      /*
--- 1,24 ----
  
! static char rcsid[] = "@(#)$Id: realfrom.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  * 			Copyright (c) 1993 USENET Community Trust
!  *****************************************************************************/
  
  
  #include "headers.h"
  
  extern long make_gmttime();
  
! int real_from(buffer, entry)
!      char *buffer;
!      struct header_rec *entry;
  {
  
      /*
***************
*** 89,95 ****
       */
      if (entry != NULL) {
  	entry->time_zone[0] = '\0';
! 	entry->from[0] = '\0';
  	entry->time_sent = 0;
  	entry->received_time = 0;
  	entry->tz_offset = 0;
--- 51,57 ----
       */
      if (entry != NULL) {
  	entry->time_zone[0] = '\0';
! 	entry->env_from[0] = '\0';
  	entry->time_sent = 0;
  	entry->received_time = 0;
  	entry->tz_offset = 0;
***************
*** 125,131 ****
  	  /*  field2 is month, field3 is day  */
            /* <user> */
            if (entry != NULL)
! 	      *( entry->from ) = '\0';
            dprint(7, (debugfile, "  user=\n"));
  
            /* <day> */
--- 87,93 ----
  	  /*  field2 is month, field3 is day  */
            /* <user> */
            if (entry != NULL)
! 	      *( entry->env_from ) = '\0';
            dprint(7, (debugfile, "  user=\n"));
  
            /* <day> */
***************
*** 136,142 ****
        {
          /* <user> */
          if (entry != NULL)
! 	    strfcpy(entry->from, field, sizeof(field));
          dprint(7, (debugfile, "  user=%s\n", field));
  
          /* <day> */
--- 98,104 ----
        {
          /* <user> */
          if (entry != NULL)
! 	    strfcpy(entry->env_from, field, sizeof(entry->env_from));
          dprint(7, (debugfile, "  user=%s\n", field));
  
          /* <day> */
***************
*** 172,178 ****
  	 * First check if this is a TZ field.  If so, pull in the info
  	 * and continue onto the next field.
  	 */
! 	if (cvt_timezone_to_offset(field, &i)) {
  	    tz += i;
  	    i = strlen(save_tz);
  	    (void) strfcpy(save_tz+i, " ", sizeof(save_tz)-i);
--- 134,140 ----
  	 * First check if this is a TZ field.  If so, pull in the info
  	 * and continue onto the next field.
  	 */
! 	if (cvt_timezone_to_offset(field, &i, sizeof field)) {
  	    tz += i;
  	    i = strlen(save_tz);
  	    (void) strfcpy(save_tz+i, " ", sizeof(save_tz)-i);
***************
*** 196,201 ****
--- 158,182 ----
  	    "  assuming \"%s\" is a bogus timezone - skipping it\n", field));
  
      }
+     
+     if (!save_tz[0] && tz == 0) {
+       /* Assume local timezone */
+       long      tzmin;		/* number of minutes off gmt 	 */
+       int	  tzsign;		/* + or - gmt 			 */
+       
+       if ((tz = (tzmin = -get_tz_mins())) >= 0) {
+ 	tzsign = '+';
+       } else {
+ 	tzsign = '-';
+ 	tzmin = -tzmin;
+       }
+       elm_sfprintf(save_tz, sizeof save_tz,
+ 		   FRM(" %c%02d%02d"),
+ 		   tzsign,tzmin / 60, tzmin % 60);
+       dprint(7, (debugfile,
+ 		 "  assuming local timezone %s", save_tz));
+ 
+     }
      if (entry != NULL) {
  	entry->tz_offset = tz * 60;
  	(void) strfcpy(entry->time_zone, save_tz+1, sizeof(entry->time_zone));
***************
*** 233,239 ****
  	else {
  	    printf("OK %s\n", buf);
  	    printf("from=%s time_zone=%s tz_offset=%d\n",
! 		hdr.from, hdr.time_zone, hdr.tz_offset);
  	    printf("time_sent=%ld received_time=%ld %s",
  		hdr.time_sent, hdr.received_time, ctime(&hdr.received_time));
  	}
--- 214,220 ----
  	else {
  	    printf("OK %s\n", buf);
  	    printf("from=%s time_zone=%s tz_offset=%d\n",
! 		hdr.env_from, hdr.time_zone, hdr.tz_offset);
  	    printf("time_sent=%ld received_time=%ld %s",
  		hdr.time_sent, hdr.received_time, ctime(&hdr.received_time));
  	}
Index: elm2.4.ME+.50/lib/remfirstwd.c
*** elm2.4.25/lib/remfirstwd.c	Sun Oct  4 01:42:29 1992
--- elm2.4.ME+.50/lib/remfirstwd.c	Tue Nov 17 21:12:56 1998
***************
*** 1,23 ****
! static char rcsid[] = "@(#)$Id: remfirstwd.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: remfirstwd.c,v $
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,15 ----
! static char rcsid[] = "@(#)$Id: remfirstwd.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 25,33 ****
  
  #include "headers.h"
  
! 
! remove_first_word(string)
! char *string;
  {	/** removes first word of string, ie up to first non-white space
  	    following a white space! **/
  
--- 17,24 ----
  
  #include "headers.h"
  
! void remove_first_word(string)
!      char *string;
  {	/** removes first word of string, ie up to first non-white space
  	    following a white space! **/
  
***************
*** 42,49 ****
  	move_left(string, loc);
  }
  
! remove_header_keyword(string)
! char *string;
  {	/** removes a RFC822 header keyword from the string.
  	    i.e. removes up to (and including) the first colon,
  	    plus any white-space immediately following it.  **/
--- 33,40 ----
  	move_left(string, loc);
  }
  
! void remove_header_keyword(string)
!      char *string;
  {	/** removes a RFC822 header keyword from the string.
  	    i.e. removes up to (and including) the first colon,
  	    plus any white-space immediately following it.  **/
Index: elm2.4.ME+.50/lib/reverse.c
*** elm2.4.25/lib/reverse.c	Sun Oct  4 01:42:29 1992
--- elm2.4.ME+.50/lib/reverse.c	Tue Nov 17 21:12:55 1998
***************
*** 1,23 ****
! static char rcsid[] = "@(#)$Id: reverse.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: reverse.c,v $
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,15 ----
! static char rcsid[] = "@(#)$Id: reverse.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 25,42 ****
  
  #include "headers.h"
  
! 
! reverse(string)
! char *string;
  {
  	/** reverse string... pretty trivial routine, actually! **/
  
  	register char *head, *tail, c;
  
! 	for (head = string, tail = string + strlen(string) - 1; head < tail; head++, tail--)
! 		{
! 		c = *head;
! 		*head = *tail;
! 		*tail = c;
! 		}
  }
--- 17,34 ----
  
  #include "headers.h"
  
! void reverse(string)
!      char *string;
  {
  	/** reverse string... pretty trivial routine, actually! **/
  
  	register char *head, *tail, c;
  
! 	for (head = string, tail = string + strlen(string) - 1; 
! 	     head < tail; 
! 	     head++, tail--) {
! 	  c = *head;
! 	  *head = *tail;
! 	  *tail = c;
! 	}
  }
Index: elm2.4.ME+.50/lib/rfc822tlen.c
*** elm2.4.25/lib/rfc822tlen.c	Tue Jul 20 06:15:24 1993
--- elm2.4.ME+.50/lib/rfc822tlen.c	Tue Nov 17 21:12:56 1998
***************
*** 1,26 ****
  
! static char rcsid[] = "@(#)$Id: rfc822tlen.c,v 5.2 1993/07/20 03:15:15 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
   *
!  *			Copyright (c) 1993 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: rfc822tlen.c,v $
!  * Revision 5.2  1993/07/20  03:15:15  syd
!  * remove extra garbage line
!  *
!  * Revision 5.1  1993/06/10  03:02:20  syd
!  * Initial Checkin
   *
!  *
!  ******************************************************************************/
  
  #include <stdio.h>
  
--- 1,15 ----
  
! static char rcsid[] = "@(#)$Id: rfc822tlen.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  *			Copyright (c) 1993 USENET Community Trust
!  *****************************************************************************/
  
  #include <stdio.h>
  
***************
*** 53,62 ****
   */
  #define IS822_SPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n')
  
! /*
!  * We've thrown non-ASCII (value > 0177) into this.
!  */
! #define IS822_CTL(c)	((c) <= 037 || (c) >= 0177)
  
  #define IS822_ATOMCH(c)	(!IS822_SPECIAL(c) && !IS822_SPACE(c) && !IS822_CTL(c))
  
--- 42,48 ----
   */
  #define IS822_SPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n')
  
! #define IS822_CTL(c)	((unsigned char)(c) <= 037 || (unsigned char)(c) == 0177)
  
  #define IS822_ATOMCH(c)	(!IS822_SPECIAL(c) && !IS822_SPACE(c) && !IS822_CTL(c))
  
Index: elm2.4.ME+.50/lib/safemalloc.c
*** elm2.4.25/lib/safemalloc.c	Mon Apr 12 04:51:33 1993
--- elm2.4.ME+.50/lib/safemalloc.c	Tue Nov 17 21:12:56 1998
***************
*** 1,26 ****
  
! static char rcsid[] = "@(#)$Id: safemalloc.c,v 5.1 1993/04/12 01:51:01 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
!  * 			Copyright (c) 1992 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: safemalloc.c,v $
!  * Revision 5.1  1993/04/12  01:51:01  syd
!  * Initial Checkin
!  *
   *
!  ******************************************************************************/
  
- #include <stdio.h>
  #include "defs.h"
  
  /*
   * These routines perform dynamic memory allocation with error checking.
--- 1,18 ----
  
! static char rcsid[] = "@(#)$Id: safemalloc.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  * 			Copyright (c) 1992 USENET Community Trust
!  *****************************************************************************/
  
  #include "defs.h"
+ #include "elmlib.h"
  
  /*
   * These routines perform dynamic memory allocation with error checking.
***************
*** 31,38 ****
  
  
  void dflt_safe_malloc_fail_handler(proc, len)
! char *proc;
! unsigned len;
  {
  	fprintf(stderr,
  		"error - out of memory [%s failed allocating %d bytes]\n",
--- 23,30 ----
  
  
  void dflt_safe_malloc_fail_handler(proc, len)
!      char *proc;
!      unsigned len;
  {
  	fprintf(stderr,
  		"error - out of memory [%s failed allocating %d bytes]\n",
***************
*** 42,50 ****
  
  void (*safe_malloc_fail_handler)() = dflt_safe_malloc_fail_handler;
  
- 
  malloc_t safe_malloc(len)
! unsigned len;
  {
  	malloc_t p;
  	if ((p = malloc(len)) == NULL)
--- 34,41 ----
  
  void (*safe_malloc_fail_handler)() = dflt_safe_malloc_fail_handler;
  
  malloc_t safe_malloc(len)
!      unsigned len;
  {
  	malloc_t p;
  	if ((p = malloc(len)) == NULL)
***************
*** 54,61 ****
  
  
  malloc_t safe_realloc(p, len)
! malloc_t p;
! unsigned len;
  {
  	if ((p = (p == NULL ? malloc(len) : realloc((malloc_t)p, len))) == NULL)
  		(*safe_malloc_fail_handler)("safe_realloc", len);
--- 45,52 ----
  
  
  malloc_t safe_realloc(p, len)
!      malloc_t p;
!      unsigned len;
  {
  	if ((p = (p == NULL ? malloc(len) : realloc((malloc_t)p, len))) == NULL)
  		(*safe_malloc_fail_handler)("safe_realloc", len);
***************
*** 62,73 ****
  	return p;
  }
  
- 
  char *safe_strdup(s)
! char *s;
  {
  	char *p;
! 	if ((p = (char *) malloc(strlen(s)+1)) == NULL)
! 		(*safe_malloc_fail_handler)("safe_strdup", strlen(s)+1);
! 	return strcpy(p, s);
  }
--- 53,64 ----
  	return p;
  }
  
  char *safe_strdup(s)
!      const char *s;
  {
  	char *p;
! 	int Len = strlen(s)+1;
! 	if ((p = (char *) malloc(Len)) == NULL)
! 		(*safe_malloc_fail_handler)("safe_strdup", Len);
! 	return strfcpy(p, s, Len);
  }
Index: elm2.4.ME+.50/lib/shiftlower.c
*** elm2.4.25/lib/shiftlower.c	Sat Mar 12 00:11:09 1994
--- elm2.4.ME+.50/lib/shiftlower.c	Tue Nov 17 21:12:56 1998
***************
*** 1,43 ****
! static char rcsid[] = "@(#)$Id: shiftlower.c,v 5.3 1994/03/11 22:11:09 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: shiftlower.c,v $
!  * Revision 5.3  1994/03/11  22:11:09  syd
!  * There is a bug in the alias-system of elm-2.4.23 that did not appear in
!  * elm-2.4.21. When searching for a string in the alias-table with the '//'
!  * command, elm sometimes gets a segmentation fault. With help of a debugger,
!  * I found that the function shift_lower gets a NULL argument. A fix is
!  * appended, but maybe the problem lies elsewhere.
!  * From: Sjaak Schilperoort <J.W.Schilperoort@research.ptt.nl>
!  *
!  * Revision 5.2  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,15 ----
! static char rcsid[] = "@(#)$Id: shiftlower.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 46,67 ****
  #include "headers.h"
  
  char *shift_lower(string)
! char *string;
  {
  	/** return 'string' shifted to lower case.  Do NOT touch the
  	    actual string handed to us! **/
  
  	static char buffer[VERY_LONG_STRING];
! 	register char *bufptr = buffer;
  
  	if (string == NULL) {
  		buffer[0] = 0;
  		return( (char *) buffer);
  	}
! 	for (; *string; string++, bufptr++)
  	  *bufptr = tolower(*string);
  	
  	*bufptr = 0;
  	
  	return( (char *) buffer);
  }
--- 18,48 ----
  #include "headers.h"
  
  char *shift_lower(string)
!      const char *string;
  {
  	/** return 'string' shifted to lower case.  Do NOT touch the
  	    actual string handed to us! **/
  
  	static char buffer[VERY_LONG_STRING];
! 	char *bufptr = buffer;
! 	const char *src0 = string;
  
  	if (string == NULL) {
  		buffer[0] = 0;
  		return( (char *) buffer);
  	}
! 	for (; *string && bufptr - buffer < sizeof buffer; 
! 	     string++, bufptr++)
  	  *bufptr = tolower(*string);
  	
  	*bufptr = 0;
  	
+ 	if (*string != '\0') {
+ 	  dprint(1,(debugfile,
+ 		    "shift_lower: --- too long string (max=%d): %.30s...\n",
+ 		    sizeof buffer -1,src0));
+ 	}
+ 
+ 
  	return( (char *) buffer);
  }
Index: elm2.4.ME+.50/lib/strfcpy.c
*** elm2.4.25/lib/strfcpy.c	Tue Jan 19 06:47:05 1993
--- elm2.4.ME+.50/lib/strfcpy.c	Tue Nov 17 21:12:55 1998
***************
*** 1,23 ****
  
! static char rcsid[] = "@(#)$Id: strfcpy.c,v 5.1 1993/01/19 04:46:21 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
!  * 			Copyright (c) 1993 USENET Community Trust
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: strfcpy.c,v $
!  * Revision 5.1  1993/01/19  04:46:21  syd
!  * Initial Checkin
!  *
   *
!  ******************************************************************************/
  
  /*
   * This is just like strncpy() except:
--- 1,15 ----
  
! static char rcsid[] = "@(#)$Id: strfcpy.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
!  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
!  ******************************************************************************
!  *  The Elm Mail System 
   *
!  * 			Copyright (c) 1993 USENET Community Trust
!  *****************************************************************************/
  
  /*
   * This is just like strncpy() except:
***************
*** 29,43 ****
   *   the trailing '\0'.  That is, strncpy() fills in the end with '\0'
   *   if strlen(src)<len.  We don't bother.
   */
  char *strfcpy(dest, src, len)
! register char *dest, *src;
! register int len;
  {
! 	char *dest0 = dest;
! 	while (--len > 0 && *src != '\0')
! 		*dest++ = *src++;
! 	*dest = '\0';
! 	return dest0;
  }
  
  #ifdef _TEST
--- 21,75 ----
   *   the trailing '\0'.  That is, strncpy() fills in the end with '\0'
   *   if strlen(src)<len.  We don't bother.
   */
+ 
+ #include "defs.h"
+ #include "elmlib.h"
+ 
  char *strfcpy(dest, src, len)
!      char *dest;
!      const char *src;
!      int len;
! {
!   int size = len;
!   const char *src0 = src;
! 
!   char *dest0 = dest;
! 
!   while (--len > 0 && *src != '\0')
!     *dest++ = *src++;
! 
!   if (*src != '\0') {
!     dprint(1,(debugfile,
! 	      "strfcpy: --- too long string (max=%d): %.30s...\n",
! 	      size,src0));
!   }
! 
!   *dest = '\0';
!   return dest0;
! }
! 
! char *strfcat(dest, src, len)
!      char *dest;
!      const char *src;
!      int len;
  {
!   int size = len;
!   const char *src0 = src;
! 
!   char *dest0 = dest;
!   while ('\0' != *dest && --len > 0)
!     dest++;
!   while (--len > 0 && *src != '\0')
!     *dest++ = *src++;
! 
!   if (*src != '\0') {
!     dprint(1,(debugfile,
! 	      "strfcat: --- too long string (max target=%d): %.30s...\n",
! 	      size,src0));
!   }
! 
!   *dest = '\0';
!   return dest0;
  }
  
  #ifdef _TEST
Index: elm2.4.ME+.50/lib/strftime.c
*** elm2.4.25/lib/strftime.c	Mon May 16 03:05:33 1994
--- elm2.4.ME+.50/lib/strftime.c	Tue Nov 17 21:12:55 1998
***************
*** 1,92 ****
  
! static char rcsid[] = "@(#)$Id: strftime.c,v 5.11 1994/05/16 00:05:27 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.11 $   $State: Exp $
   *
   * Public-domain relatively quick-and-dirty implemenation of
   * ANSI library routine for System V Unix systems.
   *
   * Arnold Robbins
   *
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  * (Note: this routine is provided as is, without support for those sites that
!  *	do not have strftime in their library)
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: strftime.c,v $
!  * Revision 5.11  1994/05/16  00:05:27  syd
!  * Update to strftime-6.1
!  * From: Syd
!  *
!  * Revision 5.10  1994/03/11  20:55:23  syd
!  * Replaced the get_tz_mins() routine in lib/get_tz.c with a portable
!  * version that requires no configuration.  Rewrote the test case in
!  * lib/get_tz.c, and also wrote in support to simplify configuration
!  * tests.  Dropped TZMINS_USE_XXXX configuration parameter.  Simplified
!  * timezone determination in Configure.  The new get_tz_mins() introduces
!  * two side effects.  First it steps on the static data returned by
!  * localtime().  Second, it uses a routine in lib/date_util.c, which
!  * requires debug initializations.  Rewrote get_arpa_date() to work around
!  * the first issue.  Rather than doing the same for lib/strftime.c, just
!  * removed the timezone stuff with a conditional compile.  Elm does not
!  * use it.  Added debugging initializations to util/fastmail.c.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.9  1994/03/11  20:43:42  syd
!  * Fix ANSI prototype stripping macro
!  * From: "Tom Moore" <tmoore@fievel.DaytonOH.NCR.COM>
!  *
!  * Revision 5.8  1993/08/23  02:46:51  syd
!  * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX).
!  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
!  *
!  * Revision 5.7  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.6  1993/08/03  19:20:31  syd
!  * Implement new timezone handling.  New file lib/get_tz.c with new timezone
!  * routines.  Added new TZMINS_USE_xxxxxx and TZNAME_USE_xxxxxx configuration
!  * definitions.  Obsoleted TZNAME, ALTCHECK, and TZ_MINUTESWEST configuration
!  * definitions.  Updated Configure.  Modified lib/getarpdate.c and
!  * lib/strftime.c to use new timezone routines.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.5  1993/06/10  03:17:45  syd
!  * Change from TZNAME_MISSING to TZNAME
!  * From: Syd via request from Dan Blanchard
!  *
!  * Revision 5.4  1993/05/08  19:56:45  syd
!  * update to newer version
!  * From: Syd
!  *
!  * Revision 5.3  1993/04/21  01:42:23  syd
!  * avoid name conflicts on min and max
!  *
!  * Revision 5.2  1993/04/16  04:29:34  syd
!  * attempt to bsdize a bit strftime
!  * From: many via syd
!  *
!  * Revision 5.1  1993/01/27  18:52:15  syd
!  * Initial checkin of contributed public domain routine.
!  * This routine is provided as is and not covered by Elm Copyright.
!  *
!  *
!  *
!  ******************************************************************************/
  
  /*
   * strftime.c
--- 1,19 ----
  
! static char rcsid[] = "@(#)$Id: strftime.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * Public-domain relatively quick-and-dirty implemenation of
   * ANSI library routine for System V Unix systems.
   *
   * Arnold Robbins
   *
!  *****************************************************************************/
  
  /*
   * strftime.c
***************
*** 127,147 ****
  
  #include "headers.h"
  
! #ifdef I_TIME
! #  include <time.h>
! #endif
! #ifdef I_SYSTIME
! #  include <sys/time.h>
! #endif
! 
! #if ANSI_C
! # define P_(x) x
! #else
! # define P_(x) () /**/
! # define const	/**/
! #endif
! 
! #ifndef BSD
  extern void tzset P_((void));
  #endif
  static int weeknumber P_((const struct tm *timeptr, int firstweekday));
--- 54,60 ----
  
  #include "headers.h"
  
! #ifndef BSD_TYPE
  extern void tzset P_((void));
  #endif
  static int weeknumber P_((const struct tm *timeptr, int firstweekday));
***************
*** 284,290 ****
  			savetz = (char *) malloc(tzlen + 1);
  			if (savetz != NULL) {
  				savetzlen = tzlen + 1;
! 				strcpy(savetz, tz);
  			}
  		}
  		tzset();
--- 197,203 ----
  			savetz = (char *) malloc(tzlen + 1);
  			if (savetz != NULL) {
  				savetzlen = tzlen + 1;
! 				strfcpy(savetz, tz, savetzlen);
  			}
  		}
  		tzset();
***************
*** 297,306 ****
  			savetz = (char *) realloc(savetz, i);
  			if (savetz) {
  				savetzlen = i;
! 				strcpy(savetz, tz);
  			}
  		} else
! 			strcpy(savetz, tz);
  		tzset();
  	}
  #endif	/* POSIX_SEMANTICS */
--- 210,219 ----
  			savetz = (char *) realloc(savetz, i);
  			if (savetz) {
  				savetzlen = i;
! 				strfcpy(savetz, tz, savetzlen);
  			}
  		} else
! 			strfcpy(savetz, tz, savetzlen);
  		tzset();
  	}
  #endif	/* POSIX_SEMANTICS */
***************
*** 323,338 ****
  
  		case 'a':	/* abbreviated weekday name */
  			if (timeptr->tm_wday < 0 || timeptr->tm_wday > 6)
! 				strcpy(tbuf, "?");
  			else
! 				strcpy(tbuf, days_a[timeptr->tm_wday]);
  			break;
  
  		case 'A':	/* full weekday name */
  			if (timeptr->tm_wday < 0 || timeptr->tm_wday > 6)
! 				strcpy(tbuf, "?");
  			else
! 				strcpy(tbuf, days_l[timeptr->tm_wday]);
  			break;
  
  #ifdef SYSV_EXT
--- 236,253 ----
  
  		case 'a':	/* abbreviated weekday name */
  			if (timeptr->tm_wday < 0 || timeptr->tm_wday > 6)
! 				strfcpy(tbuf, "?", sizeof tbuf);
  			else
! 				strfcpy(tbuf, days_a[timeptr->tm_wday],
! 					sizeof tbuf);
  			break;
  
  		case 'A':	/* full weekday name */
  			if (timeptr->tm_wday < 0 || timeptr->tm_wday > 6)
! 				strfcpy(tbuf, "?", sizeof tbuf);
  			else
! 				strfcpy(tbuf, days_l[timeptr->tm_wday],
! 					sizeof tbuf);
  			break;
  
  #ifdef SYSV_EXT
***************
*** 340,376 ****
  #endif
  		case 'b':	/* abbreviated month name */
  			if (timeptr->tm_mon < 0 || timeptr->tm_mon > 11)
! 				strcpy(tbuf, "?");
  			else
! 				strcpy(tbuf, months_a[timeptr->tm_mon]);
  			break;
  
  		case 'B':	/* full month name */
  			if (timeptr->tm_mon < 0 || timeptr->tm_mon > 11)
! 				strcpy(tbuf, "?");
  			else
! 				strcpy(tbuf, months_l[timeptr->tm_mon]);
  			break;
  
  		case 'c':	/* appropriate date and time representation */
! 			sprintf(tbuf, "%s %s %2d %02d:%02d:%02d %d",
! 				days_a[range(0, timeptr->tm_wday, 6)],
! 				months_a[range(0, timeptr->tm_mon, 11)],
! 				range(1, timeptr->tm_mday, 31),
! 				range(0, timeptr->tm_hour, 23),
! 				range(0, timeptr->tm_min, 59),
! 				range(0, timeptr->tm_sec, 61),
! 				timeptr->tm_year + 1900);
  			break;
  
  		case 'd':	/* day of the month, 01 - 31 */
  			i = range(1, timeptr->tm_mday, 31);
! 			sprintf(tbuf, "%02d", i);
  			break;
  
  		case 'H':	/* hour, 24-hour clock, 00 - 23 */
  			i = range(0, timeptr->tm_hour, 23);
! 			sprintf(tbuf, "%02d", i);
  			break;
  
  		case 'I':	/* hour, 12-hour clock, 01 - 12 */
--- 255,296 ----
  #endif
  		case 'b':	/* abbreviated month name */
  			if (timeptr->tm_mon < 0 || timeptr->tm_mon > 11)
! 				strfcpy(tbuf, "?", sizeof tbuf);
  			else
! 				strfcpy(tbuf, months_a[timeptr->tm_mon],
! 					sizeof tbuf);
  			break;
  
  		case 'B':	/* full month name */
  			if (timeptr->tm_mon < 0 || timeptr->tm_mon > 11)
! 				strfcpy(tbuf, "?", sizeof tbuf);
  			else
! 				strfcpy(tbuf, months_l[timeptr->tm_mon],
! 					sizeof tbuf);
  			break;
  
  		case 'c':	/* appropriate date and time representation */
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				    FRM("%s %s %2d %02d:%02d:%02d %d"),
! 				    days_a[range(0, timeptr->tm_wday, 6)],
! 				    months_a[range(0, timeptr->tm_mon, 11)],
! 				    range(1, timeptr->tm_mday, 31),
! 				    range(0, timeptr->tm_hour, 23),
! 				    range(0, timeptr->tm_min, 59),
! 				    range(0, timeptr->tm_sec, 61),
! 				    timeptr->tm_year + 1900);
  			break;
  
  		case 'd':	/* day of the month, 01 - 31 */
  			i = range(1, timeptr->tm_mday, 31);
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%02d"), i);
  			break;
  
  		case 'H':	/* hour, 24-hour clock, 00 - 23 */
  			i = range(0, timeptr->tm_hour, 23);
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%02d"), i);
  			break;
  
  		case 'I':	/* hour, 12-hour clock, 01 - 12 */
***************
*** 379,462 ****
  				i = 12;
  			else if (i > 12)
  				i -= 12;
! 			sprintf(tbuf, "%02d", i);
  			break;
  
  		case 'j':	/* day of the year, 001 - 366 */
! 			sprintf(tbuf, "%03d", timeptr->tm_yday + 1);
  			break;
  
  		case 'm':	/* month, 01 - 12 */
  			i = range(0, timeptr->tm_mon, 11);
! 			sprintf(tbuf, "%02d", i + 1);
  			break;
  
  		case 'M':	/* minute, 00 - 59 */
  			i = range(0, timeptr->tm_min, 59);
! 			sprintf(tbuf, "%02d", i);
  			break;
  
  		case 'p':	/* am or pm based on 12-hour clock */
  			i = range(0, timeptr->tm_hour, 23);
  			if (i < 12)
! 				strcpy(tbuf, ampm[0]);
  			else
! 				strcpy(tbuf, ampm[1]);
  			break;
  
  		case 'S':	/* second, 00 - 61 */
  			i = range(0, timeptr->tm_sec, 61);
! 			sprintf(tbuf, "%02d", i);
  			break;
  
  		case 'U':	/* week of year, Sunday is first day of week */
! 			sprintf(tbuf, "%02d", weeknumber(timeptr, 0));
  			break;
  
  		case 'w':	/* weekday, Sunday == 0, 0 - 6 */
  			i = range(0, timeptr->tm_wday, 6);
! 			sprintf(tbuf, "%d", i);
  			break;
  
  		case 'W':	/* week of year, Monday is first day of week */
! 			sprintf(tbuf, "%02d", weeknumber(timeptr, 1));
  			break;
  
  		case 'x':	/* appropriate date representation */
! 			sprintf(tbuf, "%s %s %2d %d",
! 				days_a[range(0, timeptr->tm_wday, 6)],
! 				months_a[range(0, timeptr->tm_mon, 11)],
! 				range(1, timeptr->tm_mday, 31),
! 				timeptr->tm_year + 1900);
  			break;
  
  		case 'X':	/* appropriate time representation */
! 			sprintf(tbuf, "%02d:%02d:%02d",
! 				range(0, timeptr->tm_hour, 23),
! 				range(0, timeptr->tm_min, 59),
! 				range(0, timeptr->tm_sec, 61));
  			break;
  
  		case 'y':	/* year without a century, 00 - 99 */
  			i = timeptr->tm_year % 100;
! 			sprintf(tbuf, "%02d", i);
  			break;
  
  		case 'Y':	/* year with century */
! 			sprintf(tbuf, "%d", 1900 + timeptr->tm_year);
  			break;
  
  		case 'Z':	/* time zone name or abbrevation */
  #ifdef TZNAME_USE_TZNAME
  			i = (daylight && timeptr->tm_isdst);	/* 0 or 1 */
! 			strcpy(tbuf, tzname[i]);
  #else
  #ifdef TZNAME_USE_TM_ZONE
! 			strcpy(tbuf, timeptr->tm_zone);
  #else
  			gettimeofday(& tv, & zone);
! 			strcpy(tbuf, timezone(zone.tz_minuteswest,
! 						timeptr->tm_isdst));
  #endif
  #endif
  			break;
--- 299,394 ----
  				i = 12;
  			else if (i > 12)
  				i -= 12;
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%02d"), i);
  			break;
  
  		case 'j':	/* day of the year, 001 - 366 */
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%03d"), timeptr->tm_yday + 1);
  			break;
  
  		case 'm':	/* month, 01 - 12 */
  			i = range(0, timeptr->tm_mon, 11);
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%02d"), i + 1);
  			break;
  
  		case 'M':	/* minute, 00 - 59 */
  			i = range(0, timeptr->tm_min, 59);
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%02d"), i);
  			break;
  
  		case 'p':	/* am or pm based on 12-hour clock */
  			i = range(0, timeptr->tm_hour, 23);
  			if (i < 12)
! 				strfcpy(tbuf, ampm[0], sizeof tbuf);
  			else
! 				strfcpy(tbuf, ampm[1], sizeof tbuf);
  			break;
  
  		case 'S':	/* second, 00 - 61 */
  			i = range(0, timeptr->tm_sec, 61);
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%02d"), i);
  			break;
  
  		case 'U':	/* week of year, Sunday is first day of week */
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				    FRM("%02d"), weeknumber(timeptr, 0));
  			break;
  
  		case 'w':	/* weekday, Sunday == 0, 0 - 6 */
  			i = range(0, timeptr->tm_wday, 6);
! 			elm_sfprintf(tbuf, sizeof tbuf, FRM("%d"), i);
  			break;
  
  		case 'W':	/* week of year, Monday is first day of week */
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%02d"), weeknumber(timeptr, 1));
  			break;
  
  		case 'x':	/* appropriate date representation */
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%s %s %2d %d"),
! 				     days_a[range(0, timeptr->tm_wday, 6)],
! 				     months_a[range(0, timeptr->tm_mon, 11)],
! 				     range(1, timeptr->tm_mday, 31),
! 				     timeptr->tm_year + 1900);
  			break;
  
  		case 'X':	/* appropriate time representation */
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%02d:%02d:%02d"),
! 				     range(0, timeptr->tm_hour, 23),
! 				     range(0, timeptr->tm_min, 59),
! 				     range(0, timeptr->tm_sec, 61));
  			break;
  
  		case 'y':	/* year without a century, 00 - 99 */
  			i = timeptr->tm_year % 100;
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%02d"), i);
  			break;
  
  		case 'Y':	/* year with century */
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%d"), 1900 + timeptr->tm_year);
  			break;
  
  		case 'Z':	/* time zone name or abbrevation */
  #ifdef TZNAME_USE_TZNAME
  			i = (daylight && timeptr->tm_isdst);	/* 0 or 1 */
! 			strfcpy(tbuf, tzname[i], sizeof tbuf);
  #else
  #ifdef TZNAME_USE_TM_ZONE
! 			strfcpy(tbuf, timeptr->tm_zone, sizeof tbuf);
  #else
  			gettimeofday(& tv, & zone);
! 			strfcpy(tbuf, timezone(zone.tz_minuteswest,
! 					       timeptr->tm_isdst),
! 				sizeof tbuf);
  #endif
  #endif
  			break;
***************
*** 477,483 ****
  			break;
  
  		case 'e':	/* day of month, blank padded */
! 			sprintf(tbuf, "%2d", range(1, timeptr->tm_mday, 31));
  			break;
  
  		case 'r':	/* time as %I:%M:%S %p */
--- 409,417 ----
  			break;
  
  		case 'e':	/* day of month, blank padded */
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%2d"), 
! 				     range(1, timeptr->tm_mday, 31));
  			break;
  
  		case 'r':	/* time as %I:%M:%S %p */
***************
*** 495,501 ****
  
  #ifdef SUNOS_EXT
  		case 'k':	/* hour, 24-hour clock, blank pad */
! 			sprintf(tbuf, "%2d", range(0, timeptr->tm_hour, 23));
  			break;
  
  		case 'l':	/* hour, 12-hour clock, 1 - 12, blank pad */
--- 429,436 ----
  
  #ifdef SUNOS_EXT
  		case 'k':	/* hour, 24-hour clock, blank pad */
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%2d"), range(0, timeptr->tm_hour, 23));
  			break;
  
  		case 'l':	/* hour, 12-hour clock, 1 - 12, blank pad */
***************
*** 504,510 ****
  				i = 12;
  			else if (i > 12)
  				i -= 12;
! 			sprintf(tbuf, "%2d", i);
  			break;
  #endif
  
--- 439,445 ----
  				i = 12;
  			else if (i > 12)
  				i -= 12;
! 			elm_sfprintf(tbuf, sizeof tbuf, FRM("%2d"), i);
  			break;
  #endif
  
***************
*** 511,520 ****
  
  #ifdef VMS_EXT
  		case 'v':	/* date as dd-bbb-YYYY */
! 			sprintf(tbuf, "%02d-%3.3s-%4d",
! 				range(1, timeptr->tm_mday, 31),
! 				months_a[range(0, timeptr->tm_mon, 11)],
! 				timeptr->tm_year + 1900);
  			for (i = 3; i < 6; i++)
  				if (islower(tbuf[i]))
  					tbuf[i] = toupper(tbuf[i]);
--- 446,456 ----
  
  #ifdef VMS_EXT
  		case 'v':	/* date as dd-bbb-YYYY */
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%02d-%3.3s-%4d"),
! 				     range(1, timeptr->tm_mday, 31),
! 				     months_a[range(0, timeptr->tm_mon, 11)],
! 				     timeptr->tm_year + 1900);
  			for (i = 3; i < 6; i++)
  				if (islower(tbuf[i]))
  					tbuf[i] = toupper(tbuf[i]);
***************
*** 524,530 ****
  
  #ifdef POSIX2_DATE
  		case 'C':
! 			sprintf(tbuf, "%02d", (timeptr->tm_year + 1900) / 100);
  			break;
  
  
--- 460,468 ----
  
  #ifdef POSIX2_DATE
  		case 'C':
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%02d"), 
! 				     (timeptr->tm_year + 1900) / 100);
  			break;
  
  
***************
*** 547,559 ****
  			}
  		}
  #endif
! 			sprintf(tbuf, "%02d", iso8601wknum(timeptr));
  			break;
  
  		case 'u':
  		/* ISO 8601: Weekday as a decimal number [1 (Monday) - 7] */
! 			sprintf(tbuf, "%d", timeptr->tm_wday == 0 ? 7 :
! 					timeptr->tm_wday);
  			break;
  #endif	/* POSIX2_DATE */
  		default:
--- 485,499 ----
  			}
  		}
  #endif
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%02d"), iso8601wknum(timeptr));
  			break;
  
  		case 'u':
  		/* ISO 8601: Weekday as a decimal number [1 (Monday) - 7] */
! 			elm_sfprintf(tbuf, sizeof tbuf,
! 				     FRM("%d"), timeptr->tm_wday == 0 ? 7 :
! 				     timeptr->tm_wday);
  			break;
  #endif	/* POSIX2_DATE */
  		default:
***************
*** 565,571 ****
  		i = strlen(tbuf);
  		if (i) {
  			if (s + i < endp - 1) {
! 				strcpy(s, tbuf);
  				s += i;
  			} else
  				return 0;
--- 505,511 ----
  		i = strlen(tbuf);
  		if (i) {
  			if (s + i < endp - 1) {
! 				strfcpy(s, tbuf, maxsize - (s-start));
  				s += i;
  			} else
  				return 0;
Index: elm2.4.ME+.50/lib/strincmp.c
*** elm2.4.25/lib/strincmp.c	Tue Aug  3 22:28:58 1993
--- elm2.4.ME+.50/lib/strincmp.c	Tue Nov 17 21:14:08 1998
***************
*** 1,36 ****
  
! static char rcsid[] = "@(#)$Id: strincmp.c,v 5.2 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: strincmp.c,v $
!  * Revision 5.2  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** compare strings ignoring case - length limited
  **/
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: strincmp.c,v 1.3 1998/11/08 18:21:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.3 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** compare strings ignoring case - length limited
  **/
***************
*** 37,49 ****
  
  #include "headers.h"
  
! int
! strincmp(s1,s2,n)
! register char *s1, *s2;
! register int n;
  {
  	/* case insensitive comparison */
! 	register int d;
  	while (--n >= 0) {
  	  d = (tolower(*s1) - tolower(*s2));
  	  if ( d != 0 || *s1 == '\0' || *s2 == '\0' )
--- 17,32 ----
  
  #include "headers.h"
  
! /* Is this needed? This is same than strncasecmp 
!  *        - K E H <hurtta@ozone.FMI.FI>
!  */
! 
! int strincmp(s1,s2,n)
!      const char *s1, *s2;
!      int n;
  {
  	/* case insensitive comparison */
! 	int d;
  	while (--n >= 0) {
  	  d = (tolower(*s1) - tolower(*s2));
  	  if ( d != 0 || *s1 == '\0' || *s2 == '\0' )
Index: elm2.4.ME+.50/lib/striparens.c
*** elm2.4.25/lib/striparens.c	Thu Jun 10 06:09:06 1993
--- elm2.4.ME+.50/lib/striparens.c	Tue Nov 17 21:12:55 1998
***************
*** 1,28 ****
! static char rcsid[] = "@(#)$Id: striparens.c,v 5.2 1993/06/10 03:09:06 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: striparens.c,v $
!  * Revision 5.2  1993/06/10  03:09:06  syd
!  * Greatly simplified "lib/striparens.c" to use new rfc822_toklen() routine.
!  * This cut more than 50% out of the object size.  Also added _TEST case.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /* 
   * strip_parens() - Delete all (parenthesized) information from a string.
--- 1,15 ----
! static char rcsid[] = "@(#)$Id: striparens.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /* 
   * strip_parens() - Delete all (parenthesized) information from a string.
***************
*** 39,77 ****
  static char paren_buffer[VERY_LONG_STRING];
  
  char *strip_parens(src)
! register char *src;
  {
! 	register int len;
! 	register char *dest = paren_buffer;
! 
! 	while (*src != '\0') {
! 		len = rfc822_toklen(src);
! 		if (*src != '(') {	/*)*/
! 			strncpy(dest, src, len);
! 			dest += len;
! 		}
! 		src += len;
! 	}
! 	*dest = '\0';
! 	return paren_buffer;
  }
  
  char *get_parens(src)
! register char *src;
  {
! 	register int len;
! 	register char *dest = paren_buffer;
! 
! 	while (*src != '\0') {
! 		len = rfc822_toklen(src);
! 		if (len > 2 && *src == '(') {	/*)*/
! 			strncpy(dest, src+1, len-2);
! 			dest += (len-2);
! 		}
! 		src += len;
! 	}
! 	*dest = '\0';
! 	return paren_buffer;
  }
  
  #ifdef _TEST
--- 26,85 ----
  static char paren_buffer[VERY_LONG_STRING];
  
  char *strip_parens(src)
!      const char *src;
  {
!   int len;
!   char *dest = paren_buffer;
!   const char *src0 = src;
! 
!   while (*src != '\0') {
!     len = rfc822_toklen(src);		
!     if (*src != '(') {	/*)*/
!       if ((dest-paren_buffer) + len < sizeof paren_buffer -1) {
! 	strncpy(dest, src, len);
! 	dest += len;
!       } else {
! 	dprint(1,(debugfile,
! 		  "strip_parens: --- too long string (max=%d): %.30s...\n",
! 		  sizeof paren_buffer,src0));	
! 	dprint(1,(debugfile,
! 		  "strip_parens: next token: %.*s\n",len,src));
! 	break;
!       }
!     }
!     src += len;
!   }
!   *dest = '\0';
!   return paren_buffer;
  }
  
  char *get_parens(src)
!      const char *src;
  {
!   int len;
!   char *dest = paren_buffer;
!   const char *src0 = src;
! 
!   while (*src != '\0') {
!     len = rfc822_toklen(src);
!     if (len > 2 && *src == '(') {	/*)*/
!       if ((dest-paren_buffer) + len < sizeof paren_buffer) {	
! 	strncpy(dest, src+1, len-2);
! 	dest += (len-2);
!       } else {
! 	dprint(1,(debugfile,
! 		  "get_parens: --- too long string (max=%d): %.30s...\n",
! 		  sizeof paren_buffer,src0));	
! 	dprint(1,(debugfile,
! 		  "get_parens: next token: %.*s\n",len,src));
! 	break;
!       }
! 
!     }
!     src += len;
!   }
!   *dest = '\0';
!   return paren_buffer;
  }
  
  #ifdef _TEST
Index: elm2.4.ME+.50/lib/strmcpy.c
*** /tmp/8255-very-long-file-name-NULL-comes-in-here	Sun Nov 22 09:14:43 1998
--- elm2.4.ME+.50/lib/strmcpy.c	Tue Nov 17 21:14:08 1998
***************
*** 0 ****
--- 1,43 ----
+ static char rcsid[] = "@(#)$Id: strmcpy.c,v 1.2 1998/11/16 17:08:30 hurtta Exp $";
+ 
+ /******************************************************************************
+  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
+  *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  *
+  *  Initially written by: Michael Elkins <elkins@aero.org>, 1995
+  *****************************************************************************/
+ 
+ #include "defs.h"
+ #include "elmlib.h"
+ 
+ char * strmcpy (dest, src)
+      char *dest;
+      const char *src;
+ {
+ 	int len = strlen (src) + 1;
+ 
+ 	if (dest)
+ 		dest = (char *) safe_realloc (dest, len);
+ 	else
+ 		dest = (char *) safe_malloc (len);
+ 	strfcpy (dest, src, len);
+ 	return dest;
+ }
+ 
+ 
+ char * strmcat (dest, src)
+      char *dest;
+      const char *src;
+ {
+ 	int len;
+ 
+ 	if (!dest)
+ 	  return strmcpy(dest,src);
+ 
+ 	len = strlen (src) + 1 + strlen(dest);
+ 
+ 	dest = (char *) safe_realloc (dest, len);
+ 	strfcat (dest, src, len);
+ 	return dest;
+ }
Index: elm2.4.ME+.50/lib/strstr.c
*** elm2.4.25/lib/strstr.c	Sun Oct  4 01:42:30 1992
--- elm2.4.ME+.50/lib/strstr.c	Tue Nov 17 21:12:55 1998
***************
*** 1,24 ****
  
! static char rcsid[] = "@(#)$Id: strstr.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: strstr.c,v $
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** look for substring in string
  **/
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: strstr.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** look for substring in string
  **/
***************
*** 49,55 ****
   */
  
  char *strstr(s1, s2)
! char *s1, *s2;
  {
  	int len;
  	char *ptr;
--- 41,47 ----
   */
  
  char *strstr(s1, s2)
!      char *s1, *s2;
  {
  	int len;
  	char *ptr;
Index: elm2.4.ME+.50/lib/strtokq.c
*** elm2.4.25/lib/strtokq.c	Tue Jul 20 05:05:17 1993
--- elm2.4.ME+.50/lib/strtokq.c	Tue Nov 17 21:12:56 1998
***************
*** 1,43 ****
  
! static char rcsid[] = "@(#)$Id: strtokq.c,v 5.3 1993/07/20 02:05:17 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: strtokq.c,v $
!  * Revision 5.3  1993/07/20  02:05:17  syd
!  * A long-standing bug of handling replies to VMS systems.
!  * Original "From: " -line is of format:
!  * 	From: "NAME \"Real Name\"" <USERNAME@vms-system>
!  * (PMDF mailer)
!  * 	Anyway,  parse_arpa_who()  strips quotes too cleanly
!  * resulting data:
!  * 	NAME \"Real Name\
!  * which, when put into parenthesis, becomes:
!  * 	(NAME \"Real Name\)
!  * which in its turn lacks closing `)'
!  * Patch of  lib/parsarpwho.c  fixes that.
!  * strtokq() started one position too late to search for next double-quote (") char.
!  * Another one-off (chops off trailing comment character, quote or not..)  in   src/reply.c
!  * From:	Matti Aarnio <mea@utu.fi>
!  *
!  * Revision 5.2  1993/02/03  16:20:30  syd
!  * add include file
!  *
!  * Revision 5.1  1993/02/03  16:19:31  syd
!  * Initial checkin, taken from filter/parse.c
!  *
!  *
!  ******************************************************************************/
  
  
  /* Like strtok, but returns quoted strings as one token (quotes removed)
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: strtokq.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  
  /* Like strtok, but returns quoted strings as one token (quotes removed)
***************
*** 46,54 ****
  
  #include "headers.h"
  
  char *strtokq(source, keys, flag)
! char *source, *keys;
! int flag;
  {
  	register int  last_ch;
  	static   char *sourceptr = NULL;
--- 19,31 ----
  
  #include "headers.h"
  
+ /* Why there is ' -- it is not quote character in mail.
+  *    - K E H <hurtta@ozone.FMI.FI>
+  */
+ 
  char *strtokq(source, keys, flag)
!      char *source, *keys;
!      int flag;
  {
  	register int  last_ch;
  	static   char *sourceptr = NULL;
Index: elm2.4.ME+.50/lib/tail_of.c
*** elm2.4.25/lib/tail_of.c	Sun Oct  4 01:42:30 1992
--- elm2.4.ME+.50/lib/tail_of.c	Tue Nov 17 21:12:56 1998
***************
*** 1,23 ****
! static char rcsid[] = "@(#)$Id: tail_of.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: tail_of.c,v $
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** 
  
--- 1,15 ----
! static char rcsid[] = "@(#)$Id: tail_of.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** 
  
***************
*** 26,34 ****
  #include "headers.h"
  
  
! int
! tail_of(from, buffer, to)
! char *from, *buffer, *to;
  {
  	/** Return last two words of 'from'.  This is to allow
  	    painless display of long return addresses as simply the
--- 18,26 ----
  #include "headers.h"
  
  
! int tail_of(from, buffer, to, size)
!      char *from, *buffer, *to;
!      int size;
  {
  	/** Return last two words of 'from'.  This is to allow
  	    painless display of long return addresses as simply the
***************
*** 52,71 ****
  
  	register int loc, i = 0, cnt = 0, using_to = 0;
  	
- #ifndef INTERNET
- 	
- 	/** let's see if we have an address appropriate for hacking: 
- 	    what this actually does is remove the spuriously added
- 	    local bogus Internet header if we have one and the message
- 	    has some sort of UUCP component too...
- 	**/
- 
- 	sprintf(buffer, "@%s", hostfullname); 
- 	if (chloc(from,'!') != -1 && in_string(from, buffer))
- 	   from[strlen(from)-strlen(buffer)] = '\0';
- 
- #endif
- 
  	/**
  	    Produce a simplified version of the from into buffer.  If the
  	    from is just "username" or "Full Username" it will be preserved.
--- 44,49 ----
***************
*** 72,78 ****
  	    If it is an address, the rightmost "stuff!stuff", "stuff@stuff",
  	    or "stuff:stuff" will be used.
  	**/
! 	for (loc = strlen(from)-1; loc >= 0 && cnt < 2; loc--) {
  	  if (from[loc] == BANG || from[loc] == AT_SIGN ||
  	      from[loc] == COLON) cnt++;
  	  if (cnt < 2) buffer[i++] = from[loc];
--- 50,56 ----
  	    If it is an address, the rightmost "stuff!stuff", "stuff@stuff",
  	    or "stuff:stuff" will be used.
  	**/
! 	for (loc = strlen(from)-1; loc >= 0 && cnt < 2 && i < size; loc--) {
  	  if (from[loc] == BANG || from[loc] == AT_SIGN ||
  	      from[loc] == COLON) cnt++;
  	  if (cnt < 2) buffer[i++] = from[loc];
***************
*** 83,92 ****
  #ifdef MMDF
  	if (strlen(buffer) == 0) {
  	  if(to && *to != '\0' && !addr_matches_user(to, username)) {
! 	    tail_of(to, buffer, (char *)0);
  	    using_to = 1;
  	  } else
! 	    strcpy(buffer, full_username);
          }
  #endif /* MMDF */
  
--- 61,70 ----
  #ifdef MMDF
  	if (strlen(buffer) == 0) {
  	  if(to && *to != '\0' && !addr_matches_user(to, username)) {
! 	    tail_of(to, buffer, (char *)0, size);
  	    using_to = 1;
  	  } else
! 	    strfcpy(buffer, full_username, size);
          }
  #endif /* MMDF */
  
***************
*** 100,110 ****
  	   */
  
  	  if(to && *to != '\0' && !addr_matches_user(to, username)) {
! 	    tail_of(to, buffer, (char *)0);
  	    using_to = 1;
  	  } else
! 	    strcpy(buffer, full_username);
  
  	} else {					/* user%host@host? */
  
  	  /** The logic here is that we're going to use 'loc' as a handy
--- 78,91 ----
  	   */
  
  	  if(to && *to != '\0' && !addr_matches_user(to, username)) {
! 	    tail_of(to, buffer, (char *)0, size);
  	    using_to = 1;
  	  } else
! 	    strfcpy(buffer, full_username, size);
  
+ 	} else if (showto && to != 0 && strcmp (to, username) != 0) {
+ 		tail_of (to, buffer, (char *)0, size);
+ 		using_to = 1;
  	} else {					/* user%host@host? */
  
  	  /** The logic here is that we're going to use 'loc' as a handy
Index: elm2.4.ME+.50/lib/validname.c
*** elm2.4.25/lib/validname.c	Fri Dec 11 03:45:28 1992
--- elm2.4.ME+.50/lib/validname.c	Tue Nov 17 21:12:56 1998
***************
*** 1,36 ****
  
! static char rcsid[] = "@(#)$Id: validname.c,v 5.3 1992/12/11 01:45:04 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
   *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: validname.c,v $
!  * Revision 5.3  1992/12/11  01:45:04  syd
!  * remove sys/types.h include, it is now included by defs.h
!  * and this routine includes defs.h or indirectly includes defs.h
!  * From: Syd
!  *
!  * Revision 5.2  1992/12/07  04:55:16  syd
!  * add sys/types include for time_t
!  * From: Syd
!  *
!  * Revision 5.1  1992/10/03  22:41:36  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  #include <stdio.h>
  #include "defs.h"
  
  #ifndef NOCHECK_VALIDNAME		 /* Force a return of valid */
  # ifdef PWDINSYS
--- 1,20 ----
  
! static char rcsid[] = "@(#)$Id: validname.c,v 1.2 1998/10/20 19:57:48 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   *			Copyright (c) 1988-1992 USENET Community Trust
   *			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  #include <stdio.h>
  #include "defs.h"
+ #include "elmlib.h"
  
  #ifndef NOCHECK_VALIDNAME		 /* Force a return of valid */
  # ifdef PWDINSYS
***************
*** 40,48 ****
  # endif
  #endif
  
! int
! valid_name(name)
! char *name;
  {
  	/** Determine whether "name" is a valid logname on this system.
  	    It is valid if there is a password entry, or if there is
--- 24,33 ----
  # endif
  #endif
  
! /* This is quite bogus   - K E H <hurtta@ozone.FMI.FI> */
! 
! int valid_name(name)
!      char *name;
  {
  	/** Determine whether "name" is a valid logname on this system.
  	    It is valid if there is a password entry, or if there is
***************
*** 61,67 ****
  	if(getpwnam(name) != NULL)
  	  return(TRUE);
  
! 	sprintf(filebuf,"%s/%s", mailhome, name);
  	if (access(filebuf, ACCESS_EXISTS) == 0)
  	  return(TRUE);
  
--- 46,53 ----
  	if(getpwnam(name) != NULL)
  	  return(TRUE);
  
! 	elm_sfprintf(filebuf,sizeof filebuf,
! 		     FRM("%s/%s"), mailhome, name);
  	if (access(filebuf, ACCESS_EXISTS) == 0)
  	  return(TRUE);
  
Index: elm2.4.ME+.50/nls/C/C/C/s_aliases.m
*** elm2.4.25/nls/C/C/C/s_aliases.m	Sat Jun 12 08:26:18 1993
--- elm2.4.ME+.50/nls/C/C/C/s_aliases.m	Tue Nov 17 21:12:56 1998
***************
*** 243,245 ****
--- 243,247 ----
  143	T = Tag current alias and go to next alias.
  $ #Modified
  144	"(modified, resync needed) "
+ $ #AddressAs1
+ 145	Messages addressed as: %s
Index: elm2.4.ME+.50/nls/C/C/C/s_elm.m
*** elm2.4.25/nls/C/C/C/s_elm.m	Tue Aug  3 21:58:06 1993
--- elm2.4.ME+.50/nls/C/C/C/s_elm.m	Tue Nov 17 21:12:56 1998
***************
*** 451,459 ****
  $ #HdrmenuScreenTitle
  229	Message Header Edit Screen
  $ #HdrmenuInstruct
! 230	Choose header, u)ser defined header, d)omainize, !)shell, or <return>.
  $ #HdrmenuInstructNoShell
! 231	Choose header, u)ser defined header, d)omainize, or <return>.
  $quote "
  $ #HdrmenuPrompt
  232	"Choice: "
--- 451,459 ----
  $ #HdrmenuScreenTitle
  229	Message Header Edit Screen
  $ #HdrmenuInstruct
! 230	Choose header, u)ser defined header, !)shell, or <return>.
  $ #HdrmenuInstructNoShell
! 231	Choose header, u)ser defined header, or <return>.
  $quote "
  $ #HdrmenuPrompt
  232	"Choice: "
***************
*** 476,487 ****
  240	The user-defined header must begin with a letter or number.
  $ #HdrmenuUserdefMissingColon
  241	The user-defined header must have a colon after the field name.
- $ #HdrmenuDomInstruct
- 242	Select header to domainize:  T)o, C)c, B)cc, or <return>.
- $quote "
- $ #HdrmenuDomPrompt
- 243	"Domainize choice: "
- $quote
  $ #HelpMessage
  255	Press the key you want help for, '?' for a key list, or '.' to exit help
  $ #HelpPrompt
--- 476,481 ----
***************
*** 603,609 ****
  $ #HelpMakeMessageCurrent
  313	<number> = Make specified number the current message.
  $ #YouHaveNoPasswordEntry
! 314	You have no password entry!\r\n
  $ #CouldNotOpenDebugFile
  315	Could not open file %s for debug output!\n
  $ #NoTerm
--- 597,603 ----
  $ #HelpMakeMessageCurrent
  313	<number> = Make specified number the current message.
  $ #YouHaveNoPasswordEntry
! 314	You have no password entry!
  $ #CouldNotOpenDebugFile
  315	Could not open file %s for debug output!\n
  $ #NoTerm
***************
*** 787,793 ****
  $ #NoEncryptInBatch
  411	Sorry. Cannot send encrypted mail in "batch mode".\n
  $ #WriteFailedCopyAcross
! 412	\nWrite failed in copy_message_across\n
  $ #BounceOffRemote
  413	"Bounce" a copy off the remote machine? (%c/%c) "
  $ #WarningBlankIgnored
--- 781,787 ----
  $ #NoEncryptInBatch
  411	Sorry. Cannot send encrypted mail in "batch mode".\n
  $ #WriteFailedCopyAcross
! 412	Write failed in copy_message_across\n
  $ #BounceOffRemote
  413	"Bounce" a copy off the remote machine? (%c/%c) "
  $ #WarningBlankIgnored
***************
*** 988,994 ****
  $ #MatchSeekFailed
  522	ELM [match] failed looking %ld bytes into file (%s).
  $ #CouldntMallocBytes
! 523	\n\nCouldn't malloc %d bytes!!\n\n
  $ #ChangeToWhichFolder
  524	"Change to which folder: "
  $quote
--- 982,988 ----
  $ #MatchSeekFailed
  522	ELM [match] failed looking %ld bytes into file (%s).
  $ #CouldntMallocBytes
! 523	Couldn't malloc %d bytes!!
  $ #ChangeToWhichFolder
  524	"Change to which folder: "
  $quote
***************
*** 1000,1010 ****
  \t -dn\t\tDebug - set debug level to 'n'\n\r\
  \t -fx\t\tFolder - read folder 'x' rather than incoming mailbox\n\r\
  \t -h \t\tHelp - give this list of options\n\r\
! \t -ix\t\tInclude prepared file 'x' in edit buffer for send\n\r\
! \t -k \t\tKeypad - enable HP 2622 terminal keyboard\n\r
  $ #ArgsHelp2
! 536	\t -K \t\tKeypad&softkeys - enable use of softkeys + "-k"\n\r\
! \t -m \t\tMenu - Turn off menu, using more of the screen\n\r\
  \t -sx\t\tSubject 'x' - for batch mailing\n\r\
  \t -t \t\tTiTe - don't use termcap/terminfo ti/te entries.\n\r\
  \t -V \t\tEnable sendmail voyeur mode.\n\r\
--- 994,1002 ----
  \t -dn\t\tDebug - set debug level to 'n'\n\r\
  \t -fx\t\tFolder - read folder 'x' rather than incoming mailbox\n\r\
  \t -h \t\tHelp - give this list of options\n\r\
! \t -ix\t\tInclude prepared file 'x' in edit buffer for send\n\r
  $ #ArgsHelp2
! 536	\t -m \t\tMenu - Turn off menu, using more of the screen\n\r\
  \t -sx\t\tSubject 'x' - for batch mailing\n\r\
  \t -t \t\tTiTe - don't use termcap/terminfo ti/te entries.\n\r\
  \t -V \t\tEnable sendmail voyeur mode.\n\r\
***************
*** 1041,1056 ****
  $ #CouldNotOpenNewElmrc
  554	Warning: could not open new ".elm/elmrc" file! Using default parameters.\n\r
  $ #BadSortKeyInElmrc
! 555	I can't understand sort key "%s" in line %d in your ".elm/elmrc" file\n\r
  $ #BadAliasSortInElmrc
! 556	I can't understand alias sort key "%s" in line %d in your ".elm/elmrc" file\n\r
  $ #SignatureObsolete
! 557	"signature" used in obsolete way in .elm/elmrc file. Ignored!\n\r\
! \t(Signature should specify the filename to use rather than on/off.)\n\r\n
  $ #BouncebackGTMaxhops
  558	Warning: bounceback is set to greater than %d (max-hops). Ignored.\n\r
  $ #TimeoutLTTen
! 559	Warning: timeout is set to less than 10 seconds. Ignored.\n\r
  $ #BadLineElmrc
  560	I can't understand line %d in your ".elm/elmrc" file:\n\r> %s\n\r
  $ #BatchNoticeFoldersDir
--- 1033,1048 ----
  $ #CouldNotOpenNewElmrc
  554	Warning: could not open new ".elm/elmrc" file! Using default parameters.\n\r
  $ #BadSortKeyInElmrc
! 555	I can't understand sort key "%s" in line %d in "%s" file
  $ #BadAliasSortInElmrc
! 556	I can't understand alias sort key "%s" in line %d in "%s" file
  $ #SignatureObsolete
! 557	"signature" used in obsolete way in .elm/elmrc file. Ignored!\n\
! \t(Signature should specify the filename to use rather than on/off.)
  $ #BouncebackGTMaxhops
  558	Warning: bounceback is set to greater than %d (max-hops). Ignored.\n\r
  $ #TimeoutLTTen
! 559	Warning: timeout is set to less than 10 seconds. Ignored.
  $ #BadLineElmrc
  560	I can't understand line %d in your ".elm/elmrc" file:\n\r> %s\n\r
  $ #BatchNoticeFoldersDir
***************
*** 1063,1075 ****
  ELM requires the use of a folders directory to store your mail folders in.\n\r\
  Shall I create the directory %s for you (%c/%c/q)? %c%c
  $ #TooManyWeedHeaders
! 563	Too many weed headers!  Leaving...\n\r
  $ #TooManyWeedPmalloc
! 564	Too many weed headers! Out of memory!  Leaving...\n\r
  $ #NoMemDefaultWeed
! 565	\nNot enough memory for default weedlist. Leaving.\n
  $ #CannotInitErrorExpanding
! 566	\r\nCannot initialize "%s" - error expanding "%s".\r\n
  $ #CouldntMakeTempFileName
  567	Sorry - couldn't make file temp file name.
  $ #CouldntOpenForWriting
--- 1055,1067 ----
  ELM requires the use of a folders directory to store your mail folders in.\n\r\
  Shall I create the directory %s for you (%c/%c/q)? %c%c
  $ #TooManyWeedHeaders
! 563	Too many weed headers!  Leaving...
  $ #TooManyWeedPmalloc
! 564	Too many weed headers! Out of memory!  Leaving...
  $ #NoMemDefaultWeed
! 565	Not enough memory for default weedlist. Leaving.
  $ #CannotInitErrorExpanding
! 566	Cannot initialize "%s" - error expanding "%s".
  $ #CouldntMakeTempFileName
  567	Sorry - couldn't make file temp file name.
  $ #CouldntOpenForWriting
***************
*** 1423,1447 ****
  $ #SortUnknown
  740	*UNKNOWN-SORT-PARAMETER*
  $ #EnterLastSelected
! 741	Enter: {"subject","to","from"} [pattern] OR "all"
  $ #EnterSelected
! 742	Enter: {"subject","to","from"} [pattern]
  $ #HelpUndeletePattern
  743	^U = Undelete all messages with the specified pattern.
  $ #NoIncludeFilename
! 744	\n\rNo Filename given, include line ignored\n\r
  $ #NoContentTypeGiven
! 745	\n\rNo Content-type given, include line ignored\n\r
  $ #EncodingIsIllegal
! 746	\n\rEncoding is illegal\n\r
  $ #IncludeCannotAccess
! 747	\n\rInclude File can't be accessed\n\r
  $ #UnknownEncodingInInclude
  748	\n\rUnknown Encoding, include line ignored\n\r
  $ #CantStatIncludedFile
  749	\n\rCan't stat included File,ignored\n\r
  $ #CantOpenIncludedFile
! 750	\nCan't open included File\n
  $ #PressAnyKeyIndex
  751	Press any key to return to index.
  $ #ArgsInclFileNotSend
--- 1415,1439 ----
  $ #SortUnknown
  740	*UNKNOWN-SORT-PARAMETER*
  $ #EnterLastSelected
! 741	Enter: {"subject","to","from","cc"} [pattern] OR {"thread","tagged","all"}
  $ #EnterSelected
! 742	Enter: {"subject","to","from"} [pattern] OR {"thread","tagged"}
  $ #HelpUndeletePattern
  743	^U = Undelete all messages with the specified pattern.
  $ #NoIncludeFilename
! 744	No Filename given, include line ignored
  $ #NoContentTypeGiven
! 745	No Content-type given, include line ignored
  $ #EncodingIsIllegal
! 746	Encoding is illegal
  $ #IncludeCannotAccess
! 747	Include File can't be accessed
  $ #UnknownEncodingInInclude
  748	\n\rUnknown Encoding, include line ignored\n\r
  $ #CantStatIncludedFile
  749	\n\rCan't stat included File,ignored\n\r
  $ #CantOpenIncludedFile
! 750	Can't open included File
  $ #PressAnyKeyIndex
  751	Press any key to return to index.
  $ #ArgsInclFileNotSend
***************
*** 1559,1565 ****
  $ #CouldntSeekBytesIntoTempFile
  822	\nCouldn't seek %ld bytes into temp file.\n
  $ #CannotExpand
! 823	Cannot expand alias '%s'!\n\r
  $ #NoItemToScan
  824	No %s to scan!
  $quote "
--- 1551,1557 ----
  $ #CouldntSeekBytesIntoTempFile
  822	\nCouldn't seek %ld bytes into temp file.\n
  $ #CannotExpand
! 823	Cannot expand alias '%s'!
  $ #NoItemToScan
  824	No %s to scan!
  $quote "
***************
*** 1585,1593 ****
  $ #OptionReturnHelp
  834	i,q = Return from option menu.
  $ #ReadMessageIncrement
! 835	Warning: readmsginc is set to less than 1.  Ignored.\n\r
  $ #SleepMessageInvalid
! 836	Warning: sleepmsg is set to less than 0.  Setting to 0.\n\r
  $ #VfyPromptPleaseChoose
  837	Please choose one of the following options by parenthesized letter: s
  $ #VfyMenuUser0
--- 1577,1585 ----
  $ #OptionReturnHelp
  834	i,q = Return from option menu.
  $ #ReadMessageIncrement
! 835	Warning: readmsginc is set to less than 1.  Ignored.
  $ #SleepMessageInvalid
! 836	Warning: sleepmsg is set to less than 0.  Setting to 0.
  $ #VfyPromptPleaseChoose
  837	Please choose one of the following options by parenthesized letter: s
  $ #VfyMenuUser0
***************
*** 1614,1616 ****
--- 1606,1942 ----
  847	Message kept.  Can be restored at next f)orward, m)ail or r)eply.
  $ #VfyNoFieldsInForm
  848	No fields in form!\007
+ $ #HelpViewAttach
+ 849	v = View Attachments in current message.
+ $ #BadModeInElmrc
+ 850	I can't understand file permissions "%s" in line %d in "%s" file
+ $ #BadKeyInElmrc
+ 851	I can't understand keyword "%s" in line %d in "%s" file
+ $ #SendingMailBackground
+ 852	Sending mail... in background
+ $ #ResendingMailBackground
+ 853	Resending mail... in background
+ $ #CouldntLockFolder
+ 854	Couldn't lock folder %s!
+ $ #IncludeBINARY
+ 855	Include file has BINARY data.
+ $ #Include8BIT
+ 856	Include file has 8BIT data.
+ $ #Doesnt8BIT
+ 857	Mailer (MTA) doesn't support 8BIT encoding.
+ $ #DoesntBINARY
+ 858	Mailer (MTA) doesn't support BINARY encoding!
+ $ #DontEncoding
+ 859	Content-Type don't allow encoding -- ignoring this part.
+ $ #CantMetamail
+ 860	Can't execute metamail: %s.30: %.30s
+ $ #FolderRemoved
+ 861	Folder removed.
+ $ #BadEKeyInElmrc
+ 862	I can't understand %s key "%s" in line %d in "%s" file
+ $ #BadEKeyValues
+ 863	Possible values are:
+ $ #LongValueInElmrc
+ 864	Value of "%s" in line %d in "%s" file is too long
+ $ #BackgroundLLT
+ 865	Warning: background_wait_time is set less than 0. Setting to 0.
+ $ #ErrorReading
+ 866	Error reading from %.50s
+ $ #ErrorReadableUser
+ 867	%.50s isn't readable by user!	
+ $ #CantOpenAttach
+ 868	Can't open attachment: %.50s
+ $ #InternalnoFD
+ 869	Internal error: no parent fd!
+ $ #FailedSeekAttach
+ 870	Failed to seek beginning of attachment!
+ $ #WriteErrorAttach
+ 871	Write error when copying attachment!
+ $ #ErrorCreatTempfile
+ 872	Error creating tempfile %s
+ $ #JobSpooled
+ 873	Print job spooled.
+ $ #ErrorPrinting
+ 874	Error while printing!
+ $ #NotKnowPrint
+ 875	Don't know how to print this type of data!
+ $ #MailNotSaved
+ 876	Mail not saved.
+ $ #NoPermissionWrite
+ 875	You do not have permission to write that file!
+ $ #ErrorOpening
+ 876	Error opening file!
+ $ #UnsupportedEncoding
+ 877	Unsupported encoding! Decode manually!
+ $ #ErrorSaving
+ 878	Error saving file!
+ $ #MailSaved
+ 879	Mail saved.
+ $ #CantStat
+ 880	Can't stat file!
+ $ #CouldOpenReading
+ 881	Could not open file for reading!
+ $ #StrucredNoEncoding
+ 882	%.30s: Structured types don't allow encoding of data.
+ $ #NotKnowPrint
+ 883	Don't know how to print this type of data!
+ $ #MailNotSaved
+ 884	Mail not saved.
+ $ #CantRenameTmpFile
+ 885	Could not rename temporary file!
+ $ #CantLinkTmpFile
+ 886	Could not create link to temporary file!
+ $ #CantUnLinkTmpFile
+ 887	Could not unlink temporary file!
+ $ #PgpNonZeroValue
+ 888	Pgp returned a non-zero value!
+ $ #RunningPgp
+ 889	Running PGP...
+ $ #FailSignal
+ 890	%.30s fail: Signal?
+ $ #FailErrno
+ 891	Failed: %.30s: %.40s
+ $ #PgpErrorStatus
+ 892	Pgp returned error status %d
+ $ #PgpDone
+ 893	Running PGP... Done.
+ $ #LostErrno
+ 894	%.30s lost: %.40s
+ $ #CantStart
+ 895	Can't start %.30s
+ $ #OpenTmpWriting
+ 896	Could not open temp file %.30s for writing!
+ $ #CantChangeFilename
+ 897	You can't change filename!
+ $ #ErrorAccess
+ 898	%.45s: %.33s
+ $ #WarningBINARY
+ 899	Warning: BINARY data? Check Content-Type!
+ $ #StructuredNoencoding
+ 900	Structured types don't allow encoding of data.
+ $ #StructuredLeaf
+ 901	Structured types must be encoded in leaf type!
+ $ #UnknownCommand2
+ 902	Unknown command.
+ $ #FileNotExist
+ 903	That file %.20s does not exist!
+ $ #CantStatFile
+ 904	Could not stat file %.20s!
+ $ #NotReadableByUser
+ 905	%.50s isn't readable by user!
+ $ #CheckingEncoding
+ 906	Checking %s...
+ $ #CantOpenFile
+ 907	Can't open %s!
+ $ #NoAttachments
+ 908	There are no attachments!
+ $ #LastAttachment
+ 909	You are on the last attachment!
+ $ #FirstAttachment
+ 910	You are on the first attachment!
+ $ #PassphraseForgotten
+ 911	Passphrase forgotten!
+ $ #UnknownCommand3
+ 912	Unknown command: %c
+ $ #BuiltInMore
+ 913	MORE (you've seen %d%%):
+ $ #PgpMultipleKeys
+ 914	Multiple keys match '%s':
+ $ #PgpPublicKey
+ 915	PGP public key for %s
+ $ #RemailTo
+ 916	Remail to %.50s...
+ $ #MsgDeleted
+ 917	Message deleted.
+ $ #MsgsDeleted
+ 918	%d messages deleted.
+ $ #PagerStatDeleted
+ 919	[Deleted] %d/%d 
+ $ #PagerStatMessage
+ 920	Message %d/%d 
+ $ #PagerFailedTmpFile
+ 921	Failed to create temporary file!
+ $ #AttachMenu
+ 922	Attachment Menu (%d attachments)
+ $ #ErrorReadMailfile
+ 923	Error when reading mailfile %s
+ $ #ForwardedMesg
+ 924	Forwarded message from %s
+ $ #MailTo
+ 925	Mail to %.50s...
+ $ #FailFileForward
+ 926	Failed to create file for forwarding
+ $ #UsingUNKNOWN8BIT
+ 927	Text has 8BIT data and charset=US-ASCII, using charset=UNKNOWN-8BIT instead.
+ $ #FixInclude
+ 928	Please fix [include ...] lines!
+ $ #AccessAttach
+ 929	Can't access attachment: %.50s
+ $ #BadAttach
+ 930	Bad attachment -- no filename!
+ $ #PgpAlreadyEncSig
+ 931	This message is already encrypted and/or signed!
+ $ #FailedSeekBytes
+ 932	Failed to seek %d bytes into file!
+ $ #PgpNoMatch
+ 933	Couldn't find key matching '%s'!
+ $ #HeaderUsingUNKNOWN8BIT
+ 934	Header has 8BIT data and charset=US-ASCII, using charset=UNKNOWN-8BIT instead.
+ $ #HeaderBadCharset
+ 935	Bad charset=%s, using charset=UNKNOWN-8BIT instead.
+ $ #ErrorOpeningName
+ 936	Error opening %s!
+ $ #ErrorWhenReading
+ 937	Error when reading: %s
+ $ #FailedLeaveFolder
+ 938	Failed to leave folder!
+ $ #FailedResyncFolder
+ 939	Failed to resync folder!
+ $ #ALERTMailfileShrinken
+ 940	ALERT: Mailfile shrinken %d bytes!
+ $ #NoFolderEditing
+ 941	You are not experienced to use folder editing
+ $ #NoPgpPublicKeys
+ 942	This message does not contain PGP public keys!
+ $ #NoMIMEMessage
+ 945	This is not a MIME message!
+ $ #NoMessages
+ 946	There are no messages!
+ $ #DecryptBadPGP
+ 947	Decrypting message... Bad PGP passphrase.
+ $ #DecryptFailInitPGP
+ 948	Decrypting message... Failed to init PGP.
+ $ #DecryptFailInitPGPRaw
+ 949	[Decrypting message... Failed to init PGP. Raw data follows.]\n
+ $ #DecryptEndRaw
+ 950	[Decrypting message... End of raw data.]\n
+ $ #Sigaction
+ 951	sigaction: %s
+ $ #ReadFailedCopy
+ 952	Read failed in copy
+ $ #Fingering
+ 953	Fingering %s...
+ $ #RemailerReading
+ 954	Reading %s...
+ $ #RemailerCoulntTime
+ 955	Could not convert time for remailer %s!
+ $ #RemailerCouldntList
+ 956	Could not retrieve list of remailers!
+ $ #RemailerErrorTemp
+ 957	Error opening temp file!
+ $ #RemailerErrorTempRename
+ 958	Could not rename temp file!
+ $ #RemailerDatabase
+ 959	Could not find remailer database!
+ $ #RemailerFind
+ 960	Could not find remailer '%s'.
+ $ #RemailerTempWriting
+ 961	Could not open temp file for writing!
+ $ #RemailerFormating
+ 962	Error while formatting for remailer!
+ $ #RemailerTempRead
+ 963	Could not read temp file!
+ $ #BuiltinHelpTitle
+ 964	Help for builtin++
+ $ #BuiltinHelpKeyA
+ 965	Key\t\tAction
+ $ #BuiltinHelpSpace
+ 966	<SPACE>, +\tNext page.
+ $ #BuiltinHelpMinus
+ 967	-\t\tPrevious page.
+ $ #BuiltinHelpReturn
+ 968	<RETURN>\tNext line.
+ $ #BuiltinHelpq
+ 969	q, x, i\t\tReturn to the index menu.
+ $ #BuiltinHelpDiv
+ 970	/\t\tSearch for pattern in message.
+ $ #BuiltinHelpArr
+ 971	^\t\tFirst page.
+ $ #BuiltinHelpG
+ 972	G\t\tLast page.
+ $ #BuiltinHelpCtrlL
+ 973	^L\t\tRefresh display.
+ $ #BuiltinHelpCtrlP
+ 974	^P\t\tUp one line.
+ $ #BuiltinHelpCtrlD
+ 975	^D\t\tDown one-half page.
+ $ #BuiltinHelpCtrlU
+ 976	^U\t\tUp one-half page.
+ $ #BuiltinHelpQuestion
+ 977	?\t\tThis help screen.
+ $ #BuiltinMore0
+ 978	More (you've seen 0%%)
+ $ #BuiltinCommandi
+ 979	Command ('i' to return to index):
+ $ #PgpEncrypt
+ 980	Encrypt
+ $ #PgpSign
+ 981	Sign
+ $ #PgpSignEncrypt
+ 982	Sign and Encrypt
+ $ #WriteFMimeEncode
+ 983	Write failed in mime_encode\n
+ $ #WriteFWriteEncoded
+ 984	Write failed in write_encoded\n
+ $ #ExtractPGPKey
+ 985	Extract PGP public key
+ $ #DebugHeader
+ 986	Num      From                    Subject                Lines   Offset  Content\n\r\n\r
+ $ #VfyMenuAtttach
+ 987	Attachments
+ $ #VfyMenuDsn
+ 988	Dsn
+ $ #VfyMenuSend
+ 989	Send
+ $ #VfyMenuForget
+ 990	Forget
+ $ #VfyMenuCopyFile
+ 991	Copy file
+ $ #VfyMenuEdit
+ 992	Edit
+ $ #VfyMenuHeaders
+ 993	Headers
+ $ #VfyMenuIspell2
+ 994	Ispell
+ $ #VfyMenuPgp
+ 995	Pgp
+ $ #Menu2True
+ 996	TRUE
+ $ #Menu2False
+ 997	FALSE
+ $ #BuiltinHelpPressRet
+ 998	Press any key to return...
+ $ #BuiltinNotFound
+ 999	NOT FOUND!
+ $ #BuiltinSearch
+ 1000	Search%s
+ $ #PgpTo
+ 1001	To%s
+ $ #PgpFrom
+ 1002	From%s
+ $ #PgpP
+ 1003	pgp%s
+ $ #PgpEntUser
+ 1004	Enter userid of public key%s
+ $ #DbxCurrMsgNum
+ 1005	Current message number = %d\t\t%d message(s) total\n
+ $ #DbxHdrPage
+ 1006	Header_page = %d           \t\t%d possible page(s)\n
+ $ #DbxCurrMailFile
+ 1007	\nCurrent mail file is %s.\n\r\n
+ $ #DbxPressAnyKey
+ 1008	Press any key to return.
+ $ #TerminatedWithSignal
+ 1009	Terminated with signal %d. Press any key to continue: 
+ $ #ExitedWithStatus
+ 1010	Exited with status %d. Press any key to continue: 
+ $ #DoneCont
+ 1011	Done. Press any key to continue: 
+ $ #MetaPagePressAnyKey
+ 1012	Press any key to continue...
+ $ #ToParen
+ 1013	To: (%s)
+ $ #ToNoParen
+ 1014	To: %s
+ $ #ToNoParen2
+ 1015	          To: %s
Index: elm2.4.ME+.50/nls/Makefile
*** elm2.4.25/nls/Makefile	Thu Mar 10 19:21:47 1994
--- elm2.4.ME+.50/nls/Makefile	Tue Nov 17 21:12:57 1998
***************
*** 8,13 ****
--- 8,15 ----
  HFILES=	$(HDIR)/s_aliases.h \
  	$(HDIR)/s_answer.h \
  	$(HDIR)/s_elm.h \
+ 	$(HDIR)/s_me.h \
+ 	$(HDIR)/s_elmalias.h \
  	$(HDIR)/s_elmrc.h \
  	$(HDIR)/s_error.h \
  	$(HDIR)/s_fastmail.h \
***************
*** 20,25 ****
--- 22,29 ----
  MFILES=	$(SDIR)/s_aliases.m \
  	$(SDIR)/s_answer.m \
  	$(SDIR)/s_elm.m \
+ 	$(SDIR)/s_me.m \
+ 	$(SDIR)/s_elmalias.m \
  	$(SDIR)/s_elmrc.m \
  	$(SDIR)/s_error.m \
  	$(SDIR)/s_fastmail.m \
Index: elm2.4.ME+.50/nls/gencat/Makefile
*** elm2.4.25/nls/gencat/Makefile	Wed Jul  1 03:56:25 1992
--- elm2.4.ME+.50/nls/gencat/Makefile	Tue Nov 17 21:12:57 1998
***************
*** 6,19 ****
  
  all:	gencat dumpmsg
  
! gencat:	gencat.o genlib.o
! 	$(CC) $(CFLAGS) -o $@ gencat.o genlib.o
  
! dumpmsg: dumpmsg.o genlib.o
! 	$(CC) $(CFLAGS) -o $@ dumpmsg.o genlib.o
  
  clean:
  	rm -f gencat.o genlib.o dumpmsg.o *~ *.bak gencat dumpmsg
  
  gencat.o:	gencat.h
! genlib.o:	gencat.h ../../hdrs/msgcat.h
--- 6,19 ----
  
  all:	gencat dumpmsg
  
! gencat:	gencat.o genlib.o ../../lib/libutil.a
! 	$(CC) $(CFLAGS) -o $@ gencat.o genlib.o ../../lib/libutil.a
  
! dumpmsg: dumpmsg.o genlib.o  ../../lib/libutil.a
! 	$(CC) $(CFLAGS) -o $@ dumpmsg.o genlib.o ../../lib/libutil.a
  
  clean:
  	rm -f gencat.o genlib.o dumpmsg.o *~ *.bak gencat dumpmsg
  
  gencat.o:	gencat.h
! genlib.o:	gencat.h ../../hdrs/msgcat.h ../../hdrs/elmlib.h
Index: elm2.4.ME+.50/nls/gencat/gencat.c
*** elm2.4.25/nls/gencat/gencat.c	Mon Aug 23 05:46:29 1993
--- elm2.4.ME+.50/nls/gencat/gencat.c	Tue Nov 17 21:12:57 1998
***************
*** 68,74 ****
  #if ANSI_C || defined(__cplusplus)
  # define P_(x) x
  #else
! # define P_(x) /**/
  #endif
  
  static void writeIfChanged P_((char *fname, int lang, int orConsts));
--- 68,74 ----
  #if ANSI_C || defined(__cplusplus)
  # define P_(x) x
  #else
! # define P_(x) ()
  #endif
  
  static void writeIfChanged P_((char *fname, int lang, int orConsts));
***************
*** 197,203 ****
      }
  
      /* If it does exist, create a temp file for now */
!     sprintf(tmpname, "/tmp/gencat.%d", (int) getpid());
      if ((tfd = open(tmpname, O_RDWR|O_CREAT, 0666)) < 0) {
  	fprintf(stderr, "gencat: Unable to open temporary file: %s\n", tmpname);
  	exit(1);
--- 197,204 ----
      }
  
      /* If it does exist, create a temp file for now */
!      elm_sfprintf(tmpname, sizeof tmpname,
!            FRM("/tmp/gencat.%d"), (int) getpid());
      if ((tfd = open(tmpname, O_RDWR|O_CREAT, 0666)) < 0) {
  	fprintf(stderr, "gencat: Unable to open temporary file: %s\n", tmpname);
  	exit(1);
Index: elm2.4.ME+.50/nls/gencat/gencat.h
*** elm2.4.25/nls/gencat/gencat.h	Mon Aug 23 05:46:29 1993
--- elm2.4.ME+.50/nls/gencat/gencat.h	Tue Nov 17 21:12:57 1998
***************
*** 86,92 ****
  #if ANSI_C || defined(__cplusplus)
  # define P_(x) x
  #else
! # define P_(x) /**/
  #endif
  
  extern void MCAddSet P_((int setId, char *c));
--- 86,92 ----
  #if ANSI_C || defined(__cplusplus)
  # define P_(x) x
  #else
! # define P_(x) ()
  #endif
  
  extern void MCAddSet P_((int setId, char *c));
Index: elm2.4.ME+.50/nls/gencat/genlib.c
*** elm2.4.25/nls/gencat/genlib.c	Sun Nov 15 03:05:11 1992
--- elm2.4.ME+.50/nls/gencat/genlib.c	Tue Nov 17 21:12:57 1998
***************
*** 273,282 ****
  char *ostr;
  {
      char	*nstr;
  
!     nstr = (char *) malloc(strlen(ostr) + 1);
      if (!nstr) error(NULL, "unable to allocate storage");
!     strcpy(nstr, ostr);
      return(nstr);
  }
  
--- 273,283 ----
  char *ostr;
  {
      char	*nstr;
+     int Len = strlen(ostr) + 1;
  
!     nstr = (char *) malloc(Len);
      if (!nstr) error(NULL, "unable to allocate storage");
!     strfcpy(nstr, ostr, Len);
      return(nstr);
  }
  
***************
*** 373,379 ****
  		cptr = wskip(cptr);
  		if (*cptr == '#') {
  		    ++cptr;
! 		    strcpy(hconst, token(cptr));
  		}
  	    } else {
  		if (*cptr) {
--- 374,380 ----
  		cptr = wskip(cptr);
  		if (*cptr == '#') {
  		    ++cptr;
! 		    strfcpy(hconst, token(cptr), sizeof hconst);
  		}
  	    } else {
  		if (*cptr) {
Index: elm2.4.ME+.50/src/Makefile.SH
*** elm2.4.25/src/Makefile.SH	Thu Dec 24 23:42:05 1992
--- elm2.4.ME+.50/src/Makefile.SH	Tue Nov 17 21:14:08 1998
***************
*** 19,44 ****
  if test "$mailermode" = 755; then
  	chgrp=":"
  fi
  cat >Makefile <<!GROK!THIS!
! # $Id: Makefile.SH,v 5.1 1992/10/03 22:58:40 syd Exp $
  #
  #  Makefile for the ELM mail program.
  #
  #	Copyright (c) 1988-1992 USENET Community Trust
  #	Copyright (c) 1986,1987 Dave Taylor
- #
- # Bug reports, patches, comments, suggestions should be sent to:
- #
- #	Syd Weinstein - elm@DSI.COM
- #			dsinc!elm
- #
- # $Log: Makefile.SH,v $
- # Revision 5.1  1992/10/03  22:58:40  syd
- # Initial checkin as of 2.4 Release at PL0
- #
- # Revision 5.1  1992/10/03  22:58:40  syd
- # Initial checkin as of 2.4 Release at PL0
- #
  # 
  #
  # Variables
--- 19,41 ----
  if test "$mailermode" = 755; then
  	chgrp=":"
  fi
+ 
+ case "$d_locale" in
+ define)
+ 	localetarget='$(LIB)/elm.mimecharsets'
+ 	;;
+ *)
+ 	localetarget=
+ 	;;
+ esac
+ 
  cat >Makefile <<!GROK!THIS!
! # $Id: Makefile.SH,v 1.3 1998/11/17 15:09:00 hurtta Exp $
  #
  #  Makefile for the ELM mail program.
  #
  #	Copyright (c) 1988-1992 USENET Community Trust
  #	Copyright (c) 1986,1987 Dave Taylor
  # 
  #
  # Variables
***************
*** 63,68 ****
--- 60,67 ----
  TOUCH		=	$touch
  TAGS		=	ctags
  
+ LOCALETARG	=	$localetarget
+ 
  !GROK!THIS!
  
  cat >>Makefile <<'!NO!SUBS!'
***************
*** 78,84 ****
  
  #	Other general variables
  BIN		=	../bin
! CFLAGS		=	$(CCFLAGS) $(OPTIMIZE) -I$(INCLDIR) $(DEBUG) $(DACSNET) 
  INCLDIR		=	../hdrs
  LINTFLAGS	=	-I$(INCLDIR)
  SHELL		=	/bin/sh
--- 77,83 ----
  
  #	Other general variables
  BIN		=	../bin
! CFLAGS		=	-I$(INCLDIR) $(CCFLAGS) $(OPTIMIZE) $(DEBUG) $(DACSNET) 
  INCLDIR		=	../hdrs
  LINTFLAGS	=	-I$(INCLDIR)
  SHELL		=	/bin/sh
***************
*** 92,99 ****
  			a_screen.c	\
  			a_sort.c	\
  			a_quit.c	\
! 			bouncebk.c	\
! 			builtin.c	\
  			calendar.c	\
  			curses.c	\
  			date.c		\
--- 91,98 ----
  			a_screen.c	\
  			a_sort.c	\
  			a_quit.c	\
! 			attach_menu.c	\
! 			builtin++.c	\
  			calendar.c	\
  			curses.c	\
  			date.c		\
***************
*** 118,133 ****
  			limit.c		\
  			mailmsg1.c	\
  			mailmsg2.c	\
! 			mime.c		\
  			mkhdrs.c	\
  			newmbox.c	\
  			options.c	\
  			out_utils.c	\
  			pattern.c	\
! 			pmalloc.c	\
  			quit.c		\
  			read_rc.c	\
  			remail.c	\
  			reply.c		\
  			returnadd.c	\
  			save_opts.c	\
--- 117,137 ----
  			limit.c		\
  			mailmsg1.c	\
  			mailmsg2.c	\
! 			menu.c		\
! 			menu2.c		\
! 			metapager.c	\
! 		 	mime.c          \
! 			mime_encode.c	\
  			mkhdrs.c	\
  			newmbox.c	\
  			options.c	\
  			out_utils.c	\
  			pattern.c	\
! 			pgp.c		\
  			quit.c		\
  			read_rc.c	\
  			remail.c	\
+ 			remailer.c	\
  			reply.c		\
  			returnadd.c	\
  			save_opts.c	\
***************
*** 136,142 ****
  			showmsg.c	\
  			showmsg_c.c	\
  			signals.c	\
- 			softkeys.c	\
  			sort.c		\
  			string2.c	\
  			strings.c	\
--- 140,145 ----
***************
*** 144,160 ****
  			utils.c		\
  			wildcards.c	\
  			wordwrap.c
  
  ELM_OBJ		=	addr_util.o	\
  			alias.o		\
  			aliaslib.o	\
  			args.o		\
  			a_edit.o	\
  			a_screen.o	\
  			a_sort.o	\
  			a_quit.o	\
! 			bouncebk.o	\
! 			builtin.o	\
  			calendar.o	\
  			curses.o	\
  			date.o		\
--- 147,164 ----
  			utils.c		\
  			wildcards.c	\
  			wordwrap.c
+ #			softkeys.c	
  
  ELM_OBJ		=	addr_util.o	\
  			alias.o		\
  			aliaslib.o	\
  			args.o		\
+ 			attach_menu.o	\
  			a_edit.o	\
  			a_screen.o	\
  			a_sort.o	\
  			a_quit.o	\
! 			builtin++.o	\
  			calendar.o	\
  			curses.o	\
  			date.o		\
***************
*** 179,194 ****
  			limit.o		\
  			mailmsg1.o	\
  			mailmsg2.o	\
  			mime.o		\
  			mkhdrs.o	\
  			newmbox.o	\
  			options.o	\
  			out_utils.o	\
  			pattern.o	\
! 			pmalloc.o	\
  			quit.o		\
  			read_rc.o	\
  			remail.o	\
  			reply.o		\
  			returnadd.o	\
  			save_opts.o	\
--- 183,203 ----
  			limit.o		\
  			mailmsg1.o	\
  			mailmsg2.o	\
+ 			menu.o		\
+ 			menu2.o		\
+ 			metapager.o	\
  			mime.o		\
+ 			mime_encode.o	\
  			mkhdrs.o	\
  			newmbox.o	\
  			options.o	\
  			out_utils.o	\
  			pattern.o	\
! 			pgp.o		\
  			quit.o		\
  			read_rc.o	\
  			remail.o	\
+ 			remailer.o	\
  			reply.o		\
  			returnadd.o	\
  			save_opts.o	\
***************
*** 197,203 ****
  			showmsg.o	\
  			showmsg_c.o	\
  			signals.o	\
- 			softkeys.o	\
  			sort.o		\
  			string2.o	\
  			strings.o	\
--- 206,211 ----
***************
*** 205,219 ****
  			utils.o		\
  			wildcards.o	\
  			wordwrap.o
  
  # Standard targets
! all:		$(BIN)/elm
  
! install:	$(DEST)/elm
  
  uninstall:	
  		$(RM) $(DEST)/elm
  
  #	This is the only target that gets installed even if not out-of-date
  #	with respect the files from which it is installed.
  rmt-install:	rmt-defined
--- 213,233 ----
  			utils.o		\
  			wildcards.o	\
  			wordwrap.o
+ #			softkeys.o	
  
  # Standard targets
! all:		Makefile $(BIN)/elm
  
! install:	Makefile $(DEST)/elm $(LOCALETARG)
  
  uninstall:	
  		$(RM) $(DEST)/elm
  
+ Makefile: Makefile.SH ../config.sh
+ 	@echo "You must run 'sh Configure -S' or 'sh Configure'"
+ 	exit 1
+ 
+ 
  #	This is the only target that gets installed even if not out-of-date
  #	with respect the files from which it is installed.
  rmt-install:	rmt-defined
***************
*** 250,260 ****
  			$(CHMOD) u+w $@
  			$(TOUCH) $@
  
! $(INCLDIR)/elm.h:	$(INCLDIR)/curses.h $(INCLDIR)/defs.h
  			$(CHMOD) u+w $@
  			$(TOUCH) $@
  
! $(INCLDIR)/headers.h:	$(INCLDIR)/curses.h $(INCLDIR)/defs.h
  			$(CHMOD) u+w $@
  			$(TOUCH) $@
  
--- 264,274 ----
  			$(CHMOD) u+w $@
  			$(TOUCH) $@
  
! $(INCLDIR)/elm.h:	$(INCLDIR)/curses.h $(INCLDIR)/defs.h  $(INCLDIR)/me.h
  			$(CHMOD) u+w $@
  			$(TOUCH) $@
  
! $(INCLDIR)/headers.h:	$(INCLDIR)/curses.h $(INCLDIR)/defs.h $(INCLDIR)/mime.h $(INCLDIR)/me.h $(INCLDIR)/elmlib.h
  			$(CHMOD) u+w $@
  			$(TOUCH) $@
  
***************
*** 267,309 ****
  a_screen.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_aliases.h
  a_sort.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_aliases.h
  a_quit.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_aliases.h
! bouncebk.o:	$(INCLDIR)/headers.h
! builtin.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  calendar.o:	$(INCLDIR)/headers.h
! curses.o:	$(INCLDIR)/headers.h
  date.o:		$(INCLDIR)/headers.h
  delete.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  edit.o:		$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  editmsg.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! elm.o:		$(INCLDIR)/elm.h $(INCLDIR)/s_elm.h
  encode.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! exitprog.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  expires.o:	$(INCLDIR)/headers.h
! file.o:		$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! file_util.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! fileio.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  find_alias.o:	$(INCLDIR)/headers.h
  forms.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! hdrconfg.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  help.o:		$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! in_utils.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! init.o:		$(INCLDIR)/headers.h $(INCLDIR)/patchlevel.h $(INCLDIR)/s_elm.h
! leavembox.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! lock.o:		$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  limit.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/s_aliases.h
  mailmsg1.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! mailmsg2.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! mkhdrs.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! mime.o:		$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! newmbox.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  options.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/save_opts.h
  out_utils.o:	$(INCLDIR)/headers.h
  pattern.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! pmalloc.o:	$(INCLDIR)/defs.h $(INCLDIR)/s_elm.h
  quit.o:		$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  read_rc.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/save_opts.h
! remail.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! reply.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  returnadd.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  save_opts.o:	$(INCLDIR)/save_opts.h $(INCLDIR)/headers.h $(INCLDIR)/s_elmrc.h
  savecopy.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
--- 281,328 ----
  a_screen.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_aliases.h
  a_sort.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_aliases.h
  a_quit.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_aliases.h
! attach_menu.o:	$(INCLDIR)/headers.h $(INCLDIR)/me.h $(INCLDIR)/s_elm.h
! builtin++.o:	$(INCLDIR)/headers.h $(INCLDIR)/me.h
  calendar.o:	$(INCLDIR)/headers.h
! curses.o:	$(INCLDIR)/headers.h $(INCLDIR)/me.h
  date.o:		$(INCLDIR)/headers.h
  delete.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  edit.o:		$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  editmsg.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! elm.o:		$(INCLDIR)/elm.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h $(INCLDIR)/patchlevel.h
  encode.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! exitprog.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
  expires.o:	$(INCLDIR)/headers.h
! file.o:		$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
! file_util.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
! fileio.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
  find_alias.o:	$(INCLDIR)/headers.h
  forms.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! hdrconfg.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
  help.o:		$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! in_utils.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
! init.o:		$(INCLDIR)/headers.h $(INCLDIR)/patchlevel.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
! leavembox.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
  limit.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/s_aliases.h
+ lock.o:		$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  mailmsg1.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! mailmsg2.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h $(INCLDIR)/menu2.h
! menu2.o:	$(INCLDIR)/headers.h $(INCLDIR)/me.h $(INCLDIR)/menu2.h
! menu.o:		$(INCLDIR)/headers.h $(INCLDIR)/me.h $(INCLDIR)/menu.h
! metapager.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
! mime.o:		$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
! mime_encode.o:   $(INCLDIR)/headers.h $(INCLDIR)/me.h
! mkhdrs.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
! newmbox.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
  options.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/save_opts.h
  out_utils.o:	$(INCLDIR)/headers.h
  pattern.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! pgp.o:		$(INCLDIR)/headers.h $(INCLDIR)/me.h
  quit.o:		$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  read_rc.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/save_opts.h
! remail.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
! remailer.o:	$(INCLDIR)/headers.h $(INCLDIR)/me.h $(INCLDIR)/menu2.h $(INCLDIR)/s_elm.h
! reply.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
  returnadd.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  save_opts.o:	$(INCLDIR)/save_opts.h $(INCLDIR)/headers.h $(INCLDIR)/s_elmrc.h
  savecopy.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
***************
*** 315,328 ****
  sort.o:		$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  string2.o:	$(INCLDIR)/headers.h
  strings.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! syscall.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! utils.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  wildcards.o:	$(INCLDIR)/defs.h
! wordwrap.o:	$(INCLDIR)/headers.h
  
  #	Dependencies and rules for compiling C programs
! $(BIN)/elm:	$& $(ELM_OBJ) ../lib/libutil.a
! 		$(CC) $(LFLAGS) -o $@ $(ELM_OBJ) ../lib/libutil.a $(LIBS) $(LIB2)
  
  #	Dependencies and rules for installing C programs
  $(DEST)/elm:	$(BIN)/elm
--- 334,347 ----
  sort.o:		$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
  string2.o:	$(INCLDIR)/headers.h
  strings.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h
! syscall.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
! utils.o:	$(INCLDIR)/headers.h $(INCLDIR)/s_elm.h $(INCLDIR)/me.h
  wildcards.o:	$(INCLDIR)/defs.h
! wordwrap.o:	$(INCLDIR)/headers.h $(INCLDIR)/me.h
  
  #	Dependencies and rules for compiling C programs
! $(BIN)/elm:	$& $(ELM_OBJ) ../melib/libme.a ../lib/libutil.a 
! 		$(CC) $(LFLAGS) -o $@ $(ELM_OBJ) ../melib/libme.a ../lib/libutil.a $(LIBS) $(LIB2)
  
  #	Dependencies and rules for installing C programs
  $(DEST)/elm:	$(BIN)/elm
***************
*** 332,335 ****
--- 351,357 ----
  		$(CHGRP) $(MAILGRP) $@
  		$(CHMOD) $(MAILERMODE) $@
  
+ $(LIB)/elm.mimecharsets: $(BIN)/elm.mimecharsets
+ 		$(CP) $? $@
+ 		$(CHMOD) u=rw,go=r $@
  !NO!SUBS!
Index: elm2.4.ME+.50/src/a_edit.c
*** elm2.4.25/src/a_edit.c	Sat Oct 31 21:27:53 1992
--- elm2.4.ME+.50/src/a_edit.c	Tue Nov 17 21:14:08 1998
***************
*** 1,28 ****
  
! static char rcsid[] = "@(#)$Id: a_edit.c,v 5.2 1992/10/31 19:27:44 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: a_edit.c,v $
!  * Revision 5.2  1992/10/31  19:27:44  syd
!  * Clear selection on resync of aliases
!  * From: Syd
!  *
!  * Revision 5.1  1992/10/03  22:58:40  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** This routine is for allowing the user to edit their aliases.text
      as they wish. 
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: a_edit.c,v 1.3 1998/11/06 13:56:58 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.3 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** This routine is for allowing the user to edit their aliases.text
      as they wish. 
***************
*** 43,52 ****
  	    hard to figure out what occurred in the edit session...
  	**/
  
! 	char     at_file[SLEN];
! 
! 	sprintf(at_file,"%s/%s", home, ALIAS_TEXT);
! 	if (edit_a_file(at_file) == 0) {
  	    return (0);
  	}
  /*
--- 31,37 ----
  	    hard to figure out what occurred in the edit session...
  	**/
  
! 	if (edit_a_file(user_text_file) == 0) {
  	    return (0);
  	}
  /*
Index: elm2.4.ME+.50/src/a_quit.c
*** elm2.4.25/src/a_quit.c	Mon Apr 12 05:34:36 1993
--- elm2.4.ME+.50/src/a_quit.c	Tue Nov 17 21:12:57 1998
***************
*** 1,42 ****
  
! static char rcsid[] = "@(#)$Id: a_quit.c,v 5.4 1993/04/12 02:34:36 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: a_quit.c,v $
!  * Revision 5.4  1993/04/12  02:34:36  syd
!  * I have now added a parameter which controls whether want_to clears the
!  * line and centers the question or behaves like it did before. I also
!  * added a 0 at the end of the parameter list to all the other calls to
!  * want_to where a centered question on a clean line is not desirable.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.3  1992/12/24  21:42:01  syd
!  * Fix messages and nls messages to match.  Plus use want_to
!  * where appropriate.
!  * From: Syd, via prompting from Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.2  1992/12/11  02:09:06  syd
!  * Fix where the user creates a first new alias, then deletes it, the
!  * alias stays on screen, but the file really will be empty if it was the
!  * last alias, so the retry to delete gives 'cannot open ...file' messages
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.1  1992/10/03  22:58:40  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** a_quit: leave the aliases menu and return to the main menu.
    
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: a_quit.c,v 1.2 1998/10/20 19:58:15 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** a_quit: leave the aliases menu and return to the main menu.
    
***************
*** 87,96 ****
--- 61,72 ----
  	ask_questions = ((!prompt) ? FALSE : question_me);
  
  	/* YES or NO on softkeys */
+ 	/*
  	if (hp_softkeys && ask_questions) {
  	  define_softkeys(YESNO);
  	  softkeys_on();
  	}
+ 	*/
  
  	/* Determine if deleted messages are really to be deleted */
  
***************
*** 106,123 ****
  	  answer = (always_del ? *def_ans_yes : *def_ans_no);	/* default answer */
  	  if(ask_questions) {
  	    if (marked_deleted == 1)
! 	      MCsprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesDelete,
! 			"Delete 1 alias? (%c/%c) "), *def_ans_yes, *def_ans_no);
  	    else
! 	      MCsprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesDeletePlural,
! 			"Delete %d aliases? (%c/%c) "),
! 			marked_deleted, *def_ans_yes, *def_ans_no);
  	                    
! 	    answer = want_to(buffer, answer, LINES-3, 0);
  	  }
  
  	  if(answer == *def_ans_yes) {
! 	    list = (char **) malloc(marked_deleted*sizeof(*list));
  	    for (i = 0; i < message_count; i++) {
  	      if (ison(aliases[i]->status, DELETED)) {
  		list[to_delete] = aliases[i]->alias;
--- 82,103 ----
  	  answer = (always_del ? *def_ans_yes : *def_ans_no);	/* default answer */
  	  if(ask_questions) {
  	    if (marked_deleted == 1)
! 	      elm_sfprintf(buffer, sizeof buffer,
! 			   CATGETS(elm_msg_cat, AliasesSet, AliasesDelete,
! 				   "Delete 1 alias? (%c/%c) "), 
! 			   *def_ans_yes, *def_ans_no);
  	    else
! 	      elm_sfprintf(buffer, sizeof buffer,
! 			   CATGETS(elm_msg_cat, AliasesSet, 
! 				   AliasesDeletePlural,
! 				   "Delete %d aliases? (%c/%c) "),
! 			   marked_deleted, *def_ans_yes, *def_ans_no);
  	                    
! 	    answer = want_to(buffer, answer, elm_LINES-3, 0);
  	  }
  
  	  if(answer == *def_ans_yes) {
! 	    list = (char **) safe_malloc(marked_deleted*sizeof(*list));
  	    for (i = 0; i < message_count; i++) {
  	      if (ison(aliases[i]->status, DELETED)) {
  		list[to_delete] = aliases[i]->alias;
***************
*** 136,151 ****
  	    if (to_keep > 0) {
  	      current = 1;		/* Reset current alias */
  	      if (to_keep == 1)
! 		sprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesKeepDelete,
! 			  "[Keeping 1 alias and deleting %d.]"), to_delete);
  	      else
! 		MCsprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesKeepDeletePlural,
! 			  "[Keeping %d aliases and deleting %d.]"), to_keep, to_delete);
  	    }
  	    else {
  	      current = 0;		/* No aliases left */
! 	      sprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesDeleteAll,
! 			  "[Deleting all aliases.]"));
  	    }
  
  	    dprint(2, (debugfile, "Action: %s\n", buffer));
--- 116,138 ----
  	    if (to_keep > 0) {
  	      current = 1;		/* Reset current alias */
  	      if (to_keep == 1)
! 		elm_sfprintf(buffer, sizeof buffer,
! 			     CATGETS(elm_msg_cat, AliasesSet, 
! 				     AliasesKeepDelete,
! 				     "[Keeping 1 alias and deleting %d.]"), 
! 			     to_delete);
  	      else
! 		elm_sfprintf(buffer, sizeof buffer,
! 			     CATGETS(elm_msg_cat, AliasesSet, 
! 				     AliasesKeepDeletePlural,
! 				     "[Keeping %d aliases and deleting %d.]"),
! 			     to_keep, to_delete);
  	    }
  	    else {
  	      current = 0;		/* No aliases left */
! 	      elm_sfprintf(buffer, sizeof buffer,
! 			   CATGETS(elm_msg_cat, AliasesSet, AliasesDeleteAll,
! 				   "[Deleting all aliases.]"));
  	    }
  
  	    dprint(2, (debugfile, "Action: %s\n", buffer));
Index: elm2.4.ME+.50/src/a_screen.c
*** elm2.4.25/src/a_screen.c	Fri Apr 16 06:54:15 1993
--- elm2.4.ME+.50/src/a_screen.c	Tue Nov 17 21:12:57 1998
***************
*** 1,50 ****
  
! static char rcsid[] = "@(#)$Id: a_screen.c,v 5.4 1993/04/16 03:53:43 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: a_screen.c,v $
!  * Revision 5.4  1993/04/16  03:53:43  syd
!  * fix wrong softkeys displayed
!  * From: From: Michael Greenberg <hp.com!hpbbn.bbn.hp.com!hputlaa!hputlav!michael>
!  *
!  * Revision 5.3  1993/01/19  04:52:19  syd
!  * 	add c)hange alias command to alias helpfile
!  * 	if a deleted alias is changed, undelete it.  Also added the 'N'
!  * flag to changed aliases to help remind the user.  Documented it.
!  * Note:  if they mark the alias for deletion AFTER making the change it
!  * WILL be deleted. (and marked accordingly)
!  * 	modified alias mode title string to indicate when a resync was
!  * needed.
!  * 	allow editing alias file when none exist.
!  * 	Now aliases are check for illegal characters (and WS) and
!  * addresses are check for illegal WS when they are being entered.  If
!  * anything illegal is found and message is printed and they keep entering
!  * the item until they get it right.
!  * 	I fixed a couple of places where int should be long to match
!  * the declared type of alias_rec.length
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.2  1992/12/20  05:15:58  syd
!  * Add a c)hange alias, -u and -t options to listalias to list only user
!  * and only system aliases respectively.
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.1  1992/10/03  22:58:40  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /**  alias screen display routines for ELM program
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: a_screen.c,v 1.2 1998/10/20 19:58:15 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /**  alias screen display routines for ELM program
  
***************
*** 73,80 ****
  
  	show_last_error();
  
! 	if (hp_terminal)
! 	  define_softkeys(ALIAS);
  }
  
  alias_title(modified)
--- 39,45 ----
  
  	show_last_error();
  
! 	/* define_softkeys(ALIAS); */
  }
  
  alias_title(modified)
***************
*** 87,94 ****
  	char modmsg[SLEN];
  
  	if (modified) {
! 	    strcpy(modmsg, catgets(elm_msg_cat, AliasesSet, AliasesModified,
! 		"(modified, resync needed) "));
  	}
  	else {
  	    modmsg[0] = '\0';
--- 52,60 ----
  	char modmsg[SLEN];
  
  	if (modified) {
! 	    strfcpy(modmsg, catgets(elm_msg_cat, AliasesSet, AliasesModified,
! 				    "(modified, resync needed) "),
! 		    sizeof modmsg);
  	}
  	else {
  	    modmsg[0] = '\0';
***************
*** 95,110 ****
  	}
  
  	if (selected)
! 	  MCsprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesSelect,
! 	      "Alias mode: %d shown out of %d %s[ELM %s]"),
! 	      selected, message_count, modmsg, version_buff);
  	else if (message_count == 1)
! 	  sprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesSingle,
! 	      "Alias mode: 1 alias %s[ELM %s]"), modmsg, version_buff);
  	else
! 	  MCsprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesPlural,
! 	      "Alias mode: %d aliases %s[ELM %s]"),
! 	      message_count, modmsg, version_buff);
  
  	ClearLine(1);
  
--- 61,80 ----
  	}
  
  	if (selected)
! 	  elm_sfprintf(buffer, sizeof buffer,
! 		       CATGETS(elm_msg_cat, AliasesSet, AliasesSelect,
! 			       "Alias mode: %d shown out of %d %s[ELM %s]"),
! 		       selected, message_count, modmsg, version_buff);
  	else if (message_count == 1)
! 	  elm_sfprintf(buffer, sizeof buffer,
! 		       CATGETS(elm_msg_cat, AliasesSet, AliasesSingle,
! 			       "Alias mode: 1 alias %s[ELM %s]"), 
! 		       modmsg, version_buff);
  	else
! 	  elm_sfprintf(buffer, sizeof buffer,
! 		       CATGETS(elm_msg_cat, AliasesSet, AliasesPlural,
! 			       "Alias mode: %d aliases %s[ELM %s]"),
! 		       message_count, modmsg, version_buff);
  
  	ClearLine(1);
  
***************
*** 117,146 ****
  	/* Moved from alias.c */
  
  	if (user_level == RANK_AMATEUR) {	/* Give less options  */
! 	  Centerline(LINES-7, catgets(elm_msg_cat, AliasesSet, AliasesRMenuLn1,
  "You can use any of the following commands by pressing the first character;"));
! 	  Centerline(LINES-6, catgets(elm_msg_cat, AliasesSet, AliasesRMenuLn2,
  "a)lias current message, n)ew alias, d)elete or u)ndelete an alias,"));
! 	  Centerline(LINES-5, catgets(elm_msg_cat, AliasesSet, AliasesRMenuLn3,
  "m)ail to alias, or r)eturn to main menu.  To view an alias, press <return>."));
! 	  Centerline(LINES-4, catgets(elm_msg_cat, AliasesSet, AliasesRMenuLn4,
  "j = move down, k = move up, ? = help"));
  	}
  	else {
! 	    Centerline(LINES-7, catgets(elm_msg_cat, AliasesSet, AliasesMenuLn1,
  "Alias commands:  ?=help, <n>=set current to n, /=search pattern"));
! 	    Centerline(LINES-6, catgets(elm_msg_cat, AliasesSet, AliasesMenuLn2,
  "a)lias current message, c)hange, d)elete, e)dit aliases.text, f)ully expand,"));
! 	    Centerline(LINES-5, catgets(elm_msg_cat, AliasesSet, AliasesMenuLn3,
  "l)imit display, m)ail, n)ew alias, r)eturn, t)ag, u)ndelete, or e(x)it"));
  	}
  
  }
  
! build_alias_line(buffer, entry, message_number, highlight)
! char *buffer;
! struct alias_rec *entry;
! int message_number, highlight;
  {
  	/** Build in buffer the alias header ... entry is the current
  	    message entry, 'highlight' is either TRUE or FALSE,
--- 87,125 ----
  	/* Moved from alias.c */
  
  	if (user_level == RANK_AMATEUR) {	/* Give less options  */
! 	  Centerline(elm_LINES-7, catgets(elm_msg_cat, AliasesSet, 
! 					  AliasesRMenuLn1,
  "You can use any of the following commands by pressing the first character;"));
! 	  Centerline(elm_LINES-6, catgets(elm_msg_cat, AliasesSet, 
! 					  AliasesRMenuLn2,
  "a)lias current message, n)ew alias, d)elete or u)ndelete an alias,"));
! 	  Centerline(elm_LINES-5, catgets(elm_msg_cat, AliasesSet, 
! 					  AliasesRMenuLn3,
  "m)ail to alias, or r)eturn to main menu.  To view an alias, press <return>."));
! 	  Centerline(elm_LINES-4, catgets(elm_msg_cat, AliasesSet, 
! 					  AliasesRMenuLn4,
  "j = move down, k = move up, ? = help"));
  	}
  	else {
! 	    Centerline(elm_LINES-7, catgets(elm_msg_cat, AliasesSet, 
! 					    AliasesMenuLn1,
  "Alias commands:  ?=help, <n>=set current to n, /=search pattern"));
! 	    Centerline(elm_LINES-6, catgets(elm_msg_cat, AliasesSet, 
! 					    AliasesMenuLn2,
  "a)lias current message, c)hange, d)elete, e)dit aliases.text, f)ully expand,"));
! 	    Centerline(elm_LINES-5, catgets(elm_msg_cat, AliasesSet, 
! 					    AliasesMenuLn3,
  "l)imit display, m)ail, n)ew alias, r)eturn, t)ag, u)ndelete, or e(x)it"));
  	}
  
  }
  
! void
! build_alias_line(buffer, entry, message_number, highlight, buffer_size)
!      char *buffer;
!      struct alias_rec *entry;
!      int message_number, highlight;
!      int buffer_size;
  {
  	/** Build in buffer the alias header ... entry is the current
  	    message entry, 'highlight' is either TRUE or FALSE,
***************
*** 159,185 ****
  
  	/* Note that one huge sprintf() is too hard for some compilers. */
  
! 	sprintf(buffer, "%s%s%c%-3d ",
! 		(highlight && arrow_cursor)? "->" : "  ",
! 		show_status(entry->status),
! 		(entry->status & TAGGED?  '+' : ' '),
! 		message_number);
  
  	/* Set the name display width. */
! 	name_width = COLUMNS-40;
  
! 	/* Put the name and associated comment in local buffer */
! 	if (strlen(entry->comment))
! 	  MCsprintf(mybuffer, "%s, %s", entry->name, entry->comment);
! 	else
! 	  sprintf(mybuffer, "%s", entry->name);
  
  	/* complete line with name, type and alias. */
! 	sprintf(buffer + strlen(buffer), "%-*.*s %s %-18.18s",
! 		/* give max and min width parameters for 'name' */
! 		name_width, name_width, mybuffer,
! 		alias_type(entry->type),
! 		entry->alias);
  }
  
  char *alias_type(type)
--- 138,176 ----
  
  	/* Note that one huge sprintf() is too hard for some compilers. */
  
! 	elm_sfprintf(buffer, buffer_size,
! 		     FRM("%s%s%c%-3d "),
! 		     (highlight && arrow_cursor)? "->" : "  ",
! 		     show_status(entry->status,NULL),
! 		     (entry->status & TAGGED?  '+' : ' '),
! 		     message_number);
  
  	/* Set the name display width. */
! 	name_width = elm_COLUMNS-40;
  
! 	/* Put the name and associated comment 
! 	   (or just the address if null) in local buffer */
! 	if (strlen(entry->name)) {
! 	  if (strlen(entry->comment))
! 	    elm_sfprintf(mybuffer, sizeof mybuffer,
! 			 FRM("%.100s, %.100s"), 
! 			 entry->name, entry->comment);
! 	  else
! 	    elm_sfprintf(mybuffer, sizeof mybuffer,
! 			 FRM("%.100s"), 
! 			 entry->name);
! 	} else
! 	  elm_sfprintf(mybuffer, sizeof mybuffer,
! 		       FRM("%.100s"), 
! 		       entry->address);
  
  	/* complete line with name, type and alias. */
! 	elm_sfprintf(buffer + strlen(buffer), buffer_size - strlen(buffer),
! 		     FRM("%-*.*s %s %-18.18s"),
! 		     /* give max and min width parameters for 'name' */
! 		     name_width, name_width, mybuffer,
! 		     alias_type(entry->type),
! 		     entry->alias);
  }
  
  char *alias_type(type)
***************
*** 193,203 ****
  	static char mybuffer[10];
  	extern char *a_group_name, *a_person_name, *a_system_flag;
  
! 	if (type & GROUP)	strcpy(mybuffer, a_group_name);
! 	else			strcpy(mybuffer, a_person_name);
  
! 	if (type & SYSTEM)	strcat(mybuffer, a_system_flag);
! 	else			strcat(mybuffer, "   ");
  
  	return( (char *) mybuffer);
  }
--- 184,194 ----
  	static char mybuffer[10];
  	extern char *a_group_name, *a_person_name, *a_system_flag;
  
! 	if (type & GROUP)    strfcpy(mybuffer, a_group_name, sizeof mybuffer);
! 	else		     strfcpy(mybuffer, a_person_name, sizeof mybuffer);
  
! 	if (type & SYSTEM)   strfcat(mybuffer, a_system_flag, sizeof mybuffer);
! 	else		     strfcat(mybuffer, "   ", sizeof mybuffer);
  
  	return( (char *) mybuffer);
  }
Index: elm2.4.ME+.50/src/a_sort.c
*** elm2.4.25/src/a_sort.c	Sat Mar 12 17:32:55 1994
--- elm2.4.ME+.50/src/a_sort.c	Tue Nov 17 21:12:58 1998
***************
*** 1,54 ****
  
! static char rcsid[] = "@(#)$Id: a_sort.c,v 5.5 1993/06/12 05:27:44 syd Exp syd $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: a_sort.c,v $
!  * Revision 5.5  1993/06/12  05:27:44  syd
!  * Fix calling sequence error
!  * From: Syd
!  *
!  * Revision 5.4  1993/04/12  01:10:15  syd
!  * fix @aliasname sort problem
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.3  1993/01/19  04:52:19  syd
!  * 	add c)hange alias command to alias helpfile
!  * 	if a deleted alias is changed, undelete it.  Also added the 'N'
!  * flag to changed aliases to help remind the user.  Documented it.
!  * Note:  if they mark the alias for deletion AFTER making the change it
!  * WILL be deleted. (and marked accordingly)
!  * 	modified alias mode title string to indicate when a resync was
!  * needed.
!  * 	allow editing alias file when none exist.
!  * 	Now aliases are check for illegal characters (and WS) and
!  * addresses are check for illegal WS when they are being entered.  If
!  * anything illegal is found and message is printed and they keep entering
!  * the item until they get it right.
!  * 	I fixed a couple of places where int should be long to match
!  * the declared type of alias_rec.length
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.2  1992/11/22  00:05:07  syd
!  * Fix bug where alias records were not sorting by both last and
!  * first names.
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.1  1992/10/03  22:58:40  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** Sort alias table by the field specified in the global
      variable "alias_sortby"...
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: a_sort.c,v 1.2 1998/10/20 19:58:15 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** Sort alias table by the field specified in the global
      variable "alias_sortby"...
***************
*** 78,85 ****
  	  last_index = aliases[current-1]->length;
  
  	if ((entries > 30) && visible && are_in_aliases) {
! 	    error1(catgets(elm_msg_cat, AliasesSet, AliasesSort,
! 		    "Sorting aliases by %s..."), alias_sort_name(FULL));
  	}
  	
  	if (entries > 1)
--- 40,48 ----
  	  last_index = aliases[current-1]->length;
  
  	if ((entries > 30) && visible && are_in_aliases) {
! 	    lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesSort,
! 			      "Sorting aliases by %s..."), 
! 		      alias_sort_name(FULL));
  	}
  	
  	if (entries > 1)
Index: elm2.4.ME+.50/src/addr_util.c
*** elm2.4.25/src/addr_util.c	Tue Aug  3 22:28:59 1993
--- elm2.4.ME+.50/src/addr_util.c	Tue Nov 17 21:12:57 1998
***************
*** 1,89 ****
  
! static char rcsid[] = "@(#)$Id: addr_util.c,v 5.11 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.11 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: addr_util.c,v $
!  * Revision 5.11  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.10  1993/05/31  19:32:20  syd
!  * With this patch build_address() should treat local mailing
!  * lists and other aliases known by the transport agent as valid
!  * addresses.
!  * I also conditionalized printing the "Expands to: " message
!  * in check_only mode to be done only when there is an expanded
!  * address to print. Build_address will inform anyway about an
!  * alias that does not exist.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.9  1993/05/14  03:53:46  syd
!  * Fix wrong message being displayed and then overwritten
!  * for long aliases.
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.8  1993/04/16  03:26:50  syd
!  * For many embedded X.400 addresses in the format
!  * "/.../.../.../.../"@admd.country NLEN was simply too short and part of
!  * the address never made it to the reply address. In my opinion 512 bytes
!  * should be enough. So make it LONG_STRING.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.7  1993/01/19  05:07:05  syd
!  * Trim erroreous extra log entry
!  * From: Syd
!  *
!  * Revision 5.6  1993/01/19  04:47:12  syd
!  * Significant changes to provide consistent Date and From_ header
!  * cracking.  Overhauled date utilities and moved into library.  Moved
!  * real_from() into library.  Modified frm, newmail, and readmsg utilities
!  * to use library version of real_from().  Moved get_word() from Elm
!  * source into library.  Added new library routines atonum() and strfcpy().
!  * Fixed trailing backslash bug in len_next().
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.5  1992/12/11  01:45:04  syd
!  * remove sys/types.h include, it is now included by defs.h
!  * and this routine includes defs.h or indirectly includes defs.h
!  * From: Syd
!  *
!  * Revision 5.4  1992/11/26  00:46:13  syd
!  * changes to first change screen back (Raw off) and then issue final
!  * error message.
!  * From: Syd
!  *
!  * Revision 5.3  1992/10/31  18:52:51  syd
!  * Corrections to Unix date parsing and time zone storage
!  * From: eotto@hvlpa.att.com
!  *
!  * Revision 5.2  1992/10/25  02:18:01  syd
!  * fix found_year flag
!  * From: Syd
!  *
!  * Revision 5.1  1992/10/03  22:58:40  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** This file contains addressing utilities 
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: addr_util.c,v 1.2 1998/10/20 19:58:15 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** This file contains addressing utilities 
  
***************
*** 91,97 ****
  
  #include "headers.h"
  #include "s_elm.h"
! 
  
  translate_return(addr, ret_addr)
  char *addr, *ret_addr;
--- 18,24 ----
  
  #include "headers.h"
  #include "s_elm.h"
! #include "me.h"
  
  translate_return(addr, ret_addr)
  char *addr, *ret_addr;
***************
*** 170,178 ****
  	ret_addr[iindex] = '\0';
  }
  
! int
! build_address(to, full_to)
! char *to, *full_to;
  {
  	/** loop on all words in 'to' line...append to full_to as
  	    we go along, until done or length > len.  Modified to
--- 97,105 ----
  	ret_addr[iindex] = '\0';
  }
  
! int build_address(to, full_to, size_to, size_full_to)
!      char *to, *full_to;
!      int size_to, size_full_to;
  {
  	/** loop on all words in 'to' line...append to full_to as
  	    we go along, until done or length > len.  Modified to
***************
*** 215,225 ****
  	  else if (word[0] == '-'){
  	    for (k=0; word[k]; word[k] = word[k+1],k++);
  	    if (elim_list[0] != '\0')
! 	      strcat(elim_list, " ");
! 	    strcat(elim_list, word);
  	  }
  	  if ((i = j) > 0)
! 	    strcpy(word, next_word);
  	}
  
  	if (elim_list[0] != '\0')
--- 142,152 ----
  	  else if (word[0] == '-'){
  	    for (k=0; word[k]; word[k] = word[k+1],k++);
  	    if (elim_list[0] != '\0')
! 	      strfcat(elim_list, " ", sizeof elim_list);
! 	    strfcat(elim_list, word, sizeof elim_list);
  	  }
  	  if ((i = j) > 0)
! 	    strfcpy(word, next_word, sizeof word);
  	}
  
  	if (elim_list[0] != '\0')
***************
*** 236,245 ****
  	    in_parens++;
  
  	  if (in_parens) {
! 	    if(word[strlen(word)-1] == ')')
  	      in_parens--;
! 	    strcat(full_to, " ");
! 	    strcat(full_to, word);
  	  }
  
  	  else if (word[0] == '-') {
--- 163,195 ----
  	    in_parens++;
  
  	  if (in_parens) {
! 	    char c1 = '\0', c2 = '\0';
! 	    char *word1 = word;
! #ifdef MIME
! 	    char temp[LONG_STRING];
! #endif
! 
! 	    if (word1[0] == '(') {
! 	      c1 = '(';
! 	      word1++;
! 	    }
! 	    if(word1[strlen(word1)-1] == ')') {
  	      in_parens--;
! 	      c2 = ')';
! 	      word1[strlen(word1)-1] = '\0';
! 	    }
! #ifdef MIME
! 	    if (!allow_no_hdrencoding) {
! 	      rfc1522_encode_text(temp,sizeof temp,word1,HDR_COMMENT);
! 	      word1 = temp;
! 	    } 
! #endif 
! 	    strfcat(full_to, " ", size_full_to);
! 	    if (c1)
! 	      strfcat(full_to, "(", size_full_to);
! 	    strfcat(full_to, word1, size_full_to-1);
! 	    if (c2)
! 	      strfcat(full_to, ")", size_full_to);
  	  }
  
  	  else if (word[0] == '-') {
***************
*** 246,253 ****
  	  }
  
  	  else if (qstrpbrk(word,"!@:") != NULL) {
! 	    sprintf(full_to, "%s%s%s", full_to,
!                     full_to[0] != '\0'? ", " : "", word);
  	  }
  	  else if ((ptr = get_alias_address(word, TRUE, &too_long)) != NULL) {
  
--- 196,204 ----
  	  }
  
  	  else if (qstrpbrk(word,"!@:") != NULL) {
! 	    elm_sfprintf(full_to, size_full_to,
! 			 FRM("%s%s%s"), full_to,
! 			 full_to[0] != '\0'? ", " : "", word);
  	  }
  	  else if ((ptr = get_alias_address(word, TRUE, &too_long)) != NULL) {
  
***************
*** 258,271 ****
  	      while (k > 0) {
  		l = get_word(ptr, k, next_word_a, sizeof(next_word_a));
  		if (in_list(elim_list, word_a) == 0)
! 		  sprintf(full_to, "%s%s%s", full_to,
! 			  full_to[0] != '\0' ? ", " : "", word_a);
  		if ((k = l) > 0)
! 		  strcpy(word_a, next_word_a);
  	      }
  	    } else
! 	      sprintf(full_to, "%s%s%s", full_to, 
!                       full_to[0] != '\0'? ", " : "", ptr);
  	    expanded_information++;
  	  }
  	  else if (too_long) {
--- 209,224 ----
  	      while (k > 0) {
  		l = get_word(ptr, k, next_word_a, sizeof(next_word_a));
  		if (in_list(elim_list, word_a) == 0)
! 		  elm_sfprintf(full_to, size_full_to,
! 			       FRM("%s%s%s"), full_to,
! 			       full_to[0] != '\0' ? ", " : "", word_a);
  		if ((k = l) > 0)
! 		  strfcpy(word_a, next_word_a, sizeof word_a);
  	      }
  	    } else
! 	      elm_sfprintf(full_to, size_full_to,
! 			   FRM("%s%s%s"), full_to, 
! 			   full_to[0] != '\0'? ", " : "", ptr);
  	    expanded_information++;
  	  }
  	  else if (too_long) {
***************
*** 278,306 ****
  	      dprint(2,(debugfile,"Overflowed alias expansion for %s\n", word));
  	  }
  	  else if (strlen(word) > 0) {
  	    if (valid_name(word)) {
  	      if (j > 0 && next_word[0] == '(')	/* already has full name */
  		gecos = NULL;
  	      else				/* needs a full name */
  		gecos = get_full_name(word);
! #if defined(INTERNET) & defined(USE_DOMAIN)
! 	      sprintf(full_to, "%s%s%s@%s%s%s%s",
! 		      full_to,
! 		      (full_to[0] ? ", " : ""),
! 		      word,
! 		      hostfullname,
! 		      (gecos ? " (" : ""),
! 		      (gecos ? gecos : ""),
! 		      (gecos ? ")" : ""));
! #else /* INTERNET and USE_DOMAIN */
! 	      sprintf(full_to, "%s%s%s%s%s%s",
! 		      full_to,
! 		      (full_to[0] ? ", " : ""),
! 		      word,
! 		      (gecos ? " (" : ""),
! 		      (gecos ? gecos : ""),
! 		      (gecos ? ")" : ""));
! #endif /* INTERNET and USE_DOMAIN */
  	    }
  	    else if (check_only) {
  		if (! isatty(fileno(stdin)) ) {
--- 231,273 ----
  	      dprint(2,(debugfile,"Overflowed alias expansion for %s\n", word));
  	  }
  	  else if (strlen(word) > 0) {
+ #ifdef MIME
+ 	    char temp[LONG_STRING];
+ #endif
  	    if (valid_name(word)) {
  	      if (j > 0 && next_word[0] == '(')	/* already has full name */
  		gecos = NULL;
  	      else				/* needs a full name */
  		gecos = get_full_name(word);
! #ifdef MIME
! 	    if (!allow_no_hdrencoding && gecos) {
! 	      /* from is not longer mime encoded */
! 
! 	      rfc1522_encode_text(temp,sizeof temp,gecos,HDR_COMMENT);
! 	      gecos = temp;
! 	    } 
! #endif 
! 
! #if defined(USE_DOMAIN)
! 	      elm_sfprintf(full_to, size_full_to,
! 			   FRM("%s%s%s@%s%s%s%s"),
! 			   full_to,
! 			   (full_to[0] ? ", " : ""),
! 			   word,
! 			   hostfullname,
! 			   (gecos ? " (" : ""),
! 			   (gecos ? gecos : ""),
! 			   (gecos ? ")" : ""));
! #else /* USE_DOMAIN */
! 	      elm_sfprintf(full_to, size_full_to,
! 			   FRM("%s%s%s%s%s%s"),
! 			   full_to,
! 			   (full_to[0] ? ", " : ""),
! 			   word,
! 			   (gecos ? " (" : ""),
! 			   (gecos ? gecos : ""),
! 			   (gecos ? ")" : ""));
! #endif /* USE_DOMAIN */
  	    }
  	    else if (check_only) {
  		if (! isatty(fileno(stdin)) ) {
***************
*** 327,409 ****
  		}
  	    }
  	    else {
! 	      sprintf(full_to, "%s%s%s",
! 		      full_to,
! 		      (full_to[0] ? ", " : ""),
! 		      word);
  	    }
  	  }
  
  	  /* and this word to the new to list */
  	  if(*new_to_list != '\0')
! 	    strcat(new_to_list, " ");
! 	  strcat(new_to_list, word);
  
  	  if((i = j) > 0)
! 	    strcpy(word, next_word);
  	}
  
  	/* if new to list is different from original, update original */
  	if (changed)
! 	  strcpy(to, new_to_list);
  
  	return( expanded_information > 0 ? 1 : 0 );
  }
  
! 
! forwarded(buffer, entry)
! char *buffer;
! struct header_rec *entry;
! {
! 	/** Change 'from' and date fields to reflect the ORIGINATOR of 
! 	    the message by iteratively parsing the >From fields... 
! 	    Modified to deal with headers that include the time zone
! 	    of the originating machine... **/
! 
! 	char machine[SLEN], buff[SLEN], holding_from[SLEN];
! 	int len;
! 
! 	machine[0] = holding_from[0] = '\0';
! 
! 	sscanf(buffer, "%*s %s", holding_from);
! 
! 	/* after skipping over From and address, process rest as date field */
! 
! 	while (!isspace(*buffer)) buffer++;	/* skip From */
! 	while (isspace(*buffer)) buffer++;
! 
! 	while (*buffer) {
! 	  len = len_next_part(buffer);
! 	  if (len > 1) {
! 	    buffer += len;
! 	  } else {
! 	    if (isspace(*buffer))
! 	      break;
! 	    buffer++;
! 	  }
! 	}
! 	while (isspace(*buffer)) buffer++;
! 
! 	parse_arpa_date(buffer, entry);
! 
! 	/* the following fix is to deal with ">From xyz ... forwarded by xyz"
! 	   which occasionally shows up within AT&T.  Thanks to Bill Carpenter
! 	   for the fix! */
! 
! 	if (strcmp(machine, holding_from) == 0)
! 	  machine[0] = '\0';
! 
! 	if (machine[0] == '\0')
! 	  strcpy(buff, holding_from[0] ? holding_from : "anonymous");
! 	else
! 	  sprintf(buff,"%s!%s", machine, holding_from);
! 
! 	strfcpy(entry->from, buff, STRING);
! }
! 
! 
! fix_arpa_address(address)
! char *address;
  {
  	/** Given a pure ARPA address, try to make it reasonable.
  
--- 294,326 ----
  		}
  	    }
  	    else {
! 	      elm_sfprintf(full_to, size_full_to,
! 			   FRM("%s%s%s"),
! 			   full_to,
! 			   (full_to[0] ? ", " : ""),
! 			   word);
  	    }
  	  }
  
  	  /* and this word to the new to list */
  	  if(*new_to_list != '\0')
! 	    strfcat(new_to_list, " ", sizeof new_to_list);
! 	  strfcat(new_to_list, word, sizeof new_to_list);
  
  	  if((i = j) > 0)
! 	    strfcpy(word, next_word, sizeof word);
  	}
  
  	/* if new to list is different from original, update original */
  	if (changed)
! 	  strfcpy(to, new_to_list, size_to);
  
  	return( expanded_information > 0 ? 1 : 0 );
  }
  
! int fix_arpa_address(address, size)
!      char *address;
!      int size;
  {
  	/** Given a pure ARPA address, try to make it reasonable.
  
***************
*** 425,431 ****
  	      ;
  
  	  if (i == host_count) {
! 	    strcpy(hosts[host_count++], host);
  	    if (host_count == MAX_HOPS) {
  	       dprint(2, (debugfile, 
             "Can't build return address - hit MAX_HOPS in fix_arpa_address\n"));
--- 342,348 ----
  	      ;
  
  	  if (i == host_count) {
! 	    strfcpy(hosts[host_count++], host, sizeof hosts[host_count]);
  	    if (host_count == MAX_HOPS) {
  	       dprint(2, (debugfile, 
             "Can't build return address - hit MAX_HOPS in fix_arpa_address\n"));
***************
*** 444,453 ****
  	address[0] = '\0';
  
  	for (i = 0; i < host_count; i++)
! 	  sprintf(address, "%s%s%s", address, 
! 	          address[0] == '\0'? "" : 
! 	 	    (i == host_count - 1 ? "@" : "%"),
! 	          hosts[i]);
  
! 	return(0);
  }
--- 361,371 ----
  	address[0] = '\0';
  
  	for (i = 0; i < host_count; i++)
! 	  elm_sfprintf(address, size,
! 		       FRM("%s%s%s"), address, 
! 		       address[0] == '\0'? "" : 
! 		       (i == host_count - 1 ? "@" : "%"),
! 		       hosts[i]);
  
! 	return 0;
  }
Index: elm2.4.ME+.50/src/alias.c
*** elm2.4.25/src/alias.c	Mon May 30 19:42:49 1994
--- elm2.4.ME+.50/src/alias.c	Tue Nov 17 21:14:09 1998
***************
*** 1,263 ****
  
! static char rcsid[] = "@(#)$Id: alias.c,v 5.40 1994/05/30 16:42:48 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.40 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: alias.c,v $
!  * Revision 5.40  1994/05/30  16:42:48  syd
!  * Just a minor fix to an impossible character comparison.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.39  1994/05/15  23:10:08  syd
!  * Below are the changes required to compile/link elm 2.4 pl23 under
!  * QNX 4.2 with the Watcom 9.5 compiler (very picky).
!  * From: "Brian Campbell" <brianc@quantum>
!  *
!  * Revision 5.38  1994/03/11  21:25:24  syd
!  * Fix Elm looping if an EOF is received.
!  * From: Gregory Neil Shapiro <gshapiro@WPI.EDU>
!  *
!  * Revision 5.37  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.36  1993/06/12  05:27:44  syd
!  * Fix calling sequence error
!  * From: Syd
!  *
!  * Revision 5.35  1993/06/10  02:58:26  syd
!  * Correct problem in fetch_alias() with alias record fixup that caused
!  * core dump on machines with pointers larger than int.  This problem
!  * was reported on comp.mail.elm by Richard Eckman and Jim Brown.  Simplify
!  * get_one_alias() by having it use fetch_alias().
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.34  1993/05/14  03:57:36  syd
!  * A couple of calls to want_to() had typos. Here is the patch.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.33  1993/05/14  03:53:46  syd
!  * Fix wrong message being displayed and then overwritten
!  * for long aliases.
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.32  1993/05/08  20:25:33  syd
!  * Add sleepmsg to control transient message delays
!  * From: Syd
!  *
!  * Revision 5.31  1993/05/08  17:04:15  syd
!  * Jan's removal of tolower in alias.c breaks help for 'I'.  This fixes
!  * that and makes the help messages for characters that have printable
!  * synonyms on the alias and options screens consistent with the help files.
!  * From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
!  *
!  * Revision 5.30  1993/04/21  01:33:49  syd
!  * Use pointer arithmetic for aliases on crays
!  * From: Quentin Van Abbe <rxxqva@argolis.osf.rmit.OZ.AU>
!  *
!  * Revision 5.29  1993/04/12  03:15:41  syd
!  * These patches makes 'T' (since it was free) do a Tag and Move command in the
!  * index and alias page, and in the builtin pager.
!  * In the alias help in src/alias.c, there is a tolower done on the character
!  * one wants help for.  This is clearly wrong.
!  * From: Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.28  1993/04/12  03:00:57  syd
!  * None of i, q, x, >, and ^L are recognized by the single character help
!  * on the options screen.  <return> causes the options screen to scroll
!  * because all non-printing characters are echoed by the error message.
!  * Options and alias help files didn't list all commands.
!  * From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
!  *
!  * Revision 5.27  1993/04/12  02:34:36  syd
!  * I have now added a parameter which controls whether want_to clears the
!  * line and centers the question or behaves like it did before. I also
!  * added a 0 at the end of the parameter list to all the other calls to
!  * want_to where a centered question on a clean line is not desirable.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.26  1993/04/12  01:14:11  syd
!  * The test in delete did not take into account for mixed case.
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.25  1993/04/12  01:13:05  syd
!  * Move first name to lastname if lastname blank.
!  * this is the only real way for now.  I think that the dbz stuff, sorting,
!  * and other things all hope to see a lastname.
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.24  1993/04/12  01:10:15  syd
!  * fix @aliasname sort problem
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.23  1993/04/12  01:08:16  syd
!  * test firstname == lastname and if true zero out firstname before
!  * writing to the aliases.text file.  Let me check out the source.  Now if
!  * you try to change a SYSTEM alias it lets you know and asks to verify
!  * that you are going to superceed that alias.
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.22  1993/02/03  16:56:59  syd
!  * Fix which seek is being used on DBZ file, FILE * requires fseek
!  * From: syd via prompt from mfvargo@netcom.com (Michael Vargo)
!  *
!  * Revision 5.21  1993/01/20  03:37:16  syd
!  * Nits and typos in the NLS messages and corresponding default messages.
!  * From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
!  *
!  * Revision 5.20  1993/01/19  04:52:19  syd
!  * 	add c)hange alias command to alias helpfile
!  * 	if a deleted alias is changed, undelete it.  Also added the 'N'
!  * flag to changed aliases to help remind the user.  Documented it.
!  * Note:  if they mark the alias for deletion AFTER making the change it
!  * WILL be deleted. (and marked accordingly)
!  * 	modified alias mode title string to indicate when a resync was
!  * needed.
!  * 	allow editing alias file when none exist.
!  * 	Now aliases are check for illegal characters (and WS) and
!  * addresses are check for illegal WS when they are being entered.  If
!  * anything illegal is found and message is printed and they keep entering
!  * the item until they get it right.
!  * 	I fixed a couple of places where int should be long to match
!  * the declared type of alias_rec.length
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.19  1992/12/24  21:42:01  syd
!  * Fix messages and nls messages to match.  Plus use want_to
!  * where appropriate.
!  * From: Syd, via prompting from Jan Djarv <Jan.Djarv@sa.erisoft.se>
!  *
!  * Revision 5.18  1992/12/20  05:15:58  syd
!  * Add a c)hange alias, -u and -t options to listalias to list only user
!  * and only system aliases respectively.
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.17  1992/12/13  17:59:18  syd
!  * Please write on the blackboard 500 times `NULL != 0.'
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.16  1992/12/11  02:09:06  syd
!  * Fix where the user creates a first new alias, then deletes it, the
!  * alias stays on screen, but the file really will be empty if it was the
!  * last alias, so the retry to delete gives 'cannot open ...file' messages
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.15  1992/12/11  01:58:22  syd
!  * Anytime elm wants to re-run newalias, selected is set to 0.
!  * (removing any limit in effect)
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.14  1992/12/11  01:45:04  syd
!  * remove sys/types.h include, it is now included by defs.h
!  * and this routine includes defs.h or indirectly includes defs.h
!  * From: Syd
!  *
!  * Revision 5.13  1992/12/07  03:02:03  syd
!  * On machines with 64 bit pointers (and 64 bit longs) using int
!  * for newmax causes pointer truncation.
!  * From: Jim Brown
!  *
!  * Revision 5.12  1992/11/26  00:46:50  syd
!  * Fix how errno is used so err is inited and used instead
!  * as errno gets overwritten by print system call
!  * From: Syd
!  *
!  * Revision 5.11  1992/11/15  01:24:34  syd
!  * The situation is that the .elm/aliases file is missing, but
!  * .elm/aliases.dir and .elm/aliases.pag exist (isn't serendipity
!  * wonderful?).  The ndbz functions tolerate this and just put a NULL
!  * pointer in the db structure for the data file FILE pointer.  However,
!  * get_one_alias() in listalias and elm doesn't account for the db_open()
!  * succeeding but the dbz_basef field being NULL, so it passes the NULL
!  * pointer to fread().  Detect null and return 0
!  * From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
!  *
!  * Revision 5.10  1992/11/15  01:15:28  syd
!  * The alias message_count isn't set to zero if the last alias has
!  * been deleted from the alias table. As no aliases are reread from
!  * the aliases database the message_count is left as it was before.
!  *
!  * Fixed that the function do_newalias() sometimes returns without freeing
!  * the buffer allocated before. The patch adds these free calls.
!  *
!  * When you erroneously type a number in your folder elm asks you for
!  * a new current message number. But now if you erase this one number
!  * and leave the string empty elm will set the new current message to
!  * the second message on our sun4! The patch adds a check for an empty
!  * string and returns the current number if no number was entered.
!  * From: vogt@isa.de (Gerald Vogt)
!  *
!  * Revision 5.9  1992/10/24  13:35:39  syd
!  * changes found by using codecenter on Elm 2.4.3
!  * From: Graham Hudspith <gwh@inmos.co.uk>
!  *
!  * Revision 5.8  1992/10/19  16:58:18  syd
!  * more on the update of compiler warnings
!  * From: Syd
!  *
!  * Revision 5.7  1992/10/19  16:50:41  syd
!  * Fix a couple more compiler gripes from SYSVR4
!  * From: Tom Moore <tmoore@wnas.DaytonOH.NCR.COM>
!  *
!  * Revision 5.6  1992/10/17  22:47:09  syd
!  * adds the function bytemap() and the macros MAPIN and MAPOUT from the file
!  * lib/ndbz.c in the file src/alias.c.
!  *
!  * prevent elm from exiting when resyncing the empty incoming mailbox.
!  * From: vogt@isa.de (Gerald Vogt)
!  *
!  * Revision 5.5  1992/10/11  01:46:35  syd
!  * change dbm name to dbz to avoid conflicts with partial call
!  * ins from shared librarys, and from mixing code with yp code.
!  * From: Syd via prompt from Jess Anderson
!  *
!  * Revision 5.4  1992/10/11  01:21:17  syd
!  * 1. If firstname && lastname is null then copy aliasname into the
!  * personal name field (inside the ()'s) when creating an alias
!  * from the menu using the 'n' command.
!  *
!  * 2. Now if for some reason and alias has a null personal name field
!  * (the person hand edited aliases.text) the blank () is not printed
!  * as part of the address.  This actually cured another problem, where
!  * the To: field on the screen (when you hit 'm' on the alias menu)
!  * used to be blank, now the address shows up....
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.3  1992/10/11  01:07:52  syd
!  * get_return() assumes that message_count reflects the number of
!  * messages in the current folder, but the message_count it's seeing
!  * from the alias subsystem is actually the *alias* count.
!  * toggle the main state before and after calling get_return().
!  * From: cliff@sfn.ORG (R. Cliff Young)
!  *
!  * Revision 5.2  1992/10/11  00:59:39  syd
!  * Fix some compiler warnings that I receive compiling Elm on my SVR4
!  * machine.
!  * From: Tom Moore <tmoore@fievel.DaytonOH.NCR.COM>
!  *
!  * Revision 5.1  1992/10/03  22:58:40  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** This file contains alias stuff
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: alias.c,v 1.4 1998/11/07 16:41:29 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.4 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** This file contains alias stuff
  
***************
*** 269,277 ****
--- 22,41 ----
  #include <sys/stat.h>
  #include "s_aliases.h"
  #include "ndbz.h"
+ #include "me.h"
  
  #define	ECHOIT	1 	/* echo on for prompting */
  
+ static int get_aliasname P_((
+ 			     char *aliasname, char *buffer,
+ 			     int *duplicate,
+ 			     int size,int  buffer_size));
+ 
+ static int superceed_system P_((
+ 				int this_alias,
+ 				char *buffer,
+ 				int buffer_size));
+ 
  /*
   * A simple macro to make it easier to remember how to do a simple
   * resync and not screw up whether or not to prompt on deletions.
***************
*** 281,289 ****
  
  extern char *alias_type(), *get_alias_address();
  char *error_description(), *get_parens();
- void get_realnames();
  void install_aliases();
  
  int  is_system=0;		/* system file updating?     */
  
  extern int errno;
--- 45,58 ----
  
  extern char *alias_type(), *get_alias_address();
  char *error_description(), *get_parens();
  void install_aliases();
  
+ static void get_realnames P_((char *, char *, char *, char *, char *,
+ 			      int, int, int, int));
+ static int add_alias P_((int, int));
+ static int ask_accept P_((char *, char *, char *, char *, char *, char *,
+ 			  int, int, int));
+ 
  int  is_system=0;		/* system file updating?     */
  
  extern int errno;
***************
*** 436,442 ****
  
  	/* If hash file hasn't changed, don't bother re-reading. */
  
! 	sprintf(fname, "%s/%s", home, ALIAS_DATA);
  
  	if (stat(fname, &hst) == 0) {			/* File exists */
  	    if (hst.st_ctime == user_ctime &&
--- 205,211 ----
  
  	/* If hash file hasn't changed, don't bother re-reading. */
  
! 	strfcpy(fname,user_data_file,sizeof fname);
  
  	if (stat(fname, &hst) == 0) {			/* File exists */
  	    if (hst.st_ctime == user_ctime &&
***************
*** 480,488 ****
  
  }
  
! int
! add_alias(replace, to_replace)
! int replace, to_replace;
  {
  /*
   *	Add an alias to the user alias text file.  If there
--- 249,256 ----
  
  }
  
! static int add_alias(replace, to_replace)
!      int replace, to_replace;
  {
  /*
   *	Add an alias to the user alias text file.  If there
***************
*** 524,538 ****
  	  * There is only on alias tagged.  Ask the question
  	  * but the default response is NO.
  	  */
! 	    PutLine0(LINES-2,0, catgets(elm_msg_cat,
! 	            AliasesSet, AliasesOneTagged,
! 	            "There is 1 alias tagged..."));
  	    CleartoEOLN();
! 	    MCsprintf(buffer, catgets(elm_msg_cat,
! 	            AliasesSet, AliasesCreateGroup,
! 	            "Create group alias? (%c/%c) "),
! 	        *def_ans_yes, *def_ans_no);
! 	    ch = want_to(buffer, *def_ans_no, LINES-3, 0);
  	}
  	else if (tagged > 1) {
  	 /*
--- 292,307 ----
  	  * There is only on alias tagged.  Ask the question
  	  * but the default response is NO.
  	  */
! 	    PutLine0(elm_LINES-2,0, catgets(elm_msg_cat,
! 					    AliasesSet, AliasesOneTagged,
! 					    "There is 1 alias tagged..."));
  	    CleartoEOLN();
! 	    elm_sfprintf(buffer, sizeof buffer,
! 			 CATGETS(elm_msg_cat,
! 				 AliasesSet, AliasesCreateGroup,
! 				 "Create group alias? (%c/%c) "),
! 			 *def_ans_yes, *def_ans_no);
! 	    ch = want_to(buffer, *def_ans_no, elm_LINES-3, 0);
  	}
  	else if (tagged > 1) {
  	 /*
***************
*** 540,554 ****
  	  * wants to create a group alias.  The default response
  	  * is YES.
  	  */
! 	    PutLine1(LINES-2,0, catgets(elm_msg_cat,
! 	            AliasesSet, AliasesManyTagged,
! 	            "There are %d aliases tagged..."), tagged);
  	    CleartoEOLN();
! 	    MCsprintf(buffer, catgets(elm_msg_cat,
! 	            AliasesSet, AliasesCreateGroup,
! 	            "Create group alias? (%c/%c) "),
! 	        *def_ans_yes, *def_ans_no);
! 	    ch = want_to(buffer, *def_ans_yes, LINES-3, 0);
  	}
  
  /*
--- 309,325 ----
  	  * wants to create a group alias.  The default response
  	  * is YES.
  	  */
! 	    PutLineX(elm_LINES-2,0, CATGETS(elm_msg_cat,
! 					    AliasesSet, AliasesManyTagged,
! 					    "There are %d aliases tagged..."),
! 		     tagged);
  	    CleartoEOLN();
! 	    elm_sfprintf(buffer, sizeof buffer,
! 			 CATGETS(elm_msg_cat,
! 				 AliasesSet, AliasesCreateGroup,
! 				 "Create group alias? (%c/%c) "),
! 			 *def_ans_yes, *def_ans_no);
! 	    ch = want_to(buffer, *def_ans_yes, elm_LINES-3, 0);
  	}
  
  /*
***************
*** 558,568 ****
   *	and the user responded correctly).
   */
  	if (ch == *def_ans_yes) {
! 	    strcpy(address1, aliases[leftoff]->alias);
  	    for (i=leftoff+1; i < message_count; i++) {
  	        if (ison(aliases[i]->status, TAGGED)) {
! 	            strcat(address1, ",");
! 	            strcat(address1, aliases[i]->alias);
  	        }
  	    }
  	}
--- 329,341 ----
   *	and the user responded correctly).
   */
  	if (ch == *def_ans_yes) {
! 	    strfcpy(address1, aliases[leftoff]->alias,
! 		    sizeof address1);
  	    for (i=leftoff+1; i < message_count; i++) {
  	        if (ison(aliases[i]->status, TAGGED)) {
! 	            strfcat(address1, ",", sizeof address1);
! 	            strfcat(address1, aliases[i]->alias, 
! 			    sizeof address1);
  	        }
  	    }
  	}
***************
*** 575,581 ****
   *	current alias.
   */
  	if (replace) {
! 	    strcpy(aliasname, aliases[to_replace]->alias);
  	/*
  	 *  First, see if what we are replacing is a SYSTEM
  	 *  alias.  If so, we need to ask a question.
--- 348,355 ----
   *	current alias.
   */
  	if (replace) {
! 	    strfcpy(aliasname, aliases[to_replace]->alias,
! 		    sizeof aliasname);
  	/*
  	 *  First, see if what we are replacing is a SYSTEM
  	 *  alias.  If so, we need to ask a question.
***************
*** 587,609 ****
  	     *  If they don't want to superceed the SYSTEM alias then
  	     *  just return.
  	     */
! 	        if( ! superceed_system(to_replace, buffer)) {
! 	            ClearLine(LINES-2);
  	            return(0);
  	        }
  	    }
  	}
  	else {
! 	    strcpy(buffer, catgets(elm_msg_cat,
! 	            AliasesSet, AliasesEnterAliasName, "Enter alias name: "));
! 	    PutLine0(LINES-2,0, buffer);
  	    CleartoEOLN();
  	    *aliasname = '\0';
! 	    if ((replace = get_aliasname(aliasname, buffer, &to_replace)) < 0) {
! 	        dprint(3, (debugfile, 
! 	            "Aliasname [%s] was rejected in add_alias\n", aliasname));
! 	        ClearLine(LINES-2);
! 	        return(0);
  	    }
  	}
  
--- 361,394 ----
  	     *  If they don't want to superceed the SYSTEM alias then
  	     *  just return.
  	     */
! 	        if( ! superceed_system(to_replace, buffer, sizeof buffer)) {
! 	            ClearLine(elm_LINES-2);
  	            return(0);
  	        }
  	    }
  	}
  	else {
! 	    strfcpy(buffer, catgets(elm_msg_cat,
! 				   AliasesSet, AliasesEnterAliasName, 
! 				   "Enter alias name: "),
! 		    sizeof buffer);
! 	    PutLine0(elm_LINES-2,0, buffer);
  	    CleartoEOLN();
  	    *aliasname = '\0';
! 
! 	    replace = get_aliasname(aliasname, buffer, &to_replace,
! 				    sizeof aliasname, sizeof buffer);
! 	    while (REDRAW_MARK == replace) {
! 	      PutLine0(elm_LINES-2,0, buffer);
! 	      replace = get_aliasname(aliasname, buffer, &to_replace,
! 				      sizeof aliasname, sizeof buffer);
! 	    }
! 
! 	    if (replace < 0) {
! 	      dprint(3, (debugfile, 
! 			 "Aliasname [%s] was rejected in add_alias\n", aliasname));
! 	      ClearLine(elm_LINES-2);
! 	      return(0);
  	    }
  	}
  
***************
*** 613,623 ****
   *	there.  So we copy some defaults from the existing alias.
   */
  	if (replace) {
! 	    strcpy(lastname, aliases[to_replace]->last_name);
! 	    strcpy(firstname, aliases[to_replace]->name);
  	    ch_ptr = strstr(firstname, lastname);
! 	    *(ch_ptr-1) = '\0';
! 	    strcpy(comment, aliases[to_replace]->comment);
  	}
  	else {
  	    *lastname = '\0';
--- 398,411 ----
   *	there.  So we copy some defaults from the existing alias.
   */
  	if (replace) {
! 	    strfcpy(lastname, aliases[to_replace]->last_name,
! 		    sizeof lastname);
! 	    strfcpy(firstname, aliases[to_replace]->name,
! 		    sizeof firstname);
  	    ch_ptr = strstr(firstname, lastname);
! 	    if (ch_ptr)
! 	      *(ch_ptr-1) = '\0';
! 	    strfcpy(comment, aliases[to_replace]->comment, sizeof comment);
  	}
  	else {
  	    *lastname = '\0';
***************
*** 624,630 ****
  	    *firstname = '\0';
  	    *comment = '\0';
  	}
! 	get_realnames(aliasname, firstname, lastname, comment, buffer);
  
  /*
   *	Since there are no tagged aliases, we must ask for an
--- 412,420 ----
  	    *firstname = '\0';
  	    *comment = '\0';
  	}
! 	get_realnames(aliasname, firstname, lastname, comment, buffer,
! 		      sizeof firstname, sizeof lastname, sizeof comment,
! 		      sizeof buffer);
  
  /*
   *	Since there are no tagged aliases, we must ask for an
***************
*** 632,657 ****
   *	presented.
   */
  	if (tagged == 0) {
! 	    sprintf(buffer, catgets(elm_msg_cat,
! 	            AliasesSet, AliasesEnterAddress,
! 	            "Enter address for %s: "), aliasname);
! 	    PutLine0(LINES-2,0, buffer);
  	    CleartoEOLN();
  	    if (replace) {
! 	        strcpy(address1, aliases[to_replace]->address);
  	    }
  	    else {
  	        *address1 = '\0';
  	    }
  	    do {
! 	        optionally_enter(address1, LINES-2, strlen(buffer),
! 	                         FALSE, FALSE);
! 	        Raw(ON);
! 	        if (strlen(address1) == 0) {
! 	            error(catgets(elm_msg_cat, AliasesSet, AliasesNoAddressSpec,
! 	                    "No address specified!"));
! 	            return(0);
! 	        }
  	    } while (check_address(address1) == -1);
  
  	    clear_error();			/* Just in case */
--- 422,466 ----
   *	presented.
   */
  	if (tagged == 0) {
! 	    elm_sfprintf(buffer, sizeof buffer,
! 			 CATGETS(elm_msg_cat,
! 				 AliasesSet, AliasesEnterAddress,
! 				 "Enter address for %s: "), 
! 			 aliasname);
! 	    PutLine0(elm_LINES-2,0, buffer);
  	    CleartoEOLN();
  	    if (replace) {
! 	        strfcpy(address1, aliases[to_replace]->address,
! 			sizeof address1);
  	    }
  	    else {
  	        *address1 = '\0';
  	    }
  	    do {
! 	      int status =
! 	        optionally_enter(address1, elm_LINES-2, strlen(buffer),
! 	                         OE_REDRAW_MARK, sizeof address1);
! 
! 	      while (REDRAW_MARK == status) {
! 		elm_sfprintf(buffer, sizeof buffer,
! 			     CATGETS(elm_msg_cat,
! 				     AliasesSet, AliasesEnterAddress,
! 				     "Enter address for %s: "), 
! 			     aliasname);
! 		PutLine0(elm_LINES-2,0, buffer);
! 		status =
! 		  optionally_enter(address1, elm_LINES-2, strlen(buffer),
! 				   OE_REDRAW_MARK|OE_APPEND_CURRENT,
! 				   sizeof address1);
! 	      }
! 
! 	      if (0 != status ||
! 		  strlen(address1) == 0) {
! 		lib_error(CATGETS(elm_msg_cat, AliasesSet, 
! 				  AliasesNoAddressSpec,
! 				  "No address specified!"));
! 		return(0);
! 	      }
  	    } while (check_address(address1) == -1);
  
  	    clear_error();			/* Just in case */
***************
*** 658,664 ****
  	}
  
  	if(ask_accept(aliasname, firstname, lastname, comment, address1,
! 	        buffer, replace, to_replace)) {
  	 /*
  	  * We can only clear the tags after we know that the
  	  * alias was added.  This allows the user to back out
--- 467,474 ----
  	}
  
  	if(ask_accept(aliasname, firstname, lastname, comment, address1,
! 		      buffer, replace, to_replace,
! 		      sizeof buffer)) {
  	 /*
  	  * We can only clear the tags after we know that the
  	  * alias was added.  This allows the user to back out
***************
*** 705,734 ****
  	if (current_mail_message == 0) {
  	 dprint(4, (debugfile, 
  		"Add current alias called without any current message!\n"));
! 	 error(catgets(elm_msg_cat, AliasesSet, AliasesNoMessage,
! 		"No message to alias to!"));
  	 return(0);
  	}
  	current_header = headers[current_mail_message - 1];
  	
! 	strcpy(buffer, catgets(elm_msg_cat, AliasesSet, AliasesCurrentMessage,
! 		"Current message address aliased to: "));
! 	PutLine0(LINES-2,0, buffer);
  	CleartoEOLN();
  	*aliasname = '\0';
! 	if ((replace = get_aliasname(aliasname, buffer, &to_replace)) < 0) {
  	    dprint(3, (debugfile, 
  	        "Aliasname [%s] was rejected in add_current_alias\n",
  	        aliasname));
! 	    ClearLine(LINES-2);
  	    return(0);
  	}
  
! 	/* use full name in current message for default comment */
! 	tail_of(current_header->from, comment_buff, current_header->to);
! 	if(index(comment_buff, (int)'!') || index(comment_buff, (int)'@'))
! 	  /* never mind - it's an address not a full name */
! 	  *comment_buff = '\0';
  
  /*
   *	Try to break up the From: comment into firstname, lastname, and
--- 515,554 ----
  	if (current_mail_message == 0) {
  	 dprint(4, (debugfile, 
  		"Add current alias called without any current message!\n"));
! 	 lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesNoMessage,
! 			   "No message to alias to!"));
  	 return(0);
  	}
  	current_header = headers[current_mail_message - 1];
  	
! 	strfcpy(buffer, catgets(elm_msg_cat, AliasesSet, AliasesCurrentMessage,
! 				"Current message address aliased to: "),
! 		sizeof buffer);
! 	PutLine0(elm_LINES-2,0, buffer);
  	CleartoEOLN();
  	*aliasname = '\0';
! 	replace = get_aliasname(aliasname, buffer, &to_replace,
! 				sizeof aliasname, sizeof buffer);
! 	while (REDRAW_MARK == replace) {
! 	  PutLine0(elm_LINES-2,0, buffer);
! 	  replace = get_aliasname(aliasname, buffer, &to_replace,
! 				  sizeof aliasname, sizeof buffer);
! 	}
! 	if (replace < 0) {
  	    dprint(3, (debugfile, 
  	        "Aliasname [%s] was rejected in add_current_alias\n",
  	        aliasname));
! 	    ClearLine(elm_LINES-2);
  	    return(0);
  	}
  
! 	/* take fullname if there was exatcly one address */
! 	comment_buff[0] = '\0';
! 	if (current_header->from && 
! 	    current_header->from[0].fullname &&
! 	    !current_header->from[1].fullname)
! 	  strfcpy(comment_buff,current_header->from[0].fullname,
! 		  sizeof comment_buff);
  
  /*
   *	Try to break up the From: comment into firstname, lastname, and
***************
*** 755,761 ****
  	    *   Get firstname and move bufptr.
  	    */
  	        *chspace = '\0';
! 	        strcpy(firstname, bufptr);
  	        bufptr = chspace + 1;			/* Move the pointer */
  	        while (*bufptr == SPACE) bufptr++;
  	    }
--- 575,581 ----
  	    *   Get firstname and move bufptr.
  	    */
  	        *chspace = '\0';
! 	        strfcpy(firstname, bufptr, sizeof firstname);
  	        bufptr = chspace + 1;			/* Move the pointer */
  	        while (*bufptr == SPACE) bufptr++;
  	    }
***************
*** 776,797 ****
  	        *   probably a middle initial.  Add it to firstname
  	        *   and shift.
  	        */
! 	            strcat(firstname, " ");
! 	            strcat(firstname, bufptr);
  	            bufptr = chspace + 1;		/* Move the pointer */
  	            while (*bufptr == SPACE) bufptr++;
  	            goto above;
  	        }
! 	        strcpy(lastname, bufptr);
  	        bufptr = chspace + 1;			/* Move the pointer */
  	        while (*bufptr == SPACE) bufptr++;
! 	        strcpy(comment, bufptr);
  	    }
  	    else {
  	   /*
  	    *   Only a lastname left.
  	    */
! 	        strcpy(lastname, bufptr);
  	    }
  
  	/*
--- 596,617 ----
  	        *   probably a middle initial.  Add it to firstname
  	        *   and shift.
  	        */
! 	            strfcat(firstname, " ", sizeof firstname);
! 	            strfcat(firstname, bufptr, sizeof firstname);
  	            bufptr = chspace + 1;		/* Move the pointer */
  	            while (*bufptr == SPACE) bufptr++;
  	            goto above;
  	        }
! 	        strfcpy(lastname, bufptr, sizeof lastname);
  	        bufptr = chspace + 1;			/* Move the pointer */
  	        while (*bufptr == SPACE) bufptr++;
! 	        strfcpy(comment, bufptr, sizeof comment);
  	    }
  	    else {
  	   /*
  	    *   Only a lastname left.
  	    */
! 	        strfcpy(lastname, bufptr, sizeof lastname);
  	    }
  
  	/*
***************
*** 811,826 ****
  	    }
  	}
  
! 	get_realnames(aliasname, firstname, lastname, comment, buffer);
  
  	/* grab the return address of this message */
  	main_state(); /* toggle main state so that message_count is right */
! 	get_return(address1, current_mail_message-1);
  	main_state(); /* toggle main state back to alias mode */
! 	strcpy(address1, strip_parens(address1));	/* remove parens! */
  
  	return(ask_accept(aliasname, firstname, lastname, comment, address1,
! 	        buffer, replace, to_replace));
  
  }
  
--- 631,649 ----
  	    }
  	}
  
! 	get_realnames(aliasname, firstname, lastname, comment, buffer,
! 		      sizeof firstname, sizeof lastname, sizeof comment,
! 		      sizeof buffer);
  
  	/* grab the return address of this message */
  	main_state(); /* toggle main state so that message_count is right */
! 	get_return(address1, current_mail_message-1, sizeof address1);
  	main_state(); /* toggle main state back to alias mode */
! 	strfcpy(address1, strip_parens(address1),
! 		sizeof address1);	/* remove parens! */
  
  	return(ask_accept(aliasname, firstname, lastname, comment, address1,
! 			  buffer, replace, to_replace, sizeof buffer));
  
  }
  
***************
*** 838,844 ****
  	char buffer[SLEN];
  	int  err;
  	
! 	sprintf(fname,"%s/%s", home, ALIAS_TEXT);
  	
  	save_file_stats(fname);
  	if ((file = fopen(fname, "a")) == NULL) {
--- 661,667 ----
  	char buffer[SLEN];
  	int  err;
  	
! 	strfcpy(fname,user_text_file,sizeof fname);
  	
  	save_file_stats(fname);
  	if ((file = fopen(fname, "a")) == NULL) {
***************
*** 847,866 ****
  		 "Failure attempting to add alias to file %s within %s",
  		   fname, "add_to_alias_text"));
  	  dprint(2, (debugfile, "** %s **\n", error_description(err)));
! 	  error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntOpenAdd,
! 		 "Couldn't open %s to add new alias!"), fname);
  	  return(1);
  	}
  
  	if (strlen(firstname) == 0) {
! 	    strcpy(buffer, lastname);  
  	}
  	else {
! 	    sprintf(buffer, "%s; %s", lastname, firstname);
  	}
  	if (strlen(comment) != 0) {
! 	    strcat(buffer, ", ");
! 	    strcat(buffer, comment);
  	}
  	if (fprintf(file,"%s = %s = %s\n", aliasname, buffer, address) == EOF) {
  	    err = errno;
--- 670,691 ----
  		 "Failure attempting to add alias to file %s within %s",
  		   fname, "add_to_alias_text"));
  	  dprint(2, (debugfile, "** %s **\n", error_description(err)));
! 	  lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesCouldntOpenAdd,
! 			    "Couldn't open %s to add new alias!"), 
! 		    fname);
  	  return(1);
  	}
  
  	if (strlen(firstname) == 0) {
! 	    strfcpy(buffer, lastname, sizeof buffer);  
  	}
  	else {
! 	  elm_sfprintf(buffer, sizeof buffer,
! 		       FRM("%s; %s"), lastname, firstname);
  	}
  	if (strlen(comment) != 0) {
! 	    strfcat(buffer, ", ", sizeof buffer);
! 	    strfcat(buffer, comment, sizeof buffer);
  	}
  	if (fprintf(file,"%s = %s = %s\n", aliasname, buffer, address) == EOF) {
  	    err = errno;
***************
*** 868,875 ****
  		       "Failure attempting to write alias to file within %s",
  		       fname, "add_to_alias_text"));
  	    dprint(2, (debugfile, "** %s **\n", error_description(err)));
! 	    error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntWrite,
! 		   "Couldn't write alias to file %s!"), fname);
  	    fclose(file);
  	    return(1);
  	}
--- 693,701 ----
  		       "Failure attempting to write alias to file within %s",
  		       fname, "add_to_alias_text"));
  	    dprint(2, (debugfile, "** %s **\n", error_description(err)));
! 	    lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesCouldntWrite,
! 			      "Couldn't write alias to file %s!"), 
! 		      fname);
  	    fclose(file);
  	    return(1);
  	}
***************
*** 881,886 ****
--- 707,715 ----
  	return(0);
  }
  
+ static int parse_aliases P_((char *, char *, int, int)); /* Prototype */
+ 
+ 
  delete_from_alias_text(name, num_to_delete)
  char **name;
  int num_to_delete;
***************
*** 905,915 ****
  
  	delete_continues = FALSE;
  
! 	for (i=0; i < num_to_delete; i++)
! 	  strcat(name[i], ","); 
! 
! 	sprintf(fname,"%s/%s", home, ALIAS_TEXT);
! 	sprintf(tmpfname,"%s/%s.t", home, ALIAS_TEXT);
  	
  	save_file_stats(fname);
  
--- 734,742 ----
  
  	delete_continues = FALSE;
  
! 	strfcpy(fname,user_text_file,sizeof fname);
! 	elm_sfprintf(tmpfname,sizeof tmpfname,
! 		     FRM("%s.t"), user_text_file);
  	
  	save_file_stats(fname);
  
***************
*** 919,926 ****
  		 "Failure attempting to delete alias from file %s within %s",
  		   fname, "delete_from_alias_text"));
  	  dprint(2, (debugfile, "** %s **\n", error_description(err)));
! 	  error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntOpenDelete,
! 		 "Couldn't open %s to delete alias!"), fname);
  	  return(1);
  	}
  
--- 746,754 ----
  		 "Failure attempting to delete alias from file %s within %s",
  		   fname, "delete_from_alias_text"));
  	  dprint(2, (debugfile, "** %s **\n", error_description(err)));
! 	  lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesCouldntOpenDelete,
! 			    "Couldn't open %s to delete alias!"), 
! 		    fname);
  	  return(1);
  	}
  
***************
*** 930,937 ****
  		 "Failure attempting to open temp file %s within %s",
  		   tmpfname, "delete_from_alias_text"));
  	  dprint(2, (debugfile, "** %s **\n", error_description(err)));
! 	  error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntOpenTemp,
! 	  	 "Couldn't open temp file %s to delete alias!"), tmpfname);
  	  return(1);
  	}
  
--- 758,766 ----
  		 "Failure attempting to open temp file %s within %s",
  		   tmpfname, "delete_from_alias_text"));
  	  dprint(2, (debugfile, "** %s **\n", error_description(err)));
! 	  lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesCouldntOpenTemp,
! 			    "Couldn't open temp file %s to delete alias!"), 
! 		    tmpfname);
  	  return(1);
  	}
  
***************
*** 940,952 ****
  	  if (! whitespace(line_in_file[0])) {
  	    delete_continues = FALSE;
  	    if (line_in_file[0] != '#') {
! 	      if (num_aliases = parse_aliases(line_in_file, rest_of_line)) {
  	        for (i=0; i < num_to_delete && num_aliases; i++) {
! 	          if ((s = strstr(line_in_file, name[i])) != NULL) {
  /*
   *	Collapse the to be deleted alias out of line_in_file
   */
! 	            rest = index(s, (int)',');
  	            for (++rest; *rest; rest++)
  	              *s++ = *rest;
  	            *s = '\0';
--- 769,787 ----
  	  if (! whitespace(line_in_file[0])) {
  	    delete_continues = FALSE;
  	    if (line_in_file[0] != '#') {
! 	      if (num_aliases = parse_aliases(line_in_file, rest_of_line,
! 					      sizeof line_in_file,
! 					      sizeof rest_of_line)) {
  	        for (i=0; i < num_to_delete && num_aliases; i++) {
! 		  char buf[LONG_STRING];
! 		  strfcpy(buf,name[i], sizeof buf);
! 		  strfcat(buf,",", sizeof buf);
! 
! 	          if ((s = strstr(line_in_file, buf)) != NULL) {
  /*
   *	Collapse the to be deleted alias out of line_in_file
   */
! 	            rest = index(s, ',');
  	            for (++rest; *rest; rest++)
  	              *s++ = *rest;
  	            *s = '\0';
***************
*** 955,961 ****
  	        }
  	        if (num_aliases) {
  	          *(line_in_file + strlen(line_in_file) - 1) = ' ';
! 	          strcat(line_in_file, rest_of_line);
  	        }
  	        else {
  	          delete_continues = TRUE;
--- 790,797 ----
  	        }
  	        if (num_aliases) {
  	          *(line_in_file + strlen(line_in_file) - 1) = ' ';
! 	          strfcat(line_in_file, rest_of_line,
! 			  sizeof line_in_file);
  	        }
  	        else {
  	          delete_continues = TRUE;
***************
*** 970,977 ****
  		"Failure attempting to write to temp file %s within %s",
  		tmpfname, "delete_from_alias_text"));
  	      dprint(2, (debugfile, "** %s **\n", error_description(err)));
! 	      error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntWriteTemp,
! 		"Couldn't write to temp file %s!"), tmpfname);
  	      fclose(file);
  	      fclose(tmp_file);
  	      unlink(tmpfname);
--- 806,815 ----
  		"Failure attempting to write to temp file %s within %s",
  		tmpfname, "delete_from_alias_text"));
  	      dprint(2, (debugfile, "** %s **\n", error_description(err)));
! 	      lib_error(CATGETS(elm_msg_cat, AliasesSet, 
! 				AliasesCouldntWriteTemp,
! 				"Couldn't write to temp file %s!"), 
! 			tmpfname);
  	      fclose(file);
  	      fclose(tmp_file);
  	      unlink(tmpfname);
***************
*** 983,990 ****
  	fclose(tmp_file);
  	if (rename(tmpfname, fname) != 0)
  	{
! 		error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntRenameTemp,
! 			"Couldn't rename temp file %s after deleting alias!"), tmpfname);
  		return(1);
  	}
  
--- 821,830 ----
  	fclose(tmp_file);
  	if (rename(tmpfname, fname) != 0)
  	{
! 		lib_error(CATGETS(elm_msg_cat, AliasesSet, 
! 				  AliasesCouldntRenameTemp,
! 				  "Couldn't rename temp file %s after deleting alias!"), 
! 			  tmpfname);
  		return(1);
  	}
  
***************
*** 993,998 ****
--- 833,839 ----
  	return(0);
  }
  
+ void
  alias()
  {
  /*
***************
*** 999,1005 ****
   *	Work with alias commands...
   */
  
! 	char name[NLEN], *address, ch, buffer[SLEN];
  	char *commap;
  	int  key_offset;        /** Position offset within keyboard string   **/
  	static int  newaliases = 0;
--- 840,847 ----
   *	Work with alias commands...
   */
  
! 	char name[NLEN], *address, buffer[SLEN];
! 	int ch;
  	char *commap;
  	int  key_offset;        /** Position offset within keyboard string   **/
  	static int  newaliases = 0;
***************
*** 1018,1024 ****
  	open_alias_files(FALSE);	/* First, read the alias files. RLH */
  
  	alias_screen(newaliases);
! 	define_softkeys(ALIAS);
  
  	while (1) {
  
--- 860,866 ----
  	open_alias_files(FALSE);	/* First, read the alias files. RLH */
  
  	alias_screen(newaliases);
! 	/* define_softkeys(ALIAS); */
  
  	while (1) {
  
***************
*** 1028,1041 ****
  
  	    ScreenSize(&newLINES, &newCOLUMNS);
  	    resize_screen = 0;
! 	    if (newLINES != LINES || newCOLUMNS != COLUMNS) {
! 	      LINES = newLINES, COLUMNS = newCOLUMNS;
  #undef max
  #define max(a,b)	       ((a) < (b) ? (b) : (a))
  	      if (mini_menu)
! 		headers_per_page = max (LINES - 13, 1);
  	      else
! 		headers_per_page = max (LINES -	 8, 1);	  /* 5 more headers! */
  #undef max
  	      redraw++;
  	    }
--- 870,883 ----
  
  	    ScreenSize(&newLINES, &newCOLUMNS);
  	    resize_screen = 0;
! 	    if (newLINES != elm_LINES || newCOLUMNS != elm_COLUMNS) {
! 	      elm_LINES = newLINES, elm_COLUMNS = newCOLUMNS;
  #undef max
  #define max(a,b)	       ((a) < (b) ? (b) : (a))
  	      if (mini_menu)
! 		headers_per_page = max (elm_LINES - 13, 1);
  	      else
! 		headers_per_page = max (elm_LINES -	 8, 1);	  /* 5 more headers! */
  #undef max
  	      redraw++;
  	    }
***************
*** 1049,1063 ****
  
  	  prompt(Prompt);
  	  CleartoEOLN();
! 	  ch = ReadCh();
! 	  MoveCursor(LINES-3,strlen(Prompt)); CleartoEOS();
! 	  
! 	  dprint(3, (debugfile, "\n-- Alias command: %c\n\n", ch));
  
  	  switch (ch) {
  	    case '?': redraw += alias_help();			break;
  
! 	    case '$': PutLine0(LINES-3, strlen(Prompt),
  			     catgets(elm_msg_cat, AliasesSet, AliasesResync,
  					"Resynchronize aliases..."));
  	           /*
--- 891,914 ----
  
  	  prompt(Prompt);
  	  CleartoEOLN();
! 	  ch = ReadCh(REDRAW_MARK|READCH_CURSOR);
! 	  MoveCursor(elm_LINES-3,strlen(Prompt)); CleartoEOS();
! 
! 	  if (isascii(ch) && isprint(ch)) {
! 	    dprint(4, (debugfile, "-- Alias command: %c [%d]\n",ch,ch));
! 	  } else {
! 	    dprint(4, (debugfile, "-- Alias command: [%d]\n",ch));
! 	  }
  
  	  switch (ch) {
+ 	  case HELP_MARK:
  	    case '?': redraw += alias_help();			break;
  
! 	    case REDRAW_MARK:
! 	    case 'L'&31: redraw++;                              break;
! 
! 
! 	    case '$': PutLine0(elm_LINES-3, strlen(Prompt),
  			     catgets(elm_msg_cat, AliasesSet, AliasesResync,
  					"Resynchronize aliases..."));
  	           /*
***************
*** 1071,1079 ****
  		      }
  		      break;
  
! 	    case 'a': PutLine0(LINES-3, strlen(Prompt),
! 			     catgets(elm_msg_cat, AliasesSet, AliasesAddCurrent,
! 					"Add address from current message..."));
  		      clear_error();
  		      if (add_current_alias()) {
  		          newaliases++;
--- 922,931 ----
  		      }
  		      break;
  
! 	    case 'a': PutLine0(elm_LINES-3, strlen(Prompt),
! 			       catgets(elm_msg_cat, AliasesSet, 
! 				       AliasesAddCurrent,
! 				       "Add address from current message..."));
  		      clear_error();
  		      if (add_current_alias()) {
  		          newaliases++;
***************
*** 1083,1089 ****
  
  	    case 'c':
  	              if (current > 0) {
! 	                  PutLine0(LINES-3, strlen(Prompt),
  			      catgets(elm_msg_cat,
  	                              AliasesSet, AliasesReplaceCurrent,
  	                              "Replace current alias in database..."));
--- 935,941 ----
  
  	    case 'c':
  	              if (current > 0) {
! 	                  PutLine0(elm_LINES-3, strlen(Prompt),
  			      catgets(elm_msg_cat,
  	                              AliasesSet, AliasesReplaceCurrent,
  	                              "Replace current alias in database..."));
***************
*** 1094,1108 ****
  		          }
  	              }
  	              else {
! 		          error(catgets(elm_msg_cat,
! 	                          AliasesSet, AliasesNoneToReplace,
! 				  "Warning: no aliases to replace!"));
  	              }
  		      break;
  
! 	    case 'e': PutLine1(LINES-3, strlen(Prompt),
! 	                  catgets(elm_msg_cat, AliasesSet, AliasesEdit,
! 	                      "Edit %s..."), ALIAS_TEXT);
  	           /*
  	            * Process aliases.text for deletions, etc.  You
  	            * have to do this *before* checking current because
--- 946,960 ----
  		          }
  	              }
  	              else {
! 		          lib_error(CATGETS(elm_msg_cat,
! 					    AliasesSet, AliasesNoneToReplace,
! 					    "Warning: no aliases to replace!"));
  	              }
  		      break;
  
! 	    case 'e': PutLineX(elm_LINES-3, strlen(Prompt),
! 			       CATGETS(elm_msg_cat, AliasesSet, AliasesEdit,
! 				       "Edit %s..."), USER_ALIAS_TEXT);
  	           /*
  	            * Process aliases.text for deletions, etc.  You
  	            * have to do this *before* checking current because
***************
*** 1112,1140 ****
  	              if (edit_aliases_text()) {
  	                  newaliases = 0;
  	              }
- 	              if (cursor_control) {
- 	                  transmit_functions(ON);	/* insurance */
- 	              }
  		      redraw++;
  		      break;
  
  	    case 'm':
  	              if (current > 0) {
! 	                  PutLine0(LINES-3, strlen(Prompt),
  	                      catgets(elm_msg_cat, AliasesSet, AliasesMail,
  	                          "Mail..."));
  	                  redraw += a_sendmsg(TRUE,allow_forms);
  	              }
  	              else {
! 		          error(catgets(elm_msg_cat,
! 	                          AliasesSet, AliasesNoneToMail,
! 				  "Warning: no aliases to send mail to!"));
  	              }
  		      break;
  
! 	    case 'n': PutLine0(LINES-3, strlen(Prompt),
! 			     catgets(elm_msg_cat, AliasesSet, AliasesAddNew,
! 					     "Add a new alias to database..."));
  		      clear_error();
  		      if (add_alias(FALSE, -1)) {
  		          newaliases++;
--- 964,989 ----
  	              if (edit_aliases_text()) {
  	                  newaliases = 0;
  	              }
  		      redraw++;
  		      break;
  
  	    case 'm':
  	              if (current > 0) {
! 	                  PutLine0(elm_LINES-3, strlen(Prompt),
  	                      catgets(elm_msg_cat, AliasesSet, AliasesMail,
  	                          "Mail..."));
  	                  redraw += a_sendmsg(TRUE,allow_forms);
  	              }
  	              else {
! 		          lib_error(CATGETS(elm_msg_cat,
! 					    AliasesSet, AliasesNoneToMail,
! 					    "Warning: no aliases to send mail to!"));
  	              }
  		      break;
  
! 	    case 'n': PutLine0(elm_LINES-3, strlen(Prompt),
! 			       catgets(elm_msg_cat, AliasesSet, AliasesAddNew,
! 				       "Add a new alias to database..."));
  		      clear_error();
  		      if (add_alias(FALSE, -1)) {
  		          newaliases++;
***************
*** 1147,1155 ****
  	    case 'i':
  	    case 'I':
  	    case 'r':
! 	    case 'R': PutLine0(LINES-3, strlen(Prompt),
! 			     catgets(elm_msg_cat, AliasesSet, AliasesAddReturn,
! 					"Return to main menu..."));
  	           /*
  	            * leaving the alias system.  Must check for
  	            * pending deletes, etc.  prompt is set to FALSE
--- 996,1005 ----
  	    case 'i':
  	    case 'I':
  	    case 'r':
! 	    case 'R': PutLine0(elm_LINES-3, strlen(Prompt),
! 			       catgets(elm_msg_cat, AliasesSet, 
! 				       AliasesAddReturn,
! 				       "Return to main menu..."));
  	           /*
  	            * leaving the alias system.  Must check for
  	            * pending deletes, etc.  prompt is set to FALSE
***************
*** 1169,1204 ****
  	    case SPACE:
  	    case 'v':
  		      if (newaliases) {		/* Need this ?? */
! 		          error(catgets(elm_msg_cat,
! 	                          AliasesSet, AliasesNotInstalled,
! 				  "Warning: new aliases not installed yet!"));
  	              }
  
  	              if (current > 0) {
  	                  if (aliases[current-1]->type & GROUP) {
! 	                      PutLine1(LINES-1, 0, catgets(elm_msg_cat,
! 	                              AliasesSet, AliasesGroupAlias,
! 				      "Group alias: %-60.60s"),
  	                          aliases[current-1]->address);
  		          }
  		          else {
! 	                      PutLine1(LINES-1, 0, catgets(elm_msg_cat,
! 	                              AliasesSet, AliasesAliasedAddress,
! 				      "Aliased address: %-60.60s"), 
! 	                          aliases[current-1]->address);
  		          }
  		      }
  	              else {
! 		          error(catgets(elm_msg_cat,
! 	                          AliasesSet, AliasesNoneToView,
! 				  "Warning: no aliases to view!"));
  		      }
  		      break;
  
  	    case 'x':
! 	    case 'X': PutLine0(LINES-3, strlen(Prompt),
! 			     catgets(elm_msg_cat, AliasesSet, AliasesAddReturn,
! 					"Return to main menu..."));
  	              exit_alias();
  		      clear_error();
  		      main_state();		/* Done with aliases. */
--- 1019,1057 ----
  	    case SPACE:
  	    case 'v':
  		      if (newaliases) {		/* Need this ?? */
! 		          lib_error(CATGETS(elm_msg_cat,
! 					    AliasesSet, AliasesNotInstalled,
! 					    "Warning: new aliases not installed yet!"));
  	              }
  
  	              if (current > 0) {
  	                  if (aliases[current-1]->type & GROUP) {
! 	                      PutLineX(elm_LINES-1, 0, 
! 				       CATGETS(elm_msg_cat,
! 					       AliasesSet, AliasesGroupAlias,
! 					       "Group alias: %-60.60s"),
  	                          aliases[current-1]->address);
  		          }
  		          else {
! 	                      PutLineX(elm_LINES-1, 0, 
! 				       CATGETS(elm_msg_cat,
! 					       AliasesSet, AliasesAliasedAddress,
! 					       "Aliased address: %-60.60s"), 
! 				       aliases[current-1]->address);
  		          }
  		      }
  	              else {
! 		          lib_error(CATGETS(elm_msg_cat,
! 					    AliasesSet, AliasesNoneToView,
! 					    "Warning: no aliases to view!"));
  		      }
  		      break;
  
  	    case 'x':
! 	    case 'X': PutLine0(elm_LINES-3, strlen(Prompt),
! 			       catgets(elm_msg_cat, AliasesSet, 
! 				       AliasesAddReturn,
! 				       "Return to main menu..."));
  	              exit_alias();
  		      clear_error();
  		      main_state();		/* Done with aliases. */
***************
*** 1208,1234 ****
  	    case 'F':
  	              if (current > 0) {
  		          clear_error();
! 		          strcpy(name, aliases[current-1]->alias);
  		          if (ch == 'F') {
! 		              strcpy(buffer, catgets(elm_msg_cat,
! 	                              AliasesSet, AliasesFullyExpanded,
! 				      "Fully expand alias: "));
! 		              PutLine0(LINES-2,0, buffer);
  		              CleartoEOS();
! 		              optionally_enter(name, LINES-2, strlen(buffer),
! 			          FALSE, FALSE);
  		          }
  	                  too_long = FALSE;
  		          address = get_alias_address(name, TRUE, &too_long);
  		          if (address != NULL) {
  		              while (TRUE) {
  	                          ClearScreen();
! 			          PutLine1(2,0, catgets(elm_msg_cat,
! 	                                  AliasesSet, AliasesAliasedFull,
! 					  "Aliased address for:\t%s\n\r"),
! 	                              name);
  		                  i = 4;
! 		                  while (i < LINES-2) {
  		                      if ((commap = index(address, (int)','))
  	                                          == NULL) {
  		                          PutLine0(i, 4, address);
--- 1061,1106 ----
  	    case 'F':
  	              if (current > 0) {
  		          clear_error();
! 		          strfcpy(name, aliases[current-1]->alias,
! 				  sizeof name);
  		          if (ch == 'F') {
! 			    int status;
! 			    
! 		              strfcpy(buffer, catgets(elm_msg_cat,
! 						      AliasesSet, 
! 						      AliasesFullyExpanded,
! 						      "Fully expand alias: "),
! 				      sizeof buffer);
! 		              PutLine0(elm_LINES-2,0, buffer);
  		              CleartoEOS();
! 		              status = optionally_enter(name, elm_LINES-2, 
! 					       strlen(buffer),
! 					       OE_REDRAW_MARK, sizeof name);
! 			      while (REDRAW_MARK == status) {
! 				PutLine0(elm_LINES-2,0, buffer);
! 				status = optionally_enter(name, elm_LINES-2, 
! 							  strlen(buffer),
! 							  OE_REDRAW_MARK|
! 							  OE_APPEND_CURRENT,
! 							  sizeof name);
! 				redraw++;
! 			      }
! 			      if (0 != status)
! 				break;
  		          }
+ 		      redraw2:
  	                  too_long = FALSE;
  		          address = get_alias_address(name, TRUE, &too_long);
  		          if (address != NULL) {
  		              while (TRUE) {
  	                          ClearScreen();
! 			          PutLineX(2,0, 
! 					   CATGETS(elm_msg_cat,
! 						   AliasesSet, AliasesAliasedFull,
! 						   "Aliased address for:\t%s\n\r"),
! 					   name);
  		                  i = 4;
! 		                  while (i < elm_LINES-2) {
  		                      if ((commap = index(address, (int)','))
  	                                          == NULL) {
  		                          PutLine0(i, 4, address);
***************
*** 1238,1247 ****
  		                      PutLine0(i++, 4, address);
  		                      address = commap+2;
  		                  }
! 	                          PutLine0(LINES-1, 0, catgets(elm_msg_cat,
  	                                  AliasesSet, AliasesPressReturn,
  					  "Press <return> to continue."));
! 			          (void) getchar();
  		                  if (commap == NULL) {
  			              redraw++;
  		                      break;
--- 1110,1122 ----
  		                      PutLine0(i++, 4, address);
  		                      address = commap+2;
  		                  }
! 	                          PutLine0(elm_LINES-1, 0, catgets(elm_msg_cat,
  	                                  AliasesSet, AliasesPressReturn,
  					  "Press <return> to continue."));
! 			          if (REDRAW_MARK == ReadCh(REDRAW_MARK)) {
! 				    redraw++;
! 				    goto redraw2;
! 				  }
  		                  if (commap == NULL) {
  			              redraw++;
  		                      break;
***************
*** 1249,1263 ****
  		              }
  		          }
  	                  else if (! too_long) {
! 			      error(catgets(elm_msg_cat,
! 	                              AliasesSet, AliasesNotFound,
! 				      "Not found."));
  		          }
  		      }
  	              else {
! 		          error(catgets(elm_msg_cat,
! 	                          AliasesSet, AliasesNoneToView,
! 				  "Warning: no aliases to view!"));
  		      }
  		      break;
  
--- 1124,1138 ----
  		              }
  		          }
  	                  else if (! too_long) {
! 			      lib_error(CATGETS(elm_msg_cat,
! 						AliasesSet, AliasesNotFound,
! 						"Not found."));
  		          }
  		      }
  	              else {
! 		          lib_error(CATGETS(elm_msg_cat,
! 					    AliasesSet, AliasesNoneToView,
! 					    "Warning: no aliases to view!"));
  		      }
  		      break;
  
***************
*** 1287,1298 ****
  	    show_current();
  	  else if (nufoot) {
  	    if (mini_menu) {
! 	      MoveCursor(LINES-7, 0);  
                CleartoEOS();
  	      show_alias_menu();
  	    }
  	    else {
! 	      MoveCursor(LINES-4, 0);
  	      CleartoEOS();
  	    }
  	    show_last_error();	/* for those operations that have to
--- 1162,1173 ----
  	    show_current();
  	  else if (nufoot) {
  	    if (mini_menu) {
! 	      MoveCursor(elm_LINES-7, 0);  
                CleartoEOS();
  	      show_alias_menu();
  	    }
  	    else {
! 	      MoveCursor(elm_LINES-4, 0);
  	      CleartoEOS();
  	    }
  	    show_last_error();	/* for those operations that have to
***************
*** 1317,1329 ****
  	char buffer[SLEN];
  
  
! 	error(catgets(elm_msg_cat, AliasesSet, AliasesUpdating,
! 		"Updating aliases..."));
  	if (sleepmsg > 0)
  		sleep(sleepmsg);
  
! 	sprintf(itextfile, "%s/%s", home, ALIAS_TEXT);
! 	sprintf(odatafile, "%s/%s", home, ALIAS_DATA);
  
  /*
   *	We need to unlimit everything since aliases are 
--- 1192,1204 ----
  	char buffer[SLEN];
  
  
! 	lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesUpdating,
! 			  "Updating aliases..."));
  	if (sleepmsg > 0)
  		sleep(sleepmsg);
  
! 	strfcpy(itextfile,user_text_file, sizeof itextfile);
! 	strfcpy(odatafile,user_data_file,sizeof odatafile);
  
  /*
   *	We need to unlimit everything since aliases are 
***************
*** 1333,1345 ****
  
  	na = do_newalias(itextfile, odatafile, TRUE, FALSE);
  	if (na >= 0) {
! 	    error1(catgets(elm_msg_cat, AliasesSet, AliasesReReading,
! 		  "Processed %d aliases.  Re-reading the database..."), na);
  	    if (sleepmsg > 0)
  		sleep(sleepmsg);
  	    open_alias_files(TRUE);
! 	    set_error(catgets(elm_msg_cat, AliasesSet, AliasesUpdatedOK,
! 		  "Aliases updated successfully."));
  	}
  }
  
--- 1208,1221 ----
  
  	na = do_newalias(itextfile, odatafile, TRUE, FALSE);
  	if (na >= 0) {
! 	    lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesReReading,
! 			      "Processed %d aliases.  Re-reading the database..."), 
! 		      na);
  	    if (sleepmsg > 0)
  		sleep(sleepmsg);
  	    open_alias_files(TRUE);
! 	    lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesUpdatedOK,
! 			      "Aliases updated successfully."));
  	}
  }
  
***************
*** 1363,1479 ****
  		alias_prompt = catgets(elm_msg_cat, AliasesSet, AliasesLongKey,
  			"Key you want help for: ");
  
! 	MoveCursor(LINES-3, 0);	CleartoEOS();
  
  	if (mini_menu) {
! 	  Centerline(LINES-3, catgets(elm_msg_cat, AliasesSet, AliasesKeyMenu,
   "Press the key you want help for, '?' for a key list, or '.' to exit help"));
  	}
  
  	lower_prompt(alias_prompt);
  
! 	while ((ch = ReadCh()) != '.') {
  	  switch(ch) {
! 	    case EOF : leave(0);
  	               break;
  	    case '?' : display_helpfile(ALIAS_HELP);	
  		       redraw++;
  		       return(redraw);
  
! 	    case '$': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpDollar,
! "$ = Force resynchronization of aliases, processing additions and deletions."));
  		      break;
  
! 	    case '/': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpSlash,
! 			"/ = Search for specified name or alias in list."));
  		      break;
  
  	    case RETURN:
  	    case LINE_FEED:
  	    case SPACE:
! 	    case 'v': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpv,
! 	    "v = View the address for the currently selected alias."));
  		      break;
  	
! 	    case 'a': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpa,
! 	    "a = Add (return) address of current message to alias database."));
  		      break;
  
! 	    case 'c': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpc,
! "c = Change current user alias, modifying alias database at next resync."));
  		      break;
  
! 	    case 'd': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpd,
! 	    "d = Mark the current alias for deletion from alias database."));
  		      break;
  
! 	    case ctrl('D'): error(catgets(elm_msg_cat, AliasesSet, AliasesHelpCtrlD,
! 	    "^D = Mark for deletion user aliases matching specified pattern."));
  		      break;
  
! 	    case 'e': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpe,
! 	    "e = Edit the alias text file directly (will run newalias)."));
  		      break;
  
! 	    case 'f': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpf,
! 		"f = Display fully expanded address of current alias."));
  		      break;
  
! 	    case 'l': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpl,
! 	    "l = Limit displayed aliases on the specified criteria."));
  		      break;
  
! 	    case ctrl('L'): error(catgets(elm_msg_cat, AliasesSet, AliasesHelpCtrlL,
! 		      "^L = Rewrite the screen."));
  	    	      break;
  
! 	    case 'm': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpm,
! 	    "m = Send mail to the current or tagged aliases."));
  		      break;
  
! 	    case 'n': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpn,
! "n = Add a new user alias, adding to alias database at next resync."));
  		      break;
  
  	    case 'r':
  	    case 'q':
! 	    case 'i': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpi,
! 		      "r,q,i = Return from alias menu (with prompting)."));
  	   	      break;
  		      
  	    case 'R':
  	    case 'Q':
! 	    case 'I': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpQ,
! 		      "R,Q,I = Return from alias menu (no prompting)."));
  	   	      break;
  		      
! 	    case 't': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpt,
! 		      "t = Tag current alias for further operations."));
  		      break;
  	
! 	    case 'T': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpT,
! 		      "T = Tag current alias and go to next alias."));
  		      break;
  	
! 	    case ctrl('T'): error(catgets(elm_msg_cat, AliasesSet, AliasesHelpCtrlT,
! 	    "^T = Tag aliases matching specified pattern."));
  		      break;
  
! 	    case 'u': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpu,
! 	    "u = Unmark the current alias for deletion from alias database."));
  		      break;
  
! 	    case ctrl('U'): error(catgets(elm_msg_cat, AliasesSet, AliasesHelpCtrlU,
! "^U = Mark for undeletion user aliases matching specified pattern."));
  		      break;
  
  	    case 'x':
! 	    case 'X': error(catgets(elm_msg_cat, AliasesSet, AliasesHelpX,
! 	    "x = Exit from alias menu, abandoning any pending deletions."));
  	   	      break;
  
! 	    default : error(catgets(elm_msg_cat, AliasesSet, AliasesHelpNoHelp,
! 			"That key isn't used in this section."));
  	   	      break;
  	  }
  	  lower_prompt(alias_prompt);
--- 1239,1365 ----
  		alias_prompt = catgets(elm_msg_cat, AliasesSet, AliasesLongKey,
  			"Key you want help for: ");
  
! 	MoveCursor(elm_LINES-3, 0);	CleartoEOS();
  
  	if (mini_menu) {
! 	  Centerline(elm_LINES-3, catgets(elm_msg_cat, AliasesSet, 
! 					  AliasesKeyMenu,
   "Press the key you want help for, '?' for a key list, or '.' to exit help"));
  	}
  
  	lower_prompt(alias_prompt);
  
! 	while ((ch = ReadCh(0|READCH_CURSOR)) != '.') {
  	  switch(ch) {
! 	  case EOF : leave(0);
  	               break;
+ 	  case HELP_MARK:
  	    case '?' : display_helpfile(ALIAS_HELP);	
  		       redraw++;
  		       return(redraw);
  
! 	    case '$': lib_error(CATGETS(elm_msg_cat, AliasesSet, 
! 					AliasesHelpDollar,
! 					"$ = Force resynchronization of aliases, processing additions and deletions."));
  		      break;
  
! 	  case FIND_MARK:
! 	    case '/': lib_error(CATGETS(elm_msg_cat, AliasesSet, 
! 					AliasesHelpSlash,
! 					"/ = Search for specified name or alias in list."));
  		      break;
  
  	    case RETURN:
  	    case LINE_FEED:
  	    case SPACE:
! 	    case 'v': lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpv,
! 					"v = View the address for the currently selected alias."));
  		      break;
  	
! 	    case 'a':lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpa,
! 				       "a = Add (return) address of current message to alias database."));
  		      break;
  
! 	    case 'c': lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpc,
! 					"c = Change current user alias, modifying alias database at next resync."));
  		      break;
  
! 	    case 'd': lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpd,
! 					"d = Mark the current alias for deletion from alias database."));
  		      break;
  
! 	    case ctrl('D'): lib_error(CATGETS(elm_msg_cat, AliasesSet, 
! 					      AliasesHelpCtrlD,
! 					      "^D = Mark for deletion user aliases matching specified pattern."));
  		      break;
  
! 	    case 'e': lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpe,
! 					"e = Edit the alias text file directly (will run newalias)."));
  		      break;
  
! 	    case 'f': lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpf,
! 					"f = Display fully expanded address of current alias."));
  		      break;
  
! 	    case 'l': lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpl,
! 					"l = Limit displayed aliases on the specified criteria."));
  		      break;
  
! 	    case ctrl('L'): lib_error(CATGETS(elm_msg_cat, AliasesSet, 
! 					      AliasesHelpCtrlL,
! 					      "^L = Rewrite the screen."));
  	    	      break;
  
! 	    case 'm': lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpm,
! 					"m = Send mail to the current or tagged aliases."));
  		      break;
  
! 	    case 'n': lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpn,
! 					"n = Add a new user alias, adding to alias database at next resync."));
  		      break;
  
  	    case 'r':
  	    case 'q':
! 	    case 'i': lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpi,
! 					"r,q,i = Return from alias menu (with prompting)."));
  	   	      break;
  		      
  	    case 'R':
  	    case 'Q':
! 	    case 'I': lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpQ,
! 					"R,Q,I = Return from alias menu (no prompting)."));
  	   	      break;
  		      
! 	    case 't': lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpt,
! 					"t = Tag current alias for further operations."));
  		      break;
  	
! 	    case 'T': lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpT,
! 					"T = Tag current alias and go to next alias."));
  		      break;
  	
! 	    case ctrl('T'): lib_error(CATGETS(elm_msg_cat, AliasesSet, 
! 					      AliasesHelpCtrlT,
! 					      "^T = Tag aliases matching specified pattern."));
  		      break;
  
! 	    case 'u': lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpu,
! 					"u = Unmark the current alias for deletion from alias database."));
  		      break;
  
! 	    case ctrl('U'): lib_error(CATGETS(elm_msg_cat, AliasesSet, 
! 					      AliasesHelpCtrlU,
! 					      "^U = Mark for undeletion user aliases matching specified pattern."));
  		      break;
  
  	    case 'x':
! 	    case 'X': lib_error(CATGETS(elm_msg_cat, AliasesSet, AliasesHelpX,
! 					"x = Exit from alias menu, abandoning any pending deletions."));
  	   	      break;
  
! 	    default : lib_error(CATGETS(elm_msg_cat, AliasesSet, 
! 					AliasesHelpNoHelp,
! 					"That key isn't used in this section."));
  	   	      break;
  	  }
  	  lower_prompt(alias_prompt);
***************
*** 1480,1486 ****
  	}
  
  	/* Remove help lines */
! 	MoveCursor(LINES-3, 0);	CleartoEOS();
  	return(redraw);
  }
  
--- 1366,1372 ----
  	}
  
  	/* Remove help lines */
! 	MoveCursor(elm_LINES-3, 0);	CleartoEOS();
  	return(redraw);
  }
  
***************
*** 1623,1633 ****
  	    selected = main_selected;
  	    header_page = main_page;
  
! 	    strcpy(item, catgets(elm_msg_cat, ElmSet, Elmitem, "message"));
! 	    strcpy(items, catgets(elm_msg_cat, ElmSet, Elmitems, "messages"));
! 	    strcpy(Item, catgets(elm_msg_cat, ElmSet, ElmItem, "Message"));
! 	    strcpy(Items, catgets(elm_msg_cat, ElmSet, ElmItems, "Messages"));
! 	    strcpy(Prompt, catgets(elm_msg_cat, ElmSet, ElmPrompt, "Command: "));
  
  	    dprint(3, (debugfile, "Leaving alias mode\n"));
  	    inalias = FALSE;
--- 1509,1525 ----
  	    selected = main_selected;
  	    header_page = main_page;
  
! 	    strfcpy(item, catgets(elm_msg_cat, ElmSet, Elmitem, "message"),
! 		    sizeof item);
! 	    strfcpy(items, catgets(elm_msg_cat, ElmSet, Elmitems, "messages"),
! 		    sizeof items);
! 	    strfcpy(Item, catgets(elm_msg_cat, ElmSet, ElmItem, "Message"),
! 		    sizeof Item);
! 	    strfcpy(Items, catgets(elm_msg_cat, ElmSet, ElmItems, "Messages"),
! 		    sizeof Items);
! 	    strfcpy(Prompt, catgets(elm_msg_cat, ElmSet, ElmPrompt, 
! 				    "Command: "),
! 		    sizeof Prompt);
  
  	    dprint(3, (debugfile, "Leaving alias mode\n"));
  	    inalias = FALSE;
***************
*** 1646,1656 ****
  	    selected = alias_selected;
  	    header_page = alias_page;
  
! 	    strcpy(item, catgets(elm_msg_cat, AliasesSet, Aliasesitem, "alias"));
! 	    strcpy(items, catgets(elm_msg_cat, AliasesSet, Aliasesitems, "aliases"));
! 	    strcpy(Item, catgets(elm_msg_cat, AliasesSet, AliasesItem, "Alias"));
! 	    strcpy(Items, catgets(elm_msg_cat, AliasesSet, AliasesItems, "Aliases"));
! 	    strcpy(Prompt, catgets(elm_msg_cat, AliasesSet, AliasesPrompt, "Alias: "));
  
  	    dprint(3, (debugfile, "Entered alias mode\n"));
  	    inalias = TRUE;
--- 1538,1558 ----
  	    selected = alias_selected;
  	    header_page = alias_page;
  
! 	    strfcpy(item, catgets(elm_msg_cat, AliasesSet, Aliasesitem, 
! 				  "alias"),
! 		    sizeof item);
! 	    strfcpy(items, catgets(elm_msg_cat, AliasesSet, Aliasesitems, 
! 				   "aliases"),
! 		    sizeof items);
! 	    strfcpy(Item, catgets(elm_msg_cat, AliasesSet, AliasesItem, 
! 				  "Alias"),
! 		    sizeof Item);
! 	    strfcpy(Items, catgets(elm_msg_cat, AliasesSet, AliasesItems, 
! 				   "Aliases"),
! 		    sizeof Items);
! 	    strfcpy(Prompt, catgets(elm_msg_cat, AliasesSet, AliasesPrompt, 
! 				    "Alias: "),
! 		    sizeof Prompt);
  
  	    dprint(3, (debugfile, "Entered alias mode\n"));
  	    inalias = TRUE;
***************
*** 1657,1665 ****
  	}
  }
  
! int
! parse_aliases(buffer, remainder)
! char *buffer, *remainder;
  {
  /*
   *	This routine will parse out the individual aliases present
--- 1559,1567 ----
  	}
  }
  
! static int parse_aliases(buffer, remainder, size_buffer, size_remainder)
!      char *buffer, *remainder;
!      int size_buffer, size_remainder;
  {
  /*
   *	This routine will parse out the individual aliases present
***************
*** 1681,1701 ****
  
  /*	Check to see if an alias */
  
! 	if ((s = index(buffer, (int)'=')) == NULL)
  	  return (0);
  
! 	strcpy(remainder, s);		/* Save the remainder of the line */
  
  /*	Terminate the list of aliases with a ',' */
  
  	while (--s >= buffer && whitespace(*s)) ;
! 	*++s = ',';
! 	*++s = '\0';
  
  /*	Lowercase everything */
  
  	s = shift_lower(buffer);
! 	strcpy(buffer, s);
  
  /*	Now, count the aliases */
  
--- 1583,1606 ----
  
  /*	Check to see if an alias */
  
! 	if ((s = index(buffer, '=')) == NULL)
  	  return (0);
  
! 	/* Save the remainder of the line */
! 	strfcpy(remainder, s, size_remainder);		
  
  /*	Terminate the list of aliases with a ',' */
  
  	while (--s >= buffer && whitespace(*s)) ;
! 	if (s < buffer + size_buffer -2) {
! 	  *++s = ',';
! 	  *++s = '\0';
! 	}
  
  /*	Lowercase everything */
  
  	s = shift_lower(buffer);
! 	strfcpy(buffer, s, size_buffer);
  
  /*	Now, count the aliases */
  
***************
*** 1707,1716 ****
  	return (number);
  }
  
! int
! get_aliasname(aliasname, buffer, duplicate)
! char *aliasname, *buffer;
! int *duplicate;
  {
  
  /*
--- 1612,1621 ----
  	return (number);
  }
  
! static int get_aliasname(aliasname, buffer, duplicate, size, buffer_size)
!      char *aliasname, *buffer;
!      int *duplicate;
!      int size, buffer_size;
  {
  
  /*
***************
*** 1730,1746 ****
   *		that the user has chosen to replace.  In this
   *		case the alias to replace is passed back in
   *		in the variable 'duplicate'.
   */
  
  	int loc;
  
  	do {
! 	    optionally_enter(aliasname, LINES-2, strlen(buffer), FALSE, FALSE);
  	/*
  	 *  Return if nothing was entered.
  	 */
! 	    if (strlen(aliasname) == 0) 
! 	        return(-1);
  
  	} while (check_alias(aliasname) == -1);
  
--- 1635,1659 ----
   *		that the user has chosen to replace.  In this
   *		case the alias to replace is passed back in
   *		in the variable 'duplicate'.
+  *
+  *   REDRAW_MARK
   */
  
  	int loc;
  
  	do {
! 	  int status =
! 	    optionally_enter(aliasname, elm_LINES-2, strlen(buffer), 
! 			     OE_REDRAW_MARK, size);
! 
! 	  if (REDRAW_MARK == status)
! 	    return REDRAW_MARK;
! 
  	/*
  	 *  Return if nothing was entered.
  	 */
! 	  if (0 != status || strlen(aliasname) == 0) 
! 	    return(-1);
  
  	} while (check_alias(aliasname) == -1);
  
***************
*** 1753,1775 ****
  	         "Attempt to add a duplicate alias [%s] in get_aliasname\n",
  	         aliases[loc]->alias)); 
  	    if (aliases[loc]->type & GROUP )
! 	        PutLine1(LINES-2,0, catgets(elm_msg_cat,
! 	                AliasesSet, AliasesAlreadyGroup,
! 	                "Already a group with name %s."), aliases[loc]->alias);
  	    else
! 	        PutLine1(LINES-2,0, catgets(elm_msg_cat,
! 	                AliasesSet, AliasesAlreadyAlias,
! 	                "Already an alias for %s."), aliases[loc]->alias);
  	    CleartoEOLN();
! 	    MCsprintf(buffer, catgets(elm_msg_cat,
! 	            AliasesSet, AliasesReplaceExisting,
! 	            "Replace existing alias? (%c/%c) "),
! 	        *def_ans_yes, *def_ans_no);
  	 /*
  	  * If they don't want to replace the alias by that name
  	  * then just return.
  	  */
! 	    if (want_to(buffer, *def_ans_no, LINES-3, 0) != *def_ans_yes)
  	        return(-1);
  	    *duplicate = loc;
  	    return(1);
--- 1666,1693 ----
  	         "Attempt to add a duplicate alias [%s] in get_aliasname\n",
  	         aliases[loc]->alias)); 
  	    if (aliases[loc]->type & GROUP )
! 	        PutLineX(elm_LINES-2,0, 
! 			 CATGETS(elm_msg_cat,
! 				 AliasesSet, AliasesAlreadyGroup,
! 				 "Already a group with name %s."), 
! 			 aliases[loc]->alias);
  	    else
! 	        PutLineX(elm_LINES-2,0, 
! 			 CATGETS(elm_msg_cat,
! 				 AliasesSet, AliasesAlreadyAlias,
! 				 "Already an alias for %s."), 
! 			 aliases[loc]->alias);
  	    CleartoEOLN();
! 	    elm_sfprintf(buffer, buffer_size,
! 			 CATGETS(elm_msg_cat,
! 				 AliasesSet, AliasesReplaceExisting,
! 				 "Replace existing alias? (%c/%c) "),
! 			 *def_ans_yes, *def_ans_no);
  	 /*
  	  * If they don't want to replace the alias by that name
  	  * then just return.
  	  */
! 	    if (want_to(buffer, *def_ans_no, elm_LINES-3, 0) != *def_ans_yes)
  	        return(-1);
  	    *duplicate = loc;
  	    return(1);
***************
*** 1787,1793 ****
  	      "Attempt to add a duplicate system alias [%s] in get_aliasname\n",
  	      aliases[loc]->address)); 
  	  
! 	    if( ! superceed_system(loc, buffer))
  	        return(-1);
  	}
  	return(0);
--- 1705,1711 ----
  	      "Attempt to add a duplicate system alias [%s] in get_aliasname\n",
  	      aliases[loc]->address)); 
  	  
! 	    if( ! superceed_system(loc, buffer, buffer_size))
  	        return(-1);
  	}
  	return(0);
***************
*** 1794,1857 ****
  
  }
  
! int
! superceed_system(this_alias, buffer)
! int this_alias;
! char *buffer;
  {
  
! 	PutLine2(LINES-2, 0, catgets(elm_msg_cat,
! 	        AliasesSet, AliasesSystemAlias, "System (%6s) alias for %s."),
! 	    alias_type(aliases[this_alias]->type), aliases[this_alias]->alias);
! 
! 	MCsprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesSuperceed,
! 	        "Superceed? (%c/%c) "), *def_ans_yes, *def_ans_no);
  /*
   *	If they don't want to superceed the SYSTEM alias then
   *	return a FALSE.
   */
! 	return(want_to(buffer, *def_ans_no, LINES-3, 0) == *def_ans_yes);
  }
  
! void
! get_realnames(aliasname, firstname, lastname, comment, buffer)
! char *aliasname, *firstname, *lastname, *comment, *buffer;
  {
! 
! 	sprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesEnterLastName,
! 		"Enter last name for %s: "), aliasname);
! 	PutLine0(LINES-2,0, buffer);
  	CleartoEOLN();
! 	optionally_enter(lastname, LINES-2, strlen(buffer), FALSE, FALSE);
  
! 	sprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesEnterFirstName,
! 		"Enter first name for %s: "), aliasname);
! 	PutLine0(LINES-2,0, buffer);
  	CleartoEOLN();
! 	optionally_enter(firstname, LINES-2, strlen(buffer), FALSE, FALSE);
  
  	if (strlen(lastname) == 0) {
! 	    if (strlen(firstname) == 0) {
! 	        strcpy(lastname, aliasname);  
! 	    }
! 	    else {
! 	        strcpy(lastname, firstname);  
! 	        *firstname = '\0';
! 	    }
  	}
  
! 	sprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesEnterComment,
! 		"Enter optional comment for %s: "), aliasname);
! 	PutLine0(LINES-2,0, buffer);
! 	optionally_enter(comment, LINES-2, strlen(buffer), FALSE, FALSE);
  
  }
  
! int
! ask_accept(aliasname, firstname, lastname, comment, address, buffer,
! 	replace, replacement)
! char *aliasname, *firstname, *lastname, *comment, *address, *buffer;
! int replace, replacement;
  {
  
  	char ch;
--- 1712,1801 ----
  
  }
  
! static int
! superceed_system(this_alias, buffer, buffer_size)
!      int this_alias;
!      char *buffer;
!      int buffer_size;
  {
  
! 	PutLineX(elm_LINES-2, 0, 
! 		 CATGETS(elm_msg_cat,
! 			 AliasesSet, AliasesSystemAlias, 
! 			 "System (%6s) alias for %s."),
! 		 alias_type(aliases[this_alias]->type), 
! 		 aliases[this_alias]->alias);
! 
!         elm_sfprintf(buffer, buffer_size,
! 		     CATGETS(elm_msg_cat, AliasesSet, AliasesSuperceed,
! 			     "Superceed? (%c/%c) "), *def_ans_yes, *def_ans_no);
  /*
   *	If they don't want to superceed the SYSTEM alias then
   *	return a FALSE.
   */
! 	return(want_to(buffer, *def_ans_no, elm_LINES-3, 0) == *def_ans_yes);
  }
  
! static void get_realnames(aliasname, firstname, lastname, comment, buffer,
! 		   size_first, size_last, size_comment, size_buffer)
!      char *aliasname, *firstname, *lastname, *comment, *buffer;
!      int size_first, size_last, size_comment, size_buffer;
  {
!   int status;
! 	
!   elm_sfprintf(buffer, size_buffer,
! 	       CATGETS(elm_msg_cat, AliasesSet, AliasesEnterLastName,
! 		       "Enter last name for %s: "), aliasname);
! 	PutLine0(elm_LINES-2,0, buffer);
  	CleartoEOLN();
! 	status = optionally_enter(lastname, elm_LINES-2, strlen(buffer),
! 				  OE_REDRAW_MARK, size_last);
! 	while (REDRAW_MARK == status) {
! 	  PutLine0(elm_LINES-2,0, buffer);
! 	  status = optionally_enter(lastname, elm_LINES-2, strlen(buffer),
! 				    OE_REDRAW_MARK|OE_APPEND_CURRENT,
! 				    size_last);
! 	}
  
! 	elm_sfprintf(buffer, size_buffer,
! 		     CATGETS(elm_msg_cat, AliasesSet, AliasesEnterFirstName,
! 			     "Enter first name for %s: "), aliasname);
! 	PutLine0(elm_LINES-2,0, buffer);
  	CleartoEOLN();
! 	status = optionally_enter(firstname, elm_LINES-2, strlen(buffer), 
! 				  OE_REDRAW_MARK, size_first);
! 	while (REDRAW_MARK == status) {
! 	  PutLine0(elm_LINES-2,0, buffer);
! 	  status = optionally_enter(firstname, elm_LINES-2, strlen(buffer), 
! 				    OE_REDRAW_MARK|OE_APPEND_CURRENT,
! 				    size_first);
! 	}
  
  	if (strlen(lastname) == 0) {
! 	    strfcpy(lastname, firstname, size_last);  
! 	    *firstname = '\0';
  	}
  
! 	elm_sfprintf(buffer, size_buffer,
! 		     CATGETS(elm_msg_cat, AliasesSet, AliasesEnterComment,
! 			     "Enter optional comment for %s: "), aliasname);
! 	PutLine0(elm_LINES-2,0, buffer);
! 	status = optionally_enter(comment, elm_LINES-2, strlen(buffer), 
! 				  OE_REDRAW_MARK, size_comment);
! 	while (status == REDRAW_MARK) {
! 	  PutLine0(elm_LINES-2,0, buffer);
! 	  status = optionally_enter(comment, elm_LINES-2, strlen(buffer), 
! 				    OE_REDRAW_MARK|OE_APPEND_CURRENT,
! 				    size_comment);
! 	}
  
  }
  
! static int ask_accept(aliasname, firstname, lastname, comment, address, buffer,
! 	       replace, replacement, size_buffer)
!      char *aliasname, *firstname, *lastname, *comment, *address, *buffer;
!      int replace, replacement;
!      int size_buffer;
  {
  
  	char ch;
***************
*** 1865,1885 ****
  	    *firstname = '\0';
  	}
  
! 	if (strlen(firstname) == 0) {
! 	    strcpy(buffer, lastname);  
! 	}
  	else {
! 	    sprintf(buffer, "%s %s", firstname, lastname);
  	}
- 	PutLine2(LINES-1,0, catgets(elm_msg_cat, AliasesSet, AliasesAddressAs,
- 	        "Messages addressed as: %s (%s)"), address, buffer);
  	if (strlen(comment) != 0) {
! 	    strcat(buffer, ", ");
! 	    strcat(buffer, comment);
  	}
  
! 	PutLine2(LINES-2,0, catgets(elm_msg_cat, AliasesSet, AliasesAddressTo,
! 	        "New alias: %s is '%s'."), aliasname, buffer);
  	CleartoEOLN();
  /*
   *	Kludge Alert:  Spaces are padded to the front of the prompt
--- 1809,1843 ----
  	    *firstname = '\0';
  	}
  
! 	if (strlen(lastname) == 0)
! 	  PutLineX(elm_LINES-1,0, CATGETS(elm_msg_cat, AliasesSet, 
! 					  AliasesAddressAs1,
! 					  "Messages addressed as: %s"), 
! 		   address);
  	else {
! 	  if (strlen(firstname) == 0) {
! 	      strfcpy(buffer, lastname, size_buffer);  
! 	  }
! 	  else {
! 	      elm_sfprintf(buffer, size_buffer,
! 			   FRM("%s %s"), firstname, lastname);
! 	  }
! 	  PutLineX(elm_LINES-1,0, 
! 		   CATGETS(elm_msg_cat, AliasesSet, 
! 			   AliasesAddressAs,
! 			   "Messages addressed as: %s (%s)"), 
! 		   address, buffer);
  	}
  	if (strlen(comment) != 0) {
! 	    strfcat(buffer, ", ", size_buffer);
! 	    strfcat(buffer, comment, size_buffer);
  	}
  
! 	PutLineX(elm_LINES-2,0, 
! 		 CATGETS(elm_msg_cat, AliasesSet, 
! 			 AliasesAddressTo,
! 			 "New alias: %s is '%s'."), 
! 		 aliasname, buffer);
  	CleartoEOLN();
  /*
   *	Kludge Alert:  Spaces are padded to the front of the prompt
***************
*** 1886,1894 ****
   *	to write over the previous question.  Should probably record
   *	the end of the line, move to it, and CleartoEOLN() it.
   */
! 	MCsprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesAcceptNew,
! 		"      Accept new alias? (%c/%c) "), *def_ans_yes, *def_ans_no);
! 	if((ch = want_to(buffer, *def_ans_yes, LINES-3, 0)) == *def_ans_yes) {
  	    if (replace) {
  	        old_alias[0] = aliases[replacement]->alias;
  	    /*
--- 1844,1854 ----
   *	to write over the previous question.  Should probably record
   *	the end of the line, move to it, and CleartoEOLN() it.
   */
! 	elm_sfprintf(buffer, size_buffer,
! 		    CATGETS(elm_msg_cat, AliasesSet, AliasesAcceptNew,
! 			    "      Accept new alias? (%c/%c) "), 
! 		     *def_ans_yes, *def_ans_no);
! 	if((ch = want_to(buffer, *def_ans_yes, elm_LINES-3, 0)) == *def_ans_yes) {
  	    if (replace) {
  	        old_alias[0] = aliases[replacement]->alias;
  	    /*
***************
*** 1922,1929 ****
  	    }
  	    add_to_alias_text(aliasname, firstname, lastname, comment, address);
  	}
! 	ClearLine(LINES-2);
! 	ClearLine(LINES-1);
  	return(ch == *def_ans_yes ? 1 : 0);
  
  }
--- 1882,1889 ----
  	    }
  	    add_to_alias_text(aliasname, firstname, lastname, comment, address);
  	}
! 	ClearLine(elm_LINES-2);
! 	ClearLine(elm_LINES-1);
  	return(ch == *def_ans_yes ? 1 : 0);
  
  }
Index: elm2.4.ME+.50/src/aliaslib.c
*** elm2.4.25/src/aliaslib.c	Tue Aug  3 22:29:01 1993
--- elm2.4.ME+.50/src/aliaslib.c	Tue Nov 17 21:12:57 1998
***************
*** 1,80 ****
  
! static char rcsid[] = "@(#)$Id: aliaslib.c,v 5.10 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: aliaslib.c,v $
!  * Revision 5.10  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.9  1993/05/31  19:39:43  syd
!  * Elm either failed to expand a group alias or crashed in strlen
!  * (called from do_expand_group()).
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.8  1993/05/14  03:53:46  syd
!  * Fix wrong message being displayed and then overwritten
!  * for long aliases.
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.7  1993/05/08  17:03:16  syd
!  * If there are local user names (account names) in the alias, they don't
!  * get fully expanded with a GCOS field like they do when you type an
!  * account name on the To line.
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.6  1993/04/12  01:10:15  syd
!  * fix @aliasname sort problem
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.5  1993/02/07  15:13:13  syd
!  * remove extra declaration of lseek, now in hdrs/defs.h
!  * From: Syd
!  *
!  * Revision 5.4  1993/01/20  03:02:19  syd
!  * Move string declarations to defs.h
!  * From: Syd
!  *
!  * Revision 5.3  1992/12/12  01:28:24  syd
!  * in do_get_alias().  abuf[] was under dimensioned.
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.2  1992/10/11  01:21:17  syd
!  * 1. If firstname && lastname is null then copy aliasname into the
!  * personal name field (inside the ()'s) when creating an alias
!  * from the menu using the 'n' command.
!  *
!  * 2. Now if for some reason and alias has a null personal name field
!  * (the person hand edited aliases.text) the blank () is not printed
!  * as part of the address.  This actually cured another problem, where
!  * the To: field on the screen (when you hit 'm' on the alias menu)
!  * used to be blank, now the address shows up....
!  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
!  *
!  * Revision 5.1  1992/10/03  22:58:40  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** Library of functions dealing with the alias system...
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: aliaslib.c,v 1.2 1998/10/20 19:58:15 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** Library of functions dealing with the alias system...
  
***************
*** 171,180 ****
  	if ( !sysalias ) {
  	  if ( (loc = find_alias(name, USER)) >= 0 ) {
  	    match = aliases[loc];
! 	    strcpy(abuf, match->address);
  	    if ( match->type & PERSON ) {
  	      if (strlen(match->name) > 0) {
!                 sprintf(abuf+strlen(abuf), " (%s)", match->name);
  	      }
  	    }
  	    goto do_expand;
--- 107,117 ----
  	if ( !sysalias ) {
  	  if ( (loc = find_alias(name, USER)) >= 0 ) {
  	    match = aliases[loc];
! 	    strfcpy(abuf, match->address, sizeof abuf);
  	    if ( match->type & PERSON ) {
  	      if (strlen(match->name) > 0) {
!                 elm_sfprintf(abuf+strlen(abuf),  sizeof abuf -strlen(abuf),
! 			     FRM(" (%s)"), match->name);
  	      }
  	    }
  	    goto do_expand;
***************
*** 184,193 ****
  	/* check for a system alias */
  	  if ( (loc = find_alias(name, SYSTEM)) >= 0 ) {
  	    match = aliases[loc];
! 	    strcpy(abuf, match->address);
  	    if ( match->type & PERSON ) {
  	      if (strlen(match->name) > 0) {
!                 sprintf(abuf+strlen(abuf), " (%s)", match->name);
  	      }
  	    }
  	    sysalias = TRUE;
--- 121,131 ----
  	/* check for a system alias */
  	  if ( (loc = find_alias(name, SYSTEM)) >= 0 ) {
  	    match = aliases[loc];
! 	    strfcpy(abuf, match->address, sizeof abuf);
  	    if ( match->type & PERSON ) {
  	      if (strlen(match->name) > 0) {
!                 elm_sfprintf(abuf+strlen(abuf), sizeof abuf -strlen(abuf),
! 			     FRM(" (%s)"), match->name);
  	      }
  	    }
  	    sysalias = TRUE;
***************
*** 221,229 ****
  	if ( depth > 12 ) {
  	  dprint(2, (debugfile,
  	      "alias expansion loop detected at \"%s\" - bailing out\n", name));
! 	    error1(catgets(elm_msg_cat, ElmSet, ElmErrorExpanding,
! 		"Error expanding \"%s\" - probable alias definition loop."),
! 		name);
  	    return FALSE;
  	}
  
--- 159,167 ----
  	if ( depth > 12 ) {
  	  dprint(2, (debugfile,
  	      "alias expansion loop detected at \"%s\" - bailing out\n", name));
! 	    lib_error(CATGETS(elm_msg_cat, ElmSet, ElmErrorExpanding,
! 			      "Error expanding \"%s\" - probable alias definition loop."),
! 		      name);
  	    return FALSE;
  	}
  
***************
*** 298,304 ****
  	    gecos = get_full_name(name);
  
  	    if (gecos && (strlen(gecos) > 0)) {
! 	        sprintf(expanded_address, "%s (%s)", name, gecos);
  	        name = expanded_address;
  	    }
  	  }
--- 236,243 ----
  	    gecos = get_full_name(name);
  
  	    if (gecos && (strlen(gecos) > 0)) {
! 	        elm_sfprintf(expanded_address, sizeof expanded_address,
! 			     FRM("%s (%s)"), name, gecos);
  	        name = expanded_address;
  	    }
  	  }
***************
*** 334,341 ****
  	    *bufsizep = -1;
  	    dprint(2, (debugfile,
  		"Alias expansion is too long in add_name_to_list()\n"));
! 	    error(catgets(elm_msg_cat, ElmSet, ElmAliasExpTooLong,
! 		"Alias expansion is too long."));
  	    return FALSE;
  	}
  
--- 273,280 ----
  	    *bufsizep = -1;
  	    dprint(2, (debugfile,
  		"Alias expansion is too long in add_name_to_list()\n"));
! 	    lib_error(CATGETS(elm_msg_cat, ElmSet, ElmAliasExpTooLong,
! 			      "Alias expansion is too long."));
  	    return FALSE;
  	}
  
Index: elm2.4.ME+.50/src/args.c
*** elm2.4.25/src/args.c	Mon Apr 12 06:35:24 1993
--- elm2.4.ME+.50/src/args.c	Tue Nov 17 21:14:09 1998
***************
*** 1,54 ****
  
! static char rcsid[] = "@(#)$Id: args.c,v 5.9 1993/04/12 03:35:08 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.9 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: args.c,v $
!  * Revision 5.9  1993/04/12  03:35:08  syd
!  * No tite for elm -z
!  * From: Syd
!  *
!  * Revision 5.8  1993/02/03  19:06:31  syd
!  * Remove extra strchr/strcat/strcpy et al declarations
!  * From: Syd
!  *
!  * Revision 5.7  1993/01/20  03:37:16  syd
!  * Nits and typos in the NLS messages and corresponding default messages.
!  * From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
!  *
!  * Revision 5.6  1992/10/30  21:12:40  syd
!  * Make patchlevel a text string to allow local additions to the variable
!  * From: syd via a request from Dave Wolfe
!  *
!  * Revision 5.5  1992/10/27  01:37:29  syd
!  * add usetite clear to -c mode
!  *
!  * Revision 5.4  1992/10/24  13:35:39  syd
!  * changes found by using codecenter on Elm 2.4.3
!  * From: Graham Hudspith <gwh@inmos.co.uk>
!  *
!  * Revision 5.3  1992/10/17  23:09:10  syd
!  * fix position of t arg
!  *
!  * Revision 5.2  1992/10/17  22:58:57  syd
!  * patch to make elm use (or in my case, not use) termcap/terminfo ti/te.
!  * From: Graham Hudspith <gwh@inmos.co.uk>
!  *
!  * Revision 5.1  1992/10/03  22:58:40  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** starting argument parsing routines for ELM system...
  
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: args.c,v 1.5 1998/11/17 07:33:17 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.5 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** starting argument parsing routines for ELM system...
  
***************
*** 57,70 ****
  #include "headers.h"
  #include "patchlevel.h"
  #include "s_elm.h"
  
  extern char *optarg;		/* optional argument as we go */
  extern int   optind;			/* argnum + 1 when we leave   */
  
! char *
! parse_arguments(argc, argv, to_whom)
! int argc;
! char *argv[], *to_whom;
  {
  	/** Set flags according to what was given to program.  If we are 
  	    fed a name or series of names, put them into the 'to_whom' buffer
--- 19,37 ----
  #include "headers.h"
  #include "patchlevel.h"
  #include "s_elm.h"
+ #include "me.h"
  
  extern char *optarg;		/* optional argument as we go */
  extern int   optind;			/* argnum + 1 when we leave   */
  
! 
! static void args_version P_((int i));
! 
! char * parse_arguments(argc, argv, to_whom, size_r, size)
!      int argc;
!      char *argv[], *to_whom;
!      int *size_r;
!      int size;
  {
  	/** Set flags according to what was given to program.  If we are 
  	    fed a name or series of names, put them into the 'to_whom' buffer
***************
*** 74,105 ****
  	    **/
  
  	register int c = 0;
  	static char req_mfile[SLEN];
  
  	to_whom[0] = '\0';
  	batch_subject[0] = '\0';
  	included_file[0] = '\0';
  
!         while ((c = getopt(argc, argv, "?acd:f:hi:kKms:tVvz")) != EOF) {
! 	   switch (c) {
! 	     case 'a' : arrow_cursor++;		break;
! 	     case 'c' : check_only++; use_tite = 0;	break;
! 	     case 'd' : debug = atoi(optarg);	break;
! 	     case 'f' : strcpy(req_mfile, optarg);	break;
! 	     case '?' :
! 	     case 'h' : args_help();
! 	     case 'i' : strcpy(included_file, optarg);	break;
! 	     case 'k' : hp_terminal++;	break;
! 	     case 'K' : hp_terminal++; hp_softkeys++;	break;
! 	     case 'm' : mini_menu = 0;	break;
! 	     case 's' : strcpy(batch_subject, optarg);	break;
! 	     case 't' : use_tite = 0;	break;
!              case 'V' : sendmail_verbose++;     break;
! 	     case 'v' : args_version();
! 	     case 'z' : check_size++; use_tite = 0;   break;
! 	    }
! 	 }
  
  
  #ifndef DEBUG
  	if (debug)
--- 41,87 ----
  	    **/
  
  	register int c = 0;
+ 	int v = 0;
  	static char req_mfile[SLEN];
  
+ 	*size_r = sizeof req_mfile;
+ 
  	to_whom[0] = '\0';
  	batch_subject[0] = '\0';
  	included_file[0] = '\0';
  
!         while ((c = getopt(argc, argv, "?aA:cd:f:hi:kKms:tVvwz")) != EOF) {
! 	  switch (c) {
! 	  case 'a' : arrow_cursor++;		break;
! #ifdef MIME
! 	  case 'A' : 
! 	    if(!Attach_it(optarg)) exit(1);
! 	    break;
! #endif 
! 	  case 'c' : check_only++; use_tite = 0;	break;
! 	  case 'd' : debug = atoi(optarg);	break;
! 	  case 'f' : strfcpy(req_mfile, optarg,sizeof req_mfile);	
! 	    break;
! 	  case '?' :
! 	  case 'h' : args_help();
! 	  case 'i' : strfcpy(included_file, optarg, sizeof included_file);  
! 	    break;
! 	       /* case 'k' : hp_terminal++;	break;
! 		  case 'K' : hp_terminal++; hp_softkeys++;	break;
! 		  */
! 	  case 'm' : mini_menu = 0;	break;
! 	  case 's' : strfcpy(batch_subject, optarg, sizeof batch_subject);
! 	    break;
! 	  case 't' : use_tite = 0;	break;
! 	  case 'V' : sendmail_verbose++;     break;
! 	  case 'v' : v++; break;
! 	  case 'w' : write_elmrc++; break;
! 	  case 'z' : check_size++; use_tite = 0;   break;
! 	  }
! 	}
  
+ 	if (v)
+ 	  args_version(v);
  
  #ifndef DEBUG
  	if (debug)
***************
*** 110,122 ****
  
  	if (optind < argc) {
  	  while (optind < argc) {
! 		if (strlen(to_whom) + strlen(to_whom[0] != '\0'? " " : "") +
  			strlen(argv[optind]) > SLEN)
  				exit(printf(catgets(elm_msg_cat, ElmSet, ElmArgsTooManyAddresses,
  					"\n\rToo many addresses, or addresses too long!\n\r")));
  
! 	    sprintf(to_whom, "%s%s%s", to_whom, 
! 	            to_whom[0] != '\0'? " " : "", argv[optind]);
  	    if(!check_only)
  	      mail_only++;
  	    optind++;
--- 92,105 ----
  
  	if (optind < argc) {
  	  while (optind < argc) {
! 		if (strlen(to_whom) + strlen(to_whom[0] != '\0'? "," : "") +
  			strlen(argv[optind]) > SLEN)
  				exit(printf(catgets(elm_msg_cat, ElmSet, ElmArgsTooManyAddresses,
  					"\n\rToo many addresses, or addresses too long!\n\r")));
  
! 	    elm_sfprintf(to_whom, size,
! 			 FRM("%s%s%s"), to_whom, 
! 			 to_whom[0] != '\0'? "," : "", argv[optind]);
  	    if(!check_only)
  	      mail_only++;
  	    optind++;
***************
*** 131,140 ****
  	if (!isatty(fileno(stdin)) && !check_only) {
  	  batch_only = ON;
  	  if(*batch_subject == '\0')
! 	    strcpy(batch_subject, DEFAULT_BATCH_SUBJECT);
  	}
  
! 	if (strlen(included_file) > 0) {
  	  if (! mail_only)
  	    exit(printf(catgets(elm_msg_cat, ElmSet, ElmArgsInclFileNotSend,
              "\n\rCan't specify an included file with no-one to send to!\n\r")));
--- 114,128 ----
  	if (!isatty(fileno(stdin)) && !check_only) {
  	  batch_only = ON;
  	  if(*batch_subject == '\0')
! 	    strfcpy(batch_subject, DEFAULT_BATCH_SUBJECT, 
! 		    sizeof batch_subject);
  	}
  
! 	if (strlen(included_file) > 0
! #ifdef MIME
! 	    || attach_files
! #endif
! 	    ) {
  	  if (! mail_only)
  	    exit(printf(catgets(elm_msg_cat, ElmSet, ElmArgsInclFileNotSend,
              "\n\rCan't specify an included file with no-one to send to!\n\r")));
***************
*** 144,151 ****
          }
  
  	return(req_mfile);
- 
- 
  }
  
  args_help()
--- 132,137 ----
***************
*** 156,273 ****
  	  "\nPossible Starting Arguments for ELM program:\n\n\r\
  \targ\t\t\tMeaning\n\r\
  \t -a \t\tArrow - use the arrow pointer regardless\n\r\
  \t -c \t\tCheckalias - check the given aliases only\n\r\
  \t -dn\t\tDebug - set debug level to 'n'\n\r\
  \t -fx\t\tFolder - read folder 'x' rather than incoming mailbox\n\r\
  \t -h \t\tHelp - give this list of options\n\r\
! \t -ix\t\tInclude prepared file 'x' in edit buffer for send\n\r\
! \t -k \t\tKeypad - enable HP 2622 terminal keyboard\n\r"));
  	printf(catgets(elm_msg_cat, ElmSet, ElmArgsHelp2,
! 	  "\t -K \t\tKeypad&softkeys - enable use of softkeys + \"-k\"\n\r\
! \t -m \t\tMenu - Turn off menu, using more of the screen\n\r\
  \t -sx\t\tSubject 'x' - for batch mailing\n\r\
  \t -t \t\tTiTe - don't use termcap/terminfo ti/te entries.\n\r\
  \t -V \t\tEnable sendmail voyeur mode.\n\r\
  \t -v \t\tPrint out ELM version information.\n\r\
  \t -z \t\tZero - don't enter ELM if no mail is pending\n\r\
  \n\n"));
  	exit(1);
  }
  
! args_version()
  {
  	/** print out version information **/
  
  	printf("\nElm Version and Identification Information:\n\n");
  	printf("\tElm %s PL%s, of %s\n",VERSION,PATCHLEVEL,VERS_DATE);
! 	printf("\t(C) Copyright 1988-1992 USENET Community Trust\n");
! 	printf("\tBased on Elm 2.0, (C) Copyright 1986,1987 Dave Taylor\n");
! 	printf("\t----------------------------------\n");
! 	printf("\tConfigured %s\n", CONFIGURE_DATE);
! 	printf("\t----------------------------------\n");
  
  #ifdef MMDF
! 	printf("\tUse MMDF Mail Transport Agent/Mailbox Delimiters: MMDF\n");
  #else /* MMDF */
! 	printf("\tUse UNIX Mailbox Delimiters and %s Mail Transport Agent: not MMDF\n", mailer);
  #endif /* MMDF */
! 
  #ifdef DONT_ADD_FROM
! 	printf("\tLet the MTA add the From: header: DONT_ADD_FROM\n");
  #else /* DONT_ADD_FROM */
! 	printf("\tElm will add the From: header: not DONT_ADD_FROM\n");
  #endif /* DONT_ADD_FROM */
! 
! 	printf("\tFollowing mail spool locking protocols will be used:");
  #ifdef USE_DOTLOCK_LOCKING
! 	printf(" USE_DOTLOCK_LOCKING (.lock)");
  #endif
  #ifdef USE_FLOCK_LOCKING
! 	printf(" USE_FLOCK_LOCKING");
  #endif
  #ifdef USE_FCNTL_LOCKING
! 	printf(" USE_FCNTL_LOCKING");
  #endif
! 	printf("\n");
! 
! #ifdef USE_EMBEDDED_ADDRESSES
! 	printf("\tFrom: and Reply-To: addresses are good: USE_EMBEDDED_ADDRESSES\n");
! #else /* USE_EMBEDDED_ADDRESSES */
! 	printf("\tFrom: and Reply-To: addresses ignored: not USE_EMBEDDED_ADDRESSES\n");
! #endif /* USE_EMBEDDED_ADDRESSES */
  
  #ifdef MIME
! 	printf("\tSupport Multipurpose Internet Mail Extensions: MIME\n");
  #else /* MIME */
! 	printf("\tIgnore Multipurpose Internet Mail Extensions: not MIME\n");
  #endif /* MIME */
  
- #ifdef INTERNET
- 	printf("\tPrefers Internet address formats: INTERNET\n");
- #else /* INTERNET */
- 	printf("\tInternet address formats not used: not INTERNET\n");
- #endif /* INTERNET */
- 
  #ifdef DEBUG
! 	printf("\tDebug options are available: DEBUG\n");
  #else /* DEBUG */
! 	printf("\tNo debug options are available: not DEBUG\n");
  #endif /* DEBUG */
  		
  #ifdef CRYPT
! 	printf("\tCrypt function enabled: CRYPT\n");
  #else /* CRYPT */
! 	printf("\tCrypt function disabled: not CRYPT\n");
  #endif /* CRYPT */
  
  #ifdef ALLOW_MAILBOX_EDITING
! 	printf("\tMailbox editing included: ALLOW_MAILBOX_EDITING\n");
  #else /* ALLOW_MAILBOX_EDITING */
! 	printf("\tMailbox editing not included: not ALLOW_MAILBOX_EDITING\n");
  #endif /* ALLOW_MAILBOX_EDITING */
  
  #ifdef ALLOW_SUBSHELL
! 	printf("\tSubshell menu items included: ALLOW_SUBSHELL\n");
  #else /* ALLOW_SUBSHELL */
! 	printf("\tSubshell menu items not included: not ALLOW_SUBSHELL\n");
  #endif /* ALLOW_SUBSHELL */
  
  #ifdef ISPELL
! 	printf("\tSpell checking feature enabled: ISPELL\n");
! 	printf("\t\t(Default spelling checker is %s options '%s')\n", ISPELL_PATH, ISPELL_OPTIONS);
  #else /* ISPELL */
! 	printf("\tSpell checking feature disabled: not ISPELL\n");
  #endif /* ISPELL */
  
  #ifdef ENABLE_CALENDAR
! 	printf("\tCalendar file feature enabled: ENABLE_CALENDAR\n");
! 	printf("\t\t(Default calendar file is %s)\n",dflt_calendar_file);
  #else /* ENABLE_CALENDAR */
! 	printf("\tCalendar file feature disabled: not ENABLE_CALENDAR\n");
  #endif /* ENABLE_CALENDAR */
  
! 	printf("\n\n");
! 	exit(1);
  
  }
  
--- 142,368 ----
  	  "\nPossible Starting Arguments for ELM program:\n\n\r\
  \targ\t\t\tMeaning\n\r\
  \t -a \t\tArrow - use the arrow pointer regardless\n\r\
+ \t -A \t\tAttach file (requires .elm/mime.types)\n\r\
  \t -c \t\tCheckalias - check the given aliases only\n\r\
  \t -dn\t\tDebug - set debug level to 'n'\n\r\
  \t -fx\t\tFolder - read folder 'x' rather than incoming mailbox\n\r\
  \t -h \t\tHelp - give this list of options\n\r\
! \t -ix\t\tInclude prepared file 'x' in edit buffer for send\n\r"));
  	printf(catgets(elm_msg_cat, ElmSet, ElmArgsHelp2,
! 	  "\t -m \t\tMenu - Turn off menu, using more of the screen\n\r\
  \t -sx\t\tSubject 'x' - for batch mailing\n\r\
  \t -t \t\tTiTe - don't use termcap/terminfo ti/te entries.\n\r\
  \t -V \t\tEnable sendmail voyeur mode.\n\r\
  \t -v \t\tPrint out ELM version information.\n\r\
+ \t -w \t\tWrite .elm/elmrc\n\r\
  \t -z \t\tZero - don't enter ELM if no mail is pending\n\r\
  \n\n"));
+ 	/*
+ 	  \t -k \t\tKeypad - enable HP 2622 terminal keyboard\n\r
+ 	  \t -K \t\tKeypad&softkeys - enable use of softkeys + \"-k\"\n\r\
+ 	  */
  	exit(1);
  }
  
! static void args_version(i)
!      int i;
  {
+         time_t    curr_time = time(NULL);
+  
  	/** print out version information **/
  
  	printf("\nElm Version and Identification Information:\n\n");
  	printf("\tElm %s PL%s, of %s\n",VERSION,PATCHLEVEL,VERS_DATE);
! 	if (curr_time < LAST_REPORT_TIME && i != 2) {
! 	  printf("\tSend bug reports to %s\n",BUG_REPORT_ADDR);
! 	  printf("\n\tWARNING: Elm is not intended to be distributed in\n");
! 	  printf(  "\t         binary form. If that is done, then it is very\n");
! 	  printf(  "\t         likely that compile time configuration does not\n");
! 	  printf(  "\t         match to your system. This is NOT bug of ELM ME+\n");
! 	  printf(  "\t         and bug reports for that reason will be rejected.\n\n");
! 	}
! 	if (i == 1)
! 	  printf("\n\tBased on Elm 2.4 PL24 - PL25\n");
  
+ 	if (i < 3) {
+ 	  printf("\t(C) Copyright 1988-1992 USENET Community Trust\n");
+ 	  printf("\tBased on Elm 2.0, (C) Copyright 1986,1987 Dave Taylor\n");
+ 	}
+ 	if ( i < 2 ) {
+ 	  printf ("\n\tTo print configuration, use option: -vv\n");
+ 	  exit(1);
+ 	}
+ 	if (i < 3) {
+ 	  printf("\t----------------------------------\n");
+ 	  printf("\tConfigured %s\n", CONFIGURE_DATE);
+ 	  printf("\t----------------------------------\n");
+ 
  #ifdef MMDF
! 	  printf("\tUse MMDF Mail Transport Agent/Mailbox Delimiters: MMDF\n");
  #else /* MMDF */
! 	  printf("\tUse UNIX Mailbox Delimiters and %s Mail Transport Agent: not MMDF\n", mailer);
  #endif /* MMDF */
! 	  
  #ifdef DONT_ADD_FROM
! 	  printf("\tLet the MTA add the From: header: DONT_ADD_FROM\n");
  #else /* DONT_ADD_FROM */
! 	  printf("\tElm will add the From: header: not DONT_ADD_FROM\n");
  #endif /* DONT_ADD_FROM */
! 	  
! 	  printf("\tFollowing mail spool locking protocols will be used:");
  #ifdef USE_DOTLOCK_LOCKING
! 	  printf(" USE_DOTLOCK_LOCKING (.lock)");
  #endif
  #ifdef USE_FLOCK_LOCKING
! 	  printf(" USE_FLOCK_LOCKING");
  #endif
  #ifdef USE_FCNTL_LOCKING
! 	  printf(" USE_FCNTL_LOCKING");
  #endif
! 	  printf("\n");
  
  #ifdef MIME
! 	  printf("\tSupport Multipurpose Internet Mail Extensions: MIME\n");
! 
! #ifdef USE_8BITMIME
! 	  printf("\tUse 8BIT content_transfer_encoding and -B8BITMIME -option: USE_8BITMIME\n");
! #else /* USE_8BITMIME */
! 	  printf("\tDon't use 8BIT content_transfer_encoding with -B8BITMIME -option: not USE_8BITMIME\n");
! #endif /* USE_8BITMIME */
! 	  
! #ifdef USE_BINARYMIME
! 	  printf("\tUse BINARY content_transfer_encoding and -BBINARYMIME -option: USE_BINARYMIME");
! #else /* USE_BINARYMIME */
! 	  printf("\tDon't use BINARY content_transfer_encoding with -BBINARYMIME -option: not USE_BINARYMIME");
! #endif /* USE_BINARYMIME */
! 	  printf(" (This option isn't fully implemented yet.)\n");
! 
! #ifdef USE_DSN
! 	  printf("\tUse DSN and options -N -R -V: USE_DSN\n");
! #else /* USE_DSN */
! 	  printf("\tDon't use DSN with -N -R -V -options: not USE_DSN\n");
! #endif /* USE_DSN */
! 
  #else /* MIME */
! 	  printf("\tIgnore Multipurpose Internet Mail Extensions: not MIME\n");
  #endif /* MIME */
  
  #ifdef DEBUG
! 	  printf("\tDebug options are available: DEBUG\n");
  #else /* DEBUG */
! 	  printf("\tNo debug options are available: not DEBUG\n");
  #endif /* DEBUG */
  		
  #ifdef CRYPT
! 	  printf("\tCrypt function enabled: CRYPT\n");
  #else /* CRYPT */
! 	  printf("\tCrypt function disabled: not CRYPT\n");
  #endif /* CRYPT */
  
  #ifdef ALLOW_MAILBOX_EDITING
! 	  printf("\tMailbox editing included: ALLOW_MAILBOX_EDITING\n");
  #else /* ALLOW_MAILBOX_EDITING */
! 	  printf("\tMailbox editing not included: not ALLOW_MAILBOX_EDITING\n");
  #endif /* ALLOW_MAILBOX_EDITING */
  
  #ifdef ALLOW_SUBSHELL
! 	  printf("\tSubshell menu items included: ALLOW_SUBSHELL\n");
  #else /* ALLOW_SUBSHELL */
! 	  printf("\tSubshell menu items not included: not ALLOW_SUBSHELL\n");
  #endif /* ALLOW_SUBSHELL */
  
  #ifdef ISPELL
! 	  printf("\tSpell checking feature enabled: ISPELL\n");
! 	  printf("\t\t(Default spelling checker is %s options '%s')\n", ISPELL_PATH, ISPELL_OPTIONS);
  #else /* ISPELL */
! 	  printf("\tSpell checking feature disabled: not ISPELL\n");
  #endif /* ISPELL */
  
  #ifdef ENABLE_CALENDAR
! 	  printf("\tCalendar file feature enabled: ENABLE_CALENDAR\n");
! 	  printf("\t\t(Default calendar file is %s)\n",dflt_calendar_file);
  #else /* ENABLE_CALENDAR */
! 	  printf("\tCalendar file feature disabled: not ENABLE_CALENDAR\n");
  #endif /* ENABLE_CALENDAR */
  
! #ifdef USE_PGP
! 	  printf("\tPGP support enabled: USE_PGP\n");
! #else
! 	  printf("\tPGP support disabled: not USE_PGP\n");
! #endif
! #ifdef USE_REMAILER
! 	  printf("\tRemailer support enabled: USE_REMAILER\n");
! #else
! 	  printf("\tRemailer support disabled: not USE_REMAILER\n");
! #endif
! 	  printf("\n\n");
  
+ 	  printf("\tTo read global initialization file %s, use Elm -vvv\n",
+ 		 system_rc_file);
+ 	  exit(1);
+ 	}
+ 
+ 	switch (i) {
+ 	case 3:
+ 	printf("\t------------------------------------------\n");
+ 	printf("\tSystem RC file: %s\n",system_rc_file);
+ 	printf("\t------------------------------------------\n\n");
+ 	
+ 	user_init();
+ 	init_defaults();
+ 	post_init_check();
+ 
+ 	printf("\tShort host name:           %s\n",hostname);
+ 	printf("\tHost's domain:             %s\n",hostdomain);
+ 	printf("\tQualified host name:       %s\n",hostfullname);
+ 	printf("\tMailbox:                   %s\n",defaultfile);
+ #ifdef MIME
+ 	printf("\tDisplay character-set:     %s\n",display_charset);
+ 	printf("\tSending character-set:     %s\n",charset);
+ #endif
+ 	printf("\n\tTo list configuration files, use Elm -vvvv\n");
+ 	break;
+ 
+ 	case 4:
+ 	printf("\t------------------------------------------\n");
+ 	printf("\tElm ME+ configuration files: \n");
+ 	printf("\t------------------------------------------\n\n");
+ 	user_init();
+ 
+ 	printf("System configuration files:\n");
+ 	printf("\tRC file:                  %s\n",system_rc_file);
+ 	printf("\tAliases database:         %s\n",system_data_file);
+ 	printf("\tAliases file:             %s\n",system_text_file);
+ 	printf("\tMapping to content-type:  %s\n",system_mime_types);
+ 	printf("\tMapping to charset:       %s\n",system_mime_charsets);
+ 	printf("\tDomain-name file:         %s\n",hostdomfile);
+ 	printf("User configuration files:\n");
+ 	printf("\tRC file:                  %s\n",user_rc_file);
+ 	printf("\tAliases database:         %s\n",user_data_file);
+ 	printf("\tAliases file:             %s\n",user_text_file);
+ 	printf("\tMapping to content-type:  %s\n",user_mime_types);
+ 	printf("\tMapping to charset:       %s\n",user_mime_charsets);
+ 	printf("\tAdditional mail-headers:  %s\n",user_mailheaders);
+ 	printf("\n\tTo read user configuration, use Elm -vvvvv\n");
+ 	break;
+ 
+ 	case 5:
+ 	user_init();
+ 	init_defaults();
+ 	printf("\t------------------------------------------\n");
+ 	printf("\tUser RC file: %s\n",user_rc_file);
+ 	printf("\t------------------------------------------\n\n");
+ 
+ 	read_rc_file();
+ 	post_init_check();
+ 
+ 	printf("\tLocale (LC_CTYPE):         %s\n",display_locale);
+ #ifdef MIME
+ 	printf("\tDisplay character-set:     %s\n",display_charset);
+ 	printf("\tSending character-set:     %s\n",charset);
+ #endif
+ 
+ 	}
+ 	exit(1);
  }
  
Index: elm2.4.ME+.50/src/attach_menu.c
*** /tmp/8255-very-long-file-name-NULL-comes-in-here	Sun Nov 22 09:14:43 1998
--- elm2.4.ME+.50/src/attach_menu.c	Tue Nov 17 21:14:09 1998
***************
*** 0 ****
--- 1,1645 ----
+ static char rcsid[] = "@(#)$Id: attach_menu.c,v 1.5 1998/11/08 18:22:25 hurtta Exp $";
+ 
+ /******************************************************************************
+  *  The Elm (ME+) Mail System  -  $Revision: 1.5 $   $State: Exp $
+  *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  *
+  *  Initially written by: Michael Elkins <elkins@aero.org>, 1995
+  *****************************************************************************/
+ 
+ #include "headers.h"
+ #include "me.h"
+ #include "s_elm.h"
+ 
+ #ifdef MIME
+ #include <sys/errno.h>
+ #include <sys/stat.h>
+ /* unistd.h is included in headers.h */
+ 
+ extern int errno;
+ extern int elm_COLUMNS;
+ 
+ static int can_save(filename) 
+      char *filename;
+ {
+   if (access(filename,ACCESS_EXISTS) < 0) {
+     if (errno == ENOENT)
+       return 1;    /* File not exists -- can save ! */
+     return 0;     /* Other error -- don't save with that name ! */
+   } else
+     return 0;    /* File exits -- don't save over ! */
+ }
+ 
+ static FILE * 
+ get_attachment(mail_fd,att)
+      FILE * mail_fd;
+      mime_t *att;
+ {
+   FILE * result = NULL;
+ 
+   if (att->magic != MIME_magic)
+     mime_panic(__FILE__,__LINE__,"get_attachment",
+ 	       "Bad magic number");
+ 
+   if (att->pathname) {
+     if (can_open(att->pathname,"r") != 0) {
+       lib_error(CATGETS(elm_msg_cat, ElmSet, ElmErrorReadableUser,
+ 			"%.50s isn't readable by user!"), 
+ 		att->pathname);
+       sleep_message();
+       return NULL;
+     }
+ 
+     result = fopen(att->pathname,"r");
+     if (!result) {
+       	    lib_error(CATGETS(elm_msg_cat, ElmSet, ElmCantOpenAttach,
+ 			      "Can't open attachment: %.50s"),
+ 		      att->pathname);
+ 	    sleep_message();
+     }
+   } else if (!mail_fd) {
+       lib_error(CATGETS(elm_msg_cat, ElmSet, ElmInternalnoFD,
+ 			"Internal error: no parent fd!"));
+       sleep_message();
+   } else {
+     result = mail_fd;
+     if (fseek(mail_fd,att->offset,SEEK_SET) != 0) {
+       lib_error(CATGETS(elm_msg_cat, ElmSet, ElmFailedSeekAttach,
+ 			"Failed to seek beginning of attachment!"));
+       sleep_message();
+       result = NULL;
+     }
+   }
+   return result;
+ }
+ 
+ void close_attachment(mail_fd, tmpfd)
+      FILE * mail_fd, *tmpfd;
+ {
+   if (!tmpfd)
+     return;
+   if (mail_fd != tmpfd)
+     fclose(tmpfd);
+ }
+ 
+ void attachment_copy(att, tmpfd, outfd)
+      FILE *tmpfd, *outfd;
+      mime_t *att;
+ {
+   if (att->magic != MIME_magic)
+     mime_panic(__FILE__,__LINE__,"attachment_copy",
+ 	       "Bad magic number");
+ 
+   if (att->pathname) {  /* Already decoded */
+     char buf[VERY_LONG_STRING];
+     int len;
+     while (0 < (len = fread(buf,1,sizeof(buf),tmpfd))) {
+       if (fwrite(buf,1,len,outfd) != len) {
+         lib_error(CATGETS(elm_msg_cat, ElmSet, ElmWriteErrorAttach,
+ 			  "Write error when copying attachment!"));
+ 	sleep_message();
+ 	break;
+       }
+     }
+     if (ferror(tmpfd)) {
+       lib_error(CATGETS(elm_msg_cat, ElmSet, ElmErrorReading,
+ 			"Error reading from %.50s"),
+ 		att->pathname);
+       sleep_message();
+     }
+   } else { /* Needs decode */
+     in_state_t state_in;
+     out_state_t state_out;
+     int disp = att -> disposition;
+ 
+     in_state_clear(&state_in, STATE_in_file);
+     out_state_clear(&state_out, STATE_out_file);
+ 
+     set_out_state_file(outfd,&state_out);
+     state_out.displaying = FALSE;
+     set_in_state_file(tmpfd,&state_in);
+ 
+     att -> disposition = DISP_INLINE;  /* Show it ! */
+     mime_decode(att,&state_in, &state_out);
+     att -> disposition = disp;
+ 
+ 
+     in_state_destroy(&state_in);
+     out_state_destroy(&state_out);
+   }
+ }
+ 
+ static void
+ attach_print (att)
+      mime_t *att;
+ {
+   char tempfile[STRING];
+   char buf[VERY_LONG_STRING];
+   
+   if (att->magic != MIME_magic)
+     mime_panic(__FILE__,__LINE__,"attach_print",
+ 	       "Bad magic number");
+ 
+   elm_sfprintf(tempfile,sizeof tempfile,
+ 	       FRM("%selm.%d"), temp_dir, getpid());
+ 
+   if (att->type == MIME_TYPE_TEXT && istrcmp(att->subtype,"plain") == 0) {
+     FILE *f_out, *f_in;
+     int ret;
+ 
+     dprint(3,(debugfile,"attach_print: printing directly\n"));
+ 
+     
+     if (!(f_out = safeopen(tempfile))) {
+       lib_error(CATGETS(elm_msg_cat, ElmSet, ElmErrorCreatTempfile,
+ 			"Error creating tempfile %s"),
+ 		tempfile);
+       sleep_message();
+       return;
+     }
+ 
+     if (!(f_in = get_attachment(mailfile,att))) {
+       fclose(f_out);
+       unlink(tempfile);
+       return;
+     }
+     attachment_copy(att,f_in,f_out);
+ 
+     (void) elm_chown (tempfile, userid, groupid);
+       
+     fclose(f_out);
+     elm_sfprintf(buf, sizeof buf,
+ 		 FRM(printout), tempfile);
+     ret = system_call(buf,0);
+     if (ret == 0)
+       lib_error(CATGETS(elm_msg_cat, ElmSet, ElmJobSpooled,
+ 			"Print job spooled."));
+     else
+       lib_error(CATGETS(elm_msg_cat, ElmSet, ElmErrorPrinting,
+ 			"Error while printing!"));
+     unlink(tempfile);
+     close_attachment(mailfile,f_in);
+   }
+   else if (have_metamail()) {
+     dprint(3,(debugfile,"attach_print: printing via metamail: %s\n",
+ 	      metamail_path));
+     if (att->pathname)
+       elm_sfprintf(buf,sizeof buf,
+ 		   FRM("%s -m Elm -h -b -c %s/%s %s"),
+ 		   metamail_path,TYPE(att->type), att->subtype, att->pathname);
+     else {
+       FILE *fpout;
+ 
+       fpout = safeopen(tempfile);
+ 
+       if (!fpout) {
+ 	lib_error(CATGETS(elm_msg_cat, ElmSet, ElmErrorCreatTempfile,
+ 			  "Error creating tempfile %s"),
+ 		  tempfile);
+ 	sleep_message();
+ 	return;
+       }
+ 
+       (void) elm_chown (tempfile, userid, groupid);
+       fseek(mailfile,att->begin_offset,0);
+       while (ftell(mailfile) < att->offset + att->length) {
+ 	int len = mail_gets(buf,VERY_LONG_STRING,mailfile);
+ 	if (len <= 0) 
+ 	  break; /* Error ? */
+ 	fwrite(buf,1,len,fpout);
+       }
+       /* Option -z cuses that metamail unlinks tempfile */
+       fclose(fpout);
+       elm_sfprintf(buf,sizeof buf,
+ 		   FRM("%s -m Elm -h -z %s"),
+ 		   metamail_path, tempfile);
+     }
+     Raw(OFF);
+     system_call(buf,SY_ENV_METAMAIL);
+     PressAnyKeyToContinue();
+     Raw(ON);
+   }
+   else
+     lib_error(CATGETS(elm_msg_cat, ElmSet, ElmNotKnowPrint,
+ 		      "Don't know how to print this type of data!"));
+ 
+ }
+ 
+ static void attach_save (a)
+      mime_t *a;
+ {
+   char savefile[STRING], buf[VERY_LONG_STRING], tmp[STRING];
+   int bytes=0, err, is_text;
+   in_state_t state_in;
+   out_state_t state_out;
+   FILE *f_in, *f_out;
+   int code;
+ 
+   in_state_clear(&state_in, STATE_in_file);
+   out_state_clear(&state_out, STATE_out_file);
+ 
+   if (a->magic != MIME_magic)
+     mime_panic(__FILE__,__LINE__,"attach_save",
+ 	       "Bad magic number");
+ 
+   savefile[0] = '\0';
+   if (a->type == MIME_TYPE_APPLICATION &&
+       istrcmp (a->subtype, "octet-stream") == 0) {
+ 
+     /* See if there is a name=<...> field for the default filename */
+     tmp[0] = '\0';
+     if (a->type_opts &&
+ 	mime_get_param ("name", tmp, a->type_opts, sizeof(tmp))) {
+       char *p = strrchr (tmp, '/');
+       if (p)
+ 	p++;
+       else
+ 	p = tmp;
+       if (can_save(p))
+ 	strfcpy (savefile, p, sizeof (savefile));
+     }
+   }
+ 
+    /* See if there is a filename=<...> field for the default filename */
+   tmp[0] = '\0';
+   if (a->disposition_opts &&
+       mime_get_param ("filename", tmp, a->disposition_opts, sizeof(tmp))) {
+     char *p = strrchr (tmp, '/');
+     if (p)
+       p++;
+     else
+       p = tmp;
+     if (can_save(p))
+       strfcpy (savefile, p, sizeof (savefile));
+   }
+ 
+   ClearLine (elm_LINES-2);
+ 
+ redraw:
+   PutLine0 (elm_LINES-2, 0, "To file: ");
+   code = optionally_enter(savefile, elm_LINES-2, 9, OE_APPEND_CURRENT|
+ 			  OE_REDRAW_MARK, sizeof savefile);
+   if (REDRAW_MARK == code)
+     goto redraw;
+ 
+   if (code < 0 || 
+       savefile[0]=='\0'){
+     ClearLine(elm_LINES-2);
+     lib_error(CATGETS(elm_msg_cat, ElmSet, ElmMailNotSaved,
+ 		      "Mail not saved."));
+     
+     in_state_destroy(&state_in);
+     out_state_destroy(&state_out);
+     sleep_message();
+     return;
+   }
+ 
+   ClearLine(elm_LINES-2);
+ 
+   
+   if (!(f_in = get_attachment(mailfile,a)))  {
+ 
+     in_state_destroy(&state_in);
+     out_state_destroy(&state_out);
+     return;
+   }
+ 
+   if (can_open (savefile,"w") != 0) {
+     lib_error(CATGETS(elm_msg_cat, ElmSet, ElmNoPermissionWrite,
+ 		      "You do not have permission to write that file!"));
+     sleep_message();
+ 
+     in_state_destroy(&state_in);
+     out_state_destroy(&state_out);
+ 
+     close_attachment(mailfile,f_in);
+ 
+     return;
+   }
+ 
+   
+   if (! (f_out = fopen(savefile, "w"))) {
+     	    lib_error(CATGETS(elm_msg_cat, ElmSet, ElmErrorOpening,
+ 			      "Error opening file!"));
+     sleep_message();
+ 
+     in_state_destroy(&state_in);
+     out_state_destroy(&state_out);
+ 
+     close_attachment(mailfile,f_in);
+     return;
+   }
+ 
+   is_text = is_text_type (TYPE(a->type), a->subtype, a->encoding);
+ 
+   set_in_state_file(f_in,&state_in);
+   set_out_state_file(f_out,&state_out);
+ 
+   state_out.prefix = NULL;
+   state_out.displaying = 0;
+ 
+   if (a->encoding == ENCODING_BASE64 && !a->pathname)
+      base64_decode (&state_in, &state_out, a->length, is_text);
+   else if (a->encoding == ENCODING_QUOTED && !a->pathname)
+      quoted_printable_decode (&state_in, &state_out, a->length, is_text);
+   else {
+     if (a->encoding != ENCODING_NONE && a->encoding != ENCODING_7BIT &&
+ 	a->encoding != ENCODING_8BIT && a->encoding != ENCODING_BINARY
+ 	&& !a->pathname) {
+       	    lib_error(CATGETS(elm_msg_cat, ElmSet, ElmUnsupportedEncoding,
+ 			      "Unsupported encoding! Decode manually!"));
+       sleep_message();
+ 
+       /* save without decoding ! */
+       is_text = 0;  /* We can't suppose it is text before decoding... */
+     }
+     while (bytes < a->length) {
+       int chunk = VERY_LONG_STRING;
+       int len;
+ 
+       if (chunk > a->length - bytes)
+ 	chunk = a->length - bytes;
+       if ((len = state_getl (buf, chunk, &state_in)) <= 0)
+ 	break;
+       bytes += len;
+       if (is_text > 0) { /* replace CRLF with LF */
+ 	if (len >= 2 && buf[len-2] == '\r' && buf[len-1] == '\n') {
+ 	  buf[len-2] = '\n';
+ 	  buf[len-1] = '\0';
+ 	  len--;
+ 	}
+       }
+       state_put(buf,len,&state_out);
+     }
+   }
+ 
+   err = ferror (f_out); 
+   err = err || fclose (f_out) != 0;
+   elm_chown (savefile, userid, groupid);
+ 
+   close_attachment(mailfile,f_in);
+ 
+   if (err)
+     lib_error(CATGETS(elm_msg_cat, ElmSet, ElmErrorSaving,
+ 		      "Error saving file!"));
+   else
+     lib_error(CATGETS(elm_msg_cat, ElmSet, ElmMailSaved,
+ 		      "Mail saved."));
+ 
+   in_state_destroy(&state_in);
+   out_state_destroy(&state_out);
+   return;
+ }
+ 
+ static int attach_info P_((mime_t *ptr));
+ 
+ static void attach_edit (ptr)
+      mime_t *ptr;
+ {
+   int savetime;
+   struct stat sb;
+   char buf[STRING];
+ 
+   if (ptr->magic != MIME_magic)
+     mime_panic(__FILE__,__LINE__,"attach_edit",
+ 	       "Bad magic number");
+ 
+   if (!ptr->pathname)
+     return;
+ 
+   if (-1 == stat (ptr->pathname, &sb)) {
+     lib_error(CATGETS(elm_msg_cat, ElmSet, ElmCantStat,
+ 		      "Can't stat file!"));
+     sleep_message();
+     return;
+   }
+   if (strlen(ptr->pathname) + strlen(editor) > STRING-5)
+     return;
+   savetime = sb.st_mtime;
+   Raw(OFF);
+   elm_sfprintf (buf, sizeof buf,
+ 		FRM("%s %s"), editor, ptr->pathname);
+   system_call (buf, 0);
+   Raw(ON);
+   if (stat (ptr->pathname, &sb) == -1 || sb.st_mtime != savetime)
+     (void) attach_info (ptr);  /* update the information on this attachment */
+   return;
+ }
+ 
+ static void attach_viewer (a)
+      mime_t *a;
+ {
+   char buf[LONG_STRING];
+ 
+   struct header_rec tmp;
+   FILE *tmpfp = NULL;
+   struct stat sb;
+ 
+   /* The next line is required so that mime_t_clear() doesn't call
+    * mime_destroy() or free() on bad pointers
+    */
+   header_zero(&tmp);
+   mime_t_clear (&tmp.mime_rec);
+ 
+   if (a->magic != MIME_magic)
+     mime_panic(__FILE__,__LINE__,"attach_viewer",
+ 	       "Bad magic number");
+     
+   /* So that metapager() doesn't try to do special handling */
+   tmp.status = MIME_MESSAGE;  /* Now I test again MIME_MESSAGE
+ 			       * - K E H   <hurtta@dionysos.FMI.FI>
+ 			       */
+ #ifdef USE_PGP
+     tmp.pgp = 0;
+ #endif
+ 
+   if (a->pathname) {
+     ClearScreen();     /* Extra clear for attach_parse ... */
+ 
+     if (can_open(a->pathname,"r") != 0) {
+       lib_error(CATGETS(elm_msg_cat, ElmSet, ElmErrorReadableUser,
+ 			"%.50s isn't readable by user!"), 
+ 		a->pathname);
+       sleep_message();
+       return;
+     }
+ 
+     tmpfp = fopen (a->pathname, "r");
+     if (! tmpfp) {
+       lib_error(CATGETS(elm_msg_cat, ElmSet, ElmCouldOpenReading,
+ 			"Could not open file for reading!"));
+       sleep_message();
+       return;
+     }
+ 
+     tmp.mime_rec.flags = a->flags;
+     tmp.mime_rec.type = a->type;
+     strfcpy (tmp.mime_rec.subtype,a->subtype,
+ 	     sizeof tmp.mime_rec.subtype);
+     if (a->type_opts) {
+       tmp.mime_rec.type_opts = strmcpy(tmp.mime_rec.type_opts,a->type_opts);
+     }
+     tmp.mime_rec.notplain = a->notplain;  
+ 
+     tmp.mime_rec.disposition = DISP_INLINE;  /* Show it ! */
+     tmp.offset = tmp.mime_rec.offset = 0;
+     tmp.mime_rec.encoding = ENCODING_7BIT;
+     stat(a->pathname, &sb);
+     tmp.content_length = tmp.mime_rec.length = sb.st_size;
+     attach_parse(&tmp, tmpfp);
+ 
+   }
+   else {
+ 
+     /* Make copy of mime structure: */
+     mime_t_copy(&(tmp.mime_rec),a);
+     tmp.mime_rec.disposition = DISP_INLINE;  /* Show it ! */
+ 
+     tmp.offset = tmp.mime_rec.offset = a -> offset;
+     tmp.content_length = tmp.mime_rec.length = a->length;
+ #ifdef USE_PGP
+     if (headers)
+       tmp.pgp = headers[current-1]->pgp;
+ #endif
+   }
+ 
+   if (tmp.lines < 1)
+     tmp.lines = tmp.content_length / 60; /* This value is used for selecting
+ 					  * external pager versus internal
+ 					  * pager.
+ 					  */
+   /* there is nothing to display! */
+   if (tmp.mime_rec.length <= 0)
+     goto fail;
+ 
+   if (!mime_notplain(&(tmp.mime_rec)) || !have_metamail()) {
+ 
+     metapager (tmpfp == NULL ? mailfile : tmpfp, &tmp, FALSE);
+   } else {
+     /* otherwise call metamail */
+ 
+     if (!a->pathname) {
+       char tmpfile[STRING], c;
+       FILE *out;
+       int bytes;
+ 
+       elm_sfprintf (tmpfile, sizeof tmpfile,
+ 		    FRM("%selm.%d"), temp_dir, getpid());
+ 
+       out = safeopen(tmpfile);
+ 
+       if (out == NULL) {
+ 	lib_error(CATGETS(elm_msg_cat, ElmSet, ElmErrorCreatTempfile,
+ 			  "Error creating tempfile %s"),		 
+ 		  tmpfile);
+ 	sleep_message();
+ 	goto fail;
+       }
+       /* copy the headers plus the message to a temp file */
+       fseek (mailfile, a->begin_offset, 0);
+       bytes = a->begin_offset - a->offset;
+       while (bytes < a->length) {
+ 	c = fgetc (mailfile);
+ 	fputc (c, out);
+ 	bytes++;
+       }
+       fclose (out);
+       elm_sfprintf (buf, sizeof buf,
+ 		    FRM("%s -m Elm -p -z %s"), metamail_path,tmpfile);
+     }
+     else
+       /* This is the case when we are viewing attachments for an outgoing
+        * message.
+        */
+       elm_sfprintf(buf,sizeof buf,
+ 		   FRM("%s -m Elm -p -b -c %s/%s %s"), 
+ 		   metamail_path,TYPE(a->type), a->subtype, a->pathname);
+     
+ 
+     (void) elm_chown (tmpfile, userid, groupid);
+ 
+     /* Option -z causes that metamail deletes input file */
+ 
+     Raw (OFF);
+     ClearScreen();
+     printf ("Executing: %s\n", buf);
+     system_call (buf, SY_ENAB_SIGINT|SY_ENV_METAMAIL);
+     PressAnyKeyToContinue();
+     Raw (ON);
+   }
+ 
+  fail:
+   mime_t_clear (&(tmp.mime_rec));
+ 
+   if (tmpfp) {
+     fclose (tmpfp);
+   }
+ 
+   return;
+ }
+ 
+ int Check_attachments() { /* Check initial attachments */
+   mime_t * tmp;
+   for (tmp = attach_files; tmp; tmp = tmp -> next) {
+     int need_enc;
+     int is_text;
+     char buf[40];
+ 
+     need_enc = attach_info (tmp);
+     if (need_enc < 0) {
+       return 0;
+     }
+ 
+     is_text = is_text_type (mime_types[tmp->type], 
+ 			    tmp->subtype, tmp->encoding);
+     
+     if (tmp->type == MIME_TYPE_TEXT && (need_enc & HAVE_8BIT) &&
+ 	!mime_get_param("charset",buf,tmp->type_opts,sizeof (buf)) &&
+ 	charset[0] != '\0')
+       add_parameter_t(tmp, "charset", charset,0);
+ 
+     is_text = is_text_type (mime_types[tmp->type], 
+ 			    tmp->subtype, tmp->encoding);
+   
+     if (is_text < 0 && (tmp->encoding == ENCODING_QUOTED || 
+ 			tmp->encoding == ENCODING_BASE64)) {
+       	    lib_error(CATGETS(elm_msg_cat, ElmSet, ElmStrucredNoEncoding,
+ "%.30s: Structured types don't allow encoding of data."),
+ 	      tmp->pathname);
+       sleep_message();
+ 
+       return 0;
+     }
+   }
+   return 1;
+ }
+ 
+ /* Make initial attachment */
+ int Attach_it(pathname) 
+      char *pathname;
+ {
+   mime_t * tmp;
+ 
+   if (access(pathname,READ_ACCESS) < 0) {
+     int err = errno;
+     lib_error(FRM("%.45s: %.33s"),
+ 	      pathname,error_description(err));
+     return 0;
+   }
+ 
+   tmp = (mime_t *) mime_t_alloc ();
+   tmp->pathname = strmcpy (tmp->pathname, pathname);
+ 
+   /* Default disposition for attachments: attachment */
+   tmp->disposition = DISP_ATTACH;
+ 
+   tmp->next = attach_files;
+   attach_files = tmp;
+   return 1;
+ }
+ 
+ static int attach_modify (att, new)
+      mime_t *att;
+      int new;
+ {
+   char buf[STRING];
+   int update = TRUE, prompt = TRUE, need_enc = 0;
+   int is_text = -1, ch;
+ 
+   if (att->magic != MIME_magic)
+     mime_panic(__FILE__,__LINE__,"attach_modify",
+ 	       "Bad magic number");
+ 
+   buf[0] = '\0';
+ 
+   if (new) {
+     /* set the default charset */
+     add_parameter_t (att, "charset", charset, 0);
+ 
+     /* Default disposition for attachments: attachment */
+     att->disposition = DISP_ATTACH;
+ 
+     /* force a prompt for a filename */
+     prompt = FALSE;
+     ch = 'f';
+     att->unlink = 0;
+   }
+   
+   /* 1 if is text type (true)
+    * 0 if not text type
+    * -1 if can't be encoded (ie structured) Message/ or Multpart/
+    */
+   is_text = is_text_type (TYPE(att->type), att->subtype, att->encoding);
+ 
+   for (;;) {
+     if (update) {
+       int add = 0;
+       ClearScreen ();
+       
+       Centerline (1, "Attachment Configuration");
+       
+       if (att->unlink) 
+ 	PutLineX(3, 0, 
+ 		 FRM("%-26.26s: %.*s"), "Filename", 
+ 		 sizeof(buf)-30, NONULL(att->pathname));
+       else
+ 	PutLineX(3, 0, 
+ 		 FRM("%-26.26s: %.*s"), "F)ilename", 
+ 		 sizeof(buf)-30, NONULL(att->pathname));
+ 
+       PutLineX(4, 0, 
+ 	       FRM("%-26.26s: %.*s"), "D)escription", 
+ 	       sizeof(buf)-30, NONULL(att->description));
+ 
+ 
+       PutLineX (5, 0, 
+ 		FRM("%-26.26s: %.15s/%.30s%s"), "Content-T)ype",
+ 		TYPE(att->type), att->subtype,
+ 		att->type_opts ? ";" : "");
+ 
+       if (att->type_opts) {
+ 	PutLine0 (6+add, 28, att->type_opts);
+ 	add++;
+       }
+       PutLineX(6+add, 0, 
+ 	       FRM("%-26.26s: %s"), "content-transfer-E)ncoding",
+ 	       ENCODING(att->encoding));
+ 
+       
+ 
+       PutLineX (7+add, 0, 
+ 		FRM("%-26.26s: %.15s%s"), "content-disP)osition", 
+ 		DISPOSITION(att->disposition),
+ 		att->disposition_opts ? ";" : "");
+ 
+       if (att->disposition_opts) {
+ 	PutLine0 (8+add, 28, att->disposition_opts);
+ 	add++;
+       }
+ 
+       if (is_text < 0)
+ 	PutLineX(9+add, 0, 
+ 		 FRM("%-26.26s: %s"), 
+ 		 "CRLF-conversions",
+ 		 "structured (direct content-encoding not allowed)");
+       else if (is_text)
+ 	PutLineX(9+add, 0, 
+ 		 FRM("%-26.26s: %s"), 
+ 		 "CRLF-conversions",
+ 		 "Text (line orienteed, convert LF <-> CRLF)");
+       else 
+ 	PutLineX(9+add, 0, 
+ 		 FRM("%-26.26s: %s"), "CRLF-conversions",
+ 		 "Binary (no conversions)");
+ 
+ 
+       update = FALSE;
+       show_last_error();
+     }
+     
+     if (prompt) {
+       PutLine0 (elm_LINES-2, 0, "Enter letter or RETURN to quit: ");
+       ch = ReadCh(REDRAW_MARK);
+       clear_error();
+     }
+     
+     if (ch == '\n' || ch == 'q' || ch == 'Q' || ch == 'x' || ch == 'X')
+       return (TRUE);
+     else if (ch == ctrl('L') || ch == REDRAW_MARK)
+       update = TRUE;
+     else if (ch == 'f' || ch == 'F') {
+       int code;
+ 
+       if (att->unlink)  {
+ 	lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			  ElmCantChangeFilename,"You can't change filename!"));
+ 	continue;
+       }
+       if (att->pathname)
+ 	strfcpy(buf, att->pathname, sizeof(buf));
+       else
+ 	buf[0] = '\0';
+ 
+       prompt = TRUE;
+       PutLine0 (elm_LINES-2, 0, "Filename: ");
+       code = optionally_enter (buf, elm_LINES-2, 10, OE_APPEND_CURRENT|
+ 			       OE_REDRAW_MARK, sizeof buf);
+       if (REDRAW_MARK == code) {
+ 	update = TRUE;
+ 	prompt = FALSE;
+ 	continue;
+       }
+ 
+       if (buf[0] != '\0') {
+ 	if (access(buf,READ_ACCESS) < 0) {
+ 	  int err = errno;
+ 	  lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			    ElmErrorAccess,
+ 			    "%.45s: %.33s"),
+ 		    buf,error_description(err));
+ 	  continue;
+ 	}
+         att->pathname = strmcpy (att->pathname, buf);
+ 	update = TRUE;
+ 
+       } else {
+ 	update = TRUE;
+ 
+         if (att->pathname) {
+           free (att->pathname);
+           att->pathname = NULL;
+         }
+         if (new)
+           return FALSE;
+         else
+           continue;
+       }
+ 
+       /* Set some information about this attachment */
+       need_enc = attach_info (att);
+       if (need_enc < 0)
+ 	continue;
+ 
+       /* 1 if is text type (true)
+        * 0 if not text type
+        * -1 if can't be encoded (ie structured) Message/ or Multpart/
+        */
+       is_text = is_text_type (TYPE(att->type), att->subtype, att->encoding);
+       if (is_text > 0 && (need_enc & HAVE_BINARY)) {
+ 	lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			  ElmWarningBINARY,
+ 			  "Warning: BINARY data? Check Content-Type!"));
+       }
+ 
+       if (is_text < 0 && (att->encoding == ENCODING_QUOTED || 
+ 			  att->encoding == ENCODING_BASE64)) {
+ 	/* Reconsider encoding ... */
+ 	ch = 'e';
+ 	prompt = FALSE;
+ 	update = TRUE;
+ 	lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			  ElmStructuredNoencoding,
+ 			  "Structured types don't allow encoding of data."));
+ 	sleep_message();
+ 
+ 	break;
+       } 
+ 
+       /* now let the user do what they want */
+       if (new)
+ 	prompt = TRUE;
+       
+     }
+     else if (ch == 'd' || ch == 'D') {
+       int code;
+ 
+       PutLine0 (elm_LINES-2, 0, "Description: ");
+       buf[0] = '\0';
+       if (att->description)
+ 	strfcpy(buf,att->description,sizeof(buf));
+ 
+       prompt = TRUE;
+       code =
+ 	optionally_enter (buf, elm_LINES-2, 13, OE_APPEND_CURRENT|
+ 			  OE_REDRAW_MARK, sizeof buf);
+       if (REDRAW_MARK == code) {
+ 	update = TRUE;
+ 	prompt = FALSE;
+ 	continue;
+       }
+       if (code != 0)
+ 	continue;
+ 
+       if (buf[0])
+         att->description = strmcpy (att->description, buf);
+       else if (att->description) {
+         free (att->description);
+ 	att->description = NULL;
+       }
+       update = TRUE;
+     }
+     else if (ch == 't' || ch == 'T') {
+       int code;
+ 
+       prompt = TRUE;
+       PutLine0 (elm_LINES-2, 0, "Content-Type: ");
+       att -> flags &= ~(MIME_RFC822);
+       att -> flags &= ~(MIME_MIXED);
+       att -> flags &= ~(MIME_DIGEST);
+       elm_sfprintf (buf, sizeof buf,
+ 		    FRM("%.15s/%.30s"), 
+ 		    TYPE(att->type), att->subtype);
+       if (att->type_opts) {
+ 	int l;
+ 
+ 	strfcat (buf, "; ", sizeof buf);
+         l = strlen (buf);
+ 	strfcpy (buf + l, att->type_opts, sizeof (buf) - l);
+       }
+       
+       code = optionally_enter (buf, elm_LINES-2, 14, OE_APPEND_CURRENT|
+ 			       OE_REDRAW_MARK, sizeof buf);
+       if (REDRAW_MARK == code) {
+ 	update = TRUE;
+ 	prompt = FALSE;
+ 	continue;
+       }
+       if (0 != code)
+ 	continue;
+ 
+       mime_get_content (buf, att);
+       if (att->type == MIME_TYPE_TEXT && (need_enc & HAVE_8BIT) &&
+ 	  !mime_get_param("charset",buf,att->type_opts,sizeof (buf)))
+ 	add_parameter_t(att, "charset", charset,0);
+       
+       /* 1 if is text type (true)
+        * 0 if not text type
+        * -1 if can't be encoded (ie structured) Message/ or Multpart/
+        */
+       is_text = is_text_type (mime_types[att->type], 
+ 			      att->subtype, att->encoding);
+       update = TRUE;
+       if (is_text < 0 && (att->encoding == ENCODING_QUOTED || 
+ 			  att->encoding == ENCODING_BASE64)) {
+ 	/* Reconsider encoding ... */
+ 	ch = 'e';
+ 	prompt = FALSE;
+ 	lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			  ElmStructuredNoencoding,
+ 			  "Structured types don't allow encoding of data."));
+ 	sleep_message();
+       } 
+     }
+     else if (ch == 'p' || ch == 'P') {
+       int code;
+ 
+       prompt = TRUE;
+       PutLine0 (elm_LINES-2, 0, "Content-Disposition: ");
+       strfcpy (buf, DISPOSITION(att->disposition), sizeof buf);
+       if (att->disposition_opts) {
+ 	int l;
+ 
+ 	strfcat (buf,"; ", sizeof buf);
+         l = strlen (buf);
+ 	strfcpy (buf + l, att->disposition_opts, sizeof (buf) - l);
+       }
+       
+       code = optionally_enter (buf, elm_LINES-2, 21, 
+ 			       OE_REDRAW_MARK|OE_APPEND_CURRENT,
+ 			       sizeof buf);
+       if (REDRAW_MARK == code) {
+ 	update = TRUE;
+ 	prompt = FALSE;
+ 	continue;
+       }
+       if (0 != code)
+ 	continue;
+       mime_get_disposition (buf, att);
+       update = TRUE;
+     }
+     else if (ch == 'e' || ch == 'E') {
+       prompt = TRUE;
+       PutLine0 (elm_LINES-2, 0, "Content-Transfer-Encoding: ");
+       Centerline (elm_LINES-1, "<SPACE> for next value, <RETURN> to accept.");
+       for (;;) {
+ 	MoveCursor (elm_LINES-2, 27);
+ 	CleartoEOLN ();
+ 
+ #define NEXT_ENCODING  { \
+ 			   att->encoding++; \
+ 			   if (att->encoding > 5) att->encoding = 1; \
+ 			   continue; \
+ 		       }
+ 
+ #ifndef USE_8BITMIME
+ 	if (allow_no_encoding < 1) {
+ 	  if (att->encoding == ENCODING_8BIT) {  /* Mailer won't support ! */
+ 	    /* TRY next encosing instead */
+ 	    NEXT_ENCODING;
+ 	  }
+ 	}
+ #endif
+ 	
+ #ifndef USE_BINARYMIME
+ 	if (allow_no_encoding < 2) {
+ 	  if (att->encoding == ENCODING_BINARY) {  /* Mailer won't support ! */
+ 	    /* TRY next encoding instead */
+ 	    NEXT_ENCODING;
+ 	  }
+ 	}
+ #endif
+ 
+ 	/* Don't allow 7bit if the file contains 8bit chars... 
+ 	 * 7bit encoding is allowed if file includes control characters 
+ 	 */
+ 	if (att->encoding == ENCODING_7BIT && (need_enc & HAVE_8BIT)) {
+ 	  NEXT_ENCODING;
+ 	}
+ 	/* Don't allow 7bit or 8bit if the file required binary
+ 	 * encoding according of Mime Draft Standard.
+ 	 */
+ 	if ((att->encoding == ENCODING_7BIT || att->encoding == ENCODING_8BIT)
+ 	    && (need_enc & HAVE_BINARY)) {
+ 	  NEXT_ENCODING;
+ 	}
+ 
+ 	/* Don't allow encoding for Multipart/ and Message/ 
+ 	 * See mime Draft Standard. Be carefull that don't create
+ 	 * infinitive loop! */
+ 
+ 	if (is_text < 0) {
+ 	  static int again = 0;    /* Prevent looping */
+ 	  if (att->encoding == ENCODING_QUOTED || 
+ 	      att->encoding == ENCODING_BASE64) {
+ 	    if (again == att->encoding) {
+  	      	lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 				  ElmStructuredLeaf,
+ 				  "Structured types must be encoded in leaf type!"));
+ 	      sleep_message();
+ 
+ 	      /* prompt for new content-type */
+ 	      prompt = FALSE;
+ 	      ch = 't';
+ 	      break;
+ 	    } else {
+ 	      if (!again)
+ 		again = att->encoding;
+ 	      NEXT_ENCODING;
+ 	    }
+ 	  } else
+ 	    again = 0;
+ 	}
+ 
+ 	Write_to_screen (FRM("%s"),ENCODING(att->encoding));
+ 	ch = ReadCh(REDRAW_MARK);
+ 	if (ch == '\n')
+ 	  break;
+ 	else if (ch == ' ') {
+ 	  NEXT_ENCODING;
+ 	}
+ 	else if (ch == REDRAW_MARK) {
+ 	  update = TRUE;
+ 	  prompt = FALSE;
+ 	  ch =  'e';
+ 	  
+ 	  break;
+ 	}
+       }
+ 
+ #undef NEXT_ENCODING
+ 
+       ClearLine (elm_LINES-1);
+       /* 1 if is text type (true)
+        * 0 if not text type
+        * -1 if can't be encoded (ie structured) Message/ or Multpart/
+        */
+       is_text = is_text_type (mime_types[att->type], att->subtype, att->encoding);
+       update = TRUE;
+     }
+     else
+       lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			ElmUnknownCommand2,			
+ 			"Unknown command."));
+   }
+   /* Not reached. */
+ }
+ 
+ static void
+ mime_guess_content_type (ptr)
+      mime_t *ptr;
+ {
+   /* This routine tries to guess the content-type of an attachment by looking
+    * at the suffix of ptr->pathname.  It first looks to see if it can find
+    * an entry in ~/.elm/mime.types, then in "system_mime_types", and failing
+    * that, to a small list of builtin definitions.
+    */
+   int i, found = FALSE;
+   char *p, *c, buf[LONG_STRING];
+   FILE *fp;
+ 
+   dprint (3, (debugfile, "mime_guess_content_type: pathname=%s\n",
+ 	      ptr->pathname));
+ 
+   if (ptr->magic != MIME_magic)
+     mime_panic(__FILE__,__LINE__,"mime_guess_content_type",
+ 	       "Bad magic number");
+ 
+   /* Set the "filename" field for content-disposition */
+   p = strrchr (ptr->pathname, '/');
+   if (p)
+     p++;
+   else
+     p = ptr->pathname;
+   buf[0] = '\0';
+   add_parameter (buf, "filename", p, sizeof (buf), 0);
+   ptr->disposition_opts = strmcpy (ptr->disposition_opts, buf);
+ 
+   /* Try to guess the content type of the data by the filename extension */
+   p = strrchr (ptr->pathname, '.');
+   if (! p)
+     return;
+   p++;
+   for (i = 0; i < 3; i++) {
+   dprint (3, (debugfile, 
+ 	      "mime_guess_content_type: searching \"%s\", i=%d\n",
+ 	      p,i));
+     if (i == 0) {
+       
+       /* First try the user's mime.types file */
+       
+       fp = fopen (user_mime_types, "r");
+       if (!fp)
+ 	continue;
+     }
+     else if (i == 1) {
+       
+       /* If it wasn't there, try the system file... */
+       
+       fp = fopen (system_mime_types, "r");
+       if (! fp)
+ 	continue;
+     }
+     else {
+       /* Couldn't find user or system mime.types file,
+        * use these defaults...
+        */
+       if (istrcmp (p, "ps") == 0) {
+ 	ptr->type = MIME_TYPE_APPLICATION;
+ 	strfcpy (ptr->subtype, "postscript", sizeof ptr->subtype);
+         if (ptr->type_opts) {
+           free (ptr->type_opts);
+           ptr->type_opts = NULL;
+         }
+       }
+       else if (istrcmp (p, "gif") == 0 || istrcmp (p, "jpeg") == 0 ||
+ 	       istrcmp (p, "tiff") == 0) {
+ 	ptr->type = MIME_TYPE_IMAGE;
+ 	strfcpy (ptr->subtype, p, sizeof ptr->subtype);
+         if (ptr->type_opts) {
+           free (ptr->type_opts);
+           ptr->type_opts = NULL;
+         }
+       }
+       dprint (3, (debugfile, 
+ 		  "mime_guess_content_type: built-in default \"%s\" as \"%s/%s\"\n", 
+ 		  p, TYPE(ptr->type), ptr->subtype));
+     }
+     
+     if (i < 2) {
+       int l = strlen(p);
+       while (fgets (buf, LONG_STRING, fp) != NULL) {
+ 	int l1 = strlen(buf);
+ 	
+ 	if ('\n' == buf[l1 -1]) 
+ 	  buf[l1 - 1] = '\0';
+ 	else {
+ 	  lib_error("mime.types: Too long line: %.30s...\n",buf);
+ 	  break;
+ 	}
+ 	while (l1-- > 0 && whitespace(buf[l1]))
+ 	  buf[l1] = '\0';
+ 
+ 	c = buf;
+ 	while (*c && whitespace ( *c)) /* skip leading whitespace */
+ 	  c++;
+ 	if (*c == '#') /* Skip comments */
+ 	  continue;
+ 	if (! *c)
+ 	  continue;
+ 	if (strincmp (c, p, l) == 0 &&
+ 	    whitespace(c[l])) {
+ 	  mime_get_content (c + l + 1, ptr);
+ 	  dprint (3, (debugfile, "mime_guess_content_type: user defined \"%s\" as \"%s/%s\"\n", p, TYPE(ptr->type), ptr->subtype));
+ 	  found = TRUE;
+ 	  break;
+ 	}
+       }
+       fclose (fp);
+       if (found)
+ 	break;
+     }
+   }
+   return;
+ }
+ 
+ static int attach_info (ptr)
+      mime_t *ptr;
+ {
+   struct stat sb;
+   FILE *fp;
+   int need_enc;
+ 
+   if (ptr->magic != MIME_magic)
+     mime_panic(__FILE__,__LINE__,"attach_info",
+ 	       "Bad magic number");
+ 
+   if (stat (ptr->pathname, &sb) == -1) {
+     if (errno == ENOENT)
+       lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			ElmFileNotExist,			
+ 			"That file %.20s does not exist!"),
+ 		ptr->pathname);
+     else
+       lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			ElmCantStatFile,			
+ 			"Could not stat file %.20s!"),
+ 		ptr->pathname);
+     sleep_message();
+     return (-1);
+   }
+ 
+   ptr->length = sb.st_size;
+ 
+   if (can_open(ptr->pathname,"r") != 0) {
+     lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 		      ElmNotReadableByUser,			
+ 		      "%.50s isn't readable by user!"), 
+ 	      ptr->pathname);
+     ptr->pathname[0] = '\0';
+     sleep_message();
+     return (-1);
+   }
+ 
+   mime_guess_content_type (ptr);
+ 
+   /* Figure out what the default encoding is... */
+ 
+   lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 		    ElmCheckingEncoding,			
+ 		    "Checking %s..."), 
+ 	    ptr->pathname);
+   fp = fopen (ptr->pathname, "r");
+   if (!fp) {
+     lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 		      ElmCantOpenFile,			
+ 		      "Can't open %s!"), 
+ 	      ptr->pathname);
+     sleep_message();
+     return -1;
+   }
+ 
+   need_enc = needs_encoding (fp);
+   
+   if (need_enc & HAVE_CTRL)
+     ptr->encoding = (need_enc & HAVE_BINARY) 
+       ? ENCODING_BASE64 : ENCODING_QUOTED;
+   else if (need_enc & HAVE_BINARY) { 
+     /* HAVE_BINARY, but not HAVE_CTRL so that have long lines! */
+ #ifdef USE_BINARYMIME
+     ptr->encoding = ENCODING_BINARY;
+ #else
+     ptr->encoding = ENCODING_QUOTED;
+ #endif
+   }
+   else if (need_enc & HAVE_8BIT) {
+ #ifdef USE_8BITMIME
+     ptr->encoding = ENCODING_8BIT;
+ #else
+     ptr->encoding = ENCODING_QUOTED;
+ #endif
+   }
+   fclose (fp);
+   clear_error();  /* Remove reading ... -message */
+ 
+   dprint(3,(debugfile,"attach_info: need_enc=%d, encoding=%d, pathname=%s\n",
+ 	    need_enc,ptr->encoding,ptr->pathname));
+   return (need_enc);
+ }
+ 
+ static void attach_header P_((mime_t *mt,
+ 			      int num, int is_cur, int offset, int use_desc));
+ 
+ static void attach_header (mt, num, is_cur, use_desc, offset)
+      mime_t *mt;
+      int num, is_cur, offset, use_desc;
+ {
+   /* Displays a header for a menu for the specified attachment. */
+   char *Encoding = "???";
+  
+   char buf[LONG_STRING], buf2[LONG_STRING];
+   int len, len2;
+   int Width = elm_COLUMNS;     /* Protect arbitary big values of COLUMNS */
+   if (Width > sizeof (buf)-1)
+     Width = sizeof (buf)-1;
+ 
+   if (mt->magic != MIME_magic)
+     mime_panic(__FILE__,__LINE__,"attach_header",
+ 	       "Bad magic number");
+ 
+   Encoding = ENCODING(mt->encoding);
+ 
+   elm_sfprintf (buf, sizeof buf,
+ 		FRM("%4d %-30.30s (%d) "),
+ 		num,
+ 		use_desc ? NONULL(mt->description) : NONULL(mt->pathname),
+ 		mt->length);
+   if (mt->length < 10)
+     strfcat (buf, "   ", sizeof buf);
+   else if (mt->length < 100)
+     strfcat (buf, "  ", sizeof buf);
+   else if (mt->length < 1000)
+     strfcat (buf, " ", sizeof buf);
+   elm_sfprintf (buf2, sizeof buf2,
+ 		FRM("%.15s/%.30s"), TYPE(mt->type), mt->subtype);
+   strfcat (buf, buf2, sizeof buf);
+   len = Width - strlen (buf);
+   len2 = strlen (Encoding) + 3;
+   if (len2 > len) {
+     buf[Width-len2] = '\0';
+     len = len2 = 0;
+   }
+   elm_sfprintf (buf2, sizeof buf2,
+ 		FRM("%s %*.*s[%s]"), buf, len-len2, len-len2, "", Encoding);
+   
+   if (is_cur && arrow_cursor) {
+     buf2[0] = '-';
+     buf2[1] = '>';
+   }
+ 
+   if (is_cur && has_highlighting && ! arrow_cursor) 
+     StartInverse();
+   PutLine0 (offset, 0, buf2);
+   if (is_cur && has_highlighting && ! arrow_cursor) 
+     EndInverse();
+ }
+ 
+ static void write_num P_((int num, int is_cur, int offset));
+ 
+ static void write_num(num, is_cur, offset)
+      int num, is_cur,offset;
+ {
+   char buf[10];
+ 
+   elm_sfprintf (buf,sizeof buf,
+ 		FRM("%4d"),num);
+ 
+   if (is_cur) {
+     buf[0] = '-';
+     buf[1] = '>';
+   }
+   PutLine0 (offset, 0, buf);
+ }
+ 
+ mime_t * attach_menu (mt, rdonly)
+      mime_t *mt;
+      int rdonly;
+ {
+   /* A generic attachment menu.  "rdonly" controls whether or not the list
+    * of attachments "mt" may be edited.
+    */
+ 
+   mime_t **ptrs = NULL, *tmp, *ret = NULL;
+   int ptr_len = 0, ptr_max = 0, i, cur = 0, offset = 3, key_offset, ch;
+   int update = TRUE;
+   char buf[STRING];
+   int top = 0;
+ 
+   if (mt && mt->magic != MIME_magic)
+     mime_panic(__FILE__,__LINE__,"attach_menu",
+ 	       "Bad magic number");
+ 
+   /* Generate an array of pointers so it is easier to work with. */
+   while (mt) {
+     if (mt->magic != MIME_magic)
+       mime_panic(__FILE__,__LINE__,"attach_menu",
+ 		 "Bad magic number (next chain)");
+ 
+     if (ptr_len == ptr_max)
+       ptrs = (mime_t **) DynamicArray (ptrs, sizeof (mime_t *), &ptr_len, 5);
+     ptrs[ptr_max++] = mt;
+     mt = mt->next;
+   }
+ 
+   for (;;) {
+     if (cur < top || cur >= top + elm_LINES-3-offset) {
+       if (cur < top) 
+ 	top -= elm_LINES-3-offset;
+       if (cur >= top + elm_LINES-3-offset) 
+ 	top += elm_LINES-3-offset;
+       if (top >= ptr_max)
+ 	top = ptr_max - elm_LINES +3 +offset;
+       if (top < 0)
+ 	top = 0;
+       update = TRUE;
+     }
+     if (update) {
+       ClearScreen ();
+       elm_sfprintf (buf, sizeof buf,
+ 		    CATGETS(elm_msg_cat, ElmSet, ElmAttachMenu,
+ 			    "Attachment Menu (%d attachments)"), 
+ 		    ptr_max);
+       Centerline (1, buf);
+       if (! rdonly)
+ 	strfcpy (buf, "a)dd, e)dit, d)elete, m)odify, ", sizeof buf);
+       else
+ 	buf[0] = '\0';
+       strfcat (buf, "p)rint, s)ave, v)iew subparts, q)uit", sizeof buf);
+       Centerline (elm_LINES-1, buf);
+       for (i = top; i < ptr_max && i < top + elm_LINES -3 - offset; i++)
+ 	attach_header (ptrs[i], i + 1, i == cur, rdonly, offset + i - top);
+       update = FALSE;
+       show_last_error(); 
+     }
+     ClearLine (elm_LINES-2);
+     PutLine0 (elm_LINES-2, 0, "Attachments: ");
+     ch = ReadCh (REDRAW_MARK|READCH_CURSOR);
+     clear_error(); /* Clear the error message (from buffer also) */
+     switch (ch) {
+     case '-':
+     case LEFT_MARK:
+     case PAGEUP_MARK:
+       if ( ptr_max > 0 ) {
+         attach_header (ptrs[cur], cur+1, FALSE, rdonly, offset + cur - top);
+         cur -= elm_LINES -3;
+         if (cur < 0)
+ 	  cur = 0;
+       }
+       else
+         lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 	                  ElmNoAttachments,
+ 		          "There are no attachments!"));
+       break;
+     case '+':
+     case RIGHT_MARK:
+     case PAGEDOWN_MARK:
+       if ( ptr_max > 0 ) {
+         attach_header (ptrs[cur], cur+1, FALSE, rdonly, offset + cur - top);
+         cur += elm_LINES -3;
+         if (cur > ptr_max - 1) 
+ 	  cur = ptr_max - 1;
+       }
+       else
+         lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 	                  ElmNoAttachments,
+ 		          "There are no attachments!"));
+       break;
+     case 's':
+       if (ptr_max > 0)
+         attach_save (ptrs[cur]);
+       else
+ 	lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			  ElmNoAttachments,			
+ 			  "There are no attachments!"));
+       break;
+     case ' ':
+     case '\n':
+       if (ptr_max > 0) {
+         attach_viewer (ptrs[cur]);
+         update = TRUE;
+       }
+       else
+ 	lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			  ElmNoAttachments,			
+ 			  "There are no attachments!"));
+       break;
+     case 'p':
+       if (ptr_max > 0)
+ 	attach_print(ptrs[cur]);
+       else
+         lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			  ElmNoAttachments,			
+ 			  "There are no attachments!"));
+ 		
+       break;
+     case 'v': /* Perhaps it is better that attachment meny shows whole
+ 	       * structure -- but this is temporary hack.... */
+       if (ptr_max == 0) {
+ 	lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			  ElmNoAttachments,			
+ 			  "There are no attachments!"));
+         break;
+       }
+       if (ptrs[cur]->parts) {
+ 	attach_menu(ptrs[cur]->parts,TRUE);
+ 	update = TRUE;
+       }
+       break;
+     case 'e':
+       if (! rdonly) {
+         if (ptr_max == 0) {
+ 	  lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			    ElmNoAttachments,			
+ 			    "There are no attachments!"));
+           break;
+         }
+ 	attach_edit (ptrs[cur]);
+ 	update = TRUE;
+       }
+       break;
+     case 'd':
+       if (! rdonly) {
+         if (ptr_max == 0) {
+ 	  lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			    ElmNoAttachments,			
+ 			    "There are no attachments!"));
+           break;
+         }
+ 	if (question_me) {
+ 	  for(;;) {
+ 	    PutLine0(elm_LINES-2, 0, "Are you sure? (y/n): y");
+ 	    MoveCursor(elm_LINES-2, 21);
+ 	    ch = ReadCh(0);
+ 	    if (ch == 'y' || ch == '\n' || ch == 'n')
+ 	      break;
+ 	  }
+ 	  ClearLine(elm_LINES-2);
+ 	  if (ch == 'n')
+ 	    break;
+ 	}
+       delete_it:
+ 	/* List will be rebuild in exit */
+ 	ptrs[cur]->next = NULL;
+   	mime_destroy (ptrs[cur]);
+ 	ptrs[cur] = NULL;
+ 	/* Shift the rest of the pointers down by one. */
+ 	for (i = cur + 1; i < ptr_max; i++)
+ 	  ptrs[i-1] = ptrs[i];
+ 	ptrs[ptr_max-1] = NULL;
+         ptr_max--;
+ 	if ( cur >= ptr_max && cur > 0 ) cur = ptr_max-1;
+ 	update = TRUE;
+       }
+       break;
+     case 'a':
+       if (! rdonly) {
+ 	tmp = (mime_t *) mime_t_alloc ();
+ 	if (attach_modify (tmp, TRUE)) {
+ 	  if (ptr_len == ptr_max)
+ 	    ptrs = (mime_t **) DynamicArray (ptrs, sizeof (mime_t *), &ptr_len, 5);
+ 	  ptrs[ptr_max++] = tmp;
+ 	}
+ 	else {
+ 	  /* List will be rebuild in exit */
+ 	  tmp->next = NULL;
+ 	  mime_destroy(tmp);
+ 	}
+         update = TRUE;
+       }
+       break;
+     case 'm':
+       if (! rdonly) {
+         if (ptr_max == 0) {
+ 	  lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			    ElmNoAttachments,			
+ 			    "There are no attachments!"));
+           break;
+         }
+ 	attach_modify (ptrs[cur], FALSE);
+ 	/* If there is not pathname it is otherwise assumed to be 
+ 	 * part from mailfile...!
+ 	 */
+ 	if (ptrs[cur]->pathname == NULL)
+ 	  goto delete_it;
+         update = TRUE;
+       }
+       break;
+     case 'j':
+     case 'J':
+     case 'n':
+     case DOWN_MARK:
+     case ctrl('N'):
+     NEXT_ATTACH:
+       if (cur >= ptr_max - 1) {
+ 	lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			  ElmLastAttachment,			
+ 			  "You are on the last attachment!"));
+ 	break;
+       }
+       if (arrow_cursor)
+ 	write_num(cur+1,FALSE,offset + cur - top);
+       else
+ 	attach_header (ptrs[cur], cur+1, FALSE, rdonly, offset + cur - top);
+       cur++;
+       if (cur < top + elm_LINES -3 - offset) {
+ 	if (arrow_cursor)
+ 	  write_num(cur+1,TRUE,offset + cur - top);
+ 	else
+ 	  attach_header (ptrs[cur], cur+1, TRUE, rdonly, offset + cur - top);
+       }
+       break;
+     case 'k':
+     case 'K':
+     case ctrl('K'):
+     case UP_MARK:
+     PREV_ATTACH:
+       if (cur == 0) {
+ 	lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			  ElmFirstAttachment,			
+ 			  "You are on the first attachment!"));
+ 	break;
+       }
+       if (arrow_cursor) 
+ 	write_num(cur+1,FALSE,offset + cur - top);
+       else
+ 	attach_header (ptrs[cur], cur+1, FALSE, rdonly, offset + cur - top);
+       cur--;
+       if (cur >= top) {
+ 	if (arrow_cursor)
+ 	  write_num(cur+1,TRUE,offset + cur - top);
+ 	else	  
+ 	  attach_header (ptrs[cur], cur+1, TRUE, rdonly, offset + cur - top);
+       }
+       break;
+     case 'i':
+       if (! rdonly)
+         break;
+       /* else fall through to next statement! */
+     case 'q':
+     case 'x':
+       if (ptrs == NULL)
+         return NULL;
+       if (! rdonly) {
+ 	/* The attachments might have been edited, so rebuild the list */
+ 	if (ptr_max > 0) {
+ 	  ret = tmp = ptrs[0];
+ 
+ 	  if (ret->magic != MIME_magic)
+ 	    mime_panic(__FILE__,__LINE__,"attach_menu",
+ 		       "Bad magic number (ptrs[0])");
+ 
+ 	  for (i = 1; i < ptr_max; i++) {
+ 	    
+ 	    if (ptrs[i]->magic != MIME_magic)
+ 	      mime_panic(__FILE__,__LINE__,"attach_menu",
+ 			 "Bad magic number (ptrs[..])");
+ 
+ 	    tmp->next = ptrs[i];
+ 	    tmp = tmp->next;
+ 	  }
+ 	  tmp->next = NULL;
+ 	}
+ 	else
+ 	  ret = NULL;
+       }
+       else
+ 	ret = mt;
+       free (ptrs);
+       return ret;
+ #ifdef USE_PGP
+     case ctrl('F'):
+       pgp_void_passphrase();
+       lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			ElmPassphraseForgotten,			
+ 			"Passphrase forgotten!"));
+       break;
+ #endif
+     case ctrl('L'):
+     case REDRAW_MARK:
+       update = TRUE;
+       break;
+     default:
+       lib_error(CATGETS(elm_msg_cat, ElmSet,
+ 			ElmUnknownCommand3,		       
+ 			"Unknown command: %c"), 
+ 		ch);
+     }
+   }
+ }
+ #endif /* MIME */
+ 
+ 
+ 
+ 
+ 
+ 
Index: elm2.4.ME+.50/src/bouncebk.c
*** elm2.4.25/src/bouncebk.c	Wed Feb  3 21:06:46 1993
--- elm2.4.ME+.50/src/bouncebk.c	Tue Nov 17 21:12:57 1998
***************
*** 1,132 ****
- 
- static char rcsid[] = "@(#)$Id: bouncebk.c,v 5.2 1993/02/03 19:06:31 syd Exp $";
- 
- /*******************************************************************************
-  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
-  *
-  * 			Copyright (c) 1988-1992 USENET Community Trust
-  * 			Copyright (c) 1986,1987 Dave Taylor
-  *******************************************************************************
-  * Bug reports, patches, comments, suggestions should be sent to:
-  *
-  *	Syd Weinstein, Elm Coordinator
-  *	elm@DSI.COM			dsinc!elm
-  *
-  *******************************************************************************
-  * $Log: bouncebk.c,v $
-  * Revision 5.2  1993/02/03  19:06:31  syd
-  * Remove extra strchr/strcat/strcpy et al declarations
-  * From: Syd
-  *
-  * Revision 5.1  1992/10/03  22:58:40  syd
-  * Initial checkin as of 2.4 Release at PL0
-  *
-  *
-  ******************************************************************************/
- 
- /** This set of routines implement the bounceback feature of the mailer.
-     This feature allows mail greater than 'n' hops away (n specified by
-     the user) to have a 'cc' to the user through the remote machine.  
- 
-     Due to the vagaries of the Internet addressing (uucp -> internet -> uucp)
-     this will NOT generate bounceback copies with mail to an internet host!
- 
- **/
- 
- #include "headers.h"
- 
- char *bounce_off_remote();		/* forward declaration */
- 
- int
- uucp_hops(to)
- register char *to;
- {	
- 	/** Given the entire "To:" list, return the number of hops in the
- 	    first address (a hop = a '!') or ZERO iff the address is to a
-   	    non uucp address.
- 	**/
- 
- 	register int hopcount = 0, len;
- 
- 	while (*to) {
- 	  len = len_next_part(to);
- 	  if (len == 1) {
- 	    if (whitespace(*to))
- 	      break;
- 	    
- 	    if (*to == '!')
- 	      hopcount++;
- 	    else if (*to == '@' || *to == '%' || *to == ':')
- 	      return(0);	/* don't continue! */
- 	  }
- 	  to += len;
- 	}
- 
- 	return(hopcount);
- }
- 	
- char *bounce_off_remote(to)
- register char *to;
- {
- 	/** Return an address suitable for framing (no, that's not it...)
- 	    Er, suitable for including in a 'cc' line so that it ends up
- 	    with the bounceback address.  The method is to take the first 
- 	    address in the To: entry and break it into machines, then 
- 	    build a message up from that.  For example, consider the
- 	    following address:
- 			a!b!c!d!e!joe
- 	    the bounceback address would be;
- 			a!b!c!d!e!d!c!b!a!ourmachine!ourname
- 	    simple, eh?
- 	**/
- 
- 	static char address[LONG_STRING];	/* BEEG address buffer! */
- 
- 	char   host[MAX_HOPS][NLEN];	/* for breaking up addr */
- 	register int hostcount = 0, hindex = 0, iindex, len;
- 
- 	while (*to) {
- 	  len = len_next_part(to);
- 	  if (len == 1) {
- 	    if (whitespace(*to))
- 	      break;
- 	    
- 	    if (*to == '!') {
- 	      host[hostcount][hindex] = '\0';
- 	      hostcount++;
- 	      hindex = 0;
- 	    } else 
- 	      host[hostcount][hindex++] = *to++;
- 	  } else {
- 	    while (--len >= 0)
- 	      host[hostcount][hindex++] = *to++;
- 	  }
- 	}
- 
- 	/* we have hostcount hosts... */
- 
- 	strcpy(address, host[0]);	/* initialize it! */
- 
- 	for (iindex=1; iindex < hostcount; iindex++) {
- 	  strcat(address, "!");
- 	  strcat(address, host[iindex]);
- 	}
- 	
- 	/* and now the same thing backwards... */
- 
- 	for (iindex = hostcount -2; iindex > -1; iindex--) {
- 	  strcat(address, "!");
- 	  strcat(address, host[iindex]);
- 	}
- 
- 	/* and finally, let's tack on our machine and login name */
- 
- 	strcat(address, "!");
- 	strcat(address, hostname);
- 	strcat(address, "!");
- 	strcat(address, username);
- 
- 	/* and we're done!! */
- 
- 	return( (char *) address );
- }
--- 0 ----
Index: elm2.4.ME+.50/src/builtin++.c
*** /tmp/8255-very-long-file-name-NULL-comes-in-here	Sun Nov 22 09:14:43 1998
--- elm2.4.ME+.50/src/builtin++.c	Tue Nov 17 21:14:09 1998
***************
*** 0 ****
--- 1,411 ----
+ static char rcsid[] = "@(#)$Id: builtin++.c,v 1.3 1998/11/16 17:08:35 hurtta Exp $";
+ 
+ /******************************************************************************
+  *  The Elm (ME+) Mail System  -  $Revision: 1.3 $   $State: Exp $
+  *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  *
+  *  Initially written by: Michael Elkins <elkins@aero.org>, 1995
+  *****************************************************************************/
+ 
+ #include "headers.h"
+ #include "me.h"
+ #include "s_elm.h"
+ 
+ extern int errno;
+ extern int tabspacing;
+ 
+ static void
+ builtin_help () {
+   /* A help screen for the pager below. */
+ 
+ redraw:
+   ClearScreen ();
+   StartInverse();
+   Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpTitle,
+ 			   "Help for builtin++"));
+   EndInverse();
+   NewLine ();
+   NewLine ();
+   Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpKeyA,
+ 			   "Key\t\tAction"));
+   NewLine ();
+   Write_to_screen (FRM("---\t\t------"));
+   NewLine ();
+   Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpSpace,
+ 			   "<SPACE>, +\tNext page."));
+   NewLine ();
+   Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpMinus,
+ 			   "-\t\tPrevious page."));
+   NewLine ();
+   Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpReturn,
+ 			   "<RETURN>\tNext line."));
+   NewLine ();
+   Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpq,
+ 			   "q, x, i\t\tReturn to the index menu."));
+   NewLine ();
+   Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpDiv,
+ 			   "/\t\tSearch for pattern in message."));
+   NewLine ();
+   Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpArr,
+ 			   "^\t\tFirst page."));
+   NewLine ();
+   Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpG,
+ 			   "G\t\tLast page."));
+   NewLine ();
+   Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpCtrlL,
+ 			   "^L\t\tRefresh display."));
+   NewLine ();
+   Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpCtrlP,
+ 			   "^P\t\tUp one line."));
+   NewLine ();
+   Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpCtrlP,
+ 			   "^D\t\tDown one-half page."));
+   NewLine ();
+   Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpCtrlU,
+ 			   "^U\t\tUp one-half page."));
+   NewLine ();
+   Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpQuestion,
+ 			   "?\t\tThis help screen."));
+   NewLine ();
+   PutLineX (elm_LINES, 0, 
+ 	    CATGETS(elm_msg_cat, ElmSet, ElmBuiltinHelpPressRet,
+ 		    "Press any key to return..."));
+   if (REDRAW_MARK == ReadCh (REDRAW_MARK))
+     goto redraw;
+ 
+   return;
+ }
+ 
+ int
+ builtinplusplus (fp, begin, length, text, textlen)
+      FILE *fp;
+      long begin;
+      int length, textlen;
+      char **text;
+ {
+   char buffer[LONG_STRING], searchword[STRING], *pending = NULL;
+   long **offsets = NULL;
+   int offset_len = 0, offset_max = 0;
+   int lines = 0, saveidx, ch, len, chars;
+   int slurping = FALSE; /* used to find the end of the file */
+   int searching = FALSE;
+   long end_offset = begin + length;
+   int idx = -textlen, cur_line_len;
+   int is_end = 0;
+ 
+   if (fseek (fp, begin, 0) == -1) {
+     dprint (1, (debugfile, "pager2(): fseek() returned errno %d!\n", errno));
+     lib_error(CATGETS(elm_msg_cat, ElmSet, ElmFailedSeekBytes,
+ 		      "Failed to seek %d bytes into file!"), 
+ 	      begin);
+     if (sleepmsg > 0)
+       sleep (sleepmsg);
+     return (0);
+   }
+ 
+   clear_error();
+   ClearScreen();
+ 
+   for (;;) {
+     while (((ftell (fp) < end_offset) || (idx < 0)) &&
+ 	   (lines < elm_LINES || searching || slurping)) {
+ 
+       if (pending == NULL) {
+ 	/* There is no pending data to output, so we need to grab another
+ 	 * line.
+ 	 */
+ 	if (idx < 0) {
+ 	  /* Negative index numbers refer to the text block passed to pager2.
+ 	   * this is necessary for doings things like adding a title and
+ 	   * weeding unwanted headers.
+ 	   */
+ 	  pending = text[textlen+idx];
+ 	  idx++;
+ 	}
+ 	else {
+ 	  if (offset_len >= offset_max - 1)
+ 	    offsets = (long **) DynamicArray (offsets, 
+ 					      sizeof (long *), &offset_max, 
+ 					      elm_LINES + 1);
+ 	  if (idx == offset_len) {
+ 	    if (! offsets[idx]) {
+ 	      offsets[idx] = (long *) safe_malloc (sizeof (long));
+ 	      offset_len++;
+ 	    }
+ 	    *offsets[idx] = ftell (fp);
+ 	  }
+ 	
+ 	  if ((cur_line_len= mail_gets (buffer, LONG_STRING, fp)) <= 0) {
+ 	    if (slurping) {
+ 	      slurping = FALSE;
+ 	      idx -= elm_LINES;
+ 	      if (idx < -textlen)
+ 		idx = -textlen;
+ 	      fseek (fp, *offsets[idx > -1 ? idx : 0], 0);
+ 	      continue;
+ 	    }
+ 	    if (searching) {
+ 	      searching = FALSE;
+ 	      ClearLine (elm_LINES);
+ 	      PutLineX (elm_LINES, 0, 	    
+ 			CATGETS(elm_msg_cat, ElmSet, ElmBuiltinNotFound,
+ 				"NOT FOUND!"));
+ 	      if (sleepmsg > 0)
+ 		sleep (sleepmsg);	 
+ 	      ClearLine (elm_LINES);
+ 	      /* Reposition the file at the appropriate place */
+ 	      idx = saveidx;
+ 	      fseek (fp, *offsets[idx > 0 ? idx : 0], 0);
+ 	    }
+ 	    break;
+ 	  }
+ 	  
+ 	  idx++;
+ 
+ 	  if (slurping)
+ 	    continue;
+ 	  
+ 	  if (searching) {
+ 	    if (in_string (buffer, searchword)) {
+ 	      searching = FALSE;
+ 	      idx -= 3;
+ 	      if (idx < -textlen)
+ 		idx = -textlen;
+ 	      if (idx >= 0) fseek (fp, *offsets[idx], 0);
+ 	      else fseek (fp, begin, 0);
+ 	      ClearScreen ();
+ 	      lines = 0;
+ 	    }
+ 	    continue;
+ 	  }
+ 
+ 	  if (cur_line_len > 0 && buffer[cur_line_len-1] == '\n') {
+ 	    buffer[cur_line_len-1] = '\0';
+ 	    if (cur_line_len > 1 && buffer[cur_line_len-2] == '\r') 
+ 	      buffer[cur_line_len-2] = '\0';
+ 	  }
+ 
+ 	  pending = buffer;
+ 	}
+       }
+ 
+       /* This is the part of the code that actually displays on the screen */
+       chars = 0;
+       while (*pending) {
+ 	if (chars >= elm_COLUMNS)
+ 	  break;
+ 
+ 	if (*pending == '\t') {
+ 	  Writechar('\t');
+ 	  /* 'chars += tabspacing' is INCORRENT! - K E H */ 
+ 	  chars = ((chars / tabspacing ) +1) * tabspacing; 
+ 	}
+ #ifdef ASCII_CTYPE
+         else if (!isascii((unsigned char)*pending)) {
+           Writechar('?');
+           chars++;
+         }
+ #endif
+ 	else if (!isprint((unsigned char)*pending)) {
+ 	  if (*pending >= 0 && *pending <= 31) {    
+             /* This won't fit on the line, so just skip it for now */
+             if (chars == elm_COLUMNS - 1)
+               break;
+ 
+             Writechar('^');
+             Writechar(*pending + 64);
+             chars += 2;
+ 
+             /* Honor the formfeed character */
+             if (*pending == ctrl('L')) {
+               break;
+             }
+           }
+           else {
+             Writechar('?');
+             chars++;
+           }
+ 	}
+ 	else {
+ 	  Writechar(*pending);
+ 	  chars++;
+ 	}
+ 	pending++;
+       }
+       NewLine();
+       lines++;
+ 
+       if (*pending == ctrl('L')) {
+         pending++;
+         if (*pending == '\0')
+           pending = NULL;
+         break;
+       }
+ 
+       /* Check to see if we are finished with this line */
+       if (*pending == '\0')
+ 	pending = NULL;
+     }
+     if (slurping){
+       slurping = FALSE;
+       idx -= elm_LINES;
+       if (idx < -textlen)
+         idx = -textlen;
+       if (idx >= 0) fseek (fp, *offsets[idx], 0);
+       else fseek (fp, begin, 0);
+       continue;
+     }
+ 
+     StartBold();
+     if (idx < 0) {
+       Write_to_screen (CATGETS(elm_msg_cat, ElmSet, ElmBuiltinMore0,
+ 			       "More (you've seen 0%%)"));
+       len = 0;
+       is_end = 0;
+     }
+     else {
+       if (length < 1)
+         len = 100;
+       else {
+         long pos = ftell (fp);
+ 
+         len = 100 * (pos - begin) / length;
+       }
+ 
+       if (len >= 100) {
+         Write_to_screen(CATGETS(elm_msg_cat, ElmSet, ElmBuiltinCommandi,
+ 				"Command ('i' to return to index):"));
+         is_end = 1;
+       }
+       else {
+         Write_to_screen(CATGETS(elm_msg_cat, ElmSet, ElmBuiltInMore,
+ 				"MORE (you've seen %d%%):"), 
+ 			len);
+         is_end = 0;
+       }
+     }
+     EndBold();
+ 
+     ch = ReadCh (REDRAW_MARK|READCH_CURSOR);
+     switch (ch) {
+     case ' ':
+     case '+':
+     case PAGEDOWN_MARK:
+       if (is_end) {
+ 	DestroyDynamicArray (offsets);
+ 	return (' ');
+       }
+       lines = 0;
+       ClearScreen ();
+       break;
+     case HOME_MARK:
+     case '^':      
+       idx = -textlen;
+       fseek (fp, begin, 0);
+       lines = 0;
+       ClearScreen ();
+       break;
+     case 'G':
+       idx = offset_len-1;
+       if (idx >= 0) fseek (fp, *offsets[idx], 0);
+       else fseek (fp, begin, 0);
+       slurping = TRUE;
+       lines = 0;
+       ClearScreen ();
+       break;
+     case FIND_MARK:
+     case '/':
+       ClearLine (elm_LINES);
+       PutLineX (elm_LINES, 0, 
+ 		CATGETS(elm_msg_cat, ElmSet, ElmBuiltinSearch,"Search%s"),
+ 		": ");
+       searchword[0] = '\0';
+       {
+ 	int code = optionally_enter (searchword, elm_LINES, 8, 
+ 				     OE_REDRAW_MARK, 
+ 				     sizeof searchword);
+ 	if (REDRAW_MARK == code)
+ 	  goto redraw;
+ 	if (code < 0)
+ 	  goto quit;
+       }
+       if (searchword[0])
+ 	searching = TRUE;
+       saveidx = idx;
+       break;	
+     case PAGEUP_MARK:
+     case '-':
+       idx -= elm_LINES * 2;
+       if (idx < -textlen)
+ 	idx = -textlen;
+       if (idx >= 0) fseek (fp, *offsets[idx], 0);
+       else fseek (fp, begin, 0);
+       ClearScreen ();
+       lines = 0;
+       break;
+     case ctrl('P'):
+       idx -= elm_LINES + 1;
+       if (idx < -textlen)
+ 	idx = -textlen;
+       if (idx >= 0) fseek (fp, *offsets[idx], 0);
+       else fseek (fp, begin, 0);
+       lines = 0;
+       ClearScreen();
+       break;
+     case ctrl('D'):
+       lines = elm_LINES / 2;
+       CarriageReturn();
+       if (CleartoEOLN() >= 0)
+ 	 break;  
+ 
+       idx -= (elm_LINES / 2);
+       if (idx < -textlen)
+ 	idx = -textlen;
+       if (idx >= 0) fseek (fp, *offsets[idx], 0);
+       else fseek (fp, begin, 0);
+       lines = 0;
+       ClearScreen ();
+       break;
+ 
+     case ctrl('U'):
+       idx -= elm_LINES + (elm_LINES / 2);
+       if (idx < -textlen)
+ 	idx = -textlen;
+       if (idx >= 0) fseek (fp, *offsets[idx], 0);
+       else fseek (fp, begin, 0);
+       lines = 0;
+       ClearScreen ();
+       break;
+     case HELP_MARK:
+     case '?':
+       builtin_help ();
+     case REDRAW_MARK:
+     case ctrl('L'):
+     redraw:
+       idx -= elm_LINES;
+       if (idx < -textlen)
+ 	idx = -textlen;
+       if (idx >= 0) fseek (fp, *offsets[idx], 0);
+       else fseek (fp, begin, 0);
+       ClearScreen ();
+       lines = 0;
+       break;
+     case '\n':
+       {
+ 	int x, y;
+ 
+ 	GetXYLocation (&x, &y);
+ 	ClearLine (x);
+       }
+       lines = elm_LINES - 1;
+       break;
+     case EOF:
+     default:
+     quit:
+       DestroyDynamicArray (offsets);
+       return (ch == 'q' || ch == 'x' ? 0 : ch);
+     }
+   }
+ }
+ 
Index: elm2.4.ME+.50/src/calendar.c
*** elm2.4.25/src/calendar.c	Wed Feb  3 21:06:47 1993
--- elm2.4.ME+.50/src/calendar.c	Tue Nov 17 21:12:58 1998
***************
*** 1,33 ****
  
! static char rcsid[] = "@(#)$Id: calendar.c,v 5.3 1993/02/03 19:06:31 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: calendar.c,v $
!  * Revision 5.3  1993/02/03  19:06:31  syd
!  * Remove extra strchr/strcat/strcpy et al declarations
!  * From: Syd
!  *
!  * Revision 5.2  1992/11/26  00:46:50  syd
!  * Fix how errno is used so err is inited and used instead
!  * as errno gets overwritten by print system call
!  * From: Syd
!  *
!  * Revision 5.1  1992/10/03  22:58:40  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** This routine implements a rather snazzy idea suggested by Warren
      Carithers of the Rochester Institute of Technology that allows
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: calendar.c,v 1.2 1998/10/20 19:58:15 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** This routine implements a rather snazzy idea suggested by Warren
      Carithers of the Rochester Institute of Technology that allows
***************
*** 67,74 ****
  		  "Error: wrong permissions to append to calendar %s\n",
  		  calendar_file));
  	  dprint(2, (debugfile, "** - %s **\n", error_description(err)));
! 	  error1(catgets(elm_msg_cat, ErrorSet, ErrorCalendarCanOpen,
! 		  "Not able to append to file %s!"), calendar_file);
  	  return; 
  	}
  
--- 50,58 ----
  		  "Error: wrong permissions to append to calendar %s\n",
  		  calendar_file));
  	  dprint(2, (debugfile, "** - %s **\n", error_description(err)));
! 	  lib_error(CATGETS(elm_msg_cat, ErrorSet, ErrorCalendarCanOpen,
! 			    "Not able to append to file %s!"), 
! 		    calendar_file);
  	  return; 
  	}
  
***************
*** 80,87 ****
  		"Error: couldn't append to calendar file %s (scan)\n", 
  		calendar_file));
  	  dprint(2, (debugfile, "** - %s **\n", error_description(err)));
! 	  error1(catgets(elm_msg_cat, ErrorSet, ErrorCalendarAppend,
! 		  "Couldn't append to file %s!"), calendar_file);
  	  return; 
  	}
  	
--- 64,72 ----
  		"Error: couldn't append to calendar file %s (scan)\n", 
  		calendar_file));
  	  dprint(2, (debugfile, "** - %s **\n", error_description(err)));
! 	  lib_error(CATGETS(elm_msg_cat, ErrorSet, ErrorCalendarAppend,
! 			    "Couldn't append to file %s!"), 
! 		    calendar_file);
  	  return; 
  	}
  	
***************
*** 93,106 ****
  
  	if (count > 0) {
  	  if (count > 1)
! 	    error1(catgets(elm_msg_cat, ErrorSet, ErrorCalendarSavedPlural,
! 		    "%d entries saved in calendar file."), count);
  	  else
! 	    error(catgets(elm_msg_cat, ErrorSet, ErrorCalendarSaved,
! 		    "1 entry saved in calendar file."));
  	} else 
! 	  error(catgets(elm_msg_cat, ErrorSet, ErrorCalendarNoneSaved,
! 		  "No calendar entries found in that message."));
  
  	return;
  }
--- 78,92 ----
  
  	if (count > 0) {
  	  if (count > 1)
! 	    lib_error(CATGETS(elm_msg_cat, ErrorSet, ErrorCalendarSavedPlural,
! 			      "%d entries saved in calendar file."), 
! 		      count);
  	  else
! 	    lib_error(CATGETS(elm_msg_cat, ErrorSet, ErrorCalendarSaved,
! 			      "1 entry saved in calendar file."));
  	} else 
! 	  lib_error(CATGETS(elm_msg_cat, ErrorSet, ErrorCalendarNoneSaved,
! 			    "No calendar entries found in that message."));
  
  	return;
  }
***************
*** 123,131 ****
         	  dprint(1,(debugfile, 
  		"ERROR: Attempt to seek %d bytes into file failed (%s)",
  		headers[current-1]->offset, "extract_info"));
!        	  error1(catgets(elm_msg_cat, ErrorSet, ErrorCalendarSeek,
! 		  "ELM [seek] failed trying to read %d bytes into file."),
! 	     	headers[current-1]->offset);
         	  return(0);
      	}
  
--- 109,117 ----
         	  dprint(1,(debugfile, 
  		"ERROR: Attempt to seek %d bytes into file failed (%s)",
  		headers[current-1]->offset, "extract_info"));
!        	  lib_error(CATGETS(elm_msg_cat, ErrorSet, ErrorCalendarSeek,
! 			    "ELM [seek] failed trying to read %d bytes into file."),
! 		    headers[current-1]->offset);
         	  return(0);
      	}
  
Index: elm2.4.ME+.50/src/curses.c
*** elm2.4.25/src/curses.c	Mon May 30 19:27:44 1994
--- elm2.4.ME+.50/src/curses.c	Tue Nov 17 21:14:09 1998
***************
*** 1,116 ****
  
! static char rcsid[] = "@(#)$Id: curses.c,v 5.18 1994/05/30 16:27:44 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.18 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
-  *******************************************************************************
-  * Bug reports, patches, comments, suggestions should be sent to:
-  *
-  *	Syd Weinstein, Elm Coordinator
-  *	elm@DSI.COM			dsinc!elm
-  *
-  *******************************************************************************
-  * $Log: curses.c,v $
-  * Revision 5.18  1994/05/30  16:27:44  syd
-  * There was a typo in src/curses.c. An include read out like
-  * "# include <vararg.h>" though the file name should have been
-  * varargs.h.
-  * From: Jukka Antero Ukkonen <ukkonen@csc.fi>
-  *
-  * Revision 5.17  1994/05/15  23:10:08  syd
-  * Below are the changes required to compile/link elm 2.4 pl23 under
-  * QNX 4.2 with the Watcom 9.5 compiler (very picky).
-  * From: "Brian Campbell" <brianc@quantum>
-  *
-  * Revision 5.16  1994/05/15  22:58:36  syd
-  * Tune the Ultrix fix for ispell
-  * From: Bill Gianopoulos <wag@sccux1.msd.ray.com>
-  *
-  * Revision 5.15  1994/05/15  22:55:25  syd
-  * I had to put in some changes to builtin+ to allow it to display
-  * 8-bit letters as they should when the message has been sent
-  * through a real 8-bit channel like ESMTP with 8bit MIME Content-
-  * Transfer-Encoding.
-  * From: Jukka Ukkonen <ukkonen@csc.fi>
-  *
-  * Revision 5.14  1994/03/11  20:45:03  syd
-  * fixed ReadCh() to recover from EINTR and EAGAIN instead
-  * of just returning an unexpected EOF.
-  * From: Jukka Ukkonen <ukkonen@csc.fi>
-  *
-  * Revision 5.13  1993/08/23  02:56:35  syd
-  * have Writechar() backspace over the left edge of the screen to the end
-  * of the previous line if the current line is not the first line on the
-  * screen.
-  * From: Jukka Ukkonen <ukkonen@csc.fi>
-  *
-  * Revision 5.12  1993/08/03  19:28:39  syd
-  * Elm tries to replace the system toupper() and tolower() on current
-  * BSD systems, which is unnecessary.  Even worse, the replacements
-  * collide during linking with routines in isctype.o.  This patch adds
-  * a Configure test to determine whether replacements are really needed
-  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
-  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
-  * there.  Inclusion of <ctype.h> was removed from *all* the individual
-  * files, and the toupper() and tolower() routines in lib/opt_utils.c
-  * were dropped.
-  * From: chip@chinacat.unicom.com (Chip Rosenthal)
-  *
-  * Revision 5.11  1993/07/20  02:13:20  syd
-  * Make tabspacing check for <= 0 so we dont get divide by
-  * zero errors when the termcap has tabspacing 0
-  * From: Syd via request from G A Smant
-  *
-  * Revision 5.10  1993/04/12  03:57:45  syd
-  * Give up and add an Ultrix specific patch. There is a bug in Ispell under
-  * ultrix.  The problem is that when ispell returns, the terminal is no
-  * longer in raw mode. (Ispell isn't restoring the terminal parameters)
-  * From: Scott Ames <scott@cwis.unomaha.edu>
-  *
-  * Revision 5.9  1993/02/03  19:06:31  syd
-  * Remove extra strchr/strcat/strcpy et al declarations
-  * From: Syd
-  *
-  * Revision 5.8  1992/12/11  01:45:04  syd
-  * remove sys/types.h include, it is now included by defs.h
-  * and this routine includes defs.h or indirectly includes defs.h
-  * From: Syd
-  *
-  * Revision 5.7  1992/11/07  20:45:39  syd
-  * add no tite flag on options that should not use ti/te
-  * Hack by Syd
-  *
-  * Revision 5.6  1992/10/27  15:46:35  syd
-  * Suns dont like ioctl on top of termios
-  * From: syd
-  *
-  * Revision 5.5  1992/10/27  01:52:16  syd
-  * Always include <sys/ioctl.h> in curses.c When calling ioctl()
-  *
-  * Remove declaration of getegid() from leavembox.c & lock.c
-  * They aren't even used there.
-  * From: tom@osf.org
-  *
-  * Revision 5.4  1992/10/24  13:35:39  syd
-  * changes found by using codecenter on Elm 2.4.3
-  * From: Graham Hudspith <gwh@inmos.co.uk>
-  *
-  * Revision 5.3  1992/10/17  22:58:57  syd
-  * patch to make elm use (or in my case, not use) termcap/terminfo ti/te.
-  * From: Graham Hudspith <gwh@inmos.co.uk>
   *
!  * Revision 5.2  1992/10/11  01:02:05  syd
!  * Add AIX to those who dont define window size in termios.h
!  * From: Syd via note from Tom Kovar
!  *
!  * Revision 5.1  1992/10/03  22:58:40  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /**  This library gives programs the ability to easily access the
       termcap information and write screen oriented and raw input
--- 1,17 ----
  
! static char rcsid[] = "@(#)$Id: curses.c,v 1.3 1998/11/15 19:11:19 hurtta Exp $";
  
! /*****************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.3 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
   *
!  *****************************************************************************/
  
  /**  This library gives programs the ability to easily access the
       termcap information and write screen oriented and raw input
***************
*** 126,137 ****
  **/
  
  #include "headers.h"
  
- #ifdef I_STDARG
- # include <stdarg.h>
- #else
- # include <varargs.h>
- #endif
  #ifdef TERMIOS
  # include <termios.h>
  # ifndef sun
--- 27,35 ----
  **/
  
  #include "headers.h"
+ #include <errno.h>
+ #include "me.h"
  
  #ifdef TERMIOS
  # include <termios.h>
  # ifndef sun
***************
*** 174,183 ****
  #define	ttgetattr(fd,where)	ioctl((fd),TCGETA,(where))
  #define	ttsetattr(fd,where)	ioctl((fd),TCSETAW,(where))
  # else
! struct sgttyb _raw_tty,
! 	      _original_tty;
! #define	ttgetattr(fd,where)	ioctl((fd),TIOCGETP,(where))
! #define	ttsetattr(fd,where)	ioctl((fd),TIOCSETP,(where))
  # endif	/*TERMIO*/
  #endif	/*TERMIOS*/
  
--- 72,83 ----
  #define	ttgetattr(fd,where)	ioctl((fd),TCGETA,(where))
  #define	ttsetattr(fd,where)	ioctl((fd),TCSETAW,(where))
  # else
! struct tty_modes {
!   struct sgttyb sgttyb;
!   struct tchars tchars;
! }  _raw_tty, _original_tty;
! static int ttgetattr P_((int,struct tty_modes *));  /* Prototype */
! static int ttsetattr P_((int,struct tty_modes *)); /* Prototype */
  # endif	/*TERMIO*/
  #endif	/*TERMIOS*/
  
***************
*** 190,206 ****
  static int _line  = -1,			/* initialize to "trash" */
             _col   = -1;
  
! static int _intransmit;			/* are we transmitting keys? */
  
  static
! char *_clearscreen, *_moveto, *_up, *_down, *_right, *_left,
!      *_setbold, *_clearbold, *_setunderline, *_clearunderline, 
!      *_sethalfbright, *_clearhalfbright, *_setinverse, *_clearinverse,
!      *_cleartoeoln, *_cleartoeos, *_transmit_on, *_transmit_off,
!      *_set_memlock, *_clear_memlock, *_start_termcap, *_end_termcap;
  
  static int _lines, _columns, _automargin, _eatnewlineglitch;
  int tabspacing;
  
  static char _terminal[1024];              /* Storage for terminal entry */
  static char _capabilities[1024];           /* String for cursor motion */
--- 90,113 ----
  static int _line  = -1,			/* initialize to "trash" */
             _col   = -1;
  
! static int _intransmit = -1;	        /* are we transmitting keys? */
  
  static
! char *_clearscreen = NULL, *_moveto = NULL, *_up = NULL, *_down = NULL, 
!   *_right = NULL, *_left = NULL, *_setbold = NULL, *_clearbold = NULL, 
!   *_setunderline = NULL, *_clearunderline = NULL, *_sethalfbright = NULL, 
!   *_clearhalfbright = NULL, *_setinverse = NULL, *_clearinverse = NULL,
!   *_cleartoeoln = NULL, *_cleartoeos = NULL, *_transmit_on = NULL, 
!   *_transmit_off = NULL, *_set_memlock = NULL, *_clear_memlock = NULL, 
!   *_start_termcap = NULL, *_end_termcap = NULL, *_bell = NULL,
! 
!   *_key_up = NULL, *_key_down = NULL, *_key_left = NULL, *_key_right = NULL,
!   *_key_pageup = NULL, *_key_pagedown = NULL, *_key_home = NULL, 
!   *_key_help = NULL, *_key_find = NULL;
  
  static int _lines, _columns, _automargin, _eatnewlineglitch;
  int tabspacing;
+ static int tabexpand = 0;          /* Is terminal driver expanding tabs? */
  
  static char _terminal[1024];              /* Storage for terminal entry */
  static char _capabilities[1024];           /* String for cursor motion */
***************
*** 207,212 ****
--- 114,122 ----
  
  static char *ptr = _capabilities;	/* for buffering         */
  
+ static int  cursor_control    = 0;
+ static int  need_moveabsolute = 0;
+ 
  int    outchar();			/* char output for tputs */
  char  *tgetstr(),     		       /* Get termcap capability */
        *tgoto();				/* and the goto stuff    */
***************
*** 225,232 ****
  	
  	if ((termenv = getenv("TERM")) == NULL) return(-1);
  
! 	if (strcpy(termname, termenv) == NULL)
! 		return(-1);
  
  	if ((err = tgetent(_terminal, termname)) != 1)
  		return(err-2);
--- 135,141 ----
  	
  	if ((termenv = getenv("TERM")) == NULL) return(-1);
  
! 	strfcpy(termname, termenv, sizeof termname);
  
  	if ((err = tgetent(_terminal, termname)) != 1)
  		return(err-2);
***************
*** 241,246 ****
--- 150,157 ----
  	_down              = tgetstr("do", &ptr);
  	_right             = tgetstr("nd", &ptr);
  	_left              = tgetstr("bc", &ptr);
+ 	_bell              = tgetstr("bl", &ptr);
+ 
  	_setbold           = tgetstr("so", &ptr);
  	_clearbold         = tgetstr("se", &ptr);
  	_setunderline      = tgetstr("us", &ptr);
***************
*** 263,329 ****
  	_start_termcap	   = tgetstr("ti", &ptr);
  	_end_termcap	   = tgetstr("te", &ptr);
  
  
! 	if (!_left) {
! 		_left = "\b";
  	}
  
! 	return(0);
! }
  
! char *return_value_of(termcap_label)
! char *termcap_label;
! {
! 	/** This will return the string kept by termcap for the 
! 	    specified capability. Modified to ensure that if 
! 	    tgetstr returns a pointer to a transient address	
! 	    that we won't bomb out with a later segmentation
! 	    fault (thanks to Dave@Infopro for this one!)
! 
! 	    Tweaked to remove padding sequences.
! 	 **/
! 
! 	static char escape_sequence[20];
! 	register int i=0,j=0;
! 	char buffer[20];
! 	char *myptr, *tgetstr();     		/* Get termcap capability */
! 
! 	if (strlen(termcap_label) < 2)
! 	  return(NULL);
! 
! 	if (termcap_label[0] == 's' && termcap_label[1] == 'o')
! 	  {
! 	  if (_setinverse)
! 	    strcpy(escape_sequence, _setinverse);
! 	  else
! 	    return( (char *) NULL );
! 	  }
! 	else if (termcap_label[0] == 's' && termcap_label[1] == 'e')
! 	  {
! 	  if (_clearinverse)
! 	    strcpy(escape_sequence, _clearinverse);
! 	  else
! 	    return( (char *) NULL );
! 	  }
! 	else if ((myptr = tgetstr(termcap_label, &ptr)) == NULL)
! 	  return( (char *) NULL );
! 	else
! 	  strcpy(escape_sequence, myptr);
! 
! 	if (chloc(escape_sequence, '$') != -1) {
! 	  while (escape_sequence[i] != '\0') {
! 	    while (escape_sequence[i] != '$' && escape_sequence[i] != '\0')
! 	      buffer[j++] = escape_sequence[i++];
! 	    if (escape_sequence[i] == '$') {
! 	      while (escape_sequence[i] != '>') i++;
! 	      i++;
! 	    }
! 	  }
! 	  buffer[j] = '\0';
! 	  strcpy(escape_sequence, buffer);
  	}
  
! 	return( (char *) escape_sequence);
  }
  
  transmit_functions(newstate)
--- 174,202 ----
  	_start_termcap	   = tgetstr("ti", &ptr);
  	_end_termcap	   = tgetstr("te", &ptr);
  
+ 	_key_up            = tgetstr("ku", &ptr);
+ 	_key_down          = tgetstr("kd", &ptr);
+ 	_key_left          = tgetstr("kl", &ptr);
+ 	_key_right         = tgetstr("kr", &ptr);
+ 	_key_pageup        = tgetstr("kP", &ptr);
+ 	_key_pagedown      = tgetstr("kN", &ptr);
+ 	_key_home          = tgetstr("kh", &ptr);
+ 	_key_help          = tgetstr("%1", &ptr);
+ 	_key_find          = tgetstr("@0", &ptr);
  
! 	if (_transmit_on && _transmit_off && _key_up && _key_down) {
! 	  cursor_control = TRUE;
  	}
  
! 	if (_setinverse && _clearinverse) {
! 	  has_highlighting = TRUE;
! 	}
  
! 	if (!_left) {
! 		_left = "\b";
  	}
  
! 	return(0);
  }
  
  transmit_functions(newstate)
***************
*** 332,338 ****
  	/** turn function key transmission to ON | OFF **/
  
  	if (newstate != _intransmit) {
! 		_intransmit = ! _intransmit;
  		if (newstate == ON)
  		  tputs(_transmit_on, 1, outchar);
  		else 
--- 205,211 ----
  	/** turn function key transmission to ON | OFF **/
  
  	if (newstate != _intransmit) {
! 		_intransmit = newstate;
  		if (newstate == ON)
  		  tputs(_transmit_on, 1, outchar);
  		else 
***************
*** 343,350 ****
  
  /****** now into the 'meat' of the routines...the cursor stuff ******/
  
! ScreenSize(lines, columns)
! int *lines, *columns;
  {
  	/** returns the number of lines and columns on the display. **/
  
--- 216,223 ----
  
  /****** now into the 'meat' of the routines...the cursor stuff ******/
  
! void ScreenSize(lines, columns)
!      int *lines, *columns;
  {
  	/** returns the number of lines and columns on the display. **/
  
***************
*** 362,368 ****
  	if (_lines == 0) _lines = DEFAULT_LINES_ON_TERMINAL;
  	if (_columns == 0) _columns = DEFAULT_COLUMNS_ON_TERMINAL;
  
! 	*lines = _lines - 1;		/* assume index from zero */
  	*columns = _columns;
  }
  
--- 235,259 ----
  	if (_lines == 0) _lines = DEFAULT_LINES_ON_TERMINAL;
  	if (_columns == 0) _columns = DEFAULT_COLUMNS_ON_TERMINAL;
  
! 
! 	/* WARNING: elm_LINES and elm_COLUMNS are inconsistent!
! 	 *
! 	 * elm_LINES    == number of lines in screen -1
! 	 * elm_COLUMNS  == number of rows in screen
! 	 *
! 	 *
! 	 * Check code in MoveCursor!
! 	 *
! 	 * row          == 0 .. elm_LINES
! 	 * col          == 0 .. elm_COLUMNS-1
! 	 *
! 	 *
! 	 * Who was this smart programmer!!!!!!!!!!!!!!!!!!!!!
! 	 *
! 	 *                         - K E H <hurtta@ozone.FMI.FI>
! 	 */
! 
! 	*lines = _lines - 1;	     
  	*columns = _columns;
  }
  
***************
*** 395,400 ****
--- 286,294 ----
  	_line = 0;	/* clear leaves us at top... */
  	_col  = 0;
  
+ 	redraw_screen = 0;
+ 	_intransmit = -1;   /* Re-set state */
+ 
  	if (!_clearscreen)
  		return(-1);
  
***************
*** 403,484 ****
  	return(0);
  }
  
! static
! CursorUp(n)
! int n;
  {
! 	/** move the cursor up 'n' lines **/
! 	/** Calling function must check that _up is not null before calling **/
  
! 	_line = (_line-n > 0? _line - n: 0);	/* up 'n' lines... */
  
! 	while (n-- > 0)
! 		tputs(_up, 1, outchar);
  
! 	fflush(stdout);
! 	return(0);
  }
  
  
! static
! CursorDown(n)
! int n;
  {
! 	/** move the cursor down 'n' lines **/
! 	/** Caller must check that _down is not null before calling **/
  
! 	_line = (_line+n <= LINES? _line + n: LINES);    /* down 'n' lines... */
  
! 	while (n-- > 0)
! 		tputs(_down, 1, outchar);
  
! 	fflush(stdout);
! 	return(0);
  }
  
  
! static
! CursorLeft(n)
! int n;
  {
  	/** move the cursor 'n' characters to the left **/
! 	/** Caller must check that _left is not null before calling **/
! 
! 	_col = (_col - n> 0? _col - n: 0);	/* left 'n' chars... */
! 
! 	while (n-- > 0)
! 		tputs(_left, 1, outchar);
  
! 	fflush(stdout);
! 	return(0);
  }
  
  
! static
! CursorRight(n)
! int n;
  {
! 	/** move the cursor 'n' characters to the right (nondestructive) **/
! 	/** Caller must check that _right is not null before calling **/
  
! 	_col = (_col+n < COLUMNS? _col + n: COLUMNS);	/* right 'n' chars... */
  
! 	while (n-- > 0)
! 		tputs(_right, 1, outchar);
  
! 	fflush(stdout);
! 	return(0);
  }
  
! static
! moveabsolute(col, row)
  {
  
! 	char *stuff, *tgoto();
  
! 	stuff = tgoto(_moveto, col, row);
! 	tputs(stuff, 1, outchar);
! 	fflush(stdout);
  }
  
  MoveCursor(row, col)
--- 297,397 ----
  	return(0);
  }
  
! static void moveabsolute P_((int col, int row));
! 
! static CursorUp(n)
!      int n;
  {
!   /** move the cursor up 'n' lines **/
!   /** Calling function must check that _up is not null before calling **/
  
!   if (need_moveabsolute)
!     moveabsolute(_col, _line);
  
!   _line = (_line-n > 0? _line - n: 0);	/* up 'n' lines... */
  
!   while (n-- > 0)
!     tputs(_up, 1, outchar);
! 
!   fflush(stdout);
!   return(0);
  }
  
  
! static CursorDown(n)
!      int n;
  {
!   /** move the cursor down 'n' lines **/
!   /** Caller must check that _down is not null before calling **/
  
!   if (need_moveabsolute)
!     moveabsolute(_col, _line);;
  
!   _line = (_line+n <= elm_LINES? _line + n: elm_LINES);    /* down 'n' lines... */
  
!   while (n-- > 0)
!     tputs(_down, 1, outchar);
!   
!   fflush(stdout);
!   return(0);
  }
  
  
! static CursorLeft(n)
!      int n;
  {
  	/** move the cursor 'n' characters to the left **/
!   /** Caller must check that _left is not null before calling **/
!   
!   if (need_moveabsolute)
!     moveabsolute(_col, _line);
  
!   _col = (_col - n> 0? _col - n: 0);	/* left 'n' chars... */
!   
!   while (n-- > 0)
!     tputs(_left, 1, outchar);
!   
!   fflush(stdout);
!   return(0);
  }
  
  
! static CursorRight(n)
!      int n;
  {
!   /** move the cursor 'n' characters to the right (nondestructive) **/
!   /** Caller must check that _right is not null before calling **/
!   
!   if (need_moveabsolute)
!     moveabsolute(_col, _line);
  
!   _col = (_col+n < elm_COLUMNS? _col + n: elm_COLUMNS);	
!   /* right 'n' chars... */
  
!   while (n-- > 0)
!     tputs(_right, 1, outchar);
  
!   fflush(stdout);
!   return(0);
  }
  
! static void moveabsolute(col, row)
!      int col, row;
  {
  
!   char *stuff, *tgoto();
  
!   if (need_moveabsolute) {
!     dprint(4,(debugfile,
! 	      "Curses: moveabsolute: Syncronizing cursos position (col=%d,row=%d)\n",
! 	      col,row));
!   }
! 
!   stuff = tgoto(_moveto, col, row);
!   tputs(stuff, 1, outchar);
!   fflush(stdout);
!   
!   need_moveabsolute = 0;
  }
  
  MoveCursor(row, col)
***************
*** 491,510 ****
  
  	/* we don't want to change "rows" or we'll mangle scrolling... */
  
  	if (col < 0)
  	  col = 0;
! 	if (col >= COLUMNS)
! 	  col = COLUMNS - 1;
  	if (row < 0)
  	  row = 0;
! 	if (row > LINES) {
  	  if (col == 0)
! 	    scrollafter = row - LINES;
! 	  row = LINES;
  	}
  
  	if (!_moveto)
! 		return(-1);
  
  	if (row == _line) {
  	  if (col == _col)
--- 404,426 ----
  
  	/* we don't want to change "rows" or we'll mangle scrolling... */
  
+ 	if (need_moveabsolute)
+ 	  moveabsolute(_col, _line);;
+ 
  	if (col < 0)
  	  col = 0;
! 	if (col >= elm_COLUMNS)
! 	  col = elm_COLUMNS - 1;
  	if (row < 0)
  	  row = 0;
! 	if (row > elm_LINES) {
  	  if (col == 0)
! 	    scrollafter = row - elm_LINES;
! 	  row = elm_LINES;
  	}
  
  	if (!_moveto)
! 	  return(-1);
  
  	if (row == _line) {
  	  if (col == _col)
***************
*** 543,550 ****
  
  	if (scrollafter) {
  	  putchar('\r');
! 	  while (scrollafter--)
  	    putchar('\n');
  	}
  
  	return(0);
--- 459,467 ----
  
  	if (scrollafter) {
  	  putchar('\r');
! 	  while (scrollafter--) {
  	    putchar('\n');
+ 	  }
  	}
  
  	return(0);
***************
*** 693,700 ****
  
  	if (! _memory_locked) {
  
! 	  _old_LINES = LINES;
! 	  LINES -= _line;		/* we can't use this for scrolling */
  
  	  tputs(_set_memlock, 1, outchar);
  	  fflush(stdout);
--- 610,617 ----
  
  	if (! _memory_locked) {
  
! 	  _old_LINES = elm_LINES;
! 	  elm_LINES -= _line;		/* we can't use this for scrolling */
  
  	  tputs(_set_memlock, 1, outchar);
  	  fflush(stdout);
***************
*** 713,719 ****
  	  return(-1);
  
  	if (_memory_locked) {
! 	  LINES = _old_LINES;		/* back to old setting */
    
  	  tputs(_clear_memlock, 1, outchar);
  	  fflush(stdout);
--- 630,636 ----
  	  return(-1);
  
  	if (_memory_locked) {
! 	  elm_LINES = _old_LINES;		/* back to old setting */
    
  	  tputs(_clear_memlock, 1, outchar);
  	  fflush(stdout);
***************
*** 732,737 ****
--- 649,657 ----
  	static int wrappedlastchar = 0;
  	int justwrapped, nt;
  
+ 	if (need_moveabsolute)
+ 	  moveabsolute(_col, _line);
+ 
  	ch &= 0xFF;
  	justwrapped = 0;
  
***************
*** 750,756 ****
  	else if (ch == '\n') {
  	  if (!wrappedlastchar) {
  	    putchar('\n');
! 	    if (_line < LINES)
  	      ++_line;
  	  }
  	}
--- 670,676 ----
  	else if (ch == '\n') {
  	  if (!wrappedlastchar) {
  	    putchar('\n');
! 	    if (_line < elm_LINES)
  	      ++_line;
  	  }
  	}
***************
*** 762,768 ****
  		_col--;
  	    }
  	    else if (_line > 0) {
! 		_col = COLUMNS - 1;
  		_line--;
  		moveabsolute (_col, _line);
  	    }
--- 682,688 ----
  		_col--;
  	    }
  	    else if (_line > 0) {
! 		_col = elm_COLUMNS - 1;
  		_line--;
  		moveabsolute (_col, _line);
  	    }
***************
*** 771,786 ****
  
  	/* if bell, ring the bell but don't advance the column */
  	else if (ch == '\007') {
! 	  putchar(ch);
  	}
  
  	/* if a tab, output it */
  	else if (ch == '\t') {
! 	  putchar(ch);
! 	  if((nt=next_tab(_col+1)) > prev_tab(COLUMNS))
! 	    _col = COLUMNS-1;
  	  else
  	    _col = nt-1;
  	}
  
  	else {
--- 691,713 ----
  
  	/* if bell, ring the bell but don't advance the column */
  	else if (ch == '\007') {
! 	  if (_bell)
! 	    tputs(_bell,1,outchar);
! 	  else
! 	    putchar(ch);
  	}
  
  	/* if a tab, output it */
  	else if (ch == '\t') {
! 	  /* If terminal driver is expanding tabs, don't trust it ... */
! 	  if (!tabexpand)
! 	    putchar(ch);
! 	  if((nt=next_tab(_col+1)) > prev_tab(elm_COLUMNS))
! 	    _col = elm_COLUMNS-1;
  	  else
  	    _col = nt-1;
+ 	  if (tabexpand)
+ 	    moveabsolute (_col, _line);
  	}
  
  	else {
***************
*** 788,806 ****
  #ifdef ASCII_CTYPE
  	  if(!isascii(ch) || !isprint(ch))
  #else
! 	  if(!isprint(ch) && !(ch & ~0x7f))
  #endif
  	    ch = '?';
  
  	  /* if we only have one column left, simulate automargins if
  	   * the terminal doesn't have them */
! 	  if (_col == COLUMNS - 1) {
  	    putchar(ch);
  	    if (!_automargin || _eatnewlineglitch) {
  	      putchar('\r');
  	      putchar('\n');
  	    }
! 	    if (_line < LINES)
  	      ++_line;
  	    _col = 0;
  	    justwrapped = 1;
--- 715,733 ----
  #ifdef ASCII_CTYPE
  	  if(!isascii(ch) || !isprint(ch))
  #else
! 	  if(!isprint((unsigned char)ch))
  #endif
  	    ch = '?';
  
  	  /* if we only have one column left, simulate automargins if
  	   * the terminal doesn't have them */
! 	  if (_col == elm_COLUMNS - 1) {
  	    putchar(ch);
  	    if (!_automargin || _eatnewlineglitch) {
  	      putchar('\r');
  	      putchar('\n');
  	    }
! 	    if (_line < elm_LINES)
  	      ++_line;
  	    _col = 0;
  	    justwrapped = 1;
***************
*** 822,873 ****
  
  /*VARARGS2*/
  
! #ifdef	I_STDARG
! Write_to_screen(char *line, int argcount, ...)
! {
! 	char *arg1, *arg2, *arg3;
! 	va_list vl;
! 	va_start(vl, argcount);
  #else
! Write_to_screen(line, argcount, va_alist)
! char *line;
! int   argcount; 
! va_dcl
! {
! 	char *arg1, *arg2, *arg3;
! 	va_list vl;
! 	va_start(vl);
  #endif
  
  	/** This routine writes to the screen at the current location.
    	    when done, it increments lines & columns accordingly by
  	    looking for "\n" sequences... **/
  
! 	switch (argcount) {
! 	case 0 :
! 		PutLine0(_line, _col, line);
! 		break;
! 	case 1 :
! 		arg1 = va_arg(vl, char *);
! 		PutLine1(_line, _col, line, arg1);
! 		break;
! 	case 2 :
! 		arg1 = va_arg(vl, char *);
! 		arg2 = va_arg(vl, char *);
! 		PutLine2(_line, _col, line, arg1, arg2);
! 		break;
! 	case 3 :
! 		arg1 = va_arg(vl, char *);
! 		arg2 = va_arg(vl, char *);
! 		arg3 = va_arg(vl, char *);
! 		PutLine3(_line, _col, line, arg1, arg2, arg3);
! 		break;
! 	}
  }
  
! PutLine0(x, y, line)
! int x,y;
! register char *line;
  {
  	/** Write a zero argument line at location x,y **/
  
--- 749,786 ----
  
  /*VARARGS2*/
  
! void Write_to_screen (
! #if ANSI_C
! 		      const char *format, const char *msg, ...
  #else
! 		      format, msg, va_alist
  #endif
+ 		      )
+ #if !ANSI_C
+      const char *format; 
+      const char *msg;
+      va_dcl
+ #endif
+ {
+   	va_list vl;
+ 	char *text;
  
+ 	Va_start(vl, msg);           /* defined in defs.h */
+ 
  	/** This routine writes to the screen at the current location.
    	    when done, it increments lines & columns accordingly by
  	    looking for "\n" sequences... **/
  
! 	text = elm_vmessage(0,format,msg,vl);
! 	PutLine0(_line, _col, text);
! 	free(text);
! 
! 	va_end(vl);
  }
  
! void PutLine0(x, y, line)
!      int x,y;
!      const char *line;
  {
  	/** Write a zero argument line at location x,y **/
  
***************
*** 877,934 ****
  	fflush(stdout);
  }
  
! /*VARARGS2*/
! PutLine1(x,y, line, arg1)
! int x,y;
! char *line;
! char *arg1;
! {
! 	/** write line at location x,y - one argument... **/
! 
! 	char buffer[VERY_LONG_STRING];
! 
! 	sprintf(buffer, line, arg1);
! 
! 	PutLine0(x, y, buffer);
!         fflush(stdout);
! }
! 
! /*VARARGS2*/
! PutLine2(x,y, line, arg1, arg2)
! int x,y;
! char *line;
! char *arg1, *arg2;
! {
! 	/** write line at location x,y - one argument... **/
! 
! 	char buffer[VERY_LONG_STRING];
! 
! 	MCsprintf(buffer, line, arg1, arg2);
! 
! 	PutLine0(x, y, buffer);
!         fflush(stdout);
! }
! 
! /*VARARGS2*/
! PutLine3(x,y, line, arg1, arg2, arg3)
! int x,y;
! char *line;
! char *arg1, *arg2, *arg3;
  {
! 	/** write line at location x,y - one argument... **/
  
! 	char buffer[VERY_LONG_STRING];
  
! 	MCsprintf(buffer, line, arg1, arg2, arg3);
  
! 	PutLine0(x, y, buffer);
!         fflush(stdout);
  }
  
! CleartoEOLN()
  {
  	/** clear to end of line **/
  
  	if (!_cleartoeoln)
  		return(-1);
  
--- 790,829 ----
  	fflush(stdout);
  }
  
! void PutLineX(
! #if ANSI_C
!      int x, int y, const char *format, const char *line, ...
! #else
!      x, y, format, line, va_alist
! #endif
!      )
! #if !ANSI_C
!      int x; 
!      int y; 
!      const char *format; 
!      const char *line; 
!      va_dcl
! #endif
  {
!   	va_list vl;
! 	char *text;
  
! 	Va_start(vl, line);           /* defined in defs.h */
  
! 	text = elm_vmessage(0,format,line,vl);
! 	PutLine0(x, y, text);
! 	free(text);
  
! 	va_end(vl);
  }
  
! int CleartoEOLN()
  {
  	/** clear to end of line **/
  
+ 	if (need_moveabsolute)
+ 	  moveabsolute(_col, _line);
+ 
  	if (!_cleartoeoln)
  		return(-1);
  
***************
*** 941,946 ****
--- 836,844 ----
  {
  	/** clear to end of screen **/
  
+ 	if (need_moveabsolute)
+ 	  moveabsolute(_col, _line);
+ 
  	if (!_cleartoeos)
  		return(-1);
  
***************
*** 973,981 ****
--- 871,888 ----
  
  	state = state & ~NO_TITE;
  
+ 	dprint(4,(debugfile,
+ 		  "curses: Raw: state=%d do_tite=%d\n",state,do_tite));
+ 
  	/** state is either ON or OFF, as indicated by call **/
  
  	if (state == OFF && _inraw) {
+ 	  dprint(4,(debugfile,
+ 		    "curses: Raw: Setting Raw state OFF\n"));;
+ 
+ 	  if (cursor_control)
+ 	    transmit_functions(OFF);
+ 
  	  if (use_tite && _end_termcap && do_tite) {
  	    tputs(_end_termcap, 1, outchar);
  	    fflush(stdout);
***************
*** 985,990 ****
--- 892,900 ----
  	}
  	else if (state == ON && ! _inraw) {
  
+ 	  dprint(4,(debugfile,
+ 		    "curses: Raw: Setting Raw state ON\n"));;
+ 
  	  (void) ttgetattr(TTYIN, &_original_tty);
  	  (void) ttgetattr(TTYIN, &_raw_tty);    /** again! **/
  
***************
*** 991,996 ****
--- 901,907 ----
  #if !defined(TERMIO) && !defined(TERMIOS)
  	  _raw_tty.sg_flags &= ~(ECHO);	/* echo off */
  	  _raw_tty.sg_flags |= CBREAK;	/* raw on    */
+ 
  #else
  	  _raw_tty.c_lflag &= ~(ICANON | ECHO);	/* noecho raw mode        */
  
***************
*** 997,1034 ****
  	  _raw_tty.c_cc[VMIN] = '\01';	/* minimum # of chars to queue    */
  	  _raw_tty.c_cc[VTIME] = '\0';	/* minimum time to wait for input */
  
  #endif
  	  (void) ttsetattr(TTYIN, &_raw_tty);
! 	  if (use_tite && _start_termcap && do_tite)
  	    tputs(_start_termcap, 1, outchar);
  	  _inraw = 1;
  	}
  }
  
! int
! ReadCh()
  {
!     /*
!      *	read a character with Raw mode set!
!      *
!      *	EAGAIN & EWOULDBLOCK are recognized just in case
!      *	O_NONBLOCK happens to be in effect.
!      */
  
!     register int    result;
      unsigned char   ch;
  
!     while (((result = read(0, &ch, 1)) < 0)
! 	   && ((errno == EINTR)
  #ifdef	EAGAIN
! 	       || (errno == EAGAIN)
  #endif
  #ifdef	EWOULDBLOCK
! 	       || (errno == EWOULDBLOCK)
  #endif
-     ));
  
!     return((result <= 0 ) ? EOF : ch);
  }
  
  outchar(c)
--- 908,1195 ----
  	  _raw_tty.c_cc[VMIN] = '\01';	/* minimum # of chars to queue    */
  	  _raw_tty.c_cc[VTIME] = '\0';	/* minimum time to wait for input */
  
+ 
+ #if defined(OXTABS)
+ 	  /* Some systems use OXTABS bit */
+ 	  if (_raw_tty.c_oflag & OXTABS) {
+ 	    dprint(4,(debugfile,
+ 		      "curses: [OXTABS] Terminal driver is expanding tabs...\n"));
+ 	    tabexpand = 1;
+ 	  } else {
+ 	    if (tabexpand) 	      
+ 	      dprint(4,(debugfile,
+ 			"curses: [OXTABS] Terminal driver isn't expanding tabs...\n"));
+ 	    tabexpand = 0;
+ 	  }
+ #endif /* defined(OXTABS) */
+ 
+ #if defined(TABDLY) && !defined(OXTABS)
+ 	  /* Some systems expands tab when TABDLY is XTABS */
+ 	  if ((_raw_tty.c_oflag & TABDLY) == 
+ #ifdef XTABS
+ 	      XTABS
+ #else
+ 	      TAB3
+ #endif
+ 	      ) {
+ 	    dprint(4,(debugfile,
+ 		      "curses: [TABDLY] Terminal driver is expanding tabs...\n"));
+ 	    tabexpand = 1;
+ 	  } else {
+ 	    if (tabexpand) 
+ 	      dprint(4,(debugfile,
+ 			"curses: [TABDLY] Terminal driver isn't expanding tabs...\n"));
+ 	    tabexpand = 0;
+ 	  }
+ #endif /* defined(TABDLY) && !defined(OXTABS) */
+ 
+ #if !defined(TABDLY) && !defined(OXTABS)
+ 
+ 	  /* If _POSIX_SOURCE is defined then OXTABS or TABDLY are not 
+ 	   * defined -- so print warning anyway
+ 	   */
+ 	  dprint(4,(debugfile,
+ 		    "curses: No information is terminal driver expanding tabs!\n"));	  
+ #endif /* !defined(TABDLY) && !defined(OXTABS) */
+ 
  #endif
  	  (void) ttsetattr(TTYIN, &_raw_tty);
! 	  if (use_tite && _start_termcap && do_tite) 
  	    tputs(_start_termcap, 1, outchar);
+ 	  _intransmit = -1; /* state unclear */
  	  _inraw = 1;
+ 	  need_moveabsolute = 1;
  	}
  }
  
! #if !defined(TERMIO) && !defined(TERMIOS)
! static int ttgetattr(fd, where)
!      int fd;
!      struct tty_modes *where;
! {
!   if (ioctl(fd, TIOCGETP, &where->sgttyb) < 0)
!     return(-1);
!   if (ioctl(fd, TIOCGETC, &where->tchars) < 0)
!     return(-1);
!   return(0);
! }
! 
! static int ttsetattr(fd, where)
!      int fd;
!      struct tty_modes *where;
! {
!   if (ioctl(fd, TIOCSETP, &where->sgttyb) < 0)
!     return(-1);
!   if (ioctl(fd, TIOCSETC, &where->tchars) < 0)
!     return(-1);
!   return(0);
! }
! #endif
! 
! int ReadCh(flags)
!      int flags;
  {
!   int redraw      = (flags & READCH_MASK);
!   int cursorkeys  = (flags & READCH_CURSOR) != 0;
!   int nocursor    = (flags & READCH_NOCURSOR) != 0 && cursor_control;
! 
! #ifdef DEBUG
!   unsigned char debug_buffer[20];
! #endif
! 
!   /*
!    *	read a character with Raw mode set!
!    *
!    *	EAGAIN & EWOULDBLOCK are recognized just in case
!    *	O_NONBLOCK happens to be in effect.
!    */
  
!   /* This is static array so we can initialize it in here ...
!    */
!   static struct {
!     char ** const str;
!     const int result;
!     int maybe;
!   } keytable[] =
!     { { &_key_up,       UP_MARK,       0 },
!       { &_key_down,     DOWN_MARK,     0 },
!       { &_key_left,     LEFT_MARK,     0 },
!       { &_key_right,    RIGHT_MARK,    0 },
! 
!       { &_key_pageup,   PAGEUP_MARK,   0 },
!       { &_key_pagedown, PAGEDOWN_MARK, 0 },
! 
!       { &_key_home,     HOME_MARK,     0 },
!       { &_key_help,     HELP_MARK,     0 },
!       { &_key_find,     FIND_MARK,     0 },
!       { NULL,           0,             0 }
!     };
!     
!   int read_p,found_key;
! 
! reinit_ReadChar:
!   read_p = 0;
!   found_key = 0;
! 
!   fflush(stdout);
! 
!   if (redraw && !RawState()) { /* Check that we have in 'raw' mode */
!     dprint(4,(debugfile,
! 	      "ReadCh: Going to Raw mode\n"));
!     Raw(ON);
!     ClearScreen();
!     return redraw;
!   }
! 
!   if (redraw && redraw_screen) {
!     dprint(4,(debugfile,
! 	      "ReadCh: Pending redraw...\n"));
!     ClearScreen();
!     return redraw;
!   }
!   
!   if ((_intransmit != ON || redraw_screen) &&
!        cursorkeys && _transmit_on) {
!     dprint(4,(debugfile,
! 	      "ReadCh: Enabling cursor keys...\n"));
!     transmit_functions(ON);
!   }
! 
!   if ((_intransmit != OFF || redraw_screen) &&
!       nocursor && _transmit_off) {
!     dprint(4,(debugfile,
! 	      "ReadCh: Disabling cursor keys...\n"));
!     transmit_functions(OFF);
!   }
! 
!   if (cursorkeys) {
!     int i;
!     dprint(8,(debugfile,
! 	      "ReadCh: Available function keys:"));
! 
!     for (i = 0; keytable[i].str != 0; i++) {
!       char * const str = *(keytable[i].str);
!       if(str && str[0] != '\0') {
! 	keytable[i].maybe = 1;  /* Initially ewery function key is possible */
! 	dprint(8,(debugfile,
! 		  " [%d] %d",i,keytable[i].result));
! 
!       }
!     }      
!     dprint(8,(debugfile,
! 	      "\n"));
!   }
! 
!   while (found_key == 0) {
!     int    result;
      unsigned char   ch;
+     
+     result = read(0, &ch, 1);
  
!     if (result < 0) {
!       int err = errno;
!       dprint(4,(debugfile,
! 		"ReadCh: errno = %d [%s]\n",err,
! 		error_description(err)));
! 
!       /* Return error: */
!       if (redraw && redraw_screen
! 	  || InGetPrompt   /* GetPrompt wants to see errors! */
! 	  ) {
! 	found_key = -1;
! 	continue;
!       }
!       if((errno == EINTR)
  #ifdef	EAGAIN
! 	 || (errno == EAGAIN)
  #endif
  #ifdef	EWOULDBLOCK
! 	 || (errno == EWOULDBLOCK)
! #endif
! 	 ) {
! 	continue;  /* Retry */
!       }
!     }
!     if (0 == result) {
!       dprint(4,(debugfile,
! 		"ReadCh: Got zero bytes...\n"));
!       found_key = -1;
!       continue;
!     }
! 
!     if (cursorkeys) {
!       int match = 0;
!       int i;
!       for (i = 0; keytable[i].str != NULL; i++) {
! 	if (keytable[i].maybe) {
! 	  unsigned char * const str = 
! 	    (unsigned char * const) *(keytable[i].str);
! 	  if (str[read_p] == ch) {
! 	    match++;
! 	    if (str[read_p+1] == '\0') {
! 	      found_key = keytable[i].result;
! 	      dprint(4,(debugfile,
! 			"ReadCh: Found function key = %d (keytable = %d, read_p =%d)\n",
! 			found_key,i,read_p));
! 	    }
! 	  } else {
! 	    keytable[i].maybe = 0;
! 	  }
! 	}
!       }
! #ifdef DEBUG
!       if (read_p < sizeof debug_buffer -1) {
! 	debug_buffer[read_p] = ch;
! 	debug_buffer[read_p+1] = '\0';
!       }
! #endif 
!       if (match == 0) {    /* Not in keytable */
! 	if (read_p == 0) 
! 	  found_key = ch;  /* Normal key */
! 	else {
! 	  int i;
! 	  dprint(4,(debugfile,
! 		    "ReadCh: Bad escape sequence; ch = %d, read_p = %d\n",
! 		    ch,read_p));
! #ifdef DEBUG
! 	  dprint(4,(debugfile,"ReadCh: Sequence was:"));
! 	  for (i = 0; i <= read_p && i < sizeof debug_buffer -1; i++) {
! 	    if (isascii(debug_buffer[i]) && isprint(debug_buffer[i])) {
! 	      dprint(4,(debugfile," %c (0x%02X)", 
! 			debug_buffer[i],debug_buffer[i]));
! 	    } else {
! 	      dprint(4,(debugfile," 0x%02X", debug_buffer[i]));
! 	    }
! 	  }
! 	  if (read_p > sizeof debug_buffer -1)
! 	    dprint(4,(debugfile," ..."));
! 	  dprint(4,(debugfile,"\n"));
  #endif
  
! 	  /* Ring a bell */
! 	  Writechar('\007');
! 	  goto reinit_ReadChar;
! 	}
!       } else
! 	read_p++;
!     } else
!       found_key = ch;
!     
!   }
! 
!   if (found_key <= 0 && redraw && redraw_screen) {
!     dprint(4,(debugfile,
! 	      "ReadCh: Redraw...\n"));
!     if(!RawState()) {  /* Check that we have in 'raw' mode */
!       dprint(4,(debugfile,
! 		"ReadCh: Going to Raw mode\n"));
!       Raw(ON);      
!     }
!     ClearScreen();
!     return redraw;
!   }
!   
!   return found_key;
  }
  
  outchar(c)
***************
*** 1039,1042 ****
  
  	putc(c, stdout);
  }
- 
--- 1200,1202 ----
Index: elm2.4.ME+.50/src/date.c
*** elm2.4.25/src/date.c	Tue Aug  3 22:29:03 1993
--- elm2.4.ME+.50/src/date.c	Tue Nov 17 21:12:57 1998
***************
*** 1,49 ****
  
! static char rcsid[] = "@(#)$Id: date.c,v 5.5 1993/08/03 19:28:39 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: date.c,v $
!  * Revision 5.5  1993/08/03  19:28:39  syd
!  * Elm tries to replace the system toupper() and tolower() on current
!  * BSD systems, which is unnecessary.  Even worse, the replacements
!  * collide during linking with routines in isctype.o.  This patch adds
!  * a Configure test to determine whether replacements are really needed
!  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
!  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
!  * there.  Inclusion of <ctype.h> was removed from *all* the individual
!  * files, and the toupper() and tolower() routines in lib/opt_utils.c
!  * were dropped.
!  * From: chip@chinacat.unicom.com (Chip Rosenthal)
!  *
!  * Revision 5.4  1992/12/11  01:45:04  syd
!  * remove sys/types.h include, it is now included by defs.h
!  * and this routine includes defs.h or indirectly includes defs.h
!  * From: Syd
!  *
!  * Revision 5.3  1992/12/07  02:57:09  syd
!  * convert long to time_t where relevant
!  * From: Syd via prompting from Jim Brown
!  *
!  * Revision 5.2  1992/11/15  02:10:11  syd
!  * remove no longer used tzname
!  * From: Syd
!  *
!  * Revision 5.1  1992/10/03  22:58:40  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** return the current date and time in a readable format! **/
  /** also returns an ARPA RFC-822 format date...            **/
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: date.c,v 1.3 1998/10/23 20:31:37 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.3 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** return the current date and time in a readable format! **/
  /** also returns an ARPA RFC-822 format date...            **/
***************
*** 50,63 ****
  
  
  #include "headers.h"
  
! #ifdef I_TIME
! #  include <time.h>
! #endif
! #ifdef I_SYSTIME
! #  include <sys/time.h>
! #endif
! #ifdef BSD
  #  include <sys/timeb.h>
  #endif
  
--- 17,25 ----
  
  
  #include "headers.h"
+ #include "me.h"
  
! #ifdef BSD_TYPE
  #  include <sys/timeb.h>
  #endif
  
***************
*** 84,92 ****
  int  days_in_month[] = { 31,    28,    31,    30,    31,     30, 
  		  31,     31,    30,   31,    30,     31,  -1};
  
! days_ahead(days, buffer)
! int days;
! char *buffer;
  {
  	/** return in buffer the date (Day, Mon Day, Year) of the date
  	    'days' days after today.  
--- 46,55 ----
  int  days_in_month[] = { 31,    28,    31,    30,    31,     30, 
  		  31,     31,    30,   31,    30,     31,  -1};
  
! void days_ahead(days, buffer, size)
!      int days;
!      char *buffer;
!      int size;
  {
  	/** return in buffer the date (Day, Mon Day, Year) of the date
  	    'days' days after today.  
***************
*** 95,138 ****
  	struct tm *the_time;		/* Time structure, see CTIME(3C) */
  	time_t	   junk;		/* time in seconds....		 */
  
! 	junk = time((time_t *) 0);	/* this must be here for it to work! */
! 	the_time = localtime(&junk);
  
! 	/* increment the day of the week */
  
- 	the_time->tm_wday = (the_time->tm_wday + days) % 7;
  
! 	/* the day of the month... */
! 	the_time->tm_mday += days;
! 	
!         while (the_time->tm_mday > days_in_month[the_time->tm_mon]) {
!           if (the_time->tm_mon == FEB && leapyear(the_time->tm_year)) {
!             if (the_time->tm_mday > DAYS_IN_LEAP_FEB) {
!               the_time->tm_mday -= DAYS_IN_LEAP_FEB;
!               the_time->tm_mon += 1;
!             }
!             else
!               break;            /* Is Feb 29, so leave */
!           }
!           else {
!             the_time->tm_mday -= days_in_month[the_time->tm_mon];
!             the_time->tm_mon += 1;
!           }
! 
!           /* check the month of the year */
!           if (the_time->tm_mon > MONTHS_IN_YEAR) {
!             the_time->tm_mon -= (MONTHS_IN_YEAR + 1);
!             the_time->tm_year += 1;
!           }
!         }
!   
!         /* now, finally, build the actual date string */
! 
! 	sprintf(buffer, "%s, %d %s %d",
! 	  arpa_dayname[the_time->tm_wday],
! 	  the_time->tm_mday % 32,
! 	  arpa_monname[the_time->tm_mon],
! 	  the_time->tm_year % 100);
  }
  
  int
--- 58,75 ----
  	struct tm *the_time;		/* Time structure, see CTIME(3C) */
  	time_t	   junk;		/* time in seconds....		 */
  
! 	junk = time((time_t *) 0);
  
! 	junk += days * 24 * 60 *60;
! 	the_time = localtime(&junk);
  
  
! 	elm_sfprintf(buffer, size,
! 		    FRM("%s, %d %s %d"),
! 		    arpa_dayname[the_time->tm_wday],
! 		    the_time->tm_mday,
! 		    arpa_monname[the_time->tm_mon],
! 		    1900+the_time->tm_year);
  }
  
  int
***************
*** 177,206 ****
  	static char buffer[SLEN];	/* static character buffer       */
  	struct tm *the_time;		/* Time structure, see CTIME(3C) */
  
- #ifdef BSD
- 	struct  timeval  time_val;		
- 	struct  timezone time_zone;
- 	long	   junk;		/* time in seconds....		 */
- #else
  	time_t	   junk;		/* time in seconds....		 */
- #endif
  
! #ifdef BSD
! 	gettimeofday(&time_val, &time_zone);
! 	junk = time_val.tv_sec;
! #else
! 	junk = time((time_t *) 0);	/* this must be here for it to work! */
! #endif
  	the_time = localtime(&junk);
  
! 	sprintf(buffer, "%s %s %d %02d:%02d:%02d %d",
! 	  arpa_dayname[the_time->tm_wday],
! 	  arpa_monname[the_time->tm_mon],
! 	  the_time->tm_mday % 32,
! 	  min(the_time->tm_hour % 24, (rand() % 24)),
! 	  min(abs(the_time->tm_min  % 61 - (rand() % 60)), (rand() % 60)),
! 	  min(abs(the_time->tm_sec  % 61 - (rand() % 60)), (rand() % 60)),
! 	  the_time->tm_year % 100 + 1900);
  	
  	return( (char *) buffer);
  }
--- 114,136 ----
  	static char buffer[SLEN];	/* static character buffer       */
  	struct tm *the_time;		/* Time structure, see CTIME(3C) */
  
  	time_t	   junk;		/* time in seconds....		 */
  
! 	junk = time((time_t *) 0);	
! 
! 	junk -= 500 * rand();
! 
  	the_time = localtime(&junk);
  
! 	elm_sfprintf(buffer, sizeof buffer,
! 		     FRM("%s %s %d %02d:%02d:%02d %d"),
! 		     arpa_dayname[the_time->tm_wday],
! 		     arpa_monname[the_time->tm_mon],
! 		     the_time->tm_mday,
! 		     the_time->tm_hour,
! 		     the_time->tm_min,
! 		     the_time->tm_sec,
! 		     the_time->tm_year + 1900);
  	
  	return( (char *) buffer);
  }
***************
*** 208,229 ****
  #endif
  
  char *
! elm_date_str(buf, seconds)
! char *buf;
! time_t seconds;
  {
  	struct tm *tmbuf;
  
  	tmbuf = gmtime(&seconds);
  
! 	sprintf(buf, "%s %d, %d %2.2d:%2.2d:%2.2d %s",
! 	    arpa_monname[tmbuf->tm_mon],
! 	    tmbuf->tm_mday,
! 	    tmbuf->tm_year % 100,
! 	    ampm(tmbuf->tm_hour),
! 	    tmbuf->tm_min,
! 	    tmbuf->tm_sec,
! 	    am_or_pm(tmbuf->tm_hour));
  
  	return(buf);
  }
--- 138,161 ----
  #endif
  
  char *
! elm_date_str(buf, seconds, size)
!      char *buf;
!      time_t seconds;
!      int size;
  {
  	struct tm *tmbuf;
  
  	tmbuf = gmtime(&seconds);
  
! 	elm_sfprintf(buf, size,
! 		     FRM("%s %d, %d %02d:%02d:%02d %s"),
! 		     arpa_monname[tmbuf->tm_mon],
! 		     tmbuf->tm_mday,
! 		     tmbuf->tm_year+1900,
! 		     ampm(tmbuf->tm_hour),
! 		     tmbuf->tm_min,
! 		     tmbuf->tm_sec,
! 		     am_or_pm(tmbuf->tm_hour));
  
  	return(buf);
  }
***************
*** 236,241 ****
  
  	seconds = entry->time_sent + entry->tz_offset;
  	tmbuf = gmtime(&seconds);
! 	sprintf(entry->time_menu, "%3.3s %-2d",
! 	    arpa_monname[tmbuf->tm_mon], tmbuf->tm_mday);
  }
--- 168,174 ----
  
  	seconds = entry->time_sent + entry->tz_offset;
  	tmbuf = gmtime(&seconds);
! 	elm_sfprintf(entry->time_menu, sizeof entry->time_menu,
! 		     FRM("%3.3s %-2d"),
! 		     arpa_monname[tmbuf->tm_mon], tmbuf->tm_mday);
  }
Index: elm2.4.ME+.50/src/delete.c
*** elm2.4.25/src/delete.c	Sun Oct  4 01:58:49 1992
--- elm2.4.ME+.50/src/delete.c	Tue Nov 17 21:12:57 1998
***************
*** 1,24 ****
  
! static char rcsid[] = "@(#)$Id: delete.c,v 5.1 1992/10/03 22:58:40 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
-  *******************************************************************************
-  * Bug reports, patches, comments, suggestions should be sent to:
-  *
-  *	Syd Weinstein, Elm Coordinator
-  *	elm@DSI.COM			dsinc!elm
-  *
-  *******************************************************************************
-  * $Log: delete.c,v $
-  * Revision 5.1  1992/10/03  22:58:40  syd
-  * Initial checkin as of 2.4 Release at PL0
-  *
   *
!  ******************************************************************************/
  
  /**  Delete or undelete files: just set flag in header record! 
       Also tags specified message(s)...
--- 1,17 ----
  
! static char rcsid[] = "@(#)$Id: delete.c,v 1.2 1998/10/20 19:58:15 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
   *
!  *****************************************************************************/
  
  /**  Delete or undelete files: just set flag in header record! 
       Also tags specified message(s)...
***************
*** 40,47 ****
  	if (real_del) {
  	  if (inalias) {
  	    if (aliases[current-1]->type & SYSTEM)
! 	      error(catgets(elm_msg_cat, ElmSet, ElmNoDelSysAlias,
! 		"Can't delete a system alias!"));
  	    else
  	      setit(aliases[current-1]->status, DELETED);
  	  }
--- 33,40 ----
  	if (real_del) {
  	  if (inalias) {
  	    if (aliases[current-1]->type & SYSTEM)
! 	      lib_error(CATGETS(elm_msg_cat, ElmSet, ElmNoDelSysAlias,
! 				"Can't delete a system alias!"));
  	    else
  	      setit(aliases[current-1]->status, DELETED);
  	  }
***************
*** 51,58 ****
  	else {
  	  if (inalias) {
  	    if (aliases[current-1]->type & SYSTEM)
! 	      error(catgets(elm_msg_cat, ElmSet, ElmNoDelSysAlias,
! 		"Can't delete a system alias!"));
  	    else if (ison(aliases[current-1]->status, DELETED))
  	      clearit(aliases[current-1]->status, DELETED);
  	    else
--- 44,51 ----
  	else {
  	  if (inalias) {
  	    if (aliases[current-1]->type & SYSTEM)
! 	      lib_error(CATGETS(elm_msg_cat, ElmSet, ElmNoDelSysAlias,
! 				"Can't delete a system alias!"));
  	    else if (ison(aliases[current-1]->status, DELETED))
  	      clearit(aliases[current-1]->status, DELETED);
  	    else
***************
*** 89,96 ****
  
  	char tempbuf[3];
  
! 	strcpy(tempbuf, show_status(ifmain(headers[msg]->status,
! 	                                   aliases[msg]->status)));
  
  	if (on_page(msg)) {
  	  MoveCursor(((compute_visible(msg+1)-1) % headers_per_page) + 4, 2);
--- 82,91 ----
  
  	char tempbuf[3];
  
! 	strfcpy(tempbuf, show_status(ifmain(headers[msg]->status,
! 					    aliases[msg]->status),
! 				     ifmain(headers[msg], NULL)),
! 		sizeof tempbuf);
  
  	if (on_page(msg)) {
  	  MoveCursor(((compute_visible(msg+1)-1) % headers_per_page) + 4, 2);
***************
*** 163,179 ****
  	if (on_page(msg)) 
  	  if (msg+1 == current && !arrow_cursor) {
  	    StartBold();
! 	    PutLine2(((compute_visible(msg+1)-1) % headers_per_page) + 4,
! 		   2, "%s%c", show_status(ifmain(headers[msg]->status,
! 		                                 aliases[msg]->status)),
! 		   ison(ifmain(headers[msg]->status,
! 		               aliases[msg]->status), TAGGED )? '+' : ' ');
  	    EndBold();
  	  }
  	  else
! 	    PutLine2(((compute_visible(msg+1)-1) % headers_per_page) + 4,
! 		   2, "%s%c", show_status(ifmain(headers[msg]->status,
! 		                                 aliases[msg]->status)),
! 		   ison(ifmain(headers[msg]->status,
! 		               aliases[msg]->status), TAGGED )? '+' : ' ');
  }
--- 158,205 ----
  	if (on_page(msg)) 
  	  if (msg+1 == current && !arrow_cursor) {
  	    StartBold();
! 	    PutLineX(((compute_visible(msg+1)-1) % headers_per_page) + 4,
! 		   2, FRM("%s%c"), show_status(ifmain(headers[msg]->status,
! 						      aliases[msg]->status),
! 					       ifmain(headers[msg], NULL)),
! 		     ison(ifmain(headers[msg]->status,
! 				 aliases[msg]->status), TAGGED )? '+' : ' ');
  	    EndBold();
  	  }
  	  else
! 	    PutLineX(((compute_visible(msg+1)-1) % headers_per_page) + 4,
! 		     2, FRM("%s%c"), show_status(ifmain(headers[msg]->status,
! 							aliases[msg]->status),
! 						 ifmain(headers[msg], NULL)),
! 		     ison(ifmain(headers[msg]->status,
! 				 aliases[msg]->status), TAGGED )? '+' : ' ');
! }
! 
! int
! DeleteTagged()
! {
! /** delete all tagged messages.  return TRUE if the current message was
!     deleted. **/
!   int iindex, count = 0;
!   char buf[STRING];
! 
!   if (!inalias) {
!     for (iindex=0; iindex < message_count; iindex++)
!       if (headers[iindex]->status & TAGGED) {
!         headers[iindex]->status |= DELETED;
!         count++;
!         show_new_status(iindex);
!       }
!     if (count == 1)
!       elm_sfprintf(buf, sizeof buf,
! 		   CATGETS(elm_msg_cat, ElmSet, ElmMsgDeleted,
! 			   "Message deleted."));
!     else
!       elm_sfprintf(buf, sizeof buf,
! 		   CATGETS(elm_msg_cat, ElmSet, ElmMsgsDeleted,
! 			   "%d messages deleted."), 
! 		   count);
!     Centerline(elm_LINES, buf);
!     return(headers[current-1]->status & DELETED ? 1 : 0);
!   }
  }
Index: elm2.4.ME+.50/src/edit.c
*** elm2.4.25/src/edit.c	Tue Aug 30 18:07:04 1994
--- elm2.4.ME+.50/src/edit.c	Tue Nov 17 21:12:57 1998
***************
*** 1,66 ****
  
! static char rcsid[] = "@(#)$Id: edit.c,v 5.10 1994/08/30 15:07:03 syd Exp $";
  
! /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
   *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *******************************************************************************
!  * Bug reports, patches, comments, suggestions should be sent to:
!  *
!  *	Syd Weinstein, Elm Coordinator
!  *	elm@DSI.COM			dsinc!elm
!  *
!  *******************************************************************************
!  * $Log: edit.c,v $
!  * Revision 5.10  1994/08/30  15:07:03  syd
!  * Extra } in edit_mailbox removed.
!  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
!  *
!  * Revision 5.9  1994/06/03  17:05:17  syd
!  * try and prevent copy from calling elm_chown unless needed
!  * From: Syd
!  *
!  * Revision 5.8  1994/05/14  18:42:57  syd
!  * Here are some more of fixes to correctly call fflush() and unlock() in sequence.
!  * From: Jukka Ukkonen <ukkonen@csc.fi>
!  *
!  * Revision 5.7  1993/05/08  20:25:33  syd
!  * Add sleepmsg to control transient message delays
!  * From: Syd
!  *
!  * Revision 5.6  1993/02/03  17:12:53  syd
!  * move more declarations to defs.h, including sleep
!  * From: Syd
!  *
!  * Revision 5.5  1993/01/20  03:37:16  syd
!  * Nits and typos in the NLS messages and corresponding default messages.
!  * From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
!  *
!  * Revision 5.4  1992/12/07  14:53:21  syd
!  * Fix typos in edit.c
!  * From: Bo.Asbjorn.Muldbak <bam@jutland.ColumbiaSC.NCR.COM>
!  *
!  * Revision 5.3  1992/11/26  00:46:13  syd
!  * changes to first change screen back (Raw off) and then issue final
!  * error message.
!  * From: Syd
!  *
!  * Revision 5.2  1992/11/14  21:53:49  syd
!  * When elm copies the temp mailbox back to the mail spool to resync or
!  * quit, it changes to the mailgroup before attempting to diddle in the
!  * mail spool, but when it copies the temp mailbox back to the mail spool
!  * after editing, it forgets to change to mailgroup.  This patch appears
!  * to work, but I haven't exhaustively checked for some path that leaves
!  * the gid set
!  * wrong.  From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
!  *
!  * Revision 5.1  1992/10/03  22:58:40  syd
!  * Initial checkin as of 2.4 Release at PL0
!  *
!  *
!  ******************************************************************************/
  
  /** This routine is for allowing the user to edit their current folder
      as they wish.
--- 1,16 ----
  
! static char rcsid[] = "@(#)$Id: edit.c,v 1.2 1998/10/20 19:58:15 hurtta Exp $";
  
! /******************************************************************************
!  *  The Elm (ME+) Mail System  -  $Revision: 1.2 $   $State: Exp $
   *
+  *  Modified by: Kari Hurtta <hurtta+elm@ozone.FMI.FI>
+  ******************************************************************************
+  *  The Elm Mail System 
+  *
   * 			Copyright (c) 1988-1992 USENET Community Trust
   * 			Copyright (c) 1986,1987 Dave Taylor
!  *****************************************************************************/
  
  /** This routine is for allowing the user to edit their current folder
      as they wish.
***************
*** 70,75 ****
--- 20,26 ----
  #include "headers.h"
  #include "s_elm.h"
  #include <errno.h>
+ #include "me.h"
  
  extern int errno;
  
***************
*** 83,104 ****
  {
  	int err = errno;
  
! 	MoveCursor(LINES, 0);
  	Raw(OFF);
  
! 	MCprintf(catgets(elm_msg_cat, ElmSet, ElmCouldntCopyMailfile,
! 		"\nCouldn't copy %s to mail file %s!\n"),
! 		cur_folder, edited_file);
! 
! 	printf(catgets(elm_msg_cat, ElmSet, ElmCheckOutMail,
! 		"\nYou'll need to check out %s for your mail.\n"),
! 		edited_file);
! 	printf("** %s. **\n", error_description(err));
! 
! 	if (mailfile)
! 	    fflush (mailfile);
! 	unlock();					/* ciao!*/
! 	emergency_exit();
  }
  
  edit_mailbox()
--- 34,54 ----
  {
  	int err = errno;
  
! 	MoveCursor(elm_LINES, 0);
  	Raw(OFF);
  
! 	lib_error(CATGETS(elm_msg_cat, ElmSet, ElmCouldntCopyMailfile,
! 			  "\nCouldn't copy %s to mail file %s!\n"),
! 		  cur_folder, edited_file);
! 
! 	lib_error(CATGETS(elm_msg_cat, ElmSet, ElmCheckOutMail,
! 			  "\nYou'll need to check out %s for your mail.\n"),
! 		  edited_file);
! 	lib_error(FRM("** %s. **\n"), 
! 		  error_description(err));
! 
! 	unlock(0);					/* ciao!*/
! 	emergency_exit(0);
  }
  
  edit_mailbox()
***************
*** 122,129 ****
  
  	if(folder_type == SPOOL) {
  	  if(save_file_stats(cur_folder) != 0) {
! 	    error1(catgets(elm_msg_cat, ElmSet, ElmPermFolder,
! 	      "Problems saving permissions of folder %s!"), cur_folder);
  	    Raw(ON);
  	    if (sleepmsg > 0)
  		sleep(sleepmsg);
--- 72,80 ----
  
  	if(folder_type == SPOOL) {
  	  if(save_file_stats(cur_folder) != 0) {
! 	    lib_error(CATGETS(elm_msg_cat, ElmSet, ElmPermFolder,
! 			      "Problems saving permissions of folder %s!"), 
! 		      cur_folder);
  	    Raw(ON);
  	    if (sleepmsg > 0)
  		sleep(sleepmsg);
***************
*** 131,138 ****
  	  }
  	}
  
! 	strcpy(edited_file,
! 	    (folder_type == NON_SPOOL ? cur_folder : cur_tempfolder));
  	if (edit_a_file(edited_file) == 0) {
  	    return (0);
  	}
--- 82,90 ----
  	  }
  	}
  
! 	strfcpy(edited_file,
! 		(folder_type == NON_SPOOL ? cur_folder : cur_tempfolder),
! 		sizeof edited_file);
  	if (edit_a_file(edited_file) == 0) {
  	    return (0);
  	}
***************
*** 139,145 **