| 1 | #include <stdio.h> |
| 2 | #include <pwd.h> |
| 3 | |
| 4 | struct passwd *getpwuid(); |
| 5 | |
| 6 | main() |
| 7 | { |
| 8 | char lbuf[BUFSIZ]; |
| 9 | register struct passwd *pp; |
| 10 | |
| 11 | if (chdir("/usr/spool/mail") < 0) |
| 12 | exit(1); |
| 13 | pp = getpwuid(getuid()); |
| 14 | if (pp == 0) { |
| 15 | fprintf(stderr, "Who are you?\n"); |
| 16 | exit(1); |
| 17 | } |
| 18 | if (freopen(pp->pw_name, "r", stdin) == NULL) |
| 19 | exit(0); |
| 20 | while(fgets(lbuf, sizeof lbuf, stdin) != NULL) |
| 21 | if (lbuf[0] == 'F' && lbuf[1] == 'r' && lbuf[2] == 'o' && lbuf[3] == 'm') |
| 22 | printf("%s", lbuf); |
| 23 | exit(0); |
| 24 | } |