Skip to content

Commit 751ed7b

Browse files
Added: Add support for --version to print $TERMUX__PREFIX/libexec/termux-api-broadcast version
1 parent e8b0013 commit 751ed7b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

termux-api.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
#include "termux-api.h"
2424

25+
#define TERMUX_API_PACKAGE_VERSION "0.57"
26+
2527
#ifndef PREFIX
2628
# define PREFIX "/data/data/com.termux/files/usr"
2729
#endif
@@ -364,6 +366,13 @@ int transmit_socket_to_stdout(int input_socket_fd) {
364366
}
365367

366368
int run_api_command(int argc, char **argv) {
369+
// If only `--version` argument is passed
370+
if (argc == 2 && strcmp(argv[1], "--version") == 0) {
371+
fprintf(stdout, "%s\n", TERMUX_API_PACKAGE_VERSION);
372+
fflush(stdout);
373+
exit(0);
374+
}
375+
367376
// Do not transform children into zombies when they terminate:
368377
struct sigaction sigchld_action = {
369378
.sa_handler = SIG_DFL,

0 commit comments

Comments
 (0)