diff --git a/src/include/66/ssexec.h b/src/include/66/ssexec.h index 2f2d82fde02a88ac39211df0a9587a958005d693..9a0adf401b80f8e33384fe1745d61fc022151d27 100644 --- a/src/include/66/ssexec.h +++ b/src/include/66/ssexec.h @@ -98,6 +98,7 @@ typedef int ssexec_func_t(int argc, char const *const *argv, ssexec_t *info) ; typedef ssexec_func_t *ssexec_func_t_ref ; extern void ssexec_free(ssexec_t *info) ; +extern void ssexec_copy(ssexec_t *dest, ssexec_t *src) ; extern ssexec_t const ssexec_zero ; extern void set_ssinfo(ssexec_t *info) ; @@ -180,7 +181,7 @@ extern char const *usage_66 ; #define OPTS_START_LEN (sizeof OPTS_START - 1) #define OPTS_STOP "uP" #define OPTS_STOP_LEN (sizeof OPTS_STOP - 1) -#define OPTS_SVCTL "abqhkti12pcyroduxOw:P" +#define OPTS_SVCTL "abqHkti12pcyroduxOw:P" #define OPTS_SVCTL_LEN (sizeof OPTS_SVCTL - 1) #define OPTS_ENV "c:s:VLr:e:i:" #define OPTS_ENV_LEN (sizeof OPTS_ENV - 1) diff --git a/src/include/66/tree.h b/src/include/66/tree.h index 2f5e746a8427952720b307be490232c62e3a1790..a0bf979a1def1575466609d53a12d5ef917e1b2d 100644 --- a/src/include/66/tree.h +++ b/src/include/66/tree.h @@ -183,7 +183,7 @@ extern int tree_resolve_write_cdb(cdbmaker *c, resolve_tree_t *tres) ; extern int tree_resolve_copy(resolve_tree_t *dst, resolve_tree_t *tres) ; extern int tree_resolve_modify_field(resolve_tree_t *tres, uint8_t field, char const *data) ; extern int tree_resolve_get_field_tosa(stralloc *sa, resolve_tree_t *tres, resolve_tree_enum_t field) ; - +extern int tree_resolve_array_search(resolve_tree_t *ares, unsigned int areslen, char const *name) ; /** Master */ extern int tree_resolve_master_read_cdb(cdb *c, resolve_tree_master_t *mres) ; extern int tree_resolve_master_write_cdb(cdbmaker *c, resolve_tree_master_t *mres) ; diff --git a/src/lib66/exec/deps-lib/deps b/src/lib66/exec/deps-lib/deps index 10580b4f8e98e1f7141a610470500e1b5f266c29..05aff2c0d50319cb10fd4b53ca5c6167899fa3e5 100644 --- a/src/lib66/exec/deps-lib/deps +++ b/src/lib66/exec/deps-lib/deps @@ -1,5 +1,6 @@ ssexec_all.o ssexec_boot.o +ssexec_copy.o ssexec_disable.o ssexec_enable.o ssexec_env.o diff --git a/src/lib66/exec/ssexec_copy.c b/src/lib66/exec/ssexec_copy.c new file mode 100644 index 0000000000000000000000000000000000000000..2f9fda62389152e47968393788137f42811fa58a --- /dev/null +++ b/src/lib66/exec/ssexec_copy.c @@ -0,0 +1,48 @@ +/* + * ssexec_copy.c + * + * Copyright (c) 2018-2021 Eric Vidal <eric@obarun.org> + * + * All rights reserved. + * + * This file is part of Obarun. It is subject to the license terms in + * the LICENSE file found in the top-level directory of this + * distribution. + * This file may not be copied, modified, propagated, or distributed + * except according to the terms contained in the LICENSE file./ + */ + +#include <oblibs/string.h> +#include <oblibs/log.h> + +#include <skalibs/stralloc.h> + +#include <66/ssexec.h> + +void ssexec_copy(ssexec_t *dest, ssexec_t *src) +{ + log_flow() ; + + stralloc_copy(&dest->base, &src->base) ; + stralloc_copy(&dest->live, &src->live) ; + stralloc_copy(&dest->tree, &src->tree) ; + stralloc_copy(&dest->scandir, &src->scandir) ; + stralloc_copy(&dest->treename, &src->treename) ; + + dest->treeallow = src->treeallow ; + dest->owner = src->owner ; + auto_strings(dest->ownerstr, src->ownerstr) ; + dest->ownerlen = src->ownerlen ; + dest->timeout = src->timeout ; + dest->prog = src->prog ; + dest->help = src->help ; + dest->usage = src->usage ; + dest->opt_verbo = src->opt_verbo ; + dest->opt_live = src->opt_live ; + dest->opt_tree = src->opt_tree ; + dest->opt_timeout = src->opt_timeout ; + dest->opt_color = src->opt_color ; + dest->skip_opt_tree = src->skip_opt_tree ; +} + + diff --git a/src/lib66/tree/deps-lib/deps b/src/lib66/tree/deps-lib/deps index 2572c254e8378deeee1c1aa6a5c328f26a0ec690..af4d52ec9b137fb54375f564023ddd7e47aff887 100644 --- a/src/lib66/tree/deps-lib/deps +++ b/src/lib66/tree/deps-lib/deps @@ -5,6 +5,7 @@ tree_isenabled.o tree_isinitialized.o tree_isvalid.o tree_ongroups.o +tree_resolve_array_search.o tree_resolve_copy.o tree_resolve_get_field_tosa.o tree_resolve_master_copy.o diff --git a/src/lib66/tree/tree_resolve_array_search.c b/src/lib66/tree/tree_resolve_array_search.c new file mode 100644 index 0000000000000000000000000000000000000000..c94b57608f22ecaf71a623d67e84c73c5e67f8f6 --- /dev/null +++ b/src/lib66/tree/tree_resolve_array_search.c @@ -0,0 +1,31 @@ +/* + * tree_resolve_array_search.c + * + * Copyright (c) 2018-2021 Eric Vidal <eric@obarun.org> + * + * All rights reserved. + * + * This file is part of Obarun. It is subject to the license terms in + * the LICENSE file found in the top-level directory of this + * distribution. + * This file may not be copied, modified, propagated, or distributed + * except according to the terms contained in the LICENSE file./ + */ + +#include <string.h> + +#include <66/tree.h> + +int tree_resolve_array_search(resolve_tree_t *ares, unsigned int areslen, char const *name) +{ + unsigned int pos = 0 ; + + for (; pos < areslen ; pos++) { + + char const *n = ares[pos].sa.s + ares[pos].name ; + if (!strcmp(name, n)) + return pos ; + } + + return -1 ; +}