From: Urban Wallasch Date: Wed, 31 Jul 2019 19:56:57 +0000 (+0200) Subject: * Added use message to telehttpd. X-Git-Tag: v0.1.0~46 X-Git-Url: https://git.packet-gain.de/?a=commitdiff_plain;h=84edc0379a7e92da268eefcaa46cf219367e652a;p=ets2_tele.git * Added use message to telehttpd. --- diff --git a/telehttpd.c b/telehttpd.c index ff684b3..ede748d 100644 --- a/telehttpd.c +++ b/telehttpd.c @@ -203,6 +203,22 @@ static int serve_http(void) { return 0; } +static void usage( const char *me ) +{ + const char *p; + if ( NULL != ( p = strrchr( me, '/' ) ) ) + me = ++p; + fprintf( stderr, "Usage: %s [options]\n", me ); + fprintf( stderr, + " Options:\n" + " -b str bind interface; default: * (all)\n" + " -h str host name; default: localhost\n" + " -i file file to serve as index file; default: index.html\n" + " -o str origin; default: http://localhost\n" + " -p N TCP listen port; default: 8837\n" + ); +} + static int config( int argc, char *argv[] ) { int opt; const char *ostr = "+b:h:i:o:p:"; @@ -226,11 +242,13 @@ static int config( int argc, char *argv[] ) { break; case ':': EPRINT( "Missing argument for option '%c'\n", optopt ); + usage( argv[0] ); return -1; break; case '?': default: EPRINT( "Unrecognized option '%c'\n", optopt ); + usage( argv[0] ); return -1; break; }