1 2 /* : : generated by proto : : */ 3 /*********************************************************************** 4 * * 5 * This software is part of the ast package * 6 * Copyright (c) 1985-2010 AT&T Intellectual Property * 7 * and is licensed under the * 8 * Common Public License, Version 1.0 * 9 * by AT&T Intellectual Property * 10 * * 11 * A copy of the License is available at * 12 * http://www.opensource.org/licenses/cpl1.0.txt * 13 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 14 * * 15 * Information and Software Systems Research * 16 * AT&T Research * 17 * Florham Park NJ * 18 * * 19 * Glenn Fowler <gsf@research.att.com> * 20 * David Korn <dgk@research.att.com> * 21 * Phong Vo <kpv@research.att.com> * 22 * * 23 ***********************************************************************/ 24 25 26 /* 27 * mime/mailcap interface 28 */ 29 30 #ifndef _MIMETYPE_H 31 #if !defined(__PROTO__) 32 #include <prototyped.h> 33 #endif 34 #if !defined(__LINKAGE__) 35 #define __LINKAGE__ /* 2004-08-11 transition */ 36 #endif 37 38 #define _MIMETYPE_H 1 39 40 #include <sfio.h> 41 #include <ls.h> 42 43 #define MIME_VERSION 19970717L 44 45 #ifndef MIME_FILES 46 #define MIME_FILES "~/.mailcap:/usr/local/etc/mailcap:/usr/etc/mailcap:/etc/mailcap:/etc/mail/mailcap:/usr/public/lib/mailcap" 47 #endif 48 49 #define MIME_FILES_ENV "MAILCAP" 50 51 #define MIME_LIST (1<<0) /* mimeload arg is : list */ 52 #define MIME_NOMAGIC (1<<1) /* no magic for mimetype() */ 53 #define MIME_PIPE (1<<2) /* mimeview() io is piped */ 54 #define MIME_REPLACE (1<<3) /* replace existing definition */ 55 56 #define MIME_USER (1L<<16) /* first user flag bit */ 57 58 struct Mime_s; 59 typedef struct Mime_s Mime_t; 60 61 struct Mimedisc_s; 62 typedef struct Mimedisc_s Mimedisc_t; 63 64 typedef int (*Mimevalue_f) __PROTO__((Mime_t*, __V_*, char*, size_t, Mimedisc_t*)); 65 66 struct Mimedisc_s 67 { 68 unsigned long version; /* interface version */ 69 unsigned long flags; /* MIME_* flags */ 70 Error_f errorf; /* error function */ 71 Mimevalue_f valuef; /* value extraction function */ 72 }; 73 74 struct Mime_s 75 { 76 const char* id; /* library id string */ 77 78 #ifdef _MIME_PRIVATE_ 79 _MIME_PRIVATE_ 80 #endif 81 82 }; 83 84 #if _BLD_ast && defined(__EXPORT__) 85 #undef __MANGLE__ 86 #define __MANGLE__ __LINKAGE__ __EXPORT__ 87 #endif 88 89 extern __MANGLE__ Mime_t* mimeopen __PROTO__((Mimedisc_t*)); 90 extern __MANGLE__ int mimeload __PROTO__((Mime_t*, const char*, unsigned long)); 91 extern __MANGLE__ int mimelist __PROTO__((Mime_t*, Sfio_t*, const char*)); 92 extern __MANGLE__ int mimeclose __PROTO__((Mime_t*)); 93 extern __MANGLE__ int mimeset __PROTO__((Mime_t*, char*, unsigned long)); 94 extern __MANGLE__ char* mimetype __PROTO__((Mime_t*, Sfio_t*, const char*, struct stat*)); 95 extern __MANGLE__ char* mimeview __PROTO__((Mime_t*, const char*, const char*, const char*, const char*)); 96 extern __MANGLE__ int mimehead __PROTO__((Mime_t*, __V_*, size_t, size_t, char*)); 97 extern __MANGLE__ int mimecmp __PROTO__((const char*, const char*, char**)); 98 99 #undef __MANGLE__ 100 #define __MANGLE__ __LINKAGE__ 101 102 #endif 103