summaryrefslogtreecommitdiff
path: root/src/tools/irm
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2016-03-02 11:42:01 +0100
committerSander Vrijders <sander.vrijders@intec.ugent.be>2016-03-02 11:42:01 +0100
commit3bebab119c5a2c59121355c72b4e69b2817eea3a (patch)
tree1112213c1c5e41a0496b5d168f0883ce5b4b2119 /src/tools/irm
parent52a5113760802e16b07d9d954237871d52cff70a (diff)
downloadouroboros-3bebab119c5a2c59121355c72b4e69b2817eea3a.tar.gz
ouroboros-3bebab119c5a2c59121355c72b4e69b2817eea3a.zip
tools: Parse command line params
This adds initial support to the irm tool for parsing command line parameters.
Diffstat (limited to 'src/tools/irm')
-rw-r--r--src/tools/irm/main.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/tools/irm/main.c b/src/tools/irm/main.c
index ac09e1e7..ea88e4a6 100644
--- a/src/tools/irm/main.c
+++ b/src/tools/irm/main.c
@@ -20,13 +20,25 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#define OUROBOROS_PREFIX "irm"
-
-#include <ouroboros/logs.h>
#include <ouroboros/common.h>
#include <ouroboros/irm.h>
+#include <stdio.h>
+
+int main (int argc, char ** argv) {
+
+ char * operation;
+
+ if (argc < 2) {
+ printf("Usage: irm [OPERATION]\n\n"
+ "where OPERATION = {create_ipcp destroy_ipcp \n"
+ " bootstrap_ipcp enroll_ipcp\n"
+ " register_ipcp unregister_ipcp}\n");
+ return 0;
+ }
+
+ operation = argv[1];
+ printf("Operation is %s\n", operation);
-int main () {
char * ap_name = "test";
char * ipcp_type = "normal-ipcp";
rina_name_t name;
@@ -39,32 +51,26 @@ int main () {
size_t difs_size = 1;
if (irm_create_ipcp(name, ipcp_type)) {
- LOG_ERR("Failed to create IPCP");
return -1;
}
if (irm_destroy_ipcp(name)) {
- LOG_ERR("Failed to destroy IPCP");
return -1;
}
if (irm_bootstrap_ipcp(name, info)) {
- LOG_ERR("Failed to bootstrap IPCP");
return -1;
}
if (irm_enroll_ipcp(name, dif_name)) {
- LOG_ERR("Failed to enroll IPCP");
return -1;
}
if (irm_reg_ipcp(name, &dif_name, difs_size)) {
- LOG_ERR("Failed to register IPCP");
return -1;
}
if (irm_unreg_ipcp(name, &dif_name, difs_size)) {
- LOG_ERR("Failed to unregister IPCP");
return -1;
}