Overview

chicken-magic

libmagic bindings for CHICKEN Scheme.

Installation

$ git clone git://bitbucket.org/evhan/chicken-magic.git
$ cd chicken-magic
$ chicken-install

Usage

Two modules are included, libmagic and magic.

libmagic is a one-to-one binding to libmagic.h, used exactly like the C library, e.g. (modulo error handling):

> (use libmagic)
> (define m (magic_open MAGIC_NONE))
> (magic_load m #f)
0
> (magic_file m "/usr/include/magic.h")
"C source, ASCII text"
> (magic_close m)

magic is high-level wrapper, providing one procedure called identify:

> (use magic)
> (identify "/usr/include/magic.h")
"C source, ASCII text"
> (identify "/usr/include/magic.h" 'mime)
"text/x-c; charset=us-ascii"

Full documentation is available on the CHICKEN wiki.

Author

Evan Hanson evhan@foldling.org

License

BSD. See LICENSE for details.