LinuxGuruz
  • Last 5 Forum Topics
    Replies
    Views
    Last post


The Web Only This Site
  • BOOKMARK

  • ADD TO FAVORITES

  • REFERENCES


  • MARC

    Mailing list ARChives
    - Search by -
     Subjects
     Authors
     Bodies





    FOLDOC

    Computing Dictionary




  • Text Link Ads






  • LINUX man pages
  • Linux Man Page Viewer


    The following form allows you to view linux man pages.

    Command:

    libmagic

    
    
    

    LIBRARY

         library "libmagic"
    
    
    

    SYNOPSIS

         #include <magic.h>
    
         magic_t
         magic_open(int flags);
    
         void
         magic_close(magic_t cookie);
    
         const char *
         magic_error(magic_t cookie);
    
         int
         magic_errno(magic_t cookie);
    
         const char *
         magic_descriptor(magic_t cookie,, int, fd");
    
         const char *
         magic_file(magic_t cookie, const char *filename);
    
         const char *
         magic_buffer(magic_t cookie, const void *buffer, size_t length);
    
         int
         magic_setflags(magic_t cookie, int flags);
    
         int
         magic_check(magic_t cookie, const char *filename);
    
         int
         magic_compile(magic_t cookie, const char *filename);
    
         int
         magic_load(magic_t cookie, const char *filename);
    
    
    

    DESCRIPTION

         These functions operate on the magic database file which is described in
         magic(5).
    
         The function magic_open() creates a magic cookie pointer and returns it.
         It returns NULL if there was an error allocating the magic cookie.  The
         flags argument specifies how the other magic functions should behave:
    
         MAGIC_NONE      No special handling.
    
         MAGIC_DEBUG     Print debugging messages to stderr.
    
         MAGIC_SYMLINK   If the file queried is a symlink, follow it.
         MAGIC_MIME      A shorthand for MAGIC_MIME_TYPE | MAGIC_MIME_ENCODING.
    
         MAGIC_CONTINUE  Return all matches, not just the first.
    
         MAGIC_CHECK     Check the magic database for consistency and print warn-
                         ings to stderr.
    
         MAGIC_PRESERVE_ATIME
                         On systems that support utime(3) or utimes(2), attempt to
                         preserve the access time of files analysed.
    
         MAGIC_RAW       Don't translate unprintable characters to a \ooo octal
                         representation.
    
         MAGIC_ERROR     Treat operating system errors while trying to open files
                         and follow symlinks as real errors, instead of printing
                         them in the magic buffer.
    
         MAGIC_APPLE     Return the Apple creator and type.
    
         MAGIC_NO_CHECK_APPTYPE
                         Don't check for EMX application type (only on EMX).
    
         MAGIC_NO_CHECK_CDF
                         Don't get extra information on MS Composite Document
                         Files.
    
         MAGIC_NO_CHECK_COMPRESS
                         Don't look inside compressed files.
    
         MAGIC_NO_CHECK_ELF
                         Don't print ELF details.
    
         NO_CHECK_ENCODING
                         Don't check text encodings.
    
         MAGIC_NO_CHECK_SOFT
                         Don't consult magic files.
    
         MAGIC_NO_CHECK_TAR
                         Don't examine tar files.
    
         MAGIC_NO_CHECK_TEXT
                         Don't check for various types of text files.
    
         MAGIC_NO_CHECK_TOKENS
                         Don't look for known tokens inside ascii files.
    
         The magic_close() function closes the magic(5) database and deallocates
         any resources used.
    
         The magic_error() function returns a textual explanation of the last
    
         The magic_setflags() function sets the flags described above.  Note that
         using both MIME flags together can also return extra information on the
         charset.
    
         The magic_check() function can be used to check the validity of entries
         in the colon separated database files passed in as filename, or NULL for
         the default database.  It returns 0 on success and -1 on failure.
    
         The magic_compile() function can be used to compile the the colon sepa-
         rated list of database files passed in as filename, or NULL for the
         default database.  It returns 0 on success and -1 on failure.  The com-
         piled files created are named from the basename(1) of each file argument
         with ".mgc" appended to it.
    
         The magic_load() function must be used to load the the colon separated
         list of database files passed in as filename, or NULL for the default
         database file before any magic queries can performed.
    
         The default database file is named by the MAGIC environment variable.  If
         that variable is not set, the default database file name is
         /usr/share/misc/magic.  magic_load() adds ".mgc" to the database filename
         as appropriate.
    
    
    

    RETURN VALUES

         The function magic_open() returns a magic cookie on success and NULL on
         failure setting errno to an appropriate value.  It will set errno to
         EINVAL if an unsupported value for flags was given.  The magic_load(),
         magic_compile(), and magic_check() functions return 0 on success and -1
         on failure.  The magic_file(), and magic_buffer() functions return a
         string on success and NULL on failure.  The magic_error() function
         returns a textual description of the errors of the above functions, or
         NULL if there was no error.  Finally, magic_setflags() returns -1 on sys-
         tems that don't support utime(3), or utimes(2) when MAGIC_PRESERVE_ATIME
         is set.
    
    
    

    FILES

         /usr/share/misc/magic      The non-compiled default magic database.
         /usr/share/misc/magic.mgc  The compiled default magic database.
    
    
    

    SEE ALSO

         file(1), magic(5)
    
    
    

    AUTHORS

         Mans Rullgard Initial libmagic implementation, and configuration.
         Christos Zoulas API cleanup, error code and allocation handling.
    
    
    

    BSD January 14, 2011 BSD

    
    
  • MORE RESOURCE


  • Linux

    The Distributions





    Linux

    The Software





    Linux

    The News



  • MARKETING






  • Toll Free

webmaster@linuxguruz.com
Copyright © 1999 - 2016 by LinuxGuruz