t***@tavianator.com
2018-11-02 02:05:16 UTC
From: Tavian Barnes <***@tavianator.com>
See https://savannah.gnu.org/bugs/?15235 for a discussion of why the
POSIX wording implies that "-" by itself is not part of the expression.
---
find.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/find.c b/find.c
index 03889a8..f96c05b 100644
--- a/find.c
+++ b/find.c
@@ -1015,6 +1015,12 @@ usage(void)
eprintf("usage: %s [-H | -L] path ... [expression ...]\n", argv0);
}
+static int
+is_path(const char *arg)
+{
+ return !(arg[0] == '-' && arg[1]) && strcmp(arg, "!") && strcmp(arg, "(");
+}
+
int
main(int argc, char **argv)
{
@@ -1037,7 +1043,7 @@ main(int argc, char **argv)
paths = argv;
- for (; *argv && **argv != '-' && strcmp(*argv, "!") && strcmp(*argv, "("); argv++)
+ for (; *argv && is_path(*argv); argv++)
;
if (!(npaths = argv - paths))
See https://savannah.gnu.org/bugs/?15235 for a discussion of why the
POSIX wording implies that "-" by itself is not part of the expression.
---
find.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/find.c b/find.c
index 03889a8..f96c05b 100644
--- a/find.c
+++ b/find.c
@@ -1015,6 +1015,12 @@ usage(void)
eprintf("usage: %s [-H | -L] path ... [expression ...]\n", argv0);
}
+static int
+is_path(const char *arg)
+{
+ return !(arg[0] == '-' && arg[1]) && strcmp(arg, "!") && strcmp(arg, "(");
+}
+
int
main(int argc, char **argv)
{
@@ -1037,7 +1043,7 @@ main(int argc, char **argv)
paths = argv;
- for (; *argv && **argv != '-' && strcmp(*argv, "!") && strcmp(*argv, "("); argv++)
+ for (; *argv && is_path(*argv); argv++)
;
if (!(npaths = argv - paths))
--
2.19.1
2.19.1