summaryrefslogtreecommitdiff
path: root/src/tools/irm/irm_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/irm/irm_utils.c')
-rw-r--r--src/tools/irm/irm_utils.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/tools/irm/irm_utils.c b/src/tools/irm/irm_utils.c
index 34bec18c..021227fd 100644
--- a/src/tools/irm/irm_utils.c
+++ b/src/tools/irm/irm_utils.c
@@ -21,6 +21,11 @@
*/
#include <string.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <ouroboros/common.h>
+
+#include "irm_utils.h"
int matches(const char * cmd, const char * pattern)
{
@@ -31,3 +36,23 @@ int matches(const char * cmd, const char * pattern)
return memcmp(pattern, cmd, len);
}
+
+
+bool parse_name(char ** argv,
+ rina_name_t * name)
+{
+ bool found = true;
+
+ if (matches(*argv, "ap") == 0)
+ name->ap_name = *(argv + 1);
+ else if (matches(*argv, "api") == 0)
+ name->api_id = atoi(*(argv + 1));
+ else if (matches(*argv, "ae") == 0)
+ name->ae_name = *(argv + 1);
+ else if (matches(*argv, "aei") == 0)
+ name->aei_id = atoi(*(argv + 1));
+ else
+ found = false;
+
+ return found;
+}