[comp.mail.elm] Elm Patch 7 of 8

taylor@hpldat.UUCP (Dave Taylor) (05/03/87)

This is Elm Patch Kit #7 of 8 and contains patches for the following:

  hdrs/save_opts.h   hdrs/elm.h     hdrs/sysdefs.master   hdrs/shortnames.h
  hdrs/filter.h      utils/answer.c utils/autoreply.c     utils/from.c
  utils/newalias.c   utils/wnewmail.c

SPECIAL NOTE: the patches for 'utils/from.c' apply to the version previously
made available in this group *not* the one distributed in mod.sources

Please feed this file to 'patch'.


Index: hdrs/save_opts.h

***************
*** 45,46
  #define WEEDOUT			37
  

--- 45,47 -----
  #define WEEDOUT			37
+ #define ASK			38
  
***************
*** 46,48
  
! #define NUMBER_OF_SAVEABLE_OPTIONS	WEEDOUT+1
  

--- 47,49 -----
  
! #define NUMBER_OF_SAVEABLE_OPTIONS	ASK+1
  
***************
*** 65,67
   { "titles", -1L },       { "userlevel", -1L }, 	{ "warnings", -1L },
!  { "weed", -1L },         { "weedout", -1L }
  };

--- 66,68 -----
   { "titles", -1L },       { "userlevel", -1L }, 	{ "warnings", -1L },
!  { "weed", -1L },         { "weedout", -1L },		{ "ask", -1L }
  };

Index: hdrs/elm.h

***************
*** 18,20
  
! static char copyright[] = { "@(#)          (C) Copyright 1986, Dave Taylor" };
  

--- 18,21 -----
  
! static char copyright[] = { 
! 		"@(#)          (C) Copyright 1986, 1987, Dave Taylor" };
  
***************
*** 47,48
  char backspace,			/* the current backspace char */
       kill_line;			/* the current kill-line char */

--- 48,50 -----
  char backspace,			/* the current backspace char */
+      escape_char = TILDE,	/* '~' or something else..    */
       kill_line;			/* the current kill-line char */
***************
*** 92,97
  int keep_empty_files = 0;	/* flag: leave empty mailbox files? */
! 
! #ifdef UTS
!  int isatube = 0;		/* flag: are we on an IBM 3270?     */
! #endif
  

--- 94,96 -----
  int keep_empty_files = 0;	/* flag: leave empty mailbox files? */
! int clear_pages = 0;		/* flag: act like "page" (more -c)? */
  

Index: hdrs/sysdefs.master

***************
*** 148,150
      uncomment the following lines and set them to reasonable values.  See 
!     the configuration guide for more details....
  **/

--- 148,152 -----
      uncomment the following lines and set them to reasonable values.  See 
!     the configuration guide for more details....(actually these are undoc-
!     umented because they're fairly dangerous to use.  Just ignore 'em and
!     perhaps one day you'll find out what they do, ok?)
  **/
***************
*** 164,165
  
  /** are you stuck on a machine that has short names?  If so, define the

--- 166,170 -----
  
+ /** How about the 'cuserid()' call?  If not...well...you get the idea  **/
+ /** #define NEED_CUSERID **/
+ 
  /** are you stuck on a machine that has short names?  If so, define the
***************
*** 169,173
  
- #define NOTES_HEADER		"/***** "
- #define NOTES_FOOTER		"/* ---------- */"
- 
  #ifdef BSD

--- 174,175 -----
  
  #ifdef BSD
***************
*** 186,188
  /** where to put the output of the elm -d command... (in home dir) **/
! #define DEBUG		"ELM:debug.info"
  #define OLDEBUG		"ELM:debug.last"

--- 188,190 -----
  /** where to put the output of the elm -d command... (in home dir) **/
! #define DEBUGFILE	"ELM:debug.info"
  #define OLDEBUG		"ELM:debug.last"
***************
*** 207,209
  
! # define default_pager	"builtin"
  

--- 209,212 -----
  
! # define default_shell	"/bin/csh"
! # define default_pager	"builtin+"
  

Index: hdrs/shortnames.h

***************
*** 5,7
  
! 	This file has no explicit copyright.
  

--- 5,7 -----
  
!     Additions and all that are more recent, of course...
  
***************
*** 8,9
  **/
  

--- 8,12 -----
  **/
+ 
+ #define CleartoEOS		Clear_EOS
+ #define CleartoEOLN		Clear_EOLN
  

Index: hdrs/filter.h

***************
*** 14,16
  
! #define  BEEP		(audible? "\007" : "")
  

--- 14,16 -----
  
! #define  BEEP		(audible? "" : "")
  
***************
*** 22,23
  
  /** some of the files we'll be using, where they are, and so on... **/

--- 22,27 -----
  
+ #define remove_return(s)	{ if (s[strlen(s)-1] == '\n') \
+ 				    s[strlen(s)-1] = '\0';    \
+ 			   	}
+ 
  /** some of the files we'll be using, where they are, and so on... **/
