[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch: find(1) -regextype should be POSOPT

From: Thien-Thi Nguyen
Subject: patch: find(1) -regextype should be POSOPT
Date: Sat, 17 Jan 2009 13:51:50 +0100

Greetings findutils hackers,

The docs say -regextype is positional, but using it (from Emacs)
suchwise i see:

  find . \( -regextype egrep -regex './(doc|examples|lib)' -prune -o -type f 
-name '*.c' -exec /tmp/ko '{}' \; \) -exec ls -ld \{\} \;
  find: warning: you have specified the -regextype option after a non-option 
argument (, but options are not positional (-regextype affects tests specified 
before it as well as those specified after it).  Please specify options before 
other arguments.

I believe find/parser.c line 309 should be changed from:

  PARSE_OPTION     ("regextype",             regextype),     /* GNU */


  PARSE_POSOPT     ("regextype",             regextype),     /* GNU */

in order to make the warning go away.  Following is a full patch.
Please let me know if there is a better way to achieve this result.


git show bugfix-regextype
commit afd144eee293a3e72ac11f0a16d37b2d1b4d7f04
Author: Thien-Thi Nguyen <address@hidden>
Date:   Sat Jan 17 13:48:20 2009 +0100

    find: Fix -regexptype parse specification bug: declare as POSOPT.
    * find/parser.c (parse_table): Parse -regextype as POSOPT.

diff --git a/ChangeLog b/ChangeLog
index b826d26..e295b9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-17  Thien-Thi Nguyen  <address@hidden>
+       find: Fix -regexptype parse specification bug: declare as POSOPT.
+       * find/parser.c (parse_table): Parse -regextype as POSOPT.
 2008-12-26  Jim Meyering  <address@hidden>
        find: avoid using undefined statbuf
diff --git a/find/parser.c b/find/parser.c
index 294672f..7f404ba 100644
--- a/find/parser.c
+++ b/find/parser.c
@@ -306,7 +306,7 @@ static struct parser_table const parse_table[] =
   PARSE_ACTION     ("quit",                  quit),         /* GNU */
   {ARG_TEST,       "readable",            parse_accesscheck, pred_readable}, 
/* GNU, 4.3.0+ */
   PARSE_TEST       ("regex",                 regex),        /* GNU */
-  PARSE_OPTION     ("regextype",             regextype),     /* GNU */
+  PARSE_POSOPT     ("regextype",             regextype),     /* GNU */
   PARSE_TEST       ("samefile",              samefile),             /* GNU */
 #if 0
   PARSE_OPTION     ("show-control-chars",    show_control_chars), /* GNU, 
4.3.0+ */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]