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;
+size_t util_strtocmd(const char *in, char *out, size_t outsz) {
+ size_t sz = 1;
+ for (; *in && sz < outsz; ++in, ++out, ++sz) {
+ if (*in == '-')
+ *out = '_';
+ else if (isalpha(*in) && !isupper(*in))
+ *out = *in + 'A' - 'a';
+ else
+ *out = *in;
+ }
+ *out = 0;
+ return sz-1;
+}
+
+size_t util_strtononcmd(const char *in, char *out, size_t outsz) {
+ size_t sz = 1;
+ for (; *in && sz < outsz; ++in, ++out, ++sz) {
+ if (*in == '_')
+ *out = '-';
+ else if (isalpha(*in) && isupper(*in))
+ *out = *in + 'a' - 'A';
+ else
+ *out = *in;
+ }
+ *out = 0;
+ return sz-1;
+}