Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the magicffi Reference Manual, generated automatically by Declt version 3.0 "Montgomery Scott" on Tue Dec 22 14:19:16 2020 GMT+0.
• Introduction | What magicffi is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
MAGICFFI is a CFFI interface to libmagic(3), the file type determination library using ``magic'' numbers.
To check out the git repository, run:
$ git clone git://github.com/guicho271828/magicffi.git
MAGICFFI depends on the following lisp libraries:
The following system packages are also required:
You have to install them on your system before loading magicffi.
> (asdf:load-system :magicffi)
> (use-package :magicffi)
> (with-open-magic (magic '(:mime-type :symlink))
(magic-file magic #P"magicffi.asd"))
"text/plain"
All external symbols of the package MAGICFFI
are listed in
package.lisp
. Check out their docstrings for help.
You can use either constants or keyword list as magic flags. I.e.,
(magic-open (logxor +magic-mime-type+ +magic-symlink+))
is equivalent to
(magic-open '(:mime-type :symlink))
The constant name and keyword name of a flag are based on its C name. See the following table for the pattern:
| C name | Lisp constant | Lisp keyword |
|--------------|----------------|--------------|
| MAGIC_NONE
| +MAGIC-NONE+
| :NONE
|
All constant names are exported.
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The magicffi system |
Desmond O. Chang <dochang+magicffi@gmail.com>
Desmond O. Chang <dochang+magicffi@gmail.com>
Simplified BSD License
cffi interface to libmagic(3)
A file type determination library.
cffi-grovel
magicffi.asd (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The magicffi.asd file | ||
• The magicffi/package.lisp file | ||
• The magicffi/grovel.lisp file | ||
• The magicffi/types.lisp file | ||
• The magicffi/api.lisp file | ||
• The magicffi/shortcuts.lisp file |
Next: The magicffi/package․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/magicffi.asd
magicffi (system)
Next: The magicffi/grovel․lisp file, Previous: The magicffi․asd file, Up: Lisp files [Contents][Index]
Next: The magicffi/types․lisp file, Previous: The magicffi/package․lisp file, Up: Lisp files [Contents][Index]
package.lisp (file)
magicffi (system)
grovel.lisp
Next: The magicffi/api․lisp file, Previous: The magicffi/grovel․lisp file, Up: Lisp files [Contents][Index]
grovel.lisp (file)
magicffi (system)
types.lisp
Next: The magicffi/shortcuts․lisp file, Previous: The magicffi/types․lisp file, Up: Lisp files [Contents][Index]
types.lisp (file)
magicffi (system)
api.lisp
Previous: The magicffi/api․lisp file, Up: Lisp files [Contents][Index]
api.lisp (file)
magicffi (system)
shortcuts.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The magicffi package |
Usage:
> (asdf:load-system :magicffi)
> (use-package :magicffi)
> (with-open-magic (magic ’(:mime-type :symlink))
(magic-load magic)
(magic-file magic #P"magicffi.asd"))
"text/plain"
package.lisp (file)
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported constants | ||
• Exported special variables | ||
• Exported macros | ||
• Exported functions | ||
• Exported generic functions | ||
• Exported conditions | ||
• Exported classes |
Next: Exported special variables, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
Return the Apple creator/type
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Print warnings to stderr
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Check inside compressed files
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Return all matches
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Turn on debugging
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Look at the contents of devices
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Handle ENOENT etc as real errors
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
A shorthand for MAGIC_MIME_TYPE | MAGIC_MIME_ENCODING
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Return the MIME encoding
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Return the MIME type
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Don’t check application type
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Defined for backwards compatibility (renamed): same as MAGIC_NO_CHECK_TEXT
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Don’t check for cdf files
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Don’t check for compressed files
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Don’t check for elf details
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Don’t check text encodings
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Defined for backwards compatibility; do nothing
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Don’t check magic entries
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Don’t check for tar files
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Don’t check for text files
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Don’t check tokens
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Defined for backwards compatibility; do nothing
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
No flags
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Restore access time on exit
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Don’t convert unprintable chars
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Follow symlinks
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Next: Exported macros, Previous: Exported constants, Up: Exported definitions [Contents][Index]
Default magic database files. It can be NIL(default), or a designator for a non-empty list of pathname designators. NIL means the default database files defined by libmagic.
Next: Exported functions, Previous: Exported special variables, Up: Exported definitions [Contents][Index]
Opens the magic cookie MAGIC, executes BODY and close MAGIC.
FLAGS:
A list of keywords (see types), defaulted to (:none).
MAGICFILES:
NIL, or a list of pathname designators for the database files.
Defaulted to NIL, which uses the default database available in the system. This covers the most usage.
Next: Exported generic functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]
Returns a textual description of the contents of the STRING argument. An error of type MAGIC-ERROR is signaled on failure.
Checks the validity of database files. PATHNAME-LIST is NIL(default), which means use *MAGIC-DATABASE*, or a designator for a non-empty list of pathname designators. Returns ’true’ on success and signals an error of type MAGIC-ERROR on failure.
Closes the magic database and deallocates any resources used. It is permissible to close an already closed magic, and has no effect. Returns ’true’ if an open magic cookie has been closed, or ’false’ if the magic cookie is already closed.
Compiles database files. PATHNAME-LIST is NIL(default), which means use *MAGIC-DATABASE*, or a designator for a non-empty list of pathname designators. Returns ’true’ on success and signals an error of type MAGIC-ERROR on failure. The compiled files created are named from the basename(1) of each file argument with ‘.mgc’ appended to it.
Signals an error of type MAGIC-ERROR.
Returns a textual description of the contents of the PATHSPEC argument. PATHSPEC is a pathname designator. An error of type MAGIC-ERROR is signaled on failure.
Loads database files. PATHNAME-LIST is NIL(default), which means use *MAGIC-DATABASE*, or a designator for a non-empty list of pathname designators. Returns ’true’ on success and signals an error of type MAGIC-ERROR on failure.
Creates a magic cookie and returns it. An error of type SIMPLE-ERROR is signaled on failure. FLAGS specifies how the other magic functions should behave. See README for the flags usage.
Sets the magic flags. Signals an error of type SIMPLE-ERROR on systems that don’t support utime(2), or utimes(2) when :PRESERVE-ATIME is set; otherwise, returns ’true’.
Returns ’true’ if object is of type MAGIC; otherwise, returns ’false’. It is unaffected by whether object, if it is a magic, is open or closed.
types.lisp (file)
Returns ’true’ if MAGIC is open; otherwise, returns ’false’.
types.lisp (file)
Return the Apple creator/type
shortcuts.lisp (file)
Return a /-separated list of extensions. This is NOT about the file name extensions (such as .png).
shortcuts.lisp (file)
Returns a description, as in unix ‘file‘ command
shortcuts.lisp (file)
Return the MIME type
shortcuts.lisp (file)
Return the MIME encoding
shortcuts.lisp (file)
Return the MIME type
shortcuts.lisp (file)
Next: Exported conditions, Previous: Exported functions, Up: Exported definitions [Contents][Index]
types.lisp (file)
types.lisp (file)
Next: Exported classes, Previous: Exported generic functions, Up: Exported definitions [Contents][Index]
Consists of errors that are related to MAGICFFI.
Use the function MAGIC-ERROR to signal it. The error number and error
string are accessed by the functions MAGIC-ERROR-ERRNO and
MAGIC-ERROR-ERROR.
types.lisp (file)
error (condition)
:errno
magic-error-errno (generic function)
:error
magic-error-error (generic function)
Previous: Exported conditions, Up: Exported definitions [Contents][Index]
Lisp magic class.
types.lisp (file)
standard-object (class)
:cookie
%magic-cookie (generic function)
(setf %magic-cookie) (generic function)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal constants | ||
• Internal symbol macros | ||
• Internal macros | ||
• Internal functions | ||
• Internal generic functions |
Next: Internal symbol macros, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
Check inside compressed files but not report compression
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Return a /-separated list of extensions
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
A shorthand for:
MAGIC_NO_CHECK_COMPRESS |
MAGIC_NO_CHECK_TAR |
MAGIC_NO_CHECK_APPTYPE |
MAGIC_NO_CHECK_ELF |
MAGIC_NO_CHECK_TEXT |
MAGIC_NO_CHECK_CDF |
MAGIC_NO_CHECK_TOKENS |
MAGIC_NO_CHECK_ENCODING.
Not documented in the library documentation.
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
This implementation
/home/quickref/.cache/common-lisp/sbcl-1.5.8-linux-x64/home/quickref/quicklisp/dists/quicklisp/software/magicffi-20200925-git/src/grovel.processed-grovel-file
Next: Internal macros, Previous: Internal constants, Up: Internal definitions [Contents][Index]
Next: Internal functions, Previous: Internal symbol macros, Up: Internal definitions [Contents][Index]
Next: Internal generic functions, Previous: Internal macros, Up: Internal definitions [Contents][Index]
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
types.lisp (file)
The magic_version() command returns the version number of this library which is compiled into the shared library using the constant MAGIC_VERSION from <magic.h>. This can be used by client programs to verify that the version they compile against is the same as the version that they run against.
Previous: Internal functions, Up: Internal definitions [Contents][Index]
automatically generated reader method
types.lisp (file)
automatically generated writer method
types.lisp (file)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L M |
---|
Jump to: | F L M |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | %
(
F G M O P W |
---|
Jump to: | %
(
F G M O P W |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | %
*
+
C S |
---|
Jump to: | %
*
+
C S |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | C M P S |
---|
Jump to: | C M P S |
---|