cp: make con_printf non-fatal no-op
[hvf.git] / doc / manual / gen-docs.sh
blob79d768f5143f68694441942293c741bb649829d0
1 write_docs()
3 cat "$1" | awk -v fmt="$2" '
4 BEGIN{
5 docdir = ".";
7 fname = "";
10 /^[/ ]\*!!! / {
11 # begin a new command
12 if (fname != "")
13 close(fname);
15 name="";
16 fname="";
17 for(i=2; i<=NF; i+=1) {
18 name = name $i " ";
19 fname = fname $i "-";
21 name = substr(name, 1, length(name)-1);
22 _fname = docdir "/" fmt "/" substr(fname, 1, length(fname)-1)
23 fname = _fname "." fmt;
25 print "Writing out ", fname;
27 print "\\input{" _fname "}" >> "cp-cmd-list.tex"
29 print "\\section{" name "}" > fname;
30 mode = "none";
33 /^[/ ]\*!! SYNTAX$/ {
34 mode = "syntax";
35 print "\\begin{syntdiag}" >> fname;
36 next;
39 /^[/ ]\*!! XATNYS$/ {
40 mode = "none";
41 print "\\end{syntdiag}" >> fname;
42 next;
45 /^[/ ]\*!! AUTH / {
46 mode = "none";
47 print "\\subsection*{Authorization}\nPriviledge Class: " $3 >> fname;
48 next;
51 /^[/ ]\*!! PURPOSE$/ {
52 mode = "copy";
53 print "\\subsection*{Purpose}" >> fname;
54 next;
57 /^[/ ]\*!! EXAMPLES$/ {
58 mode = "copy";
59 print "\\subsection*{Examples}" >> fname;
60 next;
63 /^[/ ]\*!! OPERANDS$/ {
64 mode = "copy";
65 print "\\subsection*{Operands}" >> fname;
66 print "\\begin{description}" >> fname
67 next;
70 /^[/ ]\*!! SDNAREPO$/ {
71 mode = "none";
72 print "\\end{description}" >> fname;
73 next;
76 /^[/ ]\*!! OPTIONS$/ {
77 mode = "copy";
78 print "\\subsection*{Options}" >> fname;
79 print "\\begin{description}" >> fname;
80 next;
83 /^[/ ]\*!! SNOITPO$/ {
84 mode = "none";
85 print "\\end{description}" >> fname;
86 next;
89 /^[/ ]\*!! NOTES$/ {
90 mode = "copy";
91 print "\\subsection*{Usage Notes}" >> fname;
92 print "\\begin{enumerate}" >> fname;
93 next;
96 /^[/ ]\*!! SETON$/ {
97 mode = "none";
98 print "\\end{enumerate}" >> fname;
99 next;
102 /^[/ ]\*! / {
103 # verbatim line
104 if (mode == "copy" || mode == "syntax")
105 print substr($0, 5) >> fname;
108 /^[/ ]\*!$/ {
109 if (mode == "copy" || mode == "syntax")
110 print substr($0, 5) >> fname;
115 rm -f cp-cmd-list.tex
116 mkdir -p tex/
118 for srcf in ../../cp/shell/cmd_*.c ; do
119 echo "Inspecting $srcf..."
120 write_docs $srcf tex
121 #write_docs $srcf txt
122 #write_docs $srcf html
123 done
125 sort < cp-cmd-list.tex > cp-cmd-list.tex.2
126 mv cp-cmd-list.tex.2 cp-cmd-list.tex