2 # This script parses a command_table file into something which is a bit
3 # easier for an awk script to understand.
5 # Input syntax: a .ct file
8 # (for the command_table line)
9 # command_table <command_table>
11 #(for each request definition)
13 # sub: <subroutine name>
18 # (there may be more than one 'cmd' or 'opt' line
20 # A number sent to the output represents a parse error --- it will be
21 # followed by the next line which will have the form:
24 # The design of this output syntax is such that it should be easy for
25 # an awk script to parse.
28 # The first section of this script is just to cannoicalize the file.
29 # It removes comments, and puts each command_table request onto a single
44 # Now we take care of some syntatic sugar.....
47 s/^unimplemented [A-Za-z_0-9]*/request ss_unimplemented/
48 s/;/, (dont_list, dont_summarize);/
51 s/^unknown /request ss_unknown, "", /
54 # Dispatch based on the keyword.... illegal keywords are prefixed by ERROR:
55 # and are handled by the awk script.
61 s/^/ERROR: unknown keyword: /
65 # Handle the command_table keyword
73 # Handle the request keyword --- this is the heart of the sed script.
80 # First, parse out the subroutine name
84 # Next, parse out the help message, being careful to handle a quoted string
103 # Next take care of the command names
127 # Here we parse the list of options.
138 ERROR: parse error in options list
156 # Handle the end keyword --- it's basically ignored.