#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "errlib.h"

#define ERR_QUIT_SKIP 1
#define LOG_QUIT_SKIP 1

int main()
{
	FILE *pe;
	while (1) {
		printf("addr lf err_ret 0x%08x\n", (unsigned int)err_ret);	
		fputs("Testing err_ret()...\n", stdout);
		if ((pe = fopen("foo", "r")) == NULL)
			err_ret("%s %s", "err_ret()", "failed to open fol");
		fputs("Testing log_ret()...\n", stdout);
		if ((pe = fopen("foo", "r"))  == NULL)
			log_ret("errtest.log", "%s %s", "log_ret()", "failed to open foo");
#ifndef ERR_QUIT_SKIP
		fputs("Testing err_quit()...\n", stdout);
		if ((pe = fopen("foo", "r")) == NULL)
			err_ret("%s %s", "err_quit()", "failed to open foo");
#endif
	
#ifndef LOG_QUIT_SKIP
		fputs("Testing log_quit()...\n", stdout);
		if ((pe = fopen("foo", "r"))  == NULL)
			log_ret("errtest.log", "%s %s", "log_quit()", "failed to open foo");	
#endif	
		sleep(2);	
	}
	return 1;
}



