X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=tools%2Fblergtool.c;h=35af915a620121a02a452c637f5fe408070788d9;hb=7034e4be0e5b0cd1a27a067fee5970cf61500b60;hp=ab98a942d36744c31a15b631cbb8019e26dd7aaa;hpb=fd07ab46f5f37057e9290441931d5de92d62761b;p=blerg.git diff --git a/tools/blergtool.c b/tools/blergtool.c index ab98a94..35af915 100644 --- a/tools/blergtool.c +++ b/tools/blergtool.c @@ -7,7 +7,18 @@ #include "tags.h" void help() { - printf("Usage: blergtool [record]\n"); + printf( + "Usage: blergtool [args]\n" + "\n" + "Where command is one of:\n" + "\n" + " blergtool store \n" + " blergtool fetch [record]\n" + " blergtool mute \n" + " blergtool unmute \n" + " blergtool subscribe \n" + " blergtool unsubscribe \n" + ); } int main(int argc, char *argv[]) { @@ -88,6 +99,26 @@ int main(int argc, char *argv[]) { blerg_set_mute(f, 0); blerg_close(f); + } else if (strncmp(argv[1], "subscribe", 9) == 0) { + if (argc < 4) { + printf("Not enough arguments for subscribe\n"); + help(); + exit(1); + } + if (!subscription_add(argv[2], argv[3])) { + printf("Could not subscribe %s to %s\n", argv[2], argv[3]); + exit(1); + } + } else if (strncmp(argv[1], "unsubscribe", 11) == 0) { + if (argc < 4) { + printf("Not enough arguments for unsubscribe\n"); + help(); + exit(1); + } + if (!subscription_remove(argv[2], argv[3])) { + printf("Could not subscribe %s to %s\n", argv[2], argv[3]); + exit(1); + } } else { help(); }