return util_strdup(s);
}
-/*
- * Remove newline from a string (if it exists). This is
- * done pointer wise instead of strlen(), and an array
- * access.
- */
-char *util_strrnl(const char *src) {
- char *cpy = NULL;
-
- if (src) {
- cpy = (char*)src;
- while (*cpy && *cpy != '\n')
- cpy++;
-
- *cpy = '\0';
- }
- return (char*)src;
-}
-
-/*
- * Removes any whitespace prefixed on a string by moving
- * skipping past it, and stroing the skip distance, so
- * the string can later be freed (if it was allocated)
- */
-char *util_strsws(const char *skip) {
- size_t size = 0;
- if (!skip)
- return NULL;
-
- while (*skip == ' ' || *skip == '\t')
- skip++,size++;
- return util_strdup(skip-size);
-}
-
/*
* Returns true if string is all uppercase, otherwise
* it returns false.
return true;
}
+bool util_strncmpexact(const char *src, const char *ned, size_t len) {
+ return (!strncmp(src, ned, len) && !src[len]);
+}
+
void util_debug(const char *area, const char *ms, ...) {
va_list va;
if (!opts_debug)
*pos = '\0';
return (ret = pos - *lineptr);
}
+
+/* TODO: opts.c? when it gets large enugh */
+/* global options */
+bool opts_debug = false;
+bool opts_memchk = false;
+bool opts_darkplaces_stringtablebug = false;
+bool opts_omit_nullcode = false;
+int opts_compiler = COMPILER_GMQCC;