Deleted Added
full compact
from.c (1591) from.c (13678)
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>
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>
48#include <paths.h>
49
50main(argc, argv)
51 int argc;
52 char **argv;
53{
54 extern char *optarg;
55 extern int optind;
56 struct passwd *pwd;
57 int ch, newline;
58 char *file, *sender, *p;
59#if MAXPATHLEN > BUFSIZ
60 char buf[MAXPATHLEN];
61#else
62 char buf[BUFSIZ];
63#endif
64
65 file = sender = NULL;
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;
66 while ((ch = getopt(argc, argv, "f:s:")) != EOF)
67 while ((ch = getopt(argc, argv, "f:s:?")) != EOF)
67 switch((char)ch) {
68 case 'f':
69 file = optarg;
70 break;
71 case 's':
72 sender = optarg;
73 for (p = sender; *p; ++p)
74 if (isupper(*p))

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

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

--- 32 unchanged lines hidden ---
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 ---