***************
*** 38,39
  
  #define  TO		1

--- 42,47 -----
  
+ #ifdef SUBJECT
+ # undef SUBJECT
+ #endif
+ 
  #define  TO		1
***************
*** 41,43
  #define  LINES		3
! #define  CONTAINS	4
  

--- 49,53 -----
  #define  LINES		3
! #define  SUBJECT	4
! #define  CONTAINS	5
! #define  ALWAYS		6
  
***************
*** 43,50
  
! #define  DELETE 	5
! #define  SAVE		6
! #define  SAVECC		7
! #define  FORWARD	8
! #define  LEAVE		9
! #define  EXEC		10
  

--- 53,60 -----
  
! #define  DELETE 	7
! #define  SAVE		8
! #define  SAVECC		9
! #define  FORWARD	10
! #define  LEAVE		11
! #define  EXEC		12
  
***************
*** 89,90
       log_actions_only = FALSE,			/* log actions | everything */
       rule_choosen;				/* which one we choose      */

--- 99,101 -----
       log_actions_only = FALSE,			/* log actions | everything */
+      printing_rules = FALSE,			/* are we just using '-r'?  */
       rule_choosen;				/* which one we choose      */
***************
*** 100,101
             log_actions_only,			/* log actions | everything */
             rule_choosen;			/* which one we choose      */

--- 111,113 -----
             log_actions_only,			/* log actions | everything */
+            printing_rules,			/* are we just using '-r'?  */
             rule_choosen;			/* which one we choose      */

Index: utils/answer.c

***************
*** 46,49
  prompt:   printf("\nMessage to: ");
! 	  gets(user_name, SLEN);
! 	  if (user_name == NULL)
  	    goto prompt;

--- 46,48 -----
  prompt:   printf("\nMessage to: ");
! 	  if (gets(user_name) == NULL || user_name[0] == '\0')
  	    goto prompt;
***************
*** 169,171
  	  lseek(user_data, user_hash_table[loc].byte, 0L);
! 	  get_line(user_data, buffer, LONG_STRING);
  	  if (buffer[0] == '!' && mailing)

--- 168,170 -----
  	  lseek(user_data, user_hash_table[loc].byte, 0L);
! 	  get_line(user_data, buffer);
  	  if (buffer[0] == '!' && mailing)

Index: utils/autoreply.c

***************
*** 100,102
  	      copied++;
! 	      fprintf(tempfile, "%s %s %ld\n", user, filename, filesize);
  	    }

--- 100,102 -----
  	      copied++;
! 	      fprintf(temp, "%s %s %ld\n", user, filename, filesize);
  	    }

Index: utils/from.c

***************
*** 99,100
  	}
  }

--- 99,101 -----
  	}
+ 	exit(0);
  }
***************
*** 231,233
  	
! 	if (chloc(from,'!') != -1 && chloc(from,'@') > 0)
  	  for (p=from;*p != '@'; p++) ;

--- 232,234 -----
  	
