From df9ea12ea1b0811ef3537a4ecd04cc881348214f Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期一, 27 七月 2020 18:33:47 +0800
Subject: [PATCH] update

---
 test/test.c |   39 ++++++++-------------------------------
 1 files changed, 8 insertions(+), 31 deletions(-)

diff --git a/test/test.c b/test/test.c
index 99e3289..744ac72 100644
--- a/test/test.c
+++ b/test/test.c
@@ -1,35 +1,12 @@
-#include "test.h"
-#define MKEY 0x2222
-int testmatshm() {
+#include "usg_common.h"
+#include "usg_typedef.h"
 
-  int shmid = -1;
-  void *shmp;
-  shmid = shmget(MKEY, 1024, IPC_CREAT | IPC_EXCL | OBJ_PERMS);
-  if (shmid == -1 && errno == EEXIST) {
-    printf("first create\n");
-    shmid = shmget(MKEY, 0, 0);
-  }
-
-  if (shmid == -1)
-    err_exit(errno, "testmatshm shmget");
-
-  shmp = shmat(shmid, NULL, 0);
+void test(char *src, int size) {
+	char dest[size];
+	strncpy(dest, src, size);
+	puts(dest);
 }
-
-typedef struct buf_t { char buf[7]; } buf_t;
-
-void test(int size) {
-  char buf[size];
-  printf("size = %d\n", sizeof(buf));
-}
-
-char msg[10];
 int main() {
-  // testmatshm();
-  // testmatshm();
-
-  // sleep(60);
-
-  // printf("size = %d, msg = %d\n", sizeof(buf_t), sizeof(msg));
-  test(12);
+	char *str = "hello";
+	test(str, strlen(str));
 }
\ No newline at end of file

--
Gitblit v1.8.0