2 * wmmisc - WindowMaker Dockapp for monitoring misc. information.
3 * Copyright (C) 2003-2006 Jesse S. (luxorfalls@sbcglobal.net)
5 * wmmisc is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * wmmisc is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with wmmisc; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #include <bits/getopt_core.h>
30 #endif /* USE_MTRACE */
32 #include <libdockapp/wmgeneral.h>
34 #include "wmmisc-master.xpm"
35 #include "dockapp_main.h"
36 #include "dockapp_draw.h"
39 dockapp_show_help( const char* wm_name
)
41 printf( "Usage: %s [OPTION]...\n", wm_name
);
42 printf( "This is a simple WindowMaker 'DockApp' that will monitor the following:\n" );
43 printf( "Number of users logged in, total processes, total number of processes running,\n" );
44 printf( "the system's fork count and load average.\n\n" );
45 printf( " -h display this help and exit\n" );
46 printf( " -v output version information and exit\n" );
47 printf( " -display DISPLAY set display\n");
48 printf( " -geometry +x+y set position\n\n");
49 printf( "Report bugs to <" PACKAGE_BUGREPORT
">.\n" );
53 dockapp_show_version( void )
55 printf( "%s\n", PACKAGE_STRING
);
56 printf( "Written by %s <%s>\n\n", DOCKAPP_AUTHOR
, DOCKAPP_AUTHOR_EMAIL
);
57 printf( "Copyright (C) 2003-2006 %s\n", DOCKAPP_AUTHOR
);
58 printf( "This is free software; see the source for copying conditions. There is NO\n" );
59 printf( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" );
63 dockapp_exit( int signal_received
)
67 #endif /* USE_MTRACE */
71 "%s: Exiting cleanly with signal %d\n",
80 dockapp_crash( int signal_received
)
83 "%s: got signal %d -- bailing out!\n",
87 "It appears that %s has encountered an error.\n",
90 "If this continues to happen, please run '%s core' from a debugger,\n",
93 "such as gdb, and report the output to <%s>.\n",
100 main( int argc
, char** argv
)
103 const struct option longopts
[] = {
104 {"display", required_argument
, NULL
, 0},
105 {"geometry", required_argument
, NULL
, 0},
111 #endif /* USE_MTRACE */
113 signal( SIGINT
, dockapp_exit
);
114 signal( SIGSEGV
, dockapp_crash
);
116 opt
= getopt_long_only( argc
, argv
, "hv", longopts
, NULL
);
124 dockapp_show_help( argv
[0] );
131 dockapp_show_version();
137 opt
= getopt_long_only( argc
, argv
, "hv", longopts
, NULL
);
140 createXBMfromXPM( wmmisc_mask_bits
,
143 wmmisc_mask_height
);
150 wmmisc_mask_height
);
154 dockapp_draw_small_str( "USERS", 4, 4 );
155 dockapp_draw_small_str( "PROCS", 4, 11 );
156 dockapp_draw_small_str( "ACTIVE", 4, 18 );
158 dockapp_draw_small_str( "UP", 4, 28 );
159 dockapp_draw_small_str( "DAYS", 4, 37 );
160 dockapp_draw_small_str( "WEEKS", 4, 44 );
162 dockapp_draw_small_str( "LOAD", 4, 53 );