ngp
ngp copied to clipboard
FreeBSD: Incorrect command line parse throws "error: could not open directory"
Dear Jonathan,
Here is some difficulties running ngp on FreeBSD (13-STABLE). It compiles successfuly but when trying to run with actual command line parameters like:
ngp PATTERN
Moving forward in the order of execution:
int main(int argc, char *argv[]) {
..
struct options_t *options = create_options(config, argc, argv);
..
parse_args(options, argc, argv);
And reaches the piece of code where everything stops:
int first_argument = 0;
for (; optind < arg_count; optind++) {
if (!first_argument) {
strcpy(options->pattern, args[optind]);
first_argument = 1;
} else {
strcpy(options->directory, args[optind]);
}
}
free(args);
DIR *dirp = opendir(options->directory);
if (!dirp) {
fprintf(stderr, "error: could not open directory \"%s\"\n",
options->directory);