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

Diff of /MITgcm/tools/mpack-1.6/decode.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.2 by jmc, Sat Feb 23 01:28:26 2008 UTC
# Line 26  Line 26 
26   * SOFTWARE.  */   * SOFTWARE.  */
27    
28  #include <stdio.h>  #include <stdio.h>
29    #include <stdlib.h>
30  #include <string.h>  #include <string.h>
31  #include <ctype.h>  #include <ctype.h>
32    #include <unistd.h>
33  #include "xmalloc.h"  #include "xmalloc.h"
34  #include "common.h"  #include "common.h"
35  #include "part.h"  #include "part.h"
# Line 37  extern char *os_idtodir(char *id); Line 39  extern char *os_idtodir(char *id);
39  extern FILE *os_newtypedfile(char *fname, char *contentType, int flags, params contentParams);  extern FILE *os_newtypedfile(char *fname, char *contentType, int flags, params contentParams);
40  extern FILE *os_createnewfile(char *fname);  extern FILE *os_createnewfile(char *fname);
41  extern char *md5contextTo64(MD5_CTX *context);  extern char *md5contextTo64(MD5_CTX *context);
42    extern void warn(char *s);
43    extern void os_perror(char *str);
44    extern void chat(char *s);
45    extern void os_donewithdir(char *dir);
46    extern void os_warnMD5mismatch(void);
47    extern void os_closetypedfile(FILE *outfile);
48    
49    extern int part_depth(struct part *part);
50    extern void part_ungets(char *s, struct part *part);
51    extern void part_close(struct part *part);
52    extern int part_fill(struct part *part);
53    extern void part_addboundary(struct part *part, char *boundary);
54    extern int part_readboundary(struct part *part);
55    
56  /* The possible content transfer encodings */  /* The possible content transfer encodings */
57  enum encoding { enc_none, enc_qp, enc_base64 };  enum encoding { enc_none, enc_qp, enc_base64 };
# Line 49  char *getDispositionFilename(char *dispo Line 64  char *getDispositionFilename(char *dispo
64  void from64(struct part *inpart, FILE *outfile, char **digestp, int suppressCR);  void from64(struct part *inpart, FILE *outfile, char **digestp, int suppressCR);
65  void fromqp(struct part *inpart, FILE *outfile, char **digestp);  void fromqp(struct part *inpart, FILE *outfile, char **digestp);
66  void fromnone(struct part *inpart, FILE *outfile, char **digestp);  void fromnone(struct part *inpart, FILE *outfile, char **digestp);
67    int handlePartial(struct part *inpart, char *headers, params contentParams,
68                      int extractText);
69    int ignoreMessage(struct part *inpart);
70    int handleMultipart(struct part *inpart, char *contentType,
71                        params contentParams, int extractText);
72    int handleUuencode(struct part *inpart, char *subject, int extractText);
73    int handleText(struct part *inpart, enum encoding contentEncoding);
74    int saveToFile(struct part *inpart, int inAppleDouble, char *contentType,
75                   params contentParams, enum encoding contentEncoding,
76                   char *contentDisposition, char *contentMD5);
77    
78  /*  /*
79   * Read and handle an RFC 822 message from the body-part 'inpart'.   * Read and handle an RFC 822 message from the body-part 'inpart'.
80   */   */
# Line 545  getDispositionFilename(char *disposition Line 571  getDispositionFilename(char *disposition
571          SkipWhitespace(&disposition);          SkipWhitespace(&disposition);
572          if (!disposition) return 0;          if (!disposition) return 0;
573    
574          /* If we're looking at a ";", we found what we're looking for */          /* If we're looking at a "=", we found what we're looking for */
575          if (*disposition++ == ';') break;          if (*disposition++ == '=') break;
576      }      }
577    
578      SkipWhitespace(&disposition);      SkipWhitespace(&disposition);
# Line 624  int handlePartial(struct part *inpart, c Line 650  int handlePartial(struct part *inpart, c
650      }      }
651      thispart = atoi(p);      thispart = atoi(p);
652    
653      if (p = getParam(contentParams, "total")) {      if ((p = getParam(contentParams, "total"))) {
654          nparts = atoi(p);          nparts = atoi(p);
655          if (nparts <= 0) {          if (nparts <= 0) {
656              warn("partial message has invalid number of parts");              warn("partial message has invalid number of parts");
# Line 643  int handlePartial(struct part *inpart, c Line 669  int handlePartial(struct part *inpart, c
669      else {      else {
670          /* Try to retrieve number of parts from reassembly directory */          /* Try to retrieve number of parts from reassembly directory */
671          sprintf(buf, "%sCT", dir);          sprintf(buf, "%sCT", dir);
672          if (partfile = fopen(buf, "r")) {          if ((partfile = fopen(buf, "r"))) {
673              if (fgets(buf, sizeof(buf), partfile)) {              if (fgets(buf, sizeof(buf), partfile)) {
674                  nparts = atoi(buf);                  nparts = atoi(buf);
675                  if (nparts < 0) nparts = 0;                  if (nparts < 0) nparts = 0;

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

  ViewVC Help
Powered by ViewVC 1.1.22