main: support lower case command

people use lower case more than upper case. so we should support
lower case command

Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
This commit is contained in:
Eddie Cai 2017-04-16 21:39:58 +08:00
parent a8d2345885
commit 8df2d64a80

View File

@ -1275,14 +1275,19 @@ bool handle_command(int argc, char* argv[], CRKScan *pScan)
strCmd = argv[1];
ssize_t cnt;
bool bRet,bSuccess = false;
int ret;
char *s;
int i, ret;
STRUCT_RKDEVICE_DESC dev;
transform(strCmd.begin(), strCmd.end(), strCmd.begin(), (int(*)(int))toupper);
if(strcmp(strCmd.c_str(), "-H") == 0) {
s = (char*)strCmd.c_str();
for(i = 0; i < (int)strlen(s); i++)
s[i] = toupper(s[i]);
printf("handle_command: %s\n", strCmd.c_str());
if((strcmp(strCmd.c_str(), "-H") == 0) || (strcmp(strCmd.c_str(), "--HELP")) == 0){
usage();
return true;
} else if(strcmp(strCmd.c_str(), "-V") == 0) {
} else if((strcmp(strCmd.c_str(), "-V") == 0) || (strcmp(strCmd.c_str(), "--VERSION") == 0)) {
printf("rkdeveloptool ver %s\r\n", PACKAGE_VERSION);
return true;
}