comparison cli-runopts.c @ 1215:d058e15ea213

A few minor style fixes
author Matt Johnston <matt@ucc.asn.au>
date Tue, 15 Dec 2015 22:09:55 +0800
parents 7fd1211a1f63
children 980b7ea2c5ef
comparison
equal deleted inserted replaced
1214:61d3f56808a4 1215:d058e15ea213
826 static int match_extendedopt(const char** strptr, const char *optname) { 826 static int match_extendedopt(const char** strptr, const char *optname) {
827 int seen_eq = 0; 827 int seen_eq = 0;
828 int optlen = strlen(optname); 828 int optlen = strlen(optname);
829 const char *str = *strptr; 829 const char *str = *strptr;
830 830
831 while (isspace(*str)) 831 while (isspace(*str)) {
832 ++str; 832 ++str;
833 833 }
834 if (strncasecmp(str, optname, optlen) != 0) 834
835 if (strncasecmp(str, optname, optlen) != 0) {
835 return DROPBEAR_FAILURE; 836 return DROPBEAR_FAILURE;
837 }
836 838
837 str += optlen; 839 str += optlen;
838 840
839 while (isspace(*str) || (!seen_eq && *str == '=')) { 841 while (isspace(*str) || (!seen_eq && *str == '=')) {
840 if (*str == '=') 842 if (*str == '=') {
841 seen_eq = 1; 843 seen_eq = 1;
844 }
842 ++str; 845 ++str;
843 } 846 }
844 847
845 *strptr = str; 848 *strptr = str;
846 return DROPBEAR_SUCCESS; 849 return DROPBEAR_SUCCESS;
847 } 850 }
848 851
849 static int parse_flag_value(const char *value) 852 static int parse_flag_value(const char *value) {
850 { 853 if (strcmp(value, "yes") == 0 || strcmp(value, "true") == 0) {
851 if (strcmp(value, "yes") == 0 || strcmp(value, "true") == 0)
852 return 1; 854 return 1;
853 else if (strcmp(value, "no") == 0 || strcmp(value, "false") == 0) 855 } else if (strcmp(value, "no") == 0 || strcmp(value, "false") == 0) {
854 return 0; 856 return 0;
857 }
855 858
856 dropbear_exit("Bad yes/no argument '%s'", value); 859 dropbear_exit("Bad yes/no argument '%s'", value);
857 } 860 }
858 861
859 static void add_extendedopt(const char* origstr) { 862 static void add_extendedopt(const char* origstr) {