add new function for debug in Lama: LprintfPerrror --- synonym for fprintf(perror,...)

This commit is contained in:
danyaberezun 2024-02-29 15:30:23 +02:00
parent 7541ea64c2
commit 539e9712e5
2 changed files with 16 additions and 2 deletions

View file

@ -23,6 +23,7 @@ F,regexpMatch;
F,sprintf;
F,makeString;
F,printf;
F,printfPerror;
F,fprintf;
F,fopen;
F,fclose;

View file

@ -987,6 +987,19 @@ extern void Lfailure (char *s, ...) {
vfailure(s, args);
}
extern void LprintfPerror (char *s, ...) {
va_list args = (va_list)BOX(NULL);
ASSERT_STRING("printfPerror:1", s);
va_start(args, s);
fix_unboxed(s, args);
if (vfprintf(stderr, s, args) < 0) { failure("printfPerror (...): %s\n", strerror(errno)); }
fflush(stderr);
}
extern void Bmatch_failure (void *v, char *fname, int line, int col) {
createStringBuf();
printValue(v);