Print this page
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>

*** 203,212 **** --- 203,213 ---- main(int argc, char **argv) { char *p; int ch; FILE *fl; + int bflg = 0; int cflg = 0; int eflg = 0; int fflg = 0; char *ap = NULL; int pathlen;
*** 216,233 **** #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ #define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */ #endif (void) textdomain(TEXT_DOMAIN); ! while ((ch = getopt(argc, argv, "M:cdf:him:")) != EOF) { switch (ch) { case 'M': add_to_mlist(optarg, !dflg); M_flg++; break; case 'c': cflg++; break; case 'd': --- 217,238 ---- #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ #define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */ #endif (void) textdomain(TEXT_DOMAIN); ! 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; case 'd':
*** 286,296 **** if (!cflg && !fflg && (eflg || optind == argc)) usage(); if (iflg && (dflg || mflg || M_flg)) { usage(); } ! if (iflg && cflg) { usage(); } if (!dflg && !mflg && !M_flg && !iflg) { /* no -d, -m, nor -M option; also -i option doesn't need magic */ --- 291,301 ---- if (!cflg && !fflg && (eflg || optind == argc)) usage(); if (iflg && (dflg || mflg || M_flg)) { usage(); } ! if ((iflg && cflg) || (cflg && bflg)) { usage(); } if (!dflg && !mflg && !M_flg && !iflg) { /* no -d, -m, nor -M option; also -i option doesn't need magic */
*** 407,416 **** --- 412,423 ---- l = strlen(p); if (l > 0) p[l - 1] = '\0'; } else p = argv[optind]; + + if (!bflg) prf(p); /* print "file_name:<tab>" */ if (type(p)) tret = 1; }
*** 1643,1656 **** 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" " file -c [-d] [-M mfile] [-m mfile]\n")); exit(2); } static uint32_t --- 1650,1663 ---- static void usage(void) { (void) fprintf(stderr, gettext( ! "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); } static uint32_t