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 |
|
#ifdef HAVE_GETOPT_H |
30 |
|
#include <getopt.h> |
31 |
|
#endif |
32 |
|
#include <sys/types.h> |
33 |
|
#include <sys/wait.h> |
34 |
|
#include <unistd.h> |
35 |
#include "common.h" |
#include "common.h" |
36 |
#include "version.h" |
#include "version.h" |
37 |
#include "xmalloc.h" |
#include "xmalloc.h" |
38 |
|
|
39 |
#define MAXADDRESS 100 |
#define MAXADDRESS 100 |
40 |
|
|
41 |
extern char *getenv(); |
extern int attachment; |
|
|
|
|
extern int errno; |
|
|
extern int optind; |
|
|
extern char *optarg; |
|
42 |
|
|
43 |
void usage(void); |
void usage(void); |
44 |
void sendmail(FILE *infile, char **addr, int start); |
void sendmail(FILE *infile, char **addr, int start); |
45 |
void inews(FILE *infile); |
void inews(FILE *infile); |
46 |
|
void os_perror(char *str); |
47 |
|
int encode(FILE *infile, FILE *applefile, char *fname, FILE *descfile, |
48 |
|
char *subject, char *headers, long int maxsize, |
49 |
|
char *typeoverride, char *outfname); |
50 |
|
|
51 |
int main(int argc, char **argv) |
int main(int argc, char **argv) |
52 |
{ |
{ |
71 |
maxsize = atoi(p); |
maxsize = atoi(p); |
72 |
} |
} |
73 |
|
|
74 |
while ((opt = getopt(argc, argv, "s:d:m:c:o:n:")) != EOF) { |
while ((opt = getopt(argc, argv, "as:d:m:c:o:n:")) != EOF) { |
75 |
switch (opt) { |
switch (opt) { |
76 |
case 's': |
case 's': |
77 |
subject = optarg; |
subject = optarg; |
97 |
newsgroups = optarg; |
newsgroups = optarg; |
98 |
break; |
break; |
99 |
|
|
100 |
|
case 'a': |
101 |
|
attachment = 1; |
102 |
|
break; |
103 |
|
|
104 |
default: |
default: |
105 |
usage(); |
usage(); |
106 |
|
|
166 |
fprintf(stderr, "A subject is required\n"); |
fprintf(stderr, "A subject is required\n"); |
167 |
usage(); |
usage(); |
168 |
} |
} |
169 |
if (p = strchr(sbuf, '\n')) *p = '\0'; |
if ((p = strchr(sbuf, '\n'))) *p = '\0'; |
170 |
subject = sbuf; |
subject = sbuf; |
171 |
} |
} |
172 |
|
|
175 |
strcpy(fnamebuf, getenv("TMPDIR")); |
strcpy(fnamebuf, getenv("TMPDIR")); |
176 |
} |
} |
177 |
else { |
else { |
178 |
strcpy(fnamebuf, "/usr/tmp"); |
strcpy(fnamebuf, "/var/tmp"); |
179 |
} |
} |
180 |
strcat(fnamebuf, "/mpackXXXXXX"); |
strcat(fnamebuf, "/mpackXXXXXX"); |
181 |
mktemp(fnamebuf); |
mktemp(fnamebuf); |