diff options
author | Sander Vrijders <[email protected]> | 2016-12-06 11:02:18 +0000 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2016-12-06 11:02:18 +0000 |
commit | 82ae7959d21c654fe9fd14de504f47d18b1ebcfc (patch) | |
tree | 6c00500dd93460dae01eea5fb3f5bc17e018c57e /src/tools/irm | |
parent | d68efc18d65217afa8a0ad2f300697ee1088b44f (diff) | |
parent | c17641d483279151748dc7cec8e9e44b0da11623 (diff) | |
download | ouroboros-82ae7959d21c654fe9fd14de504f47d18b1ebcfc.tar.gz ouroboros-82ae7959d21c654fe9fd14de504f47d18b1ebcfc.zip |
Merged in dstaesse/ouroboros/be-bind (pull request #318)
Be bind
Diffstat (limited to 'src/tools/irm')
-rw-r--r-- | src/tools/irm/irm_bind.c | 1 | ||||
-rw-r--r-- | src/tools/irm/irm_bind_ap.c | 13 | ||||
-rw-r--r-- | src/tools/irm/irm_unbind.c | 1 | ||||
-rw-r--r-- | src/tools/irm/irm_unbind_ap.c | 3 | ||||
-rw-r--r-- | src/tools/irm/irm_unbind_api.c | 5 | ||||
-rw-r--r-- | src/tools/irm/irm_unbind_ipcp.c | 3 |
6 files changed, 21 insertions, 5 deletions
diff --git a/src/tools/irm/irm_bind.c b/src/tools/irm/irm_bind.c index aafa2f75..2b5a6cf4 100644 --- a/src/tools/irm/irm_bind.c +++ b/src/tools/irm/irm_bind.c @@ -31,6 +31,7 @@ static void usage(void) { printf("Usage: irm bind [OPERATION]\n" + "\n" "where OPERATION = {ap api ipcp help}\n"); } diff --git a/src/tools/irm/irm_bind_ap.c b/src/tools/irm/irm_bind_ap.c index b558f072..b83e30dd 100644 --- a/src/tools/irm/irm_bind_ap.c +++ b/src/tools/irm/irm_bind_ap.c @@ -21,8 +21,12 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define _POSIX_C_SOURCE 200809L +#define _XOPEN_SOURCE 500 + #include <stdio.h> #include <string.h> +#include <stdlib.h> #include <ouroboros/irm.h> #include <ouroboros/errno.h> @@ -47,6 +51,7 @@ int do_bind_ap(int argc, char ** argv) char * ap_name = NULL; uint16_t flags = 0; int ret = 0; + char * temp = NULL; while (argc > 0) { if (matches(*argv, "name") == 0) { @@ -54,8 +59,11 @@ int do_bind_ap(int argc, char ** argv) ++argv; --argc; } else if (matches(*argv, "ap") == 0) { - ap_name = *(argv + 1); ++argv; + temp = realpath(*argv, NULL); + if (temp != NULL) + *argv = temp; + ap_name = *argv; --argc; } else if (strcmp(*argv, "auto") == 0) { flags |= BIND_AP_AUTO; @@ -92,5 +100,8 @@ int do_bind_ap(int argc, char ** argv) return -1; } + if (temp != NULL) + free(temp); + return ret; } diff --git a/src/tools/irm/irm_unbind.c b/src/tools/irm/irm_unbind.c index a6b27907..962e9555 100644 --- a/src/tools/irm/irm_unbind.c +++ b/src/tools/irm/irm_unbind.c @@ -31,6 +31,7 @@ static void usage(void) { printf("Usage: irm unbind [OPERATION]\n" + "\n" "where OPERATION = {ap api ipcp help}\n"); } diff --git a/src/tools/irm/irm_unbind_ap.c b/src/tools/irm/irm_unbind_ap.c index 8ad3d670..f3f16ee1 100644 --- a/src/tools/irm/irm_unbind_ap.c +++ b/src/tools/irm/irm_unbind_ap.c @@ -32,7 +32,8 @@ static void usage(void) { printf("Usage: irm unbind ap <ap>\n" - " [name <name>, omit: remove all AP info]\n"); + " [name <name> (default: remove all AP info)]" + "\n"); } int do_unbind_ap(int argc, char ** argv) diff --git a/src/tools/irm/irm_unbind_api.c b/src/tools/irm/irm_unbind_api.c index d332f438..fdfc2374 100644 --- a/src/tools/irm/irm_unbind_api.c +++ b/src/tools/irm/irm_unbind_api.c @@ -33,7 +33,8 @@ static void usage(void) { printf("Usage: irm unbind api <pid>\n" - " [name <name>, omit: remove all AP-I info]\n"); + " [name <name> (default: remove all AP-I info)]" + "\n"); } int do_unbind_api(int argc, char ** argv) @@ -41,7 +42,7 @@ int do_unbind_api(int argc, char ** argv) pid_t api = -1; char * name = NULL; - while (argc > 0) { + while (argc > 1) { if (matches(*argv, "name") == 0) { name = *(argv + 1); ++argv; diff --git a/src/tools/irm/irm_unbind_ipcp.c b/src/tools/irm/irm_unbind_ipcp.c index 33d7a818..16dd024b 100644 --- a/src/tools/irm/irm_unbind_ipcp.c +++ b/src/tools/irm/irm_unbind_ipcp.c @@ -33,7 +33,8 @@ static void usage(void) { printf("Usage: irm unbind ipcp <name>\n" - " [name <name>, omit: remove all information.\n"); + " [name <name> (default: remove all IPCP info)]" + "\n"); } int do_unbind_ipcp(int argc, char ** argv) |