|
|
1.1 root 1: alias(pargc, argv)
2: int *pargc;
3: char **argv;
4: v_search(user)
5: char *user;
6: h_search(head, str)
7: node *head;
8: char *str;
9: load_alias(head, filename)
10: node *head;
11: char *filename;
12: ** add each word in a string (*p) of recipients
13: ** to the (horizontal) linked list associated with 'h'
14: */
15:
16: recipients(h, p)
17: node *h;
18: char *p;
19: ** strip out the stuff in ()'s
20: **
21: */
22:
23: void
24: strip_comments(p)
25: char *p;
26: add_vert(head, str)
27: node *head;
28: char *str;
29: add_horz(head, str)
30: node *head;
31: char *str;
32: pop(head)
33: node *head;
34: ** at a time (e.g., 4.1 /bin/mail). To disable the batching, set MAXCLEN
35: ** a small value (like 0).
36: */
37:
38: #define MAXCLEN 512 /* longest command allowed (approx.)
39: /* this is to keep other's buffers
40: ** from overflowing
41: */
42:
43: /* GATEWAY_NAME should only be used on gateway machines into the .ATT.COM
44: ** domain. Since mail will appear to come from att.ATT.COM, there is no
45: ** way of knowing WHICH gateway it came from. deliver.c was changed
46: ** such that the GATEWAY_NAME was placed in the headers in a non-dangerous
47: ** place so that it could be determined which gateway was used.
48: ** If smail is not being run on a gateway, don't use this definition,
49: **
50: ** T. G. Thompson Thu Apr 7 13:47:36 EDT 1988
51: */
52: /* #define GATEWAY_NAME "att-ih" /* gateway name other than "att" */
53:
54:
55:
56: /*
57: ** PLEASE DON'T TOUCH THE REST
58: */
59:
60: #define SMLBUF 512 /* small buffer (handle one item) */
61: #define BIGBUF 4096 /* handle lots of items */
62:
63: #define MAXPATH 32 /* number of elements in ! path */
64: #define MAXDOMS 16 /* number of subdomains in . domain */
65: #define MAXARGS 500 /* number of arguments */
66: #define WS " \t" /* white space for paths file */
67: #ifndef NULL
68: #define NULL 0
69: #endif
70:
71: #define DEBUG if (debug==YES) (void) printf
72: #define ADVISE if (debug!=NO) (void) printf
73: #define error(stat,msg,a) { (void) fprintf(stderr, msg, a); exit(stat); }
74: #define lower(c) ( isupper(c) ? c-'A'+'a' : c )
75:
76:
77: enum eform { /* format of addresses */
78: ERROR, /* bad or invalidated format */
79: LOCAL, /* just a local name */
80: DOMAIN, /* user@domain or domain!user */
81: UUCP, /* host!address */
82: ROUTE, /* intermediate form - to be routed */
83: SENT /* sent to a mailer on a previous pass */
84: };
85:
86: enum ehandle { /* what addresses can we handle? (don't kick to LMAIL) */
87: ALL, /* UUCP and DOMAIN addresses */
88: JUSTUUCP, /* UUCP only; set by -l */
89: NONE /* all mail is LOCAL; set by -L */
90: };
91:
92: enum erouting { /* when to route A!B!C!D */
93: JUSTDOMAIN, /* route A if A is a domain */
94: ALWAYS, /* route A always; set by -r */
95: REROUTE /* route C, B, or A (whichever works); set by -R */
96: };
97:
98: enum edebug { /* debug modes */
99: NO, /* normal deliver */
100: VERBOSE, /* talk alot */
101: YES /* talk and don't deliver */
102: };
103:
104: #ifdef BSD
105:
106: #include <strings.h>
107: #include <sysexits.h>
108:
109: #else
110:
111: #include <string.h>
112: #include "sysexits.h"
113: #define index strchr
114: #define rindex strrchr
115:
116: #endif
117: extern void exit(), perror();
118: extern unsigned sleep();
119: ** deliver(): hand the letter to the proper mail programs.
120: **
121: ** Issues one command for each different host of <hostv>,
122: ** constructing the proper command for LOCAL or UUCP mail.
123: ** Note that LOCAL mail has blank host names.
124: **
125: ** The <userv> names for each host are arguments to the command.
126: **
127: ** Prepends a "From" line to the letter just before going
128: ** out, with a "remote from <hostname>" if it is a UUCP letter.
129: **
130: */
131:
132: deliver(argc, hostv, userv, formv, costv)
133: int argc; /* number of addresses */
134: char *hostv[]; /* host names */
135: char *userv[]; /* user names */
136: enum eform formv[]; /* form for each address */
137: int costv[]; /* cost vector */
138: return_mail(from, fcommand, form)
139: char *from, *fcommand;
140: enum eform form;
141: int gethostname(name, bufsize)
142: unsigned char *name;
143: int bufsize;
144: int getdomain(name, bufsize)
145: unsigned char *name;
146: int bufsize;
147: getopt(argc, argv, opts)
148: int argc;
149: char **argv, *opts;
150: ** getpath(): look up key in ascii sorted path database.
151: **
152: */
153:
154: getpath( key, path , cost)
155: char *key; /* what we are looking for */
156: char *path; /* where the path results go */
157: int *cost; /* where the cost results go */
158: ** parse(): parse <address> into <domain, user, form>.
159: **
160: ** input form
161: ** ----- ----
162: ** user LOCAL
163: ** domain!user DOMAIN
164: ** user@domain DOMAIN
165: ** @domain,address LOCAL (just for sendmail)
166: ** host!address UUCP
167: **
168: */
169:
170: enum eform
171: parse(address, domain, user)
172: char *address; /* input address */
173: char *domain; /* output domain */
174: char *user; /* output user */
175: build(domain, user, form, result)
176: char *domai
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.