aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/upas/misc/mail.c
blob: 20cf239706faa1ceb05f4db5d9b1220c5412f6cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * #!/bin/sh
 * case $1 in
 * -n)
 * 	exit 0 ;;
 * -m*|-f*|-r*|-p*|-e*|"")
 * 	exec /usr/lib/upas/edmail $*
 * 	exit $? ;;
 * *)
 * 	exec /usr/lib/upas/send $*
 * 	exit $? ;;
 * esac
 */


extern *UPASROOT;

#define	EDMAIL	"edmail"
#define	SEND	"send"

main (argc, argv)
	int argc;
	char **argv;
{
	char *progname = SEND;
	char realprog[500];

	if (argc > 1) {
		if (argv[1][0] == '-') {
			switch (argv[1][1]) {
			case 'n':
				exit (0);

			case 'm':
			case 'f':
			case 'r':
			case 'p':
			case 'e':
			case '\0':
				progname = EDMAIL;
			}
		}
	} else
		progname = EDMAIL;

	sprint(realprog, "%s/%s", UPASROOT, progname);
	execv (realprog, argv);
	perror (realprog);
	exit (1);
}