if (fflush(stdout)) Toutputerr();
}
-void Q_vb(void) {
- if (!adns__vbuf_append(&vb,"",1)) Tnomem();
- if (fprintf(stdout," %s\n",vb.buf) == EOF) Toutputerr();
- Tflushstdout();
-}
-
-static void Pformat(const char *what) {
- fprintf(stderr,"adns test harness: format error in raw log input file: %s\n",what);
- exit(-1);
-}
-
-extern void Tshutdown(void) {
- int c= fgetc(Tinputfile);
- if (c!=EOF) Pformat("unwanted additional syscall reply data");
- if (ferror(Tinputfile)) Tfailed("read test log input (at end)");
-}
-
-static void Pcheckinput(void) {
- if (ferror(Tinputfile)) Tfailed("read test log input file");
- if (feof(Tinputfile)) Pformat("eof at syscall reply");
-}
-
-void Tensurerecordfile(void) {
+void Tensuresetup(void) {
static int done;
if (done) return;
if (proutstr) stdout_enable= atoi(proutstr);
}
+void Q_vb(void) {
+ Tensuresetup();
+ if (!adns__vbuf_append(&vb,"",1)) Tnomem();
+ if (fprintf(stdout," %s\n",vb.buf) == EOF) Toutputerr();
+ Tflushstdout();
+}
+
+static void Pformat(const char *what) {
+ fprintf(stderr,"adns test harness: format error in raw log input file: %s\n",what);
+ exit(-1);
+}
+
+extern void Tshutdown(void) {
+ int c= fgetc(Tinputfile);
+ if (c!=EOF) Pformat("unwanted additional syscall reply data");
+ if (ferror(Tinputfile)) Tfailed("read test log input (at end)");
+}
+
+static void Pcheckinput(void) {
+ if (ferror(Tinputfile)) Tfailed("read test log input file");
+ if (feof(Tinputfile)) Pformat("eof at syscall reply");
+}
static void P_read_dump(const unsigned char *p0, size_t count, ssize_t d) {
fputs(" | ",stdout);
static int P_succfail(void) {
int e;
P_READ(e);
- if (e<0 && -e<Tnerrnos) {
- errno= Terrnos[-e].v;
- return -1;
- } else if (e>0 && e<=255) {
+ if (e>0) {
errno= e;
return -1;
} else if (e) {
hm_create_hqcall_init($1)
$3
- Tensurerecordfile();
+ Tensuresetup();
if (stdout_enable) {
hm_create_hqcall_args
m4_include(`hsyscalls.i4')
int Hclose(int fd) {
+ syscall_sync(close)
P_fdf(fd);
fdtab.buf[fd]= 0;
return P_succfail();