X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/6820631175868c277effa7cc05f9cb3197b72654..82eb6e3832dea63be4c22ac4415c3190add43f0b:/util.c diff --git a/util.c b/util.c index 98c5fc5..8808aba 100644 --- a/util.c +++ b/util.c @@ -1,4 +1,4 @@ -#include +/* See LICENSE file for copyright and license details. */ #include #include #include @@ -16,8 +16,9 @@ bprintf(const char *fmt, ...) len = vsnprintf(buf, sizeof(buf) - 1, fmt, ap); va_end(ap); - if (len >= sizeof(buf)) + if (len >= sizeof(buf)) { buf[sizeof(buf)-1] = '\0'; + } return buf; } @@ -30,7 +31,7 @@ pscanf(const char *path, const char *fmt, ...) int n; if (!(fp = fopen(path, "r"))) { - warn("fopen %s: %s\n", path, strerror(errno)); + fprintf(stderr, "fopen '%s': %s\n", path, strerror(errno)); return -1; } va_start(ap, fmt);