Xinqi Bao's Git
1 /* See LICENSE file for copyright and license details. */
10 bprintf(const char *fmt
, ...)
16 len
= vsnprintf(buf
, sizeof(buf
) - 1, fmt
, ap
);
19 if (len
>= sizeof(buf
))
20 buf
[sizeof(buf
)-1] = '\0';
26 pscanf(const char *path
, const char *fmt
, ...)
32 if (!(fp
= fopen(path
, "r"))) {
33 fprintf(stderr
, "fopen '%s': %s\n", path
, strerror(errno
));
37 n
= vfscanf(fp
, fmt
, ap
);
41 return (n
== EOF
) ? -1 : n
;