if (!buf[0])
continue;
- /* NB: need to allocate the element before the call to
- * uci_parse_delta_tuple, otherwise the original string
+ /* NB: need to allocate the element before the call to
+ * uci_parse_delta_tuple, otherwise the original string
* gets modified before it is saved */
e = uci_alloc_generic(ctx, UCI_TYPE_DELTA, pctx->buf, sizeof(struct uci_element));
uci_list_add(&list, &e->list);
uci_expand_ptr(ctx, ptr, false);
UCI_ASSERT(ctx, ptr->p->has_delta);
- /*
+ /*
* - flush unwritten changes
* - save the package name
* - unload the package
UCI_TRAP_SAVE(ctx, error);
UCI_INTERNAL(uci_save, ctx, ptr->p);
- /* NB: need to clone package, section and option names,
+ /* NB: need to clone package, section and option names,
* as they may get freed on uci_free_package() */
package = uci_strdup(ctx, ptr->p->e.name);
if (ptr->section)
UCI_HANDLE_ERR(ctx);
UCI_ASSERT(ctx, p != NULL);
- /*
+ /*
* if the config file was outside of the /etc/config path,
* don't save the delta to a file, update the real file
* directly.
ptr->next->prev = ptr;
}
-/*
+/*
* uci_alloc_generic allocates a new uci_element with payload
* payload is appended to the struct to save memory and reduce fragmentation
*/
else if (!uci_validate_type(name))
goto error;
- /* if the given index is negative, it specifies the section number from
+ /* if the given index is negative, it specifies the section number from
* the end of the list */
if (idx < 0) {
c = 0;
local var="$1"
local value="$2"
local sep="${3:- }"
-
+
eval "export ${NO_EXPORT:+-n} -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\""
}
config () {
local cfgtype="$1"
local name="$2"
-
+
export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$(($CONFIG_NUM_SECTIONS + 1))
name="${name:-cfg$CONFIG_NUM_SECTIONS}"
append CONFIG_SECTIONS "$name"
local value="$*"
local len
- config_get len "$CONFIG_SECTION" "${varname}_LENGTH"
+ config_get len "$CONFIG_SECTION" "${varname}_LENGTH"
len="$((${len:-0} + 1))"
config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value"
config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len"
export ${NO_EXPORT:+-n} CONFIG_SECTIONS="${SECTION:+$CONFIG_SECTIONS}"
for oldvar in `set | grep ^CONFIG_${SECTION:+${SECTION}_} | \
- sed -e 's/\(.*\)=.*$/\1/'` ; do
- unset $oldvar
+ sed -e 's/\(.*\)=.*$/\1/'` ; do
+ unset $oldvar
done
}
local type="$1"
[ "$#" -ge 1 ] && shift
local section cfgtype
-
+
[ -z "$CONFIG_SECTIONS" ] && return 0
for section in ${CONFIG_SECTIONS}; do
config_get cfgtype "$section" TYPE
#define DPRINTF(...)
#endif
-/*
+/*
* throw an uci exception and store the error number
* in the context.
*/
/**
* UCI_INTERNAL: Do an internal call of a public API function
- *
+ *
* Sets Exception handling to passthrough mode.
* Allows API functions to change behavior compared to public use
*/
/**
* UCI_NESTED: Do an normal nested call of a public API function
- *
+ *
* Sets Exception handling to passthrough mode.
* Allows API functions to change behavior compared to public use
*/
*/
/*
- * This file contains ucimap, an API for mapping UCI to C data structures
+ * This file contains ucimap, an API for mapping UCI to C data structures
*/
#include <strings.h>
*/
/*
- * This file contains ucimap, an API for mapping UCI to C data structures
+ * This file contains ucimap, an API for mapping UCI to C data structures
*/
#ifndef __UCIMAP_H