#ifndef __SHELL_H__
#define __SHELL_H__
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/signal.h>
#include <stdarg.h>
#include "varmacro.h"
#ifdef x_WIN32
#include <process.h>


#ifndef OLDGCCVARMACRO
#define process(commando,...)  spawnlp(_P_WAIT, commando, commando, __VA_ARGS__,NULL)
#else
#define process(commando,args...)   spawnlp(_P_WAIT,commando,commando,args,NULL)
#endif

#else
#ifndef OLDGCCVARMACRO
#define process(commando,...)   executor(commando,commando,__VA_ARGS__,NULL)
#else
#define process(commando,args...)   executor(commando,commando,args,NULL)
#endif
inline int executor(const char *commando,...)   {
		va_list ap;
		if(!fork())  {
				va_start(ap,commando);
			  execvp(commando,(char **)ap);
				va_end(ap);
				perror(commando); 
				exit(4);
				}
	else {
			int statusdieprocessreturns;
			wait(&statusdieprocessreturns);
			return statusdieprocessreturns;
			}
	}
#endif
#endif
