[comp.mail.mush] Official 7.2.0 Patch Kit, Part03/04

schaefer@ogicse.cse.ogi.edu (Barton E. Schaefer) (11/05/90)

This is Part 3 of the Official Patch Kit for conversion of Mush 7.1.2 to
Mush 7.2.0.  See Part 1 for a complete manifest and other information.

*** /tmp/,RCSt1009504	Sun Nov  4 20:01:58 1990
--- addrs.c	Sun Oct 21 19:24:39 1990
***************
*** 195,203 ****
      /* Make a copy of the address so we can mangle it freely. */
      if (addr && *addr) {
  	/* Skip any leading whitespace. */
! 	for (i = addr; *i && (r = any(i, " \t")) == i;)
! 	    if (r)
! 		i = r + 1;
  	if (*i == '\0')
  	    return NULL;
  	/* Skip any leading double-quoted comment. */
--- 195,202 ----
      /* Make a copy of the address so we can mangle it freely. */
      if (addr && *addr) {
  	/* Skip any leading whitespace. */
! 	for (i = addr; *i && index(" \t", *i); i++)
! 	    ;
  	if (*i == '\0')
  	    return NULL;
  	/* Skip any leading double-quoted comment. */
***************
*** 206,214 ****
  		    return NULL;
  	}
  	/* Skip any more whitespace. */
! 	for (; *i && (r = any(i, " \t")) == i;)
! 	    if (r)
! 		i = r + 1;
  	if (*i == '\0')
  	    return NULL;
  	/* Check for angle braces around the address. */
--- 205,212 ----
  		    return NULL;
  	}
  	/* Skip any more whitespace. */
! 	while (*i && index(" \t", *i))
! 	    i++;
  	if (*i == '\0')
  	    return NULL;
  	/* Check for angle braces around the address. */
*** /tmp/,RCSt1009486	Sun Nov  4 20:01:51 1990
--- bind.c	Sun Oct 21 19:24:40 1990
***************
*** 66,71 ****
--- 66,72 ----
      /* Folder modification commands */
      add_bind("\025", C_UPDATE, NULL, &cmd_map);		/* ^U */
      add_bind("\020", C_PRESERVE, NULL, &cmd_map);	/* ^P */
+     add_bind("*", C_MARK_MSG, NULL, &cmd_map);
      add_bind("W", C_WRITE_LIST, NULL, &cmd_map);
      add_bind("w", C_WRITE_MSG, NULL, &cmd_map);
      add_bind("U", C_UNDEL_LIST, NULL, &cmd_map);
***************
*** 173,178 ****
--- 174,180 ----
      { C_MAP_BANG,	"map!",			NULL, NULL_MAP },
      { C_MAP,		"map",			NULL, NULL_MAP },
      { C_MACRO,		"macro",		NULL, NULL_MAP },
+     { C_MARK_MSG,	"mark",			NULL, NULL_MAP },
      /* C_HELP Must be the last one! */
      { C_HELP,		"help",			NULL, NULL_MAP }
  };
*** /tmp/,RCSt1009594	Sun Nov  4 20:02:54 1990
--- compose.icon	Mon Oct 29 19:05:18 1990
***************
*** 0 ****
--- 1,34 ----
+ /* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
+  */
+ 	0xFFFF,0xFFFF,0xFFFF,0xF89C,0xFFFF,0xFFFF,0xFFFF,0xF8A2,
+ 	0xC000,0x0000,0x0000,0x1A61,0xC000,0x0000,0x0000,0x1A91,
+ 	0xC000,0x0000,0x0000,0x1989,0xC000,0x0000,0x0000,0x1A46,
+ 	0xC000,0x0000,0x0000,0x1E26,0xC000,0x0000,0x0000,0x1B1A,
+ 	0xC003,0x0FDE,0x0000,0x1498,0xC003,0x8FFF,0x0000,0x2968,
+ 	0xC000,0x0000,0x0000,0x5262,0xC000,0x0000,0x0000,0xA4A2,
+ 	0xC000,0x0000,0x0001,0x4988,0xC000,0x0000,0x0002,0x9288,
+ 	0xC000,0x0000,0x0005,0x2622,0xC0E6,0xEFCF,0x79FA,0x4A22,
+ 	0xC0F7,0xEFEF,0xFDF4,0x9888,0xC000,0x0000,0x0029,0x3888,
+ 	0xC000,0x0000,0x0052,0x5A22,0xC7B9,0xEF9D,0x9DA4,0x9A22,
+ 	0xC7FD,0xFFDF,0xDF49,0x1888,0xC000,0x0000,0x0292,0x1888,
+ 	0xC000,0x0000,0x0524,0x1A22,0xC73F,0x3CEC,0xFA48,0x1A22,
+ 	0xC7BF,0xBEFE,0xF490,0x1888,0xC000,0x0000,0x2920,0x1888,
+ 	0xC000,0x0000,0x5240,0x1A22,0xC6E7,0x67E7,0xA4E0,0x1A22,
+ 	0xC7F7,0xF7F7,0x49F0,0x1888,0xC000,0x0002,0x9200,0x1888,
+ 	0xC000,0x0005,0x2400,0x1A22,0xC79D,0x99EA,0x4F00,0x1A22,
+ 	0xC7DF,0xDDF4,0x9F80,0x1888,0xC000,0x0029,0x2000,0x1888,
+ 	0xC000,0x0052,0x4000,0x1A22,0xC738,0x00E4,0x8000,0x1A22,
+ 	0xC7BC,0x0129,0x0000,0x1888,0xC000,0x0112,0x0000,0x1888,
+ 	0xC000,0x020C,0x0000,0x1A22,0xC000,0x0218,0x0000,0x1A22,
+ 	0xC000,0x0660,0x0000,0x1888,0xC000,0x0780,0x0000,0x1888,
+ 	0xC000,0x0E00,0x0000,0x1A22,0xC000,0x0800,0x0000,0x1A22,
+ 	0xC000,0x0000,0x0000,0x1888,0xC000,0x0000,0x0000,0x1888,
+ 	0xC000,0x0000,0x0000,0x1A22,0xC000,0x0000,0x0000,0x1A22,
+ 	0xC000,0x0000,0x2000,0x1888,0xC000,0x0000,0x2000,0x1888,
+ 	0xC006,0x888E,0x2C00,0x1A22,0xC005,0x4891,0x3200,0x1A22,
+ 	0xC005,0x4890,0x2200,0x1888,0xC005,0x488E,0x2200,0x1888,
+ 	0xC005,0x4881,0x2200,0x1A22,0xC005,0x4991,0x2200,0x1A22,
+ 	0xC005,0x468E,0x2200,0x1888,0xC000,0x0000,0x0000,0x1888,
+ 	0xC000,0x0000,0x0000,0x1A22,0xC000,0x0000,0x0000,0x1A22,
+ 	0xC000,0x0000,0x0000,0x1888,0xC000,0x0000,0x0000,0x1888,
+ 	0xFFFF,0xFFFF,0xFFFF,0xFA22,0xFFFF,0xFFFF,0xFFFF,0xFA22
*** /tmp/,RCSt1009401	Sun Nov  4 20:01:09 1990
--- config.h-dist	Sun Oct 21 19:24:43 1990
***************
*** 25,32 ****
--- 25,37 ----
   * tzname nor the BSD timezone() function.  The example below is for
   * Gould BSD4.3 systems; others should define it as a string, e.g. "PST"
   * If TIMEZONE is defined, DAYLITETZ can also be defined, e.g. "PDT"
+  *
+  * Define USA if you are using US/NorthAmerican time zone abbreviations.
+  * If USA is not defined, dates in outgoing mail will include timezones
+  * specified as offsets from GMT, e.g. Pacific Standard Time is -0800.
   */
  /* #define TIMEZONE T->tm_zone /**/
