aboutsummaryrefslogtreecommitdiff
path: root/booki.c
diff options
context:
space:
mode:
Diffstat (limited to 'booki.c')
-rw-r--r--booki.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/booki.c b/booki.c
index 1cc0aad..4a32065 100644
--- a/booki.c
+++ b/booki.c
@@ -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;