mirror of
https://github.com/labwc/labwc.git
synced 2026-03-11 05:33:49 -04:00
src/main.c: add usage()
This commit is contained in:
parent
d4bd99888e
commit
7fc643fdb9
1 changed files with 14 additions and 7 deletions
21
src/main.c
21
src/main.c
|
|
@ -7,6 +7,15 @@ struct server server = { 0 };
|
||||||
struct rcxml rc = { 0 };
|
struct rcxml rc = { 0 };
|
||||||
struct theme theme = { 0 };
|
struct theme theme = { 0 };
|
||||||
|
|
||||||
|
static const char labwc_usage[] =
|
||||||
|
"Usage: labwc [-h] [-s <command>]\n";
|
||||||
|
|
||||||
|
static void usage(void)
|
||||||
|
{
|
||||||
|
printf("%s", labwc_usage);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *startup_cmd = NULL;
|
char *startup_cmd = NULL;
|
||||||
|
|
@ -19,17 +28,13 @@ int main(int argc, char *argv[])
|
||||||
startup_cmd = optarg;
|
startup_cmd = optarg;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Usage: %s [-s startup command]\n", argv[0]);
|
usage();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (optind < argc) {
|
if (optind < argc)
|
||||||
printf("Usage: %s [-s startup command]\n", argv[0]);
|
usage();
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
rcxml_read("data/rc.xml");
|
rcxml_read("data/rc.xml");
|
||||||
theme_read("data/themerc");
|
|
||||||
|
|
||||||
/* Wayland requires XDG_RUNTIME_DIR to be set */
|
/* Wayland requires XDG_RUNTIME_DIR to be set */
|
||||||
if (!getenv("XDG_RUNTIME_DIR")) {
|
if (!getenv("XDG_RUNTIME_DIR")) {
|
||||||
|
|
@ -42,10 +47,12 @@ int main(int argc, char *argv[])
|
||||||
server_init(&server);
|
server_init(&server);
|
||||||
server_start(&server);
|
server_start(&server);
|
||||||
|
|
||||||
|
theme_read("data/themerc");
|
||||||
xbm_load(server.renderer);
|
xbm_load(server.renderer);
|
||||||
|
|
||||||
if (startup_cmd)
|
if (startup_cmd)
|
||||||
spawn_async_no_shell(startup_cmd);
|
spawn_async_no_shell(startup_cmd);
|
||||||
|
|
||||||
wl_display_run(server.wl_display);
|
wl_display_run(server.wl_display);
|
||||||
server_finish(&server);
|
server_finish(&server);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue