forked from lattera/glibc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ulrich Drepper
committed
Jan 18, 1999
1 parent
37ce12d
commit d0d7d38
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#! /usr/bin/awk -f | ||
# Generate topologically sorted list of manual chapters. | ||
# (C) Copyright 1998, 1999 Free Software Foundation, Inc. | ||
# Written by Ulrich Drepper <[email protected]>, 1998. | ||
|
||
BEGIN { | ||
cnt = 0 | ||
dnt = 0 | ||
} | ||
{ | ||
to[dnt] = $1 | ||
from[dnt] = $2 | ||
++dnt | ||
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) | ||
|
||
for (i = 0; i < cnt; ++i) { | ||
print all[i]; | ||
} | ||
} |