2015-07-14 13:52:47 +02:00
|
|
|
---
|
|
|
|
src/file.c | 8 ++++++++
|
|
|
|
src/file_opts.h | 4 ++--
|
|
|
|
2 files changed, 10 insertions(+), 2 deletions(-)
|
|
|
|
|
2013-09-30 16:29:55 +02:00
|
|
|
--- src/file.c
|
2016-11-24 11:45:15 +01:00
|
|
|
+++ src/file.c 2016-11-24 09:11:40.741887920 +0000
|
2015-07-14 13:52:47 +02:00
|
|
|
@@ -96,10 +96,12 @@ private const struct option long_options
|
|
|
|
#define OPT_MIME_ENCODING 5
|
2016-04-18 15:32:24 +02:00
|
|
|
#define OPT(shortname, longname, opt, def, doc) \
|
2012-09-18 13:01:25 +02:00
|
|
|
{longname, opt, NULL, shortname},
|
2015-07-14 13:52:47 +02:00
|
|
|
+#define OPT_POSIX OPT
|
2016-04-18 15:32:24 +02:00
|
|
|
#define OPT_LONGONLY(longname, opt, def, doc, id) \
|
2015-07-14 13:52:47 +02:00
|
|
|
{longname, opt, NULL, id},
|
2012-09-18 13:01:25 +02:00
|
|
|
#include "file_opts.h"
|
|
|
|
#undef OPT
|
|
|
|
+#undef OPT_POSIX
|
|
|
|
#undef OPT_LONGONLY
|
|
|
|
{0, 0, NULL, 0}
|
|
|
|
};
|
2016-11-24 11:45:15 +01:00
|
|
|
@@ -621,6 +623,7 @@ docprint(const char *opts, int def)
|
2012-09-18 13:01:25 +02:00
|
|
|
private void
|
|
|
|
help(void)
|
|
|
|
{
|
|
|
|
+ const unsigned long posix = (unsigned long)getenv("POSIXLY_CORRECT");
|
|
|
|
(void)fputs(
|
|
|
|
"Usage: file [OPTION...] [FILE...]\n"
|
|
|
|
"Determine type of FILEs.\n"
|
2016-11-24 11:45:15 +01:00
|
|
|
@@ -628,11 +631,16 @@ help(void)
|
2016-04-18 15:32:24 +02:00
|
|
|
#define OPT(shortname, longname, opt, def, doc) \
|
2013-01-22 17:19:33 +01:00
|
|
|
fprintf(stdout, " -%c, --" longname, shortname), \
|
2016-04-18 15:32:24 +02:00
|
|
|
docprint(doc, def);
|
|
|
|
+#define OPT_POSIX(shortname, longname, opt, def, doc) \
|
2013-01-22 17:19:33 +01:00
|
|
|
+ fprintf(stdout, " -%c, --" longname "%s", shortname, \
|
|
|
|
+ (shortname == 'L') ? (posix ? " (default)" : "") : (posix ? "" : " (default)")), \
|
2016-04-18 15:32:24 +02:00
|
|
|
+ docprint(doc, def);
|
|
|
|
#define OPT_LONGONLY(longname, opt, def, doc, id) \
|
2013-01-22 17:19:33 +01:00
|
|
|
fprintf(stdout, " --" longname), \
|
2016-04-18 15:32:24 +02:00
|
|
|
docprint(doc, def);
|
2012-09-18 13:01:25 +02:00
|
|
|
#include "file_opts.h"
|
|
|
|
#undef OPT
|
|
|
|
+#undef OPT_POSIX
|
|
|
|
#undef OPT_LONGONLY
|
|
|
|
fprintf(stdout, "\nReport bugs to http://bugs.gw.com/\n");
|
|
|
|
exit(0);
|
2013-09-30 16:29:55 +02:00
|
|
|
--- src/file_opts.h
|
2016-11-24 11:45:15 +01:00
|
|
|
+++ src/file_opts.h 2016-11-24 09:11:40.741887920 +0000
|
2016-04-18 15:32:24 +02:00
|
|
|
@@ -36,8 +36,8 @@ OPT_LONGONLY("mime-encoding", 0, 0, "
|
|
|
|
OPT('k', "keep-going", 0, 0, " don't stop at the first match\n")
|
|
|
|
OPT('l', "list", 0, 0, " list magic strength\n")
|
2013-09-30 16:29:55 +02:00
|
|
|
#ifdef S_IFLNK
|
2016-04-18 15:32:24 +02:00
|
|
|
-OPT('L', "dereference", 0, 1, " follow symlinks")
|
|
|
|
-OPT('h', "no-dereference", 0, 2, " don't follow symlinks")
|
|
|
|
+OPT_POSIX('L', "dereference", 0, 0, " follow symlinks")
|
|
|
|
+OPT_POSIX('h', "no-dereference", 0, 0, " don't follow symlinks")
|
2012-09-18 13:01:25 +02:00
|
|
|
#endif
|
2016-04-18 15:32:24 +02:00
|
|
|
OPT('n', "no-buffer", 0, 0, " do not buffer output\n")
|
|
|
|
OPT('N', "no-pad", 0, 0, " do not pad output\n")
|