Rename parameter

This commit is contained in:
Johannes Marbach 2021-09-25 11:45:48 +02:00
parent bc8487e15c
commit ade09a093a
2 changed files with 8 additions and 8 deletions

View file

@ -70,10 +70,10 @@ static void print_usage() {
* Public functions
*/
void ul_cli_parse_opts(int argc, char *argv[], ul_cli_opts *cli_opts) {
init_opts(cli_opts);
void ul_cli_parse_opts(int argc, char *argv[], ul_cli_opts *opts) {
init_opts(opts);
struct option opts[] = {
struct option long_opts[] = {
{ "geometry", required_argument, NULL, 'g' },
{ "help", no_argument, NULL, 'h' },
{ "verbose", no_argument, NULL, 'v' },
@ -83,10 +83,10 @@ void ul_cli_parse_opts(int argc, char *argv[], ul_cli_opts *cli_opts) {
int opt, index = 0;
while ((opt = getopt_long(argc, argv, "g:hvV", opts, &index)) != -1) {
while ((opt = getopt_long(argc, argv, "g:hvV", long_opts, &index)) != -1) {
switch (opt) {
case 'g':
if (sscanf(optarg, "%ix%i", &(cli_opts->hor_res), &(cli_opts->ver_res)) != 2) {
if (sscanf(optarg, "%ix%i", &(opts->hor_res), &(opts->ver_res)) != 2) {
fprintf(stderr, "Error: invalid geometry argument \"%s\"\n", optarg);
exit(EXIT_FAILURE);
}
@ -95,7 +95,7 @@ void ul_cli_parse_opts(int argc, char *argv[], ul_cli_opts *cli_opts) {
print_usage();
exit(EXIT_SUCCESS);
case 'v':
cli_opts->verbose = true;
opts->verbose = true;
break;
case 'V':
fprintf(stderr, "unl0kr %s\n", UL_VERSION);

View file

@ -40,8 +40,8 @@ typedef struct {
*
* @param argc number of provided command line arguments
* @param argv arguments as an array of strings
* @param cli_opts pointer for writing the parsed options into
* @param opts pointer for writing the parsed options into
*/
void ul_cli_parse_opts(int argc, char *argv[], ul_cli_opts *cli_opts);
void ul_cli_parse_opts(int argc, char *argv[], ul_cli_opts *opts);
#endif /* UL_COMMAND_LINE_H */