|
|
@@ -29,9 +29,11 @@
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
#include <sys/types.h>
|
|
|
+#include <sys/wait.h>
|
|
|
#include <sys/socket.h>
|
|
|
#include <netinet/in.h>
|
|
|
#include <arpa/inet.h>
|
|
|
+
|
|
|
#include <poll.h>
|
|
|
#include <signal.h>
|
|
|
#include <getopt.h>
|
|
|
@@ -313,6 +315,23 @@ int do_new_request(struct vcc_relay_header *hdr) {
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int vcc_show_version(void) {
|
|
|
+ int pid;
|
|
|
+
|
|
|
+ printf("%s\n", VCC_VERSION);
|
|
|
+ fflush(stdout);
|
|
|
+
|
|
|
+ if (!(pid = fork())) {
|
|
|
+ execl("/etc/vccrc", VCC_VERSION, VCC_SEMVER, NULL);
|
|
|
+
|
|
|
+ exit(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ wait4(pid, NULL, 0, NULL);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
int init_signal(void) {
|
|
|
struct sigaction act;
|
|
|
@@ -341,7 +360,7 @@ int main(int argc, char **argv) {
|
|
|
bindtextdomain("vcc", "lang");
|
|
|
textdomain("vcc");
|
|
|
|
|
|
- printf(VCC_VERSION "\n");
|
|
|
+ vcc_show_version();
|
|
|
|
|
|
n = parse_args(argc, argv, &port, &ip);
|
|
|
init_socket(ip, port);
|