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

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

This is Elm Patch Kit #2 of 8 and contains patches for:

src/delete.c      src/aliasdb.c  src/file.c  src/read_rc.c  src/help.c
src/initialize.c  src/args.c     src/forms.c src/showmsg.c  src/mkhdrs.c

Please feed this directly to the 'patch' program.

Index: src/delete.c

***************
*** 10,13
  
! delete_msg(real_del)
! int real_del;
  {

--- 10,13 -----
  
! delete_msg(real_del, update_screen)
! int real_del, update_screen;
  {
***************
*** 24,26
  
! 	show_msg_status(current-1);
  }

--- 24,27 -----
  
! 	if (update_screen)
! 	  show_msg_status(current-1);
  }
***************
*** 27,29
  
! undelete_msg()
  {

--- 28,31 -----
  
! undelete_msg(update_screen)
! int update_screen;
  {
***************
*** 33,35
  
! 	show_msg_status(current-1);
  }

--- 35,38 -----
  
! 	if (update_screen)
! 	  show_msg_status(current-1);
  }

Index: src/aliasdb.c

***************
*** 62,65
            if (display_error && name[0] != '!') {
! 	    dprint2(2,"Couldn't expand host %s in address. (%s)\n",
! 	             name, "findnode");
  	    if (! check_only && warnings) {	/* be silent if just checking */

--- 62,65 -----
            if (display_error && name[0] != '!') {
! 	    dprint(2, (debugfile, "Couldn't expand host %s in address.\n",
! 	             name));
  	    if (! check_only && warnings) {	/* be silent if just checking */
***************
*** 161,164
  
! 	dprint3(5,"\nBroke address into '%s' @ '%s' '%s'\n\n",
! 		name, sitename, comment);
  

--- 161,164 -----
  
! 	dprint(5, (debugfile, "\nBroke address into '%s' @ '%s' '%s'\n\n",
! 		name, sitename, comment));
  
***************
*** 282,285
  	if (stat(pathfile, &buffer) == -1) {
! 	  dprint2(1, "Warning: No pathalias file [filename %s] found! (%s)\n", 
! 		  pathfile, "init_findnode");
  	  size_of_pathfd = 0;

--- 282,286 -----
  	if (stat(pathfile, &buffer) == -1) {
! 	  dprint(1, (debugfile, 
! 		  "Warning: pathalias file \"%s\" wasn't found by %s\n", 
! 		  pathfile, "init_findnode"));
  	  size_of_pathfd = 0;
***************
*** 293,298
  	if (dbminit(pathfile) != 0) {
! 	  dprint1(1, "Warning: couldn't initialize DBM database %s\n", 
! 		     pathfile);
! 	  dprint2(1, "** %s - %s **\n\n", error_name(errno),
! 		     error_description(errno));
  	  size_of_pathfd = 0;	/* error flag, in this case */

--- 294,300 -----
  	if (dbminit(pathfile) != 0) {
! 	  dprint(1, (debugfile,
! 		 "Warning: couldn't initialize DBM database %s\n", 
! 		 pathfile));
! 	  dprint(1, (debugfile, "** %s - %s **\n\n", error_name(errno),
! 		     error_description(errno)));
  	  size_of_pathfd = 0;	/* error flag, in this case */
***************
*** 305,308
  	if ((pathfd = fopen(pathfile,"r")) == NULL) {
! 	  dprint2(1, "Warning: Can't read pathalias file [filename %s] (%s)\n", 
! 		   pathfile, "init_findnode");
  	  size_of_pathfd = 0;

--- 307,311 -----
  	if ((pathfd = fopen(pathfile,"r")) == NULL) {
! 	  dprint(1, (debugfile,
! 		"Warning: Can't read pathalias file \"%s\" within %s\n", 
! 		   pathfile, "init_findnode"));
  	  size_of_pathfd = 0;
***************
*** 310,313
  	else
! 	  dprint2(2, "\nOpened file '%s' as path alias database.  (%s)\n\n", 
! 		  pathfile, "init_findnode");
  #endif

--- 313,316 -----
  	else
! 	  dprint(2, (debugfile, "\nOpened '%s' as pathalias database.\n\n", 
! 		  pathfile));
  #endif

Index: src/file.c

***************
*** 47,50
  
! 	dprint2(4,"%d message%s tagged for saving (save)\n", tagged,
! 		plural(tagged));
  

--- 47,50 -----
  
! 	dprint(4, (debugfile, "%d message%s tagged for saving (save)\n", tagged,
! 		plural(tagged)));
  
***************
*** 90,91
  	    *redraw = TRUE;	/* set the flag so we know what to do later */
  	    list_folders();

--- 90,92 -----
  	    *redraw = TRUE;	/* set the flag so we know what to do later */
+ 	    Raw(OFF);
  	    list_folders();
***************
*** 91,92
  	    list_folders();
  	    continue_looping++;

--- 92,94 -----
  	    list_folders();
+ 	    Raw(ON);
  	    continue_looping++;
***************
*** 96,99
  	if (! expand_filename(filename)) {
! 	  dprint1(2,"Error: Failed on expansion of filename %s (save)\n", 
! 		   filename);
  	  header_table[current-1].status = oldstat;	/* BACK! */

--- 98,102 -----
  	if (! expand_filename(filename)) {
! 	  dprint(2, (debugfile,
! 		"Error: Failed on expansion of filename %s (save)\n", 
! 		filename));
  	  header_table[current-1].status = oldstat;	/* BACK! */
***************
*** 111,114
  	  error1("Wrong permissions to save message to file %s!", filename);
! 	  dprint2(2,"Error: access permission on file %s denied (%s)! (save)\n",
! 		  filename, error_name(errno));
  	  header_table[current-1].status = oldstat;	/* BACK! */

--- 114,118 -----
  	  error1("Wrong permissions to save message to file %s!", filename);
! 	  dprint(2, (debugfile, 
! 		"Error: access permission on file %s denied (%s)! (save)\n",
! 		filename, error_name(errno)));
  	  header_table[current-1].status = oldstat;	/* BACK! */
***************
*** 117,119
  
! 	dprint1(4,"Saving mail to file '%s'...\n", filename);
  

--- 121,123 -----
  
! 	dprint(4,(debugfile, "Saving mail to file '%s'...\n", filename));
  
***************
*** 120,123
  	if ((save_file = fopen(filename,"a")) == NULL) {
! 	  dprint1(2, "Error: couldn't append to specified file %s (save)\n", 
! 		   filename);
  	  error1("Couldn't append to file %s!", filename);

--- 124,128 -----
  	if ((save_file = fopen(filename,"a")) == NULL) {
! 	  dprint(2, (debugfile,
! 		"Error: couldn't append to specified file %s (save)\n", 
! 		filename));
  	  error1("Couldn't append to file %s!", filename);
***************
*** 155,157
  	
! 	dprint1(4, "\tSaving message %d to file...\n", number);
  

--- 160,162 -----
  	
! 	dprint(4, (debugfile, "\tSaving message %d to file...\n", number));
  
***************
*** 207,210
  	  if (strlen(folders) == 0) {
! 	    dprint2(3,"Error: maildir not defined - can't expand '%c' (%s)\n",
! 		     filename[0], "expand_filename");
  	    error1("MAILDIR not defined.  Can't expand '%c'", filename[0]);

--- 212,216 -----
  	  if (strlen(folders) == 0) {
! 	    dprint(3, (debugfile, 
! 		   "Error: maildir not defined - can't expand '%c' (%s)\n",
! 		   filename[0], "expand_filename"));
  	    error1("MAILDIR not defined.  Can't expand '%c'", filename[0]);
***************
*** 227,230
  	  if (strlen(env_value) == 0) {
! 	    dprint2(3,"Error: Can't expand environment variable $%s (%s)\n",
! 		    varname, "expand_filename");
  	    error1("Don't know what the value of $%s is!", varname);

--- 233,237 -----
  	  if (strlen(env_value) == 0) {
! 	    dprint(3,(debugfile, 
! 		    "Error: Can't expand environment variable $%s (%s)\n",
! 		    varname, "expand_filename"));
  	    error1("Don't know what the value of $%s is!", varname);

Index: src/read_rc.c

***************
*** 18,19
  	pager   = <command to use for displaying messages>
  

--- 18,21 -----
  	pager   = <command to use for displaying messages>
+ 	
+ 	escape  = <single character escape, default = '~' >
  
***************
*** 30,32
  
! 	sortby  = <sent, received, from, size, subject>
  

--- 32,34 -----
  
! 	sortby  = <sent, received, from, size, subject, mailbox>
  
***************
*** 101,103
  	if ((file = fopen(filename, "r")) == NULL) {
! 	  dprint0(2,"Warning: User has no \".elmrc\" file (read_rc_file)\n");
  	  return;	/* we're done! */

--- 103,106 -----
  	if ((file = fopen(filename, "r")) == NULL) {
! 	  dprint(2, (debugfile,
! 		 "** Warning: User has no \".elmrc\" file **\n\n"));
  	  return;	/* we're done! */
***************
*** 122,125
  	  if (word2[0] == 0 && (last != WEEDOUT || last != ALTERNATIVES)) {
! 	    dprint1(2,"Error: Bad .elmrc entry in users file;\n-> \"%s\"\n",
! 		     buffer);
  	    fprintf(stderr, 

--- 125,129 -----
  	  if (word2[0] == 0 && (last != WEEDOUT || last != ALTERNATIVES)) {
! 	    dprint(2, (debugfile,
! 		     "Error: Bad .elmrc entry in users file;\n-> \"%s\"\n",
! 		     buffer));
  	    fprintf(stderr, 
***************
*** 163,164
  	      sortby = SUBJECT;
  	    else if (equal(word2, "reverse-sent") || equal(word2,"rev-sent"))

--- 167,170 -----
  	      sortby = SUBJECT;
+ 	    else if (equal(word2, "mailbox") || equal(word2, "folder"))
+ 	      sortby = MAILBOX_ORDER;
  	    else if (equal(word2, "reverse-sent") || equal(word2,"rev-sent"))
***************
*** 177,178
  	      sortby = - SUBJECT;
  	    else {

--- 183,189 -----
  	      sortby = - SUBJECT;
+ 	    else if (equal(word2, "reverse-mailbox") || 
+ 		     equal(word2, "rev-mailbox") ||
+ 	             equal(word2, "reverse-folder") || 
+ 		     equal(word2, "rev-folder"))
+ 	      sortby = - MAILBOX_ORDER;
  	    else {
***************
*** 208,209
  	    expand_env(pager, word2);
  	    last = NOTWEEDOUT;

--- 219,225 -----
  	    expand_env(pager, word2);
+ 	    if (equal(pager,"builtin+") || equal(pager,"internal+")) {
+ 	      dprint(1,(debugfile, "pager set to %s: clear_pages = ON\n",
+ 		    pager));
+ 	      clear_pages++;
+ 	    }
  	    last = NOTWEEDOUT;
***************
*** 216,218
  	      fprintf(stderr,
!    "\t(signature should specify the filename to use rather than on/off)\n\r");
  	    }

--- 232,234 -----
  	      fprintf(stderr,
!    "\t(signature should specify the filename to use rather than on/off)\n\r\n");
  	    }
***************
*** 235,236
  	  }
  	  else if (equal(word1, "autocopy")) {

--- 251,256 -----
  	  }
+ 	  else if (equal(word1, "escape")) {
+ 	    escape_char = word2[0];
+ 	    last = NOTWEEDOUT;
+ 	  }
  	  else if (equal(word1, "autocopy")) {
***************
*** 578,579
  	fprintf(debugfile, "\n");
  	fprintf(debugfile, "mini_menu = %s\n", on_off(mini_menu));

--- 598,601 -----
  	fprintf(debugfile, "\n");
+ 	fprintf(debugfile, "escape = %c\n", escape_char);
+ 	fprintf(debugfile, "\n");
  	fprintf(debugfile, "mini_menu = %s\n", on_off(mini_menu));
***************
*** 603,605
  
! 	fprintf(debugfile, "\n** userlevel = %s **\n\n", user_level);
  

--- 625,627 -----
  
! 	fprintf(debugfile, "\n** userlevel = %d **\n\n", user_level);
  

Index: src/help.c

***************
*** 183,184
  	sprintf(buffer, "%s/%s.%d", helphome, helpfile, section);
  	if ((hfile = fopen(buffer,"r")) == NULL) {

--- 183,185 -----
  	sprintf(buffer, "%s/%s.%d", helphome, helpfile, section);
+ 
  	if ((hfile = fopen(buffer,"r")) == NULL) {
***************
*** 184,186
  	if ((hfile = fopen(buffer,"r")) == NULL) {
! 	  dprint1(1,"Error: Couldn't open helpfile %s (help)\n", buffer);
  	  error1("couldn't open helpfile %s",buffer);

--- 185,188 -----
  	if ((hfile = fopen(buffer,"r")) == NULL) {
! 	  dprint(1, (debugfile,
! 		 "Error: Couldn't open helpfile %s (help)\n", buffer));
  	  error1("couldn't open helpfile %s",buffer);

Index: src/initialize.c

***************
*** 55,57
  	
- 
  	userid  = getuid();

--- 55,56 -----
  	
  	userid  = getuid();
***************
*** 59,62
  
! 	strcpy(home,((cp = getenv("HOME")) == NULL)? "" : cp);
! 	strcpy(shell,((cp = getenv("SHELL")) == NULL)? "" : cp);
  	strcpy(pager,((cp = getenv("PAGER")) == NULL)? default_pager : cp);

--- 58,61 -----
  
! 	strcpy(home, ((cp = getenv("HOME")) == NULL)? "" : cp);
! 	strcpy(shell,((cp = getenv("SHELL")) == NULL)? default_shell : cp);
  	strcpy(pager,((cp = getenv("PAGER")) == NULL)? default_pager : cp);
***************
*** 63,65
  
! 	if (debug) {		/* setup for dprintf statements! */
  	  char newfname[SLEN], filename[SLEN];

--- 62,65 -----
  
! #ifdef DEBUG
! 	if (debug) {		/* setup for dprint() statements! */
  	  char newfname[SLEN], filename[SLEN];
***************
*** 66,68
  
! 	  sprintf(filename, "%s/%s", home, DEBUG);
  	  if (access(filename, ACCESS_EXISTS) == 0) {	/* already one! */

--- 66,68 -----
  
! 	  sprintf(filename, "%s/%s", home, DEBUGFILE);
  	  if (access(filename, ACCESS_EXISTS) == 0) {	/* already one! */
***************
*** 70,71
  	    (void) link(filename, newfname);
  	  }

--- 70,72 -----
  	    (void) link(filename, newfname);
+ 	    (void) unlink(filename);
  	  }
***************
*** 88,89
  	}
  

--- 89,91 -----
  	}
+ #endif
  
***************
*** 162,165
  	  if ((errno = can_access(infile, READ_ACCESS))) {
! 	    dprint2(1,"Error: given file %s as mailbox - unreadable (%s)!\n", 
! 		     infile, error_name(errno));
  	    fprintf(stderr,"Can't open mailbox '%s' for reading!\n", infile);

--- 164,168 -----
  	  if ((errno = can_access(infile, READ_ACCESS))) {
! 	    dprint(1, (debugfile,
! 		  "Error: given file %s as mailbox - unreadable (%s)!\n", 
! 		  infile, error_name(errno)));
  	    fprintf(stderr,"Can't open mailbox '%s' for reading!\n", infile);
***************
*** 229,231
  
! 	if ((header_table = malloc(KLICK*sizeof(struct header_rec))) == NULL) {
  	   fprintf(stderr,"\n\r\n\rCouldn't allocate initial headers!\n\r\n");

--- 232,235 -----
  
! 	if ((header_table = (struct header_rec *) malloc(KLICK * 
! 	     sizeof(struct header_rec))) == NULL) {
  	   fprintf(stderr,"\n\r\n\rCouldn't allocate initial headers!\n\r\n");
***************
*** 246,248
  
! 	dprint0(2,"\n-- end of initialization phase --\n");
  

--- 250,254 -----
  
! #ifdef DEBUG
! 	if (debug >= 2) {
! 	  fprintf(debugfile,"\n-- end of initialization phase --\n");
  
***************
*** 248,250
  
! 	dprint3(2,"\thostname = %s\n\tusername = %s\n\tfull_username = \"%s\"\n",
  	         hostname, username, full_username);

--- 254,257 -----
  
! 	  fprintf(debugfile,
! 		"\thostname = %s\n\tusername = %s\n\tfull_username = \"%s\"\n",
  	         hostname, username, full_username);
***************
*** 251,253
  
! 	dprint3(2,"\thome = %s\n\teditor = %s\n\tmailbox = %s\n",
  		 home, editor, mailbox);

--- 258,260 -----
  
! 	  fprintf(debugfile,"\thome = %s\n\teditor = %s\n\tmailbox = %s\n",
  		 home, editor, mailbox);
***************
*** 254,256
  
! 	dprint3(2,"\tinfile = %s\n\tfolder-dir = %s\n\tprintout = \"%s\"\n",
  		 infile, folders, printout);

--- 261,264 -----
  
! 	  fprintf(debugfile,
! 		 "\tinfile = %s\n\tfolder-dir = %s\n\tprintout = \"%s\"\n",
  		 infile, folders, printout);
***************
*** 257,259
  	
! 	dprint3(2,"\tsavefile = %s\n\tprefix = \"%s\"\n\tshell = %s\n",
  		savefile, prefixchars, shell);

--- 265,268 -----
  	
! 	  fprintf(debugfile,
! 		"\tsavefile = %s\n\tprefix = \"%s\"\n\tshell = %s\n",
  		savefile, prefixchars, shell);
***************
*** 260,263
  	
! 	if (signature)
! 	  dprint2(2,"\tlocal-signature = %s\n\tremote-signature = %s\n",
  	  	  local_signature, remote_signature);

--- 269,273 -----
  	
! 	  if (signature)
! 	    fprintf(debugfile,
! 		  "\tlocal-signature = %s\n\tremote-signature = %s\n",
  	  	  local_signature, remote_signature);
***************
*** 263,264
  	  	  local_signature, remote_signature);
  

--- 273,275 -----
  	  	  local_signature, remote_signature);
+ 	}
  
***************
*** 264,266
  
! 	dprint0(1,"-- beginning execution phase --\n\n");
  }

--- 275,278 -----
  
! 	dprint(1, (debugfile, "-- beginning execution phase --\n\n"));
! #endif
  }
***************
*** 283,286
  	if (ioctl(STANDARD_INPUT, TCGETA, &term_buffer) == -1) {
! 	  dprint1(1,"Error: %s encountered on ioctl call (get_term_chars)\n", 
! 		   error_name(errno));
  	  /* set to defaults for terminal driver */

--- 295,299 -----
  	if (ioctl(STANDARD_INPUT, TCGETA, &term_buffer) == -1) {
! 	  dprint(1, (debugfile,
! 		   "Error: %s encountered on ioctl call (get_term_chars)\n", 
! 		   error_name(errno)));
  	  /* set to defaults for terminal driver */

Index: src/args.c

***************
*** 57,58
  
  	if (opt_index < argc) {

--- 57,65 -----
  
+ #ifndef DEBUG
+ 	if (debug)
+ 	  printf(
+      "Warning: system created without debugging enabled - request ignored\n");
+ 	debug = 0;
+ #endif
+ 
  	if (opt_index < argc) {

Index: src/forms.c

***************
*** 74,76
  
! 	dprint1(4, "Formatting form file '%s'\n", filename);
  

--- 74,76 -----
  
! 	dprint(4, (debugfile, "Formatting form file '%s'\n", filename));
  
***************
*** 80,82
  	  error("Can't read the message to validate the form!");
! 	  dprint2(1,
                "** Error encountered opening file \"%s\" - %s (check_form) **\n",

--- 80,82 -----
  	  error("Can't read the message to validate the form!");
! 	  dprint(1, (debugfile,
                "** Error encountered opening file \"%s\" - %s (check_form) **\n",
***************
*** 82,84
                "** Error encountered opening file \"%s\" - %s (check_form) **\n",
! 	      filename, error_name(errno));
  	  return(-1);

--- 82,84 -----
                "** Error encountered opening file \"%s\" - %s (check_form) **\n",
! 	      filename, error_name(errno)));
  	  return(-1);
***************
*** 90,92
  	  error("Couldn't open newform file for form output!");
! 	  dprint2(1,
                "** Error encountered opening file \"%s\" - %s (check_form) **\n",

--- 90,92 -----
  	  error("Couldn't open newform file for form output!");
! 	  dprint(1, (debugfile, 
                "** Error encountered opening file \"%s\" - %s (check_form) **\n",
***************
*** 92,94
                "** Error encountered opening file \"%s\" - %s (check_form) **\n",
! 	      newfname, error_name(errno));
  	  return(-1);

--- 92,94 -----
                "** Error encountered opening file \"%s\" - %s (check_form) **\n",
! 	      newfname, error_name(errno)));
  	  return(-1);
***************
*** 147,150
  
! 	dprint2(4, "replying to form with;\n\taddress=%s and\n\t subject=%s\n",
! 		   address, subject);
  

--- 147,151 -----
  
! 	dprint(4, (debugfile, 
! 		"replying to form with;\n\taddress=%s and\n\t subject=%s\n",
! 		 address, subject));
  
***************
*** 151,153
          if (fseek(mailfile, header_table[current-1].offset, 0) == -1) {
! 	  dprint3(1,"Error: seek %ld resulted in errno %s (%s)\n", 
  		   header_table[current-1].offset, error_name(errno), 

--- 152,155 -----
          if (fseek(mailfile, header_table[current-1].offset, 0) == -1) {
! 	  dprint(1, (debugfile,
! 		   "Error: seek %ld resulted in errno %s (%s)\n", 
  		   header_table[current-1].offset, error_name(errno), 
***************
*** 153,155
  		   header_table[current-1].offset, error_name(errno), 
! 		   "mail_filled_in_form");
  	  error2("ELM [seek] couldn't read %d bytes into file (%s)",

--- 155,157 -----
  		   header_table[current-1].offset, error_name(errno), 
! 		   "mail_filled_in_form"));
  	  error2("ELM [seek] couldn't read %d bytes into file (%s)",
***************
*** 175,177
  
! 	dprint0(6,"- past header of form message -\n");
  	

--- 177,179 -----
  
! 	dprint(6, (debugfile, "- past header of form message -\n"));
  	
***************
*** 196,198
  
! 	dprint0(6,"- skipped the non-forms-image stuff -\n");
  	

--- 198,200 -----
  
! 	dprint(6, (debugfile, "- skipped the non-forms-image stuff -\n"));
  	
***************
*** 202,204
  
! 	dprint1(2,"-- forms sending using file %s --\n", buffer);
  

--- 204,206 -----
  
! 	dprint(2, (debugfile,"-- forms sending using file %s --\n", buffer));
  
***************
*** 207,210
  		 error_name(errno));
! 	  dprint2(1,"** Error %s encountered trying to open temp file %s;\n",
! 		  error_name(errno), buffer);
  	  return(0);

--- 209,213 -----
  		 error_name(errno));
! 	  dprint(1, (debugfile,
! 		  "** Error %s encountered trying to open temp file %s;\n",
! 		  error_name(errno), buffer));
  	  return(0);
***************
*** 218,220
  	while ((ptr = fgets(buffer, SLEN, mailfile)) != NULL) {
! 	  dprint1(9,"- read %s", buffer);
  	  if (strcmp(buffer, "***\n") == 0) /* end of form! */

--- 221,223 -----
  	while ((ptr = fgets(buffer, SLEN, mailfile)) != NULL) {
! 	  dprint(9, (debugfile, "- read %s", buffer));
  	  if (strcmp(buffer, "***\n") == 0) /* end of form! */
***************
*** 236,238
  	             else 
! 		      prompt_for_entry(buffer, fd);
  	             break;

--- 239,241 -----
  	             else 
! 		       prompt_for_entry(buffer, fd);
  	             break;
***************
*** 265,267
  
! 	dprint1(7, "prompt-for-entry \"%s\"\n", buffer);
  

--- 268,270 -----
  
! 	dprint(7, (debugfile, "prompt-for-entry \"%s\"\n", buffer));
  
***************
*** 271,273
  
! 	fprintf(fd, "%s: %s", buffer, mybuffer);
  }

--- 274,276 -----
  
! 	fprintf(fd, "%s: %s\n", buffer, mybuffer);
  }
***************
*** 288,291
  
! 	dprint2(7, "prompt-for-multiple [%d] -entries \"%s\"\n", entries,
! 		buffer);
  

--- 291,295 -----
  
! 	dprint(7, (debugfile, 
! 		"prompt-for-multiple [%d] -entries \"%s\"\n", entries,
! 		buffer));
  
***************
*** 342,345
  
! 	dprint2(7, "prompt-for-sized-entry \"%s\" %d chars\n", 
! 		prompt, field_size);
  

--- 346,349 -----
  
! 	dprint(7, (debugfile, "prompt-for-sized-entry \"%s\" %d chars\n", 
! 		prompt, field_size));
  

Index: src/showmsg.c

***************
*** 37,40
  	     two!
! 		Returns non-zero iff screen was changed
! 	***/
  

--- 37,43 -----
  	     two!
! 		Returns non-zero iff the screen was changed, or the
! 	     character pressed at the 'end-of-screen' prompt (to be
! 	     processed via process_showmsg_cmd()).
! 	***/
! 	register int i;
  
***************
*** 40,42
  
! 	dprint0(8, "show_msg called\n");
  

--- 43,45 -----
  
! 	dprint(8, (debugfile, "show_msg called\n"));
  
***************
*** 55,57
  
! 	/* some explaination for that last one - We COULD use memory locking
  	   to speed up the paging, but the action of "ClearScreen" on a screen

--- 58,60 -----
  
! 	/* some explanation for that last one - We COULD use memory locking
  	   to speed up the paging, but the action of "ClearScreen" on a screen
***************
*** 74,76
  	     for message 'msgnumber' by using 'display'
! 	     Returns non-zero iff screen was altered.
  	***/

--- 77,80 -----
  	     for message 'msgnumber' by using 'display'
! 	     Returns non-zero iff screen was altered, or the char
! 	     pressed (see previous routine header comment).
  	***/
***************
*** 76,77
  	***/
  

--- 80,82 -----
  	***/
+ 	int  retval, builtin;
  
***************
*** 77,79
  
! 	dprint3(9,"show_message(%d,%ld,%d)\n", lines, file_loc, msgnumber);
  

--- 82,85 -----
  
! 	dprint(9, (debugfile, "show_message(%d,%ld,%d)\n", 
! 	 	lines, file_loc, msgnumber));
  
***************
*** 80,83
  	if (fseek(mailfile, file_loc, 0) != 0) {
! 	  dprint2(1,"Error: seek %d bytes into file, errno %s (show_message)\n",
! 		  file_loc, error_name(errno));
  	  error2("ELM failed seeking %d bytes into file (%s)",

--- 86,90 -----
  	if (fseek(mailfile, file_loc, 0) != 0) {
! 	  dprint(1, (debugfile,
! 		  "Error: seek %d bytes into file, errno %s (show_message)\n",
! 		  file_loc, error_name(errno)));
  	  error2("ELM failed seeking %d bytes into file (%s)",
***************
*** 88,90
  	if (feof(mailfile))
! 	  dprint0(1,"\n*** seek put us at END OF FILE!!! ***\n");
  

--- 95,97 -----
  	if (feof(mailfile))
! 	  dprint(1, (debugfile, "\n*** seek put us at END OF FILE!!! ***\n"));
  
***************
*** 90,91
  
  	/* next read will get 'this' line so must be at end of previous */

--- 97,99 -----
  
+ 
  	/* next read will get 'this' line so must be at end of previous */
***************
*** 93,98
  	Raw(OFF);
! 	if (strcmp(pager,"builtin") == 0 || strcmp(pager,"internal") == 0)
! 	  display(lines, msgnumber);
! 	else
! 	  secure_display(lines, msgnumber);
  	Raw(ON);

--- 101,107 -----
  	Raw(OFF);
! 	if (first_word(pager,"builtin") || first_word(pager,"internal"))
! 	  retval = display(lines, msgnumber);
! 	else 
! 	  retval = secure_display(lines, msgnumber);
! 	
  	Raw(ON);
***************
*** 100,102
  
! 	return(1);	/* we did it boss! */
  }

--- 109,111 -----
  
! 	return(retval == 0? 1 : retval);	/* we did it boss! */
  }
***************
*** 119,121
  
! 	char from_buffer[LONG_STRING], buffer[VERY_LONG_STRING], *full_month();
  

--- 128,131 -----
  
! 	char title1[SLEN], title2[SLEN], *full_month(), *p;
! 	char from_buffer[LONG_STRING], buffer[VERY_LONG_STRING];
  
***************
*** 127,129
  	    form_letter_section = 0,		/* section    */
! 	    builtin = FALSE;			/* our pager? */
  

--- 137,141 -----
  	    form_letter_section = 0,		/* section    */
! 	    padding = 0,			/*   counter  */
! 	    builtin = FALSE,			/* our pager? */
! 	    val = 0;				/* return val */
  
***************
*** 129,132
  
! 	dprint3(4,"displaying %d lines from message %d using %s\n", 
! 		lines, msgnum, pager);
  

--- 141,144 -----
  
! 	dprint(4, (debugfile,"displaying %d lines from message %d using %s\n", 
! 		lines, msgnum, pager));
  
***************
*** 138,141
  
! 	builtin = (strcmp(pager, "builtin") == 0 || 
! 		   strcmp(pager,"internal") == 0);
  

--- 150,152 -----
  
! 	builtin =(first_word(pager,"builtin") || first_word(pager,"internal"));
  
***************
*** 146,148
  
! 	if (builtin) 
  	  start_builtin(lines);

--- 157,159 -----
  
! 	if (builtin)
  	  start_builtin(lines);
***************
*** 152,155
  		    error_name(errno));
! 	    dprint2(1,"\n*** Can't create pipe to %s - error %s ***\n\n",
! 	   	    pager, error_name(errno));
  	    return(0);

--- 163,167 -----
  		    error_name(errno));
! 	    dprint(1, (debugfile, 
! 		    "\n*** Can't create pipe to %s - error %s ***\n\n",
! 	   	    pager, error_name(errno)));
  	    return(0);
***************
*** 156,158
  	  }
! 	  dprint1(4,"Opened a write-only pipe to routine %s \n", pager);
  	}

--- 168,171 -----
  	  }
! 	  dprint(4, (debugfile, 
! 		 "Opened a write-only pipe to pager %s \n", pager));
  	}
***************
*** 159,161
  
! 	if (title_messages) {
  

--- 172,174 -----
  
! 	if (title_messages && filter) {
  
***************
*** 165,168
  
! 	  sprintf(buffer, "\r%s #%d %s %s%s\t %s %s %s, %d at %s%s\n\r",
! 		   form_letter? "Form": "Message",
  		    msgnum, mail_sent? "to" : "from", from_buffer,

--- 178,182 -----
  
! 	  sprintf(title1, "%s #%d %s %s%s",
! 		    header_table[msgnum-1].status & DELETED ? "[deleted]" :
! 		      form_letter? "Form": "Message",
  		    msgnum, mail_sent? "to" : "from", from_buffer,
***************
*** 168,172
  		    msgnum, mail_sent? "to" : "from", from_buffer,
! 		   (strlen(from_buffer) > 24? "\n\r": 
! 		     (strlen(from_buffer) > 16 ? "" : "\t")),
! 		   "Mailed",
       		   full_month(header_table[msgnum-1].month), 

--- 182,186 -----
  		    msgnum, mail_sent? "to" : "from", from_buffer,
! 		    strlen(from_buffer) > 24? "\n": "");
! 
! 	  sprintf(title2, "Mailed %s %s, %d at %s%s\n",
       		   full_month(header_table[msgnum-1].month), 
***************
*** 174,177
  	           atoi(header_table[msgnum-1].year) + 1900,
! 	           header_table[msgnum-1].time,
! 		   filter? "": "\n\r\n\r");
  

--- 188,190 -----
  	           atoi(header_table[msgnum-1].year) + 1900,
! 	           header_table[msgnum-1].time);
  
***************
*** 177,178
  
  	  if (builtin)

--- 190,210 -----
  
+ 	  /** and now let's add some spaces between the two parts, please **/
+ 
+ 	  if (strlen(from_buffer) > 24) {
+ 	    if (builtin)
+ 	      display_line(title1);
+ 	    else
+ 	      fprintf(output_pipe, "%s", title1);
+ 	    title1[0] = '\0';
+ 	    padding = COLUMNS - strlen(title2) - 1;
+ 	  }
+ 	  else 
+ 	    padding = COLUMNS - strlen(title1) - strlen(title2) - 1;
+ 
+ 	  p = title1 + strlen(title1);
+ 	  while (padding-- > 0)
+ 	    *p++ = ' ';
+ 	  *p = '\0';
+ 	  strcat(title1, title2);
+ 
  	  if (builtin)
***************
*** 178,179
  	  if (builtin)
  	    display_line(buffer);

--- 210,231 -----
  	  if (builtin)
+ 	    display_line(title1);
+ 	  else
+ 	    fprintf(output_pipe, "%s", title1);
+ 
+ 	  /** if there's a subject, let's next output it, centered.  **/
+ 
+ 	  if (strlen(header_table[current-1].subject) > 0 && 
+ 		matches_weedlist("Subject:")) {
+ 	    padding = (COLUMNS - strlen(header_table[current-1].subject)) / 2;
+ 	    p = buffer;
+ 	    while (padding-- > 0)
+ 	      *p++ = ' ';
+ 	    *p = '\0';
+ 	    strcat(buffer, header_table[current-1].subject);
+ 	    strcat(buffer, "\n");
+ 	  }
+ 	  else
+ 	    strcpy(buffer, "\n");
+ 
+ 	  if (builtin)
  	    display_line(buffer);
***************
*** 181,182
  	    fprintf(output_pipe, "%s", buffer);
  

--- 233,236 -----
  	    fprintf(output_pipe, "%s", buffer);
+ 	  
+ 	  /** was this message address to us?  if not, then to whom? **/
  
***************
*** 185,187
  	      strlen(header_table[current-1].to) > 0) {
! 	    sprintf(buffer, "\n\r(message addressed to %s)\n\r", 
  		    header_table[current-1].to);

--- 239,242 -----
  	      strlen(header_table[current-1].to) > 0) {
! 	    sprintf(buffer, "%s(message addressed to %s)\n", 
! 	            strlen(header_table[current-1].subject) > 0 ? "\n" : "",
  		    header_table[current-1].to);
***************
*** 202,204
  	      "(message addressed to )" which will just clutter up the 
! 	      display!).
  

--- 257,259 -----
  	      "(message addressed to )" which will just clutter up the 
! 	      screen!).
  
***************
*** 206,207
  	  **/
  	}

--- 261,268 -----
  	  **/
+ 
+ 	  if (builtin)			/* this is for a one-line blank    */
+ 	    display_line("\n");		/*   separator between the title   */
+ 	  else				/*   stuff and the actual message  */
+ 	    fprintf(output_pipe, "\n");	/*   we're trying to display       */
+ 
  	}
***************
*** 217,221
  
! 	        dprint0(1,
! 	   	  "\n\n** Out of Sync!!  EOF with nothing read (display) **\n");
! 		dprint0(1,"** closing and reopening mailfile... **\n\n");
  

--- 278,283 -----
  
! 	        dprint(1, (debugfile, 
! 	         "\n\n** Out of Sync!!  EOF with nothing read (display) **\n"));
! 		dprint(1, (debugfile,
! 		 "** closing and reopening mailfile... **\n\n"));
  
***************
*** 238,243
  	      if (lines == 0 && pipe_abort == FALSE) {	/* displayed it all */
! 		if (!builtin)
! 	          PutLine0(LINES,0,"\rPress <return> to return to Elm: ");
! 	        else
! 		  printf("\n\r\n\rPress <return> to return to Elm: ");
  		fflush(stdout);

--- 300,302 -----
  	      if (lines == 0 && pipe_abort == FALSE) {	/* displayed it all */
! 	        PutLine0(LINES-1,0,"Press any key to return to Elm: ");
  		fflush(stdout);
***************
*** 244,246
  	        Raw(ON);
! 	        (void) ReadCh();
  	        Raw(OFF);

--- 303,305 -----
  	        Raw(ON);
! 	        val = tolower(ReadCh());
  	        Raw(OFF);
***************
*** 247,249
  	      }
! 	      return(TRUE);
  	    }

--- 306,308 -----
  	      }
! 	      return(val);
  	    }
***************
*** 272,274
                  encode(buffer);
! 	        show_line(buffer, builtin);
  	      }

--- 331,333 -----
                  encode(buffer);
! 	        val = show_line(buffer, builtin);
  	      }
***************
*** 275,277
  	      else
! 	        show_line(buffer, builtin);
  	    } 

--- 334,336 -----
  	      else
! 	        val = show_line(buffer, builtin);
  	    } 
***************
*** 280,282
  	      encode(buffer);
! 	      show_line(buffer, builtin); 
  	    }

--- 339,341 -----
  	      encode(buffer);
! 	      val = show_line(buffer, builtin); 
  	    }
***************
*** 285,287
  	      if (! weeding_out) 	/* just turned on! */
! 	        show_line(buffer, builtin);
  	    } 

--- 344,346 -----
  	      if (! weeding_out) 	/* just turned on! */
! 	        val = show_line(buffer, builtin);
  	    } 
***************
*** 290,292
  "\n------------------------------------------------------------------------------\n");
! 	      show_line(buffer, builtin);	/* hide '***' */
  	      form_letter_section++;

--- 349,351 -----
  "\n------------------------------------------------------------------------------\n");
! 	      val = show_line(buffer, builtin);	/* hide '***' */
  	      form_letter_section++;
***************
*** 296,298
  	    else
! 	      show_line(buffer, builtin);
  	}

--- 355,363 -----
  	    else
! 	      val = show_line(buffer, builtin);
! 	
! 	    if (val != 0) {	/* let's get back to the top level ... */
! 	      if (! builtin) pclose(output_pipe);
! 	      return(val);
! 	    }
! 
  	}
***************
*** 304,309
  	if (lines == 0 && pipe_abort == FALSE) {  	/* displayed it all! */
! 	  if (! builtin)
! 	    PutLine0(LINES,0,"\rPress <return> to return to Elm: ");
! 	  else
! 	    printf("\n\r\n\rPress <return> to return to Elm: ");
  	  fflush(stdout);

--- 369,371 -----
  	if (lines == 0 && pipe_abort == FALSE) {  	/* displayed it all! */
! 	  PutLine0(LINES-1,0,"Press any key to return to Elm : ");
  	  fflush(stdout);
***************
*** 310,312
  	  Raw(ON);
! 	  (void) ReadCh();
  	  Raw(OFF);

--- 372,374 -----
  	  Raw(ON);
! 	  val = tolower(ReadCh());
  	  Raw(OFF);
***************
*** 313,315
  	}
! 	return(TRUE);
  }

--- 375,378 -----
  	}
! 	
! 	return(val);
  }
***************
*** 316,317
  
  show_line(buffer, builtin)

--- 379,381 -----
  
+ int
  show_line(buffer, builtin)
***************
*** 321,323
  	/** Hands the given line to the output pipe.  'builtin' is true if
! 	    we're using the builtin pager.  **/ 
  	

--- 385,391 -----
  	/** Hands the given line to the output pipe.  'builtin' is true if
! 	    we're using the builtin pager.  We will return 'val' as the
!             intermediate value from the builtin pager if the user chooses
! 	    to do something else at the end-of-page prompt! **/
! 
! 	register int val;
  	
***************
*** 324,327
  	if (builtin) {
! 	  strcat(buffer, "\n\r");
! 	  pipe_abort = display_line(buffer);
  	}

--- 392,400 -----
  	if (builtin) {
! 	  strcat(buffer, "\n");
! 	  if ((val = display_line(buffer)) > 1) {
! 	    return(val);
! 	  }
! 	  else	    
! 	    pipe_abort = val;
! 	  
  	}
***************
*** 332,334
  	  if (errno != 0)
! 	    dprint1(1,"\terror %s hit!\n", error_name(errno));
  	}

--- 405,407 -----
  	  if (errno != 0)
! 	    dprint(1, (debugfile, "\terror %s hit!\n", error_name(errno)));
  	}
***************
*** 334,335
  	}
  }

--- 407,410 -----
  	}
+ 
+ 	return(0);
  }
***************
*** 359,360
  #else
  	if ((pid = vfork()) == 0) {

--- 434,438 -----
  #else
+ #  ifdef hp9000s500			/* done this way for portability */
+ 	if ((pid = fork()) == 0) {
+ #  else
  	if ((pid = vfork()) == 0) {
***************
*** 360,361
  	if ((pid = vfork()) == 0) {
  #endif

--- 438,440 -----
  	if ((pid = vfork()) == 0) {
+ #  endif
  #endif
***************
*** 377,383
  
! #ifdef BSD
! 	return(status.w_retcode);
! #else
! 	return(status);
! #endif
  }

--- 456,460 -----
  
! 	/** used to return status, but who cares?  Just get BACK! **/
! 
! 	return(0);
  }

Index: src/mkhdrs.c

***************
*** 55,58
  	    if (strlen(buffer) < 2) {
! 	      dprint0(2,
! 	         "Strlen of line from .elmheaders is < 2 (write_header_info)");
  	      if (mail_only)

--- 55,58 -----
  	    if (strlen(buffer) < 2) {
! 	      dprint(2, (debugfile,
! 	         "Strlen of line from .elmheaders is < 2 (write_header_info)"));
  	      if (mail_only)

End of Patch Kit #2