Skip to content

Commit

Permalink
Make application arguments optional
Browse files Browse the repository at this point in the history
If no application is specified, run without starting a child
process. Leave it up to the user to start applications externally
and stop cage with a signal.
  • Loading branch information
emersion committed Nov 12, 2024
1 parent 0208f56 commit 21dc208
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cage.1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cage - a Wayland kiosk compositor

# SYNOPSIS

*cage* [-dhmrsv] [--] _application_ [application argument ...]
*cage* [-dhmrsv] [--] [_application_...]

# DESCRIPTION

Expand Down
9 changes: 2 additions & 7 deletions cage.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static void
usage(FILE *file, const char *cage)
{
fprintf(file,
"Usage: %s [OPTIONS] [--] APPLICATION\n"
"Usage: %s [OPTIONS] [--] [APPLICATION...]\n"
"\n"
" -d\t Don't draw client side decorations, when possible\n"
" -h\t Display this help message\n"
Expand Down Expand Up @@ -268,11 +268,6 @@ parse_args(struct cg_server *server, int argc, char *argv[])
}
}

if (optind >= argc) {
usage(stderr, argv[0]);
return false;
}

return true;
}

Expand Down Expand Up @@ -588,7 +583,7 @@ main(int argc, char *argv[])
}
#endif

if (!spawn_primary_client(&server, argv + optind, &pid, &sigchld_source)) {
if (optind < argc && !spawn_primary_client(&server, argv + optind, &pid, &sigchld_source)) {
ret = 1;
goto end;
}
Expand Down

0 comments on commit 21dc208

Please sign in to comment.