/[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.2 by jmc, Sat Feb 23 01:28:27 2008 UTC revision 1.3 by jmc, Sat Feb 23 03:30:03 2008 UTC
# Line 23  Line 23 
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  {  {
# Line 69  int main(int argc, char **argv) Line 64  int main(int argc, char **argv)
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;
# Line 95  int main(int argc, char **argv) Line 90  int main(int argc, char **argv)
90              newsgroups = optarg;              newsgroups = optarg;
91              break;              break;
92    
         case 'a':  
             attachment = 1;  
             break;  
   
93          default:          default:
94              usage();              usage();
95    
# Line 164  int main(int argc, char **argv) Line 155  int main(int argc, char **argv)
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    
# Line 173  int main(int argc, char **argv) Line 164  int main(int argc, char **argv)
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);

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

  ViewVC Help
Powered by ViewVC 1.1.22