Skip to content

Commit

Permalink
prevent duplicate getopt error
Browse files Browse the repository at this point in the history
  • Loading branch information
adsr committed Apr 20, 2024
1 parent 4813b79 commit a1bd910
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -2562,12 +2562,18 @@ static int _editor_init_from_args(editor_t *editor, int argc, char **argv) {

// Return 1 if we should skip reading rc files
static int _editor_should_skip_rc(int argc, char **argv) {
int c;
int c, rv;
rv = 0;
optind = 1;
opterr = 0; // Disable printing getopt errors for this call
while ((c = getopt(argc, argv, MLE_GETOPT_STR)) != -1) {
if (c == 'h' || c == 'N') return 1;
if (c == 'h' || c == 'N') {
rv = 1;
break;
}
}
return 0;
opterr = 1;
return rv;
}

// Init status bar
Expand Down

0 comments on commit a1bd910

Please sign in to comment.