Skip to content

Commit

Permalink
Added: Add support for --version to print `$TERMUX__PREFIX/libexec/…
Browse files Browse the repository at this point in the history
…termux-api-broadcast` version
  • Loading branch information
agnostic-apollo committed Dec 23, 2023
1 parent e8b0013 commit 751ed7b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions termux-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include "termux-api.h"

#define TERMUX_API_PACKAGE_VERSION "0.57"

#ifndef PREFIX
# define PREFIX "/data/data/com.termux/files/usr"
#endif
Expand Down Expand Up @@ -364,6 +366,13 @@ int transmit_socket_to_stdout(int input_socket_fd) {
}

int run_api_command(int argc, char **argv) {
// If only `--version` argument is passed
if (argc == 2 && strcmp(argv[1], "--version") == 0) {
fprintf(stdout, "%s\n", TERMUX_API_PACKAGE_VERSION);
fflush(stdout);
exit(0);
}

// Do not transform children into zombies when they terminate:
struct sigaction sigchld_action = {
.sa_handler = SIG_DFL,
Expand Down

0 comments on commit 751ed7b

Please sign in to comment.