MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


File Formats                            gnome-vfs-mime-magic.4(4)



NAME
     gnome-vfs-mime-magic, gnome-vfs.mime, gnome-vfs.keys - GNOME
     VFS MIME detection

DESCRIPTION
     GnomeVFS is obsolete.  Refer to  the  GNOME  Desktop  System
     Administration  Guide  for information about how to register
     MIME type information with the  GNOME  desktop.   The  GNOME
     Desktop  System  Administration  Guide  can  be  viewed with
     yelp(1).

     On any modern desktop system, each  document  type  or  file
     type must be given a unique identification name and icon. In
     GNOME, this information is  used  extensively  by  the  file
     manager,  nautilus(1).  The primary underlying mechanism for
     providing such definitions is achieved  via  gnome-vfs-mime-
     magic.  gnome-vfs-mime-magic  contains the default file con-
     tent sniffers for identifying MIME  types.  The  concept  of
     MIME magic is similar to that of Solaris magic(4).

EXTENDED DESCRIPTION
  gnome-vfs-mime-magic
     Each  line  in  the   /etc/gnome/gnome-vfs-mime-magic   file
     describes  a  MIME  type. The format of each line is as fol-
     lows:

     offsetstart[:offsetend] patterntype pattern  [&patternmask] mime-type

     Each line contains the following fields:

     offsetstart            Decimal    number     that,     with
                             offsetend,   specifies   the  bytes
                             offset within the file.



     offsetend              Decimal    number     that,     with
                             offsetstart,  specifies  the  bytes
                             offset within the file.



     patterntype            Can be one of the following types:

                             byte  short  long  string   date
                                beshort    belong    bedate  
                             leshort  lelong  ledate

                             where be stands for Big  Endian  and
                             le stands for Little Endian.





SunOS 5.11          Last change: 14 May 2008                    1






File Formats                            gnome-vfs-mime-magic.4(4)



     pattern                 An ASCI string  with  non-printable
                             characters  escaped  as hex or octal
                             escape  sequences,  and  spaces  and
                             other  important  whitespace escaped
                             with a backslash (\).



     patternmask            A string of  hex  digits.  The  mask
                             must  be  the  same specification as
                             the non-ambiguous patterns.



     mime-type               A valid MIME type.



     The magic patterns are matched sequentially from  the  first
     entry  to  the last entry of the list. Therefore, you should
     put the non-ambiguous patterns at the start of the list. Any
     pattern  that  requires  a deep seek into the file should be
     placed at the end of the list to  reduce  performance  over-
     head.   When  designing  new  document  formats,  include an
     easily recognizable unique magic pattern near the  start  of
     the  file. A good pattern is is at least four bytes long and
     contains one or two non-printable characters  so  that  text
     files are not misidentified.

  gnome-vfs.mime
     and gnome-vfs.keys"

     Apart from file sniffing, GNOME  also  provide  a  secondary
     mechanism  to  determine  MIME  types.  If  a  file has been
     sniffed and its type does not match any of  the  magic  pat-
     terns,  GNOME  looks for files called /usr/share/gnome/mime-
     info/*.mime and processes these. The format of  these  files
     is  different to that of pattern magic. Instead of determin-
     ing the MIME type by reading the content of  the  file,  the
     MIME  type  of the file is determined by its extension.  The
     mime info file has the following format:

     mimetype
         ext[,prio]: list of extensions for this mime-type
         regex[,prio]: regular expression that matches the filename

     More than one ext: and regex:  field can be  present  for  a
     given  MIME type. You can also associate a priority for each
     field. The default priority (prio) is 1, a higher  numerical
     value  indicates  a  higher priority. The indentation before
     ext: and regex: must be a tab character (\t).




SunOS 5.11          Last change: 14 May 2008                    2






File Formats                            gnome-vfs-mime-magic.4(4)



     The searching sequence implies that the magic  pattern  file
     has  a  higher  precedence  over the mime info files. As the
     mime info files are read alphabetically,  this  also  deter-
     mines matching orders for the file extension.

     For example, the file FirstFile.mime contains the  following
     definition:

     application/foo
         ext: foo

     and the file SecondFile.mime contains the following  defini-
     tion:

     application/mini
         ext: foo

     The definition in FirstFile.mime will  be  found  first  and
     used.

     For each MIME info file there must  be  an  associated  keys
     file  in  the  same  directory.  The key file provides human
     readable text which can be localized into various languages.
     The  data  in  these  keys  files  is used by the GNOME file
     manager, nautilus(1).

EXAMPLES
     Example 1: Magic pattern definition for PDF file

     The following entry in  the  /etc/gnome/gnome-vfs-mime-magic
     file describes the MIME type of application/pdf:

          0    string    %PDF-                    application/pdf

     The first 5 characters of a PDF file are %PDF-. The  symbols
     % and - differentiate the PDF file from a text file.

     Example 2: Magic pattern definition for BMP file

     The following entry in  the  /etc/gnome/gnome-vfs-mime-magic
     file describes the MIME type of application/bmp:

     0    string         BMxxxx 00 00 &0xffff00000000ffff   image/bmp

     The interpretation of this line is as follows:

       ]o  The first two characters are BM  and  the  seventh  and
          eighth characters are NUL.

       ]o  The mask 0xffff00000000ffff allows the selction of  the
          first,  second,  seventh,  and  eighth characters to be
          selected for comparison.



SunOS 5.11          Last change: 14 May 2008                    3






File Formats                            gnome-vfs-mime-magic.4(4)



     Example 3: MIME  info  file  definition  for  application/x-
     compress

     The following entry in  the  /etc/gnome/gnome-vfs-mime-magic
     file describes the MIME type of application/x-compress:

     application/x-compress
               ext: Z

     This line indicates that the x-compress application searches
     for files with a .Z extension.

     The    associated     keys     file     entry     in     the
     /usr/share/gnome/mime-info/gnome-vfs.mime file is as follows
     (excluding all localized text):

     application/x-compress
               description=compress-compressed file
               iconfilename=gnome-compressed
               defaultactiontype=application
               category=Packages
               usecategorydefault=yes

     Example 4: MIME  info  file  definition  for  application/x-
     compressed-tar

     The following entry in  the  /etc/gnome/gnome-vfs-mime-magic
     file  describes  the  MIME type of application/x-compressed-
     tar:

     application/x-compressed-tar
                    regex,2: tar.gz$
                    ext: tgz

     This example uses the priority flag to give regex  a  higher
     priority than ext, which means that a file with an extension
     of tar.gz should be matched first (to have a  MIME  type  of
     application/x-compressed-tar) before tgz.

FILES
     The following files are used by this application:

     /etc/gnome/gnome-vfs-mime-magic


     /usr/share/gnome/mime-info/gnome-vfs.mime


     /usr/share/gnome/mime-info/gnome-vfs.keys






SunOS 5.11          Last change: 14 May 2008                    4






File Formats                            gnome-vfs-mime-magic.4(4)



     /usr/share/gnome/mime-info/solaris-gnome2.0.mime


     /usr/share/gnome/mime-info/solaris-gnome2.0.keys


ATRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:

     
           ATRIBUTE TYPE               ATRIBUTE VALUE       
    
     Availability                 SUNWgnome-vfs               
    
     Interface stability          Obsolete Volatile           
    


SEE ALSO
     nautilus(1),  gnome-vfs.applications(4),   libgnomevfs-2(3),
     gnome-interfaces(5)

     Latest version of the GNOME  Desktop  System  Administration
     Guide for your platform.


     Written by Ghee Teo, Sun Microsystems Inc., 2003.



























SunOS 5.11          Last change: 14 May 2008                    5



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™