Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
4732 /usr/bin/file should provide -b option for compatiblity with GNU…
…/BSD file
Reviewed by: Andy Stormont <andyjstormont@gmail.com>
Reviewed by: Serghei Samsi <sscdvp@gmail.com>
Reviewed by: Alexander Pyhalov <alp@rsu.ru>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Gordon Ross <gwr@nexenta.com>
Loading branch information
Showing
2 changed files
with
32 additions
and
16 deletions .
+14
−7
usr/src/cmd/file/file.c
+18
−9
usr/src/man/man1/file.1
@@ -205,6 +205,7 @@ main(int argc, char **argv)
char *p;
int ch;
FILE *fl;
int bflg = 0 ;
int cflg = 0 ;
int eflg = 0 ;
int fflg = 0 ;
@@ -218,14 +219,18 @@ main(int argc, char **argv)
#endif
(void ) textdomain (TEXT_DOMAIN);
while ((ch = getopt (argc, argv, " M:cdf :him:" )) != EOF) {
while ((ch = getopt (argc, argv, " M:bcdf :him:" )) != EOF) {
switch (ch) {
case ' M' :
add_to_mlist (optarg , !dflg);
M_flg++;
break ;
case ' b' :
bflg++;
break ;
case ' c' :
cflg++;
break ;
@@ -288,7 +293,7 @@ main(int argc, char **argv)
if (iflg && (dflg || mflg || M_flg)) {
usage ();
}
if (iflg && cflg) {
if (( iflg && cflg) || (cflg && bflg) ) {
usage ();
}
@@ -409,7 +414,9 @@ main(int argc, char **argv)
p[l - 1 ] = ' \0 ' ;
} else
p = argv[optind ];
prf (p); /* print "file_name:<tab>" */
if (!bflg)
prf (p); /* print "file_name:<tab>" */
if (type (p))
tret = 1 ;
@@ -1645,10 +1652,10 @@ static void
usage (void )
{
(void ) fprintf (stderr, gettext (
" usage: file [-dh ] [-M mfile] [-m mfile] [-f ffile] file ...\n "
" file [-dh ] [-M mfile] [-m mfile] -f ffile\n "
" file -i [-h ] [-f ffile] file ...\n "
" file -i [-h ] -f ffile\n "
" usage: file [-bdh ] [-M mfile] [-m mfile] [-f ffile] file ...\n "
" file [-bdh ] [-M mfile] [-m mfile] -f ffile\n "
" file -i [-bh ] [-f ffile] file ...\n "
" file -i [-bh ] -f ffile\n "
" file -c [-d] [-M mfile] [-m mfile]\n " ));
exit (2 );
}
@@ -7,28 +7,28 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH FILE 1 "Sep 10, 2013 "
.TH FILE 1 "Apr 11, 2014 "
.SH NAME
file \- determine file type
.SH SYNOPSIS
.LP
.nf
\fB /usr/bin/file \fR [\fB -dh \fR ] [\fB -m \fR \fI mfile \fR ] [\fB -M \fR \fI Mfile \fR ] [\fB -f \fR \fI ffile \fR ] \fI file \fR ...
\fB /usr/bin/file \fR [\fB -bdh \fR ] [\fB -m \fR \fI mfile \fR ] [\fB -M \fR \fI Mfile \fR ] [\fB -f \fR \fI ffile \fR ] \fI file \fR ...
.fi
.LP
.nf
\fB /usr/bin/file \fR [\fB -dh \fR ] [\fB -m \fR \fI mfile \fR ] [\fB -M \fR \fI Mfile \fR ] \fB -f \fR \fI ffile \fR
\fB /usr/bin/file \fR [\fB -bdh \fR ] [\fB -m \fR \fI mfile \fR ] [\fB -M \fR \fI Mfile \fR ] \fB -f \fR \fI ffile \fR
.fi
.LP
.nf
\fB /usr/bin/file \fR \fB -i \fR [\fB -h \fR ] [\fB -f \fR \fI ffile \fR ] \fI file \fR ...
\fB /usr/bin/file \fR \fB -i \fR [\fB -bh \fR ] [\fB -f \fR \fI ffile \fR ] \fI file \fR ...
.fi
.LP
.nf
\fB /usr/bin/file \fR \fB -i \fR [\fB -h \fR ] \fB -f \fR \fI ffile \fR
\fB /usr/bin/file \fR \fB -i \fR [\fB -bh \fR ] \fB -f \fR \fI ffile \fR
.fi
.LP
@@ -38,22 +38,22 @@ file \- determine file type
.LP
.nf
\fB /usr/xpg4/bin/file \fR [\fB -dh \fR ] [\fB -m \fR \fI mfile \fR ] [\fB -M \fR \fI Mfile \fR ] [\fB -f \fR \fI ffile \fR ] \fI file \fR ...
\fB /usr/xpg4/bin/file \fR [\fB -bdh \fR ] [\fB -m \fR \fI mfile \fR ] [\fB -M \fR \fI Mfile \fR ] [\fB -f \fR \fI ffile \fR ] \fI file \fR ...
.fi
.LP
.nf
\fB /usr/xpg4/bin/file \fR [\fB -dh \fR ] [\fB -m \fR \fI mfile \fR ] [\fB -M \fR \fI Mfile \fR ] \fB -f \fR \fI ffile \fR
\fB /usr/xpg4/bin/file \fR [\fB -bdh \fR ] [\fB -m \fR \fI mfile \fR ] [\fB -M \fR \fI Mfile \fR ] \fB -f \fR \fI ffile \fR
.fi
.LP
.nf
\fB /usr/xpg4/bin/file \fR \fB -i \fR [\fB -h \fR ] [\fB -f \fR \fI ffile \fR ] \fI file \fR ...
\fB /usr/xpg4/bin/file \fR \fB -i \fR [\fB -bh \fR ] [\fB -f \fR \fI ffile \fR ] \fI file \fR ...
.fi
.LP
.nf
\fB /usr/xpg4/bin/file \fR \fB -i \fR [\fB -h \fR ] \fB -f \fR \fI ffile \fR
\fB /usr/xpg4/bin/file \fR \fB -i \fR [\fB -bh \fR ] \fB -f \fR \fI ffile \fR
.fi
.LP
@@ -103,6 +103,15 @@ be determined.
.sp
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB -b \fR\fR
.ad
.RS 12n
Be brief, do not print leading filename.
.RE
.sp
.ne 2
.na
Toggle all file notes
Toggle all file annotations