diff options
-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); |