diff options
author | Christian C <cc@localhost> | 2025-03-04 17:25:18 -0800 |
---|---|---|
committer | Christian C <cc@localhost> | 2025-03-04 17:25:18 -0800 |
commit | 07fe1f42a98084ce5c3b9425f002546f27acd8ba (patch) | |
tree | 5c867401720baee4514785dfd234599ede172e84 /src | |
parent | a5d4202196086d96a4a2d0e6049bcbeebce10ea5 (diff) |
Command line arguments
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -126,7 +126,7 @@ bool_t flood(uint8_t* image, uint16_t* mask, size_t width, size_t height, size_t return FALSE; } -int main() +int main(int argc, char** argv) { //----------------------------------------------- //-LIST-FILES-IN-DIRECTORY----------------------- @@ -144,6 +144,21 @@ int main() } free(file_list); } + if (argc > 1) { + file_list = lsdir(argv[1]); + if (file_list) { + size_t index = 0; + while (1) { + char* fname = file_list[index]; + if (fname == NULL) { + break; + } + printf("%s\n", fname); + free(file_list[index++]); + } + free(file_list); + } + } //----------------------------------------------- //----------------------------------------------- |