[net.bugs.4bsd] Message specifiers "+" and "-" don't work right in Mail

guy@sun.uucp (Guy Harris) (08/10/85)

Index:	ucb/Mail/list.c

Description:
	The message specifiers "+" and "-" refer to the next and
	previous message, respectively, rather than to the next and
	previous applicable message.  This means, for instance,
	that if the previous message was deleted, "-" will give an
	error instead of giving the message before the deleted one.
Repeat-By:
	Do the obvious.
Fix:
	Here's the patch.

*** list.c.orig	Fri Aug  9 01:59:04 1985
--- list.c	Fri Aug  9 01:57:31 1985
***************
*** 134,145
  				printf("Non-numeric second argument\n");
  				return(-1);
  			}
! 			if (valdot < msgCount)
! 				mark(valdot+1);
! 			else {
! 				printf("Referencing beyond EOF\n");
! 				return(-1);
! 			}
  			break;
  
  		case TDASH:

--- 134,148 -----
  				printf("Non-numeric second argument\n");
  				return(-1);
  			}
! 			i = valdot;
! 			do {
! 				i++;
! 				if (i >= msgCount) {
! 					printf("Referencing beyond EOF\n");
! 					return(-1);
! 				}
! 			} while ((message[i - 1].m_flag & MDELETED) != f);
! 			mark(i);
  			break;
  
  		case TDASH:
***************
*** 144,155
  
  		case TDASH:
  			if (beg == 0) {
! 				if (valdot > 1)
! 					mark(valdot-1);
! 				else {
! 					printf("Referencing before 1\n");
! 					return(-1);
! 				}
  			}
  			break;
  

--- 147,161 -----
  
  		case TDASH:
  			if (beg == 0) {
! 				i = valdot;
! 				do {
! 					i--;
! 					if (i <= 0) {
! 						printf("Referencing before 1\n");
! 						return(-1);
! 					}
! 				} while ((message[i - 1].m_flag & MDELETED) != f);
! 				mark(i);
  			}
  			break;