2005-02-05  Dmitry V. Levin  <ldv@altlinux.org>

	Additional documentation tweaks for -execdir/-okdir actions.

	* find/parser.c (parse_help): Mention recently added options.
	* doc/find.texi, find/find.1: Additionally document new options.

diff -uprk.orig findutils-4.2.18.orig/doc/find.texi findutils-4.2.18/doc/find.texi
--- findutils-4.2.18.orig/doc/find.texi	2005-02-13 15:11:54 +0300
+++ findutils-4.2.18/doc/find.texi	2005-02-16 20:35:57 +0300
@@ -1927,10 +1927,10 @@ find bills -type f | xargs -iXX sort -o 
 @end example
 
 @noindent
-The equivalent command using @samp{find -exec} is:
+The equivalent command using @samp{find -execdir} is:
 
 @example
-find bills -type f -exec sort -o '@{@}.sorted' '@{@}' ';'
+find bills -type f -execdir sort -o '@{@}.sorted' '@{@}' ';'
 @end example
 @end table
 
@@ -1938,14 +1938,24 @@ find bills -type f -exec sort -o '@{@}.s
 @subsection Querying
 
 To ask the user whether to execute a command on a single file, you can
-use the @code{find} primary @samp{-ok} instead of @samp{-exec}:
+use the @code{find} primary @samp{-okdir} instead of @samp{-execdir},
+and the @code{find} primary @samp{-ok} instead of @samp{-exec}:
 
-@deffn Action -ok command ;
-Like @samp{-exec} (@pxref{Single File}), but ask the user first (on
+@deffn Action -okdir command ;
+Like @samp{-execdir} (@pxref{Single File}), but ask the user first (on
 the standard input); if the response does not start with @samp{y} or
 @samp{Y}, do not run the command, and return false.
 @end deffn
 
+@deffn Action -ok command ;
+This insecure variant of the @samp{-okdir} action is specified by
+POSIX.  The main difference is that the command is executed in the
+directory from which @code{find} was invoked, meaning that @samp{@{@}}
+is expanded to a relative path starting with the name of one of the
+starting directories, rather than just the basename of the matched
+file.
+@end deffn
+
 When processing multiple files with a single command, to query the user
 you give @code{xargs} the following option.  When using this option, you
 might find it useful to control the number of files processed per
@@ -2216,7 +2226,7 @@ the file name contains a character with 
 strip it off.  A more reliable way is:
 
 @example
-find . -maxdepth 1 @var{tests} -ok rm '@{@}' \;
+find . -maxdepth 1 @var{tests} -okdir rm '@{@}' \;
 @end example
 
 @noindent
@@ -2235,18 +2245,18 @@ have found that its inode number is 1234
 whether to remove it:
 
 @example
-find . -maxdepth 1 -inum 12345 -ok rm -f '@{@}' \;
+find . -maxdepth 1 -inum 12345 -okdir rm -f '@{@}' \;
 @end example
 
 If you don't want to be asked, perhaps because the file name may contain
 a strange character sequence that will mess up your screen when printed,
-then use @samp{-exec} instead of @samp{-ok}.
+then use @samp{-execdir} instead of @samp{-okdir}.
 
 If you want to rename the file instead, you can use @code{mv} instead of
 @code{rm}:
 
 @example
-find . -maxdepth 1 -inum 12345 -ok mv '@{@}' @var{new-file-name} \;
+find . -maxdepth 1 -inum 12345 -okdir mv '@{@}' @var{new-file-name} \;
 @end example
 
 @node Fixing Permissions
diff -uprk.orig findutils-4.2.18.orig/find/find.1 findutils-4.2.18/find/find.1
--- findutils-4.2.18.orig/find/find.1	2005-02-15 12:32:24 +0300
+++ findutils-4.2.18/find/find.1	2005-02-16 20:36:39 +0300
@@ -913,7 +913,7 @@ Determines the locale to be used for int
 Determines the location of the internationalisation message catalogues.
 .IP PATH
 Affects the directores which are searched to find the executables 
-invoked by `\-exec' and `\-ok'.
+invoked by `\-exec', `\-execdir', `\-ok' and `\-okdir'.
 .IP POSIXLY_CORRECT
 Determines the block size used by `-ls'.
 .IP TZ
diff -uprk.orig findutils-4.2.18.orig/find/parser.c findutils-4.2.18/find/parser.c
--- findutils-4.2.18.orig/find/parser.c	2005-02-12 23:49:25 +0300
+++ findutils-4.2.18/find/parser.c	2005-02-16 20:35:57 +0300
@@ -745,9 +745,10 @@ tests (N can be +N or -N or N): -amin N 
       -wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N\n\
       -used N -user NAME -xtype [bcdpfls]\n"));
   puts (_("\
-actions: -exec COMMAND ; -fprint FILE -fprint0 FILE -fprintf FILE FORMAT\n\
-      -fls FILE -ok COMMAND ; -print -print0 -printf FORMAT -prune -ls -delete\n\
-      -quit\n"));
+actions: -delete -exec COMMAND ; -exec COMMAND {} + -execdir COMMAND ;\n\
+      -execdir COMMAND {} + -fls FILE -fprint FILE -fprint0 FILE\n\
+      -fprintf FILE FORMAT -ls -ok COMMAND ; -ok COMMAND {} + -okdir COMMAND ;\n\
+      -okdir COMMAND {} + -print -print0 -printf FORMAT -prune -quit\n"));
   puts (_("Report (and track progress on fixing) bugs via the findutils bug-reporting\n\
 page at http://savannah.gnu.org/ or, if you have no web access, by sending\n\
 email to <bug-findutils@gnu.org>."));
