diff options
author | iphydf <iphydf@users.noreply.github.com> | 2016-08-31 19:12:19 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2016-08-31 20:04:16 +0100 |
commit | 633da98ae69866efb195e00d9a3a22ace6bada66 (patch) | |
tree | 875535f3d2257c4ea5bb97a553b2f1beab4a1590 /testing/misc_tools.c | |
parent | 6356eb4e4fe407fa7870f2a685d0d08b5c2ec5bb (diff) |
Add braces to all if statements.
Diffstat (limited to 'testing/misc_tools.c')
-rw-r--r-- | testing/misc_tools.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/testing/misc_tools.c b/testing/misc_tools.c index 52b739dc..ba49ebc8 100644 --- a/testing/misc_tools.c +++ b/testing/misc_tools.c | |||
@@ -46,8 +46,9 @@ uint8_t *hex_string_to_bin(char *hex_string) | |||
46 | uint8_t *ret = malloc(len); | 46 | uint8_t *ret = malloc(len); |
47 | char *pos = hex_string; | 47 | char *pos = hex_string; |
48 | 48 | ||
49 | for (i = 0; i < len; ++i, pos += 2) | 49 | for (i = 0; i < len; ++i, pos += 2) { |
50 | sscanf(pos, "%2hhx", &ret[i]); | 50 | sscanf(pos, "%2hhx", &ret[i]); |
51 | } | ||
51 | 52 | ||
52 | return ret; | 53 | return ret; |
53 | } | 54 | } |
@@ -56,16 +57,16 @@ int cmdline_parsefor_ipv46(int argc, char **argv, uint8_t *ipv6enabled) | |||
56 | { | 57 | { |
57 | int argvoffset = 0, argi; | 58 | int argvoffset = 0, argi; |
58 | 59 | ||
59 | for (argi = 1; argi < argc; argi++) | 60 | for (argi = 1; argi < argc; argi++) { |
60 | if (!strncasecmp(argv[argi], "--ipv", 5)) { | 61 | if (!strncasecmp(argv[argi], "--ipv", 5)) { |
61 | if (argv[argi][5] && !argv[argi][6]) { | 62 | if (argv[argi][5] && !argv[argi][6]) { |
62 | char c = argv[argi][5]; | 63 | char c = argv[argi][5]; |
63 | 64 | ||
64 | if (c == '4') | 65 | if (c == '4') { |
65 | *ipv6enabled = 0; | 66 | *ipv6enabled = 0; |
66 | else if (c == '6') | 67 | } else if (c == '6') { |
67 | *ipv6enabled = 1; | 68 | *ipv6enabled = 1; |
68 | else { | 69 | } else { |
69 | printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]); | 70 | printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]); |
70 | return -1; | 71 | return -1; |
71 | } | 72 | } |
@@ -81,6 +82,7 @@ int cmdline_parsefor_ipv46(int argc, char **argv, uint8_t *ipv6enabled) | |||
81 | 82 | ||
82 | argvoffset++; | 83 | argvoffset++; |
83 | } | 84 | } |
85 | } | ||
84 | 86 | ||
85 | return argvoffset; | 87 | return argvoffset; |
86 | }; | 88 | }; |