aboutsummaryrefslogtreecommitdiff
path: root/lib/command-line.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2009-10-23 11:49:39 -0700
committerBen Pfaff <blp@nicira.com>2009-11-04 15:24:40 -0800
commit675febfa2f31372e45e2a6a28ce19256b22106d7 (patch)
tree76b6c5a47c1a6446e3e48501425c7e910ea1d57a /lib/command-line.h
parent29d4af6016b5616ccac56c702c078e36189ef951 (diff)
Factor out common code from utilities that multiplex commands.
An upcoming commit will add yet another such utility and the code redundancy was getting to be a bit much.
Diffstat (limited to 'lib/command-line.h')
-rw-r--r--lib/command-line.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/command-line.h b/lib/command-line.h
index 426ce62e..bc2071ef 100644
--- a/lib/command-line.h
+++ b/lib/command-line.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008 Nicira Networks.
+ * Copyright (c) 2008, 2009 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,18 @@
/* Utilities for command-line parsing. */
+#include "compiler.h"
+
struct option;
+
+struct command {
+ const char *name;
+ int min_args;
+ int max_args;
+ void (*handler)(int argc, char *argv[]);
+};
+
char *long_options_to_short_options(const struct option *options);
+void run_command(int argc, char *argv[], const struct command[]);
#endif /* command-line.h */