Update against changes about 2 years ago. :)
[doldaconnect.git] / lib / makecmds
CommitLineData
d3372da9 1#!/usr/bin/perl
2
3%keys =
4 (
5 "s" => "RESP_STR",
6 "d" => "RESP_DSC",
7 "i" => "RESP_INT",
8 "f" => "RESP_FLOAT"
9 );
10
11print("
12/* Do not modify this file - it is autogenerated by makecmds */
13
14static void initcmds(void)
15{
16 struct command *cmd;
17
18");
19
20while(<>)
21{
22 ($comment) = /\s*;\s*(.*)$/;
23 s/\s*;.*$//;
24 if(($name) = /^:(\w*)/)
25 {
26 if($name)
27 {
28 print(" cmd = makecmd(L\"$name\");");
29 } else {
30 print(" cmd = makecmd(NULL);");
31 }
32 if($comment)
33 {
34 print("\t/* $comment */");
35 }
36 print("\n");
37 } elsif(/^([0-9]{3})\s+/g) {
38 print(" addresp(cmd, $1");
39 print(", " . $keys{$1}) while /\G(\S+)\s+/g;
40 print(", RESP_END);");
41 if($comment)
42 {
43 print("\t/* $comment */");
44 }
45 print("\n");
46 }
47}
48
49print("}\n");