! 	if (chloc(from,'!') != -1 && chloc(from,'@') > 0) {
  	  for (p=from;*p != '@'; p++) ;
***************
*** 234,235
  	  *p = '\0';
  #endif

--- 235,237 -----
  	  *p = '\0';
+ 	}
  #endif

Index: utils/newalias.c

***************
*** 11,13
  	If, however, it is invoked with no arguments, then
!   it assumes that the user is updating the system alias
    file and uses the defaults for everything.

--- 11,13 -----
  	If, however, it is invoked with no arguments, then
!   it assumes that the user is updating the is_system alias
    file and uses the defaults for everything.
***************
*** 29,31
  #include <stdio.h>
! #include "defs.h"		/* ELM system definitions */
  

--- 29,31 -----
  #include <stdio.h>
! #include "defs.h"		/* ELM is_system definitions */
  
***************
*** 43,44
  
  struct alias_rec

--- 43,46 -----
  
+ #define whitespace(c)		(c == ' ' || c == '\t')
+ 
  struct alias_rec
***************
*** 49,51
  
! int  hash_table_loaded=0;	/* is system table actually loaded? */
  

--- 51,53 -----
  
! int  hash_table_loaded=0;	/* is is_system table actually loaded? */
  
***************
*** 53,55
  int  error= 0;			/* if errors, don't save!    */
! int  system=0;			/* system file updating?     */
  int  count=0;			/* how many aliases so far?  */

--- 55,57 -----
  int  error= 0;			/* if errors, don't save!    */
! int  is_system=0;			/* is_system file updating?     */
  int  count=0;			/* how many aliases so far?  */