+ #define USA /**/
  
  /* mail delivery system macros and defines... */
  
***************
*** 104,110 ****
  /* #define PICKY_MAILER /**/
  
  /* Headers that will NOT be included when forwarding mail */
! #define IGNORE_ON_FWD	"status"	/* comma or space separated list */
  
  #define	MAXMSGS		1000	/* maximum number of messages we can read */
  #define HDRSIZ BUFSIZ	/* This should not be < BUFSIZ! (but can be >) */
--- 109,115 ----
  /* #define PICKY_MAILER /**/
  
  /* Headers that will NOT be included when forwarding mail */
! #define IGNORE_ON_FWD	"status,priority" /* comma or space separated list */
  
  #define	MAXMSGS		1000	/* maximum number of messages we can read */
  #define HDRSIZ BUFSIZ	/* This should not be < BUFSIZ! (but can be >) */
***************
*** 116,121 ****
--- 121,131 ----
  #if defined(SYSV) || defined(sun)
  #define VPRINTF
  #endif /* SYSV || sun */
+ 
+ /* If your system uses the getwd() system call (as opposed to getcwd()),
+  * and your system is not a BSD system (e.g. MIPS), define GETWD below.
+  */
+ /* #define GETWD	/**/
  
  #define LS_COMMAND	"ls"
  #define FORTUNE		"/usr/games/fortune"
