


XFMTYPE(1)					       XFMTYPE(1)


NNAAMMEE
       xfmtype - xfm file type tester


SSYYNNOOPPSSIISS
       xxffmmttyyppee -m _m_a_g_i_c___f_i_l_e [-f] _f_i_l_e_n_a_m_e ...

DDEESSCCRRIIPPTTIIOONN
       The  _x_f_m_t_y_p_e  program reads a magic configuration file and
       tests each file in its  command	line  to  tell	its  type
       according to the configuration file.

       The  format  of	the configuration file is the same as the
       mmaaggiicc(5) with the following additions and differences:

       mmooddee type field.
	   Similar to lloonngg type, but _o_f_f_s_e_t is ignored.	 The test
	   is  performed  against  the	sstt__mmooddee field of the _s_t_a_t
	   structure obtained using  ssttaatt(2)  system  call.  This
	   allows  testing  for directories, fifos ... as well as
	   for file permissions.

       llmmooddee type field.
	   Similar to mmooddee type, but using  _l_s_t_a_t(2)  instead  of
	   ssttaatt(2). This allows testing for symbolic links.

       bbuuiillttiinn type field.
	   The	test succeeds if the built-in type of the file is
	   the same as the value field. The built-in type of  the
	   file	 is  the  type	returned when all the tests fail.
	   Currently these are the built-in types:

	   _"_u_n_r_e_a_d_a_b_l_e_" The file could not be read.

	   _"_e_m_p_t_y_" File size is zero.

	   _"_s_p_e_c_i_a_l_" Not a regular file.

	   _"_a_s_c_i_i_" The file looks like ascii.

	   _"_d_a_t_a_" None of the above.


       rreeggeexxpp type field.
	   The _v_a_l_u_e field must be a proper  regular  expression.
	   The	bytes  starting at _o_f_f_s_e_t are matched against it.
	   If the match succeeds, then a rreeggssuubb(3)  is	performed
	   on  _m_e_s_s_a_g_e	yielding  the  final message. If the type
	   field is of the form rreeggeexxpp&&nnnnnn where nnnnnn is a  possi-
	   tive	 number,  then that number controls the amount of
	   data scanned for the	 matching,  otherwise  a  compile
	   defined value (currently 256) is used.





X Version 11		    Apr 3 1995				1





XFMTYPE(1)					       XFMTYPE(1)


       lloonngg and sshhoorrtt byte order.
	   _x_f_m_t_y_p_e  always reads lloonnggs and sshhoorrtts using MSB-first
	   order. This makes configuration files portable to  all
	   architectures,  but	some entries in original mmaaggiicc(5)
	   files might be wrong.

       Continuation lines.
	   If a line ends with a _b_a_c_k_s_l_a_s_h character (_\),  it  is
	   continued  with the following line. The maximun length
	   of a line is 1024 characters (counting also	charaters
	   in continuation lines).


OOPPTTIIOONNSS
       --ff _f_i_l_e
	   Consider  the following argument as a file, even if it
	   begins with `-'.

       --mm _f_i_l_e
	   Specifies a configuration file. You can  specify  more
	   than	 one  configuration  file  with several --mm flags.
	   They are read in the order in which	they  are  found.
	   Configuration  files do not have effect until they are
	   encountered in the command line. So, files to test  in
	   the	command	 line  before  that  switch  will  not be
	   affected by it.

BBUUGGSS
       Bad configuration lines cause undefined behavior. In  gen-
       eral  they  are	silently ignored, but that is not guaran-
       teed.
       There are no warning or error message except for the regu-
       lar expression syntax.
       There should be a syntax checking mode.
       All of the above apply to _x_f_m too.

SSEEEE AALLSSOO
       xxffmm(1x), ffiillee(1), mmaaggiicc(5), ssttaatt(2), llssttaatt(2),

CCOOPPYYRRIIGGHHTT
       Copyright (c) 1995 CNM-US
       Copyright (c) 1995 Juan D. Martin

AAUUTTHHOORR
       Juan D. Martin (juando@cnm.us.es)












X Version 11		    Apr 3 1995				2


