diff options
Diffstat (limited to 'contrib/texinfo/info/variables.c')
-rw-r--r-- | contrib/texinfo/info/variables.c | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/contrib/texinfo/info/variables.c b/contrib/texinfo/info/variables.c index 9412797..581d2bb 100644 --- a/contrib/texinfo/info/variables.c +++ b/contrib/texinfo/info/variables.c @@ -1,10 +1,7 @@ /* variables.c -- How to manipulate user visible variables in Info. - $Id: variables.c,v 1.7 1999/06/25 21:57:40 karl Exp $ + $Id: variables.c,v 1.8 2001/11/16 23:16:19 karl Exp $ - This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 97, 2001 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -273,3 +270,40 @@ make_variable_completions_array () return (array); } + +#if defined(INFOKEY) + +void +set_variable_to_value(name, value) + char *name; + char *value; +{ + register int i; + + /* Find the variable in our list of variables. */ + for (i = 0; info_variables[i].name; i++) + if (strcmp(info_variables[i].name, name) == 0) + break; + + if (!info_variables[i].name) + return; + + if (info_variables[i].choices) + { + register int j; + + /* Find the choice in our list of choices. */ + for (j = 0; info_variables[i].choices[j]; j++) + if (strcmp (info_variables[i].choices[j], value) == 0) + break; + + if (info_variables[i].choices[j]) + *info_variables[i].value = j; + } + else + { + *info_variables[i].value = atoi(value); + } +} + +#endif /* INFOKEY */ |