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

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

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

  src/newmbox.c   src/pattern.c   src/quit.c   src/file_utils.c   src/reply.c
  src/screen.c    src/strings.c   src/utils.c  src/validname.c    src/syscall.c

Please feed this directly to "patch".

Index: src/newmbox.c

***************
*** 116,118
  	    redraw = 1;		/* we'll need to clean the screen */
! 	    dprint0(1,"***  setting redraw to 1 ***\n");
  	    list_folders();

--- 116,118 -----
  	    redraw = 1;		/* we'll need to clean the screen */
! 	    Raw(OFF);
  	    list_folders();
***************
*** 118,119
  	    list_folders();
  	    goto ask_again;

--- 118,120 -----
  	    list_folders();
+ 	    Raw(ON);
  	    goto ask_again;
***************
*** 132,134
  	  if (strcmp(buff, infile) == 0 && ! resync) { 
! 	    dprint0(3,"User requested change to current mailbox! (newmbox)\n");
  	    error("already reading that mailbox!");

--- 133,136 -----
  	  if (strcmp(buff, infile) == 0 && ! resync) { 
! 	    dprint(3, (debugfile,
! 		   "User requested change to current mailbox! (newmbox)\n"));
  	    error("already reading that mailbox!");
***************
*** 138,141
  	  if ((errno = can_access(buff, READ_ACCESS))) {
! 	    dprint2(2,"Error: attempt to open %s as mailbox denied (%s)!\n",
! 		     buff, "newmbox");
  	    error1("Permission to open file %s denied", buff);

--- 140,144 -----
  	  if ((errno = can_access(buff, READ_ACCESS))) {
! 	    dprint(2, (debugfile, 
! 		     "Error: attempt to open %s as mailbox denied (%s)!\n",
! 		     buff, "newmbox"));
  	    error1("Permission to open file %s denied", buff);
***************
*** 185,186
  	  current = 1;
  	  message_count = read_headers(FALSE, main_screen);

--- 188,190 -----
  	  current = 1;
+ 	  save_file_stats(infile);
  	  message_count = read_headers(FALSE, main_screen);
***************
*** 188,190
  	}
! 	else 	/* resync with current mail file */
  	  message_count = read_headers(TRUE, main_screen);

--- 192,195 -----
  	}
! 	else {	/* resync with current mail file */
! 	  save_file_stats(infile);
  	  message_count = read_headers(TRUE, main_screen);
***************
*** 190,191
  	  message_count = read_headers(TRUE, main_screen);
  

--- 195,197 -----
  	  message_count = read_headers(TRUE, main_screen);
+ 	}
  
***************
*** 264,266
  		     error_name(err), error_description(err));
! 	     dprint3(1,
                  "Error: Couldn't open file %s as temp mbox.  errno %s (%s)\n",

--- 270,272 -----
  		     error_name(err), error_description(err));
! 	     dprint(1, (debugfile,
                  "Error: Couldn't open file %s as temp mbox.  errno %s (%s)\n",
***************
*** 266,268
                  "Error: Couldn't open file %s as temp mbox.  errno %s (%s)\n",
! 	         temp_filename, error_name(err), "read_headers");
  	     leave();

--- 272,274 -----
                  "Error: Couldn't open file %s as temp mbox.  errno %s (%s)\n",
! 	         temp_filename, error_name(err), "read_headers"));
  	     leave();
***************
*** 284,286
  		     error_name(err), error_description(err));
! 	     dprint3(1,
                  "Error: Couldn't reopen file %s as temp mbox.  errno %s (%s)\n",

--- 290,292 -----
  		     error_name(err), error_description(err));
! 	     dprint(1, (debugfile, 
                  "Error: Couldn't reopen file %s as temp mbox.  errno %s (%s)\n",
***************
*** 286,288
                  "Error: Couldn't reopen file %s as temp mbox.  errno %s (%s)\n",
! 	         temp_filename, error_name(err), "read_headers");
  	     emergency_exit();

--- 292,294 -----
                  "Error: Couldn't reopen file %s as temp mbox.  errno %s (%s)\n",
! 	         temp_filename, error_name(err), "read_headers"));
  	     emergency_exit();
***************
*** 301,303
  		     error_name(err), error_description(err));
