Xinqi Bao's Git
1 /* See LICENSE file for copyright and license details. */
11 bprintf(const char *fmt
, ...)
17 len
= vsnprintf(buf
, sizeof(buf
) - 1, fmt
, ap
);
20 if (len
>= sizeof(buf
))
21 buf
[sizeof(buf
)-1] = '\0';
27 pscanf(const char *path
, const char *fmt
, ...)
33 if (!(fp
= fopen(path
, "r"))) {
34 warn("fopen %s: %s\n", path
, strerror(errno
));
38 n
= vfscanf(fp
, fmt
, ap
);
42 return (n
== EOF
) ? -1 : n
;