/*
 * Copyright (C) 2008 The Trustees of Columbia University in the City of New York. 
 * All rights reserved.
 *
 * See the file LICENSE included in this distribution for details.
 */
#include "sysutils.h"

#ifdef WIN32

int strcasecmp(const char* s1, const char* s2) {
  return _stricmp(s1, s2);
}

#endif


char *strtok_i(char *strToken, const char *strDelimit, char **context ) {

#ifdef WIN32
	//return NULL;
	return strtok_s(strToken, strDelimit, context);
#endif

#ifdef _LINUX_
	return strtok_r(strToken, strDelimit, context);
#endif
	return NULL;
}


#ifdef WIN32
char* optarg;
static int iS = 1;
char getopt(int argc, char** argv, char* options) {
	char c = 1;

	if(iS >= argc)
		return -1;

		c=argv[iS][1];
		if(c == 'R' || c == 'O' || c =='S' || 
		   c=='U' || c=='K'|| c == 'E' || c == 'N') {
		  iS+=1;
          return c;
		}
		optarg=argv[iS+1];

	iS+=2;

	return c;
}
#endif

#ifdef WIN32
void sleep(unsigned int seconds) {
  //Windows sleep function is in ms whereas Linux is in seconds !!!
  Sleep(seconds*1000);
}
#endif
