commit b500fe861c6b21ef262e6e867d7eb5cae61ac698 from: Omar Polo date: Thu Jun 07 19:33:46 2018 UTC Updated man + version flag commit - e9f0b46746ab1311a17ca5270941e67640710ec7 commit + b500fe861c6b21ef262e6e867d7eb5cae61ac698 blob - 04b51536edefac28f478e91734e51cdc7593d318 blob + 8abc957166eab82c7d2d1f8afc5f6f7d470131a2 --- mymenu.1 +++ mymenu.1 @@ -15,7 +15,11 @@ on exit. .Sh OPTIONS .Bl -tag -width Ds .It Fl a -The first completion (if any) is always selected. This is like dmenu +The first completion (if any) is always selected. This is like dmenu. +.It Fl h +Print a small usage message to stderr. +.It Fl v +Print version and exit. .El .Sh RESOURCES @@ -113,8 +117,9 @@ whole UTF-8 support is still kinda naïve and should b .Sh EXIT STATUS -0 when the user select an entry, 1 when the user press Esc and -EX_UNAVAILABLE if the connection to X fails. +0 when the user select an entry, 1 when the user press Esc, EX_USAGE +if used with wrong flags and EX_UNAVAILABLE if the connection to X +fails. .Sh SEE ALSO .Xr dmenu 1 blob - eb15fa7216d49f57891354c550d1defa2790f9d4 blob + 56685a8550857da3ec780b843dfe04d2d455e489 --- mymenu.c +++ mymenu.c @@ -21,6 +21,10 @@ #ifdef USE_XFT # include +#endif + +#ifndef VERSION +# define VERSION "unknown" #endif #define nil NULL @@ -704,13 +708,16 @@ int main(int argc, char **argv) { // parse the command line options int ch; - while ((ch = getopt(argc, argv, "ah")) != -1) { + while ((ch = getopt(argc, argv, "ahv")) != -1) { switch (ch) { case 'a': first_selected = true; break; case 'h': usage(*argv); + return 0; + case 'v': + fprintf(stderr, "%s version: %s\n", *argv, VERSION); return 0; default: usage(*argv);