Keep unexposed functions inner

This commit is contained in:
Aoran Zeng 2024-08-19 11:42:31 +08:00
parent 4e349aa583
commit 51d08a5746
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
2 changed files with 33 additions and 33 deletions

View File

@ -84,7 +84,7 @@ chsrc_note2 (const char* str)
* @translation Done
*/
void
chsrc_log_check_result (const char *check_what, const char *check_type, bool exist)
log_check_result (const char *check_what, const char *check_type, bool exist)
{
char *chk_msg = NULL;
char *not_exist_msg = NULL;
@ -121,7 +121,7 @@ chsrc_log_check_result (const char *check_what, const char *check_type, bool exi
* @translation Done
*/
void
chsrc_log_cmd_result (bool result, int ret_code)
log_cmd_result (bool result, int ret_code)
{
char *run_msg = NULL;
char *succ_msg = NULL;
@ -185,12 +185,12 @@ query_program_exist (char *check_cmd, char *prog_name)
if (0 != ret)
{
// xy_warn (xy_strjoin(4, "× 命令 ", progname, " 不存在,", buf));
chsrc_log_check_result (prog_name, msg, false);
log_check_result (prog_name, msg, false);
return false;
}
else
{
chsrc_log_check_result (prog_name, msg, true);
log_check_result (prog_name, msg, true);
return true;
}
}
@ -232,12 +232,12 @@ chsrc_check_file (char *path)
{
if (xy_file_exist (path))
{
chsrc_log_check_result (path, "文件", true);
log_check_result (path, "文件", true);
return true;
}
else
{
chsrc_log_check_result (path, "文件", false);
log_check_result (path, "文件", false);
return false;
}
}
@ -340,7 +340,7 @@ to_human_readable_speed (double speed)
* @return -1
*/
double
test_speed_url (const char *url)
measure_speed (const char *url)
{
char *time_sec = "6";
@ -471,7 +471,7 @@ auto_select_ (SourceInfo *sources, size_t size, const char *target_name)
printf ("%s", xy_strjoin (3, test_msg, src.mirror->site , " ... "));
fflush (stdout);
speed = test_speed_url (url);
speed = measure_speed (url);
}
speeds[i] = speed;
}
@ -781,12 +781,12 @@ chsrc_run (const char *cmd, int run_option)
{
if (! (RunOpt_Dont_Notify_On_Success & run_option))
{
chsrc_log_cmd_result (true, status);
log_cmd_result (true, status);
}
}
else
{
chsrc_log_cmd_result (false, status);
log_cmd_result (false, status);
if (! (run_option & RunOpt_Dont_Abort_On_Failure))
{
chsrc_error ("关键错误,强制结束");

View File

@ -134,13 +134,13 @@ cli_print_available_mirrors ()
{
chsrc_info ("支持以下镜像站");
chsrc_info ("下方 code 列,可用于指定使用某镜像站,请使用 chsrc set <target> <code>\n");
printf (" %-13s%-35s%-38s", "code", "镜像站简写", "镜像站URL"); puts ("镜像站名称");
puts ("------- ----------- ------------------------------------- ---------------------");
// puts ("-------------------------------------------------------------------------------------------------");
printf (" %-13s%-35s%-38s", "code", "镜像站简写", "镜像站URL"); say ("镜像站名称");
say ("------- ----------- ------------------------------------- ---------------------");
// say ("-------------------------------------------------------------------------------------------------");
for (int i = 0; i < xy_arylen (available_mirrors); i++)
{
MirrorSite* mir = available_mirrors[i];
printf ("%-14s%-18s%-41s ", mir->code, mir->abbr, mir->site); puts (mir->name);
printf ("%-14s%-18s%-41s ", mir->code, mir->abbr, mir->site); say (mir->name);
}
}
@ -165,15 +165,15 @@ cli_print_supported_targets_ (const char ***array, size_t size)
void
cli_print_supported_targets ()
{
chsrc_info ("支持对以下目标换源 (同一行表示这几个命令兼容)"); puts("");
puts (xy_str_to_blue ("编程语言开发"));
puts ("-------------------------");
chsrc_info ("支持对以下目标换源 (同一行表示这几个命令兼容)"); br();
say (to_blue ("编程语言开发"));
say ("-------------------------");
cli_print_supported_targets_ (pl_packagers, xy_arylen(pl_packagers));
puts (xy_str_to_blue ("操作系统"));
puts ("-------------------------");
say (to_blue ("操作系统"));
say ("-------------------------");
cli_print_supported_targets_ (os_systems, xy_arylen(os_systems));
puts (xy_str_to_blue ("软件"));
puts ("-------------------------");
say (to_blue ("软件"));
say ("-------------------------");
cli_print_supported_targets_ (wr_softwares, xy_arylen(wr_softwares));
}
@ -215,7 +215,7 @@ cli_print_target_available_sources (SourceInfo sources[], size_t size)
src.url = "Please help to add the upstream url!";
}
printf ("%-14s%-18s%-50s ", mir->code, mir->abbr, src.url);
puts (mir->name);
say (mir->name);
}
}
@ -226,15 +226,15 @@ cli_print_target_features (FeatInfo f, const char *input_target_name)
char *get_msg = xy_2strjoin (" Get: 查看当前源状态 | chsrc get ", input_target_name);
if (f.can_get) printf (" %s%s\n", to_boldgreen(YesMark), to_purple(get_msg));
else printf (" %s%s\n", to_boldred(NoMark), get_msg);puts("");
else printf (" %s%s\n", to_boldred(NoMark), get_msg);br();
char *reset_msg = xy_2strjoin (" Reset: 重置回默认源 | chsrc reset ", input_target_name);
if (f.can_reset) printf (" %s%s\n", to_boldgreen(YesMark), to_purple(reset_msg));
else printf (" %s%s\n", to_boldred(NoMark), reset_msg);puts("");
else printf (" %s%s\n", to_boldred(NoMark), reset_msg);br();
char *user_define_msg = xy_strjoin (4, " UserDefine: 用户自定义换源URL | chsrc set ", input_target_name, " https://user-define-url.org/", input_target_name);
if (f.can_user_define) printf (" %s%s\n", to_boldgreen(YesMark), to_purple(user_define_msg));
else printf (" %s%s\n", to_boldred(NoMark), user_define_msg);puts("");
else printf (" %s%s\n", to_boldred(NoMark), user_define_msg);br();
char *locally_msg = xy_2strjoin (" Locally: 仅对本项目换源 | chsrc set -local ", input_target_name);
@ -242,13 +242,13 @@ cli_print_target_features (FeatInfo f, const char *input_target_name)
switch (f.stcan_locally)
{
case CanNotFully:
printf (" %s%s\n", to_boldred(NoMark), locally_msg);puts("");
printf (" %s%s\n", to_boldred(NoMark), locally_msg);br();
break;
case CanFully:
printf (" %s%s\n", to_boldgreen(YesMark), to_purple(locally_msg));puts("");
printf (" %s%s\n", to_boldgreen(YesMark), to_purple(locally_msg));br();
break;
case CanSemi:
printf (" %s%s\n\n %s\n", to_boldgreen(SemiYesMark), to_purple(locally_msg), f.locally);puts("");
printf (" %s%s\n\n %s\n", to_boldgreen(SemiYesMark), to_purple(locally_msg), f.locally);br();
break;
default:
xy_unreach;
@ -294,7 +294,7 @@ cli_print_help ()
void
cli_print_issues ()
{
puts (
say (
"chsrc issues: Gitee和GitHub两边同时接受issue\n\n"
"- https://gitee.com/RubyMetric/chsrc/issues\n"
"- https://github.com/RubyMetric/chsrc/issues\n"
@ -409,8 +409,8 @@ get_target (const char *input, TargetOp code, char *option)
say (to_boldblue(xy_strjoin (3, "指定使用某源,请使用 chsrc set ", input, " <code>\n")));
say (to_boldgreen("Available Sources: \n"));
// chsrc_info (xy_strjoin (3, "下方 code 列,可用于指定使用某源,请使用 chsrc set ", input, " <code>\n"));
printf (" %-14s%-35s%-43s ", "code", "镜像站简写", "换源URL"); puts ("镜像站名称");
puts ("--------- -------------- ----------------------------------------------- ---------------------");
printf (" %-14s%-35s%-43s ", "code", "镜像站简写", "换源URL"); say ("镜像站名称");
say ("--------- -------------- ----------------------------------------------- ---------------------");
cli_print_target_available_sources (target->sources, target->sources_n);
if (target->featfn)
{