/***********************************************************************
* *
* This software is part of the BSD package *
*Copyright (c) 1978-2002 The Regents of the University of California an*
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* conditions are met: *
* *
* 1. Redistributions of source code must retain the above *
* copyright notice, this list of conditions and the *
* following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above *
* copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other *
* materials provided with the distribution. *
* *
* 3. Neither the name of The Regents of the University of California*
* names of its contributors may be used to endorse or *
* promote products derived from this software without *
* specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS *
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED *
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON *
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, *
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY *
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in *
* the documentation and/or other materials provided with the *
* distribution. *
* 3. Neither the name of the University nor the names of its *
* contributors may be used to endorse or promote products derived *
* from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" *
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF *
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, *
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT *
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF *
* SUCH DAMAGE. *
* *
* Kurt Shoens (UCB) *
* gsf *
* *
***********************************************************************/
#pragma prototyped
/*
* mime/mailcap interface
*/
#ifndef _MIMETYPE_H
#define _MIMETYPE_H 1
#include <sfio.h>
#include <ls.h>
#define MIME_VERSION 19970717L
#ifndef MIME_FILES
#define MIME_FILES "~/.mailcap:/usr/local/etc/mailcap:/usr/etc/mailcap:/etc/mailcap:/etc/mail/mailcap:/usr/public/lib/mailcap"
#endif
#define MIME_FILES_ENV "MAILCAP"
#define MIME_LIST (1<<0) /* mimeload arg is : list */
#define MIME_NOMAGIC (1<<1) /* no magic for mimetype() */
#define MIME_PIPE (1<<2) /* mimeview() io is piped */
#define MIME_REPLACE (1<<3) /* replace existing definition */
#define MIME_USER (1L<<16) /* first user flag bit */
struct Mime_s;
typedef struct Mime_s Mime_t;
struct Mimedisc_s;
typedef struct Mimedisc_s Mimedisc_t;
struct Mimedisc_s
{
unsigned long version; /* interface version */
unsigned long flags; /* MIME_* flags */
Error_f errorf; /* error function */
int (*valuef)(Mime_t*, void*, char*, size_t, Mimedisc_t*);
/* value extraction function */
};
struct Mime_s
{
const char* id; /* library id string */
#ifdef _MIME_PRIVATE_
_MIME_PRIVATE_
#endif
};
#if _BLD_ast && defined(__EXPORT__)
#define extern __EXPORT__
#endif
extern Mime_t* mimeopen(Mimedisc_t*);
extern int mimeload(Mime_t*, const char*, unsigned long);
extern int mimelist(Mime_t*, Sfio_t*, const char*);
extern int mimeclose(Mime_t*);
extern int mimeset(Mime_t*, char*, unsigned long);
extern char* mimetype(Mime_t*, Sfio_t*, const char*, struct stat*);
extern char* mimeview(Mime_t*, const char*, const char*, const char*, const char*);
extern int mimehead(Mime_t*, void*, size_t, size_t, char*);
extern int mimecmp(const char*, const char*, char**);
#undef extern
#endif