* Copyright (c) 1980, 1988 The Regents of the University of California.
* %sccs.include.redist.c%
"@(#) Copyright (c) 1980, 1988 The Regents of the University of California.\n\
static char sccsid
[] = "@(#)from.c 5.6 (Berkeley) %G%";
struct passwd
*pwd
, *getpwuid();
while ((ch
= getopt(argc
, argv
, "f:s:")) != EOF
)
for (p
= sender
; *p
; ++p
)
fprintf(stderr
, "usage: from [-f file] [-s sender] [user]\n");
if (!(pwd
= getpwuid(getuid()))) {
"from: no password file entry for you.\n");
(void)sprintf(buf
, "%s/%s", _PATH_MAILDIR
, file
);
if (!freopen(file
, "r", stdin
)) {
fprintf(stderr
, "from: can't read %s.\n", file
);
for (newline
= 1; fgets(buf
, sizeof(buf
), stdin
);) {
if (newline
&& !strncmp(buf
, "From ", 5) &&
(!sender
|| match(buf
+ 5, sender
)))
register char *line
, *sender
;
register char ch
, pch
, first
, *p
, *t
;
for (first
= *sender
++;;) {
for (p
= sender
, t
= line
;;) {