intirain před 4 roky
rodič
revize
70670ad79c
3 změnil soubory, kde provedl 24 přidání a 5 odebrání
  1. 2 2
      Makefile
  2. 2 2
      include/vcc/version.h
  3. 20 1
      main.c

+ 2 - 2
Makefile

@@ -1,5 +1,5 @@
 VCC_MAJOR 		= 1
-VCC_MINOR 		= 34
+VCC_MINOR 		= 35
 VCC_PATCH 		= 0
 VCC_STR 		= -rc 
 
@@ -21,7 +21,7 @@ CFLAGS 			= -std=gnu11 -Wall -Wextra -Werror -Iinclude -g $(libgcrypt_cflags) -L
 			  -Llibs -lreadconf -Ilibs/readconf/include 
 MAKEFLAGS 		= --no-print-directory
 VCC_DEFSERV 		= 39.104.27.216
-VCC_VERSION 		= VCC $(VCC_MAJOR).$(VCC_MINOR).$(VCC_PATCH) \
+VCC_VERSION 		= vcc $(VCC_MAJOR).$(VCC_MINOR).$(VCC_PATCH) \
 		  $(VCC_COMPILE_TIME) $(VCC_COMPILE_BY)
 
 all : macros

+ 2 - 2
include/vcc/version.h

@@ -1,2 +1,2 @@
-#define VCC_VERSION "VCC 1.34.0 Sat Jun 18 04:30:02 PM CST 2022 root"
-#define VCC_SEMVER "vcc 1.34.0-rc "
+#define VCC_VERSION "vcc 1.35.0 Sat Jun 18 10:38:43 PM CST 2022 root"
+#define VCC_SEMVER "vcc 1.35.0-rc "

+ 20 - 1
main.c

@@ -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);