23 |
* SOFTWARE. |
* SOFTWARE. |
24 |
*/ |
*/ |
25 |
#include <stdio.h> |
#include <stdio.h> |
26 |
|
#include <stdlib.h> |
27 |
#include <string.h> |
#include <string.h> |
28 |
#include <errno.h> |
#include <errno.h> |
29 |
|
#include <getopt.h> |
30 |
|
#include <sys/types.h> |
31 |
|
#include <sys/wait.h> |
32 |
|
#include <unistd.h> |
33 |
#include "common.h" |
#include "common.h" |
34 |
#include "version.h" |
#include "version.h" |
35 |
#include "xmalloc.h" |
#include "xmalloc.h" |
36 |
|
|
37 |
#define MAXADDRESS 100 |
#define MAXADDRESS 100 |
38 |
|
|
39 |
extern char *getenv(); |
extern int attachment; |
|
|
|
|
extern int errno; |
|
|
extern int optind; |
|
|
extern char *optarg; |
|
40 |
|
|
41 |
void usage(void); |
void usage(void); |
42 |
void sendmail(FILE *infile, char **addr, int start); |
void sendmail(FILE *infile, char **addr, int start); |
43 |
void inews(FILE *infile); |
void inews(FILE *infile); |
44 |
|
void os_perror(char *str); |
45 |
|
int encode(FILE *infile, FILE *applefile, char *fname, FILE *descfile, |
46 |
|
char *subject, char *headers, long int maxsize, |
47 |
|
char *typeoverride, char *outfname); |
48 |
|
|
49 |
int main(int argc, char **argv) |
int main(int argc, char **argv) |
50 |
{ |
{ |
69 |
maxsize = atoi(p); |
maxsize = atoi(p); |
70 |
} |
} |
71 |
|
|
72 |
while ((opt = getopt(argc, argv, "s:d:m:c:o:n:")) != EOF) { |
while ((opt = getopt(argc, argv, "as:d:m:c:o:n:")) != EOF) { |
73 |
switch (opt) { |
switch (opt) { |
74 |
case 's': |
case 's': |
75 |
subject = optarg; |
subject = optarg; |
95 |
newsgroups = optarg; |
newsgroups = optarg; |
96 |
break; |
break; |
97 |
|
|
98 |
|
case 'a': |
99 |
|
attachment = 1; |
100 |
|
break; |
101 |
|
|
102 |
default: |
default: |
103 |
usage(); |
usage(); |
104 |
|
|
164 |
fprintf(stderr, "A subject is required\n"); |
fprintf(stderr, "A subject is required\n"); |
165 |
usage(); |
usage(); |
166 |
} |
} |
167 |
if (p = strchr(sbuf, '\n')) *p = '\0'; |
if ((p = strchr(sbuf, '\n'))) *p = '\0'; |
168 |
subject = sbuf; |
subject = sbuf; |
169 |
} |
} |
170 |
|
|
173 |
strcpy(fnamebuf, getenv("TMPDIR")); |
strcpy(fnamebuf, getenv("TMPDIR")); |
174 |
} |
} |
175 |
else { |
else { |
176 |
strcpy(fnamebuf, "/usr/tmp"); |
strcpy(fnamebuf, "/var/tmp"); |
177 |
} |
} |
178 |
strcat(fnamebuf, "/mpackXXXXXX"); |
strcat(fnamebuf, "/mpackXXXXXX"); |
179 |
mktemp(fnamebuf); |
mktemp(fnamebuf); |