***************
*** 75,78
  	if (owner == 0 && ! quiet) {	/* being run by root! */
! 	  printf("Would you like to update the system aliases? (y/n)");
! 	  gets(buffer, 2);
  	  if (buffer[0] == 'y' || buffer[0] == 'Y') {

--- 77,80 -----
  	if (owner == 0 && ! quiet) {	/* being run by root! */
! 	  printf("Would you like to update the is_system aliases? (y/n)");
! 	  gets(buffer);
  	  if (buffer[0] == 'y' || buffer[0] == 'Y') {
***************
*** 83,85
  	    sprintf(dataname, "%s/%s", mailhome, alias_data);
! 	    system++;
  	    init_table(shash_table, MAX_SALIASES); 

--- 85,87 -----
  	    sprintf(dataname, "%s/%s", mailhome, alias_data);
! 	    is_system++;
  	    init_table(shash_table, MAX_SALIASES); 
***************
*** 90,92
  	
! 	if (! system) {
  	  if (strcpy(home, getenv("HOME")) == NULL)

--- 92,94 -----
  	
! 	if (! is_system) {
  	  if (strcpy(home, getenv("HOME")) == NULL)
***************
*** 92,94
  	  if (strcpy(home, getenv("HOME")) == NULL)
! 	    exit(printf("Confused: No HOME variable in environment!\n"));
  

--- 94,96 -----
  	  if (strcpy(home, getenv("HOME")) == NULL)
! 	    exit(printf("I'm confused - no HOME variable in environment!\n"));
  
***************
*** 115,117
  	while (get_alias(in, buffer) != -1) {
! 	  if (system)
  	    put_alias(data, buffer, shash_table, MAX_SALIASES);	

--- 117,119 -----
  	while (get_alias(in, buffer) != -1) {
! 	  if (is_system)
  	    put_alias(data, buffer, shash_table, MAX_SALIASES);	
***************
*** 128,130
  	else {
! 	  if (system)
  	    write(hash, shash_table, sizeof shash_table);

--- 130,132 -----
  	else {
! 	  if (is_system)
  	    write(hash, shash_table, sizeof shash_table);
***************
*** 229,230
  	    then just return! **/
  	int stat;

--- 231,233 -----
  	    then just return! **/
+ 
  	int stat;
***************
*** 233,235
  	  buff_loaded = 1;
! 	  return;
  	}

--- 236,238 -----
  	  buff_loaded = 1;
! 	  return(0);
  	}
***************
*** 304,306
  
! 	if ( system ? count > MAX_SALIASES-35 : count > MAX_UALIASES-21) {
  	  printf("** Too many aliases in file! **\n");

--- 307,309 -----
  
! 	if ( is_system ? count > MAX_SALIASES-35 : count > MAX_UALIASES-21) {
  	  printf("** Too many aliases in file! **\n");
***************
*** 399,401
  {
! 	/** read in the system hash table...to check for group aliases
  	    from the user alias file (to ensure that there are no names

--- 402,404 -----
  {
! 	/** read in the is_system hash table...to check for group aliases
  	    from the user alias file (to ensure that there are no names
***************
*** 421,423
  	/** one by one make sure each name in the group is defined
! 	    in either the system alias file or the user alias file.
  	    This search is linearly dependent, so all group aliases

--- 424,426 -----
  	/** one by one make sure each name in the group is defined
! 	    in either the is_system alias file or the user alias file.
  	    This search is linearly dependent, so all group aliases
***************
*** 445,448
  {	
! 	/** find name in either hash table...use 'system' variable to
! 	    determine if we should look in both or just system....    **/
  

--- 448,451 -----
  {	
! 	/** find name in either hash table...use 'is_system' variable to
! 	    determine if we should look in both or just is_system....    **/
  
***************
*** 456,459
  
! 	/** system alias table... **/
! 	if (hash_table_loaded || system) {
  	  loc = hash_it(name, MAX_SALIASES);

--- 459,462 -----
  
! 	/** is_system alias table... **/
! 	if (hash_table_loaded || is_system) {
  	  loc = hash_it(name, MAX_SALIASES);
***************
*** 468,470
  
! 	if (! system) {	/* okay! Let's check the user alias file! */
  	  loc = hash_it(name, MAX_UALIASES);

--- 471,473 -----
  
! 	if (! is_system) {	/* okay! Let's check the user alias file! */
  	  loc = hash_it(name, MAX_UALIASES);
***************
*** 498,500
  
! 	while (buffer[first] == ' ') first++;
  	

--- 501,503 -----
  
! 	while (whitespace(buffer[first])) first++;
  	
***************
*** 500,502
  	
! 	/** now let's backup the 'last' value until we hit a non-space **/
  

--- 503,505 -----
  	
! 	/** now let's backup the 'last' value until we hit a non-whitespace **/
  
***************
*** 503,505
  	last -= 2;	/* starts at ch AFTER colon.. */
! 	while (buffer[last] == ' ') last--;
  

--- 506,508 -----
  	last -= 2;	/* starts at ch AFTER colon.. */
! 	while (whitespace(buffer[last])) last--;
  

Index: utils/wnewmail.c

***************
*** 13,18
  
- #ifdef AUTO_BACKGROUND
- #include <signal.h>	/* background jobs ignore some signals... */
- #endif
- 
  static char ident[] = { WHAT_STRING };

--- 13,14 -----
  
  static char ident[] = { WHAT_STRING };
***************
*** 51,61
  
- #ifdef AUTO_BACKGROUND
- 	if (fork())	    /* automatically puts this task in background! */
- 	  exit(0);
- 
- 	signal(SIGINT, SIG_IGN);
- 	signal(SIGQUIT, SIG_IGN);
- 	signal(SIGHUP,  SIG_DFL);	/* so we exit when logged out */
- #endif
- 
  	size = bytes(filename);

--- 47,48 -----
  
  	size = bytes(filename);
***************
*** 68,73
  	
- #ifndef AUTO_BACKGROUND		/* won't work if we're nested this deep! */
- 	  if (getppid() == 1) 	/* we've lost our shell! */
- 	    exit();
- #endif
  	if (! isatty(1))     /* we're not talking to the screen any more */

--- 55,56 -----
  	
  	if (! isatty(1))     /* we're not talking to the screen any more */

End of patch kit #7