Let 'git <command> -h' show usage without a git dir
[gitweb.git] / imap-send.c
index e4c83b9d5b989671c1accc573235479ad77a5ab7..04e537406e4113d5c1ead7b7e4a1a425c9b2bf09 100644 (file)
@@ -93,6 +93,8 @@ struct msg_data {
        unsigned int crlf:1;
 };
 
+static const char imap_send_usage[] = "git imap-send < <mbox>";
+
 #define DRV_OK          0
 #define DRV_MSG_BAD     -1
 #define DRV_BOX_BAD     -2
@@ -238,7 +240,7 @@ static const char *Flags[] = {
 #ifndef NO_OPENSSL
 static void ssl_socket_perror(const char *func)
 {
-       fprintf(stderr, "%s: %s\n", func, ERR_error_string(ERR_get_error(), 0));
+       fprintf(stderr, "%s: %s\n", func, ERR_error_string(ERR_get_error(), NULL));
 }
 #endif
 
@@ -1491,6 +1493,9 @@ int main(int argc, char **argv)
 
        git_extract_argv0_path(argv[0]);
 
+       if (argc != 1)
+               usage(imap_send_usage);
+
        /* init the random number generator */
        arc4_init();