diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/environment.h | 9 | ||||
-rw-r--r-- | include/search.h | 14 |
2 files changed, 22 insertions, 1 deletions
diff --git a/include/environment.h b/include/environment.h index ae3f7b6aedf..90fb1302b1e 100644 --- a/include/environment.h +++ b/include/environment.h @@ -184,6 +184,15 @@ void set_default_env(const char *s); /* Import from binary representation into hash table */ int env_import(const char *buf, int check); +/* + * Check if variable "name" can be changed from oldval to newval, + * and if so, apply the changes (e.g. baudrate). + * When (flag & H_FORCE) is set, it does not print out any error + * message and forces overwriting of write-once variables. + */ +int env_check_apply(const char *name, const char *oldval, + const char *newval, int flag); + #endif /* DO_DEPS_ONLY */ #endif /* _ENVIRONMENT_H_ */ diff --git a/include/search.h b/include/search.h index 94d75fc65c2..721c8acda06 100644 --- a/include/search.h +++ b/include/search.h @@ -57,6 +57,16 @@ struct hsearch_data { struct _ENTRY *table; unsigned int size; unsigned int filled; +/* + * Callback function which will check whether the given change for variable + * "name" from "oldval" to "newval" may be applied or not, and possibly apply + * such change. + * When (flag & H_FORCE) is set, it shall not print out any error message and + * shall force overwriting of write-once variables. +.* Must return 0 for approval, 1 for denial. + */ + int (*apply)(const char *name, const char *oldval, + const char *newval, int flag); }; /* Create a new hashing table which will at most contain NEL elements. */ @@ -97,10 +107,12 @@ extern ssize_t hexport_r(struct hsearch_data *__htab, /* * nvars: length of vars array * vars: array of strings (variable names) to import (nvars == 0 means all) + * do_apply: whether to call callback function to check the new argument, + * and possibly apply changes (false means accept everything) */ extern int himport_r(struct hsearch_data *__htab, const char *__env, size_t __size, const char __sep, - int __flag, int nvars, char * const vars[]); + int __flag, int nvars, char * const vars[], int do_apply); /* Flags for himport_r() */ #define H_NOCLEAR (1 << 0) /* do not clear hash table before importing */ |