! 	     dprint4(1,
       "Error: Couldn't seek to end of mailbox %s: (offset %ld) Errno %s (%s)\n",

--- 307,309 -----
  		     error_name(err), error_description(err));
! 	     dprint(1, (debugfile,
       "Error: Couldn't seek to end of mailbox %s: (offset %ld) Errno %s (%s)\n",
***************
*** 303,305
       "Error: Couldn't seek to end of mailbox %s: (offset %ld) Errno %s (%s)\n",
! 	        infile, mailfile_size, error_name(err), "read_headers");
  	     emergency_exit();

--- 309,311 -----
       "Error: Couldn't seek to end of mailbox %s: (offset %ld) Errno %s (%s)\n",
! 	        infile, mailfile_size, error_name(err), "read_headers"));
  	     emergency_exit();
***************
*** 328,331
  		fflush(stderr);
! 		dprint0(1, "\n\n**** First mail header is corrupt!! ****\n\n");
! 		dprint1(1, "Line is;\n\t%s\n\n", buffer);
  	        mail_only++;	/* to avoid leave() cursor motion */

--- 334,338 -----
  		fflush(stderr);
! 		dprint(1, (debugfile, 
! 			   "\n\n**** First mail header is corrupt!! ****\n\n"));
! 		dprint(1, (debugfile, "Line is;\n\t%s\n\n", buffer));
  	        mail_only++;	/* to avoid leave() cursor motion */
***************
*** 344,346
  	      max_headers += KLICK;
