handle unmatched quotes correctly and make null string match no sender
SCCS-vsn: usr.bin/mail/def.h 5.18
SCCS-vsn: usr.bin/mail/list.c 5.10
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#)def.h 5.17 (Berkeley) %G%
+ * @(#)def.h 5.18 (Berkeley) %G%
*/
#include <sys/param.h> /* includes <sys/types.h> */
*/
#include <sys/param.h> /* includes <sys/types.h> */
#define TOPEN 8 /* An '(' */
#define TCLOSE 9 /* A ')' */
#define TPLUS 10 /* A '+' */
#define TOPEN 8 /* An '(' */
#define TCLOSE 9 /* A ')' */
#define TPLUS 10 /* A '+' */
+#define TERROR 11 /* A lexical error */
#define REGDEP 2 /* Maximum regret depth. */
#define STRINGLEN 1024 /* Maximum length of string token */
#define REGDEP 2 /* Maximum regret depth. */
#define STRINGLEN 1024 /* Maximum length of string token */
-static char sccsid[] = "@(#)list.c 5.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)list.c 5.10 (Berkeley) %G%";
#endif /* not lint */
#include "rcv.h"
#endif /* not lint */
#include "rcv.h"
+
+ case TERROR:
+ return -1;
+ if (matchsender(*np, i)) {
c = *cp++;
}
while (c != '\0') {
c = *cp++;
}
while (c != '\0') {
+ if (c == quotec) {
+ cp++;
if (quotec == 0 && (c == ' ' || c == '\t'))
break;
if (cp2 - lexstring < STRINGLEN-1)
*cp2++ = c;
c = *cp++;
}
if (quotec == 0 && (c == ' ' || c == '\t'))
break;
if (cp2 - lexstring < STRINGLEN-1)
*cp2++ = c;
c = *cp++;
}
+ if (quotec && c == 0) {
fprintf(stderr, "Missing %c\n", quotec);
fprintf(stderr, "Missing %c\n", quotec);
*sp = --cp;
*cp2 = '\0';
return(TSTRING);
*sp = --cp;
*cp2 = '\0';
return(TSTRING);
- register struct message *mp;
register char *cp, *cp2, *backup;
register char *cp, *cp2, *backup;
- mp = &message[mesg-1];
- backup = cp2 = nameof(mp, 0);
+ if (!*str) /* null string matches nothing instead of everything */
+ return 0;
+ backup = cp2 = nameof(&message[mesg - 1], 0);
cp = str;
while (*cp2) {
if (*cp == 0)
cp = str;
while (*cp2) {
if (*cp == 0)