+/* Blerg is (C) 2011 The Dominion of Awesome, and is distributed under a
+ * BSD-style license. Please see the COPYING file for details.
+ */
#include <stdio.h>
#include <stdlib.h>
#include "database.h"
char *data;
int size;
- blerg_fetch(f, record, &data, &size);
+ if (blerg_fetch(f, record, &data, &size)) {
+ fwrite(data, 1, size, stdout);
+ free(data);
+ }
blerg_close(f);
- fwrite(data, 1, size, stdout);
- free(data);
} else if (strncmp(argv[1], "list", 4) == 0) {
char *tag = argv[2];
- uint64_t count = 50;
- struct tag *list = tag_list(tag, 0, &count, -1);
+ int count = 50;
+ struct blergref *list = tag_list(tag, 0, &count, -1);
if (list == NULL) {
printf("No entries");
} else {
}
free(list);
}
+ } else if (strncmp(argv[1], "mute", 4) == 0) {
+ char *store = argv[2];
+ struct blerg *f = blerg_open(store);
+ if (!f) {
+ printf("Blerg open failed\n");
+ exit(1);
+ }
+
+ blerg_set_mute(f, 1);
+ blerg_close(f);
+ } else if (strncmp(argv[1], "unmute", 6) == 0) {
+ char *store = argv[2];
+ struct blerg *f = blerg_open(store);
+ if (!f) {
+ printf("Blerg open failed\n");
+ exit(1);
+ }
+
+ blerg_set_mute(f, 0);
+ blerg_close(f);
} else {
help();
}