BSD 3 development
[unix-history] / .ref-BSD-2 / src / from.c
CommitLineData
ffcdbf5b
BJ
1/* Copyright (c) 1979 Regents of the University of California */
2#include <retrofit.h>
3#include <stdio.h>
4#include <pwd.h>
5
6struct passwd *getpwuid();
7
8main()
9{
10 char lbuf[BUFSIZ];
11 register struct passwd *pp;
12
13 if (chdir("/usr/spool/mail") < 0)
14 exit(1);
15 pp = getpwuid(getuid());
16 if (pp == 0) {
17 fprintf(stderr, "Who are you?\n");
18 exit(1);
19 }
20 if (freopen(pp->pw_name, "r", stdin) == NULL)
21 exit(0);
22 while(fgets(lbuf, sizeof lbuf, stdin) != NULL)
23 if (lbuf[0] == 'F' && lbuf[1] == 'r' && lbuf[2] == 'o' && lbuf[3] == 'm')
24 printf("%s", lbuf);
25 exit(0);
26}