]> icculus.org git repositories - divverent/darkplaces.git/blob - cvar.c
patch from RocketGuy for pqrcon command, to administrate proquake
[divverent/darkplaces.git] / cvar.c
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19 */
20 // cvar.c -- dynamic variable tracking
21
22 #include "quakedef.h"
23
24 char *cvar_dummy_description = "custom cvar";
25
26 cvar_t *cvar_vars = NULL;
27 cvar_t *cvar_hashtable[65536];
28 char *cvar_null_string = "";
29
30 /*
31 ============
32 Cvar_FindVar
33 ============
34 */
35 cvar_t *Cvar_FindVar (const char *var_name)
36 {
37         int hashindex;
38         cvar_t *var;
39
40         // use hash lookup to minimize search time
41         hashindex = CRC_Block((const unsigned char *)var_name, strlen(var_name));
42         for (var = cvar_hashtable[hashindex];var;var = var->nextonhashchain)
43                 if (!strcmp (var_name, var->name))
44                         return var;
45
46         return NULL;
47 }
48
49 cvar_t *Cvar_FindVarAfter (const char *prev_var_name, int neededflags)
50 {
51         cvar_t *var;
52
53         if (*prev_var_name)
54         {
55                 var = Cvar_FindVar (prev_var_name);
56                 if (!var)
57                         return NULL;
58                 var = var->next;
59         }
60         else
61                 var = cvar_vars;
62
63         // search for the next cvar matching the needed flags
64         while (var)
65         {
66                 if ((var->flags & neededflags) || !neededflags)
67                         break;
68                 var = var->next;
69         }
70         return var;
71 }
72
73 /*
74 ============
75 Cvar_VariableValue
76 ============
77 */
78 float Cvar_VariableValue (const char *var_name)
79 {
80         cvar_t *var;
81
82         var = Cvar_FindVar (var_name);
83         if (!var)
84                 return 0;
85         return atof (var->string);
86 }
87
88
89 /*
90 ============
91 Cvar_VariableString
92 ============
93 */
94 const char *Cvar_VariableString (const char *var_name)
95 {
96         cvar_t *var;
97
98         var = Cvar_FindVar (var_name);
99         if (!var)
100                 return cvar_null_string;
101         return var->string;
102 }
103
104 /*
105 ============
106 Cvar_VariableDefString
107 ============
108 */
109 const char *Cvar_VariableDefString (const char *var_name)
110 {
111         cvar_t *var;
112
113         var = Cvar_FindVar (var_name);
114         if (!var)
115                 return cvar_null_string;
116         return var->defstring;
117 }
118
119 /*
120 ============
121 Cvar_VariableDescription
122 ============
123 */
124 const char *Cvar_VariableDescription (const char *var_name)
125 {
126         cvar_t *var;
127
128         var = Cvar_FindVar (var_name);
129         if (!var)
130                 return cvar_null_string;
131         return var->description;
132 }
133
134
135 /*
136 ============
137 Cvar_CompleteVariable
138 ============
139 */
140 const char *Cvar_CompleteVariable (const char *partial)
141 {
142         cvar_t          *cvar;
143         size_t          len;
144
145         len = strlen(partial);
146
147         if (!len)
148                 return NULL;
149
150 // check functions
151         for (cvar=cvar_vars ; cvar ; cvar=cvar->next)
152                 if (!strncasecmp (partial,cvar->name, len))
153                         return cvar->name;
154
155         return NULL;
156 }
157
158
159 /*
160         CVar_CompleteCountPossible
161
162         New function for tab-completion system
163         Added by EvilTypeGuy
164         Thanks to Fett erich@heintz.com
165
166 */
167 int Cvar_CompleteCountPossible (const char *partial)
168 {
169         cvar_t  *cvar;
170         size_t  len;
171         int             h;
172
173         h = 0;
174         len = strlen(partial);
175
176         if (!len)
177                 return  0;
178
179         // Loop through the cvars and count all possible matches
180         for (cvar = cvar_vars; cvar; cvar = cvar->next)
181                 if (!strncasecmp(partial, cvar->name, len))
182                         h++;
183
184         return h;
185 }
186
187 /*
188         CVar_CompleteBuildList
189
190         New function for tab-completion system
191         Added by EvilTypeGuy
192         Thanks to Fett erich@heintz.com
193         Thanks to taniwha
194
195 */
196 const char **Cvar_CompleteBuildList (const char *partial)
197 {
198         const cvar_t *cvar;
199         size_t len = 0;
200         size_t bpos = 0;
201         size_t sizeofbuf = (Cvar_CompleteCountPossible (partial) + 1) * sizeof (const char *);
202         const char **buf;
203
204         len = strlen(partial);
205         buf = (const char **)Mem_Alloc(tempmempool, sizeofbuf + sizeof (const char *));
206         // Loop through the alias list and print all matches
207         for (cvar = cvar_vars; cvar; cvar = cvar->next)
208                 if (!strncasecmp(partial, cvar->name, len))
209                         buf[bpos++] = cvar->name;
210
211         buf[bpos] = NULL;
212         return buf;
213 }
214
215 // written by LordHavoc
216 void Cvar_CompleteCvarPrint (const char *partial)
217 {
218         cvar_t *cvar;
219         size_t len = strlen(partial);
220         // Loop through the command list and print all matches
221         for (cvar = cvar_vars; cvar; cvar = cvar->next)
222                 if (!strncasecmp(partial, cvar->name, len))
223                         Con_Printf ("^3%s^7 is \"%s\" [\"%s\"] %s\n", cvar->name, cvar->string, cvar->defstring, cvar->description);
224 }
225
226
227 /*
228 ============
229 Cvar_Set
230 ============
231 */
232 void Cvar_SetQuick_Internal (cvar_t *var, const char *value)
233 {
234         qboolean changed;
235         size_t valuelen;
236
237         changed = strcmp(var->string, value);
238         // LordHavoc: don't reallocate when there is no change
239         if (!changed)
240                 return;
241
242         // LordHavoc: don't reallocate when the buffer is the same size
243         valuelen = strlen(value);
244         if (!var->string || strlen(var->string) != valuelen)
245         {
246                 Z_Free (var->string);   // free the old value string
247
248                 var->string = (char *)Z_Malloc (valuelen + 1);
249         }
250         memcpy (var->string, value, valuelen + 1);
251         var->value = atof (var->string);
252         var->integer = (int) var->value;
253         if ((var->flags & CVAR_NOTIFY) && changed && sv.active)
254                 SV_BroadcastPrintf("\"%s\" changed to \"%s\"\n", var->name, var->string);
255 #if 0
256         // TODO: add infostring support to the server?
257         if ((var->flags & CVAR_SERVERINFO) && changed && sv.active)
258         {
259                 InfoString_SetValue(svs.serverinfo, sizeof(svs.serverinfo), var->name, var->string);
260                 if (sv.active)
261                 {
262                         MSG_WriteByte (&sv.reliable_datagram, svc_serverinfostring);
263                         MSG_WriteString (&sv.reliable_datagram, var->name);
264                         MSG_WriteString (&sv.reliable_datagram, var->string);
265                 }
266         }
267 #endif
268         if ((var->flags & CVAR_USERINFO) && cls.state != ca_dedicated)
269                 CL_SetInfo(var->name, var->string, true, false, false, false);
270         else if ((var->flags & CVAR_NQUSERINFOHACK) && cls.state != ca_dedicated)
271         {
272                 // update the cls.userinfo to have proper values for the
273                 // silly nq config variables.
274                 //
275                 // this is done when these variables are changed rather than at
276                 // connect time because if the user or code checks the userinfo and it
277                 // holds weird values it may cause confusion...
278                 if (!strcmp(var->name, "_cl_color"))
279                 {
280                         int top = (var->integer >> 4) & 15, bottom = var->integer & 15;
281                         CL_SetInfo("topcolor", va("%i", top), true, false, false, false);
282                         CL_SetInfo("bottomcolor", va("%i", bottom), true, false, false, false);
283                         if (cls.protocol != PROTOCOL_QUAKEWORLD && cls.netcon)
284                         {
285                                 MSG_WriteByte(&cls.netcon->message, clc_stringcmd);
286                                 MSG_WriteString(&cls.netcon->message, va("color %i %i", top, bottom));
287                         }
288                 }
289                 else if (!strcmp(var->name, "_cl_rate"))
290                         CL_SetInfo("rate", va("%i", var->integer), true, false, false, false);
291                 else if (!strcmp(var->name, "_cl_playerskin"))
292                         CL_SetInfo("playerskin", var->string, true, false, false, false);
293                 else if (!strcmp(var->name, "_cl_playermodel"))
294                         CL_SetInfo("playermodel", var->string, true, false, false, false);
295                 else if (!strcmp(var->name, "_cl_name"))
296                         CL_SetInfo("name", var->string, true, false, false, false);
297                 else if (!strcmp(var->name, "rcon_secure"))
298                 {
299                         // whenever rcon_secure is changed to 0, clear rcon_password for
300                         // security reasons (prevents a send-rcon-password-as-plaintext
301                         // attack based on NQ protocol session takeover and svc_stufftext)
302                         if(!var->integer)
303                                 Cvar_Set("rcon_password", "");
304                 }
305                 else if (!strcmp(var->name, "net_slist_favorites"))
306                         NetConn_UpdateFavorites();
307         }
308 }
309
310 void Cvar_SetQuick (cvar_t *var, const char *value)
311 {
312         if (var == NULL)
313         {
314                 Con_Print("Cvar_SetQuick: var == NULL\n");
315                 return;
316         }
317
318         if (developer.integer >= 100)
319                 Con_Printf("Cvar_SetQuick({\"%s\", \"%s\", %i, \"%s\"}, \"%s\");\n", var->name, var->string, var->flags, var->defstring, value);
320
321         Cvar_SetQuick_Internal(var, value);
322 }
323
324 void Cvar_Set (const char *var_name, const char *value)
325 {
326         cvar_t *var;
327         var = Cvar_FindVar (var_name);
328         if (var == NULL)
329         {
330                 Con_Printf("Cvar_Set: variable %s not found\n", var_name);
331                 return;
332         }
333         Cvar_SetQuick(var, value);
334 }
335
336 /*
337 ============
338 Cvar_SetValue
339 ============
340 */
341 void Cvar_SetValueQuick(cvar_t *var, float value)
342 {
343         char val[MAX_INPUTLINE];
344
345         if ((float)((int)value) == value)
346                 dpsnprintf(val, sizeof(val), "%i", (int)value);
347         else
348                 dpsnprintf(val, sizeof(val), "%f", value);
349         Cvar_SetQuick(var, val);
350 }
351
352 void Cvar_SetValue(const char *var_name, float value)
353 {
354         char val[MAX_INPUTLINE];
355
356         if ((float)((int)value) == value)
357                 dpsnprintf(val, sizeof(val), "%i", (int)value);
358         else
359                 dpsnprintf(val, sizeof(val), "%f", value);
360         Cvar_Set(var_name, val);
361 }
362
363 /*
364 ============
365 Cvar_RegisterVariable
366
367 Adds a freestanding variable to the variable list.
368 ============
369 */
370 void Cvar_RegisterVariable (cvar_t *variable)
371 {
372         int hashindex;
373         cvar_t *current, *next, *cvar;
374         char *oldstr;
375         size_t alloclen;
376
377         if (developer.integer >= 100)
378                 Con_Printf("Cvar_RegisterVariable({\"%s\", \"%s\", %i});\n", variable->name, variable->string, variable->flags);
379
380 // first check to see if it has already been defined
381         cvar = Cvar_FindVar (variable->name);
382         if (cvar)
383         {
384                 if (cvar->flags & CVAR_ALLOCATED)
385                 {
386                         if (developer.integer >= 100)
387                                 Con_Printf("...  replacing existing allocated cvar {\"%s\", \"%s\", %i}\n", cvar->name, cvar->string, cvar->flags);
388                         // fixed variables replace allocated ones
389                         // (because the engine directly accesses fixed variables)
390                         // NOTE: this isn't actually used currently
391                         // (all cvars are registered before config parsing)
392                         variable->flags |= (cvar->flags & ~CVAR_ALLOCATED);
393                         // cvar->string is now owned by variable instead
394                         variable->string = cvar->string;
395                         variable->defstring = cvar->defstring;
396                         variable->value = atof (variable->string);
397                         variable->integer = (int) variable->value;
398                         // replace cvar with this one...
399                         variable->next = cvar->next;
400                         if (cvar_vars == cvar)
401                         {
402                                 // head of the list is easy to change
403                                 cvar_vars = variable;
404                         }
405                         else
406                         {
407                                 // otherwise find it somewhere in the list
408                                 for (current = cvar_vars;current->next != cvar;current = current->next)
409                                         ;
410                                 current->next = variable;
411                         }
412
413                         // get rid of old allocated cvar
414                         // (but not cvar->string and cvar->defstring, because we kept those)
415                         Z_Free(cvar->name);
416                         Z_Free(cvar);
417                 }
418                 else
419                         Con_Printf("Can't register variable %s, already defined\n", variable->name);
420                 return;
421         }
422
423 // check for overlap with a command
424         if (Cmd_Exists (variable->name))
425         {
426                 Con_Printf("Cvar_RegisterVariable: %s is a command\n", variable->name);
427                 return;
428         }
429
430 // copy the value off, because future sets will Z_Free it
431         oldstr = variable->string;
432         alloclen = strlen(variable->string) + 1;
433         variable->string = (char *)Z_Malloc (alloclen);
434         memcpy (variable->string, oldstr, alloclen);
435         variable->defstring = (char *)Z_Malloc (alloclen);
436         memcpy (variable->defstring, oldstr, alloclen);
437         variable->value = atof (variable->string);
438         variable->integer = (int) variable->value;
439
440 // link the variable in
441 // alphanumerical order
442         for( current = NULL, next = cvar_vars ; next && strcmp( next->name, variable->name ) < 0 ; current = next, next = next->next )
443                 ;
444         if( current ) {
445                 current->next = variable;
446         } else {
447                 cvar_vars = variable;
448         }
449         variable->next = next;
450
451         // link to head of list in this hash table index
452         hashindex = CRC_Block((const unsigned char *)variable->name, strlen(variable->name));
453         variable->nextonhashchain = cvar_hashtable[hashindex];
454         cvar_hashtable[hashindex] = variable;
455 }
456
457 /*
458 ============
459 Cvar_Get
460
461 Adds a newly allocated variable to the variable list or sets its value.
462 ============
463 */
464 cvar_t *Cvar_Get (const char *name, const char *value, int flags, const char *newdescription)
465 {
466         int hashindex;
467         cvar_t *current, *next, *cvar;
468         size_t alloclen;
469
470         if (developer.integer >= 100)
471                 Con_Printf("Cvar_Get(\"%s\", \"%s\", %i);\n", name, value, flags);
472
473 // first check to see if it has already been defined
474         cvar = Cvar_FindVar (name);
475         if (cvar)
476         {
477                 cvar->flags |= flags;
478                 Cvar_SetQuick_Internal (cvar, value);
479                 if(newdescription && (cvar->flags & CVAR_ALLOCATED))
480                 {
481                         if(cvar->description != cvar_dummy_description)
482                                 Z_Free(cvar->description);
483
484                         if(*newdescription)
485                         {
486                                 alloclen = strlen(newdescription) + 1;
487                                 cvar->description = (char *)Z_Malloc(alloclen);
488                                 memcpy(cvar->description, newdescription, alloclen);
489                         }
490                         else
491                                 cvar->description = cvar_dummy_description;
492                 }
493                 return cvar;
494         }
495
496 // check for overlap with a command
497         if (Cmd_Exists (name))
498         {
499                 Con_Printf("Cvar_Get: %s is a command\n", name);
500                 return NULL;
501         }
502
503 // allocate a new cvar, cvar name, and cvar string
504 // TODO: factorize the following code with the one at the end of Cvar_RegisterVariable()
505 // FIXME: these never get Z_Free'd
506         cvar = (cvar_t *)Z_Malloc(sizeof(cvar_t));
507         cvar->flags = flags | CVAR_ALLOCATED;
508         alloclen = strlen(name) + 1;
509         cvar->name = (char *)Z_Malloc(alloclen);
510         memcpy(cvar->name, name, alloclen);
511         alloclen = strlen(value) + 1;
512         cvar->string = (char *)Z_Malloc(alloclen);
513         memcpy(cvar->string, value, alloclen);
514         cvar->defstring = (char *)Z_Malloc(alloclen);
515         memcpy(cvar->defstring, value, alloclen);
516         cvar->value = atof (cvar->string);
517         cvar->integer = (int) cvar->value;
518
519         if(newdescription && *newdescription)
520         {
521                 alloclen = strlen(newdescription) + 1;
522                 cvar->description = (char *)Z_Malloc(alloclen);
523                 memcpy(cvar->description, newdescription, alloclen);
524         }
525         else
526                 cvar->description = cvar_dummy_description; // actually checked by VM_cvar_type
527
528 // link the variable in
529 // alphanumerical order
530         for( current = NULL, next = cvar_vars ; next && strcmp( next->name, cvar->name ) < 0 ; current = next, next = next->next )
531                 ;
532         if( current )
533                 current->next = cvar;
534         else
535                 cvar_vars = cvar;
536         cvar->next = next;
537
538         // link to head of list in this hash table index
539         hashindex = CRC_Block((const unsigned char *)cvar->name, strlen(cvar->name));
540         cvar->nextonhashchain = cvar_hashtable[hashindex];
541         cvar_hashtable[hashindex] = cvar;
542
543         return cvar;
544 }
545
546
547 /*
548 ============
549 Cvar_Command
550
551 Handles variable inspection and changing from the console
552 ============
553 */
554 qboolean        Cvar_Command (void)
555 {
556         cvar_t                  *v;
557
558 // check variables
559         v = Cvar_FindVar (Cmd_Argv(0));
560         if (!v)
561                 return false;
562
563 // perform a variable print or set
564         if (Cmd_Argc() == 1)
565         {
566                 Con_Printf("\"%s\" is \"%s\" [\"%s\"]\n", v->name, v->string, v->defstring);
567                 return true;
568         }
569
570         if (developer.integer >= 100)
571                 Con_DPrint("Cvar_Command: ");
572
573         if (v->flags & CVAR_READONLY)
574         {
575                 Con_Printf("%s is read-only\n", v->name);
576                 return true;
577         }
578         Cvar_Set (v->name, Cmd_Argv(1));
579         if (developer.integer >= 100)
580                 Con_DPrint("\n");
581         return true;
582 }
583
584
585 void Cvar_UnlockDefaults (void)
586 {
587         cvar_t *var;
588         // unlock the default values of all cvars
589         for (var = cvar_vars ; var ; var = var->next)
590                 var->flags &= ~CVAR_DEFAULTSET;
591 }
592
593
594 void Cvar_LockDefaults_f (void)
595 {
596         cvar_t *var;
597         // lock in the default values of all cvars
598         for (var = cvar_vars ; var ; var = var->next)
599         {
600                 if (!(var->flags & CVAR_DEFAULTSET))
601                 {
602                         size_t alloclen;
603
604                         //Con_Printf("locking cvar %s (%s -> %s)\n", var->name, var->string, var->defstring);
605                         var->flags |= CVAR_DEFAULTSET;
606                         Z_Free(var->defstring);
607                         alloclen = strlen(var->string) + 1;
608                         var->defstring = (char *)Z_Malloc(alloclen);
609                         memcpy(var->defstring, var->string, alloclen);
610                 }
611         }
612 }
613
614
615 void Cvar_ResetToDefaults_All_f (void)
616 {
617         cvar_t *var;
618         // restore the default values of all cvars
619         for (var = cvar_vars ; var ; var = var->next)
620                 Cvar_SetQuick(var, var->defstring);
621 }
622
623
624 void Cvar_ResetToDefaults_NoSaveOnly_f (void)
625 {
626         cvar_t *var;
627         // restore the default values of all cvars
628         for (var = cvar_vars ; var ; var = var->next)
629                 if (!(var->flags & CVAR_SAVE))
630                         Cvar_SetQuick(var, var->defstring);
631 }
632
633
634 void Cvar_ResetToDefaults_SaveOnly_f (void)
635 {
636         cvar_t *var;
637         // restore the default values of all cvars
638         for (var = cvar_vars ; var ; var = var->next)
639                 if (var->flags & CVAR_SAVE)
640                         Cvar_SetQuick(var, var->defstring);
641 }
642
643
644 /*
645 ============
646 Cvar_WriteVariables
647
648 Writes lines containing "set variable value" for all variables
649 with the archive flag set to true.
650 ============
651 */
652 void Cvar_WriteVariables (qfile_t *f)
653 {
654         cvar_t  *var;
655
656         // don't save cvars that match their default value
657         for (var = cvar_vars ; var ; var = var->next)
658                 if ((var->flags & CVAR_SAVE) && (strcmp(var->string, var->defstring) || (var->flags & CVAR_ALLOCATED)))
659                         FS_Printf(f, "%s%s \"%s\"\n", var->flags & CVAR_ALLOCATED ? "seta " : "", var->name, var->string);
660 }
661
662
663 // Added by EvilTypeGuy eviltypeguy@qeradiant.com
664 // 2000-01-09 CvarList command By Matthias "Maddes" Buecher, http://www.inside3d.com/qip/
665 /*
666 =========
667 Cvar_List
668 =========
669 */
670 void Cvar_List_f (void)
671 {
672         cvar_t *cvar;
673         const char *partial;
674         size_t len;
675         int count;
676         qboolean ispattern;
677
678         if (Cmd_Argc() > 1)
679         {
680                 partial = Cmd_Argv (1);
681                 len = strlen(partial);
682         }
683         else
684         {
685                 partial = NULL;
686                 len = 0;
687         }
688
689         ispattern = partial && (strchr(partial, '*') || strchr(partial, '?'));
690
691         count = 0;
692         for (cvar = cvar_vars; cvar; cvar = cvar->next)
693         {
694                 if (len && (ispattern ? !matchpattern_with_separator(cvar->name, partial, false, "", false) : strncmp (partial,cvar->name,len)))
695                         continue;
696
697                 Con_Printf("%s is \"%s\" [\"%s\"] %s\n", cvar->name, cvar->string, cvar->defstring, cvar->description);
698                 count++;
699         }
700
701         if (len)
702         {
703                 if(ispattern)
704                         Con_Printf("%i cvar%s matching \"%s\"\n", count, (count > 1) ? "s" : "", partial);
705                 else
706                         Con_Printf("%i cvar%s beginning with \"%s\"\n", count, (count > 1) ? "s" : "", partial);
707         }
708         else
709                 Con_Printf("%i cvar(s)\n", count);
710 }
711 // 2000-01-09 CvarList command by Maddes
712
713 void Cvar_Set_f (void)
714 {
715         cvar_t *cvar;
716
717         // make sure it's the right number of parameters
718         if (Cmd_Argc() < 3)
719         {
720                 Con_Printf("Set: wrong number of parameters, usage: set <variablename> <value> [<description>]\n");
721                 return;
722         }
723
724         // check if it's read-only
725         cvar = Cvar_FindVar(Cmd_Argv(1));
726         if (cvar && cvar->flags & CVAR_READONLY)
727         {
728                 Con_Printf("Set: %s is read-only\n", cvar->name);
729                 return;
730         }
731
732         if (developer.integer >= 100)
733                 Con_DPrint("Set: ");
734
735         // all looks ok, create/modify the cvar
736         Cvar_Get(Cmd_Argv(1), Cmd_Argv(2), 0, Cmd_Argc() > 3 ? Cmd_Argv(3) : NULL);
737 }
738
739 void Cvar_SetA_f (void)
740 {
741         cvar_t *cvar;
742
743         // make sure it's the right number of parameters
744         if (Cmd_Argc() < 3)
745         {
746                 Con_Printf("SetA: wrong number of parameters, usage: seta <variablename> <value> [<description>]\n");
747                 return;
748         }
749
750         // check if it's read-only
751         cvar = Cvar_FindVar(Cmd_Argv(1));
752         if (cvar && cvar->flags & CVAR_READONLY)
753         {
754                 Con_Printf("SetA: %s is read-only\n", cvar->name);
755                 return;
756         }
757
758         if (developer.integer >= 100)
759                 Con_DPrint("SetA: ");
760
761         // all looks ok, create/modify the cvar
762         Cvar_Get(Cmd_Argv(1), Cmd_Argv(2), CVAR_SAVE, Cmd_Argc() > 3 ? Cmd_Argv(3) : NULL);
763 }
764
765