3 * http://www.iana.org/assignments/media-types/index.html
16 #include <sys/types.h>
21 static void parse_file(FILE *fh
, struct mime_header
*hdr
)
26 while (fgets(buf
, sizeof(buf
), fh
)) {
27 if (!strncmp(buf
, "Content-Type:", 13)) {
28 mime_content_type(buf
, hdr
);
29 } else if (!strncmp(buf
, "Content-Disposition:", 20)) {
30 hdr
->disposition
= mime_content_disposition(buf
);
31 } else if (!strncmp(buf
, "Content-Transfer-Encoding:", 26)) {
32 hdr
->transfer_encoding
= mime_content_transfer_encoding(buf
);
34 /*printf("[SKIP] ------- %s", buf); */
39 int main(int argc
, char **argv
)
42 struct mime_header hdr
;
46 fprintf(stderr
, "Usage: mime <file>\n");
52 fh
= fopen(file
, "r");
57 /* Init MIME header struct */
58 hdr
.type
= MIME_TYPE_TEXT
;
59 hdr
.disposition
= MIME_DISPOSITION_UNKNOWN
;
60 hdr
.transfer_encoding
= MIME_ENCODING_UNKNOWN
;
64 fprintf(stderr
, "-------------------------------------------\n");
65 fprintf(stderr
, "Test file: %s\n", file
);
66 fprintf(stderr
, "-------------------------------------------\n");
68 debug_mime_header(&hdr
);