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
|
2018-10-22 10:10:34 +02:00
|
|
|
+++ src/file.c 2018-10-22 07:56:59.735038350 +0000
|
2018-06-12 17:26:41 +02:00
|
|
|
@@ -108,10 +108,12 @@ private const struct option long_options
|
2015-07-14 13:52:47 +02:00
|
|
|
#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}
|
2018-06-12 17:26:41 +02:00
|
|
|
};
|
2018-10-22 10:10:34 +02:00
|
|
|
@@ -649,6 +651,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"
|
2018-10-22 10:10:34 +02:00
|
|
|
@@ -656,11 +659,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
|
2018-10-22 10:10:34 +02:00
|
|
|
fprintf(stdout, "\nReport bugs to https://bugs.astron.com/\n");
|
2018-06-12 17:26:41 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2013-09-30 16:29:55 +02:00
|
|
|
--- src/file_opts.h
|
2018-10-22 10:10:34 +02:00
|
|
|
+++ src/file_opts.h 2018-10-22 07:55:03.281221021 +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")
|
2018-04-06 09:09:50 +02:00
|
|
|
+OPT_POSIX('L', "dereference", 0, 1, " follow symlinks")
|
|
|
|
+OPT_POSIX('h', "no-dereference", 0, 2, " 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")
|