diff --git a/usr.bin/mail/lex.c b/usr.bin/mail/lex.c index 3428203b14e7..2c7cb3e59cd0 100644 --- a/usr.bin/mail/lex.c +++ b/usr.bin/mail/lex.c @@ -458,6 +458,17 @@ lex(word) register struct cmd *cp; extern struct cmd cmdtab[]; + /* + * ignore trailing chars after `#' + * + * lines with beginning `#' are comments + * spaces befor `#' are ignored in execute() + */ + + if (*word == '#') + *(word+1) = '\0'; + + for (cp = &cmdtab[0]; cp->c_name != NOSTR; cp++) if (isprefix(word, cp->c_name)) return(cp); diff --git a/usr.bin/mail/mail.1 b/usr.bin/mail/mail.1 index ecf586887867..376af05cebcf 100644 --- a/usr.bin/mail/mail.1 +++ b/usr.bin/mail/mail.1 @@ -308,6 +308,8 @@ argument goes to the .Ar n Ns 'th previous message and prints it. +.It Ic \&# +ignore the remainder of the line as a comment. .It Ic \&? Prints a brief summary of commands. .It Ic \&!