From c120bd2cc5b3fcbf09c25ee14ae62bce03f453eb Mon Sep 17 00:00:00 2001 From: Jakob Olsson <jakobols@kth.se> Date: Mon, 21 May 2018 15:50:46 +0200 Subject: [PATCH] small style fix --- common.c | 5 ----- dongle.c | 31 ++++++++++++++----------------- libmobile.c | 9 ++------- libmobile.h | 11 ----------- 4 files changed, 16 insertions(+), 40 deletions(-) diff --git a/common.c b/common.c index bcba134..2a0ede4 100644 --- a/common.c +++ b/common.c @@ -48,8 +48,3 @@ struct blob_buf json_to_blob(struct json_object *response, struct blob_buf bb) return bb; } - -void check_debug(void) -{ - printf("debug: %d\n", debug); -} \ No newline at end of file diff --git a/dongle.c b/dongle.c index 771468d..58c4902 100644 --- a/dongle.c +++ b/dongle.c @@ -9,8 +9,8 @@ struct ubus_context *ctx; int debug; static struct option long_options[] = { - {"debug", required_argument, NULL, 'd'}, - {0, 0, 0, 0} + {"debug", required_argument, NULL, 'd'}, + {0, 0, 0, 0} }; int parse_args(int argc, char **argv) @@ -19,22 +19,19 @@ int parse_args(int argc, char **argv) while ((ch = getopt_long(argc, argv, "d:", long_options, NULL)) != -1) { switch (ch) { - case 'd': - debug = atoi(optarg); - if (debug > 1 || debug < 0) { - printf("%s: option '-%c' is invalid.\n", argv[0], optopt); //cant exactly do debug print in here... - goto fail; - } - goto done; - break; - case ':': - printf(stderr, "%s: option '-%c' requires an argument\n", argv[0], optopt); + case 'd': + debug = atoi(optarg); + if (debug > 1 || debug < 0) { + printf("%s: option '-%c' is invalid.\n", argv[0], optopt); //cant exactly do debug print in here... goto fail; - break; - case '?': - printf(stderr, "%s: option '-%c' is invalid: ignored\n", argv[0], optopt); - goto fail; - break; + } + goto done; + case ':': + printf(stderr, "%s: option '-%c' requires an argument\n", argv[0], optopt); + goto fail; + case '?': + printf(stderr, "%s: option '-%c' is invalid: ignored\n", argv[0], optopt); + goto fail; } } diff --git a/libmobile.c b/libmobile.c index 7be2230..017c143 100644 --- a/libmobile.c +++ b/libmobile.c @@ -157,7 +157,7 @@ fail: * * IMPORTANT NOTE * Will alter the input string and allocate memory for the return value! - * The caller is responsible for freeing the return value. + * The caller is responsible for freeing the return value. */ static char *lexer(char **input, char *delimiter) { @@ -186,7 +186,7 @@ static char *lexer(char **input, char *delimiter) /** * Function: get_query_wrapper - * Wraps the input comma-separated values to the appropriate address format for a GET request. + * Wraps the input comma-separated values to the appropriate address format for a GET request. * * Parameters: * vars - Char pointer pointing to comma-separated values to retreive. @@ -463,11 +463,6 @@ fail: return NULL; } -struct json_object *mobile_get_wan_apn(char *ip_addr) -{ - return prepare_request(ip_addr, "wan_apn", GET); -} - struct json_object *mobile_get_remaining_tries(char *ip_addr) { return prepare_request(ip_addr, "pinnumber", GET); diff --git a/libmobile.h b/libmobile.h index 8a555cc..f699f79 100644 --- a/libmobile.h +++ b/libmobile.h @@ -121,17 +121,6 @@ struct json_object *mobile_get_roam_status(char *ip_addr); */ struct json_object *mobile_get_current_apn(char *ip_addr); -/** - * Function: mobile_get_wan_apn - * - * Gets the currently active APN profile's WAN name. - * - * Returns: - * A pointer to a json_object containing the JSON response from the server. {"wan_apn": "<name>" } on success. - * NULL on failure. - */ -struct json_object *mobile_get_wan_apn(char *ip_addr); - /** * Function: mobile_get_remaining_tries * -- GitLab