Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/find Fix "-exec blah blah {} +" so it only matches w...



details:   https://anonhg.NetBSD.org/src/rev/56f627ee9470
branches:  trunk
changeset: 760501:56f627ee9470
user:      dholland <dholland%NetBSD.org@localhost>
date:      Thu Jan 06 08:18:42 2011 +0000

description:
Fix "-exec blah blah {} +" so it only matches when the {} is last, as
per the standard. Per (brief) discussion on tech-userlevel.

There should really be a form where you can do the equivalent of
"-exec blah {} blah +", but I think we're going to need to call it
something other than -exec. As it is it's sort of surprising that the
standards people didn't add a different name -- note what happens if
you try to do something like "find ... -exec expr {} + 2 \;".

diffstat:

 usr.bin/find/function.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 34e908500909 -r 56f627ee9470 usr.bin/find/function.c
--- a/usr.bin/find/function.c   Thu Jan 06 07:43:05 2011 +0000
+++ b/usr.bin/find/function.c   Thu Jan 06 08:18:42 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: function.c,v 1.64 2007/07/19 07:49:30 daniel Exp $     */
+/*     $NetBSD: function.c,v 1.65 2011/01/06 08:18:42 dholland Exp $   */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)function.c   8.10 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: function.c,v 1.64 2007/07/19 07:49:30 daniel Exp $");
+__RCSID("$NetBSD: function.c,v 1.65 2011/01/06 08:18:42 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -646,6 +646,7 @@
                        errx(1, "%s: no terminating \";\" or \"+\"",
                            isok ? "-ok" : "-exec");
                lastbrace = brace;
+               brace = 0;
                if (strcmp(*ap, "{}") == 0)
                        brace = 1;
                if (strcmp(*ap, ";") == 0)



Home | Main Index | Thread Index | Old Index