2008-06-26  Juan Manuel Guerrero  <juan.guerrero@gmx.de>


	* gnulib/lib/openat.c [__DJGPP__, __DJGPP_MINOR__]: Adjust for use of
	libsupp_stat_2_03 from libsupp library.

	* gnulib/lib/getcwd.c [__DJGPP__]: Adjust for use of closedir from
	libsupp library.

	* gnulib/lib/savedir.c [__DJGPP__]: Adjust for use of closedir and
	 opendir from libsupp library.

	* gnulib/lib/mountlist.c [__DJGPP__]: Adjust for use of closedir and
	 opendir from libsupp library.


2008-06-15  Juan Manuel Guerrero  <juan.guerrero@gmx.de>


	* find/defs.h [__MSDOS__]: Add prototype of dos_signal_catcher.
	Declare global variable dos_starting_dir.

	* find/find.c [__MSDOS__]: Include signal.h.
	[__MSDOS__]: Define global variable dos_starting_dir.
	(main) [__MSDOS__]: Remeber starting dir so we can return if SIGINT is
	generated and assign dos_signal_catcher to SIGINT.

	* find/pred.c (launch) [__MSDOS__]: Remove assignment of dos signal
	catcher to SIGINT.
	[__MSDOS__]: Remove static definition of dos_signal_catcher.
	(dos_signal_catcher): If find is interrupted from inside itself
	return to the starting directory before aborting program execution.

	* gnulib/lib/getcwd.c (__getcwd) [HAVE_PARTLY_WORKING_GETCWD, __MSDOS__]:
	If DJGPP use its own getcwd() because the drive letter is required and
	not provided by the gnulib algorithm.


2008-05-25  Juan Manuel Guerrero  <juan.guerrero@gmx.de>


	* lib/savedirinfo.c (type_to_mode) [DT_LNK]: Compile code only if
	S_IFLNK is defined.


2008-05-24  Juan Manuel Guerrero  <juan.guerrero@gmx.de>


	* gnulib/lib/getcwd.c (__getcwd) [__MSDOS__]: Test also for non-POSIX
	root directories.


2008-05-22  Juan Manuel Guerrero  <juan.guerrero@gmx.de>


	* gnulib/lib/getcwd.c [__DJGPP__]: Adjust for use of opendir from
	libsupp library.


2008-05-20  Juan Manuel Guerrero  <juan.guerrero@gmx.de>


	* find/find.c (process_dir): Use ISSLASH to detect directory separating
	character.

	* find/parser.c (check_name_arg): Warn if MSDOS also.


2008-05-12  Juan Manuel Guerrero  <juan.guerrero@gmx.de>


	* find/find.c (fallback_stat) [ELOOP]: Compile code only if ELOOP is
	defined.
	(safely_chdir_nofollow) [ELOOP]: Compile code only if ELOOP is defined.

	* find/pred.c (mode_to_filetype) [S_IFLNK]: Compile code only if
	S_IFLNK is defined.
	(pred_fprintf) [ELOOP]: Compile code only if ELOOP is defined.


2008-05-09  Juan Manuel Guerrero  <juan.guerrero@gmx.de>


	* find/defs.h [__MSDOS__]: Add prototypes for pred_dosok, pred_dosokdir,
	pred_dosexec and pred_dosexecdir.

	* find/pred.c [__MSDOS__]: Add entries pred_dosok and pred_dosokdir
	into pred_table.
	[__MSDOS__]: Add definitions of pred_dosok and pred_dosokdir.
	[__MSDOS__]: Define and use macro IS_ABSOLUTE in pred_execdir and
	pred_okdir.
	(new_impl_pred_exec) [__MSDOS__, __DJGPP__]: Dossify pathname if
	requested.
	(pred_fprintf): Use ISSLASH to detect directory separating character.
	(pred_fprintf): For MSDOS check also for '\\'.



2008-05-08  Juan Manuel Guerrero  <juan.guerrero@gmx.de>


	* find/pred.c (mode_to_filetype) [S_IFSOCK]: Compile code only if
	S_IFSOCK is defined.


2008-05-04  Juan Manuel Guerrero  <juan.guerrero@gmx.de>


	* gnulib/lib/freadahead.c [__DJGPP__]: Include libc/file for the
	definition of _IOREAD, etc.

	* gnulib/lib/freading.c [__DJGPP__]: Include libc/file for the
	definition of _IOREAD, etc.

	* gnulib/lib/fseeko.c [__DJGPP__]: Include libc/file for the definition
	of _IOREAD, etc.
	[!HAVE_FSEEKO]: Do not undef fseeko.

	* lib/savedirinfo.c (type_to_mode) [DT_SOCK]: Compile code only if
	S_IFSOCK is defined.

	* find/defs.h [__DJGPP__]: dirname prototype collides with prototype
	from unistd.h.

	* find/pred.c [__MSDOS__]: Add entries pred_dosexec and pred_dosexecdir
	into pred_table.
	[__MSDOS__]: Add definitions of pred_dosexec and pred_dosexecdir.



2008-05-02  Juan Manuel Guerrero  <juan.guerrero@gmx.de>


	* find/parser.c [__MSDOS__]: Add declarations for the new functions
	parse_dosexec, parse_dosexecdir, parse_dosok and parse_dosokdir and
	the corresponding entries in parse_table.
	[__MSDOS__]: Add definitions for the new functions parse_dosexec,
	parse_dosexecdir, parse_dosok and parse_dosokdir.
	(parse_help) [__MSDOS__]: Add help for dosexec, dosexecdir, dosok
	and dosokdir options.
	(parse_fls) [__DJGPP__]: Clear _STAT_EXEC_MAGIC bit of
	_djstat_flags.  Tells stat and fstat to compute the execute
	access bit from the magic signature.
	(parse_ls) [__DJGPP__]: Clear _STAT_EXEC_MAGIC bit of
	_djstat_flags.  Tells stat and fstat to compute the execute
	access bit from the magic signature.
	(parse_help) [__MSDOS__]: Add help for dosexec and dosok
	options.
	(make_segment) [__DJGPP__]: Clear _STAT_EXEC_MAGIC bit of
	_djstat_flags.  Tells stat and fstat to compute the execute
	access bit from the magic signature.
	(parse_perm) [__DJGPP__]: Clear _STAT_EXEC_MAGIC bit of
	_djstat_flags.  Tells stat and fstat to compute the execute
	access bit from the magic signature.

	* find/find.c (main) [__DJGPP__]: Do not check for execute
	permissions if not required.
	(process_path): Save relative path.

	* find/pred.c [__MSDOS__]: Include process.h.  New functions
	dos_signal_catcher and waitpid and new macro DOS_PID.
	[__DJGPP__]: Ensure that 'find' will see all files, including
	those with SYSTEM and HIDDEN attributes.
	(launch) [__MSDOS__]: Assign dos signal catcher to SIGINT.
	[__MSDOS__]: Implement fork in a MSDOS possible way to
	launch child application.

	* find/find.1: MSDOS/DJGPP specific info added.

	* doc/find.texi: MSDOS/DJGPP specific info added.

	* locate/bigram.c [__DJGPP__]: Make disk image as small
	as possible.

	* locate/code.c [__DJGPP__]: Make disk image as small
	as possible, set _fmode to binary mode and define new
	macro SET_BINARY_MODE.
	(main): Use SET_BINARY_MODE to set file to binary mode
	if not connected to a console.

	* locate/frcode.c [__DJGPP__]: Make disk image as small
	as possible, set _fmode to binary mode and define new
	macro SET_BINARY_MODE.
	(main): Use SET_BINARY_MODE to set file to binary mode
	if not connected to a console.

	* locate/locate.c [__DJGPP__]: Set _fmode to binary mode.

	* locate/update.sh: Variable PATH_SEPARATOR added and set to colon.
	Set TMPDIR to cwd if not defined and not exists.
	Replace variable name $LOCATE_DB.n with n$LOCATE_DB to avoid
	file name conflicts when only SFN support is available.
	Replace file name 'updatedbXXXXXXXXX' with 'udbXXXXXXXXX'
	to avoid file name conflicts when only SFN support is available.
	Add DOS specific directories $TMP, $TEMP and $TMPDIR to the list
	of directories not to put in the database.

	* xargs/xargs.c [__MSDOS__]: New global variable dossify_args.
	if true, the command arguments are DOS-ified: all forward slashes
	in the arguments appended after the initial arguments, or inside
	the replace-string, are converted to DOS-style backslashes.  This
	is meant to be used for invoking DOS programs which don't
	understand Unix-style slashes.
	New macro SLASH_TO_BACKSLASH.
	[__MSDOS__]: dos-format is new entry in longopts[].
	[__MSDOS__]: Include process.h.  New functions dos_signal_catcher
	and wait and new macro DOS_PID.
	(main) [__MSDOS__]: For MSDOS allow different default echo cmd.
	(main) [__MSDOS__]: For MSDOS add new option 'D'.
	(read_line): Use SLASH_TO_BACKSLASH to dossify argument.
	(read_string): Use SLASH_TO_BACKSLASH to dossify argument.
	(main) [__MSDOS__]: Issue error message if multiple processes
	are requested.  Limit DOS command-line length to max. 126.
	Assign dos signal catcher to SIGSEGV, SIGFPE,  SIGTRAP, SIGNOFP,
	SIGINT,  SIGILL,  SIGABRT and SIGTERM.
	(xargs_do_exec) [__MSDOS__]: Spawn dos command.

	* xargs/xargs.1: MSDOS/DJGPP specific info added.

	* lib/nextelem.c [__MSDOS__]: New macro PATH_SEPARATOR.
	On MSDOS it is defined as semi colon, on all others it
	is colon.
	(next_element): Use PATH_SEPARATOR to check for colon or
	semi colon.








diff -aprNU5 findutils-4.2.33.orig/doc/find.texi findutils-4.2.33/doc/find.texi
--- findutils-4.2.33.orig/doc/find.texi	2007-12-08 16:00:30 +0000
+++ findutils-4.2.33/doc/find.texi	2008-06-27 01:28:20 +0000
@@ -508,13 +508,14 @@ searches.  The default is system-depende
 @table @code
 @item --database=@var{path}
 @itemx -d @var{path}
 Instead of searching the default file name database, search the file
 name databases in @var{path}, which is a colon-separated list of
