From: Christos Zoulas Date: Wed, 4 Nov 2009 17:27:37 +0000 (+0000) Subject: fixes from igor sobrado. X-Git-Tag: FILE5_04~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94926aa5fb1d79563e02cc0195b5b9ef1c2c4641;p=file fixes from igor sobrado. --- diff --git a/doc/file.man b/doc/file.man index 0410e70e..625d4180 100644 --- a/doc/file.man +++ b/doc/file.man @@ -1,4 +1,4 @@ -.\" $File: file.man,v 1.79 2008/11/06 22:49:08 rrt Exp $ +.\" $File: file.man,v 1.80 2009/05/08 17:41:58 christos Exp $ .Dd October 9, 2008 .Dt FILE __CSECTION__ .Os @@ -7,16 +7,18 @@ .Nd determine file type .Sh SYNOPSIS .Nm -.Op Fl bchikLnNprsvz -.Op Fl -mime-type +.Bk -words +.Op Fl bchikLNnprsvz .Op Fl -mime-encoding -.Op Fl f Ar namefile +.Op Fl -mime-type .Op Fl F Ar separator +.Op Fl f Ar namefile .Op Fl m Ar magicfiles -.Ar file +.Ar +.Ek -words .Nm .Fl C -.Op Fl m Ar magicfile +.Op Fl m Ar magicfiles .Nm .Op Fl -help .Sh DESCRIPTION @@ -161,15 +163,15 @@ in any of the character sets listed above is simply said to be .Bl -tag -width indent .It Fl b , -brief Do not prepend filenames to output lines (brief mode). +.It Fl C , -compile +Write a +.Pa magic.mgc +output file that contains a pre-parsed version of the magic file or directory. .It Fl c , -checking-printout Cause a checking printout of the parsed form of the magic file. This is usually used in conjunction with the .Fl m flag to debug a new magic file before installing it. -.It Fl C , -compile -Write a -.Pa magic.mgc -output file that contains a pre-parsed version of the magic file or directory. .It Fl e , -exclude Ar testname Exclude the test named in .Ar testname @@ -198,6 +200,10 @@ Consults magic files. .It tar Examines tar files. .El +.It Fl F , -separator Ar separator +Use the specified string as the separator between the filename and the +file result returned. Defaults to +.Sq \&: . .It Fl f , -files-from Ar namefile Read the names of the files to be examined from .Ar namefile @@ -209,10 +215,6 @@ or at least one filename argument must be present; to test the standard input, use .Sq - as a filename argument. -.It Fl F , -separator Ar separator -Use the specified string as the separator between the filename and the -file result returned. Defaults to -.Sq \&: . .It Fl h , -no-dereference option causes symlinks not to be followed (on systems that support symbolic links). This is the default if the @@ -250,16 +252,16 @@ option causes symlinks to be followed, as the like-named option in This is the default if the environment variable .Dv POSIXLY_CORRECT is defined. -.It Fl m , -magic-file Ar list +.It Fl m , -magic-file Ar magicfiles Specify an alternate list of files and directories containing magic. This can be a single item, or a colon-separated list. If a compiled magic file is found alongside a file or directory, it will be used instead. +.It Fl N , -no-pad +Don't pad filenames so that they align in the output. .It Fl n , -no-buffer Force stdout to be flushed after checking each file. This is only useful if checking a list of files. It is intended to be used by programs that want filetype output from a pipe. -.It Fl N , -no-pad -Don't pad filenames so that they align in the output. .It Fl p , -preserve-date On systems that support .Xr utime 2 diff --git a/magic/Magdir/audio b/magic/Magdir/audio index 5957e89b..9bb8e6ca 100644 --- a/magic/Magdir/audio +++ b/magic/Magdir/audio @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File$ +# $File: audio,v 1.58 2009/09/19 16:28:08 christos Exp $ # audio: file(1) magic for sound formats (see also "iff") # # Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com), @@ -278,8 +278,8 @@ >21 ubyte <128 note %d, >22 byte =0 replay 5.485 KHz >22 byte =1 replay 8.084 KHz ->22 byte =2 replay 10.971 Khz ->22 byte =3 replay 16.168 Khz +>22 byte =2 replay 10.971 KHz +>22 byte =3 replay 16.168 KHz >22 byte =4 replay 21.942 KHz >22 byte =5 replay 32.336 KHz >22 byte =6 replay 43.885 KHz diff --git a/src/file.c b/src/file.c index 672bffaa..2d08fae8 100644 --- a/src/file.c +++ b/src/file.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: file.c,v 1.132 2009/07/15 14:08:23 christos Exp $") +FILE_RCSID("@(#)$File: file.c,v 1.133 2009/09/14 17:50:38 christos Exp $") #endif /* lint */ #include "magic.h" @@ -73,12 +73,16 @@ int getopt_long(int argc, char * const *argv, const char *optstring, const struc #include "patchlevel.h" #ifdef S_IFLNK -#define SYMLINKFLAG "Lh" +#define FILE_FLAGS "-bchikLNnrsvz0" #else -#define SYMLINKFLAG "" +#define FILE_FLAGS "-bcikNnrsvz0" #endif -# define USAGE "Usage: %s [-bcik" SYMLINKFLAG "nNrsvz0] [-e test] [-f namefile] [-F separator] [-m magicfiles] file...\n %s -C -m magicfiles\n" +# define USAGE + "Usage: %s [" FILE_FLAGS \ + "] [-e test] [-f namefile] [-F separator] [-m magicfiles] file...\n" \ + " %s -C -m magicfiles\n" \ + " %s [--help]\n" #ifndef MAXPATHLEN #define MAXPATHLEN 1024 @@ -455,8 +459,7 @@ file_mbswidth(const char *s) private void usage(void) { - (void)fprintf(stderr, USAGE, progname, progname); - (void)fputs("Try `file --help' for more information.\n", stderr); + (void)fprintf(stderr, USAGE, progname, progname, progname); exit(1); }