'#' is not a comment if a non-space char follow

Closes PR # bin/657: mail(1): comments in ~/.ma...

Submitted by:	wosch@cs.tu-berlin.de (Wolfram Schneider)
This commit is contained in:
Joerg Wunsch 1995-08-15 19:40:26 +00:00
parent 665994990b
commit b5cfa4b2c4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=10067
2 changed files with 13 additions and 0 deletions

View File

@ -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);

View File

@ -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 \&!