Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD: Incorrect command line parse throws "error: could not open directory" #42

Open
v20z opened this issue Sep 16, 2021 · 0 comments

Comments

@v20z
Copy link

v20z commented Sep 16, 2021

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant