#include <ctype.h>
#include "util.h"
-#ifdef __linux__
+#ifndef WIN32
+#include <termios.h>
+#include <sys/ioctl.h>
int ukbhit(void)
{
int cnt = 0;
return num;
}
+// -------------------------------------------------------------------------
+// string parameters lib
+// -------------------------------------------------------------------------
+
// -------------------------------------------------------------------------
// line - param line
// bg, en - symbol numbers in param line of beginning an ending parameter
int bg, en;
if (!param_getptr(line, &bg, &en, paramnum))
- return strtol(&line[bg], NULL, base);
+ return strtoll(&line[bg], NULL, base);
else
return deflt;
return 0;
}
+
+int param_getstr(const char *line, int paramnum, char * str)
+{
+ int bg, en;
+
+ if (param_getptr(line, &bg, &en, paramnum)) return 0;
+
+ memcpy(str, line + bg, en - bg + 1);
+ str[en - bg + 1] = 0;
+
+ return en - bg + 1;
+}