Deleted Added
sdiff udiff text old ( 1591 ) new ( 13678 )
full compact
1/*
2 * Copyright (c) 1980, 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 31 unchanged lines hidden (view full) ---

40#ifndef lint
41static char sccsid[] = "@(#)from.c 8.1 (Berkeley) 6/6/93";
42#endif /* not lint */
43
44#include <sys/types.h>
45#include <ctype.h>
46#include <pwd.h>
47#include <stdio.h>
48#include <string.h>
49#include <paths.h>
50
51main(argc, argv)
52 int argc;
53 char **argv;
54{
55 extern char *optarg;
56 extern int optind;
57 struct passwd *pwd;
58 int ch, newline;
59 char *file, *sender, *p;
60#if MAXPATHLEN > BUFSIZ
61 char buf[MAXPATHLEN];
62#else
63 char buf[BUFSIZ];
64#endif
65
66 file = sender = NULL;
67 while ((ch = getopt(argc, argv, "f:s:?")) != EOF)
68 switch((char)ch) {
69 case 'f':
70 file = optarg;
71 break;
72 case 's':
73 sender = optarg;
74 for (p = sender; *p; ++p)
75 if (isupper(*p))

--- 13 unchanged lines hidden (view full) ---

89 "from: no password file entry for you.\n");
90 exit(1);
91 }
92 file = pwd->pw_name;
93 }
94 (void)sprintf(buf, "%s/%s", _PATH_MAILDIR, file);
95 file = buf;
96 }
97
98 /* read from stdin */
99 if (strcmp(file, "-") == 0) {
100 }
101 else if (!freopen(file, "r", stdin)) {
102 fprintf(stderr, "from: can't read %s.\n", file);
103 exit(1);
104 }
105 for (newline = 1; fgets(buf, sizeof(buf), stdin);) {
106 if (*buf == '\n') {
107 newline = 1;
108 continue;
109 }

--- 32 unchanged lines hidden ---