*** /tmp/,RCSt1009480	Sun Nov  4 20:01:48 1990
--- curses.c	Sun Nov  4 16:59:57 1990
***************
*** 10,16 ****
  register char **argv;
  {
      char buf[80];
!     extern char *UP, ttytype[];
  
      if (argv && *++argv && !strcmp(*argv, "-?"))
  	return help(0, "curses", cmd_help);
--- 10,19 ----
  register char **argv;
  {
      char buf[80];
!     extern char *UP;
! #ifndef M_UNIX
!     extern char ttytype[];
! #endif /* M_UNIX */
  
      if (argv && *++argv && !strcmp(*argv, "-?"))
  	return help(0, "curses", cmd_help);
***************
*** 365,371 ****
  	    for (n = 0; n < msg_cnt; n++)
  		if (msg_bit(msg_list, n)) {
  		    if (c == C_DELETE_MSG || c == C_DELETE_LIST)
! 			turnon(msg[n].m_flags, DELETE);
  		    else
  			turnoff(msg[n].m_flags, DELETE);
  		    if (isoff(glob_flags, CNTD_CMD) && (msg_cnt < screen ||
--- 368,374 ----
  	    for (n = 0; n < msg_cnt; n++)
  		if (msg_bit(msg_list, n)) {
  		    if (c == C_DELETE_MSG || c == C_DELETE_LIST)
! 			turnon(msg[n].m_flags, DELETE|DO_UPDATE);
  		    else
  			turnoff(msg[n].m_flags, DELETE);
  		    if (isoff(glob_flags, CNTD_CMD) && (msg_cnt < screen ||
***************
*** 450,457 ****
  	    }
  	}
  
! 	/* preserve message */
! 	when C_PRESERVE :
  	    if (!msg_cnt) {
  		print("No messages.");
  		if (ison(glob_flags, CNTD_CMD))
--- 453,460 ----
  	    }
  	}
  
! 	/* preserve message or place mark on message */
! 	when C_PRESERVE : case C_MARK_MSG :
  	    if (!msg_cnt) {
  		print("No messages.");
  		if (ison(glob_flags, CNTD_CMD))
***************
*** 458,468 ****
  		    putchar('\n');
  		break;
  	    }
! 	    if (ison(msg[current_msg].m_flags, PRESERVE))
! 		turnoff(msg[current_msg].m_flags, PRESERVE);
  	    else
! 		turnon(msg[current_msg].m_flags, PRESERVE);
! 	    turnon(glob_flags, DO_UPDATE);
  	    if (ison(glob_flags, CNTD_CMD)) {
  		wprint("%-.*s\n", COLS-1, compose_hdr(current_msg));
  		redo = 1;
--- 461,475 ----
  		    putchar('\n');
  		break;
  	    }
! 	    if (ison(msg[current_msg].m_flags,
! 			c == C_MARK_MSG ? M_PRIORITY(0) : PRESERVE))
! 		turnoff(msg[current_msg].m_flags,
! 			c == C_MARK_MSG ? M_PRIORITY(0) : PRESERVE);
  	    else
! 		turnon(msg[current_msg].m_flags,
! 			c == C_MARK_MSG ? M_PRIORITY(0) : PRESERVE);
! 	    if (c != C_MARK_MSG)
! 		turnon(glob_flags, DO_UPDATE);
  	    if (ison(glob_flags, CNTD_CMD)) {
  		wprint("%-.*s\n", COLS-1, compose_hdr(current_msg));
  		redo = 1;
***************
*** 479,488 ****
  		(void) strcat(file, " -");
  	    }
  	    print(
! 		"Order messages by [author, date, length, Status, subject]: "
  		);
  	    if ((c = m_getchar()) == 'a' || c == 'd' || c == 'l' ||
! 		    c == 'S' || c == 's' || c == 'R') {
  		print("reordering messages...");
  		(void) cmd_line(sprintf(buf, "%s %c", file, c), msg_list);
  		print_more("done.");
--- 486,495 ----
  		(void) strcat(file, " -");
  	    }
  	    print(
! 	"Order messages by [author, date, length, Status, subject, priority]: "
  		);
  	    if ((c = m_getchar()) == 'a' || c == 'd' || c == 'l' ||
! 		    c == 'S' || c == 's' || c == 'R' || c == 'p') {
  		print("reordering messages...");
  		(void) cmd_line(sprintf(buf, "%s %c", file, c), msg_list);
  		print_more("done.");
*** /tmp/,RCSt1009567	Sun Nov  4 20:02:43 1990
--- doproc.c	Tue Oct 30 13:29:23 1990
***************
*** 301,307 ****
      if (!event || event_id(event) == MS_LEFT)
  	value = 0;
      switch(value) {
! 	case 1: p = "help";
  	when 2: p = "mouse";
  	when 3: p = "windows";
  	when 4: p = "hdr_format", helpfile = cmd_help;
--- 301,308 ----
      if (!event || event_id(event) == MS_LEFT)
  	value = 0;
      switch(value) {
! 	case 0: p = "about", helpfile = cmd_help;
! 	when 1: p = "help";
  	when 2: p = "mouse";
  	when 3: p = "windows";
  	when 4: p = "hdr_format", helpfile = cmd_help;
***************
*** 354,359 ****
--- 355,361 ----
  	mail_status(0); /* lower flag (if up) print current num of msgs */
  	/* wmgr_changestate (window_get(tool, WIN_FD), rootfd, TRUE); */
  	/* wmgr_changelevel (window_get(tool, WIN_FD), parentfd, TRUE); */
+ 	close_frame();
  	window_set(tool, FRAME_CLOSED, TRUE, NULL);
  	is_iconic = ((int) window_get(tool, FRAME_CLOSED));
  	return;
***************
*** 366,372 ****
       */
      if (isoff(glob_flags, DO_UPDATE) ||
  	    ask("Folder has been modified -- update?")) {
! 	if (!copyback("Quit anyway?"))
  	    return;
      }
      cleanup(0);
--- 368,374 ----
       */
      if (isoff(glob_flags, DO_UPDATE) ||
  	    ask("Folder has been modified -- update?")) {
! 	if (!copyback("Quit anyway?", TRUE))
  	    return;
      }
      cleanup(0);
***************
*** 374,379 ****
--- 376,408 ----
  
  /*ARGSUSED*/
  void
+ do_mark(item, value, event)
+ Panel_item item;
+ int value;
+ Event *event;
+ {
+     if (event && (event_id(event) == MS_LEFT) || value == 0) {
+ 	int msg_num = event? current_msg : (int)item;
+ 	/* mark message */
+ 	if (ison(msg[msg_num].m_flags, M_PRIORITY(0)))
+ 	    turnoff(msg[msg_num].m_flags, M_PRIORITY(0));
+ 	else
+ 	    turnon(msg[msg_num].m_flags, M_PRIORITY(0));
+ 	(void) do_hdrs(0, DUBL_NULL, NULL);
+     } else if (value < 7) {
+ 	/* set priority */
+ 	char buf[90];
+ 	(void) cmd_line(sprintf(buf, "mark -%c %s",
+ 	    value < 6? value + 'A' - 1 : ' ',
+ 	    panel_get_value(msg_num_item)), NULL);
+     } else
+ 	(void) help(0, "mark", tool_help);
+     if (value != 7 && item)
+ 	panel_set_value(item, 0);
+ }
+ 
+ /*ARGSUSED*/
+ void
  do_lpr(item, value, event)
  Panel_item item;
  int value;
***************
*** 381,387 ****
  {
      char buf[128];
  
!     if (event && (event_id(event) == MS_LEFT || value == 1)) {
  	wprint("Sending message %d to printer...\n", current_msg+1);
  	(void) strcpy(buf, "lpr ");
  	if (value)
--- 410,416 ----
  {
      char buf[128];
  
!     if (event && (event_id(event) == MS_LEFT)) {
  	wprint("Sending message %d to printer...\n", current_msg+1);
  	(void) strcpy(buf, "lpr ");
  	if (value)
***************
*** 416,422 ****
      char *argv[5], buf[64];
      char *file = (char *)window_get(textsw, TEXTSW_CLIENT_DATA);
      char *p, *oldsign = NULL, *oldfortune = NULL;
-     Textsw save_sw = wprint_sw;
  
      if (textsw_store_file(textsw, file, 0, 0)) {
  	error("Can't save to %s", file);
--- 445,450 ----
***************
*** 432,442 ****
      if (p = do_set(set_options, "fortune"))
  	oldfortune = savestr(p);
      if (panel_get_value(fortune_item) && !oldfortune)
! 	(void) cmd_line(strcpy(buf, "set fortune"), NULL);
      else if (!panel_get_value(fortune_item) && oldfortune)
  	(void) cmd_line(strcpy(buf, "\\unset fortune"), NULL);
-     wprint_sw = NULL;
-     wprint_sw = save_sw;
      turnoff(glob_flags, IS_GETTING);
      argv[0] = "mail";
      argv[1] = "-Uh";
--- 460,468 ----
      if (p = do_set(set_options, "fortune"))
  	oldfortune = savestr(p);
      if (panel_get_value(fortune_item) && !oldfortune)
! 	(void) cmd_line(strcpy(buf, "\\set fortune"), NULL);
      else if (!panel_get_value(fortune_item) && oldfortune)
  	(void) cmd_line(strcpy(buf, "\\unset fortune"), NULL);
      turnoff(glob_flags, IS_GETTING);
      argv[0] = "mail";
      argv[1] = "-Uh";
***************
*** 842,858 ****
      argv[2] = NULL;
  
      if (event_id(event) == MS_LEFT)
! 	argv[1] = do_set(set_options, "sort");
!     else switch(value) {
! 	case 0: argv[1] = "d";
  	when 1: argv[1] = "a";
  	when 2: argv[1] = "l";
  	when 3: argv[1] = "R";
  	when 4: argv[1] = "s";
! 	when 5: argv[1] = "S";
! 	when 6: (void) help(0, "sort", tool_help);
      }
!     if (value != 6) {
  	if (n > 0) {
  	    turnon(glob_flags, IS_PIPE);
  	    (void) sort(2, argv, list);
--- 868,886 ----
      argv[2] = NULL;
  
      if (event_id(event) == MS_LEFT)
! 	value = 0;
!     switch(value) {
! 	case 0: argv[1] = "S";
  	when 1: argv[1] = "a";
  	when 2: argv[1] = "l";
  	when 3: argv[1] = "R";
  	when 4: argv[1] = "s";
! 	when 5: argv[1] = "d";
! 	when 6: argv[1] = "p";
! 	when 7: do_set(set_options, "sort");
! 	when 8: (void) help(0, "sort", tool_help);
      }
!     if (value != 8) {
  	if (n > 0) {
  	    turnon(glob_flags, IS_PIPE);
  	    (void) sort(2, argv, list);
*** /tmp/,RCSt1009489	Sun Nov  4 20:01:53 1990
--- file.c	Sun Oct 21 19:24:46 1990
***************
*** 393,401 ****
  	c = *p, *p = 0;
  	/* See if it's a file.  This doesn't get written back
  	 * onto "buf" since it is supposed to be extracted anyway.
  	 */
  	if (force || *file == '+' || *file == '~' ||
! 		*file == '|' || *file == '/') {
  	    int isdir;
  	    /* open either "file" or &file[1] */
  	    if (*file == '|') {
--- 393,403 ----
  	c = *p, *p = 0;
  	/* See if it's a file.  This doesn't get written back
  	 * onto "buf" since it is supposed to be extracted anyway.
+ 	 * The check for '@' in names beginning with '/' is to
+ 	 * avoid mis-identifying X.400 addresses as file names.
  	 */
  	if (force || *file == '+' || *file == '~' ||
! 		*file == '|' || *file == '/' && !index(file, '@')) {
  	    int isdir;
  	    /* open either "file" or &file[1] */
  	    if (*file == '|') {
*** /tmp/,RCSt1009470	Sun Nov  4 20:01:41 1990
--- folders.c	Sun Oct 21 19:24:47 1990
***************
*** 85,98 ****
  	 */
  	n = 0;
  	if (*tmp != '/') {
! #ifdef SYSV
! 	    extern char *getcwd();
! 	    if (!getcwd(buf, MAXPATHLEN))
! #else /* SYSV */
! 	    extern char *getwd();
! 	    if (!getwd(buf))
! #endif /* SYSV */
! 	    {
  		error("getcwd: %s",buf);
  		return -1;
  	    }
--- 85,91 ----
  	 */
  	n = 0;
  	if (*tmp != '/') {
! 	    if (!GetCwd(buf, sizeof buf)) {
  		error("getcwd: %s",buf);
  		return -1;
  	    }
***************
*** 117,123 ****
      if (!(statbuf.st_mode & 0200))
  	do_read_only = 1;
  
!     if (!(n = copyback(updating ? "Update folder?" : "Change anyway?"))) {
  #ifdef SUNTOOL
  	if (istool > 1)
  	    timeout_cursors(FALSE);
--- 110,116 ----
      if (!(statbuf.st_mode & 0200))
  	do_read_only = 1;
  
!     if (!(n=copyback(updating?"Update folder?":"Change anyway?",!updating))) {
  #ifdef SUNTOOL
  	if (istool > 1)
  	    timeout_cursors(FALSE);
***************
*** 151,156 ****
--- 144,153 ----
  	if (!(tmpf = mask_fopen(tempfile, "w"))) {
  	    error("error truncating %s", tempfile);
  	    turnoff(glob_flags, IGN_SIGS);
+ #ifdef SUNTOOL
+ 	    if (istool > 1)
+ 		timeout_cursors(FALSE);
+ #endif /* SUNTOOL */
  	    return -1;
  	}
      }
***************
*** 160,170 ****
--- 157,175 ----
  	    last_msg_cnt = 0;
  	    last_size = statbuf.st_size; /* Disable check_new_mail() */
  	    turnoff(glob_flags, IGN_SIGS);
+ #ifdef SUNTOOL
+ 	    if (istool > 1)
+ 		timeout_cursors(FALSE);
+ #endif /* SUNTOOL */
  	    return -1;
  	}
  	if (do_read_only && !(tmpf = fopen(mailfile, "r"))) {
  	    error(mailfile);
  	    turnoff(glob_flags, IGN_SIGS);
+ #ifdef SUNTOOL
+ 	    if (istool > 1)
+ 		timeout_cursors(FALSE);
+ #endif /* SUNTOOL */
  	    return -1;
  	}
      }
***************
*** 235,240 ****
--- 240,249 ----
  	if (msg_cnt) {
  	    display_msg(current_msg, (long)0);
  	    do_hdrs(0, DUBL_NULL, NULL);
+ 	    /* Automatic display should not "touch" this message */
+ 	    turnoff(msg[current_msg].m_flags, DO_UPDATE);
+ 	    /* don't update folder just because a message is displayed */
+ 	    turnoff(glob_flags, DO_UPDATE);
  	}
  	timeout_cursors(FALSE);
      }
***************
*** 369,374 ****
--- 378,385 ----
      Debug("newest_msg = %d\n", newest_msg);
      last_msg_cnt = msg_cnt;  /* for check_new_mail */
      Debug("msg_cnt = %d\n", msg_cnt);
+     if (current_msg < 0)
+ 	current_msg = 0;
      (void) mail_size();
      turnoff(glob_flags, IGN_SIGS);
  
*** /tmp/,RCSt1009435	Sun Nov  4 20:01:22 1990
--- hdrs.c	Tue Oct 23 16:14:31 1990
***************
*** 295,300 ****
--- 295,301 ----
  	    when 'r': special = REPLIED;
  	    when 's': special = SAVED;
  	    when 'p': special = PRESERVE;
+ 	    when 'm': special = M_PRIORITY(0);
  	    otherwise: print("choose from n,u,o,d,r,s,p or a"); return -1;
  	}
      if (debug)
***************
*** 378,383 ****
--- 379,385 ----
  	status[1] = 'r';
      else
  	status[1] = ' ';
+     status[2] = 0;
  
      to[0] = from[0] = subject[0] = date[0] = lines[0] = addr[0] =
      name[0] = Day[0] = Mon[0] = Tm[0] = Yr[0] = Wkday[0] = 0;
***************
*** 433,448 ****
      /* now, construct a header out of a format string */
      if (!hdr_fmt)
  	hdr_fmt = hdr_format;
! 
!     (void) sprintf(buf, "%4.d ", cnt+1);
!     b = buf+5;
!     *b++ = ((cnt == current_msg && !iscurses)? '>': ' ');
!     *b++ = status[0], *b++ = status[1];
!     *b++ = ' ';
      /* Count chars since beginning of buf. Initialize to 9 (strlen(buf) so far)
       * This magic number is used in other places in msgs.c and mail.c
       */
      n = 9;
      for (p = hdr_fmt; *p; p++)
  	if (*p == '\\')
  	    switch (*++p) {
--- 435,459 ----
      /* now, construct a header out of a format string */
      if (!hdr_fmt)
  	hdr_fmt = hdr_format;
!     {
! 	int i;
! 	for (i = MAX_PRIORITY; i > 0; i--)
! 	    if (ison(msg[cnt].m_flags, M_PRIORITY(i))) {
! 		p2 = sprintf(lines, "%d", i);
! 		break;
! 	    }
! 	(void) sprintf(buf, "%c%3.d%s%c%s ",
! 		((cnt == current_msg && !iscurses)? '>': ' '),
! 		cnt+1, cnt < 999 ? " " : "",
! 		(ison(msg[cnt].m_flags, M_PRIORITY(0)) ? '+' :
! 					i > 0 ? 'A' + i - 1 : ' '),
! 		status);
!     }
      /* Count chars since beginning of buf. Initialize to 9 (strlen(buf) so far)
       * This magic number is used in other places in msgs.c and mail.c
       */
      n = 9;
+     b = buf+9;
      for (p = hdr_fmt; *p; p++)
  	if (*p == '\\')
  	    switch (*++p) {
***************
*** 525,534 ****
--- 536,547 ----
  	    }
  	    if (do_pad && pad && strlen(p2) > pad) {
  		char *old_p2 = p2, *p3;
+ 		int is_bangform = 0;
  		/* if addr is too long, move pointer forward till the
  		 * "important" part is readable only for ! paths/addresses.
  		 */
  		while (p3 = index(p2, '!')) {
+ 		    is_bangform = 1;
  		    len = strlen(p3+1); /* xenix has compiler problems */
  		    p2 = p3+1;
  		    if (len + isauthor*4 < pad) {
***************
*** 539,545 ****
  		}
  		if (isauthor && p2 > old_p2+4 && !p3 && strlen(p2) + 4 > pad)
  		    p2 -= 4;
! 		if (p3 && (p3 = rindex(p2, '@'))) {
  		    len = strlen(p3);
  		    while (len-- && --p2 > old_p2) {
  			if (*(p2 + isauthor*4 - 1) == '!')
--- 552,558 ----
  		}
  		if (isauthor && p2 > old_p2+4 && !p3 && strlen(p2) + 4 > pad)
  		    p2 -= 4;
! 		if (is_bangform && (p3 = rindex(p2, '@'))) {
  		    len = strlen(p3);
  		    while (len-- && --p2 > old_p2) {
  			if (*(p2 + isauthor*4 - 1) == '!')
*** /tmp/,RCSt1009495	Sun Nov  4 20:01:55 1990
--- lock.c	Sun Nov  4 17:04:33 1990
***************
*** 92,101 ****
  #endif /* USG */
  #define LOCK_NB 0	/* Always non-blocking in this case */
  
! #ifdef HPUX
  #undef EWOULDBLOCK
! #endif /* HPUX */
  #define EWOULDBLOCK	EAGAIN
  
  flock(fd, op)
  int fd, op;
--- 92,105 ----
  #endif /* USG */
  #define LOCK_NB 0	/* Always non-blocking in this case */
  
! #ifdef EWOULDBLOCK
  #undef EWOULDBLOCK
! #endif /* EWOULDBLOCK */
! #ifdef M_UNIX
! #define EWOULDBLOCK	EACCESS	/* SCO bug that may eventually be fixed */
! #else /* !M_UNIX */
  #define EWOULDBLOCK	EAGAIN
+ #endif /* M_UNIX */
  
  flock(fd, op)
  int fd, op;
***************
*** 215,221 ****
  #ifdef M_XENIX
      (void) unlink(sprintf(buf, "/tmp/%.10s.mlk", login));
  #else /* M_XENIX */
!     (void) unlink(sprintf(buf, "%s.lock", filename));
  #endif /* M_XENIX */
  #ifdef BSD
      setregid(sgid, rgid);
--- 219,236 ----
  #ifdef M_XENIX
      (void) unlink(sprintf(buf, "/tmp/%.10s.mlk", login));
  #else /* M_XENIX */
!     {
! 	/* If the file was locked through open_file(), we may not have
! 	 * a complete pathname to work with here.  Expand it and test
! 	 * whether we need to unlink at all.  This should really be
! 	 * handled by having open_file() return the name it used, but
! 	 * that breaks too many other things at the moment.
! 	 */
! 	int isdir = 0;
! 	char *p = getpath(sprintf(buf, "%s.lock", filename), &isdir);
! 	if (isdir == 0)
! 	    (void) unlink(p);
!     }
  #endif /* M_XENIX */
  #ifdef BSD
      setregid(sgid, rgid);
*** /tmp/,RCSt1009474	Sun Nov  4 20:01:43 1990
--- loop.c	Sun Oct 21 19:24:50 1990
***************
*** 50,56 ****
      (void) signal(SIGINT, catch);
      (void) signal(SIGQUIT, catch);
      (void) signal(SIGHUP, catch);
- #ifndef SUNTOOL
      (void) signal(SIGTERM, catch);
      (void) signal(SIGCHLD,
  #ifndef SYSV
--- 50,55 ----
***************
*** 59,65 ****
  			   SIG_DFL
  #endif /* SYSV */
  			   );
- #endif /* SUNTOOL*/
  
      turnoff(glob_flags, IGN_SIGS);
      if (hist_size == 0) /* if user didn't set history in .rc file */
--- 58,63 ----
***************
*** 650,665 ****
  }
  
  /*
-  * Structure for expansions
-  * (move to a header file?)
-  */
- struct expand {
-     char *orig;		/* string beginning with substring to be expanded */
-     char *exp;		/* result of expansion of substring */
-     char *rest;		/* rest of the original string beyond substring */
- };
- 
- /*
   * Parse and expand a single variable reference.  Variable references
   * begin with a '$' and thereafter look like any of:
   *	$	$$ is the pid of the current process
--- 648,653 ----
***************
*** 1182,1187 ****
--- 1170,1176 ----
  #ifndef REGCMP
      extern char   *re_comp();
  #else
+     char *rex = NULL;
      extern char   *regcmp();
  #endif /* REGCMP */
  
***************
*** 1202,1208 ****
  #ifndef REGCMP
  	if (re_comp(str))
  #else
! 	if (!regcmp(str, NULL))
  #endif /* REGCMP */
  	{
  	    if (c)
--- 1191,1197 ----
  #ifndef REGCMP
  	if (re_comp(str))
  #else
! 	if (!(rex = regcmp(str, NULL)))	/* Assign and test */
  #endif /* REGCMP */
  	{
  	    if (c)
***************
*** 1232,1238 ****
  #ifndef REGCMP
  		re_exec(buf)
  #else
! 		!!regex(str, buf, NULL) /* convert to boolean value */
  #endif /* REGCMP */
  				== 1;
  	if (found) {
--- 1221,1227 ----
  #ifndef REGCMP
  		re_exec(buf)
  #else
! 		!!regex(rex, buf, NULL) /* convert to boolean value */
  #endif /* REGCMP */
  				== 1;
  	if (found) {
*** /tmp/,RCSt1009421	Sun Nov  4 20:01:14 1990
--- main.c	Sun Oct 21 19:24:52 1990
***************
*** 188,196 ****
  	mailv[n++] = recipients;
  	mailv[n] = NULL;
  	/* set now in case user is not running shell, but is running debug */
! #ifndef SUNTOOL
! 	(void) signal(SIGCHLD, sigchldcatcher);
! #endif /* SUNTOOL */
  	if (!setjmp(jmpbuf))
  	    (void) do_mail(n, mailv, msg_list);
  	/* do shell set from above: "mush -S user" perhaps */
--- 188,195 ----
  	mailv[n++] = recipients;
  	mailv[n] = NULL;
  	/* set now in case user is not running shell, but is running debug */
! 	if (!istool)
! 	    (void) signal(SIGCHLD, sigchldcatcher);
  	if (!setjmp(jmpbuf))
  	    (void) do_mail(n, mailv, msg_list);
  	/* do shell set from above: "mush -S user" perhaps */
***************
*** 280,287 ****
      }
  
      turnon(glob_flags, DO_SHELL);
-     if (istool && msg_cnt)
- 	set_isread(current_msg);
  
      /* finally, if the user wanted to source a file to execute, do it now */
      if (Flags.src_file) {
--- 279,284 ----
***************
*** 311,317 ****
  	(void) notify_set_itimer_func(tool, do_check,
  	    ITIMER_REAL, &mail_timer, (struct itimerval *) 0);
  	timeout_cursors(FALSE);
- 	turnoff(glob_flags, DO_UPDATE);
  	window_main_loop(tool);
  	cleanup(0);
      }
--- 308,313 ----
***************
*** 329,346 ****
  set_cwd()
  {
      char cwd[MAXPATHLEN];
- #ifndef SYSV
-     extern char *getwd();
- #else /* SYSV */
-     extern char *getcwd();
- #endif /* SYSV */
  
! #ifndef SYSV
!     if (getwd(cwd) == NULL)
! #else
!     if (getcwd(cwd, MAXPATHLEN) == NULL)
! #endif /* SYSV */
!     {
  	error("set_cwd: %s", cwd);
  	(void) un_set(&set_options, "cwd");
      } else {
--- 325,332 ----
  set_cwd()
  {
      char cwd[MAXPATHLEN];
  
!     if (GetCwd(cwd, MAXPATHLEN) == NULL) {
  	error("set_cwd: %s", cwd);
  	(void) un_set(&set_options, "cwd");
      } else {
*** /tmp/,RCSt1009561	Sun Nov  4 20:02:41 1990
--- makefile.sys.v	Sun Oct 21 19:24:53 1990
***************
*** 17,23 ****
  OBJS2= bind.o curs_io.o curses.o file.o strings.o macros.o \
  	addrs.o malloc.o glob.o
  
! HELP= README README-7.0 README-7.1 mush.1 cmd_help \
  	Mushrc Mailrc Gnurc sample.mushrc advanced.mushrc digestify
  
  # Sun OS systems who wish to compile with sys-v options:
--- 17,23 ----
  OBJS2= bind.o curs_io.o curses.o file.o strings.o macros.o \
  	addrs.o malloc.o glob.o
  
! HELP= README README-7.0 README-7.1 README-7.2 mush.1 cmd_help \
  	Mushrc Mailrc Gnurc sample.mushrc advanced.mushrc digestify
  
  # Sun OS systems who wish to compile with sys-v options:
*** /tmp/,RCSt1009558	Sun Nov  4 20:02:40 1990
--- makefile.xenix	Sun Oct 21 19:24:54 1990
***************
*** 20,26 ****
        signals.o setopts.o msgs.o pick.o sort.o expr.o strings.o \
        folders.o dates.o loop.o viewopts.o bind.o curses.o curs_io.o \
        lock.o macros.o options.o addrs.o malloc.o glob.o
! HELP_FILES= README README-7.0 README-7.1 mush.1 cmd_help \
  	Mushrc Mailrc Gnurc sample.mushrc advanced.mushrc digestify
  
  # Memory model.  Use -M3e for 80386 machines.
--- 20,26 ----
        signals.o setopts.o msgs.o pick.o sort.o expr.o strings.o \
        folders.o dates.o loop.o viewopts.o bind.o curses.o curs_io.o \
        lock.o macros.o options.o addrs.o malloc.o glob.o
! HELP_FILES= README README-7.0 README-7.1 README-7.2 mush.1 cmd_help \
  	Mushrc Mailrc Gnurc sample.mushrc advanced.mushrc digestify
  
  # Memory model.  Use -M3e for 80386 machines.
*** /tmp/,RCSt1009427	Sun Nov  4 20:01:17 1990
--- misc.c	Thu Oct 25 17:46:52 1990
***************
*** 51,65 ****
  print_help(argc, argv)
  register char **argv;
  {
! #ifdef SUNTOOL
!     if (istool)
! 	return help(0, "general", tool_help);
! #endif /* SUNTOOL */
  
      if (!argc || !*++argv)
! 	return help(0, "general", cmd_help);
      if (argv[0][0] == '-')
! 	return help(0, "help", cmd_help);
      return help(0, *argv, cmd_help);
  }
  
--- 51,62 ----
  print_help(argc, argv)
  register char **argv;
  {
!     int about = (argv && *argv && **argv == 'a');
  
      if (!argc || !*++argv)
! 	return help(0, about? "about": "general", cmd_help);
      if (argv[0][0] == '-')
! 	return help(0, about? "about": "help", cmd_help);
      return help(0, *argv, cmd_help);
  }
  
***************
*** 282,287 ****
--- 279,287 ----
   * The + implies: add this flag to the current message's flag bits
   * The - implies: delete this flag to the current message's flag bits
   * No + or - implies that the msg's flag bits are set explicitly.
+  * Marks and priorities are preserved in the m_flags field despite
+  * what we're doing here.  Thus, other actions taken by this function
+  * do not affect marks and priorities.
   */
  msg_flags(c, v, list)
  register char **v, *list;
***************
*** 327,332 ****
--- 327,333 ----
  			had_list = 1;
  		    }
  	    }
+ 
      /* If we haven't got a msglist, use current_msg */
      if (had_list == 0 && isoff(glob_flags, IS_PIPE))
  	set_msg_bit(list, current_msg);
***************
*** 355,371 ****
  		wprint(" FORWARD");
  	    if (ison(msg[i].m_flags, UPDATE_STATUS))
  		wprint(" UPDATE_STATUS");
  	    (void) strcpy(sent, date_to_ctime(msg[i].m_date_sent));
  	    (void) strcpy(recv, date_to_ctime(msg[i].m_date_recv));
  	    wprint("\n\tsent: %s\trecv: %s", sent, recv);
  	} else {
! 	    if (isoff(glob_flags, READ_ONLY))
! 		turnon(glob_flags, DO_UPDATE);
  	    switch (modify) {
  		case 0: msg[i].m_flags = newflag;
  		when 1: msg[i].m_flags |= newflag;
  		when 2: msg[i].m_flags &= ~newflag;
  	    }
  	}
      }
      return 0;
--- 356,386 ----
  		wprint(" FORWARD");
  	    if (ison(msg[i].m_flags, UPDATE_STATUS))
  		wprint(" UPDATE_STATUS");
+ 	    for (modify = MAX_PRIORITY; modify > 0; modify--)
+ 		if (ison(msg[i].m_flags, M_PRIORITY(modify)))
+ 		    wprint(" %c", 'A' + modify - 1);
  	    (void) strcpy(sent, date_to_ctime(msg[i].m_date_sent));
  	    (void) strcpy(recv, date_to_ctime(msg[i].m_date_recv));
  	    wprint("\n\tsent: %s\trecv: %s", sent, recv);
  	} else {
! 	    u_long save_priority = 0L;
! 	    if (modify == 0) {
! 		int j;
! 		for (j = 0; j < MAX_PRIORITY; j++)
! 		    if (ison(msg[i].m_flags, M_PRIORITY(j)))
! 			turnon(save_priority, M_PRIORITY(j));
! 	    }
  	    switch (modify) {
  		case 0: msg[i].m_flags = newflag;
  		when 1: msg[i].m_flags |= newflag;
  		when 2: msg[i].m_flags &= ~newflag;
  	    }
+ 	    if (save_priority)
+ 		msg[i].m_flags |= save_priority;
+ 	    if (isoff(glob_flags, READ_ONLY)) {
+ 		turnon(glob_flags, DO_UPDATE);
+ 		turnon(msg[i].m_flags, DO_UPDATE);
+ 	    }
  	}
      }
      return 0;
***************
*** 398,407 ****
  char *buf;
  {
      static FILE *pp;
-     static char file[MAXPATHLEN];
      static int cnt, len;
      static u_long save_echo_flag;
  #ifdef SUNTOOL
      static Textsw sw;
  
      /* pipe_msg will pass -1 for start_pager to avoid this block */
--- 413,422 ----
  char *buf;
  {
      static FILE *pp;
      static int cnt, len;
      static u_long save_echo_flag;
  #ifdef SUNTOOL
+     static char file[MAXPATHLEN];
      static Textsw sw;
  
      /* pipe_msg will pass -1 for start_pager to avoid this block */
***************
*** 551,559 ****
      if (!p)
  	p = "--more--";
      print_more(p);
!     
      while ((c = getchar()) >= 0 && c != CTRL('D') && !isspace(c) &&
! 	   c != '\n' && c != '\r' && lower(c) != 'q' && lower(c) != 'd')
  	bell();
      if (ison(glob_flags, ECHO_FLAG) && c != '\n' && c != '\r')
  	while (getchar() != '\n');
--- 566,574 ----
      if (!p)
  	p = "--more--";
      print_more(p);
! 
      while ((c = getchar()) >= 0 && c != CTRL('D') && !isspace(c) &&
! 	    c != '\n' && c != '\r' && lower(c) != 'q' && lower(c) != 'd')
  	bell();
      if (ison(glob_flags, ECHO_FLAG) && c != '\n' && c != '\r')
  	while (getchar() != '\n');
***************
*** 676,683 ****
  		error(buf+1);
  	    else {
  		turnon(glob_flags, IGN_SIGS);
! 		while (fgets(buf, sizeof(buf), pp2))
  		    (void) fputs(buf, fp), lines++;
  		(void) pclose(pp2);
  		(void) fflush(fp);
  		turnoff(glob_flags, IGN_SIGS);
--- 691,702 ----
  		error(buf+1);
  	    else {
  		turnon(glob_flags, IGN_SIGS);
! 		while (fgets(buf, sizeof(buf), pp2)) {
! 		    int len = strlen(buf);
  		    (void) fputs(buf, fp), lines++;
+ 		    if (len < sizeof buf - 1 && buf[len - 1] != '\n')
+ 			(void) fputc('\n', fp);
+ 		}
  		(void) pclose(pp2);
  		(void) fflush(fp);
  		turnoff(glob_flags, IGN_SIGS);
*** /tmp/,RCSt1009461	Sun Nov  4 20:01:37 1990
--- pick.c	Sun Oct 21 19:25:01 1990
***************
*** 3,8 ****
--- 3,9 ----
  #include "mush.h"
  
  static int before, after, search_from, search_subj, search_to, xflg, icase;
+ static u_long match_priority;
  static char search_hdr[64];
  static int mdy[3];
  static int pick();
***************
*** 71,76 ****
--- 72,78 ----
  
      head_first = TRUE;
      head_cnt = tail_cnt = -1;
+     match_priority = 0;
      icase = before = after = search_from = search_subj = search_to = xflg = 0;
      mdy[0] = mdy[1] = search_hdr[0] = 0;
      while (*argv && *++argv && (**argv == '-' || **argv == '+'))
***************
*** 89,100 ****
  	    }
  	} else if ((c = argv[0][1]) == 'e') {
  	    if (!*++argv) {
! 		print("use: -e expression...\n");
  		return -1;
  	    }
  	    break;
  	} else switch (c) {
! 	    /* users specifies a range */
  	    case 'r': {
  		int X = 2;
  		/* if not a pipe, then clear all bits cuz we only want
--- 91,102 ----
  	    }
  	} else if ((c = argv[0][1]) == 'e') {
  	    if (!*++argv) {
! 		print("usage: -e expression...\n");
  		return -1;
  	    }
  	    break;
  	} else switch (c) {
! 	    /* user specifies a range */
  	    case 'r': {
  		int X = 2;
  		/* if not a pipe, then clear all bits cuz we only want
***************
*** 144,149 ****
--- 146,159 ----
  			(void) lcase_strcpy(search_hdr, *argv);
  		else
  		    search_to = 1;
+ 	    when 'p' :	/* Select on priority field */
+ 		if (!*++argv || (c = upper(**argv)) < 'A' ||
+ 			c > MAX_PRIORITY + 'A') {
+ 		    print("pick: invalid priority: %s\n", argv[0]);
+ 		    clear_msg_list(ret_list);
+ 		    return -1;
+ 		}
+ 		turnon(match_priority, M_PRIORITY(c - 'A' + 1));
  	    when 'x' : xflg = 1;
  	    when 'i' : icase = 1;
  	    otherwise:
***************
*** 155,163 ****
  	print("Can't specify -x and head/tail options together.\n");
  	return -1;
      }
!     pattern[0] = 0;
!     (void) argv_to_string(pattern, argv);
!     search = (pattern[0] || head_cnt + tail_cnt < 0);
      if (verbose) {
  	if (head_cnt + tail_cnt >= 0) {
  	    print("Finding the ");
--- 165,181 ----
  	print("Can't specify -x and head/tail options together.\n");
  	return -1;
      }
!     if (!mdy[1]) {
! 	pattern[0] = 0;
! 	(void) argv_to_string(pattern, argv);
! 	if (pattern[0] == '\0' && match_priority == 0 &&
! 		head_cnt + tail_cnt < 0) {
! 	    print("No pattern specified\n");
! 	    clear_msg_list(ret_list);  /* doesn't matter really */
! 	    return -1;
! 	}
!     }
!     search = (pattern[0] || mdy[1] || match_priority > 0);
      if (verbose) {
  	if (head_cnt + tail_cnt >= 0) {
  	    print("Finding the ");
***************
*** 181,195 ****
  		else
  		    print_more(" of the last %d", tail_cnt);
  	} else
! 	    print_more("Searching for messages");
  	if (!search) {
  	    if (tail_cnt > 0 && head_cnt > 0)
  		print_more(" messages");
  	    if (ison(glob_flags, IS_PIPE))
  		print_more(" from the input list");
! 	} else if (mdy[1] == 0) {
! 	    print(" that %scontain \"%s\"", (xflg)? "do not ": "",
! 			    (*pattern)? pattern: "<previous expression>");
  	    if (search_subj)
  		print_more(" in subject line");
  	    else if (search_from)
--- 199,214 ----
  		else
  		    print_more(" of the last %d", tail_cnt);
  	} else
! 	    print_more("Searching for %smessages",
! 		match_priority > 0 ? "priority " : "");
  	if (!search) {
  	    if (tail_cnt > 0 && head_cnt > 0)
  		print_more(" messages");
  	    if (ison(glob_flags, IS_PIPE))
  		print_more(" from the input list");
! 	} else if (pattern[0]) {
! 	    print_more(" that %scontain \"%s\"", (xflg)? "do not ": "",
! 			    pattern);
  	    if (search_subj)
  		print_more(" in subject line");
  	    else if (search_from)
***************
*** 198,204 ****
  		print_more(" from the To: field");
  	    else if (search_hdr[0])
  		print_more(" from the message header \"%s:\"", search_hdr);
! 	} else {
  	    extern char *month_names[]; /* from dates.c */
  	    print_more(" dated ");
  	    if (before || after)
--- 217,223 ----
  		print_more(" from the To: field");
  	    else if (search_hdr[0])
  		print_more(" from the message header \"%s:\"", search_hdr);
! 	} else if (mdy[1]) {
  	    extern char *month_names[]; /* from dates.c */
  	    print_more(" dated ");
  	    if (before || after)
***************
*** 300,306 ****
  	    return -1;
  	}
  #endif /* REGCMP */
!     } else if (err == (char *)-1 && mdy[1] <= 0) {
  	print("No previous regular expression\n");
  	clear_msg_list(ret_list);  /* doesn't matter really */
  	return -1;
--- 319,325 ----
  	    return -1;
  	}
  #endif /* REGCMP */
!     } else if (err == (char *)-1 && mdy[1] <= 0 && match_priority == 0) {
  	print("No previous regular expression\n");
  	clear_msg_list(ret_list);  /* doesn't matter really */
  	return -1;
***************
*** 308,313 ****
--- 327,337 ----
      /* start searching: set bytes, and message number: n */
      for (n = 0; cnt && n < msg_cnt; n++)
  	if (msg_bit(check_list, n)) {
+ 	    if (match_priority > 0) {
+ 		if (msg[n].m_flags & match_priority)
+ 		    ++matches, set_msg_bit(ret_list, n);
+ 		continue;
+ 	    }
  	    if (mdy[1] > 0) {
  		int msg_mdy[3];
  		if (ison(glob_flags, DATE_RECV))
*** /tmp/,RCSt1009445	Sun Nov  4 20:01:28 1990
--- print.c	Sun Oct 21 19:25:01 1990
***************
*** 119,126 ****
  /*
   * wprint prints stuff to a scrollable textsw.  This is intended for
   * print statements that need to be recalled since print() overwrites
!  * its last message.  Messages are printed to whatever wprint_sw
!  * currently points to.  If you set it to null, nothing prints.
   * For non-suntool mode, wprint() is just like printf().  For curses mode,
   * wprint() does -not- act like print() -- lines length is not counted
   * and newlines are not stripped.
--- 119,125 ----
  /*
   * wprint prints stuff to a scrollable textsw.  This is intended for
   * print statements that need to be recalled since print() overwrites
!  * its last message.
   * For non-suntool mode, wprint() is just like printf().  For curses mode,
   * wprint() does -not- act like print() -- lines length is not counted
   * and newlines are not stripped.
***************
*** 149,160 ****
  	(void) fflush(stdout);
  	return;
      }
-     if (!compose_frame || !window_get(compose_frame, WIN_SHOW) || !cprint_sw)
-         wprint_sw = mfprint_sw;
-     else
-         wprint_sw = cprint_sw;
  
!     if (!wprint_sw)
          return;
      va_start(args);
      fmt = va_arg(args, char *);
--- 148,155 ----
  	(void) fflush(stdout);
  	return;
      }
  
!     if (!mfprint_sw)
          return;
      va_start(args);
      fmt = va_arg(args, char *);
***************
*** 168,174 ****
  	_doprnt(fmt, args, &foo); /* format like printf into msgbuf via foo */
  	*foo._ptr = '\0'; /* plant terminating null character */
  #endif /* VPRINTF */
! 	textsw_insert(wprint_sw, msgbuf, strlen(msgbuf));
      }
      va_end(args);
  }
--- 163,169 ----
  	_doprnt(fmt, args, &foo); /* format like printf into msgbuf via foo */
  	*foo._ptr = '\0'; /* plant terminating null character */
  #endif /* VPRINTF */
! 	textsw_insert(mfprint_sw, msgbuf, strlen(msgbuf));
      }
      va_end(args);
  }
*** /tmp/,RCSt1009454	Sun Nov  4 20:01:34 1990
--- setopts.c	Thu Oct 25 16:17:44 1990
***************
*** 493,500 ****
  	    else if (argv[argc][0] == '*') {
  		alternates[argc] = savestr(argv[argc]);
  	    } else {
! 		p = buf + Strcpy(buf, argv[argc]);
! 		*p++ = '!', p += Strcpy(p, login);
  		alternates[argc] = savestr(reverse(buf));
  	    }
  	}
--- 493,504 ----
  	    else if (argv[argc][0] == '*') {
  		alternates[argc] = savestr(argv[argc]);
  	    } else {
! 		if (index(argv[argc], '@'))
! 		    bang_form(buf, argv[argc]);
! 		else {
! 		    p = buf + Strcpy(buf, argv[argc]);
! 		    *p++ = '!', p += Strcpy(p, login);
! 		}
  		alternates[argc] = savestr(reverse(buf));
  	    }
  	}
*** /tmp/,RCSt1009451	Sun Nov  4 20:01:32 1990
--- signals.c	Sun Oct 21 19:25:03 1990
***************
*** 59,65 ****
--- 59,67 ----
  	    if (sig == SIGHUP && window_get(tool, WIN_SHOW))
  		return;
  #endif /* SUNTOOL && !SUN_4_0 */
+ #ifdef SUNTOOL
  	    istool = 1;
+ #endif /* SUNTOOL */
  	}
  	(void) setjmp(jmpbuf);
  	if (ison(glob_flags, IS_GETTING))
***************
*** 184,190 ****
      }
      if (c != 'n' && *tempfile) {
  	if (sig == SIGHUP && do_set(set_options, "hangup") &&
! 		copyback(NULL) && isoff(glob_flags, CORRUPTED))
  	    (void) unlink(tempfile);
  	else if (unlink(tempfile) && !sig && errno != ENOENT)
  	    error(tempfile);
--- 186,192 ----
      }
      if (c != 'n' && *tempfile) {
  	if (sig == SIGHUP && do_set(set_options, "hangup") &&
! 		copyback(NULL, TRUE) && isoff(glob_flags, CORRUPTED))
  	    (void) unlink(tempfile);
  	else if (unlink(tempfile) && !sig && errno != ENOENT)
  	    error(tempfile);
***************
*** 253,270 ****
      }
      /* Prevent both bogus "new mail" messages and missed new mail */
      last_size = msg[msg_cnt].m_offset;
!     if (!strcmp(mailfile, spoolfile))
  	spool_size = last_size;
      if (last_spool_size != spool_size) {
  	if (update_size)
  	    last_spool_size = spool_size;
- 	if (msg_cnt < last_msg_cnt)
- 	    turnoff(glob_flags, NEW_MAIL);
- 	else {
- 	    turnon(glob_flags, NEW_MAIL);
- 	    if (current_msg < 0)
- 		current_msg = 0;
- 	}
  	return 1;
      }
      return 0;
--- 255,271 ----
      }
      /* Prevent both bogus "new mail" messages and missed new mail */
      last_size = msg[msg_cnt].m_offset;
!     if (!strcmp(mailfile, spoolfile)) {
  	spool_size = last_size;
+ 	if (last_spool_size != spool_size)
+ 	    turnon(glob_flags, NEW_MAIL);
+     } else if (last_spool_size < spool_size)
+ 	turnon(glob_flags, NEW_MAIL);
+     if (msg_cnt && current_msg < 0)
+ 	current_msg = 0;
      if (last_spool_size != spool_size) {
  	if (update_size)
  	    last_spool_size = spool_size;
  	return 1;
      }
      return 0;
***************
*** 359,365 ****
  {
      int 	   ret_value;
  
-     /* if fullscreen access in progress (help), don't do anything */
      if (ret_value = mail_size()) {
  #ifdef SUNTOOL
  	/* if our status has changed from icon to open window, then
--- 360,365 ----
*** /tmp/,RCSt1009464	Sun Nov  4 20:01:39 1990
--- sort.c	Sun Oct 21 19:25:03 1990
***************
*** 39,46 ****
  		case 'R': /* sort by subject including Re: */
  		case 'l': /* sort by length in bytes */
  		case 'S': /* sort by message status */
  		    /* skip consecutive repeats of the same flag */
! 		    if (subsort[depth-1] != argv[0][n])
  			subsort[depth++] = argv[0][n];
  		when 'i': ignore_case = TRUE;
  		otherwise: return help(0, "sort", cmd_help);
--- 39,47 ----
  		case 'R': /* sort by subject including Re: */
  		case 'l': /* sort by length in bytes */
  		case 'S': /* sort by message status */
+ 		case 'p': /* sort by message priority */
  		    /* skip consecutive repeats of the same flag */
! 		    if (depth < 1 || subsort[depth-1] != argv[0][n])
  			subsort[depth++] = argv[0][n];
  		when 'i': ignore_case = TRUE;
  		otherwise: return help(0, "sort", cmd_help);
***************
*** 60,72 ****
      on_intr();
  
      if (list && ison(glob_flags, IS_PIPE)) {
  	for (n = 0; n < msg_cnt; n++)
  	    if (msg_bit(list, n)) {
  		if (offset < 0)
  		    offset = n;
  		range++;
  	    } else if (offset >= 0)
! 		break;
      } else
  	offset = 0, range = msg_cnt;
  
--- 61,80 ----
      on_intr();
  
      if (list && ison(glob_flags, IS_PIPE)) {
+ 	int consec = 1;
  	for (n = 0; n < msg_cnt; n++)
  	    if (msg_bit(list, n)) {
+ 		if (!consec) {
+ 		    ok_box("Listed messages not consecutive\n");
+ 		    turnoff(glob_flags, IGN_SIGS);
+ 		    off_intr();
+ 		    return -1;
+ 		}
  		if (offset < 0)
  		    offset = n;
  		range++;
  	    } else if (offset >= 0)
! 		consec = 0;
      } else
  	offset = 0, range = msg_cnt;
  
***************
*** 151,157 ****
      if (isoff(msg1->m_flags,FORWARD) && ison(msg2->m_flags,FORWARD))
  	return order;
  
!     return order;
  }
  
  author_cmp(msg1, msg2)
--- 159,165 ----
      if (isoff(msg1->m_flags,FORWARD) && ison(msg2->m_flags,FORWARD))
  	return order;
  
!     return pri_cmp(msg1, msg2);
  }
  
  author_cmp(msg1, msg2)
***************
*** 244,250 ****
  date_cmp(msg1, msg2)
  register struct msg *msg1, *msg2;
  {
-     int retval;
      long tm1, tm2;
  
      if (ison(glob_flags, DATE_RECV)) {
--- 252,257 ----
***************
*** 257,262 ****
--- 264,284 ----
      return tm1 < tm2 ? -order : (tm1 > tm2) ? order : msg_cmp(msg1, msg2);
  }
  
+ pri_cmp(msg1, msg2)
+ register struct msg *msg1, *msg2;
+ {
+     int i;
+     u_long pr1 = 0, pr2 = 0;
+ 
+     for (i = 0; pr1 == pr2 && i <= MAX_PRIORITY; i++) {
+ 	if (ison(msg1->m_flags, M_PRIORITY(i)))
+ 	    turnon(pr1, ULBIT(i));
+ 	if (ison(msg2->m_flags, M_PRIORITY(i)))
+ 	    turnon(pr2, ULBIT(i));
+     }
+     return pr1 > pr2 ? -order : (pr1 < pr2) ? order : msg_cmp(msg1, msg2);
+ }
+ 
  static
  msg_cmp(msg1, msg2)
  register struct msg *msg1, *msg2;
***************
*** 283,288 ****
--- 305,311 ----
  	when 's': retval = subject_cmp(msg1, msg2);
  	when 'R': retval = subj_with_re(msg1, msg2);
  	when 'l': retval = size_cmp(msg1, msg2); /* length compare */
+ 	when 'p': retval = pri_cmp(msg1, msg2);
  	otherwise: retval = status_cmp(msg1, msg2);
      }
      depth = sv_depth;
*** /tmp/,RCSt1009597	Sun Nov  4 20:02:55 1990
--- tool_help	Sun Oct 21 19:25:04 1990
***************
*** 401,403 ****
--- 401,420 ----
  use the RIGHT mouse button on the  Include item and select Forward
  Message from the menu.
  %%
+ 
+ %mark%
+ Marks can be used to tag messages for later reference.  They are
+ temporary and will not be saved when the folder is updated.  A
+ priority setting beteween A and E may also be set on message(s).
+ Priorities are saved across updated folders.  Sorting by marks
+ and priorities is also available (marks having highest priority,
+ followed by A, B, etc.).
+ 
+ Marks are set on the current message only while priorities are set
+ (or unset) on the message list specified in the Range: text field.
+ 
+ Messages may have both a temporary mark and a priority, but may not
+ have more than one priority.  The presence of a mark or a priority
+ setting is shown by a `+' character immediately following the message
+ number in the "headers" command display.
+ %%