diff options
Diffstat (limited to 'sesman')
-rw-r--r-- | sesman/sesman.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/sesman/sesman.c b/sesman/sesman.c index c9666943..8bebaa39 100644 --- a/sesman/sesman.c +++ b/sesman/sesman.c @@ -131,6 +131,19 @@ sesman_main_loop(void) } /******************************************************************************/ +void +print_usage(int retcode) +{ + g_printf("xrdp-sesman - xrdp session manager\n\n"); + g_printf("Usage: xrdp-sesman [options]\n"); + g_printf(" -n, --nodaemon run as foreground process\n"); + g_printf(" -k, --kill kill running xrdp-sesman\n"); + g_printf(" -h, --help show this help\n"); + g_deinit(); + g_exit(retcode); +} + +/******************************************************************************/ int DEFAULT_CC main(int argc, char **argv) { @@ -166,16 +179,7 @@ main(int argc, char **argv) (0 == g_strcasecmp(argv[1], "-help")) || (0 == g_strcasecmp(argv[1], "-h")))) { - /* help screen */ - g_printf("sesman - xrdp session manager\n\n"); - g_printf("usage: sesman [command]\n\n"); - g_printf("command can be one of the following:\n"); - g_printf("-n, -ns, --nodaemon starts sesman in foreground\n"); - g_printf("-k, --kill kills running sesman\n"); - g_printf("-h, --help shows this help\n"); - g_printf("if no command is specified, sesman is started in background"); - g_deinit(); - g_exit(0); + print_usage(0); } else if ((2 == argc) && ((0 == g_strcasecmp(argv[1], "--kill")) || (0 == g_strcasecmp(argv[1], "-kill")) || @@ -229,16 +233,13 @@ main(int argc, char **argv) else { /* there's something strange on the command line */ - g_printf("sesman - xrdp session manager\n\n"); - g_printf("error: invalid command line\n"); - g_printf("usage: sesman [ --nodaemon | --kill | --help ]\n"); - g_deinit(); - g_exit(1); + g_printf("Error: invalid command line arguments\n\n"); + print_usage(1); } if (g_file_exist(pid_file)) { - g_printf("sesman is already running.\n"); + g_printf("xrdp-sesman is already running.\n"); g_printf("if it's not running, try removing "); g_printf("%s", pid_file); g_printf("\n"); |