* Get string value of variable, or NULL if it's not defined. * * Note: result is valid until variable is next assigned to. */
| 68 | * Note: result is valid until variable is next assigned to. |
| 69 | */ |
| 70 | const char * |
| 71 | GetVariable(VariableSpace space, const char *name) |
| 72 | { |
| 73 | struct _variable *current; |
| 74 | |
| 75 | if (!space) |
| 76 | return NULL; |
| 77 | |
| 78 | for (current = space->next; current; current = current->next) |
| 79 | { |
| 80 | int cmp = strcmp(current->name, name); |
| 81 | |
| 82 | if (cmp == 0) |
| 83 | { |
| 84 | /* this is correct answer when value is NULL, too */ |
| 85 | return current->value; |
| 86 | } |
| 87 | if (cmp > 0) |
| 88 | break; /* it's not there */ |
| 89 | } |
| 90 | |
| 91 | return NULL; |
| 92 | } |
| 93 | |
| 94 | /* |
| 95 | * Try to interpret "value" as a boolean value, and if successful, |
no outgoing calls
no test coverage detected