1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-26 11:47:31 +00:00

*** empty log message ***

This commit is contained in:
Brian Feldman 1999-07-26 23:12:12 +00:00
parent 73fac075b2
commit 82753326e8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=49123
2 changed files with 22 additions and 8 deletions

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)from.1 8.2 (Berkeley) 12/30/93
.\" $Id$
.\" $Id: from.1,v 1.4 1999/07/12 20:23:30 nik Exp $
.\"
.Dd December 30, 1993
.Dt FROM 1
@ -40,6 +40,7 @@
.Nd print names of those who have sent mail
.Sh SYNOPSIS
.Nm from
.Op Fl c
.Op Fl s Ar sender
.Op Fl f Ar file
.Op Ar user
@ -50,6 +51,8 @@ out the mail header lines from the invoker's mailbox.
.Pp
Options:
.Bl -tag -width Fl
.It Fl c
Just print a count of messages and exit.
.It Fl f Ar file
The supplied file
is examined instead of the invoker's mailbox.

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)from.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
"$Id: from.c,v 1.5 1997/07/08 10:59:50 charnier Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -66,7 +66,7 @@ main(argc, argv)
extern char *optarg;
extern int optind;
struct passwd *pwd;
int ch, newline;
int ch, count, newline;
char *file, *sender, *p;
#if MAXPATHLEN > BUFSIZ
char buf[MAXPATHLEN];
@ -75,8 +75,12 @@ main(argc, argv)
#endif
file = sender = NULL;
while ((ch = getopt(argc, argv, "f:s:")) != -1)
switch((char)ch) {
count = -1;
while ((ch = getopt(argc, argv, "cf:s:")) != -1)
switch (ch) {
case 'c':
count = 0;
break;
case 'f':
file = optarg;
break;
@ -120,17 +124,24 @@ main(argc, argv)
continue;
}
if (newline && !strncmp(buf, "From ", 5) &&
(!sender || match(buf + 5, sender)))
printf("%s", buf);
(!sender || match(buf + 5, sender))) {
if (count != -1)
count++;
else
printf("%s", buf);
}
newline = 0;
}
if (count != -1)
printf("There %s %d message%s in your incoming mailbox.\n",
count == 1 ? "is" : "are", count, count == 1 ? "" : "s");
exit(0);
}
static void
usage()
{
fprintf(stderr, "usage: from [-f file] [-s sender] [user]\n");
fprintf(stderr, "usage: from [-c] [-f file] [-s sender] [user]\n");
exit(1);
}