23 |
* SOFTWARE. |
* SOFTWARE. |
24 |
*/ |
*/ |
25 |
#include <stdio.h> |
#include <stdio.h> |
|
#include <stdlib.h> |
|
26 |
#include <string.h> |
#include <string.h> |
27 |
#include <errno.h> |
#include <errno.h> |
|
#include <getopt.h> |
|
|
#include <sys/types.h> |
|
|
#include <sys/wait.h> |
|
|
#include <unistd.h> |
|
28 |
#include "common.h" |
#include "common.h" |
29 |
#include "version.h" |
#include "version.h" |
30 |
#include "xmalloc.h" |
#include "xmalloc.h" |
31 |
|
|
32 |
#define MAXADDRESS 100 |
#define MAXADDRESS 100 |
33 |
|
|
34 |
extern int attachment; |
extern char *getenv(); |
35 |
|
|
36 |
|
extern int errno; |
37 |
|
extern int optind; |
38 |
|
extern char *optarg; |
39 |
|
|
40 |
void usage(void); |
void usage(void); |
41 |
void sendmail(FILE *infile, char **addr, int start); |
void sendmail(FILE *infile, char **addr, int start); |
42 |
void inews(FILE *infile); |
void inews(FILE *infile); |
|
void os_perror(char *str); |
|
|
int encode(FILE *infile, FILE *applefile, char *fname, FILE *descfile, |
|
|
char *subject, char *headers, long int maxsize, |
|
|
char *typeoverride, char *outfname); |
|
43 |
|
|
44 |
int main(int argc, char **argv) |
int main(int argc, char **argv) |
45 |
{ |
{ |
64 |
maxsize = atoi(p); |
maxsize = atoi(p); |
65 |
} |
} |
66 |
|
|
67 |
while ((opt = getopt(argc, argv, "as:d:m:c:o:n:")) != EOF) { |
while ((opt = getopt(argc, argv, "s:d:m:c:o:n:")) != EOF) { |
68 |
switch (opt) { |
switch (opt) { |
69 |
case 's': |
case 's': |
70 |
subject = optarg; |
subject = optarg; |
90 |
newsgroups = optarg; |
newsgroups = optarg; |
91 |
break; |
break; |
92 |
|
|
|
case 'a': |
|
|
attachment = 1; |
|
|
break; |
|
|
|
|
93 |
default: |
default: |
94 |
usage(); |
usage(); |
95 |
|
|
155 |
fprintf(stderr, "A subject is required\n"); |
fprintf(stderr, "A subject is required\n"); |
156 |
usage(); |
usage(); |
157 |
} |
} |
158 |
if ((p = strchr(sbuf, '\n'))) *p = '\0'; |
if (p = strchr(sbuf, '\n')) *p = '\0'; |
159 |
subject = sbuf; |
subject = sbuf; |
160 |
} |
} |
161 |
|
|
164 |
strcpy(fnamebuf, getenv("TMPDIR")); |
strcpy(fnamebuf, getenv("TMPDIR")); |
165 |
} |
} |
166 |
else { |
else { |
167 |
strcpy(fnamebuf, "/var/tmp"); |
strcpy(fnamebuf, "/usr/tmp"); |
168 |
} |
} |
169 |
strcat(fnamebuf, "/mpackXXXXXX"); |
strcat(fnamebuf, "/mpackXXXXXX"); |
170 |
mktemp(fnamebuf); |
mktemp(fnamebuf); |