* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
static char sccsid
[] = "@(#)from.c 5.2 (Berkeley) %G%";
struct passwd
*getpwuid();
register struct passwd
*pp
;
if (argc
> 1 && *(argv
[1]) == '-' && (*++argv
)[1] == 's') {
fprintf (stderr
, "Usage: from [-s sender] [user]\n");
for (name
= sender
; *name
; name
++)
if (chdir("/usr/spool/mail") < 0)
if (name
== NULL
|| strlen(name
) == 0) {
fprintf(stderr
, "Who are you?\n");
if (freopen(name
, "r", stdin
) == NULL
) {
fprintf(stderr
, "Can't open /usr/spool/mail/%s\n", name
);
while (fgets(lbuf
, sizeof lbuf
, stdin
) != NULL
)
if (lbuf
[0] == '\n' && stashed
) {
} else if (strncmp(lbuf
, "From ", 5) == 0 &&
(sender
== NULL
|| match(&lbuf
[4], sender
))) {
register char *line
, *str
;
while (*line
== ' ' || *line
== '\t')
while (*str
&& *line
!= ' ' && *line
!= '\t' && *line
!= '\n') {
ch
= isupper(*line
) ? tolower(*line
) : *line
;