1 # Read in commands.c and add texinfo commands. See Makefile.am.
7 if ($
0 ~
/!
BEGIN-HELP
-TEXT!
/) {
11 if ($
0 ~
/!
END-HELP
-TEXT!
/) {
14 else if ($
0 ~
/new_command\
(/) {
18 idx =
index($
0,"\\n")+7;
19 chapter =
substr($
0,idx
,length());
20 sub(/ \
*\
//,"",chapter
);
22 name =
sub(/^
[^
]*/,"&");
23 info =
"@node " $name
", !NEXT!, !PREV!, Commands\n"
24 info = info
"@chapter " chapter
"\n"
25 info = info
"@cindex " $name
" command\n"
26 info = info
"Syntax:\n"
27 info = info
"@example\n"
29 info = info
"@end example\n"
30 list
[list_total
"," "name"] = $name
44 list[list_total "," "chapter
"] = chapter
45 list[list_total "," "info
"] = info
46 list[list_total "," "desc
"] = desc
54 # Borrowed from http://awk.info/?TenLiners
56 function qsort(A, left, right, i, last) {
59 swap(A, left, left+int((right-left+1)*rand()))
61 for (i = left+1; i <= right; i++)
62 if (A[i "," "name
"] < A[left "," "name
"])
65 qsort(A, left, last-1)
66 qsort(A, last+1, right)
69 function swap(A, i, j, hrm) {
70 name = A[i "," "name
"];
71 chapter = A[i "," "chapter
"];
72 info = A[i "," "info
"];
73 desc = A[i "," "desc
"];
74 A[i "," "name
"] = A[j "," "name
"]
75 A[i "," "chapter
"] = A[j "," "chapter
"]
76 A[i "," "info
"] = A[j "," "info
"]
77 A[i "," "desc
"] = A[j "," "desc
"]
78 A[j "," "name
"] = name;
79 A[j "," "chapter
"] = chapter;
80 A[j "," "info
"] = info;
81 A[j "," "desc
"] = desc;
85 qsort(list, 1, list_total-1)
87 for (t = 1; t < list_total; t++) {
89 sub(/!PREV!/, "", list[t "," "info
"])
92 sub(/!PREV!/, list[t-1 "," "name
"], list[t "," "info
"])
95 if (t == list_total-1) {
96 sub(/!NEXT!/, "", list[t "," "info
"])
99 sub(/!NEXT!/, list[t+1 "," "name
"], list[t "," "info
"])
102 print list[t "," "info
"] "\n" list[t "," "desc
"]
103 print "* " list[t "," "name
"] "::" list[t "," "chapter
"] > "menu.texi.in
"
106 close("menu.texi.in
")