blob: bcb1bc250aba8a1a1cc51a440fd5bf4b3704d8ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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;
}
|