[comp.mail.elm] Elm 2.1 PL1 part 8 of 22

syd@dsinc.UUCP (Syd Weinstein) (12/12/88)

---- Cut Here and unpack ----
#!/bin/sh
# this is part 8 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file hdrs/save_opts.h continued
#
CurArch=8
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file hdrs/save_opts.h"
sed 's/^X//' << 'SHAR_EOF' >> hdrs/save_opts.h
X { "pager", -1L }, 
X { "pointnew", -1L},      
X { "prefix", -1L },       	
X { "print", -1L }, 
X { "remotesignature",-1L},
X { "resolve", -1L },       	
X { "savemail", -1L }, 
X { "savename", -1L },     
X { "shell", -1L },         	
X { "signature", -1L },
X { "softkeys", -1L },	  
X { "sortby", -1L }, 		
X { "timeout", -1L },
X { "titles", -1L },       
X { "userlevel", -1L }, 	
X { "warnings", -1L },
X { "weed", -1L },         
X { "weedout", -1L },		
X};
SHAR_EOF
echo "File hdrs/save_opts.h is complete"
chmod 0444 hdrs/save_opts.h || echo "restore of hdrs/save_opts.h fails"
echo "x - extracting hdrs/shortname.1 (Text)"
sed 's/^X//' << 'SHAR_EOF' > hdrs/shortname.1 &&
XFrom sun!convex!ndmce!jlsoft!marquez@hplabs.HP.COM  Tue Mar 24 14:55:53 1987
XReceived: from hplabsc (hplabsc.hpl.hp.com) by hpldat ; Tue, 24 Mar 87 14:55:53 pst
XReturn-Path: <sun!convex!ndmce!jlsoft!marquez@hplabs.HP.COM>
XReceived: from hplabs.HP.COM by hplabsc ; Tue, 24 Mar 87 14:54:57 pst
XReceived: from Sun.COM by hplabs.HP.COM with TCP ; Tue, 24 Mar 87 14:52:11 pst
XReceived: from sun.Sun.COM by Sun.COM (3.2/SMI-3.2)
X	id AA01637; Tue, 24 Mar 87 14:46:13 PST
XReceived: by sun.Sun.COM (3.2/SMI-3.2)
X	id AA00003; Tue, 24 Mar 87 14:50:23 PST
XFrom: sun!convex!ndmce!jlsoft!marquez@hplabs.HP.COM
XMessage-Id: <8703242250.AA00003@sun.Sun.COM>
XReceived: by convex (4.12/4.7)
X	id AA01616; Tue, 24 Mar 87 16:47:43 cst
XReceived: by ndmce.UUCP (smail2.3)
X	id AA24491; 24 Mar 87 16:41:30 CST (Tue)
XTo: ndmce!hplabs!taylor@hplabs.HP.COM
XDate: Tue, 24 Mar 87 16:08:01 CST
XSubject: shortnames.h mods
XX-Mailer: Elm [version 1.5]
X
XDave,
X
XHello. I have just finished installing Elm on my 68k unix box running
XUnisoft Uniplus+ sysvr1. Unfortunately the C compiler doesn't support
Xlong variable names so I had the dubious honor of updating shortnames.h
Xto include several new variable and function names. I also do not have
Xthe setvbuf() function. I modified filter.h to delete it. I am enclosing
Xmy changes if you are interested...
X
XManlio D. Marquez
Xjlsoft!marquez
X
X
X
Xshortnames.h
X-----------------------
X/**			shortnames.h			**/
X
X/** This file is from Geoff Kuenning, and will help those poor users that
X    are stuck using C compilers that don't have flexnames.   Too bad.
X
X	This file has no explicit copyright.
X
X**/
X
X#define PutLine0		PLine0
X#define PutLine1		PLine1
X#define PutLine2		PLine2
X#define PutLine3		PLine3
X
X#define add_to_table		add_2_table
X#define address1		addrs1
X#define addressII		addrsII
X#define addresses		addr_s
X#define alternate_prompt	alt_prompt
X#define alternative_addresses	alt_addrs
X#define alternatives		alts
X#define always_leave		alw_leave
X
X#define calendar_line		cal_line
X#define cancelled_msg		cncld_msg
X#define central_message_buffer	cntrl_bfr
X#define check_form_file		chk_frmf
X#define compare_dates		cmp_dates
X#define compare_headers		cmp_hdrs
X#define copy_message_across	cpy_msg_across
X#define current_record		cur_rec
X#define current_time		cur_time
X
X#define define_softkeys		def_softkeys
X#define display_central_message	displ_cntrl_msg
X#define display_error		displ_error
X#define display_headers		displ_hdrs
X#define display_helpfile	dspl_helpfile
X#define display_line		dspl_line
X#define display_options		displ_options
X#define display_title		displ_titles
X#define display_to		displ_to
X
X#define encrypted		crypted
X#define encrypted_key		crypt_key
X#define expanded_cc		xp_cc
X#define expanded_to		xp_to
X#define expand_address		xp_addr
X#define expand_domain		xp_domain
X#define expand_env		xp_env
X#define expand_filename		xp_filename
X#define expand_group		xp_group
X#define expand_logname		xp_logname
X#define expand_site		xp_site
X#define expand_system		xp_system
X
X#define filename2		fn2
X#define findnode_has_been_initialized	fndhbi
X#define format_long		frm_lng
X#define form_letter		frm_let
X#define forward			forwrd
X
X#define generate_reply_to	gen_reply_to
X#define get_return_name		g_ret_name
X
X#define header_line		h_line
X#define header_page		h_page
X#define headers_per_page	h_per_page
X#define header_table		h_table
X
X#define install_aliases		ins_aliases
X
X#define last_line_loc		last_ln_loc
X#define long_sum		lng_sum
X
X#define machine_group		mach_group
X#define mailbox_defined		mbox_defined
X#define mailfile_size		mfile_size
X#define message_count		msg_count
X#define message_number		msg_number
X
X#define newaliases		nwaliases
X#define noptimize_return	noret_opt
X#define noptimize_usenet	nousenet_opt
X
X#define one_liner		one_lner
X#define optimize_and_add	opt_and_add
X#define optimize_arpa		opt_arpa
X#define optimize_cmplx_arpa	opt_cmplx_arpa
X#define optimize_return		opt_return
X#define optimize_usenet		opt_usenet
X#define optional_arg		opt_arg
X#define optionally_enter	opt_enter
X#define options_help		opt_hlp
X#define original_cc		orig_cc
X#define original_msg_num	orig_msg_num
X#define original_to		orig_to
X
X#define parse_arguments		pars_arguments
X#define parse_arpa_from		prs_arpa_from
X#define password_entry		pw_entry
X#define pattern_enter		pat_enter
X#define pattern_match		pat_match
X#define prompt_for_entry	prpt_ent
X#define prompt_for_sized_entry	prpt_sntry
X#define prompt_for_multiple_entries	prpt_fme
X
X#define read_alias_files	rd_alias_files
X#define read_headers		rd_headers
X#define read_in_file		rd_n_file
X#define read_in_messages	rd_n_mess
X#define read_rc			rd_rc
X#define read_rc_file		rd_rc_file
X#define received_on_machine	rcvd_on_machine
X#define remove_all		rem_all
X#define remove_first_word	rem_1st_word
X#define remove_domains		rem_domains
X#define remove_header		rem_hdr
X#define remove_user		rem_user
X#define remove_through_ch	rem_thru_ch
X#define reply_to_everyone	repl_to_everyone
X#define resolve_received	rslv_received
X
X#define save_option_string	sv_string
X#define save_option_sort	sv_sort
X#define save_option_number	sv_number
X#define save_option_on_off	sv_on_off
X#define save_option_weedlist	sv_weed
X#define save_option_alternatives	sv_alts
X#define show_message		shw_message
X#define show_msg		showmsg
X#define show_msg_tag		sh_msg_tag
X#define size_of_pathfd		sz_of_pathfd
X#define softkeys_off		soft_off
X#define softkeys_on		soft_on
X#define subjectbuffer		subjbuff
X#define subject_matches		subj_matches
X#define switching_to_default	sw_t_def
X#define system_call		sys_call
X#define system_data		sys_data
X#define system_files		sys_files
X#define system_hash_table	sys_hash_table
X#define system_record		sys_record
X
X#define tail_of_string		tl_of_string
X#define talk_to_sys		tlk_to_sys
X#define tempfile		tmpfile
X#define termcap_label		tcap_label
X#define top_of_screen_left	top_left_of_screen
X#define top_of_screen_right	top_right_of_screen
X#define translate_return	xlate_return
X
X#define update_mailtime		upd_mailtime
X#define update_title		upd_title
X#define unexpanded_cc		unexp_cc
X#define unexpanded_to		unexp_to
X
X#define verify_transmission	vfy_xmsn
X
X#define weeding_out		wding_out
X
X---------------------------------------
X
Xextra change for filter.h (stuck at end of file)
X
X---------------------------------------
X
X#ifndef setvbuf
X# define setvbuf(fd,a,b,c)	/* if don't have it, punt it off */
X#endif
X
X---------------------------------------
X
X
X
SHAR_EOF
chmod 0644 hdrs/shortname.1 || echo "restore of hdrs/shortname.1 fails"
echo "x - extracting hdrs/shortname.2 (Text)"
sed 's/^X//' << 'SHAR_EOF' > hdrs/shortname.2 &&
XFrom seismo!sundc!eli!geller@hplabs.HP.COM  Wed Mar 25 22:15:48 1987
XReceived: from hplabsc (hplabsc.hpl.hp.com) by hpldat ; Wed, 25 Mar 87 22:15:48 pst
XReturn-Path: <seismo!sundc!eli!geller@hplabs.HP.COM>
XReceived: from hplabs.HP.COM by hplabsc ; Wed, 25 Mar 87 22:15:04 pst
XReceived: from seismo.CSS.GOV by hplabs.HP.COM with TCP ; Wed, 25 Mar 87 22:12:56 pst
XReceived: from sundc.UUCP by seismo.CSS.GOV (5.54/1.14) with UUCP 
X	id AA24355; Thu, 26 Mar 87 01:12:39 EST
XFrom: seismo!sundc!eli!geller@hplabs.HP.COM
XReceived: by sundc.uucp (3.2/SMI-3.2)
X	id AA06338; Thu, 26 Mar 87 01:10:15 EST
XDate: Thu, 26 Mar 87 01:10:15 EST
XMessage-Id: <8703260610.AA06338@sundc.uucp>
XDave: 
XTo: hplabs!taylor@hplabs.HP.COM
X
XHere's the shortnames.h stuff I told you about. Hope its helpful -
Xbut you probably don't need it, being that you use a real
Xcompiler...
X
XAlso - has reply.c been posted to mod.sources? I'm looking
Xforward to receiving it. That's the last link I need before
XElm gets up and running.
X
X
X/*
X * D. Geller, 3/12/87
X */
X
X#define alternate_editor		alt_editor
X#define prompt_for_entry		pf_entry
X#define prompt_for_multiple_entries	pf_mult
X#define prompt_for_sized_entry		pf_size
X#define long_summary			lng_sum
X#define options_help			opts_help
X#define save_option_string		svo_string
X#define save_option_sort		svo_sort
X#define save_option_on_off		svo_onoff
X#define save_option_number		svo_numb
X#define save_option_weedlist		svo_weed
X#define save_option_alternatives	svo_alt
X#define form_letter			form_le
X#define form_letter_section		form_sect
X#define one_liner_for			onel_for
X#define switching_to_default		swi_to
X#define findnode_has_been_initialized	fnodhas
X
X/*
X * end of additions by Geller
X */
X
X
SHAR_EOF
chmod 0644 hdrs/shortname.2 || echo "restore of hdrs/shortname.2 fails"
echo "x - extracting hdrs/shortname.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > hdrs/shortname.h &&
X
X/* @(#)$Id: shortname.h,v 2.1 88/07/21 09:56:52 edc Exp $ */
X
X/*******************************************************************************
X *  The Elm Mail System  -  $Revision: 2.1 $   $State: Exp $
X *
X *******************************************************************************
X * Bug reports, patches, comments, suggetions should be sent to:
X *
X *	Syd Weinstein, Elm Corrdinator
X *	syd@dsinc.UUCP			dsinc!syd
X *
X *******************************************************************************
X * $Log:	shortname.h,v $
X * Revision 2.1  88/07/21  09:56:52  edc
X * checked in with -k by syd at 88.09.15.20.39.36.
X * 
X * Revision 2.1  88/07/21  09:56:52  edc
X * Final cleanup and hacks for the 2.1 alpha test release
X * 
X * Revision 2.0  88/06/27  16:43:30  edc
X * Initial revision 2.0 gamma sources as leaked from HP
X * 
X *
X *
X ******************************************************************************/
X
X/** This file is from Geoff Kuenning, and will help those poor users that
X    are stuck using C compilers that don't have flexnames.   Too bad.
X
X    Additions and all that are more recent, of course...
X
X**/
X
X#define CleartoEOS		Clear_EOS
X#define CleartoEOLN		Clear_EOLN
X
X#define PutLine0		PLine0
X#define PutLine1		PLine1
X#define PutLine2		PLine2
X#define PutLine3		PLine3
X
X#define add_to_table		add_2_table
X#define address1		addrs1
X#define addressII		addrsII
X#define addresses		addr_s
X#define alternate_prompt	alt_prompt
X#define alternative_addresses	alt_addrs
X#define always_leave		alw_leave
X
X#define calendar_line		cal_line
X#define cancelled_msg		cncld_msg
X#define central_message_buffer	cntrl_bfr
X#define compare_dates		cmp_dates
X#define compare_headers		cmp_hdrs
X#define copy_message_across	cpy_msg_across
X#define current_record		cur_rec
X#define current_time		cur_time
X
X#define define_softkeys		def_softkeys
X#define display_central_message	displ_cntrl_msg
X#define display_error		displ_error
X#define display_headers		displ_hdrs
X#define display_helpfile	dspl_helpfile
X#define display_options		displ_options
X#define display_title		displ_titles
X#define display_to		displ_to
X
X#define encrypted		crypted
X#define encrypted_key		crypt_key
X#define expanded_cc		xp_cc
X#define expanded_to		xp_to
X#define expand_address		xp_addr
X#define expand_domain		xp_domain
X#define expand_env		xp_env
X#define expand_filename		xp_filename
X#define expand_group		xp_group
X#define expand_logname		xp_logname
X#define expand_site		xp_site
X#define expand_system		xp_system
X
X#define filename2		fn2
X#define forward			forwrd
X
X#define generate_reply_to	gen_reply_to
X#define get_return_name		g_ret_name
X
X#define header_line		h_line
X#define header_page		h_page
X#define headers_per_page	h_per_page
X#define header_table		h_table
X
X#define install_aliases		ins_aliases
X
X#define last_line_loc		last_ln_loc
X
X#define machine_group		mach_group
X#define mailbox_defined		mbox_defined
X#define mailfile_size		mfile_size
X#define message_count		msg_count
X#define message_number		msg_number
X
X#define newaliases		nwaliases
X#define noptimize_return	noret_opt
X#define noptimize_usenet	nousenet_opt
X
X#define optimize_and_add	opt_and_add
X#define optimize_arpa		opt_arpa
X#define optimize_cmplx_arpa	opt_cmplx_arpa
X#define optimize_return		opt_return
X#define optimize_usenet		opt_usenet
X#define optional_arg		opt_arg
X#define optionally_enter	opt_enter
X#define original_cc		orig_cc
X#define original_msg_num	orig_msg_num
X#define original_to		orig_to
X
X#define parse_arguments		pars_arguments
X#define parse_arpa_from		prs_arpa_from
X#define password_entry		pw_entry
X#define pattern_enter		pat_enter
X#define pattern_match		pat_match
X
X#define read_alias_files	rd_alias_files
X#define read_headers		rd_headers
X#define read_rc			rd_rc
X#define read_rc_file		rd_rc_file
X#define received_on_machine	rcvd_on_machine
X#define remove_all		rem_all
X#define remove_first_word	rem_1st_word
X#define remove_domains		rem_domains
X#define remove_header		rem_hdr
X#define remove_user		rem_user
X#define remove_through_ch	rem_thru_ch
X#define reply_to_everyone	repl_to_everyone
X#define resolve_received	rslv_received
X
X#define show_message		shw_message
X#define show_msg		showmsg
X#define show_msg_tag		sh_msg_tag
X#define size_of_pathfd		sz_of_pathfd
X#define softkeys_off		soft_off
X#define softkeys_on		soft_on
X#define subjectbuffer		subjbuff
X#define subject_matches		subj_matches
X#define system_call		sys_call
X#define system_data		sys_data
X#define system_files		sys_files
X#define system_hash_table	sys_hash_table
X#define system_record		sys_record
X
X#define tail_of_string		tl_of_string
X#define talk_to_sys		tlk_to_sys
X#define tempfile		tmpfile
X#define termcap_label		tcap_label
X#define top_of_screen_left	top_left_of_screen
X#define top_of_screen_right	top_right_of_screen
X#define translate_return	xlate_return
X
X#define update_mailtime		upd_mailtime
X#define update_title		upd_title
X#define unexpanded_cc		unexp_cc
X#define unexpanded_to		unexp_to
X
X#define verify_transmission	vfy_xmsn
X
X#define weeding_out		wding_out
SHAR_EOF
chmod 0444 hdrs/shortname.h || echo "restore of hdrs/shortname.h fails"
echo "x - extracting hdrs/sysdefs.mt (Text)"
sed 's/^X//' << 'SHAR_EOF' > hdrs/sysdefs.mt &&
X/* $Id: sysdefs.mt,v 2.1 88/09/15 20:40:19 syd Exp $ */
X/*******************************************************************************
X *  The Elm Mail System  -  $Revision: 2.1 $   $State: Exp $
X *
X * 			Copyright (c) 1986 Dave Taylor
X *******************************************************************************
X * Bug reports, patches, comments, suggetions should be sent to:
X *
X *	Syd Weinstein, Elm Corrdinator
X *	syd@dsinc.UUCP			dsinc!syd
X *
X *******************************************************************************
X * $Log:	sysdefs.mt,v $
X * Revision 2.1  88/09/15  20:40:19  syd
X * checked in with -k by syd at 88.09.15.20.40.19.
X * 
X * 14 Sep 88 Chip Rosenthal <chip@vector>
X * This file contains the patches for Elm 2.1b to run on XENIX System V.
X * The general issues with running Elm on such a machine are:
X *
X * 88/09/05 gatech!sigmast!dgy@cs.buffalo.edu
X *	fix TOUCH ADDRESSES variable
X *
X * 88/08/27 ssw
X *	add deluth diffs
X *
X * Revision 2.2  88/07/21  09:56:56  edc
X * Final cleanup and hacks for the 2.1 alpha test release
X * 
X * Revision 2.1  88/06/28  12:54:25  edc
X * Added defines for NOMKDIR (no mkdir() call), and NOUTIMBUF (utimbuf structure
X * not defined by system somewhere).
X * 
X * Revision 2.0  88/06/27  16:43:32  edc
X * Initial revision 2.0 gamma sources as leaked from HP
X * 
X *
X *
X ******************************************************************************/
X
X/**  System level, configurable, defines for the ELM mail system.  **/
X
X
X/** Define the following if you think that the information in messages
X    that have "Reply-To:" and/or "From:" fields with addresses will
X    contain valid addressing information.  If this isn't defined, the
X    calculated return address will ALWAYS be used instead.  (note that
X    this doesn't necessarily preclude the use of G)roup replies).
X**/
X
X#define USE_EMBEDDED_ADDRESSES	
X
X
X#define FIND_DELTA	10		/* byte region where the binary search
X					   on the path alias file is fruitless 
X                                           (can't be within this boundary)    */
X
X#define MAX_SALIASES	>503<	/* number of system aliases allowed      */
X#define MAX_UALIASES	>251<	/* number of user aliases allowed 	 */
X#define MAX_IN_WEEDLIST 150	/* max headers to weed out               */
X
X#define MAX_HOPS	35	/* max hops in return addr to E)veryone  */
X
X#define MAX_ATTEMPTS	>6<	/* #times to attempt lock file creation */
X
X/** see leavembox.c to determine if this should be defined or not....The 
X    default is to NOT have it defined.
X**/
X
X#define REMOVE_AT_LAST
X
X#define DEFAULT_BATCH_SUBJECT  "no subject (file transmission)"
X
X/** If you want to have the mailer know about valid mailboxes on the
X    host machine (assumes no delivery agent aliases) then you should
X    undefine this (the default is to have it defined)...
X**/
X
X#define NOCHECK_VALIDNAME
X
X/** If your machine doesn't have virtual memory (specifically the vfork() 
X    command) then you should define the following....		
X**/
X
X/** #define NO_VM **/
X
X/** If you don't have the utimbuf structure defined in types.h or somwhere
X    else that makes sense, define the following...
X    (Unless you're BSD, inwhich case this is ignored anyway.)
X**/
X
X/** #define NOUTIMBUF **/
X
X/** If your system doesn't have the mkdir() call to create directories
X    then you should define the following....	
X**/
X
X/** #define NOMKDIR **/
X
X/** If you're running sendmail, or another transport agent that can 
X    handle the blind-carbon-copy list define the following
X**/
X
X/** #define ALLOW_BCC **/
X
X/** If you'd like to be able to use the E)dit mailbox function from
X    within the Elm program (many people find it too dangerous and
X    confusing to include) then define the following:
X**/
X
X/** #define ALLOW_MAILBOX_EDITING **/
X
X/** If you have pathalias, can we get to it as a DBM file??? **/
X
X/** #define USE_DBM **/
X
X/** If you want the mailer to check the pathalias database BEFORE it
X    looks to see if a specified machine is in the L.sys database (in
X    some cases routing is preferable to direct lines) then you should
X    define the following...
X**/
X
X#define LOOK_CLOSE_AFTER_SEARCH
X
X
X/** If you'd rather the program automatically used the 'uuname' command
X    to figure out what machines it talks to (instead of trying to get
X    it from L.sys first) then define the following...
X**/
X
X#define USE_UUNAME
X
X/** If you want the program to try to optimize return addresses of
X    aliases as you feed them to the make-alias function, then you
X    should define this.
X**/
X
X/** #define DONT_TOUCH_ADDRESSES **/
X
X/** If you'd like the system to try to optimize the return addresses of
X    mail when you 'alias current message', then define:
X**/
X
X/** #define OPTIMIZE_RETURN **/
X
X/** If you'd like "newmail" to automatically go into background when you
X    start it up (instead of the "newmail &" junk with the process id output,
X    then define the following...
X**/
X
X#define AUTO_BACKGROUND
X
X/** If you'd rather your mail transport agent (ie sendmail) put the From:
X    line into the message, define the following...
X**/
X
X/** #define DONT_ADD_FROM **/
X
X/** If your machine prefers the Internet notation of user@host for the
X    From: line and addresses, define the following...(the default is to 
X    use this rather than the USENET notation - check your pathalias file!)
X
X**/
X
X#define INTERNET_ADDRESS_FORMAT
X
X/** If you're on a machine that prefers UUCP to Internet addresses, then
X    define the following (the basic change is that on a machine that
X    receives messages of the form <path>!user@<localhost> the displayed
X    address will be <path>!user instead of user@<localhost>.
X
X    BOGUS_INTERNET is the address that your local system appends to 
X    messages occasionally.  The algorithm is simply to REMOVE the
X    BOGUS_INTERNET string.  This is horrible.  *sigh*
X
X**/
X
X#define PREFER_UUCP
X#define BOGUS_INTERNET	"@hplabs.HP.COM"
X
X/** If you're running ACSNET and/or want to have your domain name
X    attached to your hostname on outbound mail then you can define
X    the following (default are not defined)
X**/
X
X#define USE_DOMAIN
X#define DOMAIN		"<enter your domain here>"
X
X/** If you are going to be running the mailer with setgid mail (or
X    something similar) you'll need to define the following to ensure
X    that the users mailbox in the spool directory has the correct
X    group (NOT the users group)
X**/
X
X#define SAVE_GROUP_MAILBOX_ID
X
X/** If you want a neat feature that enables scanning of the message
X    body for entries to add to the users ".calendar" (or whatever)
X    file, define this.
X**/
X
X#define ENABLE_CALENDAR
X#define dflt_calendar_file	"calendar"	/* in HOME directory */
X
X/** If you want to implement 'site hiding' in the mail, then you'll need to
X    uncomment the following lines and set them to reasonable values.  See 
X    the configuration guide for more details....(actually these are undoc-
X    umented because they're fairly dangerous to use.  Just ignore 'em and
X    perhaps one day you'll find out what they do, ok?)
X**/
X
X/****************************************************************************
X
X#undef    DONT_ADD_FROM		
X
X#define   SITE_HIDING
X#define   HIDDEN_SITE_NAME	"fake-machine-name"
X#define   HIDDEN_SITE_USERS	"/usr/mail/lists/hidden_site_users"
X
X****************************************************************************/
X
X/** Do we have the 'gethostname()' call?  If not, define the following **/
X/** #define NEED_GETHOSTNAME **/
X
X/** How about the 'cuserid()' call?  If not...well...you get the idea  **/
X/** #define NEED_CUSERID **/
X
X/** are you stuck on a machine that has short names?  If so, define the
X    following **/
X
X/** #define SHORTNAMES **/
X
X/* removed ifdef -- Configure.sh will patch these if required */
X#define system_text_file	"/usr/spool/mail/.alias_text"
X#define system_hash_file	"/usr/spool/mail/.alias_hash"
X#define system_data_file	"/usr/spool/mail/.alias_data"
X
X#define ALIAS_TEXT		".elm/aliases.text"
X#define ALIAS_HASH		".elm/aliases.hash"
X#define ALIAS_DATA		".elm/aliases.data"
X
X#define pathfile		"/usr/lib/nmail.paths"
X#define domains			"/usr/lib/domains"
X
X#define Lsys			"/usr/lib/uucp/L.sys"
X
X/** where to put the output of the elm -d command... (in home dir) **/
X#define DEBUGFILE	"ELM:debug.info"
X#define OLDEBUG		"ELM:debug.last"
X
X#define	temp_lock_dir   "/tmp/"
X#define temp_file	"/tmp/snd."
X#define temp_form_file	"/tmp/form."
X#define temp_mbox	"/tmp/mbox."
X#define temp_print      "/tmp/print."
X#define temp_edit	"/tmp/elm-edit"
X#define temp_uuname	"/tmp/uuname."
X#define mailtime_file	".elm/last_read_mail"
X#define readmsg_file	".elm/readmsg"
X
X#define emacs_editor	"/usr/local/bin/emacs"
X
X#ifdef XENIX
X# define sys_lock_file(BUF,USER) sprintf(BUF,"/tmp/%s.mlk",USER)
X#else
X# define sys_lock_file(BUF,USER) sprintf(BUF,"%s/%s.lock",mailhome,USER)
X#endif
X
X/* removed ifdef -- Configure.sh will patch these if required */
X#define default_editor	"/usr/ucb/vi"
X#define mailhome	"/usr/spool/mail/"
X
X#define default_shell	"defshell"
X#define default_pager	"builtin+"
X
X#define sendmail	"/usr/lib/sendmail"
X#define smflags		"-oi -oem"	/* ignore dots and mail back errors */
X#define smflagsv      "-oi -oem -v"   /* Verbose voyuer mode */
X#define mailer		"/bin/rmail"
X
X/* removed ifdef -- Configure.sh will patch this if required */
X#define mailx		"/usr/ucb/Mail"
X
X#define helphome	"/usr/local/lib"
X#define helpfile	"elm-help"
X
X#define ELMRC_INFO	"/usr/local/lib/elmrc-info"
X
X#define elmrcfile	".elm/elmrc"
X#define old_elmrcfile	".elm/elmrc.old"
X#define mailheaders	".elm/elmheaders"
X#define dead_letter	"Cancelled.mail"
X
X#define unedited_mail	"emergency.mbox"
X
X#define newalias	"newalias -q 1>&2 > /dev/null"
X#define readmsg		"readmsg"
X
X#define remove		"/bin/rm -f"		/* how to remove a file */
X#define cat		"/bin/cat"		/* how to display files */
X#define uuname		"uuname"		/* how to get a uuname  */
SHAR_EOF
chmod 0444 hdrs/sysdefs.mt || echo "restore of hdrs/sysdefs.mt fails"
echo "x - extracting src/Makefile.mt (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/Makefile.mt &&
X# $Id: Makefile.mt,v 2.1 88/09/15 20:07:11 syd Exp $
X#
X#  Makefile for the ELM mail program.
X#
X#         (C) Copyright 1986, 1987, Dave Taylor
X#
X# $Log:	Makefile.mt,v $
X# Revision 2.1  88/09/15  20:07:11  syd
X# Initial 2.1 Release
X# 
X#
X# 14 Sep 88 Chip Rosenthal <chip@vector>
X# This file contains the patches for Elm 2.1b to run on XENIX System V.
X# The general issues with running Elm on such a machine are:
X#
X
XSHELL=/bin/sh
X
XDEFINE= -DDEBUG >os-define<
XLIB2  = >lib2<
X
X# IF you're on an ACSnet system (Australia) then
X# you'll want to uncomment the following;
X
X#   DEFINE= ${DEFINE} -DACSNET
X
X##############################
X
XCFILES=	addr_util.c alias.c aliasdb.c aliaslib.c args.c bouncebk.c	     \
X	builtin.c calendar.c conn_to.c curses.c date.c delete.c	     \
X	domains.c edit.c editmsg.c elm.c encode.c errno.c expires.c	     \
X	file.c file_util.c fileio.c forms.c getopt.c hdrconfg.c	     \
X	hdrcfg_b.c help.c init.c in_utils.c leavembox.c	     \
X	limit.c mailmsg1.c mailmsg2.c mailtime.c mkhdrs.c newmbox.c	     \
X	opt_utils.c options.c out_utils.c pattern.c pmalloc.c 	     \
X	quit.c read_rc.c remail.c reply.c returnadd.c save_opts.c 	     \
X	savecopy.c screen.c showmsg.c showmsg_c.c signals.c softkeys.c     \
X	sort.c string2.c strings.c syscall.c utils.c validname.c 
X
XHEADERS=../hdrs/curses.h ../hdrs/defs.h ../hdrs/headers.h ../hdrs/sysdefs.h
X
XOBJS  =	addr_util.o alias.o aliasdb.o aliaslib.o args.o bouncebk.o	     \
X	builtin.o calendar.o conn_to.o curses.o date.o delete.o	     \
X	domains.o edit.o editmsg.o elm.o encode.o errno.o expires.o	     \
X	file.o file_util.o fileio.o forms.o getopt.o hdrconfg.o	     \
X	hdrcfg_b.o help.o init.o in_utils.o leavembox.o	     \
X	limit.o mailmsg1.o mailmsg2.o mailtime.o mkhdrs.o newmbox.o	     \
X	opt_utils.o options.o out_utils.o pattern.o pmalloc.o	     \
X	quit.o read_rc.o remail.o reply.o returnadd.o save_opts.o	     \
X	savecopy.o screen.o showmsg.o showmsg_c.o signals.o		     \
X	softkeys.o sort.o string2.o strings.o syscall.o utils.o		     \
X	validname.o 
X
X
XBIN=    ../bin
XLIBS=   >libs<
XLARGE=	>large<
XCFLAGS= >cflags< -O -I../hdrs
XLFLAGS=	>lflags<
XCC=	>cc<
XRM=	>rm<
X
X../bin/elm: ${OBJS} ${EXTRA} ${HEADERS} ../hdrs/elm.h
X	${CC} ${LFLAGS} -o ${BIN}/elm -n ${OBJS} ${LIBS} ${LIB2}
X
X.c.o:   ${HEADERS}
X	${CC} -c ${CFLAGS} ${DEFINE} $*.c 
X
Xinit.o:	init.c ${HEADERS} ../hdrs/patchlevel.h
X	${CC} ${LARGE} -c ${CFLAGS} ${DEFINE} init.c
X
Xcurses.o: curses.c ../hdrs/curses.h
X	${CC} ${LARGE} -c ${CFLAGS} -DRAWMODE ${DEFINE} curses.c
X
Xelm.o: elm.c ${HEADERS}
X	${CC} ${LARGE} -c ${CFLAGS} ${DEFINE} elm.c
X
Xnewmbox.o: newmbox.c ${HEADERS}
X	${CC} ${LARGE} -c ${CFLAGS} ${DEFINE} newmbox.c
X
Xread_rc.o: read_rc.c ${HEADERS}
X	${CC} ${LARGE} -c ${CFLAGS} ${DEFINE} read_rc.c
X
Xscreen.o: screen.c ${HEADERS}
X	${CC} ${LARGE} -c ${CFLAGS} ${DEFINE} screen.c
X
Xshowmsg.o: showmsg.c ${HEADERS}
X	${CC} ${LARGE} -c ${CFLAGS} ${DEFINE} showmsg.c
X
X# curses.c : curses.q
X# 	@../bin/quickscreen curses.q
X#
X# curses.q :
X# 	@cp curses.c curses.q
X
Xclean:
X	${RM} ${OBJS} LINT.OUT ../bin/elm 
X
Xlint: LINT.OUT
X
XLINT.OUT: ${CFILES}
X	lint -DRAWMODE ${CFLAGS} -I../hdrs ${CFILES} ${LIBS} > LINT.OUT
X
Xlisting: LISTING
X
XLISTING: Makefile INDEX ${HEADERS} ${CFILES}
X	@echo adding file 'Makefile'...
X	@/bin/echo \\f > LISTING
X	@cat Makefile >> LISTING
X	@echo adding file 'INDEX'...
X	@/bin/echo \\f >> LISTING
X	@cat INDEX >> LISTING
X	@../bin/makelisting ${HEADERS} ${CFILES}
X	@echo LISTING generated.
X
Xindex: INDEX
X
XINDEX: ${CFILES} ${HEADERS}
X	@echo Creating function definition index
X	@index *.c | sort > INDEX
X	@echo File INDEX generated
SHAR_EOF
chmod 0444 src/Makefile.mt || echo "restore of src/Makefile.mt fails"
echo "x - extracting src/addr_util.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/addr_util.c &&
X
Xstatic char rcsid[] = "@(#)$Id: addr_util.c,v 2.1 88/09/15 20:11:54 syd Exp $";
X
X/*******************************************************************************
X *  The Elm Mail System  -  $Revision: 2.1 $   $State: Exp $
X *
X * 			Copyright (c) 1986 Dave Taylor
X *******************************************************************************
X * Bug reports, patches, comments, suggetions should be sent to:
X *
X *	Syd Weinstein, Elm Corrdinator
X *	syd@dsinc.UUCP			dsinc!syd
X *
X *******************************************************************************
X * $Log:	addr_util.c,v $
X * Revision 2.1  88/09/15  20:11:54  syd
X * checked in with -k by syd at 88.09.15.20.27.17.
X * 
X * Revision 2.1  88/07/21  09:57:24  edc
X * Final hacks and cleanup to the 2.1 alpha test release.
X * 
X * Revision 2.0  88/06/27  17:24:20  edc
X * The original 2.0 gamma sources as leaked from HP
X * 
X *
X *
X ******************************************************************************/
X
X/** This file contains addressing utilities 
X
X**/
X
X#include "headers.h"
X
X#include <sys/types.h>
X#include <sys/stat.h>
X#include <ctype.h>
X
X#ifdef BSD 
X#undef tolower
X#undef toupper
X#endif
X
Xchar *shift_lower(), *get_alias_address(), *get_token(), *strtok(),
X     *strchr(), *strcpy(), *strcat(), *strncpy();
X
X
Xint
Xtalk_to(sitename)
Xchar *sitename;
X{
X	/** If we talk to the specified site, return true, else
X	    we're going to have to expand this baby out, so 
X	    return false! **/
X
X	struct lsys_rec  *sysname;
X
X	sysname = talk_to_sys;
X
X	if (sysname == NULL) {
X	 dprint(2, (debugfile, 
X		"Warning: talk_to_sys is currently set to NULL!\n"));
X	 return(0);
X	}
X
X	while (sysname != NULL) {
X	  if (strcmp(sysname->name, sitename) == 0)
X	    return(1);
X	  else
X	    sysname = sysname->next;
X	}
X
X	return(0);
X}
X
Xadd_site(buffer, site, lastsite)
Xchar *buffer, *site, *lastsite;
X{
X	/** add site to buffer, unless site is 'uucp', current machine, or
X            site is the same as lastsite.   If not, set lastsite to
X            site.
X	**/
X
X	char local_buffer[LONG_SLEN];
X	char *strip_parens();
X
X	if (strcmp(site, "uucp") != 0)
X	  if (strcmp(site, lastsite) != 0) 
X	    if (strcmp(site, hostname) != 0) {
X	      if (buffer[0] == '\0')
X	        strcpy(buffer, strip_parens(site));         /* first in list! */
X	      else {
X	        sprintf(local_buffer,"%s!%s", buffer, strip_parens(site));
X	        strcpy(buffer, local_buffer);
X	      }
X	      strcpy(lastsite, strip_parens(site)); /* don't want THIS twice! */
X	    }
X}
X
X#ifdef USE_EMBEDDED_ADDRESSES
X
Xget_address_from(prefix, line, buffer)
Xchar *prefix, *line, *buffer;
X{
X	/** This routine extracts the address from either a 'From:' line
X	    or a 'Reply-To:' line...the algorithm is quite simple, too:
X	    increment 'line' past header, then check last character of 
X	    line.  If it's a '>' then the address is contained within '<>'
X	    and if it's a ')' then the address is in the 'clear'... **/
X
X	register int i, j = 0;
X	
X	no_ret(line);
X
X	line = (char *) (line + strlen(prefix) + 1);
X
X	if (line[strlen(line)-1] == '>') {
X	  for (i=strlen(line)-2; i > -1 && line[i] != '<'; i--)
X	    buffer[j++] = line[i];
X	  buffer[j] = 0;
X	  reverse(buffer);
X	}
X	else {	/* either ')' or address in the clear... */
X	  for (i=0; i < strlen(line) && line[i] != '('; i++)
X	    buffer[j++] = line[i];
X	  if (buffer[j-1] == '(') j--;
X	  buffer[j] = 0;
X	}
X}
X
X#endif
X
Xtranslate_return(addr, ret_addr)
Xchar *addr, *ret_addr;
X{
X	/** Return ret_addr to be the same as addr, but with the login 
X            of the person sending the message replaced by '%s' for 
X            future processing... 
X	    Fixed to make "%xx" "%%xx" (dumb 'C' system!) 
X	**/
X
X	register int loc, loc2, index = 0;
X	
X	loc2 = chloc(addr,'@');
X	if ((loc = chloc(addr, '%')) < loc2)
X	  loc2 = loc;
X
X	if (loc2 != -1) {	/* ARPA address. */
X	  /* algorithm is to get to '@' sign and move backwards until
X	     we've hit the beginning of the word or another metachar.
X	  */
X	  for (loc = loc2 - 1; loc > -1 && addr[loc] != '!'; loc--)
X	     ;
X	}
X	else {			/* usenet address */
X	  /* simple algorithm - find last '!' */
X
X	  loc2 = strlen(addr);	/* need it anyway! */
X
X	  for (loc = loc2; loc > -1 && addr[loc] != '!'; loc--)
X	      ;
X	}
X	
X	/** now copy up to 'loc' into destination... **/
X
X	while (index <= loc) {
X	  ret_addr[index] = addr[index];
X	  index++;
X	}
X
X	/** now append the '%s'... **/
X
X	ret_addr[index++] = '%';
X	ret_addr[index++] = 's';
X
X	/** and, finally, if anything left, add that **/
X
X	while (loc2 < strlen(addr)) {
X	  ret_addr[index++] = addr[loc2++];
X	  if (addr[loc2-1] == '%')	/* tweak for "printf" */
X	    ret_addr[index++] = '%';
X	}
X	
X	ret_addr[index] = '\0';
X}
X
Xint
Xbuild_address(to, full_to)
Xchar *to, *full_to;
X{
X	/** loop on all words in 'to' line...append to full_to as
X	    we go along, until done or length > len.  Modified to
X	    know that stuff in parens are comments...Returns non-zero
X	    if it changed the information as it copied it across...
X	**/
X
X	register int i, changed = 0, in_parens = 0, expanded_information = 0;
X	char word[SLEN], *ptr, buffer[SLEN];
X	char new_to_list[LONG_SLEN];
X	char *strpbrk(), *expand_system(), *strcat();
X
X	new_to_list[0] = '\0';
X
X	i = get_word(to, 0, word);
X
X	full_to[0] = '\0';
X
X	while (i > 0) {
X
X	  if (word[0] == '(' || in_parens) {
X	    in_parens = (word[strlen(word-1)] != ')');
X	    strcat(full_to, " ");
X	    strcat(full_to, word);
X	  }
X	  else if (strpbrk(word,"!@:") != NULL) {
X#ifdef DONT_TOUCH_ADDRESSES
X	    sprintf(full_to, "%s%s%s", full_to,
X                    full_to[0] != '\0'? ", " : "", word);
X#else
X	    sprintf(full_to, "%s%s%s", full_to,
X                    full_to[0] != '\0'? ", " : "", expand_system(word, 1));
X#endif
X	  }
X	  else if ((ptr = get_alias_address(word, 1, 0)) != NULL) {
X	    sprintf(full_to, "%s%s%s", full_to, 
X                    full_to[0] != '\0'? ", " : "", ptr);
X	    expanded_information++;
X	  }
X	  else if (strlen(word) > 0) {
X	    if (valid_name(word)) 
X	      sprintf(full_to, "%s%s%s", full_to,
X                      full_to[0] != '\0'? ", " : "", word);
X	    else if (check_only) {
X	      printf("(alias \"%s\" is unknown)\n\r", word);
X	      changed++;
X	    }
X	    else if (! isatty(fileno(stdin)) ) {	/* batch mode error! */
X	      fprintf(stderr,"Cannot expand alias '%s'!\n\r", word);
X	      fprintf(stderr,"Use \"checkalias\" to find valid addresses!\n\r");
X	      dprint(1, (debugfile,
X		      "Can't expand alias %s - bailing out of build_address\n", 
X		      word));
X	      emergency_exit();
X	    }
X	    else {
X	      dprint(2,(debugfile,"Entered unknown address %s\n", word));
X	      sprintf(buffer, "'%s' is an unknown address.  Replace with: ", 
X	              word);
X	      word[0] = '\0';
X
X	      if (mail_only) 
X	        printf(buffer);
X	      else
X	        PutLine0(LINES, 0, buffer);
X		
X	      (void) optionally_enter(word, LINES, strlen(buffer), FALSE);
X	      if (strlen(word) > 0) {
X	        sprintf(new_to_list, "%s%s%s", new_to_list,
X			strlen(new_to_list) > 0? " ":"", word);
X	        dprint(3,(debugfile, "Replaced with %s in build_address\n", 
X			 word));
X	      }
X	      else
X		dprint(3,(debugfile, 
X		    "Address removed from TO list by build_address\n"));
X	      if (mail_only) printf("\n\r");
X	      changed++;
X	      clear_error();
X	      continue;
X	    }
X	  }
X
X	  i = get_word(to, i, word);
X	}
X
X	if (changed)
X	  strcpy(to, new_to_list);
X
X	return( expanded_information > 0 ? 1 : 0 );
X}
X
Xint
Xreal_from(buffer, entry)
Xchar *buffer;
Xstruct header_rec *entry;
X{
X	/***** Returns true iff 's' has the seven 'from' fields, (or
X	       8 - some machines include the TIME ZONE!!!)
X	       Initializing the date and from entries in the record 
X	       and also the message received date/time.  *****/
X
X	char junk[STRING], timebuff[STRING], holding_from[SLEN];
X	int  eight_fields = 0;
X
X	entry->year[0] = '\0';
X	junk[0] = '\0';
X
X	/* From <user> <day> <month> <day> <hr:min:sec> <year> */
X
X	sscanf(buffer, "%*s %*s %*s %*s %*s %s %*s %s", timebuff, junk);
X
X	if (timebuff[1] != ':' && timebuff[2] != ':') { 
X	  dprint(3,(debugfile, 
X		"Real_from returns FAIL [bad time field] on\n-> %s\n", 
X		buffer));
X	  return(FALSE);
X	}
X	if (junk[0] != '\0') {	/* try for 8 field entry */
X	  junk[0] = '\0';
X	  sscanf(buffer, "%*s %*s %*s %*s %*s %s %*s %*s %s", timebuff, junk);
X	  if (junk[0] != '\0') {
X	    dprint(3, (debugfile, 
X		  "Real_from returns FAIL [too many fields] on\n-> %s\n", 
X		  buffer));
X	    return(FALSE);
X	  }
X	  eight_fields++;
X	}
X
X	/** now get the info out of the record! **/
X
X	if (eight_fields) 
X	  sscanf(buffer, "%s %s %s %s %s %s %*s %s",
X	            junk, holding_from, entry->dayname, entry->month, 
X                    entry->day, entry->time, entry->year);
X	else
X	  sscanf(buffer, "%s %s %s %s %s %s %s",
X	            junk, holding_from, entry->dayname, entry->month, 
X                    entry->day, entry->time, entry->year);
X	
X	strncpy(entry->from, holding_from, STRING);
X	resolve_received(entry);
X	return(entry->year[0] != '\0');
X}
X
Xforwarded(buffer, entry)
Xchar *buffer;
Xstruct header_rec *entry;
X{
X	/** Change 'from' and date fields to reflect the ORIGINATOR of 
X	    the message by iteratively parsing the >From fields... 
X	    Modified to deal with headers that include the time zone
X	    of the originating machine... **/
X
X	char machine[SLEN], buff[SLEN], holding_from[SLEN];
X
X	machine[0] = holding_from[0] = '\0';
X
X	sscanf(buffer, "%*s %s %s %s %s %s %s %*s %*s %s",
X	            holding_from, entry->dayname, entry->month, 
X                    entry->day, entry->time, entry->year, machine);
X
X	if (isdigit(entry->month[0])) { /* try for veeger address */
X	  sscanf(buffer, "%*s %s %s%*c %s %s %s %s %*s %*s %s",
X	            holding_from, entry->dayname, entry->day, entry->month, 
X                    entry->year, entry->time, machine);
X	}
X	if (isalpha(entry->year[0])) { /* try for address including tz */
X	  sscanf(buffer, "%*s %s %s %s %s %s %*s %s %*s %*s %s",
X	            holding_from, entry->dayname, entry->month, 
X                    entry->day, entry->time, entry->year, machine);
X	}
X
X	/* the following fix is to deal with ">From xyz ... forwarded by xyz"
X	   which occasionally shows up within AT&T.  Thanks to Bill Carpenter
X	   for the fix! */
X
X	if (strcmp(machine, holding_from) == 0)
X	  machine[0] = '\0';
X
X	if (machine[0] == '\0')
X	  strcpy(buff, holding_from[0] ? holding_from : "anonymous");
X	else
X	  sprintf(buff,"%s!%s", machine, holding_from);
X
X	strncpy(entry->from, buff, STRING);
X}
X
Xparse_arpa_from(buffer, newfrom)
Xchar *buffer, *newfrom;
X{
X	/** try to parse the 'From:' line given... It can be in one of
X	    two formats:
X		From: Dave Taylor <hplabs!dat>
X	    or  From: hplabs!dat (Dave Taylor)
X
X	    Added: removes quotes if name is quoted (12/12)
X	    Added: only copies STRING characters...
X	    Added: if no comment part, copy address instead! 
X	**/
X
X	char temp_buffer[SLEN], *temp;
X	register int i, j = 0;
X
X	temp = (char *) temp_buffer;
X	temp[0] = '\0';
X
X	no_ret(buffer);		/* blow away '\n' char! */
X
X	if (lastch(buffer) == '>') {
X	  for (i=strlen("From: "); buffer[i] != '\0' && buffer[i] != '<' &&
X	       buffer[i] != '('; i++)
X	    temp[j++] = buffer[i];
X	  temp[j] = '\0';
X	}
X	else if (lastch(buffer) == ')') {
X	  for (i=strlen(buffer)-2; buffer[i] != '\0' && buffer[i] != '(' &&
X	       buffer[i] != '<'; i--)
X	    temp[j++] = buffer[i];
X	  temp[j] = '\0';
X	  reverse(temp);
X	}
X
X#ifdef USE_EMBEDDED_ADDRESSES
X
X	/** if we have a null string at this point, we must just have a 
X	    From: line that contains an address only.  At this point we
X	    can have one of a few possibilities...
X
X		From: address
X		From: <address>
X		From: address ()
X	**/
X	  
X	if (strlen(temp) == 0) {
X	  if (lastch(buffer) != '>') {       
X	    for (i=strlen("From:");buffer[i] != '\0' && buffer[i] != '('; i++)
X	      temp[j++] = buffer[i];
X	    temp[j] = '\0';
X	  }
X	  else {	/* get outta '<>' pair, please! */
X	    for (i=strlen(buffer)-2;buffer[i] != '<' && buffer[i] != ':';i--)
X	      temp[j++] = buffer[i];
X	    temp[j] = '\0';
X	    reverse(temp);
X	  }
X	}
X#endif
X	  
X	if (strlen(temp) > 0) {		/* mess with buffer... */
X
X	  /* remove leading spaces and quotes... */
X
X	  while (whitespace(temp[0]) || quote(temp[0]))
X	    temp = (char *) (temp + 1);		/* increment address! */
X
X	  /* remove trailing spaces and quotes... */
X
X	  i = strlen(temp) - 1;
X
X	  while (whitespace(temp[i]) || quote(temp[i]))
X	   temp[i--] = '\0';
X
X	  /* if anything is left, let's change 'from' value! */
X
X	  if (strlen(temp) > 0)
X	    strncpy(newfrom, temp, STRING);
X	}
X}
X
Xparse_arpa_date(string, entry)
Xchar *string;
Xstruct header_rec *entry;
X{
X	/** Parse and figure out the given date format... return
X	    the entry fields changed iff it turns out we have a
X	    valid parse of the date!  **/
X
X	char word[15][NLEN], buffer[SLEN], *bufptr;
X	char *aword;
X	int  words = 0;
X
X	strcpy(buffer, string);
X	bufptr = (char *) buffer;
X
X	/** break the line down into words... **/
X
X	while ((aword = strtok(bufptr," \t '\"-/(),.")) != NULL) {
X	  strcpy(word[words++], aword);
X	  bufptr = NULL;
X	}
X
X	if (words < 6) {	/* strange format.  We're outta here! */
X	  dprint(3,(debugfile, 
X		"Parse_arpa_date failed [less than six fields] on\n-> %s\n",
X		string));
X	  return;
X	}
X
X	/* There are now five possible combinations that we could have:
X	 
X	    Date: day_number month_name year_number time timezone
X	    Date: day_name day_number month_name year_number ...
X	    Date: day_name month_name day_number time year_number
X	    Date: day_name month_name day_number year_number time
X	    Date: day_number month_name year_number time timezone day_name
X
X	   Note that they are distinguishable by checking the first
X	   character of the second, third and fourth words... 
X	*/
X
X	if (isdigit(word[1][0])) {			/*** type one! ***/
X	  if (! valid_date(word[1], word[2], word[3])) {
X	    dprint(3,(debugfile, 
X		  "parse_arpa_date failed [bad date: %s/%s/%s] on\n-> %s\n",
X		  word[1], word[2], word[3], string));
X	    return;		/* strange date! */
X	  }
X	  strncpy(entry->day, word[1], 3);
X	  strncpy(entry->month, word[2], 3);
X	  strncpy(entry->year,  word[3], 4);
X	  strncpy(entry->time,  word[4], 10);
X	}
X	else if (isdigit(word[2][0])) {		        /*** type two! ***/
X	  if (! valid_date(word[2], word[3], word[4])) {
X	    dprint(3,(debugfile,
X		  "parse_arpa_date failed [bad date: %s/%s/%s] on\n-> %s\n",
X		  word[2], word[3], word[4], string));
X	    return;		/* strange date! */
X	  }
X	  strncpy(entry->day, word[2], 3);
X	  strncpy(entry->month, word[3], 3);
X	  strncpy(entry->year,  word[4], 4);
X	  strncpy(entry->time,  word[5], 10);
X	}
X	else if (isdigit(word[3][0])) {		
X	  if (word[4][1] == ':' || 
X              word[4][2] == ':') {	               /*** type three! ***/
X	    if (! valid_date(word[3], word[2], word[5])) {
X	     dprint(3, (debugfile,
X		"parse_arpa_date failed [bad date: %s/%s/%s] on\n-> %s\n",
X		    word[3], word[2], word[5], string));
X	      return;		/* strange date! */
X	    }
X	    strncpy(entry->year,  word[5], 4);
X	    strncpy(entry->time,  word[4], 10);
X	  }
X	  else {				       /*** type four!  ***/ 
X	    if (! valid_date(word[3], word[2], word[4])) {
X	     dprint(3,(debugfile,
X		    "parse_arpa_date failed [bad date: %s/%s/%s] on\n-> %s\n",
X		    word[3], word[2], word[4], string));
X	      return;		/* strange date! */
X	    }
X	    strncpy(entry->year,  word[4], 4);
X	    strncpy(entry->time, word[5], 10);
X	  }
X	  strncpy(entry->day, word[3], 3);
X	  strncpy(entry->month, word[2], 3);
X	}
X
X	/** finally, let's just normalize the monthname to be a three
X	    letter abbreviation, with the first capitalized and the
X	    second and third in lowercase... **/
X
X	shift_lower(entry->month);
X	entry->month[0] = toupper(entry->month[0]);
X}
X
Xfix_arpa_address(address)
Xchar *address;
X{
X	/** Given a pure ARPA address, try to make it reasonable.
X
X	    This means that if you have something of the form a@b@b make 
X            it a@b.  If you have something like a%b%c%b@x make it a%b@x...
X	**/
X
X	register int host_count = 0, i;
X	char     hosts[MAX_HOPS][2*NLEN];	/* array of machine names */
X	char     *host, *addrptr;
X
X	/*  break down into a list of machine names, checking as we go along */
X	
X	addrptr = (char *) address;
X
X	while ((host = get_token(addrptr, "%@", 2)) != NULL) {
X	  for (i = 0; i < host_count && ! equal(hosts[i], host); i++)
X	      ;
X
X	  if (i == host_count) {
X	    strcpy(hosts[host_count++], host);
X	    if (host_count == MAX_HOPS) {
X	       dprint(2, (debugfile, 
X           "Can't build return address - hit MAX_HOPS in fix_arpa_address\n"));
X	       error("Can't build return address - hit MAX_HOPS limit!");
X	       return(1);
X	    }
X	  }
X	  else 
X	    host_count = i + 1;
X	  addrptr = NULL;
X	}
X
X	/** rebuild the address.. **/
X
X	address[0] = '\0';
X
X	for (i = 0; i < host_count; i++)
X	  sprintf(address, "%s%s%s", address, 
X	          address[0] == '\0'? "" : 
X	 	    (i == host_count - 1 ? "@" : "%"),
X	          hosts[i]);
X
X	return(0);
X}
X
Xfigure_out_addressee(buffer, mail_to)
Xchar *buffer;
Xchar *mail_to;
X{
X	/** This routine steps through all the addresses in the "To:"
X	    list, initially setting it to the first entry (if mail_to
X	    is NULL) or, if the user is found (eg "alternatives") to
X	    the current "username".
X
X	    Modified to know how to read quoted names...
X	    also modified to look for a comma or eol token and then
X	    try to give the maximal useful information when giving the
X	    default "to" entry (e.g. "Dave Taylor <taylor@hpldat>"
X	    will now give "Dave Taylor" rather than just "Dave")
X	**/
X
X	char *address, *bufptr, mybuf[SLEN];
X	register int index = 0, index2 = 0;
X	
X	if (equal(mail_to, username)) return;	/* can't be better! */
X
X	bufptr = (char *) buffer;	       /* use the string directly   */
X
X	if (strchr(buffer,'"') != NULL) {	/* we have a quoted string */
X	  while (buffer[index] != '"')
X	    index++;
X	  index++;	/* skip the leading quote */
X	  while (buffer[index] != '"' && index < strlen(buffer))
X	    mail_to[index2++] = buffer[index++];
X	  mail_to[index2] = '\0';
X	}
X
X	else  {
X
X	  while ((address = strtok(bufptr, ",\t\n\r")) != NULL) {
X
X	    if (! okay_address(address, "don't match me!")) {
X	      strcpy(mail_to, username);	/* it's to YOU! */
X	      return;
X	    }
X	    else if (strlen(mail_to) == 0) {	/* it's SOMEthing! */
X	
X	      /** this next bit is kinda gory, but allows us to use the
X		  existing routines to parse the address - by pretending
X		  it's a From: line and going from there...
X	          Ah well - you get what you pay for, right?
X	      **/
X
X	      if (strlen(address) > (sizeof mybuf) - 7)	/* ensure it ain't */
X		address[(sizeof mybuf)-7] = '\0';	/*  too long mon!  */
X
X	      sprintf(mybuf, "From: %s", address);
X	      parse_arpa_from(mybuf, mail_to);
X/**
X	      get_return_name(address, mail_to, FALSE);
X**/
X	    }
X
X	    bufptr = (char *) NULL;	/* set to null */
X	  }
X	}
X
X	return;
X}
SHAR_EOF
chmod 0444 src/addr_util.c || echo "restore of src/addr_util.c fails"
echo "x - extracting src/alias.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > src/alias.c &&
X
Xstatic char rcsid[] = "@(#)$Id: alias.c,v 2.1.1.2 88/09/23 syd Exp $";
X
X/*******************************************************************************
X *  The Elm Mail System  -  $Revision: 2.1 $   $State: Exp $
X *
X * 			Copyright (c) 1986 Dave Taylor
X *******************************************************************************
X * Bug reports, patches, comments, suggetions should be sent to:
X *
X *	Syd Weinstein, Elm Corrdinator
X *	syd@dsinc.UUCP			dsinc!syd
X *
X *******************************************************************************
X * $Log:	alias.c,v $
X * Revision 2.1  88/09/15  20:27:23  syd
X * checked in with -k by syd at 88.09.15.20.27.23.
X * 
X * 88/08/27 ssw
X *	split tolower and ReadCh due to macro calls
X *
X * Revision 2.1  88/07/21  09:57:46  edc
X * Final hacks and cleanup to the 2.1 alpha test release.
X * 
X * Revision 2.0  88/06/27  17:24:46  edc
X * The original 2.0 gamma sources as leaked from HP
X * 
X *
X *
X ******************************************************************************/
X
X/** This file contains alias stuff
X
X**/
X
X#include "headers.h"
X#include <errno.h>
X
X#ifdef BSD
X#undef        tolower
X#endif
X
Xchar *expand_group(), *get_alias_address(), *expand_system(), *get_token();
Xchar *error_name(), *error_description(), *strip_parens();
SHAR_EOF
echo "End of part 8"
echo "File src/alias.c is continued in part 9"
echo "9" > s2_seq_.tmp
exit 0
-- 
=====================================================================
Sydney S. Weinstein, CDP, CCP                   Elm Coordinator
Datacomp Systems, Inc.				Voice: (215) 947-9900
{allegra,bellcore,bpa,vu-vlsi}!dsinc!syd	FAX:   (215) 938-0235