|
|
1.1 root 1: #include <stdio.h>
2: #include "mail.h"
3: #include "string.h"
4: #include "dest.h"
5: #include "aux.h"
6: #include "process.h"
7:
8: /* pipe an address through a command to translate it */
9: extern dest *
10: translate(dp)
11: dest *dp;
12: {
13: process *pp;
14: string *line;
15: dest *rv=NULL;
16:
17: pp = proc_start(s_to_c(dp->repl1), (stream *)NULL, outstream(),
18: outstream(), -1);
19: if (pp == NULL) {
20: dp->status = d_resource;
21: return NULL;
22: }
23: line = s_new();
24: while (s_read_line(pp->std[1]->fp, line) != NULL)
25: ;
26: rv = s_to_dest(s_restart(line), dp);
27: s_restart(line);
28: while (s_read_line(pp->std[2]->fp, line) != NULL)
29: ;
30: if ((dp->pstat = proc_wait(pp)) != 0) {
31: dp->repl2 = line;
32: rv = NULL;
33: } else
34: s_free(line);
35: proc_free(pp);
36: return rv;
37: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.