/[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.2 by jmc, Sat Feb 23 01:28:26 2008 UTC revision 1.3 by jmc, Sat Feb 23 03:30:03 2008 UTC
# Line 26  Line 26 
26   * SOFTWARE.  */   * SOFTWARE.  */
27    
28  #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  
29  #include <string.h>  #include <string.h>
30  #include <ctype.h>  #include <ctype.h>
 #include <unistd.h>  
31  #include "xmalloc.h"  #include "xmalloc.h"
32  #include "common.h"  #include "common.h"
33  #include "part.h"  #include "part.h"
# Line 39  extern char *os_idtodir(char *id); Line 37  extern char *os_idtodir(char *id);
37  extern FILE *os_newtypedfile(char *fname, char *contentType, int flags, params contentParams);  extern FILE *os_newtypedfile(char *fname, char *contentType, int flags, params contentParams);
38  extern FILE *os_createnewfile(char *fname);  extern FILE *os_createnewfile(char *fname);
39  extern char *md5contextTo64(MD5_CTX *context);  extern char *md5contextTo64(MD5_CTX *context);
 extern void warn(char *s);  
 extern void os_perror(char *str);  
 extern void chat(char *s);  
 extern void os_donewithdir(char *dir);  
 extern void os_warnMD5mismatch(void);  
 extern void os_closetypedfile(FILE *outfile);  
   
 extern int part_depth(struct part *part);  
 extern void part_ungets(char *s, struct part *part);  
 extern void part_close(struct part *part);  
 extern int part_fill(struct part *part);  
 extern void part_addboundary(struct part *part, char *boundary);  
 extern int part_readboundary(struct part *part);  
40    
41  /* The possible content transfer encodings */  /* The possible content transfer encodings */
42  enum encoding { enc_none, enc_qp, enc_base64 };  enum encoding { enc_none, enc_qp, enc_base64 };
# Line 64  char *getDispositionFilename(char *dispo Line 49  char *getDispositionFilename(char *dispo
49  void from64(struct part *inpart, FILE *outfile, char **digestp, int suppressCR);  void from64(struct part *inpart, FILE *outfile, char **digestp, int suppressCR);
50  void fromqp(struct part *inpart, FILE *outfile, char **digestp);  void fromqp(struct part *inpart, FILE *outfile, char **digestp);
51  void fromnone(struct part *inpart, FILE *outfile, char **digestp);  void fromnone(struct part *inpart, FILE *outfile, char **digestp);
 int handlePartial(struct part *inpart, char *headers, params contentParams,  
                   int extractText);  
 int ignoreMessage(struct part *inpart);  
 int handleMultipart(struct part *inpart, char *contentType,  
                     params contentParams, int extractText);  
 int handleUuencode(struct part *inpart, char *subject, int extractText);  
 int handleText(struct part *inpart, enum encoding contentEncoding);  
 int saveToFile(struct part *inpart, int inAppleDouble, char *contentType,  
                params contentParams, enum encoding contentEncoding,  
                char *contentDisposition, char *contentMD5);  
   
52  /*  /*
53   * Read and handle an RFC 822 message from the body-part 'inpart'.   * Read and handle an RFC 822 message from the body-part 'inpart'.
54   */   */
# Line 571  getDispositionFilename(char *disposition Line 545  getDispositionFilename(char *disposition
545          SkipWhitespace(&disposition);          SkipWhitespace(&disposition);
546          if (!disposition) return 0;          if (!disposition) return 0;
547    
548          /* 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 */
549          if (*disposition++ == '=') break;          if (*disposition++ == ';') break;
550      }      }
551    
552      SkipWhitespace(&disposition);      SkipWhitespace(&disposition);
# Line 650  int handlePartial(struct part *inpart, c Line 624  int handlePartial(struct part *inpart, c
624      }      }
625      thispart = atoi(p);      thispart = atoi(p);
626    
627      if ((p = getParam(contentParams, "total"))) {      if (p = getParam(contentParams, "total")) {
628          nparts = atoi(p);          nparts = atoi(p);
629          if (nparts <= 0) {          if (nparts <= 0) {
630              warn("partial message has invalid number of parts");              warn("partial message has invalid number of parts");
# Line 669  int handlePartial(struct part *inpart, c Line 643  int handlePartial(struct part *inpart, c
643      else {      else {
644          /* Try to retrieve number of parts from reassembly directory */          /* Try to retrieve number of parts from reassembly directory */
645          sprintf(buf, "%sCT", dir);          sprintf(buf, "%sCT", dir);
646          if ((partfile = fopen(buf, "r"))) {          if (partfile = fopen(buf, "r")) {
647              if (fgets(buf, sizeof(buf), partfile)) {              if (fgets(buf, sizeof(buf), partfile)) {
648                  nparts = atoi(buf);                  nparts = atoi(buf);
649                  if (nparts < 0) nparts = 0;                  if (nparts < 0) nparts = 0;

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

  ViewVC Help
Powered by ViewVC 1.1.22