--- a/src/cline.c Sat Jul 04 12:09:37 2026 +0200 +++ b/src/cline.c Sat Jul 04 12:28:16 2026 +0200 @@ -34,7 +34,7 @@ #include "arguments.h" #include "regex_parser.h" -static void printHelpText() { +static void print_help() { printf( "\nUsage:" "\n cline [Options] [Directories...]" @@ -89,36 +89,36 @@ static int exit_with_help(settings *settings, int code) { printf("cline - Version: " VERSION "\n"); - printHelpText(); + print_help(); destroy_settings(settings); return code; } static void normalize_excluded_dirs(settings *settings) { /* normalize all paths */ - for (size_t i = 0 ; i < settings->excludeDirs->count ; i++) { - char *arg = strdup(settings->excludeDirs->items[i]); + for (size_t i = 0 ; i < settings->exclude_dirs->count ; i++) { + char *arg = strdup(settings->exclude_dirs->items[i]); if (strpbrk(arg, "/\\") == NULL) { /* do not normalize names */ - settings->excludeDirs->items[i] = arg; + settings->exclude_dirs->items[i] = arg; } else { size_t arglen = strlen(arg); /* fix file separators */ - char fs = settings->fileSeparator; - char badfs = settings->fileSeparator == '/' ? '\\' : '/'; + char fs = FILE_SEPARATOR; + char badfs = FILE_SEPARATOR == '/' ? '\\' : '/'; for (size_t j = 0 ; j < arglen ; j++) { if (arg[j] == badfs) { arg[j] = fs; } } /* make path absolute */ - settings->excludeDirs->items[i] = make_path_absolute(arg); + settings->exclude_dirs->items[i] = make_path_absolute(arg); free(arg); } } /* tell the string list to free the items */ - settings->excludeDirs->free_item = free; + settings->exclude_dirs->free_item = free; } static const char *sepline_double = "===============================================================================\n"; @@ -145,8 +145,8 @@ for (int t = 1 ; t < argc ; t++) { - int argflags = checkArgument(argv[t], "hsSrRmvVbeEicdD"); - int paropt = 0; + int argflags = argument_check(argv[t], "hsSrRmvVbeEicdD"); + int paropt = 0; /* checks if no more than one opt with arg is combined */ /* h */ if ((argflags & 1) > 0 || strcmp(argv[t], "--help") == 0) { @@ -154,7 +154,7 @@ } /* s */ if ((argflags & 2) > 0) { - if (!checkParamOpt(&paropt) || registerArgument(&checked, 2)) { + if (paropt++ || argument_register(&checked, 2)) { return exit_with_help(settings, 1); } t++; @@ -165,7 +165,7 @@ } /* S */ if ((argflags & 4) > 0) { - if (!checkParamOpt(&paropt) || registerArgument(&checked, 4)) { + if (paropt++ || argument_register(&checked, 4)) { return exit_with_help(settings, 1); } t++; @@ -176,17 +176,17 @@ } /* r, R */ if ((argflags & 24) > 0) { - if (registerArgument(&checked, 24)) { + if (argument_register(&checked, 24)) { return exit_with_help(settings, 1); } settings->recursive = true; } /* m */ if ((argflags & 32) > 0) { - if (registerArgument(&checked, 32)) { + if (argument_register(&checked, 32)) { return exit_with_help(settings, 1); } - settings->matchesOnly = true; + settings->matches_only = true; } /* v */ if ((argflags & 64) > 0 || strcmp(argv[t], "--version") == 0) { @@ -194,14 +194,14 @@ } /* V */ if ((argflags & 128) > 0) { - if (registerArgument(&checked, 128)) { + if (argument_register(&checked, 128)) { return exit_with_help(settings, 1); } settings->verbose = false; } /* b */ if ((argflags & 256) > 0) { - if (!checkParamOpt(&paropt) || registerArgument(&checked, 256)) { + if (paropt++ || argument_register(&checked, 256)) { return exit_with_help(settings, 1); } t++; @@ -209,20 +209,20 @@ return exit_with_help(settings, 1); } if (strcasecmp(argv[t], "ignore") == 0) { - settings->bfileHeuristics->level = BFILE_IGNORE; + settings->bfile->level = BFILE_IGNORE; } else if (strcasecmp(argv[t], "low") == 0) { - settings->bfileHeuristics->level = BFILE_LOW_ACCURACY; + settings->bfile->level = BFILE_LOW_ACCURACY; } else if (strcasecmp(argv[t], "medium") == 0) { - settings->bfileHeuristics->level = BFILE_MEDIUM_ACCURACY; + settings->bfile->level = BFILE_MEDIUM_ACCURACY; } else if (strcasecmp(argv[t], "high") == 0) { - settings->bfileHeuristics->level = BFILE_HIGH_ACCURACY; + settings->bfile->level = BFILE_HIGH_ACCURACY; } else { return exit_with_help(settings, 1); } } /* e */ if ((argflags & 512) > 0) { - if (!checkParamOpt(&paropt) || t + 2 >= argc) { + if (paropt++ || t + 2 >= argc) { return exit_with_help(settings, 1); } t++; add_string(settings->regex->pattern_list, argv[t]); @@ -231,7 +231,7 @@ /* E */ if ((argflags & 1024) > 0) { t++; - if (!checkParamOpt(&paropt) || t >= argc) { + if (paropt++ || t >= argc) { return exit_with_help(settings, 1); } add_string(settings->regex->pattern_list, argv[t]); @@ -247,7 +247,7 @@ } /* c */ if ((argflags & 4096) > 0) { - if (registerArgument(&checked, 4096)) { + if (argument_register(&checked, 4096)) { return exit_with_help(settings, 1); } settings->count_chars = true; @@ -255,21 +255,21 @@ } /* d */ if ((argflags & 8192) > 0) { - if (registerArgument(&checked, 8192)) { + if (argument_register(&checked, 8192)) { return exit_with_help(settings, 1); } /* ignored together with -V */ if ((checked & 128) == 0) { - settings->dirsOnly = true; + settings->dirs_only = true; } } /* D */ if ((argflags & 16384) > 0) { t++; - if (!checkParamOpt(&paropt) || t >= argc) { + if (paropt++ || t >= argc) { return exit_with_help(settings, 1); } - add_string(settings->excludeDirs, argv[t]); + add_string(settings->exclude_dirs, argv[t]); } if (argflags == 0) { /* SHORTCUTS */ @@ -295,8 +295,8 @@ } /* Find tokens */ - parseCSL(includeSuffix, settings->includeSuffixes); - parseCSL(excludeSuffix, settings->excludeSuffixes); + parse_csl(includeSuffix, settings->include_suffixes); + parse_csl(excludeSuffix, settings->exclude_suffixes); /* Compiler regular expressions, if any specified */ if (!regex_compile_all(settings->regex)) { @@ -323,7 +323,7 @@ output = new_string_list(); output->free_item = free; } - scanDirectory((scanner){directories->items[t], 0}, + scan_dir((scanner){directories->items[t], 0}, settings, output, result); total += result->result; if (settings->verbose) {