xref: /haiku/src/tests/kits/media/nodetest/misc.cpp (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
1 #include <string.h>
2 #include "misc.h"
3 
4 void val(void *p)
5 {
6 	if (p)
7 		out("OK\n");
8 	else
9 		out("failed\n");
10 }
11 
12 void val(status_t status)
13 {
14 	if (status == B_OK)
15 		out("OK\n");
16 	else
17 		out("failed, 0x%08x, %s\n",status,strerror(status));
18 }
19 
20 void wait()
21 {
22 	out("press enter to continue\n");
23 	getchar();
24 }
25 
26 void out(const char *format,...)
27 {
28 	static bigtime_t start = 0;
29 	if (start == 0)
30 		start = system_time();
31 	printf("%3.4f ",(system_time()-start) / 1E6);
32 	va_list ap;
33 	va_start(ap,format);
34 	vfprintf(stdout,format,ap);
35 	va_end(ap);
36 	fflush(0);
37 }
38