commit 529a451
uint
·
2026-10-30 13:02:06 +0000 UTC
parent 053a362
Pipe: Make testctl
1 files changed,
+27,
-8
+27,
-8
1@@ -1,17 +1,36 @@
2 #include <stdlib.h>
3+#include <string.h>
4
5 #include "ulepipe.h"
6
7-struct {
8- int x;
9- int y;
10- int z;
11- char* name;
12-} state = { 0 };
13+#define sockpath "/tmp/ulepipe_test.sock"
14+#define ssame(a, b) (!strcmp(a, b))
15
16-int main(void)
17+enum type {
18+ TEST_STOP,
19+ TEST_NAME_CHANGE,
20+} type;
21+
22+typedef struct {
23+ int x, y;
24+ char name[64];
25+ enum type type;
26+} some_data_layout;
27+
28+int main(int argc, char* argv[])
29 {
30- ulepipe master = { 0 };
31+ const char* cmd = argv[1];
32+
33+ if (ssame(cmd, "stop")) {
34+ some_data_layout stop_data = {0, 0, "die", TEST_STOP};
35+ ulepipe_send(sockpath, &stop_data, sizeof(stop_data));
36+ }
37+
38+ if (ssame(cmd, "name_change")) {
39+ some_data_layout name_change_data = {0, 0, "tester123", TEST_NAME_CHANGE};
40+ ulepipe_send(sockpath, &name_change_data, sizeof(name_change_data));
41+ }
42+
43 return EXIT_SUCCESS;
44 }
45