]>
glassweightruler.freedombox.rocks Git - Ventoy.git/blob - LinuxGUI/Ventoy2Disk/main_webui.c
10 #include <sys/types.h>
11 #include <linux/limits.h>
12 #include <ventoy_define.h>
13 #include <ventoy_util.h>
14 #include <ventoy_json.h>
15 #include <ventoy_disk.h>
16 #include <ventoy_http.h>
18 char g_log_file
[PATH_MAX
];
19 char g_ini_file
[PATH_MAX
];
21 int ventoy_log_init(void);
22 void ventoy_log_exit(void);
24 void ventoy_signal_stop(int sig
)
26 vlog("ventoy server exit due to signal ...\n");
27 printf("ventoy server exit ...\n");
36 int main(int argc
, char **argv
)
40 const char *ip
= "127.0.0.1";
41 const char *port
= "24680";
45 printf("Invalid argc %d\n", argc
);
49 if (isdigit(argv
[1][0]))
54 if (isdigit(argv
[2][0]))
59 snprintf(g_log_file
, sizeof(g_log_file
), "log.txt");
60 snprintf(g_ini_file
, sizeof(g_ini_file
), "./Ventoy2Disk.ini");
61 for (i
= 0; i
< argc
; i
++)
63 if (argv
[i
] && argv
[i
+ 1] && strcmp(argv
[i
], "-l") == 0)
65 snprintf(g_log_file
, sizeof(g_log_file
), "%s", argv
[i
+ 1]);
67 else if (argv
[i
] && argv
[i
+ 1] && strcmp(argv
[i
], "-i") == 0)
69 snprintf(g_ini_file
, sizeof(g_ini_file
), "%s", argv
[i
+ 1]);
75 vlog("===============================================\n");
76 vlog("===== Ventoy2Disk %s %s:%s =====\n", ventoy_get_local_version(), ip
, port
);
77 vlog("===============================================\n");
83 rc
= ventoy_http_start(ip
, port
);
86 printf("Ventoy failed to start http server, check log.txt for detail\n");
90 signal(SIGINT
, ventoy_signal_stop
);
91 signal(SIGTSTP
, ventoy_signal_stop
);
92 signal(SIGQUIT
, ventoy_signal_stop
);