diff options
| author | Doan Luu Duc Tai <doan@luuduct.ai> | 2026-09-08 14:46:47 -0500 |
|---|---|---|
| committer | Doan Luu Duc Tai <doan@luuduct.ai> | 2026-09-08 14:46:47 -0500 |
| commit | f34fb5042d40c186583f9e3009d8a1dd71d07d43 (patch) | |
| tree | 3f494f3723ebe9f173d0702a97509794f0ef85a5 /main.c | |
Initial commitmain
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* + * vfetch - neofetch but the ascii part is a video + * + * Copyright (C) 2026 Doan Luu Duc Tai + * + */ + +#include <stddef.h> +#include <sysexits.h> +#include "src/config.h" +#include "src/core.h" +#include "src/error.h" +#include "src/state.h" + +/* Required for the POSIX signal handler, which has a fixed signature and cannot + * be passed user context. This global is the standard mechanism for the handler + * to access application state. + * NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) */ +AppState *global_signal_handler_state_ptr = NULL; + +/* Required for the self-pipe mechanism, which allows the signal handler to + * safely communicate with the main application thread. + * NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) */ +int global_signal_pipe[2] = {-1, -1}; + +int main(int argc, const char *argv[]) { + AppState state = {0}; + VfetchArgs args = {0}; + + VfetchError err = execute_program(argc, argv, &state, &args); + + int exit_code = EX_OK; + if (err) { + exit_code = map_vfetch_error_to_exit_code(err); + } + + cleanup_application(&state, &args); + return exit_code; +} |
