From 3a7f5493619d20e7087536edbe694f9f2761ace5 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 29 Jul 2016 18:34:10 +0000 Subject: lib: Retab command_match.c Signed-off-by: Quentin Young --- lib/command_match.c | 102 ++++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 51 deletions(-) (limited to 'lib') diff --git a/lib/command_match.c b/lib/command_match.c index 984813d0d..f02b7c821 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -379,38 +379,38 @@ match_ipv4 (const char *str) memset (buf, 0, sizeof (buf)); sp = str; while (*str != '\0') - { - if (*str == '.') - { - if (dots >= 3) - return no_match; + { + if (*str == '.') + { + if (dots >= 3) + return no_match; - if (*(str + 1) == '.') - return no_match; + if (*(str + 1) == '.') + return no_match; - if (*(str + 1) == '\0') - return partly_match; + if (*(str + 1) == '\0') + return partly_match; - dots++; - break; - } - if (!isdigit ((int) *str)) - return no_match; + dots++; + break; + } + if (!isdigit ((int) *str)) + return no_match; - str++; - } + str++; + } if (str - sp > 3) - return no_match; + return no_match; strncpy (buf, sp, str - sp); if (atoi (buf) > 255) - return no_match; + return no_match; nums++; if (*str == '\0') - break; + break; str++; } @@ -436,51 +436,51 @@ match_ipv4_prefix (const char *str) memset (buf, 0, sizeof (buf)); sp = str; while (*str != '\0' && *str != '/') - { - if (*str == '.') - { - if (dots == 3) - return no_match; + { + if (*str == '.') + { + if (dots == 3) + return no_match; - if (*(str + 1) == '.' || *(str + 1) == '/') - return no_match; + if (*(str + 1) == '.' || *(str + 1) == '/') + return no_match; - if (*(str + 1) == '\0') - return partly_match; + if (*(str + 1) == '\0') + return partly_match; - dots++; - break; - } + dots++; + break; + } - if (!isdigit ((int) *str)) - return no_match; + if (!isdigit ((int) *str)) + return no_match; - str++; - } + str++; + } if (str - sp > 3) - return no_match; + return no_match; strncpy (buf, sp, str - sp); if (atoi (buf) > 255) - return no_match; + return no_match; if (dots == 3) - { - if (*str == '/') - { - if (*(str + 1) == '\0') - return partly_match; - - str++; - break; - } - else if (*str == '\0') - return partly_match; - } + { + if (*str == '/') + { + if (*(str + 1) == '\0') + return partly_match; + + str++; + break; + } + else if (*str == '\0') + return partly_match; + } if (*str == '\0') - return partly_match; + return partly_match; str++; } @@ -489,7 +489,7 @@ match_ipv4_prefix (const char *str) while (*str != '\0') { if (!isdigit ((int) *str)) - return no_match; + return no_match; str++; } -- cgit v1.2.3