aboutsummaryrefslogtreecommitdiff
path: root/scripts/gen-sorted.awk
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-11-19 11:23:37 +0000
committerUlrich Drepper <drepper@redhat.com>1998-11-19 11:23:37 +0000
commitbb41a976a37574d81b6755b1d57c7ce47d8f9dcb (patch)
treee2cece2c6f82b9ae85acc1d5a0ca6c57c4a3baad /scripts/gen-sorted.awk
parent97dac76c11e1317222fb09913d695bab51ba7b3c (diff)
downloadglibc-bb41a976a37574d81b6755b1d57c7ce47d8f9dcb.tar
glibc-bb41a976a37574d81b6755b1d57c7ce47d8f9dcb.tar.gz
glibc-bb41a976a37574d81b6755b1d57c7ce47d8f9dcb.tar.bz2
glibc-bb41a976a37574d81b6755b1d57c7ce47d8f9dcb.zip
Update.
1998-11-19 Ulrich Drepper <drepper@cygnus.com> * Makeconfig: Add comment to all-subdirs definition. Add rule to generate sysd-sorted. Include this file and and set subdirs value to $(sorted-subdirs). * scripts/gen-sorted.awk: New file. * Make-dist (+tsrcs): Add Depend. * nscd/Depend: New file. * nss/Depend: New file. * rt/Depend: New file. * manual/errno.texi> Change the short text for ENODEV to "No such device".
Diffstat (limited to 'scripts/gen-sorted.awk')
-rwxr-xr-xscripts/gen-sorted.awk52
1 files changed, 52 insertions, 0 deletions
diff --git a/scripts/gen-sorted.awk b/scripts/gen-sorted.awk
new file mode 100755
index 0000000000..a943df6d2f
--- /dev/null
+++ b/scripts/gen-sorted.awk
@@ -0,0 +1,52 @@
+#! /usr/bin/awk -f
+# Generate sorted list of directories. The sorting is stable but with
+# dependencies between directories resolved by moving dependees in front.
+# (C) Copyright 1998 Free Software Foundation, Inc.
+# Written by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+BEGIN {
+ cnt = 0
+ dnt = 0
+}
+{
+ if ($1 ~ /depend/) {
+ from[dnt] = $2
+ to[dnt] = $3
+ ++dnt
+ } else {
+ all[cnt++] = $1
+ }
+}
+END {
+ do {
+ moved = 0
+ for (i = 0; i < dnt; ++i) {
+ for (j = 0; j < cnt; ++j) {
+ if (all[j] == from[i]) {
+ for (k = j + 1; k < cnt; ++k) {
+ if (all[k] == to[i]) {
+ break;
+ }
+ }
+ if (k < cnt) {
+ for (l = k - 1; l >= j; --l) {
+ all[l + 1] = all[l]
+ }
+ all[j] = to[i]
+ break;
+ }
+ }
+ }
+ if (j < cnt) {
+ moved = 1
+ break
+ }
+ }
+ } while (moved)
+
+ printf "sorted-subdirs = "
+ for (i = 0; i < cnt; ++i) {
+ printf "%s ", all[i];
+ }
+ printf "\n"
+}