-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.cpp
More file actions
56 lines (44 loc) · 737 Bytes
/
Copy pathdebug.cpp
File metadata and controls
56 lines (44 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
extern "C" {
#include "cJSON.h"
#include "config.h"
#include "http.h"
#include "stdio_transport.h"
}
#include "tools.h"
#include <stdio.h>
#include <signal.h>
static volatile sig_atomic_t g_stop = 0;
void on_sigint(int sig)
{
(void)sig;
g_stop = 1;
}
int main() {
signal(SIGINT, on_sigint);
define_tools();
int err=0;
#if defined(MCP_STDIO)
err=init_stdio();
#else
err=init_http();
#endif
if (err != 0)
{
fprintf(stderr, "Failed to initialize MCP client\n");
return 1;
}
while (!g_stop)
{
#if defined(MCP_STDIO)
process_stdio();
#else
process_http();
#endif
}
#if defined(MCP_STDIO)
end_stdio();
#else
end_http();
#endif
return 0;
}