diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-01-16 05:36:10 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-01-16 05:36:10 +0000 |
commit | e913afeb49c504a109e4bb5f0bbc7413c1f2b7d4 (patch) | |
tree | e3f06532bf64681e08848aa1e0b3fd00383cc11d /usr.bin/mail/lex.c | |
parent | 86370b96c590d4c80af75091f9238d13ab88f77f (diff) |
Changes from Don Beusee:
o escape From line with a leading '>' when needed
o only print To: address and Subject lines if actually present
o new variable 'allnet' to treat user@foo and user@bar as the same "user"
o folders command now takes an optional argument like ls.
o new "pipe" (|) command to pipe the message through an arbitrary command
o make header display format the same as SunOS 4.1.3 /usr/ucb/mail
o tilde commands work regardless of interactive mode.
o fix "read: Interrupted system call" error by retrying if EINTR
o expanded help file
Changes by me:
o read the help file via the PAGER as it is now more than 24 lines long
Diffstat (limited to 'usr.bin/mail/lex.c')
-rw-r--r-- | usr.bin/mail/lex.c | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/usr.bin/mail/lex.c b/usr.bin/mail/lex.c index b5e2c37278d..148f618d8b4 100644 --- a/usr.bin/mail/lex.c +++ b/usr.bin/mail/lex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lex.c,v 1.21 2000/07/06 06:24:21 deraadt Exp $ */ +/* $OpenBSD: lex.c,v 1.22 2001/01/16 05:36:08 millert Exp $ */ /* $NetBSD: lex.c,v 1.10 1997/05/17 19:55:13 pk Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)lex.c 8.2 (Berkeley) 4/20/95"; #else -static char rcsid[] = "$OpenBSD: lex.c,v 1.21 2000/07/06 06:24:21 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: lex.c,v 1.22 2001/01/16 05:36:08 millert Exp $"; #endif #endif /* not lint */ @@ -55,6 +55,8 @@ static char rcsid[] = "$OpenBSD: lex.c,v 1.21 2000/07/06 06:24:21 deraadt Exp $" char *prompt = "& "; +const struct cmd *com; /* command we are running */ + /* * Set up editing on the given file name. * If the first character of name is %, we are considered to be @@ -297,11 +299,12 @@ execute(linebuf, contxt) { char word[LINESIZE]; char *arglist[MAXARGC]; - const struct cmd *com = NULL; char *cp, *cp2; int c, muvec[2]; int e = 1; + com = NULL; + /* * Strip the white space away from the beginning * of the command, then scan out a word, which @@ -378,6 +381,53 @@ execute(linebuf, contxt) goto out; } switch (com->c_argtype & ~(F|P|I|M|T|W|R)) { + case MSGLIST|STRLIST: + /* + * A message list defaulting to nearest forward + * legal message. + */ + if (msgvec == 0) { + puts("Illegal use of \"message list\""); + break; + } + /* + * remove leading blanks. + */ + while (isspace(*cp)) + cp++; + + if (isdigit(*cp) || *cp == ':') { + if ((c = getmsglist(cp, msgvec, com->c_msgflag)) < 0) + break; + /* position to next space - past the message list */ + while (!isspace(*cp)) + cp++; + /* position to next non-space */ + while (isspace(*cp)) + cp++; + } else { + c = 0; /* no message list */ + } + + if (c == 0) { + *msgvec = first(com->c_msgflag, + com->c_msgmask); + msgvec[1] = NULL; + } + if (*msgvec == NULL) { + puts("No applicable messages"); + break; + } + /* + * Just the straight string, with + * leading blanks removed. + */ + while (isspace(*cp)) + cp++; + + e = (*com->c_func2)(msgvec, cp); + break; + case MSGLIST: /* * A message list defaulting to nearest forward @@ -614,7 +664,6 @@ announce() int vec[2], mdot; mdot = newfileinfo(0); - clearnew(); vec[0] = mdot; vec[1] = 0; dot = &message[mdot - 1]; |