Version: 0.7.3
type t
Magic "cookies".
exception Failure of string
Raised by the functions of this library when they fail. The
string is an explanation of why the failure happened.
type flag =
| |
Symlink |
| |
Compress |
| |
Devices |
| |
Mime |
| |
Continue |
| |
Check |
| |
Preserve_atime |
| |
Raw |
val make : ?flags:flag list -> string list -> t
make ?flags filenames creates a magic cookie, loading the
databases in
filenames. If
filenames = [], the default
database is used.
RaisesMagic.Failure if there was an error allocating the magic cookie.
Sys_error if there was an operating system error.
flags : specifies how the other magic functions should
behave (default: []).
val create : ?flags:flag list -> string list -> t
val close : t -> unit
close cookie frees the resources associated with the cookie c.
You need not to close cookies as the resources will be freed by
the garbage collector anyway.
val file : t -> string -> string
file cookie filename returns a textual description of the
contents of the filename argument.
RaisesMagic.Failure if an error occurred.
Invalid_argument if the cookie is closed.
Sys_error if there was an operating system error.
val buffer : t -> ?len:int -> string -> string
file cookie ?len buf returns a textual description of the
contents of the filename argument.
RaisesMagic.Failure if an error occurred.
Invalid_argument if cookie is closed or if one does not
have 0 <= len <= String.length buf.
val setflags : t -> flag list -> unit
setflags cookie flags specifies how the other magic functions
should behave.
RaisesMagic.Failure if the Magic.flag Preserve_atime is
not supported by the operating system.
Invalid_argument if the cookie has been closed.
val load : t -> string list -> unit
load cookie filenames loads the the list of database files
filenames, or [] for the default database file.
RaisesInvalid_argument if the cookie has been closed.
Sys_error if there was an operating system error.
val compile : t -> string list -> unit
compile cookie filenames compiles the the list of database
files
filenames, or [] for the default database. The compiled
files created are named from the basename(1) of each file
argument with ".mgc" appended to it.
RaisesInvalid_argument if the cookie has been closed.
Sys_error if there was an operating system error.
val check : t -> string list -> bool
check cookie filenames checks the validity of entries in the
database files filenames, or [] for the default database.
Raises Invalid_argument if the cookie has been closed.