33 * License : GPLv3
44 * Authors : Aoran Zeng <[email protected] > 55 * Created on : <2023-08-29>
6- * Last modified : <2024-06-08 >
6+ * Last modified : <2024-06-11 >
77 *
88 * chsrc:
99 *
2828#define chsrc_warn_remarkably (str ) xy_warn_remarkably(App_Name,"警告",str);
2929#define chsrc_error_remarkably (str ) xy_error_remarkably(App_Name,"错误",str);
3030
31+ void
32+ chsrc_check_remarkably (const char * check_what , const char * check_type , bool exist )
33+ {
34+ if (!exist )
35+ {
36+ xy_log_remarkably (App_Name , xy_str_to_bold (xy_str_to_red ("检查" )),
37+ xy_strjoin (5 , xy_str_to_red ("x " ), check_type , " " , xy_str_to_red (check_what ), " 不存在" ));
38+ }
39+ else
40+ {
41+ xy_log_remarkably (App_Name , xy_str_to_bold (xy_str_to_green ("检查" )),
42+ xy_strjoin (5 , xy_str_to_green ("√ " ), check_type , " " , xy_str_to_green (check_what ), " 存在" ));
43+ }
44+ }
45+
3146
3247bool Cli_Option_IPv6 = false;
3348bool Cli_Option_Locally = false;
@@ -54,14 +69,12 @@ query_program_exist (char *check_cmd, char *prog_name)
5469 if (0 != ret )
5570 {
5671 // xy_warn (xy_strjoin(4, "× 命令 ", progname, " 不存在,", buf));
57- xy_log_remarkably (App_Name , xy_str_to_bold (xy_str_to_red ("检查" )),
58- xy_strjoin (4 , xy_str_to_red ("x " ), "命令 " , xy_str_to_red (prog_name ), " 不存在" ));
72+ chsrc_check_remarkably (prog_name , "命令" , false);
5973 return false;
6074 }
6175 else
6276 {
63- xy_log_remarkably (App_Name , xy_str_to_bold (xy_str_to_green ("检查" )),
64- xy_strjoin (4 , xy_str_to_green ("√ " ), "命令 " , xy_str_to_green (prog_name ), " 存在" ));
77+ chsrc_check_remarkably (prog_name , "命令" , true);
6578 return true;
6679 }
6780}
0 commit comments