/*
gcc -D__REENTRANT testmain.c thin.c thread.c mutex.c -lpthread -DDOTHREADS -D__EXTENSIONS__ -DTESTING 
*/

#include <stdlib.h>
#include <stdarg.h>
#define BFSZ 1000
#include "thin.h"

int slave_set(int x)
{
	return 0;
}
int main(int argc, char *argv[])
{
        char p1[200];
	char bf[BFSZ];
        int pchan = -1;
	static int running;

        if ((argc==2) || (argc==3)) {
	   strncpy(p1,argv[1],199);
           if (strncmp(p1,"-s",2)==0)  {
		slave_set(atoi(argv[2]));
           } else if (strncmp(p1,"-p",2)==0)  {
                   pchan = atoi(argv[1]+2);
           } else if (strncmp(p1,"-test_threads",13)==0)  {
                   thin_test_threads(atoi(argv[2]));
		   return 0;
           } else if (strncmp(p1,"-threads",8)==0)  {
	   }
	}
	return 0;
}
int lib_msleep(int x)
{
	usleep(x*1000);
}
int imsg(char * arg_list, ...)
{
        va_list arg_ptr;
        char *format;
        int len;
	char output[3000];

	
        va_start(arg_ptr, arg_list);
        format = arg_list;
        len = vsprintf(output, format, arg_ptr);
        printf("%s",output);
	return 0;
}
int emsg(char * arg_list, ...)
{
        va_list arg_ptr;
        char *format;
        int len;
	char output[3000];

	
        va_start(arg_ptr, arg_list);
        format = arg_list;
        len = vsprintf(output, format, arg_ptr);
        printf("%s",output);
	return 0;
}
