/[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.1 by edhill, Tue Aug 26 20:45:25 2003 UTC revision 1.5 by jmc, Wed Mar 12 20:38:49 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    #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  {  {
# Line 64  int main(int argc, char **argv) Line 71  int main(int argc, char **argv)
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;
# Line 90  int main(int argc, char **argv) Line 97  int main(int argc, char **argv)
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    
# Line 155  int main(int argc, char **argv) Line 166  int main(int argc, char **argv)
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    
# Line 164  int main(int argc, char **argv) Line 175  int main(int argc, char **argv)
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);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.22