Xinqi Bao's Git
1 /* See LICENSE file for copyright and license details. */
9 bprintf(const char *fmt
, ...)
15 len
= vsnprintf(buf
, sizeof(buf
) - 1, fmt
, ap
);
18 if (len
>= sizeof(buf
))
19 buf
[sizeof(buf
)-1] = '\0';
25 pscanf(const char *path
, const char *fmt
, ...)
31 if (!(fp
= fopen(path
, "r"))) {
32 fprintf(stderr
, "fopen for %s failed", path
);
36 n
= vfscanf(fp
, fmt
, ap
);
40 return (n
== EOF
) ? -1 : n
;