diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-02-13 21:04:20 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-02-13 21:04:20 +0000 |
commit | 40d7da6cb947264360b2c8fa78235a67e9019ec4 (patch) | |
tree | 2316330fb5be746defaaa5d651a5c115c362553e /app | |
parent | b1112719dae55a13a9cc24d8a4705101f6aa8595 (diff) |
add usage() for when an unknown option is given.
from Gleydson Soares <gsoares@gmail.com>, thanks!
ok jasper@
Diffstat (limited to 'app')
-rw-r--r-- | app/cwm/calmwm.c | 13 | ||||
-rw-r--r-- | app/cwm/calmwm.h | 3 |
2 files changed, 13 insertions, 3 deletions
diff --git a/app/cwm/calmwm.c b/app/cwm/calmwm.c index 1633c30ef..2ae813d3b 100644 --- a/app/cwm/calmwm.c +++ b/app/cwm/calmwm.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: calmwm.c,v 1.8 2008/02/13 12:09:47 oga Exp $ + * $Id: calmwm.c,v 1.9 2008/02/13 21:04:19 oga Exp $ */ #include "headers.h" @@ -71,7 +71,7 @@ main(int argc, char **argv) DefaultFontName = xstrdup(optarg); break; default: - errx(1, "Unknown option '%c'", ch); + usage(); } } argc -= optind; @@ -321,3 +321,12 @@ _sigchld_cb(int which) (pid < 0 && errno == EINTR)) ; } + +void +usage(void) +{ + extern char *__progname; + + fprintf(stderr, "usage: %s [-s] [-d display] [-f fontname] \n", __progname); + exit(1); +} diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index 50e7c3329..8446718b6 100644 --- a/app/cwm/calmwm.h +++ b/app/cwm/calmwm.h @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: calmwm.h,v 1.19 2008/01/16 11:39:20 oga Exp $ + * $Id: calmwm.h,v 1.20 2008/02/13 21:04:19 oga Exp $ */ #ifndef _CALMWM_H_ @@ -312,6 +312,7 @@ int x_errorhandler(Display *, XErrorEvent *); void x_setup(char *display_name); char *x_screenname(int); void x_setupscreen(struct screen_ctx *, u_int); +void usage(void); struct client_ctx *client_find(Window); void client_setup(void); |