diff options
| author | Ben Winston | 2024-05-27 20:25:42 -0400 |
|---|---|---|
| committer | Ben Winston | 2024-05-27 20:25:42 -0400 |
| commit | f4822b352ab3d6dc57f21ae241b4f594ef106dd4 (patch) | |
| tree | c1e7aa9e99e1d502037aee58d077dae21169ec7c | |
| parent | 741e0061fe48257cf00c66db95eda1388dc3ac30 (diff) | |
search wasn't returning anything useful anyway
| -rw-r--r-- | booki.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -463,14 +463,14 @@ void open(char* filepath) { } } -char** search(int argc, char* argv[], char* booki_file) { +void search(int argc, char* argv[], char* booki_file) { struct search_opt search_opts = parse_search_options(argc, argv); // get the books array char* data = load_file(booki_file); if (!data) { printf("couldn't load data from %s\n", booki_file); - return NULL; + return; } FILE *edit_file, *fixed_file = NULL; @@ -543,7 +543,7 @@ char** search(int argc, char* argv[], char* booki_file) { data = load_file(EDIT_FILE); if (!data) { printf("can't open edit file\n"); - return NULL; + return; } cur_data = data; while ((cur_data = next_book(cur_data)) != NULL) { @@ -555,8 +555,6 @@ char** search(int argc, char* argv[], char* booki_file) { fclose(fixed_file); } - - return argv + optind; } void help(bool err) { @@ -574,15 +572,13 @@ int main(int argc, char* argv[]) { return 1; } - char** remaining = NULL; - if (argc == 1) { help(false); return 0; } else if (strcmp(argv[1], "open") == 0) { open(booki_file); } else if (strcmp(argv[1], "search") == 0) { - remaining = search(argc - 1, argv + 1, booki_file); + search(argc - 1, argv + 1, booki_file); } else { printf("unknown subcommand: '%s'\n", argv[1]); return 1; |
