1
0
mirror of https://codeberg.org/vyivel/dulcepan/ synced 2025-06-24 14:34:17 +03:00

2 Commits

View File

@ -1,6 +1,7 @@
#include <getopt.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <wayland-client-core.h>
#include <wayland-client-protocol.h>
#include <xkbcommon/xkbcommon.h>
@ -167,8 +168,9 @@ static void help(const char *prog) {
" -o <path> Specify the output file path.\n"
"\n"
"If the output file path is not specified, the resuling image will be printed to\n"
"the standard output. If the output file format is not specified, it is guessed\n"
"from the output file path if it's specified, and assumed to be PNG otherwise.\n"
"the standard output, which is expected to not be a terminal. If the output file\n"
"format is not specified, it is guessed from the output file path if it's\n"
"specified, and assumed to be PNG otherwise.\n"
"\n"
"Supported formats: png, ppm.\n"
"\n"
@ -210,9 +212,13 @@ int main(int argc, char **argv) {
}
}
state.basedir_ctx = sfdo_basedir_ctx_create();
dp_config_load(&state, config_path);
if (state.output_path == NULL && isatty(STDOUT_FILENO)) {
fprintf(stderr,
"Refusing to run as the standard output is a terminal and there's no output file\n"
"path specified.\n\n");
help(argv[0]);
exit(1);
}
if (state.output_format == DP_FILE_UNKNOWN) {
if (state.output_path != NULL) {
@ -227,6 +233,10 @@ int main(int argc, char **argv) {
}
}
state.basedir_ctx = sfdo_basedir_ctx_create();
dp_config_load(&state, config_path);
wl_list_init(&state.outputs);
wl_list_init(&state.seats);