Bläddra i källkod

vcc: robot framework is now okay

intirain 4 år sedan
förälder
incheckning
0ab7fece0d
7 ändrade filer med 25 tillägg och 18 borttagningar
  1. 4 4
      Makefile
  2. 4 1
      include/vcc/plugin.h
  3. 2 2
      include/vcc/version.h
  4. 4 0
      main.c
  5. 10 4
      plugins.c
  6. 1 1
      plugins/Makefile
  7. 0 6
      vcc.c

+ 4 - 4
Makefile

@@ -1,14 +1,14 @@
 VCC_MAJOR 		= 1
-VCC_MINOR 		= 13
-VCC_PATCH 		= 1
+VCC_MINOR 		= 14
+VCC_PATCH 		= 0
 VCC_STR 		= -rc 
 
 VCC_COMPILE_TIME 	= $(shell date)
 VCC_COMPILE_BY 		= $(shell whoami)
 VCC_SEMVER 		= vcc $(VCC_MAJOR).$(VCC_MINOR).$(VCC_PATCH)$(VCC_STR)
 
-srcs 			= main.c vcc.c pretty.c cmd.c crypt.c klist.c plugins.c 
-objs 			= main.o vcc.o pretty.o cmd.o crypt.o klist.o plugins.o 
+srcs 			= main.c vcc.c pretty.c cmd.c crypt.c klist.c plugins.c robot.c 
+objs 			= main.o vcc.o pretty.o cmd.o crypt.o klist.o plugins.o robot.o 
 target 			= vcc 
 libgcrypt_cflags 	= $(shell libgcrypt-config --libs)
 CFLAGS 			= -std=gnu11 -Wall -Wextra -Werror -Iinclude -g $(libgcrypt_cflags) -Lplugins -lplugins 

+ 4 - 1
include/vcc/plugin.h

@@ -49,11 +49,14 @@ extern struct plugin *plugins[];
 
 #define plg_check_enabled() ({	\
 	if (this_plg->state != PLG_INSERTED) { \
-		fprintf(stderr, "*** this plugin didn't inserte. " \
+		fprintf(stderr, "*** this plugin didn't insert. " \
 				"please insert it by -pins and try it again. \n"); \
 		return 1; \
 	} \
 })
 
+int plg_insert(struct plugin *);
+struct plugin *find_plg(char *name);
+
 #endif
 

+ 2 - 2
include/vcc/version.h

@@ -1,2 +1,2 @@
-#define VCC_VERSION "VCC 1.13.1 Sun May  1 13:09:17 CST 2022 root"
-#define VCC_SEMVER "vcc 1.13.1-rc "
+#define VCC_VERSION "VCC 1.14.0 Sun May  1 13:34:23 CST 2022 root"
+#define VCC_SEMVER "vcc 1.14.0-rc "

+ 4 - 0
main.c

@@ -39,6 +39,7 @@
 #include <klist.h>
 #include <vcc/vcc.h>
 #include <vcc/version.h>
+#include <vcc/robot.h>
 #include <vcc/pretty.h>
 #include <vcc/defserv.h> 
 
@@ -270,6 +271,9 @@ int main(int argc, char **argv) {
 	init_socket(ip, port);
 	printf("Connected to server. \n");
 
+	if (mode == MODE_ROBOT) 
+		return robot();
+
 	if (!vos_login()) {
 		/* normally startup */
 

+ 10 - 4
plugins.c

@@ -42,10 +42,10 @@
 #include <vcc/pretty.h>
 
 
-extern struct plugin plg_hello;
+extern struct plugin plg_hello, plg_robot;
 
 struct plugin *plugins[] = {
-	&plg_hello, 
+	&plg_hello, &plg_robot, 
 	(struct plugin *) NULL
 };
 
@@ -72,6 +72,13 @@ struct plugin *find_plg(char *s) {
 	return NULL;
 }
 
+
+int plg_insert(struct plugin *plg) {
+	plg->state = PLG_INSERTED;
+
+	return 0;
+}
+
 int do_cmd_pins(char *s) {
 	struct plugin *p;
 	char name[MSG_SIZE];
@@ -87,8 +94,7 @@ int do_cmd_pins(char *s) {
 		return 1;
 	}
 	
-	p->state = PLG_INSERTED;
-	return 0;
+	return plg_insert(p);
 }
 
 

+ 1 - 1
plugins/Makefile

@@ -1,4 +1,4 @@
-plugins 	= hello
+plugins 	= hello robot
 target 		= libplugins.a 
 
 all: 

+ 0 - 6
vcc.c

@@ -138,12 +138,6 @@ int get_user_info(char *usrname) {
 	return 0;
 }
 
-
-int read_msg(struct vcc_request *buf) {
-	return read(fd, buf, REQ_SIZE);
-}
-
-
 int get_users(void) {
 	struct vcc_request req;