]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Generate a list of all commands and their help texts for the client to use.
authorMartin Mares <mj@ucw.cz>
Wed, 19 Jan 2000 14:37:56 +0000 (14:37 +0000)
committerMartin Mares <mj@ucw.cz>
Wed, 19 Jan 2000 14:37:56 +0000 (14:37 +0000)
client/client.c
conf/Makefile
conf/gen_commands.m4 [new file with mode: 0644]

index ea12c29190a78755639cdb928b3cba966376c38b..2a43a8de2d5aebc48aac91726992f98cca2780e3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     BIRD Client
  *
- *     (c) 1999 Martin Mares <mj@ucw.cz>
+ *     (c) 1999--2000 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
@@ -9,6 +9,16 @@
 #include "nest/bird.h"
 #include "client/client.h"
 
+struct cmd_info {
+  char *command;
+  char *args;
+  char *help;
+};
+
+static struct cmd_info command_table[] = {
+#include "conf/commands.h"
+};
+
 int
 main(int argc, char **argv)
 {
index fdcd4c381971e7646933459f55738a2fde8fa9f1..853cd832a688686b48eb95627f781663d352d2a5 100644 (file)
@@ -20,7 +20,10 @@ cf-parse.y: $(conf-fragments) $(conf-src)/gen_parser.m4
 keywords.h: $(conf-fragments) $(conf-src)/gen_keywords.m4
        $(M4) -P $(conf-src)/gen_keywords.m4 $(conf-fragments) >keywords.h
 
+commands.h: $(conf-fragments) $(conf-src)/gen_commands.m4
+       $(M4) -P $(conf-src)/gen_commands.m4 $(conf-fragments) | sort >commands.h
+
 cf-lex.c: cf-lex.l
        $(FLEX) $(FLEX_DEBUG) -sB8 -ocf-lex.c -Pcf_ cf-lex.l
 
-depend: keywords.h cf-parse.tab.c cf-lex.c
+depend: keywords.h commands.h cf-parse.tab.c cf-lex.c
diff --git a/conf/gen_commands.m4 b/conf/gen_commands.m4
new file mode 100644 (file)
index 0000000..cba10b4
--- /dev/null
@@ -0,0 +1,17 @@
+m4_divert(-1)m4_dnl
+#
+#      BIRD -- Generator of CLI Command List
+#
+#      (c) 2000 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+#
+#      Can be freely distributed and used under the terms of the GNU GPL.
+#
+
+m4_define(CF_CLI, `CF_CLI_HELP($1, $3, $4)')
+
+m4_define(CF_CLI_HELP, `m4_divert(0){ "m4_translit($1,A-Z,a-z)", "$2", "$3" },
+m4_divert(-1)')
+
+# As we are processing C source, we must access all M4 primitives via
+# m4_* and also set different quoting convention: `[[' and ']]'
+m4_changequote([[,]])