+ if(Cmd_Argc(cmd) < 2)
+ {
+ Con_Printf("%s: wrong number of parameters, usage: unset <variablename1> [<variablename2> ...]\n", Cmd_Argv(cmd, 0));
+ return;
+ }
+ for(i = 1; i < Cmd_Argc(cmd); ++i)
+ {
+ cvar = Cvar_FindVarLink(cvars, Cmd_Argv(cmd, i), &parent, &link, &prev, neededflags);
+ if(!cvar)
+ {
+ Con_Printf("%s: %s is not defined\n", Cmd_Argv(cmd, 0), Cmd_Argv(cmd, i));
+ continue;
+ }
+ if(cvar->flags & CVAR_READONLY)
+ {
+ Con_Printf("%s: %s is read-only\n", Cmd_Argv(cmd, 0), cvar->name);
+ continue;
+ }
+ if(!(cvar->flags & CVAR_ALLOCATED))
+ {
+ Con_Printf("%s: %s is static and cannot be deleted\n", Cmd_Argv(cmd, 0), cvar->name);
+ continue;
+ }
+ if(cvar == cvars->vars)
+ {
+ cvars->vars = cvar->next;
+ }
+ else
+ {
+ // in this case, prev must be set, otherwise there has been some inconsistensy
+ // elsewhere already... should I still check for prev != NULL?
+ prev->next = cvar->next;
+ }
+
+ if(parent)
+ parent->nextonhashchain = cvar->nextonhashchain;
+ else if(link)
+ *link = cvar->nextonhashchain;
+
+ if(cvar->description != cvar_dummy_description)
+ Z_Free((char *)cvar->description);
+
+ Z_Free((char *)cvar->name);
+ Z_Free((char *)cvar->string);
+ Z_Free((char *)cvar->defstring);
+ Z_Free(cvar);
+ }
+}
+
+#ifdef FILLALLCVARSWITHRUBBISH
+void Cvar_FillAll_f(cmd_state_t *cmd)
+{
+ char *buf, *p, *q;
+ int n, i;
+ cvar_t *var;
+ qboolean verify;
+ if(Cmd_Argc(cmd) != 2)
+ {
+ Con_Printf("Usage: %s length to plant rubbish\n", Cmd_Argv(cmd, 0));
+ Con_Printf("Usage: %s -length to verify that the rubbish is still there\n", Cmd_Argv(cmd, 0));
+ return;
+ }
+ n = atoi(Cmd_Argv(cmd, 1));
+ verify = (n < 0);
+ if(verify)
+ n = -n;
+ buf = Z_Malloc(n + 1);
+ buf[n] = 0;
+ for(var = cvars->vars; var; var = var->next)
+ {
+ for(i = 0, p = buf, q = var->name; i < n; ++i)
+ {
+ *p++ = *q++;
+ if(!*q)
+ q = var->name;
+ }
+ if(verify && strcmp(var->string, buf))
+ {
+ Con_Printf("\n%s does not contain the right rubbish, either this is the first run or a possible overrun was detected, or something changed it intentionally; it DOES contain: %s\n", var->name, var->string);
+ }
+ Cvar_SetQuick(var, buf);
+ }
+ Z_Free(buf);
+}
+#endif /* FILLALLCVARSWITHRUBBISH */