[CUWiN-Dev] new patch for makeplist

David Young dyoung at pobox.com
Tue Jan 11 19:41:37 CST 2005


Bill,

Give this patch a shot.  It applies to src/distrib/sets/makeplist in
your 0.5.4 NetBSD sources.

Chase, will you accept a makeplist pull-up for the 0.5.4 sources,
or am I s.o.l. now? :-)

Dave

-- 
David Young             OJC Technologies
dyoung at ojctech.com      Urbana, IL * (217) 278-3933
-------------- next part --------------
Index: distrib/sets/makeplist
===================================================================
RCS file: /cvsroot/src/distrib/sets/makeplist,v
retrieving revision 1.15
diff -u -r1.15 makeplist
--- distrib/sets/makeplist	23 Jul 2004 15:11:26 -0000	1.15
+++ distrib/sets/makeplist	12 Jan 2005 01:17:43 -0000
@@ -60,24 +60,34 @@
 		print $1
 	}' | sort -u > $filename
 
-SELECTDIRS="-maxdepth 0 -type d"
-SELECTNONDIRS="-maxdepth 0 ! -type d"
+SELECTDIRS="-prune -type d"
+SELECTNONDIRS="! -type d -print -o ( -type d -prune )"
 
 cd $prefix
 #
-# match the directories
+# Match the directories.  Use find(1) to avoid repeat calls to
+# 'test -d'.
+#
+# This is a little clever.  I cannot use 'xargs find', because
+# find wants for the option arguments to follow the path arguments.
+# So I use 'xargs echo $SELECTDIRS' to make a maximum-length proto-command
+# line.  I use 'read' to peel the options off the front of the
+# command-line, and 'find $args $SELECTDIRS' to put them at the end.
 #
 xargs echo $SELECTDIRS < $filename | \
-while read ignore ignore ignore ignore args; do
+while read ignore ignore ignore args; do
 	[ -z "$args" ] && break 
 	find $args $SELECTDIRS
 done | awk '{ print "@dirrm " $1; }' > $dfilename
 
 #
-# match the non-directories
+# Match the non-directories.  Use find(1) to avoid repeat calls to
+# 'test ! -d'.  See 'Match the directories' for an explanation of the
+# cleverness.
 #
 xargs echo $SELECTNONDIRS < $filename | \
-while read ignore ignore ignore ignore ignore args; do
+while read ignore ignore ignore ignore ignore ignore ignore ignore ignore \
+    ignore args; do
 	[ -z "$args" ] && break 
 	find $args $SELECTNONDIRS
 done > $ffilename


More information about the CU-Wireless-Dev mailing list