chicken-magic

libmagic bindings for CHICKEN Scheme.

Installation

$ git clone https://git.foldling.org/chicken-magic.git
$ cd chicken-magic
$ chicken-install -test

Usage

Two modules are included, (magic) and (magic libmagic).

The (magic) module is a high-level wrapper, providing one procedure called identify:

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

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

> (import (magic 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)

Full documentation is available on the CHICKEN wiki.

Author

Evan Hanson evhan@foldling.org

License

BSD. See LICENSE for details.