/[MITgcm]/MITgcm/tools/mpack-1.6/unixpk.c
ViewVC logotype

Diff of /MITgcm/tools/mpack-1.6/unixpk.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3 by jmc, Sat Feb 23 03:30:03 2008 UTC revision 1.4 by jmc, Tue Feb 26 17:05:00 2008 UTC
# Line 23  Line 23 
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  {  {
# Line 64  int main(int argc, char **argv) Line 69  int main(int argc, char **argv)
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;
# Line 90  int main(int argc, char **argv) Line 95  int main(int argc, char **argv)
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    
# Line 155  int main(int argc, char **argv) Line 164  int main(int argc, char **argv)
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    
# Line 164  int main(int argc, char **argv) Line 173  int main(int argc, char **argv)
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);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.22