MIME(3)

πŸ“¦ version 93vu, in opensuse-leap 16.0

okay bestie, this is MIME(3) from the Library Functions Manual β€” the mime / mailcap interface page. ✨ It’s giving β€œsmall header, big Unix energy,” so let’s get into it.

🌸 NAME 🌸

  • mime β€” mime/mailcap interface

✨ SYNOPSIS ✨

#include <mime.h>

Mime_t
{
     unsigned long  flags;
};

Mime_t*   mimeopen(unsigned long flags);
void      mimeclose(Mime_t* mime);

int       mimeload(Mime_t* mime, const char* path, unsigned long flags);
int       mimelist(Mime_t* mime, Sfio_t* sp, const char* pattern);

char*     mimeview(Mime_t* mime, const char* view, const char* name, const char* type, const char* opts);
int       mimeset(Mime_t* mime, char* line, unsigned long flags);

πŸ’… DESCRIPTION πŸ’…

These routines are your little backstage pass to the MIME type database. πŸŽ€ mimeopen returns a mime session handle, and that handle gets passed to all of the other routines. The flags argument is currently unused β€” iconic β€œwe left a seat open” behaviour, no cap.

mimeclose closes the mime session. bye bestie πŸ‘‹

mimeload loads the mime file named by path into the mime session. The flags argument may be one of these:

  • MIME_LIST β€” the path argument is a : separated list of pathnames, each of which is loaded. Non-existent files are ignored MIME_LIST set. 🫢
  • MIME_REPLACE β€” replace existing entries by new entries with the same type. Otherwise original entries take precedence. periodt.

More than one mime file can be loaded into a session, and the files are searched in load order. If path is 0, then the default mime file is loaded. 🌈

mimelist lists the mime file contents on the sfio(3) stream sp. This is used for debugging mime entries. πŸ•΅οΈβ€β™€οΈ

mimetype returns the type string for path. mimetype always returns a non-null string. If errors are encountered on path, then the return value will be error. 😭

also in the synopsis are mimeview and mimeset β€” this page doesn’t give them prose descriptions here, so I’m not inventing any. we respect the source. πŸ‘‘

πŸ‘€ SEE ALSO πŸ‘€


that’s the whole page, bestie β€” footer check: MIME(3) from the Library Functions Manual, and there’s no separate source/version/date line on this page to report. bye πŸ’œβœ¨

πŸ“¦ where this page comes from