-database file names.  You can also use the environment variable
-@code{LOCATE_PATH} to set the list of database files to search.  The
-option overrides the environment variable if both are used.
+database file names.  (A semicolon is used on MS-DOS systems.)
+You can also use the environment variable @code{LOCATE_PATH} to set the
+list of database files to search.  The option overrides the environment
+variable if both are used.
 @end table
 
 @node Shell Pattern Matching
 @subsection Shell Pattern Matching
 
@@ -523,11 +524,13 @@ names, to shell patterns.  A @dfn{shell 
 contain the following special characters, which are known as
 @dfn{wildcards} or @dfn{metacharacters}.
 
 You must quote patterns that contain metacharacters to prevent the
 shell from expanding them itself.  Double and single quotes both work;
-so does escaping with a backslash.
+so does escaping with a backslash.  (Don't use backslashes on MS-DOS,
+except for escaping quote characters, because backslashes in other
+places are treated as directory separators.)
 
 @table @code
 @item *
 Matches any zero or more characters.
 
@@ -544,11 +547,12 @@ underscore.  You can negate a class by p
 immediately after the opening bracket.  Thus, @samp{[^A-Z@@]} matches
 any character except an uppercase letter or an at sign.
 
 @item \
 Removes the special meaning of the character that follows it.  This
-works even in character classes.
+works even in character classes.  (On MS-DOS, only the quote characters
+! are protected by the backslash.)
 @end table
 
 In the @code{find} tests that do shell pattern matching (@samp{-name},
 @samp{-wholename}, etc.), wildcards in the pattern will match a
 @samp{.}  at the beginning of a file name.  This is also the case for
@@ -1197,22 +1201,25 @@ built by @samp{-exec ... \+} or @samp{-e
 before the program is exited.
 @end deffn
 
 @deffn Option -noleaf
 Do not optimize by assuming that directories contain 2 fewer
-subdirectories than their hard link count.  This option is needed when
-searching filesystems that do not follow the Unix directory-link
+subdirectories than their hard link count.  This option might be needed
+when searching filesystems that do not follow the Unix directory-link
 convention, such as CD-ROM or MS-DOS filesystems or AFS volume mount
 points.  Each directory on a normal Unix filesystem has at least 2
 hard links: its name and its @file{.}  entry.  Additionally, its
 subdirectories (if any) each have a @file{..}  entry linked to that
 directory.  When @code{find} is examining a directory, after it has
 statted 2 fewer subdirectories than the directory's link count, it
 knows that the rest of the entries in the directory are
 non-directories (@dfn{leaf} files in the directory tree).  If only the
 files' names need to be examined, there is no need to stat them; this
 gives a significant increase in search speed.
+Usually, you won't need this option even on MS-DOS systems, so unless
+you see that some subdirectories aren't listed, don't use it: it makes
+@code{find} run 2 to 4 times slower.
 @end deffn
 
 @deffn Option -ignore_readdir_race
 If a file disappears after its name has been read from a directory but
 before @code{find} gets around to examining the file with @code{stat},
@@ -1262,15 +1269,39 @@ filesystem types vary among different ve
 list of filesystem types that are accepted on some version of Unix or
 another is:
 @example
 ext2 ext3 proc sysfs ufs 4.2 4.3 nfs tmp mfs S51K S52K
 @end example
+
+The DJGPP port of @code{find} recognizes the following filesystem types:
+
+@table @code
+@item hd
+a hard (aka fixed) disk
+@item fd
+a floppy disk
+@item cdrom
+a CD-ROM disk
+@item ram
+a RAM-disk
+@item net
+a networked drive
+@item dblsp
+a disk compressed with the DblSpace method
+@item stac
+a disk compressed with the Stacker method
+@item subst
+a SUBSTed disk
+@item join
+a JOINed disk
+@end table
+
 You can use @samp{-printf} with the @samp{%F} directive to see the
 types of your filesystems.  The @samp{%D} directive shows the device
 number.  @xref{Print File Information}.  @samp{-fstype} is usually
-used with @samp{-prune} to avoid searching remote filesystems
-(@pxref{Directories}).
+used with @samp{-prune} to avoid searching remote filesystems or
+removable media (@pxref{Directories}).
 @end deffn
 
 @node Combining Primaries With Operators
 @section Combining Primaries With Operators
 
@@ -1452,10 +1483,14 @@ you want a newline at the end of the str
 True; like @samp{-printf} but write to @var{file} like @samp{-fprint}
 (@pxref{Print File Name}).  The output file is always created, even if
 no output is ever sent to it.
 @end deffn
 
+When you work under @code{COMMAND.COM} or any of its work-alikes, you
+have to double every @samp{%} character, because they are special to
+those shells.
+
 @menu
 * Escapes::
 * Format Directives::
 * Time Formats::
 @end menu
@@ -1505,10 +1540,16 @@ supported, as applied to string (%s) typ
 Format flags (like @samp{#} for example) may not work as you expect
 because many of the fields, even numeric ones, are printed with %s.
 The format flag @samp{-} does work; it forces left-alignment of the
 field.
 
+On MS-DOS, you will have to type 2 @samp{%} characters for each one you
+want to pass to @code{find}.  That's because one of them is removed by
+the standard shell @code{COMMAND.COM} which uses @samp{%} for
+environment variable substitution.  Thus, you will have to write
+@samp{%%f} for the filename and @samp{%%%%} for the literal @samp{%}.
+
 @samp{%%} is a literal percent sign.  A @samp{%} character followed by
 an unrecognised character (i.e., not a known directive or @code{printf}
 field width and precision specifier), is discarded (but the
 unrecognised character is printed), and a warning message is printed
 to the standard error output (because it was probably a typo).  Don't
@@ -1850,10 +1891,36 @@ file.
 While some implementations of @code{find} replace the @samp{@{@}} only
 where it appears on its own in an argument, GNU @code{find} replaces
 @samp{@{@}} wherever it appears.
 @end deffn
 
+@deffn Action -dosexec command ;
+Like @samp{-exec}, but submits the filename to @var{command} in MS-DOS
+format by converting all Unix-style forward slashes to DOS-style
+backslashes.  This is useful for invoking native DOS programs and
+commands internal to @code{COMMAND.COM} that don't understand Unix-style
+forward slashes.  Note that the above conversion is done unconditionally
+and you cannot avoid it by using any quotes; in particular, @code{find}
+couldn't care less if the arguments aren't filenames at all.  Also note
+that the way this action is implemented, it affects all the @samp{-exec}
+and @samp{-ok} (@pxref{Querying}) actions for this invocation of
+@code{find}; so mixing @samp{-exec}, @samp{-ok} and @samp{-dosexec}
+might be unwise unless the programs involved understand both kinds of
+slashes.
+
+For example, here is a command that will rename each file with a
+@file{.cpp} extension to have a @file{.cc} extension, in the current
+directory and all of its subdirectories:
+
+@example
+find . -name '*.cpp' -dosexec command /c ren @{@} '*.cc' ;
+@end example
+
+(Note that on MS-DOS you don't have to quote the @samp{@{@}} construct
+and the semicolon.)
+@end deffn
+
 
 @node Multiple Files
 @subsection Multiple Files
 
 Sometimes you need to process files one at a time.  But usually this
@@ -1918,23 +1985,24 @@ this:
 xargs @r{[}@var{option}@dots{}@r{]} @r{[}@var{command} @r{[}@var{initial-arguments}@r{]}@r{]}
 @end example
 
 @code{xargs} normally reads arguments from the standard input.  These
 arguments are delimited by blanks (which can be protected with double
-or single quotes or a backslash) or newlines.  It executes the
-@var{command} (default is @file{/bin/echo}) one or more times with any
-@var{initial-arguments} followed by arguments read from standard
-input.  Blank lines on the standard input are ignored.
+or single quotes or a backslash) or newlines.  It executes the @var{command}
+(default is  @file{echo} on MS-DOS systems and @file{/bin/echo} elsewhere)
+one or more times with any @var{initial-arguments} followed by arguments
+read from standard input.  Blank lines on the standard input are ignored.
 
 Instead of blank-delimited names, it is safer to use @samp{find
 -print0} or @samp{find -fprint0} and process the output by giving the
 @samp{-0} or @samp{--null} option to GNU @code{xargs}, GNU @code{tar},
 GNU @code{cpio}, or @code{perl}.  The @code{locate} command also has a
 @samp{-0} or @samp{--null} option which does the same thing.
 
-You can use shell command substitution (backquotes) to process a list
-of arguments, like this:
+Except with MS-DOS native shells (that don't support command
+substitution), you can use shell command substitution (backquotes)
+to process a list of arguments, like this:
 
 @example
 grep -l sprintf `find $HOME -name '*.c' -print`
 @end example
 
@@ -2167,10 +2235,17 @@ for this option is @samp{-L} as this is 
 Use at most @var{max-args} arguments per command line.  Fewer than
 @var{max-args} arguments will be used if the size (see the @samp{-s}
 option) is exceeded, unless the @samp{-x} option is given, in which
 case @code{xargs} will exit.
 
+@item --dos-format
+@item -D
+Convert the filenames to DOS format by replacing forward slashes with
+backslashes before submitting the filenames to the command.  Implies a
+limit on the command-line length that is 127 characters plus the length
+of the command name.
+
 @item --max-chars=@var{max-chars}
 @itemx -s @var{max-chars}
 Use at most @var{max-chars} characters per command line, including the
 command initial arguments and the terminating nulls at the ends of the
 argument strings.  If you specify a value for this option which is too
@@ -2184,12 +2259,30 @@ and how this is affected by any other op
 Run up to @var{max-procs} processes at a time; the default is 1.  If
 @var{max-procs} is 0, @code{xargs} will run as many processes as
 possible at a time.  Use the @samp{-n}, @samp{-s}, or @samp{-L} option
 with @samp{-P}; otherwise chances are that the command will be run
 only once.
+
+On MS-DOS, you cannot run more than 1 process at a time.
 @end table
 
+When you run @code{xargs} on MS-DOS, the maxumum length of the arguments
+is further limited by the inherent restriction in the operating system
+call that invokes child programs.  When the child program starts, it
+gets the command-line tail which cannot be longer than 126 characters.
+When DJGPP programs are invoked by @code{xargs}, they don't suffer from
+this limitation, so @code{xargs} does not automatically limit the
+maximum command-line length so that it won't get into the way of
+benefits from using DJGPP programs.  It is your responsibility to know
+which programs can and which cannot get long command lines, and use the
+@code{-s 126} option with those which cannot.  If any of the commands
+are invoked with @code{-dosexec} action (@pxref{Single File}),
+@code{xargs} automatically impose the 126-character restriction.
+(Actually, only the tail of the command, without the command name
+itself, is limited to 126 characters, so @code{xargs} limits the command
+line to 126 + 1 blank + the length of the command name.)
+
 @node Interspersing File Names
 @subsubsection Interspersing File Names
 
 @code{xargs} can insert the name of the file it is processing between
 arguments you give for the command.  Unless you also give options to
@@ -2273,10 +2366,21 @@ is expanded to a relative path starting 
 starting directories, rather than just the basename of the matched
 file.  If the command is run, its standard input is redirected from
 @file{/dev/null}.
 @end deffn
 
+@deffn Action -dosok command ;
+Like @samp{-dosexec} (@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.  Like
+@samp{-dosexec}, this action also affects all the other @samp{-ok} and
+@samp{-exec} (@pxref{Single File}) actions for this invocation of
+@code{find}; so mixing @samp{-exec}, @samp{-ok} and @samp{-dosok} might
+be unwise unless the programs involved understand both kinds of
+slashes.
+@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 invocation of the command (@pxref{Limiting Command
 Size}).
@@ -2365,10 +2469,13 @@ scripts) in the file @file{sbins} and th
 @example
 find /usr/local -type f -perm /a=x \
   \( -execdir unstripped '@{@}' \; -fprint ubins -o -fprint sbins \)
 @end example
 
+Note that due to limitations of native MS-DOS shells, this technique is
+unavailable on MS-DOS (@code{COMMAND.COM} doesn't return the exit code
+of the last program it executed).
 
 @node Databases, File Permissions, Actions, Top
 @chapter File Name Databases
 
 The file name databases used by @code{locate} contain lists of files
@@ -2508,11 +2615,12 @@ and count bytes made printable:
 @node Old Database Format
 @subsection Old Database Format
 
 The old database format is used by Unix @code{locate} and @code{find}
 programs and earlier releases of the GNU ones.  @code{updatedb}
-produces this format if given the @samp{--old-format} option.
+produces this format if given the @samp{--old-format} option
+(supported by the MS-DOS @file{updatedb.bat} batch file).
 
 Old versions of GNU @code{locate} fail to correctly handle very long
 file names, possibly leading to security problems relating to a heap
 buffer overrun.  @xref{Security Considerations for locate}, for a
 detailed explanation.
@@ -2952,10 +3060,13 @@ You can also use the environment variabl
 @item --netuser=@var{user}
 The user to search network directories as, using @code{su}.  Default
 @code{user} is @code{daemon}.  You can also use the environment variable
 @code{NETUSER} to set this user.
 
+Note that the simplified @file{updatedb.bat} batch file used on MS-DOS
+doesn't support these options.
+
 @item --old-format
 Generate a @code{locate} database in the old format, for compatibility
 with versions of @code{locate} other than GNU @code{locate}.  Using
 this option means that @code{locate} will not be able to properly
 handle non-ASCII characters in file names (that is, file names
diff -aprNU5 findutils-4.2.33.orig/find/defs.h findutils-4.2.33/find/defs.h
--- findutils-4.2.33.orig/find/defs.h	2007-12-08 14:00:44 +0000
+++ findutils-4.2.33/find/defs.h	2008-06-27 01:28:20 +0000
@@ -343,11 +343,13 @@ int following_links(void);
 
 
 /* find library function declarations.  */
 
 /* dirname.c */
+#ifndef __DJGPP__
 char *dirname PARAMS((char *path));
+#endif
 
 /* error.c */
 void error PARAMS((int status, int errnum, char *message, ...));
 
 /* listfile.c */
@@ -436,10 +438,16 @@ boolean pred_cmin PARAMS((char *pathname
 boolean pred_cnewer PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_comma PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_ctime PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_delete PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_empty PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
+#ifdef __MSDOS__
+boolean pred_dosexec PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
+boolean pred_dosexecdir PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
+boolean pred_dosok PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
+boolean pred_dosokdir PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
+#endif
 boolean pred_exec PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_execdir PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_false PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_fls PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_fprint PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
@@ -496,10 +504,15 @@ char *find_pred_name PARAMS((PRED_FUNC p
 void print_tree PARAMS((FILE*, struct predicate *node, int indent));
 void print_list PARAMS((FILE*, struct predicate *node));
 void print_optlist PARAMS((FILE *fp, struct predicate *node));
 #endif /* DEBUG */
 
+#ifdef __MSDOS__
+extern char const *dos_starting_dir;
+void dos_signal_catcher PARAMS((int sig));
+#endif
+
 /* tree.c */
 struct predicate *
 get_expr PARAMS((struct predicate **input, short int prev_prec));
 boolean opt_expr PARAMS((struct predicate **eval_treep));
 boolean mark_stat PARAMS((struct predicate *tree));
diff -aprNU5 findutils-4.2.33.orig/find/find.1 findutils-4.2.33/find/find.1
--- findutils-4.2.33.orig/find/find.1	2007-04-15 19:04:34 +0000
+++ findutils-4.2.33/find/find.1	2008-06-27 01:28:20 +0000
@@ -511,10 +511,18 @@ section for examples of the use of the `
 command is run once for each matched file.
 The command is executed in the starting directory.   There are
 unavoidable security problems surrounding use of the \-exec option;
 you should use the \-execdir option instead.  
 
+.IP "\-dosexec \fIcommand\fR ;"
+Like \-exec, but all the slashes in the filename are converted to
+DOS-style backslashes.  This should be used with DOS prograns which
+don't understand pathnames with Unix-style forward slashes.  Note that
+this option is currently implemented in a way that makes it effect
+global: it also affects any \-exec or \-ok options that follow
+\-dosexec on the command line.
+
 .IP "\-exec \fIcommand\fR {} +"
 This variant of the \-exec option runs the specified command on the
 selected files, but the command line is built by appending each
 selected file name at the end; the total number of invocations of the
 command will be much less than the number of matched files.  The
@@ -578,10 +586,18 @@ Like \-exec but ask the user first (on t
 response does not start with `y' or `Y', do not run the command, and
 return false.  If the command is run, its standard input is redirected
 from
 .BR /dev/null .
 
+.IP "\-dosok \fIcommand\fR ;"
+Like \-ok, but all the slashes in the filename are converted to
+DOS-style backslashes.  This should be used with DOS prograns which
+don't understand pathnames with Unix-style forward slashes.  Note that
+this option is currently implemented in a way that makes it effect
+global: it also affects any \-ok or \-exec options that follow \-dosok
+on the command line.
+
 .IP \-print
 True; print the full file name on the standard output, followed by a
 newline.   If you are piping the output of 
 .B find 
 into another program and there is the faintest possibility that the files 
diff -aprNU5 findutils-4.2.33.orig/find/find.c findutils-4.2.33/find/find.c
--- findutils-4.2.33.orig/find/find.c	2007-12-08 14:00:44 +0000
+++ findutils-4.2.33/find/find.c	2008-06-27 01:28:20 +0000
@@ -33,10 +33,14 @@
 
 #include <errno.h>
 #include <assert.h>
 
 
+#ifdef __MSDOS__
+#include <signal.h>
+#endif
+
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #else
 #include <sys/file.h>
 #endif
@@ -91,10 +95,14 @@ static void complete_pending_execs   (st
 
 
 
 static boolean default_prints PARAMS((struct predicate *pred));
 
+#ifdef __MSDOS__
+char const *dos_starting_dir = ".";
+#endif
+
 /* Name this program was run with. */
 char *program_name;
 
 /* All predicates for each path to process. */
 struct predicate *predicates;
@@ -174,11 +182,13 @@ fallback_stat(const char *name, struct s
 #endif
       return lstat(name, p);
 
     case EACCES:
     case EIO:
+#ifdef ELOOP
     case ELOOP:
+#endif
     case ENAMETOOLONG:
 #ifdef EOVERFLOW
     case EOVERFLOW:	    /* EOVERFLOW is not #defined on UNICOS. */
 #endif
     default:
@@ -443,10 +453,23 @@ main (int argc, char **argv)
 
 #if defined(DEBUG_STAT)
   options.xstat = debug_stat;
 #endif /* !DEBUG_STAT */
 
+#ifdef __DJGPP__
+  /* This makes `find' 40% faster when we aren't required
+     to know about execute permissions.  */
+  _djstat_flags |= _STAT_EXEC_MAGIC;
+#endif
+
+#ifdef __MSDOS__
+  /* On MS-DOS, CWD is global, so we must remember where we were before
+     changing dirs, and return there if the program is interrupted by SIGINT.  */
+  signal(SIGINT, dos_signal_catcher);
+  dos_starting_dir = xgetcwd();
+#endif
+
   if (getenv("POSIXLY_CORRECT"))
     options.output_block_size = 512;
   else
     options.output_block_size = 1024;
 
@@ -1258,12 +1281,14 @@ safely_chdir_nofollow(const char *dest,
   fd = open(dest, O_RDONLY|extraflags);
   if (fd < 0)
     {
       switch (errno)
 	{
+#ifdef ELOOP
 	case ELOOP:
 	  return SafeChdirFailSymlink; /* This is why we use O_NOFOLLOW */
+#endif
 	case ENOENT:
 	  return SafeChdirFailNonexistent;
 	default:
 	  return SafeChdirFailDestUnreadable;
 	}
@@ -1698,11 +1723,14 @@ process_path (char *pathname, char *name
       else if (stat_buf.st_dev != root_dev)
 	state.stop_at_current_level = true;
     }
 
   if (options.do_dir_first && state.curdepth >= options.mindepth)
-    apply_predicate (pathname, &stat_buf, eval_tree);
+    {
+      state.rel_pathname = name;
+      apply_predicate (pathname, &stat_buf, eval_tree);
+    }
 
 #ifdef DEBUG
   fprintf(stderr, "pathname = %s, stop_at_current_level = %d\n",
 	  pathname, state.stop_at_current_level);
 #endif /* DEBUG */
@@ -1861,11 +1889,11 @@ process_dir (char *pathname, char *name,
       unsigned cur_path_size;	/* Bytes allocated for `cur_path'. */
       register unsigned file_len; /* Length of each path to process. */
       register unsigned pathname_len; /* PATHLEN plus trailing '/'. */
       boolean did_stat = false;
       
-      if (pathname[pathlen - 1] == '/')
+      if (ISSLASH(pathname[pathlen - 1]))
 	pathname_len = pathlen + 1; /* For '\0'; already have '/'. */
       else
 	pathname_len = pathlen + 2; /* For '/' and '\0'. */
       cur_path_size = 0;
       cur_path = NULL;
diff -aprNU5 findutils-4.2.33.orig/find/parser.c findutils-4.2.33/find/parser.c
--- findutils-4.2.33.orig/find/parser.c	2007-12-08 14:00:46 +0000
+++ findutils-4.2.33/find/parser.c	2008-06-27 01:28:20 +0000
@@ -86,10 +86,16 @@ static boolean parse_comma         PARAM
 static boolean parse_ctime         PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
 static boolean parse_daystart      PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
 static boolean parse_delete        PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
 static boolean parse_d             PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
 static boolean parse_depth         PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
+#ifdef __MSDOS__
+static boolean parse_dosexec       PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
+static boolean parse_dosexecdir    PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
+static boolean parse_dosok         PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
+static boolean parse_dosokdir      PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
+#endif
 static boolean parse_empty         PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
 static boolean parse_exec          PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
 static boolean parse_execdir       PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
 static boolean parse_false         PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
 static boolean parse_fls           PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
@@ -199,11 +205,11 @@ char *find_pred_name PARAMS((PRED_FUNC p
 /* GNU find predicates that are not mentioned in POSIX.2 are marked `GNU'.
    If they are in some Unix versions of find, they are marked `Unix'. */
 
 static struct parser_table const parse_table[] =
 {
- PARSE_PUNCTUATION("!",                     negate),
+  PARSE_PUNCTUATION("!",                     negate),
   PARSE_PUNCTUATION("not",                   negate),	     /* GNU */
   PARSE_PUNCTUATION("(",                     openparen),
   PARSE_PUNCTUATION(")",                     closeparen),
   PARSE_PUNCTUATION(",",                     comma),	     /* GNU */
   PARSE_PUNCTUATION("a",                     and),
@@ -216,10 +222,16 @@ static struct parser_table const parse_t
   PARSE_TEST       ("ctime",                 ctime),
   PARSE_POSOPT     ("daystart",              daystart),	     /* GNU */
   PARSE_ACTION     ("delete",                delete), /* GNU, Mac OS, FreeBSD */
   PARSE_OPTION     ("d",                     d), /* Mac OS X, FreeBSD, NetBSD, OpenBSD, but deprecated  in favour of -depth */
   PARSE_OPTION     ("depth",                 depth),
+#ifdef __MSDOS__
+  {ARG_ACTION,      "dosexec",               parse_dosexec, pred_dosexec}, /* MS-DOS */
+  PARSE_ACTION     ("dosexecdir",            dosexecdir),    /* MS-DOS */
+  PARSE_ACTION     ("dosok",                 dosok),         /* MS-DOS */
+  PARSE_ACTION     ("dosokdir",              dosokdir),	     /* MS-DOS */
+#endif
   PARSE_TEST       ("empty",                 empty),	     /* GNU */
   {ARG_ACTION,      "exec",    parse_exec, pred_exec}, /* POSIX */
   PARSE_ACTION     ("execdir",               execdir), /* *BSD, GNU */
   PARSE_ACTION     ("fls",                   fls),	     /* GNU */
   PARSE_POSOPT     ("follow",                follow),  /* GNU, Unix */
@@ -609,11 +621,45 @@ parse_d (const struct parser_table* entr
       error (0, 0,
 	     _("warning: the -d option is deprecated; please use -depth instead, because the latter is a POSIX-compliant feature."));
     }
   return parse_depth(entry, argv, arg_ptr);
 }
- 
+
+#ifdef __MSDOS__
+
+int dossify_filename = false;
+
+static boolean
+parse_dosexec (const struct parser_table* entry, char **argv, int *arg_ptr)
+{
+  dossify_filename = true;
+  return parse_exec (entry, argv, arg_ptr);
+}
+
+static boolean
+parse_dosexecdir (const struct parser_table* entry, char **argv, int *arg_ptr)
+{
+  dossify_filename = true;
+  return insert_exec_ok ("-execdir", entry, argv, arg_ptr);
+}
+
+static boolean
+parse_dosok (const struct parser_table* entry, char **argv, int *arg_ptr)
+{
+  dossify_filename = true;
+  return parse_ok (entry, argv, arg_ptr);
+}
+
+static boolean
+parse_dosokdir (const struct parser_table* entry, char **argv, int *arg_ptr)
+{
+  dossify_filename = true;
+  return insert_exec_ok ("-okdir", entry, argv, arg_ptr);
+}
+
+#endif /* __MSDOS__ */
+
 static boolean
 parse_empty (const struct parser_table* entry, char **argv, int *arg_ptr)
 {
   (void) argv;
   (void) arg_ptr;
@@ -657,10 +703,13 @@ parse_fls (const struct parser_table* en
     return false;
   our_pred = insert_primary (entry);
   our_pred->args.stream = open_output_file (argv[*arg_ptr]);
   our_pred->side_effects = our_pred->no_default_print = true;
   (*arg_ptr)++;
+#ifdef __DJGPP__
+  _djstat_flags &= ~_STAT_EXEC_MAGIC;
+#endif
   return true;
 }
 
 static boolean 
 parse_fprintf (const struct parser_table* entry, char **argv, int *arg_ptr)
@@ -798,16 +847,27 @@ tests (N can be +N or -N or N): -amin N 
       -links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE"));
   puts (_("\
       -nouser -nogroup -path PATTERN -perm [+-]MODE -regex PATTERN\n\
       -wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N\n\
       -used N -user NAME -xtype [bcdpfls]\n"));
+#ifdef __MSDOS__
+  puts (_("\
+actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print \n\
+      -fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit\n\
+      -exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;\n\
+      -execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;\n\
+      -dosexec COMMAND ; -dosexec COMMAND {} + -dosok COMMAND ;\n\
+      -dosexecdir COMMAND ; -dosexecdir COMMAND {} + -dosokdir COMMAND ;\n\
+"));
+#else
   puts (_("\
 actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print \n\
       -fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit\n\
       -exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;\n\
       -execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;\n\
 "));
+#endif
   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>."));
   exit (0);
 }
@@ -853,10 +913,17 @@ check_name_arg(const char *pred, const c
   if (options.warnings && strchr(arg, '/'))
     {
       error(0, 0,_("warning: Unix filenames usually don't contain slashes (though pathnames do).  That means that '%s %s' will probably evaluate to false all the time on this system.  You might find the '-wholename' test more useful, or perhaps '-samefile'.  Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ %s'."),
 	    pred, arg, arg);
     }
+#ifdef __MSDOS__
+  if (options.warnings && strchr(arg, '\\'))
+    {
+      error(0, 0,_("warning: DOS filenames usually don't contain backslashes (though pathnames do).  That means that '%s %s' will probably evaluate to false all the time on this system.  You might find the '-wholename' test more useful, or perhaps '-samefile'.  Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ %s'."),
+	    pred, arg, arg);
+    }
+#endif
   return true;			/* allow it anyway */
 }
 
 
 
@@ -955,10 +1022,13 @@ parse_ls (const struct parser_table* ent
   (void) &argv;
   (void) &arg_ptr;
 
   our_pred = insert_primary (entry);
   our_pred->side_effects = our_pred->no_default_print = true;
+#ifdef __DJGPP__
+  _djstat_flags &= ~_STAT_EXEC_MAGIC;
+#endif
   return true;
 }
 
 static boolean
 parse_maxdepth (const struct parser_table* entry, char **argv, int *arg_ptr)
@@ -1377,10 +1447,15 @@ parse_perm (const struct parser_table* e
 	       "match all files."),
 	     argv[*arg_ptr]);
     }
 
   memcpy (our_pred->args.perm.val, perm_val, sizeof perm_val);
+#if defined(__DJGPP__) && 0
+  if ((perm_val[0] & (S_IXUSR | S_IXGRP | S_IXOTH)) ||
+      (perm_val[1] & (S_IXUSR | S_IXGRP | S_IXOTH)))
+    _djstat_flags &= ~_STAT_EXEC_MAGIC;
+#endif
   (*arg_ptr)++;
   return true;
 }
 
 boolean
@@ -2074,10 +2149,13 @@ make_segment (struct segment **segment, 
       break;
 
     case 'm':			/* mode as octal number (perms only) */
       *fmt++ = 'o';
       fprintf_stat_needed = true;
+#ifdef __DJGPP__
+      _djstat_flags &= ~_STAT_EXEC_MAGIC;
+#endif
       break;
     }
   *fmt = '\0';
 
   return &(*segment)->next;
diff -aprNU5 findutils-4.2.33.orig/find/pred.c findutils-4.2.33/find/pred.c
--- findutils-4.2.33.orig/find/pred.c	2007-12-08 14:00:46 +0000
+++ findutils-4.2.33/find/pred.c	2008-06-27 01:28:20 +0000
@@ -47,10 +47,20 @@
 #else
 /* See locate.c for explanation as to why not use (String) */
 # define N_(String) String
 #endif
 
+#ifdef __MSDOS__
+# ifdef __DJGPP__
+#  include <libc/unconst.h>
+# endif
+# include <process.h>
+# define IS_SLASH(c)             ((c) == '/' || (c) == '\\')
+# define HAS_DRIVE_SPECIFIER(p)  ((p)[0] >= 'A' && (p)[0] <= 'z' && (p)[1] == ':')
+# define IS_ABSOLUTE(p)          ((HAS_DRIVE_SPECIFIER(p) && IS_SLASH((p)[2])) || IS_SLASH((p)[0]))
+#endif
+
 #if !defined(SIGCHLD) && defined(SIGCLD)
 #define SIGCHLD SIGCLD
 #endif
 
 
@@ -70,10 +80,16 @@
 # if HAVE_NDIR_H
 #  include <ndir.h>
 # endif
 #endif
 
+#ifdef __DJGPP__
+/* This ensures `find' will see all the files, including
+   those with SYSTEM and HIDDEN attributes.  */
+int __opendir_flags = __OPENDIR_FIND_HIDDEN;
+#endif
+
 #ifdef CLOSEDIR_VOID
 /* Fake a return value. */
 #define CLOSEDIR(d) (closedir (d), 0)
 #else
 #define CLOSEDIR(d) closedir (d)
@@ -172,10 +188,16 @@ struct pred_assoc pred_table[] =
   {pred_cnewer, "cnewer  "},
   {pred_comma, ",       "},
   {pred_ctime, "ctime   "},
   {pred_delete, "delete  "},
   {pred_empty, "empty   "},
+#ifdef __MSDOS__
+  {pred_dosexec, "dosexec    "},
+  {pred_dosexecdir, "dosexecdir "},
+  {pred_dosok, "dosok    "},
+  {pred_dosokdir, "dosokdir "},
+#endif
   {pred_exec, "exec    "},
   {pred_execdir, "execdir "},
   {pred_false, "false   "},
   {pred_fprint, "fprint  "},
   {pred_fprint0, "fprint0 "},
@@ -446,10 +468,14 @@ pred_empty (char *pathname, struct stat 
     return (stat_buf->st_size == 0);
   else
     return (false);
 }
 
+#ifdef __MSDOS__
+extern int dossify_filename;
+#endif
+
 static boolean
 new_impl_pred_exec (const char *pathname, struct stat *stat_buf,
 		    struct predicate *pred_ptr,
 		    const char *prefix, size_t pfxlen)
 {
@@ -479,10 +505,20 @@ new_impl_pred_exec (const char *pathname
     {
       int i;
 
       for (i=0; i<execp->num_args; ++i)
 	{
+#if defined(__MSDOS__) && defined(__DJGPP__)
+	  if (dossify_filename && execp->replace_vec[i][0] == '{' && execp->replace_vec[i][1] == '}')
+	    {
+	      char *path_name;
+
+	      for (path_name = unconst(pathname, char *); *path_name; path_name++)
+	        if (*path_name == '/')
+	          *path_name = '\\';
+	    }
+#endif
 	  bc_do_insert(&execp->ctl,
 		       &execp->state,
 		       execp->replace_vec[i],
 		       strlen(execp->replace_vec[i]),
 		       prefix, pfxlen,
@@ -495,20 +531,46 @@ new_impl_pred_exec (const char *pathname
 					&execp->state);
     }
 }
 
 
+#ifdef __MSDOS__
+boolean
+pred_dosexec (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
+{
+  return pred_exec (pathname, stat_buf, pred_ptr);
+}
+
+boolean
+pred_dosexecdir (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
+{
+  return pred_execdir (pathname, stat_buf, pred_ptr);
+}
+
+boolean
+pred_dosok (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
+{
+  return pred_ok (pathname, stat_buf, pred_ptr);
+}
+
+boolean
+pred_dosokdir (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
+{
+  return pred_okdir (pathname, stat_buf, pred_ptr);
+}
+#endif
+
 boolean
 pred_exec (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
 {
   return new_impl_pred_exec(pathname, stat_buf, pred_ptr, NULL, 0);
 }
 
 boolean
 pred_execdir (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
 {
-   const char *prefix = (state.rel_pathname[0] == '/') ? NULL : "./";
+   const char *prefix = !IS_ABSOLUTE(state.rel_pathname) ? dossify_filename ? ".\\" : "./" : NULL;
    (void) &pathname;
    return new_impl_pred_exec (state.rel_pathname, stat_buf, pred_ptr,
 			      prefix, (prefix ? 2 : 0));
 }
 
@@ -560,12 +622,16 @@ pred_fprint0 (char *pathname, struct sta
 
 static char*
 mode_to_filetype(mode_t m)
 {
   return
+#ifdef S_IFSOCK
     m == S_IFSOCK ? "s" :
+#endif
+#ifdef S_IFLNK
     m == S_IFLNK  ? "l" :
+#endif
     m == S_IFREG  ? "f" :
     m == S_IFBLK  ? "b" :
     m == S_IFDIR  ? "d" :
     m == S_IFCHR  ? "c" :
 #ifdef S_IFDOOR
@@ -878,14 +944,16 @@ pred_fprintf (char *pathname, struct sta
 	      {
 		if ( errno == ENOENT ) {
 		  fprintf (fp, segment->text, "N");
 		  break;
 		};
+#ifdef ELOOP
 		if ( errno == ELOOP ) {
 		  fprintf (fp, segment->text, "L");
 		  break;
 		};
+#endif
 		error (0, errno, "%s", pathname);
 		/* exit_status = 1;
 		return (false); */
 	      }
 	      fprintf (fp, segment->text,
@@ -1190,11 +1258,11 @@ pred_ok (char *pathname, struct stat *st
 }
 
 boolean
 pred_okdir (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
 {
-  const char *prefix = (state.rel_pathname[0] == '/') ? NULL : "./";
+  const char *prefix = !IS_ABSOLUTE(state.rel_pathname) ? dossify_filename ? ".\\" : "./" : NULL;
   if (is_ok(pred_ptr->args.exec_vec.replace_vec[0], pathname))
     return new_impl_pred_exec (state.rel_pathname, stat_buf, pred_ptr, 
 			       prefix, (prefix ? 2 : 0));
   else
     return false;
@@ -1550,10 +1618,61 @@ prep_child_for_exec (boolean close_stdin
     }
 }
 
 
 
+#ifdef __MSDOS__
+
+volatile sig_atomic_t proc_status;
+volatile sig_atomic_t child_running = 0;
+
+/* Don't die if the child got the signal.  */
+void dos_signal_catcher (int sig)
+{
+  if (child_running)
+    {
+      signal (sig, dos_signal_catcher);
+      proc_status |= (sig << 8);
+      if (sig == SIGINT)
+        exit (1);
+      else
+        return;
+    }
+  else
+    {
+      if (chdir (dos_starting_dir) < 0)
+        {
+          error (0, errno, "%s", dos_starting_dir);
+          _exit (1);
+        }
+      signal (sig, SIG_DFL);
+      kill (getpid (), sig);
+    }
+}
+
+#define DOS_PID ((pid_t)42)
+
+/* Replacement for the `waitpid' library function that doesn't
+   merely fail.  */
+pid_t waitpid (pid_t pid, int *status, int options __attribute__((unused)))
+{
+  if ((child_running) || (pid != DOS_PID))
+  {
+    errno = ECHILD;
+    return (pid_t)(-1);
+  }
+  *status = proc_status;
+  return DOS_PID;
+}
+
+/* The macros we need with `wait'.  */
+
+#undef  WTERMSIG
+#define WTERMSIG(s)	((s) >> 8)
+
+#endif /* __MSDOS__ */
+
 int
 launch (const struct buildcmd_control *ctl,
 	struct buildcmd_state *buildstate)
 {
   int wait_status;
@@ -1570,13 +1689,52 @@ launch (const struct buildcmd_control *c
   
   /* Make sure to listen for the kids.  */
   if (first_time)
     {
       first_time = 0;
+#ifdef __MSDOS__
+      /*  Assignment of dos_signal_catcher to SIGINT already done in main().  */
+#else
       signal (SIGCHLD, SIG_DFL);
+#endif
     }
 
+#ifdef __MSDOS__
+
+  /* On MS-DOS, CWD is global, so we must remember where we were
+     before spawning a child, and return there after the child exits.  */
+  {
+    char *cwd =  xgetcwd ();
+    int spawn_result;
+
+    if (chdir (starting_dir) < 0)
+      {
+	error (0, errno, "%s", starting_dir);
+	_exit (1);
+      }
+
+    proc_status = 0;
+    child_running = 1;
+    spawn_result = spawnvp(P_WAIT, buildstate->cmd_argv[0], buildstate->cmd_argv);
+    child_running = 0;
+
+    if (spawn_result == -1)
+      error (0, errno, "%s", buildstate->cmd_argv[0]);
+    else
+      proc_status |= (spawn_result & 0xff);
+
+    if (chdir (cwd) < 0)
+      {
+	error (0, errno, "%s", cwd);
+	_exit (1);
+      }
+
+    child_pid = DOS_PID;
+  }
+
+#else /* !__MSDOS__ */
+
   child_pid = fork ();
   if (child_pid == -1)
     error (1, errno, _("cannot fork"));
   if (child_pid == 0)
     {
@@ -1606,10 +1764,12 @@ launch (const struct buildcmd_control *c
       execvp (buildstate->cmd_argv[0], buildstate->cmd_argv);
       error (0, errno, "%s", buildstate->cmd_argv[0]);
       _exit (1);
     }
 
+#endif /* !__MSDOS__ */
+
 
   /* In parent; set up for next time. */
   bc_clear_args(ctl, buildstate);
 
   
diff -aprNU5 findutils-4.2.33.orig/gnulib/lib/freadahead.c findutils-4.2.33/gnulib/lib/freadahead.c
--- findutils-4.2.33.orig/gnulib/lib/freadahead.c	2007-12-08 13:46:52 +0000
+++ findutils-4.2.33/gnulib/lib/freadahead.c	2008-06-27 01:28:20 +0000
@@ -17,10 +17,17 @@
 #include <config.h>
 
 /* Specification.  */
 #include "freadahead.h"
 
+#if __DJGPP__
+ /*
+  *  Include libc/file.h for _IOREAD definition.
+  */
+# include <libc/file.h>
+#endif
+
 size_t
 freadahead (FILE *fp)
 {
 #if defined _IO_ferror_unlocked     /* GNU libc, BeOS */
   if (fp->_IO_write_ptr > fp->_IO_write_base)
diff -aprNU5 findutils-4.2.33.orig/gnulib/lib/freading.c findutils-4.2.33/gnulib/lib/freading.c
--- findutils-4.2.33.orig/gnulib/lib/freading.c	2007-12-08 13:46:52 +0000
+++ findutils-4.2.33/gnulib/lib/freading.c	2008-06-27 01:28:20 +0000
@@ -17,10 +17,17 @@
 #include <config.h>
 
 /* Specification.  */
 #include "freading.h"
 
+#if __DJGPP__
+ /*
+  *  Include libc/file.h for _IOREAD definition.
+  */
+# include <libc/file.h>
+#endif
+
 /* Don't use glibc's __freading function in glibc < 2.7, see
    <http://sourceware.org/bugzilla/show_bug.cgi?id=4359>  */
 #if !(HAVE___FREADING && (!defined __GLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)))
 
 bool
diff -aprNU5 findutils-4.2.33.orig/gnulib/lib/fseeko.c findutils-4.2.33/gnulib/lib/fseeko.c
--- findutils-4.2.33.orig/gnulib/lib/fseeko.c	2007-12-08 13:47:16 +0000
+++ findutils-4.2.33/gnulib/lib/fseeko.c	2008-06-27 01:28:20 +0000
@@ -21,15 +21,24 @@
 #include <stdio.h>
 
 /* Get off_t and lseek.  */
 #include <unistd.h>
 
+#if __DJGPP__
+ /*
+  *  Include libc/file.h for _IOERR definition.
+  */
+# include <libc/file.h>
+#endif
+
+#ifndef __DJGPP__
 #undef fseeko
 #if !HAVE_FSEEKO
 # undef fseek
 # define fseeko fseek
 #endif
+#endif
 
 int
 rpl_fseeko (FILE *fp, off_t offset, int whence)
 {
 #if LSEEK_PIPE_BROKEN
diff -aprNU5 findutils-4.2.33.orig/gnulib/lib/getcwd.c findutils-4.2.33/gnulib/lib/getcwd.c
--- findutils-4.2.33.orig/gnulib/lib/getcwd.c	2007-12-08 13:46:52 +0000
+++ findutils-4.2.33/gnulib/lib/getcwd.c	2008-06-27 01:32:58 +0000
@@ -96,12 +96,15 @@
 # define __readdir readdir
 #endif
 
 /* The results of opendir() in this file are not used with dirfd and fchdir,
    therefore save some unnecessary recursion in fchdir.c.  */
+#ifndef __DJGPP__
+/*  Make opendir() closedir() and from libsupp visible.  */
 #undef opendir
 #undef closedir
+#endif
 
 /* Get the name of the current working directory, and put it in SIZE
    bytes of BUF.  Returns NULL if the directory couldn't be determined or
    SIZE was too small.  If successful, returns BUF.  In GNU, if BUF is
    NULL, an array is allocated with `malloc'; the array is SIZE bytes long,
@@ -138,11 +141,11 @@ __getcwd (char *buf, size_t size)
   register char *dirp;
   struct stat st;
   size_t allocated = size;
   size_t used;
 
-#if HAVE_PARTLY_WORKING_GETCWD
+#if HAVE_PARTLY_WORKING_GETCWD || __MSDOS__
   /* The system getcwd works, except it sometimes fails when it
      shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.  If
      AT_FDCWD is not defined, the algorithm below is O(N**2) and this
      is much slower than the system getcwd (at least on GNU/Linux).
      So trust the system getcwd's results unless they look
@@ -151,11 +154,11 @@ __getcwd (char *buf, size_t size)
      Use the system getcwd even if we have openat support, since the
      system getcwd works even when a parent is unreadable, while the
      openat-based approach does not.  */
 
 # undef getcwd
-  dir = getcwd (buf, size);
+  dir = getcwd (buf, size ? size : PATH_MAX);
   if (dir || (errno != ERANGE && !is_ENAMETOOLONG (errno) && errno != ENOENT))
     return dir;
 #endif
 
   if (size == 0)
@@ -189,10 +192,17 @@ __getcwd (char *buf, size_t size)
   if (__lstat ("/", &st) < 0)
     goto lose;
   rootdev = st.st_dev;
   rootino = st.st_ino;
 
+#ifdef __MSDOS__
+  if (__lstat ("\\", &st) < 0)
+    goto lose;
+  rootdev = st.st_dev;
+  rootino = st.st_ino;
+#endif
+
   while (!(thisdev == rootdev && thisino == rootino))
     {
       struct dirent *d;
       dev_t dotdev;
       ino_t dotino;
diff -aprNU5 findutils-4.2.33.orig/gnulib/lib/mountlist.c findutils-4.2.33/gnulib/lib/mountlist.c
--- findutils-4.2.33.orig/gnulib/lib/mountlist.c	2007-12-08 13:46:52 +0000
+++ findutils-4.2.33/gnulib/lib/mountlist.c	2008-06-27 01:41:34 +0000
@@ -143,12 +143,15 @@
 #undef open
 #undef close
 
 /* The results of opendir() in this file are not used with dirfd and fchdir,
    therefore save some unnecessary work in fchdir.c.  */
+#ifndef __DJGPP__
+/*  Make opendir() closedir() and from libsupp visible.  */
 #undef opendir
 #undef closedir
+#endif
 
 #ifndef ME_DUMMY
 # define ME_DUMMY(Fs_name, Fs_type)		\
     (strcmp (Fs_type, "autofs") == 0		\
      || strcmp (Fs_type, "none") == 0		\
diff -aprNU5 findutils-4.2.33.orig/gnulib/lib/openat.c findutils-4.2.33/gnulib/lib/openat.c
--- findutils-4.2.33.orig/gnulib/lib/openat.c	2007-12-08 13:46:52 +0000
+++ findutils-4.2.33/gnulib/lib/openat.c	2008-06-27 01:28:20 +0000
@@ -231,11 +231,15 @@ fdopendir (int fd)
    then give a diagnostic and exit nonzero.
    Otherwise, this function works just like Solaris' fstatat.  */
 
 #define AT_FUNC_NAME fstatat
 #define AT_FUNC_F1 lstat
+#if __DJGPP__ == 2 && __DJGPP_MINOR__ == 3
+#define AT_FUNC_F2 libsupp_stat_2_03
+#else
 #define AT_FUNC_F2 stat
+#endif
 #define AT_FUNC_USE_F1_COND flag == AT_SYMLINK_NOFOLLOW
 #define AT_FUNC_POST_FILE_PARAM_DECLS , struct stat *st, int flag
 #define AT_FUNC_POST_FILE_ARGS        , st
 #include "at-func.c"
 #undef AT_FUNC_NAME
diff -aprNU5 findutils-4.2.33.orig/gnulib/lib/savedir.c findutils-4.2.33/gnulib/lib/savedir.c
--- findutils-4.2.33.orig/gnulib/lib/savedir.c	2007-12-08 13:46:52 +0000
+++ findutils-4.2.33/gnulib/lib/savedir.c	2008-06-27 01:32:58 +0000
@@ -42,12 +42,15 @@
 # define NAME_SIZE_DEFAULT 512
 #endif
 
 /* The results of opendir() in this file are not used with dirfd and fchdir,
    therefore save some unnecessary work in fchdir.c.  */
+#ifndef __DJGPP__
+/*  Make opendir() closedir() and from libsupp visible.  */
 #undef opendir
 #undef closedir
+#endif
 
 /* Return a freshly allocated string containing the file names
    in directory DIRP, separated by '\0' characters;
    the end is marked by two '\0' characters in a row.
    Return NULL (setting errno) if DIRP cannot be read or closed.
diff -aprNU5 findutils-4.2.33.orig/gnulib/lib/xstrndup.c findutils-4.2.33/gnulib/lib/xstrndup.c
--- findutils-4.2.33.orig/gnulib/lib/xstrndup.c	2007-12-08 13:46:52 +0000
+++ findutils-4.2.33/gnulib/lib/xstrndup.c	2008-06-27 01:28:20 +0000
@@ -21,10 +21,14 @@
 #include "xstrndup.h"
 
 #include <string.h>
 #include "xalloc.h"
 
+#ifdef __DJGPP__
+# include <libsupp.h>
+#endif
+
 /* Return a newly allocated copy of at most N bytes of STRING.
    In other words, return a copy of the initial segment of length N of
    STRING.  */
 char *
 xstrndup (const char *string, size_t n)
diff -aprNU5 findutils-4.2.33.orig/lib/nextelem.c findutils-4.2.33/lib/nextelem.c
--- findutils-4.2.33.orig/lib/nextelem.c	2007-12-08 14:00:56 +0000
+++ findutils-4.2.33/lib/nextelem.c	2008-06-27 01:28:20 +0000
@@ -33,10 +33,16 @@
 #endif
 #if defined(STDC_HEADERS)
 #include <stdlib.h>
 #endif
 
+#ifdef __MSDOS__
+#define PATH_SEPARATOR  ';'
+#else
+#define PATH_SEPARATOR  ':'
+#endif
+
 #include "nextelem.h"
 
 
 /* Return the next element of a colon-separated path.
    A null entry in the path is equivalent to "." (the current directory).
@@ -73,11 +79,11 @@ next_element (const char *new_path, int 
     }
 
   start = end;
   final_colon = 1;		/* Maybe there will be one.  */
 
-  end = strchr (start, ':');
+  end = strchr (start, PATH_SEPARATOR);
   if (end == start)
     {
       /* An empty path element.  */
       *end++ = '\0';
       return curdir_ok ? "." : "";
diff -aprNU5 findutils-4.2.33.orig/lib/savedirinfo.c findutils-4.2.33/lib/savedirinfo.c
--- findutils-4.2.33.orig/lib/savedirinfo.c	2007-12-08 14:00:56 +0000
+++ findutils-4.2.33/lib/savedirinfo.c	2008-06-27 01:28:20 +0000
@@ -105,14 +105,14 @@ type_to_mode(unsigned type)
     case DT_BLK:  return S_IFBLK;
 #endif		  
 #ifdef DT_REG	  
     case DT_REG:  return S_IFREG;
 #endif		  
-#ifdef DT_LNK	  
+#if defined(DT_LNK) && defined(S_IFLNK)
     case DT_LNK:  return S_IFLNK;
 #endif
-#ifdef DT_SOCK
+#if defined(DT_SOCK) && defined(S_IFSOCK)
     case DT_SOCK: return S_IFSOCK;
 #endif
     default:
       return 0;			/* Unknown. */
     }
diff -aprNU5 findutils-4.2.33.orig/locate/bigram.c findutils-4.2.33/locate/bigram.c
--- findutils-4.2.33.orig/locate/bigram.c	2007-12-08 14:00:56 +0000
+++ findutils-4.2.33/locate/bigram.c	2008-06-27 01:28:20 +0000
@@ -47,10 +47,19 @@
 #include "closeout.h"
 
 /* The name this program was run with.  */
 char *program_name;
 
+#ifdef __DJGPP__
+/* Make our disk image as small as possible.  */
+
+#include <crt0.h>
+
+void __crt0_load_environment_file(char *_app_name) {}
+char **__crt0_glob_function(char *_argument) { return 0; }
+#endif
+
 /* Return the length of the longest common prefix of strings S1 and S2. */
 
 static int
 prefix_length (char *s1, char *s2)
 {
diff -aprNU5 findutils-4.2.33.orig/locate/code.c findutils-4.2.33/locate/code.c
--- findutils-4.2.33.orig/locate/code.c	2007-12-08 14:00:56 +0000
+++ findutils-4.2.33/locate/code.c	2008-06-27 01:28:20 +0000
@@ -84,10 +84,33 @@ char *program_name;
 
 /* The 128 most common bigrams in the file list, padded with NULs
    if there are fewer.  */
 static char bigrams[257] = {0};
 
+#ifdef __DJGPP__
+# include <fcntl.h>
+# include <io.h>
+# include <unistd.h>
+
+int _fmode = O_BINARY;
+
+# define SET_BINARY_MODE(file)             \
+  do {                                     \
+    if (!isatty(fileno((file))))           \
+      setmode (fileno((file)), O_BINARY);  \
+  } while (0)
+
+/* Make our disk image as small as possible.  */
+
+#include <crt0.h>
+
+void __crt0_load_environment_file(char *_app_name) {}
+char **__crt0_glob_function(char *_argument) { return 0; }
+#else /*  !__DJGPP__  */
+# define SET_BINARY_MODE(file)  /*  Empty.  */
+#endif /*  !__DJGPP__  */
+
 /* Return the offset of PATTERN in STRING, or -1 if not found. */
 
 static int
 strindex (char *string, char *pattern)
 {
@@ -172,10 +195,12 @@ main (int argc, char **argv)
       fprintf (stderr, "%s: ", argv[0]);
       perror (argv[1]);
       return 1;
     }
 
+  SET_BINARY_MODE(stdout);
+
   pathsize = oldpathsize = 1026; /* Increased as necessary by getline.  */
   path = xmalloc (pathsize);
   oldpath = xmalloc (oldpathsize);
 
   /* Set to empty string, to force the first prefix count to 0.  */
diff -aprNU5 findutils-4.2.33.orig/locate/frcode.c findutils-4.2.33/locate/frcode.c
--- findutils-4.2.33.orig/locate/frcode.c	2007-12-08 14:00:56 +0000
+++ findutils-4.2.33/locate/frcode.c	2008-06-27 01:28:20 +0000
@@ -101,10 +101,33 @@
 
 #include "locatedb.h"
 #include <getopt.h>
 #include "closeout.h"
 
+#ifdef __DJGPP__
+# include <fcntl.h>
+# include <io.h>
+# include <unistd.h>
+
+int _fmode = O_BINARY;
+
+# define SET_BINARY_MODE(file)             \
+  do {                                     \
+    if (!isatty(fileno((file))))           \
+      setmode (fileno((file)), O_BINARY);  \
+  } while (0)
+
+/* Make our disk image as small as possible.  */
+
+# include <crt0.h>
+
+void __crt0_load_environment_file(char *_app_name) {}
+char **__crt0_glob_function(char *_argument) { return 0; }
+#else /*  !__DJGPP__  */
+# define SET_BINARY_MODE(file)  /*  Empty.  */
+#endif /*  !__DJGPP__  */
+
 char *xmalloc PARAMS((size_t));
 
 /* The name this program was run with.  */
 char *program_name;
 
@@ -212,10 +235,11 @@ main (int argc, char **argv)
       usage (stderr);
       return 1;
     }
 
 
+  SET_BINARY_MODE(stdout);
 
   fwrite (LOCATEDB_MAGIC, sizeof (LOCATEDB_MAGIC), 1, stdout);
 
   while ((line_len = getdelim (&path, &pathsize, delimiter, stdin)) > 0)
     {
diff -aprNU5 findutils-4.2.33.orig/locate/locate.c findutils-4.2.33/locate/locate.c
--- findutils-4.2.33.orig/locate/locate.c	2007-12-08 14:00:56 +0000
+++ findutils-4.2.33/locate/locate.c	2008-06-27 01:28:20 +0000
@@ -118,10 +118,15 @@ extern int errno;
  * like: static const char buf[] = ("string");
  */
 # define N_(String) String
 #endif
 
+#ifdef __DJGPP__
+# include <fcntl.h>
+int _fmode = O_BINARY;
+#endif
+
 #include "locatedb.h"
 #include "xalloc.h"
 #include "error.h"
 #include "human.h"
 #include "dirname.h"
diff -aprNU5 findutils-4.2.33.orig/locate/updatedb.sh findutils-4.2.33/locate/updatedb.sh
--- findutils-4.2.33.orig/locate/updatedb.sh	2007-12-08 14:00:56 +0000
+++ findutils-4.2.33/locate/updatedb.sh	2008-06-27 01:28:20 +0000
@@ -100,10 +100,12 @@ select_shell() {
 
 
 # You can set these in the environment, or use command-line options,
 # to override their defaults:
 
+PATH_SEPARATOR=:
+
 # Any global options for find?
 : ${FINDOPTIONS=}
 
 # What shell shoud we use?  We should use a POSIX-ish sh.
 : ${SHELL="/bin/sh"}
@@ -113,11 +115,11 @@ select_shell() {
 
 # Network (NFS, AFS, RFS, etc.) directories to put in the database.
 : ${NETPATHS=}
 
 # Directories to not put in the database, which would otherwise be.
-: ${PRUNEPATHS="/tmp /usr/tmp /var/tmp /afs /amd /sfs"}
+: ${PRUNEPATHS="$TMP $TEMP $TMPDIR /tmp /usr/tmp /var/tmp /afs /amd /sfs"}
 
 # Trailing slashes result in regex items that are never matched, which 
 # is not what the user will expect.   Therefore we now reject such 
 # constructs.
 for p in $PRUNEPATHS; do
@@ -137,12 +139,14 @@ test -z "$PRUNEREGEX" &&
 # Directory to hold intermediate files.
 if test -d /var/tmp; then
   : ${TMPDIR=/var/tmp}
 elif test -d /usr/tmp; then
   : ${TMPDIR=/usr/tmp}
-else
+elif test -d /tmp; then
   : ${TMPDIR=/tmp}
+else
+  : ${TMPDIR=.}
 fi
 export TMPDIR
 
 # The user to search network directories as.
 : ${NETUSER=daemon}
@@ -180,12 +184,12 @@ else
 fi
 
 # Make and code the file list.
 # Sort case insensitively for users' convenience.
 
-rm -f $LOCATE_DB.n
-trap 'rm -f $LOCATE_DB.n; exit' HUP TERM
+rm -f n$LOCATE_DB
+trap 'rm -f n$LOCATE_DB; exit' HUP TERM
 
 if test $old = no; then
 
 # FIXME figure out how to sort null-terminated strings, and use -print0.
 if {
@@ -216,46 +220,46 @@ if [ "$myuid" = 0 ]; then
     # : A4
     $find $NETPATHS $FINDOPTIONS \( -type d -regex "$PRUNEREGEX" -prune \) -o $print_option ||
     exit $?
   fi
 fi
-} | $sort -f | $frcode $frcode_options > $LOCATE_DB.n
+} | $sort -f | $frcode $frcode_options > n$LOCATE_DB
 then
     # OK so far
     true
 else
     rv=$?
-    echo "Failed to generate $LOCATE_DB.n" >&2
-    rm -f $LOCATE_DB.n
+    echo "Failed to generate n$LOCATE_DB" >&2
+    rm -f n$LOCATE_DB
     exit $rv
 fi
 
 # To avoid breaking locate while this script is running, put the
 # results in a temp file, then rename it atomically.
-if test -s $LOCATE_DB.n; then
+if test -s n$LOCATE_DB; then
   rm -f $LOCATE_DB
-  mv $LOCATE_DB.n $LOCATE_DB
+  mv n$LOCATE_DB $LOCATE_DB
   chmod 644 $LOCATE_DB
 else
   echo "updatedb: new database would be empty" >&2
-  rm -f $LOCATE_DB.n
+  rm -f n$LOCATE_DB
 fi
 
 else # old
 
-if ! bigrams=`mktemp -t updatedbXXXXXXXXX`; then
+if ! bigrams=`mktemp -t udbXXXXXXXXX`; then
     echo tempfile failed
     exit 1
 fi
 
-if ! filelist=`mktemp -t updatedbXXXXXXXXX`; then
+if ! filelist=`mktemp -t udbXXXXXXXXX`; then
     echo tempfile failed
     exit 1
 fi
 
-rm -f $LOCATE_DB.n
-trap 'rm -f $bigrams $filelist $LOCATE_DB.n; exit' HUP TERM
+rm -f n$LOCATE_DB
+trap 'rm -f $bigrams $filelist n$LOCATE_DB; exit' HUP TERM
 
 # Alphabetize subdirectories before file entries using tr.  James Woods says:
 # "to get everything in monotonic collating sequence, to avoid some
 # breakage i'll have to think about."
 {
@@ -293,23 +297,23 @@ fi
 # Compute the (at most 128) most common bigrams in the file list.
 $bigram $bigram_opts < $filelist | sort | uniq -c | sort -nr |
   awk '{ if (NR <= 128) print $2 }' | tr -d '\012' > $bigrams
 
 # Code the file list.
-$code $bigrams < $filelist > $LOCATE_DB.n
+$code $bigrams < $filelist > n$LOCATE_DB
 
 rm -f $bigrams $filelist
 
 # To reduce the chances of breaking locate while this script is running,
 # put the results in a temp file, then rename it atomically.
-if test -s $LOCATE_DB.n; then
+if test -s n$LOCATE_DB; then
   rm -f $LOCATE_DB
-  mv $LOCATE_DB.n $LOCATE_DB
+  mv n$LOCATE_DB $LOCATE_DB
   chmod 644 $LOCATE_DB
 else
   echo "updatedb: new database would be empty" >&2
-  rm -f $LOCATE_DB.n
+  rm -f n$LOCATE_DB
 fi
 
 fi
 
 exit 0
diff -aprNU5 findutils-4.2.33.orig/xargs/xargs.1 findutils-4.2.33/xargs/xargs.1
--- findutils-4.2.33.orig/xargs/xargs.1	2006-03-31 21:55:04 +0000
+++ findutils-4.2.33/xargs/xargs.1	2008-06-27 01:28:20 +0000
@@ -3,11 +3,11 @@
 xargs \- build and execute command lines from standard input
 .SH SYNOPSIS
 .B xargs
 [\-0prtx] [\-E eof-str] [\-e[eof-str]] [\-\-eof[=eof-str]] [\-\-null] 
 [\-d delimiter] [\-\-delimiter delimiter] 
-[\-I replace-str] [\-i[replace-str]] [\-\-replace[=replace-str]] 
+[\-I replace-str] [\-i[replace-str]] [\-\-replace[=replace-str]] [\-\-dos-format] 
 [\-l[max-lines]] [\-L max-lines] [\-\-max\-lines[=max-lines]] [\-n max-args] [\-\-max\-args=max-args] 
 [\-s max-chars] [\-\-max\-chars=max-chars] [\-P max-procs] [\-\-max\-procs=max-procs]
 [\-\-interactive] [\-\-verbose] [\-\-exit] [\-\-no\-run\-if\-empty] 
 [\-\-arg\-file=file] [\-\-show\-limits] [\-\-version] [\-\-help] 
 [command [initial-arguments]]
@@ -102,10 +102,22 @@ Implies \fI\-x\fP and \fI\-L 1\fP.
 .I "\-\-replace[=replace-str], \-i[replace-str]"
 This option is a synonym for \-I\fIreplace-str\fR if \fIreplace-str\fR
 is specified, and for \-I{} otherwise.  This option is deprecated; use
 \-I instead.
 .TP
+.I "\-\-dos-format, \-D"
+Convert all filenames to DOS format.  This option causes
+.B xargs
+to convert all Unix-style forward slashes to DOS-style backslashes.
+It should be used on MS-DOS systems when the command invoked by
+.B xargs
+doesn't understand forward slashes in filenames.  Note that all the
+slashes are unconditionally converted, whether the arguments are or
+aren't filenames, and whether they are in- or outside quotes or
+protected by a backslash.  Implies \fI\-s 126\fP (actually, 126 plus
+the length of the first initial argument).
+.TP
 .I "\-L max-lines"
 Use at most \fImax-lines\fR nonblank input lines per command line.
 Trailing blanks cause an input line to be logically continued on the
 next input line.  Implies \fI\-x\fR.
 .TP
diff -aprNU5 findutils-4.2.33.orig/xargs/xargs.c findutils-4.2.33/xargs/xargs.c
--- findutils-4.2.33.orig/xargs/xargs.c	2007-12-08 14:01:00 +0000
+++ findutils-4.2.33/xargs/xargs.c	2008-06-27 01:28:20 +0000
@@ -234,10 +234,27 @@ static boolean query_before_executing = 
 /* The delimiter for input arguments.   This is only consulted if the 
  * -0 or -d option had been given.
  */
 static char input_delimiter = '\0';
 
+#ifdef __MSDOS__
+/* If true, the command arguments are DOS-ified: all forward slashes
+  in the arguments appended after the initial arguments, or inside
+   the replace-string, are converted to DOS-style backslashes.  This
+   is meant to be used for invoking DOS programs which don't
+   understand Unix-style slashes.  */
+static boolean dossify_args = false;
+
+#define SLASH_TO_BACKSLASH(c)        \
+  do {                               \
+    if (dossify_args && (c) == '/')  \
+      (c) = '\\';                    \
+  } while (0)
+#else
+#define SLASH_TO_BACKSLASH(c)  /*  empty  */
+#endif
+
 
 static struct option const longopts[] =
 {
   {"null", no_argument, NULL, '0'},
   {"arg-file", required_argument, NULL, 'a'},
@@ -251,10 +268,13 @@ static struct option const longopts[] =
   {"max-chars", required_argument, NULL, 's'},
   {"verbose", no_argument, NULL, 't'},
   {"show-limits", no_argument, NULL, 'S'},
   {"exit", no_argument, NULL, 'x'},
   {"max-procs", required_argument, NULL, 'P'},
+#ifdef __MSDOS__
+  {"dos-format", no_argument, NULL, 'D'},
+#endif
   {"version", no_argument, NULL, 'v'},
   {"help", no_argument, NULL, 'h'},
   {NULL, no_argument, NULL, 0}
 };
 
@@ -270,10 +290,56 @@ static void wait_for_proc_all PARAMS ((v
 static long parse_num PARAMS ((char *str, int option, long min, long max, int fatal));
 static void usage PARAMS ((FILE * stream));
 
 
 
+#ifdef __MSDOS__
+
+#include <process.h>
+
+char *xgetcwd PARAMS ((void));
+
+volatile sig_atomic_t proc_status;
+volatile sig_atomic_t child_running;
+
+/* Don't die if the child got the signal.  */
+static void
+dos_signal_catcher (int sig)
+{
+  if (child_running)
+    {
+      signal (sig, dos_signal_catcher);
+      proc_status |= (sig << 8);
+      return;
+    }
+  else
+    {
+      signal (sig, SIG_DFL);
+      kill (getpid (), sig);
+    }
+}
+
+#define DOS_PID ((pid_t)42)
+
+/* Replacement for the `wait' library function that doesn't
+   merely fail.  */
+pid_t wait (int *status)
+{
+  if (child_running)
+    return (pid_t)(-1);
+  *status = proc_status;
+  return DOS_PID;
+}
+
+/* The macros we need with `wait'.  */
+
+#undef  WTERMSIG
+#define WTERMSIG(s)	((s) >> 8)
+
+#endif /* __MSDOS__ */
+
+
 static char 
 get_char_oct_or_hex_escape(const char *s)
 {
   const char * p;
   int base = 8;
@@ -400,11 +466,15 @@ main (int argc, char **argv)
 {
   int optc;
   int show_limits = 0;			/* --show-limits */
   int always_run_command = 1;
   char *input_file = "-"; /* "-" is stdin */
+#ifdef __MSDOS__
+  char *default_cmd = "echo";
+#else
   char *default_cmd = "/bin/echo";
+#endif
   int (*read_args) PARAMS ((void)) = read_line;
   void (*act_on_init_result)(void) = noop;
   enum BC_INIT_STATUS bcstatus;
 
   program_name = argv[0];
@@ -452,11 +522,16 @@ main (int argc, char **argv)
        * adjusted via the -s option.
        */
       bc_use_sensible_arg_max(&bc_ctl);
     }
   
-  while ((optc = getopt_long (argc, argv, "+0a:E:e::i::I:l::L:n:prs:txP:d:",
+  while ((optc = getopt_long (argc, argv,
+#ifdef __MSDOS__
+                              "+0a:E:e::i::I:l::L:n:prs:txP:d:D",
+#else
+                              "+0a:E:e::i::I:l::L:n:prs:txP:d:",
+#endif
 			      longopts, (int *) 0)) != -1)
     {
       switch (optc)
 	{
 	case '0':
@@ -569,10 +644,16 @@ main (int argc, char **argv)
 
         case 'a':
           input_file = optarg;
           break;
 
+#ifdef __MSDOS__
+	case 'D':
+	  dossify_args = true;
+	  break;
+#endif
+
 	case 'v':
 	  printf (_("GNU xargs version %s\n"), version_string);
 	  printf (_("Built using GNU gnulib version %s\n"), gnulib_version);
 	  return 0;
 
@@ -665,12 +746,40 @@ main (int argc, char **argv)
     }
   
   linebuf = (char *) xmalloc (bc_ctl.arg_max + 1);
   bc_state.argbuf = (char *) xmalloc (bc_ctl.arg_max + 1);
 
+#ifdef __MSDOS__
+  if (proc_max > 1)
+    {
+      error (0, 0, "multiple processes not supported on MS-DOS");
+      proc_max = 1;
+    }
+
+  /* DOS programs cannot take command-line tails longer
+     than 126 characters, so the command line is limited to
+     126 + one blank + the length of the program name.  */
+  if (dossify_args)
+    {
+      size_t maxlen = 126 + 1 + strlen (argv[optind]);
+
+      if (bc_ctl.arg_max > maxlen)
+	bc_ctl.arg_max = maxlen;
+    }
+
+  signal (SIGSEGV, dos_signal_catcher);
+  signal (SIGFPE,  dos_signal_catcher);
+  signal (SIGTRAP, dos_signal_catcher);
+  signal (SIGNOFP, dos_signal_catcher);
+  signal (SIGINT,  dos_signal_catcher);
+  signal (SIGILL,  dos_signal_catcher);
+  signal (SIGABRT, dos_signal_catcher);
+  signal (SIGTERM, dos_signal_catcher);
+#else
   /* Make sure to listen for the kids.  */
   signal (SIGCHLD, SIG_DFL);
+#endif
 
   if (!bc_ctl.replace_pat)
     {
       for (; optind < argc; optind++)
 	bc_push_arg (&bc_ctl, &bc_state,
@@ -871,10 +980,11 @@ read_line (void)
       if (p >= endbuf)
         {
 	  exec_if_possible ();
 	  error (1, 0, _("argument line too long"));
 	}
+      SLASH_TO_BACKSLASH(c);
       *p++ = c;
 #else
       append_char_to_buf(&linebuf, &endbuf, &p, c);
 #endif
     }
@@ -928,10 +1038,11 @@ read_string (void)
       if (p >= endbuf)
         {
 	  exec_if_possible ();
 	  error (1, 0, _("argument line too long"));
 	}
+      SLASH_TO_BACKSLASH(c);
       *p++ = c;
     }
 }
 
 /* Print the arguments of the command to execute.
@@ -1014,10 +1125,36 @@ xargs_do_exec (const struct buildcmd_con
     {
       if (proc_max && procs_executing >= proc_max)
 	wait_for_proc (false);
       if (!query_before_executing && print_command)
 	print_args (false);
+#ifdef __MSDOS__
+
+      {
+	/* We should return to the same directory we started from
+	   to avoid side-effects of apps that change directories.  */
+	char *cwd = xgetcwd ();
+	int e, spawn_retval;
+
+	errno = 0;
+	proc_status = 0;
+	child_running = 1;
+	spawn_retval = spawnvp (P_WAIT, bc_state.cmd_argv[0], bc_state.cmd_argv);
+	child_running = 0;
+	e = errno;
+	chdir (cwd);
+	if (spawn_retval == -1)
+	  {
+	    error (0, e, "%s", bc_state.cmd_argv[0]);
+	    proc_status |= (e == ENOENT ? 127 : 126);
+	  }
+	else
+	  proc_status |= (spawn_retval & 0xff);
+	child = DOS_PID;
+      }
+
+#else /* !__MSDOS__ */
       /* If we run out of processes, wait for a child to return and
          try again.  */
       while ((child = fork ()) < 0 && errno == EAGAIN && procs_executing)
 	wait_for_proc (false);
       switch (child)
@@ -1030,10 +1167,11 @@ xargs_do_exec (const struct buildcmd_con
 	  execvp (bc_state.cmd_argv[0], bc_state.cmd_argv);
 	  error (0, errno, "%s", bc_state.cmd_argv[0]);
 	  _exit (errno == ENOENT ? 127 : 126);
 	  /*NOTREACHED*/
 	}
+#endif /* !__MSDOS__ */
       add_proc (child);
     }
 
   bc_clear_args(&bc_ctl, &bc_state);
   return 1;			/* Success */
