diff options
author | Florian Pritz <bluewind@xinu.at> | 2013-05-11 12:10:50 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2013-05-11 12:12:47 +0200 |
commit | 5fd22c17e72e3ff49eb2050133958fe28750415c (patch) | |
tree | 8ee1622141239d21cbb27de7b3131743517cedbe | |
parent | a02a642e9a0cbcbbdd3d97988dc315ad44388b53 (diff) |
fb-helper: Add help output
It is still meant to be only used as a backend for fb-client, but this
makes testing easier.
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r-- | fb-helper.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/fb-helper.c b/fb-helper.c index 760081a..5a429b2 100644 --- a/fb-helper.c +++ b/fb-helper.c @@ -213,6 +213,17 @@ int progress_callback( return 0; } +void display_help() +{ + printf("Usage: fb-helper <options>\n"); + printf("\n"); + printf("Options:\n"); + printf(" -D Print debugging information\n"); + printf(" -h This help\n"); + printf(" -u <url> URL of pastebin or URL to download\n"); + printf(" -f <file> File to upload to URL\n"); +} + int main(int argc, char *argv[]) { CURL *curl = NULL; @@ -244,7 +255,12 @@ int main(int argc, char *argv[]) .url = NULL }; - while ((opt = getopt(argc, argv, "Du:f:m:")) != -1) { + if (argc == 1) { + display_help(); + exit(0); + } + + while ((opt = getopt(argc, argv, "Du:f:m:h")) != -1) { switch (opt) { case 'D': options.debug = 1; break; @@ -252,6 +268,11 @@ int main(int argc, char *argv[]) case 'f': options.file = optarg; break; + case 'h': + display_help(); + exit(0); + break; + default: fprintf(stderr, "Error: unknown option %c", opt); exit(1); |