! 	      dprint2(3,
  		  "\n\nAbout to allocate headers, count = %d, max_headers=%d\n",

--- 351,353 -----
  	      max_headers += KLICK;
! 	      dprint(3, (debugfile,
  		  "\n\nAbout to allocate headers, count = %d, max_headers=%d\n",
***************
*** 346,348
  		  "\n\nAbout to allocate headers, count = %d, max_headers=%d\n",
! 		  count, max_headers);
  	      if ((temp_struct = realloc(header_table, max_headers * 

--- 353,355 -----
  		  "\n\nAbout to allocate headers, count = %d, max_headers=%d\n",
! 		  count, max_headers));
  	      if ((temp_struct = realloc(header_table, max_headers * 
***************
*** 355,357
  	       header_table = temp_struct;
! 	       dprint1(7,"\tallocated %d more headers!\n\n", KLICK);
  	     }

--- 362,364 -----
  	       header_table = temp_struct;
! 	       dprint(7, (debugfile, "\tallocated %d more headers!\n\n",KLICK));
  	     }
***************
*** 361,363
  	      header_table[count].index_number = count+1;
! 	      if (! rereading || count > message_count) 
  	        header_table[count].status = VISIBLE;     /* default status! */

--- 368,370 -----
  	      header_table[count].index_number = count+1;
! 	      if (! rereading || count >= message_count) 
  	        header_table[count].status = VISIBLE;     /* default status! */
***************
*** 364,366
  	      strcpy(header_table[count].subject, "");	/* clear subj    */
! 	      header_table[count-1].lines = line;
  	      if (new_msg(header_table[count])) {

--- 371,374 -----
  	      strcpy(header_table[count].subject, "");	/* clear subj    */
! 	      if (count)
! 	        header_table[count-1].lines = line;
  	      if (new_msg(header_table[count])) {
***************
*** 459,461
  		   error_description(err));
! 	    dprint3(1,
            "Error: Reopening %s as temp mail file failed!  errno %s (%s)\n",

--- 467,469 -----
  		   error_description(err));
! 	    dprint(1, (debugfile,
            "Error: Reopening %s as temp mail file failed!  errno %s (%s)\n",
***************
*** 461,463
            "Error: Reopening %s as temp mail file failed!  errno %s (%s)\n",
! 	           temp_filename, error_name(errno), "read_headers");
  	    leave();

--- 469,471 -----
            "Error: Reopening %s as temp mail file failed!  errno %s (%s)\n",
! 	           temp_filename, error_name(errno), "read_headers"));
  	    leave();

Index: src/pattern.c

***************
*** 193,197
  
! 	    dprint3(1,"Error: seek %ld bytes into file failed. errno %d (%s)\n",
! 		      header_table[message_number].offset, errno, 
! 		     "match_in_message");
  	    error2("ELM [match] failed looking %ld bytes into file (%s)",

--- 193,198 -----
  
! 	    dprint(1, (debugfile,
! 		"Error: seek %ld bytes into file failed. errno %d (%s)\n",
! 		header_table[message_number].offset, errno, 
! 		"match_in_message"));
  	    error2("ELM [match] failed looking %ld bytes into file (%s)",

Index: src/quit.c

***************
*** 28,30
  
! 	  newmbox(1, TRUE, TRUE);
  	  mailfile_size = bytes(infile);	

--- 28,30 -----
  
! 	  newmbox(2, TRUE, TRUE);
  	  mailfile_size = bytes(infile);	

Index: src/file_utils.c

***************
*** 41,44
  	  if (errno != 2) {
! 	    dprint2(1,"Error: errno %s on fstat of file %s (bytes)\n", 
! 		     error_name(errno), name);
  	    Write_to_screen("\n\rError attempting fstat on file %s!\n\r",

--- 41,45 -----
  	  if (errno != 2) {
! 	    dprint(1,(debugfile,
! 		     "Error: errno %s on fstat of file %s (bytes)\n", 
! 		     error_name(errno), name));
  	    Write_to_screen("\n\rError attempting fstat on file %s!\n\r",
***************
*** 171,173
  	if ((from_file = fopen(from, "r")) == NULL) {
! 	  dprint1(1,"Error: could not open %s for reading (copy)\n", from);
  	  error1("could not open file %s", from);

--- 172,175 -----
  	if ((from_file = fopen(from, "r")) == NULL) {
! 	  dprint(1, (debugfile, "Error: could not open %s for reading (copy)\n",
! 		 from));
  	  error1("could not open file %s", from);
***************
*** 177,179
  	if ((to_file = fopen(to, "w")) == NULL) {
! 	  dprint1(1,"Error: could not open %s for writing (copy)\n", to);
  	  error1("could not open file %s", to);

--- 179,182 -----
  	if ((to_file = fopen(to, "w")) == NULL) {
! 	  dprint(1, (debugfile, "Error: could not open %s for writing (copy)\n",
! 		 to));
  	  error1("could not open file %s", to);
***************
*** 203,205
  	if ((my_fd = fopen(filename, "r")) == NULL) {
! 	  dprint1(1,"Error: could not open %s for reading (append)\n", filename);
  	  return(1);

--- 206,209 -----
  	if ((my_fd = fopen(filename, "r")) == NULL) {
! 	  dprint(1, (debugfile,
! 		"Error: could not open %s for reading (append)\n", filename));
  	  return(1);
***************
*** 251,254
  	if ((fd = fopen (buffer, "w")) == NULL) {
! 	  dprint3(1,"Error: couldn't create file %s - error %s (%s)\n",
! 		 buffer, error_name(errno), "create_readmsg_file");
  	  return;	/* no error to user */

--- 255,259 -----
  	if ((fd = fopen (buffer, "w")) == NULL) {
! 	  dprint(1, (debugfile, 
! 		 "Error: couldn't create file %s - error %s (%s)\n",
! 		 buffer, error_name(errno), "create_readmsg_file"));
  	  return;	/* no error to user */

Index: src/reply.c

***************
*** 44,46
  	  else
! 	    return_value = send(return_address, subject, TRUE, NO);
  	}

--- 44,46 -----
  	  else
! 	    return_value = send(return_address, "", subject, TRUE, NO);
  	}
***************
*** 58,60
  	  else
! 	    return_value = send(return_address, subject, TRUE, NO);
  	}

--- 58,60 -----
  	  else
! 	    return_value = send(return_address, "", subject, TRUE, NO);
  	}
***************
*** 65,67
  	  else
! 	    return_value = send(return_address, "Re: your mail", TRUE, NO);
  

--- 65,67 -----
  	  else
! 	    return_value = send(return_address, "", "Re: your mail", TRUE, NO);
  
***************
*** 84,85
  
  	strcpy(full_address, return_address);	/* sender gets copy */

--- 84,88 -----
  
+ #ifndef HAVE_GROUP_REPLIES_BE_A_CC
+ 	full_address[0] = '\0';			/* no copies yet    */
+ #else
  	strcpy(full_address, return_address);	/* sender gets copy */
***************
*** 85,86
  	strcpy(full_address, return_address);	/* sender gets copy */
  	

--- 88,90 -----
  	strcpy(full_address, return_address);	/* sender gets copy */
+ #endif
  	
***************
*** 97,99
  	  }
! 	  return_value = send(full_address, subject, TRUE, NO);
  	}

--- 101,103 -----
  	  }
! 	  return_value = send(return_address, full_address, subject, TRUE, NO);
  	}
***************
*** 100,102
  	else
! 	  return_value = send(full_address, "Re: your mail", TRUE, NO);
  

--- 104,107 -----
  	else
! 	  return_value = send(return_address, full_address, 
! 			      "Re: your mail", TRUE, NO);
  
***************
*** 131,133
  	  strcpy(subject,header_table[current-1].subject); 
! 	  results = send(address, subject, edit_msg,
  	    header_table[current-1].status & FORM_LETTER? 

--- 136,138 -----
  	  strcpy(subject,header_table[current-1].subject); 
! 	  results = send(address, "", subject, edit_msg,
  	    header_table[current-1].status & FORM_LETTER? 
***************
*** 136,138
  	else
! 	  results = send(address, "Forwarded Mail...", edit_msg, 
  	    header_table[current-1].status & FORM_LETTER? 

--- 141,143 -----
  	else
! 	  results = send(address, "", "Forwarded Mail...", edit_msg, 
  	    header_table[current-1].status & FORM_LETTER? 
***************
*** 157,159
  	 address[LONG_SLEN], comment[LONG_SLEN];
!     int  in_message = 1, first_pass = 0, index;
  

--- 162,164 -----
  	 address[LONG_SLEN], comment[LONG_SLEN];
!     int  in_message = 1, first_pass = 0, index, line_pending = 0;
  
***************
*** 162,164
      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), 

--- 167,169 -----
      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), 
***************
*** 164,166
  		 header_table[current-1].offset, error_name(errno), 
! 		 "get_and_expand_everyone");
  	error2("ELM [seek] couldn't read %d bytes into file (%s)",

--- 169,171 -----
  		 header_table[current-1].offset, error_name(errno), 
! 		 "get_and_expand_everyone"));
  	error2("ELM [seek] couldn't read %d bytes into file (%s)",
***************
*** 180,182
      while (in_message) {
!       in_message = (int) (fgets(buf, LONG_SLEN, mailfile) != NULL);
        if (first_word(buf, "From ") && first_pass++ != 0) 

--- 185,189 -----
      while (in_message) {
!       if (! line_pending)
!         in_message = (int) (fgets(buf, LONG_SLEN, mailfile) != NULL);
!       line_pending = 0;
        if (first_word(buf, "From ") && first_pass++ != 0) 
***************
*** 208,210
  
! 	  if (in_message) dprint1(1,"> %s", buf);
  	

--- 215,217 -----
  
! 	  if (in_message) dprint(2, (debugfile, "> %s", buf));
  	
***************
*** 211,213
  	} while (in_message && whitespace(buf[0]));
! 
        }

--- 218,220 -----
  	} while (in_message && whitespace(buf[0]));
! 	line_pending++;
        }
***************
*** 281,283
  	    if (host_count == MAX_HOPS) {
! 	       dprint1(2,
                "Error: hit max_hops limit trying to build return address (%s)\n",

--- 288,290 -----
  	    if (host_count == MAX_HOPS) {
! 	       dprint(2, (debugfile,
                "Error: hit max_hops limit trying to build return address (%s)\n",
***************
*** 283,285
                "Error: hit max_hops limit trying to build return address (%s)\n",
! 		      "optimize_and_add");
  	       error("Can't build return address - hit MAX_HOPS limit!");

--- 290,292 -----
                "Error: hit max_hops limit trying to build return address (%s)\n",
! 		      "optimize_and_add"));
  	       error("Can't build return address - hit MAX_HOPS limit!");
***************
*** 320,322
  
! get_return_name(address, name, shift_lower)
  char *address, *name;

--- 327,329 -----
  
! get_return_name(address, name, trans_to_lowercase)
  char *address, *name;
***************
*** 322,324
  char *address, *name;
! int   shift_lower;
  {

--- 329,331 -----
  char *address, *name;
! int   trans_to_lowercase;
  {
***************
*** 337,339
  	/** Another note: modified to return the argument as all lowercase
! 	    always, unless shift_lower is FALSE... **/
  

--- 344,346 -----
  	/** Another note: modified to return the argument as all lowercase
! 	    always, unless trans_to_lowercase is FALSE... **/
  
***************
*** 342,345
  
! 	dprint2(6,"get_return_name called with (%s, <>, shift=%s)\n", 
! 		   address, onoff(shift_lower));
  

--- 349,352 -----
  
! 	dprint(6, (debugfile,"get_return_name called with (%s, <>, shift=%s)\n",
! 		   address, onoff(trans_to_lowercase)));
  
***************
*** 370,372
  	  for (index = 0; index < loc - i + 1; index++)
! 	    if (shift_lower)
  	      name[index] = tolower(single_address[index+i]);

--- 377,379 -----
  	  for (index = 0; index < loc - i + 1; index++)
! 	    if (trans_to_lowercase)
  	      name[index] = tolower(single_address[index+i]);
***************
*** 386,388
  	       && i > -1; i--)
! 	     if (shift_lower)
  	       name[index++] = tolower(single_address[i]);

--- 393,395 -----
  	       && i > -1; i--)
! 	     if (trans_to_lowercase)
  	       name[index++] = tolower(single_address[i]);
***************
*** 434,436
  
! 	dprint1(5, "\n* got \"%s\"\n", buffer);
  

--- 441,443 -----
  
! 	dprint(5, (debugfile, "\n* got \"%s\"\n", buffer));
  
***************
*** 458,460
  	else if (buffer[loc-1] == '>') {	/*   name <address>  format */
! 	  dprint0(7, "\tcomment <address>\n");
  	  for (loc = 0;buffer[loc] != '<' && loc < strlen(buffer); loc++)

--- 465,467 -----
  	else if (buffer[loc-1] == '>') {	/*   name <address>  format */
! 	  dprint(7, (debugfile, "\tcomment <address>\n"));
  	  for (loc = 0;buffer[loc] != '<' && loc < strlen(buffer); loc++)
***************
*** 485,487
  
! 	dprint2(5,"-- returning '%s' '%s'\n", address, comment);
  

--- 492,494 -----
  
! 	dprint(5, (debugfile, "-- returning '%s' '%s'\n", address, comment));
  

Index: src/screen.c

***************
*** 97,99
  	if (fix_header_page()) {
! 	  dprint0(7, "show_headers returned FALSE 'cause of fix-header-page\n");
  	  return(FALSE);

--- 97,100 -----
  	if (fix_header_page()) {
! 	  dprint(7, (debugfile,
! 		"show_headers returned FALSE 'cause of fix-header-page\n"));
  	  return(FALSE);
***************
*** 103,106
  	  if ((header_page*headers_per_page) > selected) {
! 	    dprint2(7, "show_headers returned FALSE since selected [%d] < %d\n",
! 		    selected, header_page*headers_per_page);
  	    return(FALSE); 	/* too far! too far! */

--- 104,108 -----
  	  if ((header_page*headers_per_page) > selected) {
! 	    dprint(7, (debugfile,
! 		    "show_headers returned FALSE since selected [%d] < %d\n",
! 		    selected, header_page*headers_per_page));
  	    return(FALSE); 	/* too far! too far! */
***************
*** 108,110
  
! 	  dprint0(6,"** show_headers AND selected...\n");
  

--- 110,112 -----
  
! 	  dprint(6, (debugfile, "** show_headers AND selected...\n"));
  
***************
*** 119,122
  
! 	  dprint2(7,"this_msg (index) = %d  [header_page = %d]\n", this_msg, 
! 		  header_page);
  

--- 121,125 -----
  
! 	  dprint(7, (debugfile,
! 		  "this_msg (index) = %d  [header_page = %d]\n", this_msg, 
! 		  header_page));
  
***************
*** 122,124
  
! 	  dprint1(7,"we've already displayed %d messages\n", displayed);
  

--- 125,128 -----
  
! 	  dprint(7, (debugfile,
! 		  "we've already displayed %d messages\n", displayed));
  
***************
*** 126,128
  
! 	  dprint1(7,"and the last msg on this page is %d\n", last);
  	}

--- 130,133 -----
  
! 	  dprint(7, (debugfile,
! 		  "and the last msg on this page is %d\n", last));
  	}
***************
*** 184,187
  
- 	dprint0(1,"** out of redraw loop! **\n");
- 
  	if (mini_menu)

--- 189,190 -----
  
  	if (mini_menu)
***************
*** 189,191
  	else
! 	  last_line = LINES-3;
  

--- 192,194 -----
  	else
! 	  last_line = LINES-4;
  
***************
*** 231,234
  	if (selected) {
! 	  dprint2(2,"\nshow_current\n* last_current = %d, current = %d\n", 
! 			last_current, current);
  	  last_line = ((i=compute_visible(last_current-1)-1) %

--- 234,238 -----
  	if (selected) {
! 	  dprint(2, (debugfile,
! 			"\nshow_current\n* last_current = %d, current = %d\n", 
! 			last_current, current));
  	  last_line = ((i=compute_visible(last_current-1)-1) %
***************
*** 236,243
  	  new_line  = ((j=compute_visible(current-1)-1) % headers_per_page)+4;
! 	  dprint1(2,"* compute_visible(last-1)=%d\n", 
! 		   compute_visible(last_current-1));
! 	  dprint1(2,"* compute_visible(current-1)=%d\n", 
! 		   compute_visible(current-1));
! 	  dprint2(2,"* ending up with last_line = %d and new_line = %d\n",
! 		   last_line, new_line);
  	}

--- 240,248 -----
  	  new_line  = ((j=compute_visible(current-1)-1) % headers_per_page)+4;
! 	  dprint(2, (debugfile, "* compute_visible(last-1)=%d\n", 
! 		   compute_visible(last_current-1)));
! 	  dprint(2, (debugfile, "* compute_visible(current-1)=%d\n", 
! 		   compute_visible(current-1)));
! 	  dprint(2, (debugfile, 
! 		   "* ending up with last_line = %d and new_line = %d\n",
! 		   last_line, new_line));
  	}
***************
*** 248,250
  	
! 	dprint4(7,
  	   "--> show-current: last_current=%d [%d] and current=%d [%d]\n",

--- 253,255 -----
  	
! 	dprint(7, (debugfile,
  	   "--> show-current: last_current=%d [%d] and current=%d [%d]\n",
***************
*** 250,252
  	   "--> show-current: last_current=%d [%d] and current=%d [%d]\n",
! 	   last_current, i, current, j);
  

--- 255,257 -----
  	   "--> show-current: last_current=%d [%d] and current=%d [%d]\n",
! 	   last_current, i, current, j));
  
***************
*** 252,254
  
! 	dprint2(7,"    maps to lines %d and %d\n", last_line, new_line);
  

--- 257,260 -----
  
! 	dprint(7, (debugfile, 
! 		"    maps to lines %d and %d\n", last_line, new_line));
  
***************
*** 373,375
  
! 	dprint1(6,"** on_page(%d) returns...", message);
  

--- 379,381 -----
  
! 	dprint(6, (debugfile, "** on_page(%d) returns...", message));
  
***************
*** 379,381
  	  if (message <= ((header_page+1) * headers_per_page)) {
! 	    dprint0(6,"TRUE\n");
  	    return(TRUE);

--- 385,387 -----
  	  if (message <= ((header_page+1) * headers_per_page)) {
! 	    dprint(6, (debugfile, "TRUE\n"));
  	    return(TRUE);
***************
*** 383,385
  
! 	dprint0(6,"FALSE\n");
  	return(FALSE);

--- 389,391 -----
  
! 	dprint(6, (debugfile, "FALSE\n"));
  	return(FALSE);

Index: src/strings.c

***************
*** 61,63
  
! 	register int count = 0, index;
  

--- 61,64 -----
  
! 	register int count = 0;
! 	char     c, *pend, *p;
  
***************
*** 63,67
  
! 	for (index = 0; index < strlen(string); index++)
! 	  if (string[index] >= ' ') 
! 	    if (string[index] == '\t')
  	      count += (7-(count % 8));

--- 64,68 -----
  
! 	for (pend = string + strlen(string), p=string; p < pend ;) {
! 	  if ((c = *p++) >= ' ')
! 	    if (c == '\t')
  	      count += (7-(count % 8));
***************
*** 69,70
  	      count++;
  

--- 70,72 -----
  	      count++;
+ 	}
  
***************
*** 237,239
  
! 	chars--; /* index starting at zero! */
  

--- 239,241 -----
  
! 	/*  chars--; /* index starting at zero! */
  
***************
*** 258,260
  	
! 	move_left(string, ++loc);
  }

--- 260,262 -----
  	
! 	move_left(string, loc);
  }

Index: src/utils.c

***************
*** 34,36
  	if (fstat(fileno(mailfile), &buffer) == 0) {
! 	  dprint1(1,"\nDump of stats for mailfile %s;\n", infile);
  

--- 34,36 -----
  	if (fstat(fileno(mailfile), &buffer) == 0) {
! 	  dprint(1, (debugfile, "\nDump of stats for mailfile %s;\n", infile));
  
***************
*** 36,40
  
! 	  dprint3(1, "\tinode: %d, mode: %o, uid: %d, ",
! 			buffer.st_ino, buffer.st_mode, buffer.st_uid);
! 	  dprint2(1,"gid: %d, size: %d\n\n", buffer.st_gid, buffer.st_size);
  

--- 36,39 -----
  
! 	  dprint(1,  (debugfile, "\tinode: %d, mode: %o, uid: %d, ",
! 			buffer.st_ino, buffer.st_mode, buffer.st_uid));
  
***************
*** 40,42
  
! 	  dprint1(1,"\toffset into file = %l\n", ftell(mailfile));
  	}

--- 39,44 -----
  
! 	  dprint(1, (debugfile, 
! 		 "gid: %d, size: %d\n\n", buffer.st_gid, buffer.st_size));
! 
! 	  dprint(1, (debugfile, "\toffset into file = %l\n", ftell(mailfile)));
  	}
***************
*** 43,46
  	else
! 	  dprint2(1,"\nfstat on mailfile '%s' failed with error %s!!\n\n",
! 			infile, error_name(errno));
  }

--- 45,49 -----
  	else
! 	  dprint(1, (debugfile, 
! 		 "\nfstat on mailfile '%s' failed with error %s!!\n\n",
! 			infile, error_name(errno)));
  }
***************
*** 52,61
  
! 	dprint0(1,
!      "\nERROR: Something dreadful is happening!  Taking emergency exit!!\n\n");
! 	dprint0(1,"  possibly leaving behind the following files;\n");
! 	dprint2(1,"     The mailbox tempfile : %s%s\n", temp_mbox, username);
! 	dprint2(1,"     The mailbox lock file: %s%s.lock\n", mailhome, username);
! 	dprint2(1,"     The composition file : %s%d\n", temp_file, getpid());
! 	dprint2(1,"     The header comp file : %s%d\n", temp_file, getpid()+1);
! 	dprint2(1,"     The readmsg data file: %s/%s\n", home, readmsg_file);
  

--- 55,70 -----
  
! 	dprint(1, (debugfile, 
!      "\nERROR: Something dreadful is happening!  Taking emergency exit!!\n\n"));
! 	dprint(1, (debugfile,
! 	     "  possibly leaving behind the following files;\n"));
! 	dprint(1, (debugfile,
! 	     "     The mailbox tempfile : %s%s\n", temp_mbox, username));
! 	dprint(1, (debugfile,
! 	     "     The mailbox lock file: %s%s.lock\n", mailhome, username));
! 	dprint(1, (debugfile,
! 	     "     The composition file : %s%d\n", temp_file, getpid()));
! 	dprint(1, (debugfile,
! 	     "     The header comp file : %s%d\n", temp_file, getpid()+1));
! 	dprint(1, (debugfile,
! 	     "     The readmsg data file: %s/%s\n", home, readmsg_file));
  
***************
*** 68,70
  
! 	PutLine0(LINES,0, "\nEmergency Exit taken!  All temp files intact!\n\n");
  

--- 77,80 -----
  
! 	PutLine0(LINES,0, 
! 		"\nEmergency Exit taken!  All temp files intact!\n\n");
  
***************
*** 81,83
  
! 	dprint0(2,"\nLeaving mailer normally (leave)\n");
  

--- 91,93 -----
  
! 	dprint(2, (debugfile, "\nLeaving mailer normally (leave)\n"));
  
***************
*** 118,120
  
! 	dprint0(2,"\nLeaving mailer quietly (silently_exit)\n");
  

--- 128,130 -----
  
! 	dprint(2, (debugfile, "\nLeaving mailer quietly (silently_exit)\n"));
  
***************
*** 147,150
  
!         dprint0(3,
! 	    "\nLeaving mailer due to presence of lock file (leave_locked)\n");
  

--- 157,160 -----
  
!         dprint(3, (debugfile,
! 	    "\nLeaving mailer due to presence of lock file (leave_locked)\n"));
  
***************
*** 178,180
  
! 	dprint1(6,"* get_page(%d) returns...", msg_pointer);
  

--- 188,190 -----
  
! 	dprint(6, (debugfile, "* get_page(%d) returns...", msg_pointer));
  
***************
*** 184,187
  
! 	dprint2(8,"[first-on-page=%d, last-on-page=%d]",
! 		first_on_page, last_on_page);
  

--- 194,197 -----
  
! 	dprint(8, (debugfile, "[first-on-page=%d, last-on-page=%d]",
! 		first_on_page, last_on_page));
  
***************
*** 191,193
  	if (selected && msg_pointer > selected) {
! 	  dprint0(6,"FALSE - too far!\n");
  	  return(FALSE);	/* too far - page can't change! */

--- 201,203 -----
  	if (selected && msg_pointer > selected) {
! 	  dprint(6, (debugfile, "FALSE - too far!\n"));
  	  return(FALSE);	/* too far - page can't change! */
***************
*** 197,200
  	  header_page = (int) (msg_pointer-(selected? 0:1)) / headers_per_page;
! 	  dprint3(6,"TRUE (%d > %d  New hp=%d)!\n",
! 		msg_pointer, last_on_page, header_page);
  	  return(1);

--- 207,210 -----
  	  header_page = (int) (msg_pointer-(selected? 0:1)) / headers_per_page;
! 	  dprint(6, (debugfile, "TRUE (%d > %d  New hp=%d)!\n",
! 		msg_pointer, last_on_page, header_page));
  	  return(1);
***************
*** 203,206
  	  header_page = (int) (msg_pointer-1) / headers_per_page;
! 	  dprint3(6,"TRUE (%d < %d   New hp=%d)!\n",
! 		msg_pointer, first_on_page, header_page);
  	  return(1);

--- 213,216 -----
  	  header_page = (int) (msg_pointer-1) / headers_per_page;
! 	  dprint(6, (debugfile, "TRUE (%d < %d   New hp=%d)!\n",
! 		msg_pointer, first_on_page, header_page));
  	  return(1);
***************
*** 208,211
  	else {
! 	  dprint2(6,"FALSE [first=%d last=%d]\n",
! 		  first_on_page, last_on_page);
  	  return(0);

--- 218,221 -----
  	else {
! 	  dprint(6, (debugfile, "FALSE [first=%d last=%d]\n",
! 		  first_on_page, last_on_page));
  	  return(0);

Index: src/validname.c

***************
*** 35,37
  #else
! 	struct passwd *getpwname();
  	char filebuf[SLEN];

--- 35,37 -----
  #else
! 	struct passwd *getpwnam();
  	char filebuf[SLEN];

Index: src/syscall.c

***************
*** 70,73
  	
! 	dprint2(2,"System Call: %s\n\t%s\n", shell_type == SH? "/bin/sh" : shell,
! 		string);
  

--- 70,74 -----
  	
! 	dprint(2, (debugfile,
! 		"System Call: %s\n\t%s\n", shell_type == SH? "/bin/sh" : shell,
! 		string));
  
***************
*** 163,165
  
! printmsg()
  {

--- 164,166 -----
  
! print_msg()
  {
***************
*** 201,203
  	
! 	dprint0(2,"Printing system call...\n");
  

--- 202,204 -----
  	
! 	dprint(2, (debugfile, "Printing system call...\n"));
  

End of PatcintegKLui