+ERASEABLE
+bool cvar_value_issafe(string s)
+{
+ if (strstrofs(s, "\"", 0) >= 0) return false;
+ if (strstrofs(s, "\\", 0) >= 0) return false;
+ if (strstrofs(s, ";", 0) >= 0) return false;
+ if (strstrofs(s, "$", 0) >= 0) return false;
+ if (strstrofs(s, "\r", 0) >= 0) return false;
+ if (strstrofs(s, "\n", 0) >= 0) return false;
+ return true;
+}
+
+/** escape the string to make it safe for consoles */
+ERASEABLE
+string MakeConsoleSafe(string input)
+{
+ input = strreplace("\n", "", input);
+ input = strreplace("\\", "\\\\", input);
+ input = strreplace("$", "$$", input);
+ input = strreplace("\"", "\\\"", input);
+ return input;
+}
+
+ERASEABLE
+void cvar_describe(string name, string desc)
+{
+ localcmd(sprintf("\nset %1$s \"$%1$s\" \"%2$s\"\n", name, MakeConsoleSafe(desc)));
+}
+
+ERASEABLE
+void cvar_archive(string name)
+{
+ localcmd(sprintf("\nseta %1$s \"$%1$s\"\n", name));
+}
+
+ERASEABLE