1*0a6a1f1dSLionel Sambuc.\" $NetBSD: libmagic.3,v 1.14 2015/01/02 21:15:32 christos Exp $ 2ef01931fSBen Gras.\" 3*0a6a1f1dSLionel Sambuc.\" $File: libmagic.man,v 1.34 2014/12/16 23:18:40 christos Exp $ 4ef01931fSBen Gras.\" 5ef01931fSBen Gras.\" Copyright (c) Christos Zoulas 2003. 6ef01931fSBen Gras.\" All Rights Reserved. 7ef01931fSBen Gras.\" 8ef01931fSBen Gras.\" Redistribution and use in source and binary forms, with or without 9ef01931fSBen Gras.\" modification, are permitted provided that the following conditions 10ef01931fSBen Gras.\" are met: 11ef01931fSBen Gras.\" 1. Redistributions of source code must retain the above copyright 12ef01931fSBen Gras.\" notice immediately at the beginning of the file, without modification, 13ef01931fSBen Gras.\" this list of conditions, and the following disclaimer. 14ef01931fSBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright 15ef01931fSBen Gras.\" notice, this list of conditions and the following disclaimer in the 16ef01931fSBen Gras.\" documentation and/or other materials provided with the distribution. 17ef01931fSBen Gras.\" 18ef01931fSBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19ef01931fSBen Gras.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20ef01931fSBen Gras.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21ef01931fSBen Gras.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 22ef01931fSBen Gras.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23ef01931fSBen Gras.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24ef01931fSBen Gras.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25ef01931fSBen Gras.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26ef01931fSBen Gras.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27ef01931fSBen Gras.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28ef01931fSBen Gras.\" SUCH DAMAGE. 29ef01931fSBen Gras.\" 30*0a6a1f1dSLionel Sambuc.Dd December 16, 2014 31ef01931fSBen Gras.Dt LIBMAGIC 3 32ef01931fSBen Gras.Os 33ef01931fSBen Gras.Sh NAME 34ef01931fSBen Gras.Nm magic_open , 35ef01931fSBen Gras.Nm magic_close , 36ef01931fSBen Gras.Nm magic_error , 37*0a6a1f1dSLionel Sambuc.Nm magic_errno , 38835f6802SDirk Vogt.Nm magic_descriptor , 39ef01931fSBen Gras.Nm magic_buffer , 40ef01931fSBen Gras.Nm magic_setflags , 41ef01931fSBen Gras.Nm magic_check , 42ef01931fSBen Gras.Nm magic_compile , 4384d9c625SLionel Sambuc.Nm magic_list , 4484d9c625SLionel Sambuc.Nm magic_load , 45*0a6a1f1dSLionel Sambuc.Nm magic_load_buffers , 46*0a6a1f1dSLionel Sambuc.Nm magic_setparam , 47*0a6a1f1dSLionel Sambuc.Nm magic_getparam , 4884d9c625SLionel Sambuc.Nm magic_version 49ef01931fSBen Gras.Nd Magic number recognition library 50ef01931fSBen Gras.Sh LIBRARY 51ef01931fSBen Gras.Lb libmagic 52ef01931fSBen Gras.Sh SYNOPSIS 53ef01931fSBen Gras.In magic.h 54ef01931fSBen Gras.Ft magic_t 55ef01931fSBen Gras.Fn magic_open "int flags" 56ef01931fSBen Gras.Ft void 57ef01931fSBen Gras.Fn magic_close "magic_t cookie" 58ef01931fSBen Gras.Ft const char * 59ef01931fSBen Gras.Fn magic_error "magic_t cookie" 60ef01931fSBen Gras.Ft int 61ef01931fSBen Gras.Fn magic_errno "magic_t cookie" 62ef01931fSBen Gras.Ft const char * 63835f6802SDirk Vogt.Fn magic_descriptor "magic_t cookie" "int fd" 64835f6802SDirk Vogt.Ft const char * 65ef01931fSBen Gras.Fn magic_file "magic_t cookie" "const char *filename" 66ef01931fSBen Gras.Ft const char * 67ef01931fSBen Gras.Fn magic_buffer "magic_t cookie" "const void *buffer" "size_t length" 68ef01931fSBen Gras.Ft int 69ef01931fSBen Gras.Fn magic_setflags "magic_t cookie" "int flags" 70ef01931fSBen Gras.Ft int 71ef01931fSBen Gras.Fn magic_check "magic_t cookie" "const char *filename" 72ef01931fSBen Gras.Ft int 73ef01931fSBen Gras.Fn magic_compile "magic_t cookie" "const char *filename" 74ef01931fSBen Gras.Ft int 7508ff44c4SLionel Sambuc.Fn magic_list "magic_t cookie" "const char *filename" 7608ff44c4SLionel Sambuc.Ft int 77ef01931fSBen Gras.Fn magic_load "magic_t cookie" "const char *filename" 7884d9c625SLionel Sambuc.Ft int 79*0a6a1f1dSLionel Sambuc.Fn magic_load_buffers "magic_t cookie" "void **buffers" "size_t *sizes" "size_t nbuffers" 80*0a6a1f1dSLionel Sambuc.Ft int 81*0a6a1f1dSLionel Sambuc.Fn magic_getparam "magic_t cookie" "int param" "void *value" 82*0a6a1f1dSLionel Sambuc.Ft int 83*0a6a1f1dSLionel Sambuc.Fn magic_setparam "magic_t cookie" "int param" "const void *value" 84*0a6a1f1dSLionel Sambuc.Ft int 8584d9c625SLionel Sambuc.Fn magic_version "void" 86ef01931fSBen Gras.Sh DESCRIPTION 87ef01931fSBen GrasThese functions 88ef01931fSBen Grasoperate on the magic database file 89ef01931fSBen Graswhich is described 90ef01931fSBen Grasin 91ef01931fSBen Gras.Xr magic 5 . 92ef01931fSBen Gras.Pp 93ef01931fSBen GrasThe function 94ef01931fSBen Gras.Fn magic_open 95ef01931fSBen Grascreates a magic cookie pointer and returns it. 96ef01931fSBen GrasIt returns 97ef01931fSBen Gras.Dv NULL 98ef01931fSBen Grasif there was an error allocating the magic cookie. 99ef01931fSBen GrasThe 100ef01931fSBen Gras.Ar flags 101ef01931fSBen Grasargument specifies how the other magic functions should behave: 102ef01931fSBen Gras.Bl -tag -width MAGIC_COMPRESS 103ef01931fSBen Gras.It Dv MAGIC_NONE 104ef01931fSBen GrasNo special handling. 105ef01931fSBen Gras.It Dv MAGIC_DEBUG 106ef01931fSBen GrasPrint debugging messages to stderr. 107ef01931fSBen Gras.It Dv MAGIC_SYMLINK 108ef01931fSBen GrasIf the file queried is a symlink, follow it. 109ef01931fSBen Gras.It Dv MAGIC_COMPRESS 110ef01931fSBen GrasIf the file is compressed, unpack it and look at the contents. 111ef01931fSBen Gras.It Dv MAGIC_DEVICES 112ef01931fSBen GrasIf the file is a block or character special device, then open the device 113ef01931fSBen Grasand try to look in its contents. 114ef01931fSBen Gras.It Dv MAGIC_MIME_TYPE 115ef01931fSBen GrasReturn a MIME type string, instead of a textual description. 116ef01931fSBen Gras.It Dv MAGIC_MIME_ENCODING 117ef01931fSBen GrasReturn a MIME encoding, instead of a textual description. 118835f6802SDirk Vogt.It Dv MAGIC_MIME 119835f6802SDirk VogtA shorthand for MAGIC_MIME_TYPE | MAGIC_MIME_ENCODING. 120ef01931fSBen Gras.It Dv MAGIC_CONTINUE 121ef01931fSBen GrasReturn all matches, not just the first. 122ef01931fSBen Gras.It Dv MAGIC_CHECK 123ef01931fSBen GrasCheck the magic database for consistency and print warnings to stderr. 124ef01931fSBen Gras.It Dv MAGIC_PRESERVE_ATIME 125ef01931fSBen GrasOn systems that support 126ef01931fSBen Gras.Xr utime 3 127ef01931fSBen Grasor 128ef01931fSBen Gras.Xr utimes 2 , 129835f6802SDirk Vogtattempt to preserve the access time of files analysed. 130ef01931fSBen Gras.It Dv MAGIC_RAW 131ef01931fSBen GrasDon't translate unprintable characters to a \eooo octal representation. 132ef01931fSBen Gras.It Dv MAGIC_ERROR 133ef01931fSBen GrasTreat operating system errors while trying to open files and follow symlinks 134ef01931fSBen Grasas real errors, instead of printing them in the magic buffer. 135835f6802SDirk Vogt.It Dv MAGIC_APPLE 136835f6802SDirk VogtReturn the Apple creator and type. 137ef01931fSBen Gras.It Dv MAGIC_NO_CHECK_APPTYPE 138835f6802SDirk VogtDon't check for 139ef01931fSBen Gras.Dv EMX 140ef01931fSBen Grasapplication type (only on EMX). 141835f6802SDirk Vogt.It Dv MAGIC_NO_CHECK_CDF 142835f6802SDirk VogtDon't get extra information on MS Composite Document Files. 143ef01931fSBen Gras.It Dv MAGIC_NO_CHECK_COMPRESS 144835f6802SDirk VogtDon't look inside compressed files. 145ef01931fSBen Gras.It Dv MAGIC_NO_CHECK_ELF 146835f6802SDirk VogtDon't print ELF details. 147835f6802SDirk Vogt.It Dv MAGIC_NO_CHECK_ENCODING 148835f6802SDirk VogtDon't check text encodings. 149ef01931fSBen Gras.It Dv MAGIC_NO_CHECK_SOFT 150ef01931fSBen GrasDon't consult magic files. 151ef01931fSBen Gras.It Dv MAGIC_NO_CHECK_TAR 152ef01931fSBen GrasDon't examine tar files. 153835f6802SDirk Vogt.It Dv MAGIC_NO_CHECK_TEXT 154835f6802SDirk VogtDon't check for various types of text files. 155ef01931fSBen Gras.It Dv MAGIC_NO_CHECK_TOKENS 156ef01931fSBen GrasDon't look for known tokens inside ascii files. 157ef01931fSBen Gras.El 158ef01931fSBen Gras.Pp 159ef01931fSBen GrasThe 160ef01931fSBen Gras.Fn magic_close 161ef01931fSBen Grasfunction closes the 162ef01931fSBen Gras.Xr magic 5 163ef01931fSBen Grasdatabase and deallocates any resources used. 164ef01931fSBen Gras.Pp 165ef01931fSBen GrasThe 166ef01931fSBen Gras.Fn magic_error 167ef01931fSBen Grasfunction returns a textual explanation of the last error, or 168ef01931fSBen Gras.Dv NULL 169ef01931fSBen Grasif there was no error. 170ef01931fSBen Gras.Pp 171ef01931fSBen GrasThe 172ef01931fSBen Gras.Fn magic_errno 173ef01931fSBen Grasfunction returns the last operating system error number 174ef01931fSBen Gras.Pq Xr errno 2 175ef01931fSBen Grasthat was encountered by a system call. 176ef01931fSBen Gras.Pp 177ef01931fSBen GrasThe 178ef01931fSBen Gras.Fn magic_file 179ef01931fSBen Grasfunction returns a textual description of the contents of the 180ef01931fSBen Gras.Ar filename 181ef01931fSBen Grasargument, or 182ef01931fSBen Gras.Dv NULL 183ef01931fSBen Grasif an error occurred. 184ef01931fSBen GrasIf the 185ef01931fSBen Gras.Ar filename 186ef01931fSBen Grasis 187ef01931fSBen Gras.Dv NULL , 188ef01931fSBen Grasthen stdin is used. 189ef01931fSBen Gras.Pp 190ef01931fSBen GrasThe 191835f6802SDirk Vogt.Fn magic_descriptor 192835f6802SDirk Vogtfunction returns a textual description of the contents of the 193835f6802SDirk Vogt.Ar fd 194835f6802SDirk Vogtargument, or 195835f6802SDirk Vogt.Dv NULL 196835f6802SDirk Vogtif an error occurred. 197835f6802SDirk Vogt.Pp 198835f6802SDirk VogtThe 199ef01931fSBen Gras.Fn magic_buffer 200ef01931fSBen Grasfunction returns a textual description of the contents of the 201ef01931fSBen Gras.Ar buffer 202ef01931fSBen Grasargument with 203ef01931fSBen Gras.Ar length 204ef01931fSBen Grasbytes size. 205ef01931fSBen Gras.Pp 206ef01931fSBen GrasThe 207ef01931fSBen Gras.Fn magic_setflags 208ef01931fSBen Grasfunction sets the 209ef01931fSBen Gras.Ar flags 210ef01931fSBen Grasdescribed above. 211ef01931fSBen GrasNote that using both MIME flags together can also 212ef01931fSBen Grasreturn extra information on the charset. 213ef01931fSBen Gras.Pp 214ef01931fSBen GrasThe 215ef01931fSBen Gras.Fn magic_check 216ef01931fSBen Grasfunction can be used to check the validity of entries in the colon 217ef01931fSBen Grasseparated database files passed in as 218ef01931fSBen Gras.Ar filename , 219ef01931fSBen Grasor 220ef01931fSBen Gras.Dv NULL 221ef01931fSBen Grasfor the default database. 222ef01931fSBen GrasIt returns 0 on success and \-1 on failure. 223ef01931fSBen Gras.Pp 224ef01931fSBen GrasThe 225ef01931fSBen Gras.Fn magic_compile 226ef01931fSBen Grasfunction can be used to compile the the colon 227ef01931fSBen Grasseparated list of database files passed in as 228ef01931fSBen Gras.Ar filename , 229ef01931fSBen Grasor 230ef01931fSBen Gras.Dv NULL 231ef01931fSBen Grasfor the default database. 232ef01931fSBen GrasIt returns 0 on success and \-1 on failure. 233ef01931fSBen GrasThe compiled files created are named from the 234ef01931fSBen Gras.Xr basename 1 235ef01931fSBen Grasof each file argument with 236ef01931fSBen Gras.Dq .mgc 237ef01931fSBen Grasappended to it. 238ef01931fSBen Gras.Pp 239ef01931fSBen GrasThe 24008ff44c4SLionel Sambuc.Fn magic_list 24108ff44c4SLionel Sambucfunction dumps all magic entries in a human readable format, 24208ff44c4SLionel Sambucdumping first the entries that are matched against binary files and then the 24308ff44c4SLionel Sambucones that match text files. 24408ff44c4SLionel SambucIt takes and optional 24508ff44c4SLionel Sambuc.Fa filename 24608ff44c4SLionel Sambucargument which is a colon separated list of database files, or 24708ff44c4SLionel Sambuc.Dv NULL 24808ff44c4SLionel Sambucfor the default database. 24908ff44c4SLionel Sambuc.Pp 25008ff44c4SLionel SambucThe 251ef01931fSBen Gras.Fn magic_load 252ef01931fSBen Grasfunction must be used to load the the colon 253ef01931fSBen Grasseparated list of database files passed in as 254ef01931fSBen Gras.Ar filename , 255ef01931fSBen Grasor 256ef01931fSBen Gras.Dv NULL 257ef01931fSBen Grasfor the default database file before any magic queries can performed. 258ef01931fSBen Gras.Pp 259ef01931fSBen GrasThe default database file is named by the MAGIC environment variable. 260ef01931fSBen GrasIf that variable is not set, the default database file name is 261ef01931fSBen Gras.Pa /usr/share/misc/magic . 262ef01931fSBen Gras.Fn magic_load 263ef01931fSBen Grasadds 264ef01931fSBen Gras.Dq .mgc 265ef01931fSBen Grasto the database filename as appropriate. 26684d9c625SLionel Sambuc.Pp 26784d9c625SLionel SambucThe 268*0a6a1f1dSLionel Sambuc.Fn magic_load_buffers 269*0a6a1f1dSLionel Sambucfunction takes an array of size 270*0a6a1f1dSLionel Sambuc.Fa nbuffers 271*0a6a1f1dSLionel Sambucof 272*0a6a1f1dSLionel Sambuc.Fa buffers 273*0a6a1f1dSLionel Sambucwith a respective size for each in the array of 274*0a6a1f1dSLionel Sambuc.Fa sizes 275*0a6a1f1dSLionel Sambucloaded with the contents of the magic databases from the filesystem. 276*0a6a1f1dSLionel SambucThis function can be used in environment where the magic library does 277*0a6a1f1dSLionel Sambucnot have direct access to the filesystem, but can access the magic 278*0a6a1f1dSLionel Sambucdatabase via shared memory or other IPC means. 279*0a6a1f1dSLionel Sambuc.Pp 280*0a6a1f1dSLionel SambucThe 281*0a6a1f1dSLionel Sambuc.Fn magic_getparam 282*0a6a1f1dSLionel Sambucand 283*0a6a1f1dSLionel Sambuc.Fn magic_setparam 284*0a6a1f1dSLionel Sambucallow getting and setting various limits related to the the magic 285*0a6a1f1dSLionel Sambuclibrary. 286*0a6a1f1dSLionel Sambuc.Bl -column "MAGIC_PARAM_ELF_PHNUM_MAX" "size_t" "Default" -offset indent 287*0a6a1f1dSLionel Sambuc.It Sy "Parameter" Ta Sy "Type" Ta Sy "Default" 288*0a6a1f1dSLionel Sambuc.It Li MAGIC_PARAM_INDIR_MAX Ta size_t Ta 15 289*0a6a1f1dSLionel Sambuc.It Li MAGIC_PARAM_NAME_MAX Ta size_t Ta 30 290*0a6a1f1dSLionel Sambuc.It Li MAGIC_PARAM_ELF_NOTES_MAX Ta size_t Ta 256 291*0a6a1f1dSLionel Sambuc.It Li MAGIC_PARAM_ELF_PHNUM_MAX Ta size_t Ta 128 292*0a6a1f1dSLionel Sambuc.It Li MAGIC_PARAM_ELF_SHNUM_MAX Ta size_t Ta 32768 293*0a6a1f1dSLionel Sambuc.El 294*0a6a1f1dSLionel Sambuc.Pp 295*0a6a1f1dSLionel SambucThe 296*0a6a1f1dSLionel Sambuc.Dv MAGIC_PARAM_INDIR_RECURSION 297*0a6a1f1dSLionel Sambucparameter controls how many levels of recursion will be followed for 298*0a6a1f1dSLionel Sambucindirect magic entries. 299*0a6a1f1dSLionel Sambuc.Pp 300*0a6a1f1dSLionel SambucThe 301*0a6a1f1dSLionel Sambuc.Dv MAGIC_PARAM_NAME_RECURSION 302*0a6a1f1dSLionel Sambucparameter controls how many levels of recursion will be followed for 303*0a6a1f1dSLionel Sambucfor name/use calls. 304*0a6a1f1dSLionel Sambuc.Pp 305*0a6a1f1dSLionel SambucThe 306*0a6a1f1dSLionel Sambuc.Dv MAGIC_PARAM_NAME_MAX 307*0a6a1f1dSLionel Sambucparameter controls the maximum number of calls for name/use. 308*0a6a1f1dSLionel Sambuc.Pp 309*0a6a1f1dSLionel SambucThe 310*0a6a1f1dSLionel Sambuc.Dv MAGIC_PARAM_NOTES_MAX 311*0a6a1f1dSLionel Sambucparameter controls how many ELF notes will be processed. 312*0a6a1f1dSLionel Sambuc.Pp 313*0a6a1f1dSLionel SambucThe 314*0a6a1f1dSLionel Sambuc.Dv MAGIC_PARAM_PHNUM_MAX 315*0a6a1f1dSLionel Sambucparameter controls how many ELF program sections will be processed. 316*0a6a1f1dSLionel Sambuc.Pp 317*0a6a1f1dSLionel SambucThe 318*0a6a1f1dSLionel Sambuc.Dv MAGIC_PARAM_SHNUM_MAX 319*0a6a1f1dSLionel Sambucparameter controls how many ELF sections will be processed. 320*0a6a1f1dSLionel Sambuc.Pp 321*0a6a1f1dSLionel SambucThe 32284d9c625SLionel Sambuc.Fn magic_version 32384d9c625SLionel Sambuccommand returns the version number of this library which is compiled into 32484d9c625SLionel Sambucthe shared library using the constant 32584d9c625SLionel Sambuc.Dv MAGIC_VERSION 32684d9c625SLionel Sambucfrom 32784d9c625SLionel Sambuc.In magic.h . 32884d9c625SLionel SambucThis can be used by client programs to verify that the version they compile 32984d9c625SLionel Sambucagainst is the same as the version that they run against. 330ef01931fSBen Gras.Sh RETURN VALUES 331ef01931fSBen GrasThe function 332ef01931fSBen Gras.Fn magic_open 333ef01931fSBen Grasreturns a magic cookie on success and 334ef01931fSBen Gras.Dv NULL 335ef01931fSBen Grason failure setting errno to an appropriate value. 336ef01931fSBen GrasIt will set errno to 337ef01931fSBen Gras.Er EINVAL 338ef01931fSBen Grasif an unsupported value for flags was given. 339ef01931fSBen GrasThe 34008ff44c4SLionel Sambuc.Fn magic_list , 341ef01931fSBen Gras.Fn magic_load , 342ef01931fSBen Gras.Fn magic_compile , 343ef01931fSBen Grasand 344ef01931fSBen Gras.Fn magic_check 345ef01931fSBen Grasfunctions return 0 on success and \-1 on failure. 346ef01931fSBen GrasThe 34708ff44c4SLionel Sambuc.Fn magic_buffer , 34808ff44c4SLionel Sambuc.Fn magic_getpath , 349ef01931fSBen Grasand 35008ff44c4SLionel Sambuc.Fn magic_file , 351ef01931fSBen Grasfunctions return a string on success and 352ef01931fSBen Gras.Dv NULL 353ef01931fSBen Grason failure. 354ef01931fSBen GrasThe 355ef01931fSBen Gras.Fn magic_error 356ef01931fSBen Grasfunction returns a textual description of the errors of the above 357ef01931fSBen Grasfunctions, or 358ef01931fSBen Gras.Dv NULL 359ef01931fSBen Grasif there was no error. 36084d9c625SLionel SambucThe 36184d9c625SLionel Sambuc.Fn magic_version 36284d9c625SLionel Sambucalways returns the version number of the library. 363ef01931fSBen GrasFinally, 364ef01931fSBen Gras.Fn magic_setflags 365ef01931fSBen Grasreturns \-1 on systems that don't support 366ef01931fSBen Gras.Xr utime 3 , 367ef01931fSBen Grasor 368ef01931fSBen Gras.Xr utimes 2 369ef01931fSBen Graswhen 370ef01931fSBen Gras.Dv MAGIC_PRESERVE_ATIME 371ef01931fSBen Grasis set. 372ef01931fSBen Gras.Sh FILES 373ef01931fSBen Gras.Bl -tag -width /usr/share/misc/magic.mgc -compact 374ef01931fSBen Gras.It Pa /usr/share/misc/magic 375ef01931fSBen GrasThe non-compiled default magic database. 376ef01931fSBen Gras.It Pa /usr/share/misc/magic.mgc 377ef01931fSBen GrasThe compiled default magic database. 378ef01931fSBen Gras.El 379ef01931fSBen Gras.Sh SEE ALSO 380ef01931fSBen Gras.Xr file 1 , 381ef01931fSBen Gras.Xr magic 5 382ef01931fSBen Gras.Sh AUTHORS 383ef01931fSBen Gras.An M\(oans Rullg\(oard 384ef01931fSBen GrasInitial libmagic implementation, and configuration. 385ef01931fSBen Gras.An Christos Zoulas 386ef01931fSBen GrasAPI cleanup, error code and allocation handling. 387