version 1.8, 1997/08/04 17:30:22 |
version 1.9, 1997/11/14 00:23:49 |
|
|
#include <ctype.h> |
#include <ctype.h> |
#include "extern.h" |
#include "extern.h" |
|
|
|
int matchto __P((char *, int)); |
|
|
/* |
/* |
* Mail -- a mail program |
* Mail -- a mail program |
* |
* |
|
|
char *buf; |
char *buf; |
int *vector, flags; |
int *vector, flags; |
{ |
{ |
register int *ip; |
int *ip; |
register struct message *mp; |
struct message *mp; |
|
|
if (msgCount == 0) { |
if (msgCount == 0) { |
*vector = 0; |
*vector = 0; |
|
|
char buf[]; |
char buf[]; |
int f; |
int f; |
{ |
{ |
register char **np; |
char **np; |
register int i; |
int i; |
register struct message *mp; |
struct message *mp; |
char *namelist[NMLSIZE], *bufp; |
char *namelist[NMLSIZE], *bufp; |
int tok, beg, mc, star, other, valdot, colmod, colresult; |
int tok, beg, mc, star, other, valdot, colmod, colresult; |
|
|
|
|
|
|
if (colmod != 0) { |
if (colmod != 0) { |
for (i = 1; i <= msgCount; i++) { |
for (i = 1; i <= msgCount; i++) { |
register struct coltab *colp; |
struct coltab *colp; |
|
|
mp = &message[i - 1]; |
mp = &message[i - 1]; |
for (colp = &coltab[0]; colp->co_char; colp++) |
for (colp = &coltab[0]; colp->co_char; colp++) |
|
|
if (mp->m_flag & MMARK) |
if (mp->m_flag & MMARK) |
break; |
break; |
if (mp >= &message[msgCount]) { |
if (mp >= &message[msgCount]) { |
register struct coltab *colp; |
struct coltab *colp; |
|
|
fputs("No messages satisfy", stdout); |
fputs("No messages satisfy", stdout); |
for (colp = &coltab[0]; colp->co_char; colp++) |
for (colp = &coltab[0]; colp->co_char; colp++) |
|
|
evalcol(col) |
evalcol(col) |
int col; |
int col; |
{ |
{ |
register struct coltab *colp; |
struct coltab *colp; |
|
|
if (col == 0) |
if (col == 0) |
return(lastcolmod); |
return(lastcolmod); |
|
|
check(mesg, f) |
check(mesg, f) |
int mesg, f; |
int mesg, f; |
{ |
{ |
register struct message *mp; |
struct message *mp; |
|
|
if (mesg < 1 || mesg > msgCount) { |
if (mesg < 1 || mesg > msgCount) { |
printf("%d: Invalid message number\n", mesg); |
printf("%d: Invalid message number\n", mesg); |
|
|
char **argv; |
char **argv; |
int argc; |
int argc; |
{ |
{ |
register char c, *cp, *cp2, quotec; |
char c, *cp, *cp2, quotec; |
int argn; |
int argn; |
char *linebuf; |
char *linebuf; |
size_t linebufsize = BUFSIZ; |
size_t linebufsize = BUFSIZ; |
|
|
if ((linebuf = (char *)malloc(linebufsize)) == NULL) |
if ((linebuf = (char *)malloc(linebufsize)) == NULL) |
panic("Out of memory"); |
errx(1, "Out of memory"); |
|
|
argn = 0; |
argn = 0; |
cp = line; |
cp = line; |
|
|
linebufsize += BUFSIZ; |
linebufsize += BUFSIZ; |
linebuf = (char *)realloc(linebuf, linebufsize); |
linebuf = (char *)realloc(linebuf, linebufsize); |
if (linebuf == NULL) |
if (linebuf == NULL) |
panic("Out of memory"); |
errx(1, "Out of memory"); |
cp2 = linebuf + linebufsize - BUFSIZ - 1; |
cp2 = linebuf + linebufsize - BUFSIZ - 1; |
} |
} |
cp++; |
cp++; |
|
|
scan(sp) |
scan(sp) |
char **sp; |
char **sp; |
{ |
{ |
register char *cp, *cp2; |
char *cp, *cp2; |
register int c; |
int c; |
register struct lex *lp; |
struct lex *lp; |
int quotec; |
int quotec; |
|
|
if (regretp >= 0) { |
if (regretp >= 0) { |
|
|
int token; |
int token; |
{ |
{ |
if (++regretp >= REGDEP) |
if (++regretp >= REGDEP) |
panic("Too many regrets"); |
errx(1, "Too many regrets"); |
regretstack[regretp] = token; |
regretstack[regretp] = token; |
lexstring[STRINGLEN-1] = '\0'; |
lexstring[STRINGLEN-1] = '\0'; |
string_stack[regretp] = savestr(lexstring); |
string_stack[regretp] = savestr(lexstring); |
|
|
first(f, m) |
first(f, m) |
int f, m; |
int f, m; |
{ |
{ |
register struct message *mp; |
struct message *mp; |
|
|
if (msgCount == 0) |
if (msgCount == 0) |
return(0); |
return(0); |
|
|
char *str; |
char *str; |
int mesg; |
int mesg; |
{ |
{ |
register char *cp, *cp2, *backup; |
char *cp, *cp2, *backup; |
|
|
if (!*str) /* null string matches nothing instead of everything */ |
if (!*str) /* null string matches nothing instead of everything */ |
return(0); |
return(0); |
|
|
matchto(str, mesg) |
matchto(str, mesg) |
char *str; |
char *str; |
{ |
{ |
register struct message *mp; |
struct message *mp; |
register char *cp, *cp2, *backup, **to; |
char *cp, *cp2, *backup, **to; |
|
|
str++; |
str++; |
|
|
|
|
char *str; |
char *str; |
int mesg; |
int mesg; |
{ |
{ |
register struct message *mp; |
struct message *mp; |
register char *cp, *cp2, *backup; |
char *cp, *cp2, *backup; |
|
|
str++; |
str++; |
if (*str == '\0') |
if (*str == '\0') |
|
|
mark(mesg) |
mark(mesg) |
int mesg; |
int mesg; |
{ |
{ |
register int i; |
int i; |
|
|
i = mesg; |
i = mesg; |
if (i < 1 || i > msgCount) |
if (i < 1 || i > msgCount) |
panic("Bad message number to mark"); |
errx(1, "Bad message number to mark"); |
message[i-1].m_flag |= MMARK; |
message[i-1].m_flag |= MMARK; |
} |
} |
|
|
|
|
unmark(mesg) |
unmark(mesg) |
int mesg; |
int mesg; |
{ |
{ |
register int i; |
int i; |
|
|
i = mesg; |
i = mesg; |
if (i < 1 || i > msgCount) |
if (i < 1 || i > msgCount) |
panic("Bad message number to unmark"); |
errx(1, "Bad message number to unmark"); |
message[i-1].m_flag &= ~MMARK; |
message[i-1].m_flag &= ~MMARK; |
} |
} |
|
|
|
|
metamess(meta, f) |
metamess(meta, f) |
int meta, f; |
int meta, f; |
{ |
{ |
register int c, m; |
int c, m; |
register struct message *mp; |
struct message *mp; |
|
|
c = meta; |
c = meta; |
switch (c) { |
switch (c) { |