mirror of
https://github.com/RubyMetric/chsrc.git
synced 2024-11-22 05:30:51 +08:00
Fix macOS build error
This commit is contained in:
parent
909391cb37
commit
6579e52f0b
|
@ -779,8 +779,11 @@ chsrc_ensure_root ()
|
||||||
if (0!=atoi(euid)) goto not_root;
|
if (0!=atoi(euid)) goto not_root;
|
||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *msg = NULL;
|
||||||
not_root:
|
not_root:
|
||||||
char *msg = CliOpt_InEnglish ? "Use sudo before the command or switch to root to ensure the necessary permissions" : "请在命令前使用 sudo 或切换为root用户来保证必要的权限";
|
msg = CliOpt_InEnglish ? "Use sudo before the command or switch to root to ensure the necessary permissions"
|
||||||
|
: "请在命令前使用 sudo 或切换为root用户来保证必要的权限";
|
||||||
chsrc_error (msg);
|
chsrc_error (msg);
|
||||||
exit (Exit_UserCause);
|
exit (Exit_UserCause);
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,9 +300,11 @@ _xy_str_to_terminal_style (int style, const char *str)
|
||||||
color_fmt_str = "\e[9m%s\e[0m"; break;
|
color_fmt_str = "\e[9m%s\e[0m"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t len = 0;
|
||||||
new_str:
|
new_str:
|
||||||
// -2 把中间%s减掉
|
// -2 把中间%s减掉
|
||||||
size_t len = strlen (color_fmt_str) - 2;
|
len = strlen (color_fmt_str) - 2;
|
||||||
char *buf = malloc (strlen (str) + len + 1);
|
char *buf = malloc (strlen (str) + len + 1);
|
||||||
sprintf (buf, color_fmt_str, str);
|
sprintf (buf, color_fmt_str, str);
|
||||||
return buf;
|
return buf;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user