// includes\r
\r
#include <stdio.h>\r
+#include <sys/types.h>\r
+#include <sys/timeb.h>\r
+#include <sys/stat.h>\r
\r
// defines\r
\r
#define snprintf _snprintf\r
#endif\r
\r
+#define FormatBufferSize 4096\r
+\r
+#ifdef _MSC_VER\r
+#define vsnprintf _vsnprintf\r
+#endif\r
+\r
+#define CONSTRUCT_ARG_STRING(format,buf) \\r
+ { \\r
+ va_list arg_list; \\r
+ int written; \\r
+ va_start(arg_list,format); \\r
+ written=vsnprintf(buf, \\r
+ sizeof(buf), \\r
+ format, \\r
+ arg_list); \\r
+ va_end(arg_list); \\r
+ buf[sizeof(buf)-1]='\0'; \\r
+ if(written>=sizeof(buf) || written<0){ \\r
+ my_fatal("write_buffer overflow: file \"%s\", line %d\n", \\r
+ __FILE__,__LINE__); \\r
+ } \\r
+ } \\r
+\r
+#define TO_BOOL(string) ((my_string_case_equal(string,"false") || \\r
+ my_string_equal(string,"0"))?FALSE:TRUE)\r
+\r
+#define IS_BOOL(string) (my_string_case_equal(string,"false")|| \\r
+ my_string_case_equal(string,"true") || \\r
+ my_string_case_equal(string,"1") || \\r
+ my_string_case_equal(string,"0"))\r
// types\r
\r
typedef signed char sint8;\r
bool running;\r
} my_timer_t;\r
\r
+\r
// functions\r
\r
extern void util_init ();\r
extern void my_fatal (const char format[], ...);\r
\r
extern bool my_file_read_line (FILE * file, char string[], int size);\r
+extern void my_path_join (char *join_path, const char *path, const char *file);\r
+\r
+extern int my_mkdir (const char *path);\r
\r
extern bool my_string_empty (const char string[]);\r
extern bool my_string_whitespace (const char string[]);\r
extern bool my_string_equal (const char string_1[], const char string_2[]);\r
extern bool my_string_case_equal (const char string_1[], const char string_2[]);\r
+extern const char* my_string_case_contains(const char haystack[], \r
+ const char needle[]);\r
+\r
+\r
+extern bool my_string_to_lower (char dst[], const char src[]);\r
+\r
extern char * my_strdup (const char string[]);\r
\r
extern void my_string_clear (const char * * variable);\r
\r
extern char * my_error();\r
\r
-extern char * my_getcwd (char *buf, size_t size);\r
-extern int my_chdir (const char *path);\r
+extern void my_dequote (char *out, \r
+ const char *in, \r
+ const char *special);\r
+extern void my_quote (char *out, \r
+ const char *in, \r
+ const char *special);\r
+\r
+extern void my_sleep (int msec);\r
\r
#endif // !defined UTIL_H\r
\r