1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-23 01:10:17 +02:00

cleanup the code

change all the function return 1 for success
This commit is contained in:
xiangfu 2009-04-28 18:13:19 +00:00
parent 1275a789b7
commit e0de52c28c
3 changed files with 21 additions and 25 deletions

View File

@ -212,7 +212,7 @@ out:
int boot(char *stage1_path, char *stage2_path, char *config_path ){
struct ingenic_dev ingenic_dev;
int res = EXIT_FAILURE;
int res = 0;
int status;
memset(&ingenic_dev, 0, sizeof(struct ingenic_dev));
@ -272,7 +272,7 @@ int boot(char *stage1_path, char *stage2_path, char *config_path ){
check_dump_cfg();
}
res = EXIT_SUCCESS;
res = 1;
cleanup:
if (ingenic_dev.file_buff)

View File

@ -28,7 +28,7 @@
#include "config.h"
static int com_argc;
static char com_argv[20][50];
static char com_argv[9][100];
static const char COMMAND[][30]=
{
@ -133,8 +133,8 @@ int command_input(char *buf)
cptr = fgets(buf, 256, stdin);
if (cptr != NULL)
return 0;
return 1;
return 0;
}
int command_interpret(char * com_buf)
@ -158,8 +158,7 @@ int command_interpret(char * com_buf)
} else {
com_argv[i][j] = *buf;
j++;
if (j>100)
{
if (j > 100) {
printf("\n Para is too long! About!");
return 0;
}
@ -178,9 +177,8 @@ int command_interpret(char * com_buf)
int command_handle(char *buf)
{
int cmd = command_interpret(buf);
int result = 0;
if (!cmd) return 1;
if (!cmd) return -1;
switch (cmd) {
case 11:
handle_nprog();
@ -199,9 +197,9 @@ int command_handle(char *buf)
break;
default:
printf("\n Command not support!");
result = 1;
result = -1;
break;
}
return result;
return 1;
}

View File

@ -70,12 +70,10 @@ int main(int argc, char **argv)
switch (c) {
case 'h':
help();
exit(0);
break;
exit(EXIT_SUCCESS);
case 'v':
print_version();
exit(0);
break;
exit(EXIT_SUCCESS);
default:
help();
exit(2);
@ -88,11 +86,11 @@ int main(int argc, char **argv)
while (1) {
printf("\n inflash :> ");
if (command_input(com_buf))
if (!command_input(com_buf))
continue;
command_handle(com_buf);
}
return 0;
return EXIT_SUCCESS;
}