Skip to content

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

@v20z

Description

@v20z

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions