From 01bb8bdecfd1e9ce7d699639fe69cd86f5e468c3 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Wed, 11 Jul 2018 22:12:50 -0400 Subject: [PATCH] wmmisc: Add support for wmgeneral's -display command line argument --- wmmisc/src/dockapp_main.c | 14 ++++++++++---- wmmisc/wmmisc.1 | 4 +++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/wmmisc/src/dockapp_main.c b/wmmisc/src/dockapp_main.c index fb22631..bc014d5 100644 --- a/wmmisc/src/dockapp_main.c +++ b/wmmisc/src/dockapp_main.c @@ -18,6 +18,7 @@ * */ +#include #include #include #include @@ -41,8 +42,9 @@ dockapp_show_help( const char* wm_name ) printf( "This is a simple WindowMaker 'DockApp' that will monitor the following:\n" ); printf( "Number of users logged in, total processes, total number of processes running,\n" ); printf( "the system's fork count and load average.\n\n" ); - printf( " -h display this help and exit\n" ); - printf( " -v output version information and exit\n\n" ); + printf( " -h display this help and exit\n" ); + printf( " -v output version information and exit\n" ); + printf( " -display DISPLAY set display\n\n"); printf( "Report bugs to <" PACKAGE_BUGREPORT ">.\n" ); } @@ -97,6 +99,10 @@ int main( int argc, char** argv ) { int opt = 0; + const struct option longopts[] = { + {"display", required_argument, NULL, 0}, + {0, 0, 0, 0} + }; #ifdef USE_MTRACE mtrace(); @@ -105,7 +111,7 @@ main( int argc, char** argv ) signal( SIGINT, dockapp_exit ); signal( SIGSEGV, dockapp_crash ); - opt = getopt( argc, argv, "hv" ); + opt = getopt_long_only( argc, argv, "hv", longopts, NULL); while ( -1 != opt ) { @@ -126,7 +132,7 @@ main( int argc, char** argv ) } } - opt = getopt( argc, argv, "hv" ); + opt = getopt_long_only( argc, argv, "hv", longopts, NULL); } createXBMfromXPM( wmmisc_mask_bits, diff --git a/wmmisc/wmmisc.1 b/wmmisc/wmmisc.1 index 8b21b22..ea281c0 100644 --- a/wmmisc/wmmisc.1 +++ b/wmmisc/wmmisc.1 @@ -37,7 +37,9 @@ Output version information and exit .TP .B \-h Display help and exit - +.TP +.B \-display DISPLAY +Set display .SH BUGS Report bugs and suggestion to the current \fBwmmisc\fR maintainer: Jesse S. .