Module Name:    src
Committed By:   christos
Date:           Tue May 14 14:57:09 UTC 2024

Modified Files:
        src/etc: makespec

Log Message:
Allow specific subdirectories to be added to the list


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/etc/makespec

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/makespec
diff -u src/etc/makespec:1.1 src/etc/makespec:1.2
--- src/etc/makespec:1.1	Tue May  7 16:30:33 2024
+++ src/etc/makespec	Tue May 14 10:57:08 2024
@@ -55,17 +55,40 @@ gettype() {
 	esac
 }
 
-if [ -z "$1" ]; then
-	echo "Usage: $0 <dir>" 1>&2
+usage() {
+	echo "Usage: $0 -d <base> <dir>..." 1>&2
 	exit 1
+}
+
+
+while getopts "d:" i; do
+	case $i in
+	d)
+		DIR="$OPTARG";;
+	*)
+		usage;;
+	esac
+done
+
+shift $((OPTIND - 1))
+
+if [ -z "$DIR" ] || [ -z "$1" ]; then
+	usage
 fi
 
-cd "$1"
-for i in $TYPES; do
+cd "$DIR"
+
+for d; do
+	case $d in
+	.);;
+	*)	d="./$d";;
+	esac
+	for i in $TYPES; do
 	
-	t=$(gettype $i)
-	m=$(getmode $i)
-	find . -type $i -exec \
-	    printf "%s type=$t uname=root gname=wheel mode=$m\n" {} \;
+		t=$(gettype $i)
+		m=$(getmode $i)
+		find $d -type $i -exec \
+		printf "%s type=$t uname=root gname=wheel mode=$m\n" {} \;
+	done
 
 done | sort

Reply via email to