镜像自地址
https://github.com/JGZYES/ParlzPackageManger.git
已同步 2026-09-11 08:52:45 +08:00
color: strip trailing newline from formatted message (no blank lines between [PMM] lines)
这个提交包含在:
@@ -21,6 +21,12 @@ static void pmmsg(FILE *stream, int fd, const char *level, int wrap_color, const
|
|||||||
char buf[4096];
|
char buf[4096];
|
||||||
vsnprintf(buf, sizeof(buf), fmt, ap);
|
vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||||
|
|
||||||
|
/* Trim any trailing newline(s) from the formatted message — many source
|
||||||
|
* calls end their format with "\n", and we add exactly one below. Without
|
||||||
|
* this, "[PMM]:[INFO]msg\n" would print a blank line after every message. */
|
||||||
|
size_t len = strlen(buf);
|
||||||
|
while (len && (buf[len-1] == '\n' || buf[len-1] == '\r')) buf[--len] = '\0';
|
||||||
|
|
||||||
int tty = IS_TTY_FD(fd);
|
int tty = IS_TTY_FD(fd);
|
||||||
if (tty && wrap_color)
|
if (tty && wrap_color)
|
||||||
fprintf(stream, "\033[%dm[PMM]:[%s]%s\033[0m\n", wrap_color, level, buf);
|
fprintf(stream, "\033[%dm[PMM]:[%s]%s\033[0m\n", wrap_color, level, buf);
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户