forked from len0rd/rockbox
imxtools/sbtools: various fixes
Change bug() macro, fix memory leaks, always use -h for help, fix usage(), fix comment, remove useless macro Change-Id: I30554b5e07e6f2845560a570808603cf8c4da5ad
This commit is contained in:
parent
2b20026dd7
commit
5ff3a3a98f
6 changed files with 39 additions and 24 deletions
|
|
@ -324,13 +324,13 @@ static void usage(void)
|
|||
{
|
||||
printf("Usage: elftosb [options | file]...\n");
|
||||
printf("Options:\n");
|
||||
printf(" -?/--help\tDisplay this message\n");
|
||||
printf(" -h/--help\tDisplay this message\n");
|
||||
printf(" -o <file>\tSet output file\n");
|
||||
printf(" -c <file>\tSet command file\n");
|
||||
printf(" -d/--debug\tEnable debug output\n");
|
||||
printf(" -k <file>\tAdd key file\n");
|
||||
printf(" -z\t\tAdd zero key\n");
|
||||
printf(" --add-key <key>\tAdd single key (hex or usbotp)\n");
|
||||
printf(" --add-key <key>\tAdd single key\n");
|
||||
printf(" --real-key <key>\tOverride real key\n");
|
||||
printf(" --crypto-iv <iv>\tOverride crypto IV\n");
|
||||
exit(1);
|
||||
|
|
@ -342,14 +342,19 @@ int main(int argc, char **argv)
|
|||
char *output_filename = NULL;
|
||||
struct crypto_key_t real_key;
|
||||
struct crypto_key_t crypto_iv;
|
||||
memset(&real_key, 0, sizeof(real_key));
|
||||
memset(&crypto_iv, 0, sizeof(crypto_iv));
|
||||
real_key.method = CRYPTO_NONE;
|
||||
crypto_iv.method = CRYPTO_NONE;
|
||||
|
||||
if(argc == 1)
|
||||
usage();
|
||||
|
||||
while(1)
|
||||
{
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"help", no_argument, 0, '?'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"debug", no_argument, 0, 'd'},
|
||||
{"add-key", required_argument, 0, 'a'},
|
||||
{"real-key", required_argument, 0, 'r'},
|
||||
|
|
@ -357,7 +362,7 @@ int main(int argc, char **argv)
|
|||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
int c = getopt_long(argc, argv, "?do:c:k:za:", long_options, NULL);
|
||||
int c = getopt_long(argc, argv, "hdo:c:k:za:", long_options, NULL);
|
||||
if(c == -1)
|
||||
break;
|
||||
switch(c)
|
||||
|
|
@ -365,7 +370,7 @@ int main(int argc, char **argv)
|
|||
case 'd':
|
||||
g_debug = true;
|
||||
break;
|
||||
case '?':
|
||||
case 'h':
|
||||
usage();
|
||||
break;
|
||||
case 'o':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue