diff -uNr orig/f new/f --- orig/f 1970-01-01 01:00:00.000000000 +0100 +++ new/f 2006-10-25 11:09:34.000000000 +0200 @@ -0,0 +1 @@ +csc -o magic.so -X easyffi -shared magic.scm -d0 -O2 -L -lmagic Binary files orig/magic.egg and new/magic.egg differ diff -uNr orig/magic.html new/magic.html --- orig/magic.html 2006-08-19 23:29:50.000000000 +0200 +++ new/magic.html 2006-10-25 11:32:09.000000000 +0200 @@ -187,6 +187,10 @@
+An example which does what the UNIX file(1) command does: +
+(display "load extension") (newline) (require-extension magic) @@ -202,6 +206,37 @@ (display "close") (newline) (magic-close cookie)
+An example which prints the mime-type and the sanitized mime-type of a file: +
++#!/usr/bin/csi -script + +(require-extension posix easyffi magic) + +(define (main args) + (if (not (null? args)) + (begin + (define cookie (magic-open (+ MAGIC_MIME MAGIC_SYMLINK))) + (magic-load cookie #f) + + (for-each (lambda (path) + (let ((mime-type (magic-file cookie path))) + (print path ": raw mime-type: " mime-type) + (print path ": sanitized mime-type: " + (magic-sanitize-mime-type mime-type path)))) + args) + + (magic-close cookie)))) + +(main (command-line-arguments)) +(exit 0) ++
Copyright (c) 2005, Peter Busser @@ -228,4 +263,4 @@ POSSIBILITY OF SUCH DAMAGE.