mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-13 19:28:56 +00:00
fixed the usage of getopt_* ()
This commit is contained in:
parent
175931575c
commit
42ee091772
@ -23,6 +23,7 @@
|
||||
- Fixed a problem with changed current working directory, for instance by using --restore together with --remove
|
||||
- Fixed a memory problem that occured when the OpenCL folder was not found and e.g. the shared and session folder were the same
|
||||
- Fixed the version number used in the restore file header
|
||||
- Fixed the parsing of command line options. It doesn't show two times the same error about an invalid option anymore.
|
||||
|
||||
##
|
||||
## Improvements
|
||||
|
@ -248,7 +248,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
||||
|
||||
option_index = 0;
|
||||
|
||||
while (((c = getopt_long (argc, argv, short_options, long_options, &option_index)) != -1) && optopt == 0)
|
||||
while ((c = getopt_long (argc, argv, short_options, long_options, &option_index)) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
@ -291,22 +291,26 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case '?':
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Invalid argument specified.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (optopt != 0)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Invalid argument specified.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
optind = 1;
|
||||
optopt = 0;
|
||||
|
||||
option_index = 0;
|
||||
|
||||
while (((c = getopt_long (argc, argv, short_options, long_options, &option_index)) != -1) && optopt == 0)
|
||||
while ((c = getopt_long (argc, argv, short_options, long_options, &option_index)) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
@ -416,23 +420,9 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
||||
case IDX_CUSTOM_CHARSET_2: user_options->custom_charset_2 = optarg; break;
|
||||
case IDX_CUSTOM_CHARSET_3: user_options->custom_charset_3 = optarg; break;
|
||||
case IDX_CUSTOM_CHARSET_4: user_options->custom_charset_4 = optarg; break;
|
||||
|
||||
default:
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Invalid argument specified.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (optopt != 0)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Invalid argument specified.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
user_options->hc_bin = argv[0];
|
||||
|
||||
user_options->hc_argc = argc - optind;
|
||||
|
Loading…
Reference in New Issue
Block a user