Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp
Path: utzoo!linus!philabs!prls!amdimage!amdcad!decwrl!sun!guy
From: guy@sun.uucp (Guy Harris)
Newsgroups: net.bugs.4bsd
Subject: Message specifiers "+" and "-" don't work right in Mail
Message-ID: <2592@sun.uucp>
Date: Fri, 9-Aug-85 18:28:38 EDT
Article-I.D.: sun.2592
Posted: Fri Aug  9 18:28:38 1985
Date-Received: Mon, 12-Aug-85 22:05:56 EDT
Distribution: net
Organization: Sun Microsystems, Inc.
Lines: 77

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;