diff --git a/src/lib66/exec/ssexec_resolve.c b/src/lib66/exec/ssexec_resolve.c index 9681f2fc316d1958d88c40e7c8b253d214d5362e..e31855f0ebde8038f7171539ee0859e3490f188c 100644 --- a/src/lib66/exec/ssexec_resolve.c +++ b/src/lib66/exec/ssexec_resolve.c @@ -34,7 +34,7 @@ #include <66/config.h> #include <66/state.h> -#define MAXOPTS 71 +#define MAXOPTS 72 static wchar_t const field_suffix[] = L" :" ; static char fields[INFO_NKEY][INFO_FIELD_MAXLEN] = {{ 0 }} ; @@ -94,66 +94,67 @@ static void info_display_service_field(resolve_service_t *res) info_display_string(fields[14], res->sa.s, res->path.home, 1) ; info_display_string(fields[15], res->sa.s, res->path.frontend, 1) ; info_display_string(fields[16], res->sa.s, res->path.status, 1) ; - - info_display_string(fields[17], res->sa.s, res->dependencies.depends, 1) ; - info_display_string(fields[18], res->sa.s, res->dependencies.requiredby, 1) ; - info_display_string(fields[19], res->sa.s, res->dependencies.optsdeps, 1) ; - info_display_int(fields[20], res->dependencies.ndepends) ; - info_display_int(fields[21], res->dependencies.nrequiredby) ; - info_display_int(fields[22], res->dependencies.noptsdeps) ; - - info_display_string(fields[23], res->sa.s, res->execute.run.run, 1) ; - info_display_string(fields[24], res->sa.s, res->execute.run.run_user, 1) ; - info_display_string(fields[25], res->sa.s, res->execute.run.build, 1) ; - info_display_string(fields[26], res->sa.s, res->execute.run.shebang, 1) ; - info_display_string(fields[27], res->sa.s, res->execute.run.runas, 1) ; - info_display_string(fields[28], res->sa.s, res->execute.finish.run, 1) ; - info_display_string(fields[29], res->sa.s, res->execute.finish.run_user, 1) ; - info_display_string(fields[30], res->sa.s, res->execute.finish.build, 1) ; - info_display_string(fields[31], res->sa.s, res->execute.finish.shebang, 1) ; - info_display_string(fields[32], res->sa.s, res->execute.finish.runas, 1) ; - info_display_int(fields[33], res->execute.timeout.kill) ; - info_display_int(fields[34], res->execute.timeout.finish) ; - info_display_int(fields[35], res->execute.timeout.up) ; - info_display_int(fields[36], res->execute.timeout.down) ; - info_display_int(fields[37], res->execute.down) ; - info_display_int(fields[38], res->execute.downsignal) ; - - info_display_string(fields[39], res->sa.s, res->live.livedir, 1) ; - info_display_string(fields[40], res->sa.s, res->live.scandir, 1) ; - info_display_string(fields[41], res->sa.s, res->live.statedir, 1) ; - info_display_string(fields[42], res->sa.s, res->live.eventdir, 1) ; - info_display_string(fields[43], res->sa.s, res->live.notifdir, 1) ; - info_display_string(fields[44], res->sa.s, res->live.supervisedir, 1) ; - info_display_string(fields[45], res->sa.s, res->live.fdholderdir, 1) ; - info_display_string(fields[46], res->sa.s, res->live.oneshotddir, 1) ; - - info_display_string(fields[47], res->sa.s, res->logger.name, 1) ; - info_display_string(fields[48], res->sa.s, res->logger.destination, 1) ; - info_display_int(fields[49], res->logger.backup) ; - info_display_int(fields[50], res->logger.maxsize) ; - info_display_int(fields[51], res->logger.timestamp) ; - info_display_string(fields[52], res->sa.s, res->logger.execute.run.run, 1) ; - info_display_string(fields[53], res->sa.s, res->logger.execute.run.run_user, 1) ; - info_display_string(fields[54], res->sa.s, res->logger.execute.run.build, 1) ; - info_display_string(fields[55], res->sa.s, res->logger.execute.run.shebang, 1) ; - info_display_string(fields[56], res->sa.s, res->logger.execute.run.runas, 1) ; - info_display_int(fields[57], res->logger.execute.timeout.kill) ; - info_display_int(fields[58], res->logger.execute.timeout.finish) ; - - info_display_string(fields[59], res->sa.s, res->environ.env, 1) ; - info_display_string(fields[60], res->sa.s, res->environ.envdir, 1) ; - info_display_int(fields[61], res->environ.env_overwrite) ; - - info_display_string(fields[62], res->sa.s, res->regex.configure, 1) ; - info_display_string(fields[63], res->sa.s, res->regex.directories, 1) ; - info_display_string(fields[64], res->sa.s, res->regex.files, 1) ; - info_display_string(fields[65], res->sa.s, res->regex.infiles, 1) ; - info_display_string(fields[66], res->sa.s, res->regex.contents, 1) ; - info_display_int(fields[67], res->regex.ndirectories) ; - info_display_int(fields[68], res->regex.nfiles) ; - info_display_int(fields[69], res->regex.ninfiles) ; - info_display_int(fields[70], res->regex.ncontents) ; + info_display_string(fields[17], res->sa.s, res->path.servicedir, 1) ; + + info_display_string(fields[18], res->sa.s, res->dependencies.depends, 1) ; + info_display_string(fields[19], res->sa.s, res->dependencies.requiredby, 1) ; + info_display_string(fields[20], res->sa.s, res->dependencies.optsdeps, 1) ; + info_display_string(fields[21], res->sa.s, res->dependencies.contents, 1) ; + info_display_int(fields[22], res->dependencies.ndepends) ; + info_display_int(fields[23], res->dependencies.nrequiredby) ; + info_display_int(fields[24], res->dependencies.noptsdeps) ; + info_display_int(fields[25], res->dependencies.ncontents) ; + + info_display_string(fields[26], res->sa.s, res->execute.run.run, 1) ; + info_display_string(fields[27], res->sa.s, res->execute.run.run_user, 1) ; + info_display_string(fields[28], res->sa.s, res->execute.run.build, 1) ; + info_display_string(fields[29], res->sa.s, res->execute.run.shebang, 1) ; + info_display_string(fields[30], res->sa.s, res->execute.run.runas, 1) ; + info_display_string(fields[31], res->sa.s, res->execute.finish.run, 1) ; + info_display_string(fields[32], res->sa.s, res->execute.finish.run_user, 1) ; + info_display_string(fields[33], res->sa.s, res->execute.finish.build, 1) ; + info_display_string(fields[34], res->sa.s, res->execute.finish.shebang, 1) ; + info_display_string(fields[35], res->sa.s, res->execute.finish.runas, 1) ; + info_display_int(fields[36], res->execute.timeout.kill) ; + info_display_int(fields[37], res->execute.timeout.finish) ; + info_display_int(fields[38], res->execute.timeout.up) ; + info_display_int(fields[39], res->execute.timeout.down) ; + info_display_int(fields[40], res->execute.down) ; + info_display_int(fields[41], res->execute.downsignal) ; + + info_display_string(fields[42], res->sa.s, res->live.livedir, 1) ; + info_display_string(fields[43], res->sa.s, res->live.scandir, 1) ; + info_display_string(fields[44], res->sa.s, res->live.statedir, 1) ; + info_display_string(fields[45], res->sa.s, res->live.eventdir, 1) ; + info_display_string(fields[46], res->sa.s, res->live.notifdir, 1) ; + info_display_string(fields[47], res->sa.s, res->live.supervisedir, 1) ; + info_display_string(fields[48], res->sa.s, res->live.fdholderdir, 1) ; + info_display_string(fields[49], res->sa.s, res->live.oneshotddir, 1) ; + + info_display_string(fields[50], res->sa.s, res->logger.name, 1) ; + info_display_string(fields[51], res->sa.s, res->logger.destination, 1) ; + info_display_int(fields[52], res->logger.backup) ; + info_display_int(fields[53], res->logger.maxsize) ; + info_display_int(fields[54], res->logger.timestamp) ; + info_display_string(fields[55], res->sa.s, res->logger.execute.run.run, 1) ; + info_display_string(fields[56], res->sa.s, res->logger.execute.run.run_user, 1) ; + info_display_string(fields[57], res->sa.s, res->logger.execute.run.build, 1) ; + info_display_string(fields[58], res->sa.s, res->logger.execute.run.shebang, 1) ; + info_display_string(fields[59], res->sa.s, res->logger.execute.run.runas, 1) ; + info_display_int(fields[60], res->logger.execute.timeout.kill) ; + info_display_int(fields[61], res->logger.execute.timeout.finish) ; + + info_display_string(fields[62], res->sa.s, res->environ.env, 1) ; + info_display_string(fields[63], res->sa.s, res->environ.envdir, 1) ; + info_display_int(fields[64], res->environ.env_overwrite) ; + + info_display_string(fields[65], res->sa.s, res->regex.configure, 1) ; + info_display_string(fields[66], res->sa.s, res->regex.directories, 1) ; + info_display_string(fields[67], res->sa.s, res->regex.files, 1) ; + info_display_string(fields[68], res->sa.s, res->regex.infiles, 1) ; + info_display_int(fields[69], res->regex.ndirectories) ; + info_display_int(fields[70], res->regex.nfiles) ; + info_display_int(fields[71], res->regex.ninfiles) ; } @@ -194,13 +195,16 @@ int ssexec_resolve(int argc, char const *const *argv, ssexec_t *info) "home", "frontend", "status", //17 + "servicedir", "depends", "requiredby", "optsdeps", + "contents", "ndepends", "nrequiredby", - "noptsdeps", // 23 + "noptsdeps", + "ncontents", // 25 "run", "run_user", @@ -217,7 +221,7 @@ int ssexec_resolve(int argc, char const *const *argv, ssexec_t *info) "timeoutup", "timeoutdown", "down", - "downsignal", // 39 + "downsignal", // 41 "livedir", "scandir", @@ -226,7 +230,7 @@ int ssexec_resolve(int argc, char const *const *argv, ssexec_t *info) "notifdir", "supervisedir", "fdholderdir", - "oneshotddir", //47 + "oneshotddir", //49 "logname" , "logdestination" , @@ -239,21 +243,19 @@ int ssexec_resolve(int argc, char const *const *argv, ssexec_t *info) "logrun_shebang" , "logrun_runas" , "logtimeoutkill", - "logtimeoutfinish", // 59 + "logtimeoutfinish", // 61 "env", "envdir", - "env_overwrite", // 62 + "env_overwrite", // 64 "configure", "directories", "files", "infiles", - "contents", "ndirectories", "nfiles", - "ninfiles", - "ncontents" // 71 + "ninfiles" // 71 } ; diff --git a/src/lib66/exec/ssexec_status.c b/src/lib66/exec/ssexec_status.c index ce45ad288b0d9472247b2f79d9d847401d3c57b3..7c3c061c10d985df83863351b505d75b233a4b0d 100644 --- a/src/lib66/exec/ssexec_status.c +++ b/src/lib66/exec/ssexec_status.c @@ -30,7 +30,6 @@ #include <oblibs/environ.h> #include <skalibs/stralloc.h> -#include <skalibs/genalloc.h> #include <skalibs/lolstdio.h> #include <skalibs/bytestr.h> #include <skalibs/djbunix.h> @@ -87,6 +86,7 @@ static void info_display_live(char const *field, resolve_service_t *res) ; static void info_display_deps(char const *field, resolve_service_t *res) ; static void info_display_requiredby(char const *field, resolve_service_t *res) ; static void info_display_optsdeps(char const *field, resolve_service_t *res) ; +static void info_display_contents(char const *field, resolve_service_t *res) ; static void info_display_start(char const *field, resolve_service_t *res) ; static void info_display_stop(char const *field, resolve_service_t *res) ; static void info_display_envat(char const *field, resolve_service_t *res) ; @@ -112,17 +112,18 @@ static info_opts_map_t const opts_sv_table[] = { .str = "depends", .svfunc = &info_display_deps, .id = 8 }, { .str = "requiredby", .svfunc = &info_display_requiredby, .id = 9 }, { .str = "optsdepends", .svfunc = &info_display_optsdeps, .id = 10 }, - { .str = "start", .svfunc = &info_display_start, .id = 11 }, - { .str = "stop", .svfunc = &info_display_stop, .id = 12 }, - { .str = "envat", .svfunc = &info_display_envat, .id = 13 }, - { .str = "envfile", .svfunc = &info_display_envfile, .id = 14 }, - { .str = "logname", .svfunc = &info_display_logname, .id = 15 }, - { .str = "logdst", .svfunc = &info_display_logdst, .id = 16 }, - { .str = "logfile", .svfunc = &info_display_logfile, .id = 17 }, + { .str = "contents", .svfunc = &info_display_contents, .id = 11 }, + { .str = "start", .svfunc = &info_display_start, .id = 12 }, + { .str = "stop", .svfunc = &info_display_stop, .id = 13 }, + { .str = "envat", .svfunc = &info_display_envat, .id = 14 }, + { .str = "envfile", .svfunc = &info_display_envfile, .id = 15 }, + { .str = "logname", .svfunc = &info_display_logname, .id = 16 }, + { .str = "logdst", .svfunc = &info_display_logdst, .id = 17 }, + { .str = "logfile", .svfunc = &info_display_logfile, .id = 18 }, { .str = 0, .svfunc = 0, .id = -1 } } ; -#define MAXOPTS 19 +#define MAXOPTS 20 #define checkopts(n) if (n >= MAXOPTS) log_die(LOG_EXIT_USER, "too many options") #define DELIM ',' @@ -215,12 +216,10 @@ static void info_get_status(resolve_service_t *res) } else { - char *ste = res->sa.s + res->path.home ; - char *name = res->sa.s + res->name ; char *status = 0 ; - if (!state_read(&sta, ste, name)) - log_dieusys(LOG_EXIT_SYS,"read state of: ",name) ; + if (!state_read(&sta, res)) + log_dieusys(LOG_EXIT_SYS,"read state of: ", res->sa.s + res->name) ; if (!service_is(&sta, STATE_FLAGS_ISSUPERVISED)) { @@ -249,7 +248,7 @@ static void info_display_status(char const *field,resolve_service_t *res) if (NOFIELD) info_display_field_name(field) ; - if (!state_read(&ste, res->sa.s + res->path.home, res->sa.s + res->name)) + if (!state_read(&ste, res)) log_dieusys(LOG_EXIT_SYS, "read state file of: ", res->sa.s + res->name) ; disen = service_is(&ste, STATE_FLAGS_ISENABLED) ; @@ -340,7 +339,7 @@ static void info_display_requiredby(char const *field, resolve_service_t *res) if (REVERSE) if (!sastr_reverse(&deps)) - log_dieu(LOG_EXIT_SYS,"reverse the requiredby list") ; + log_dieu(LOG_EXIT_SYS,"reverse the selection list") ; info_display_list(field,&deps) ; @@ -416,7 +415,7 @@ static void info_display_deps(char const *field, resolve_service_t *res) if (REVERSE) if (!sastr_reverse(&deps)) - log_dieu(LOG_EXIT_SYS,"reverse the dependencies list") ; + log_dieu(LOG_EXIT_SYS,"reverse the selection list") ; info_display_list(field,&deps) ; @@ -500,13 +499,43 @@ static void info_display_optsdeps(char const *field, resolve_service_t *res) if (!res->dependencies.noptsdeps) goto empty ; if (!sastr_clean_string(&salist,res->sa.s + res->dependencies.optsdeps)) - log_dieu(LOG_EXIT_SYS,"build dependencies list") ; + log_dieu(LOG_EXIT_SYS,"build optionnal dependencies list") ; info_display_with_source_tree(&salist,res) ; if (REVERSE) if (!sastr_reverse(&salist)) - log_dieu(LOG_EXIT_SYS,"reverse dependencies list") ; + log_dieu(LOG_EXIT_SYS,"reverse the selection list") ; + + info_display_list(field,&salist) ; + + goto freed ; + + empty: + if (!bprintf(buffer_1,"%s%s%s\n",log_color->warning,"None",log_color->off)) + log_dieusys(LOG_EXIT_SYS,"write to stdout") ; + + freed: + stralloc_free(&salist) ; +} + +static void info_display_contents(char const *field, resolve_service_t *res) +{ + stralloc salist = STRALLOC_ZERO ; + + if (NOFIELD) info_display_field_name(field) ; + else field = 0 ; + + if (!res->dependencies.ncontents) goto empty ; + + if (!sastr_clean_string(&salist,res->sa.s + res->dependencies.contents)) + log_dieu(LOG_EXIT_SYS,"build contents list") ; + + info_display_with_source_tree(&salist,res) ; + + if (REVERSE) + if (!sastr_reverse(&salist)) + log_dieu(LOG_EXIT_SYS,"reverse the selection list") ; info_display_list(field,&salist) ; @@ -852,6 +881,7 @@ int ssexec_status(int argc, char const *const *argv, ssexec_t *info) "Dependencies", "Required by", "Optional dependencies" , + "Contents", "Start script", "Stop script", "Environment source", diff --git a/src/lib66/service/service_resolve_copy.c b/src/lib66/service/service_resolve_copy.c index ff04c34145683dde53b215f4c963921c2feb9c3b..648308aa7c8d9d1bdb06bce1f9b628ee5300ccb3 100644 --- a/src/lib66/service/service_resolve_copy.c +++ b/src/lib66/service/service_resolve_copy.c @@ -54,14 +54,17 @@ int service_resolve_copy(resolve_service_t *dst, resolve_service_t *res) dst->path.home = res->path.home ; dst->path.frontend = res->path.frontend ; dst->path.status = res->path.status ; + dst->path.servicedir = res->path.servicedir ; // dependencies dst->dependencies.depends = res->dependencies.depends ; dst->dependencies.requiredby = res->dependencies.requiredby ; dst->dependencies.optsdeps = res->dependencies.optsdeps ; + dst->dependencies.contents = res->dependencies.contents ; dst->dependencies.ndepends = res->dependencies.ndepends ; dst->dependencies.nrequiredby = res->dependencies.nrequiredby ; dst->dependencies.noptsdeps = res->dependencies.noptsdeps ; + dst->dependencies.ncontents = res->dependencies.ncontents ; // execute dst->execute.run.run = res->execute.run.run ; @@ -116,12 +119,9 @@ int service_resolve_copy(resolve_service_t *dst, resolve_service_t *res) dst->regex.directories = res->regex.directories ; dst->regex.files = res->regex.files ; dst->regex.infiles = res->regex.infiles ; - dst->regex.contents = res->regex.contents ; dst->regex.ndirectories = res->regex.ndirectories ; dst->regex.nfiles = res->regex.nfiles ; dst->regex.ninfiles = res->regex.ninfiles ; - dst->regex.ncontents = res->regex.ncontents ; - return 1 ; } diff --git a/src/lib66/service/service_resolve_get_field_tosa.c b/src/lib66/service/service_resolve_get_field_tosa.c index c50364d818f8b4ab81a59b698d1dd7013367e9ca..8924a747470e60f63a1ad4aa1fa3adb8ac3e7525 100644 --- a/src/lib66/service/service_resolve_get_field_tosa.c +++ b/src/lib66/service/service_resolve_get_field_tosa.c @@ -109,6 +109,9 @@ int service_resolve_get_field_tosa(stralloc *sa, resolve_service_t *res, resolve case E_RESOLVE_SERVICE_STATUS: str = res->sa.s + res->path.status ; + case E_RESOLVE_SERVICE_SERVICEDIR: + str = res->sa.s + res->path.servicedir ; + // dependencies case E_RESOLVE_SERVICE_DEPENDS: @@ -123,6 +126,10 @@ int service_resolve_get_field_tosa(stralloc *sa, resolve_service_t *res, resolve str = res->sa.s + res->dependencies.optsdeps ; break ; + case E_RESOLVE_SERVICE_CONTENTS: + str = res->sa.s + res->dependencies.contents ; + break ; + case E_RESOLVE_SERVICE_NDEPENDS: fmt[uint32_fmt(fmt,res->dependencies.ndepends)] = 0 ; str = fmt ; @@ -138,6 +145,11 @@ int service_resolve_get_field_tosa(stralloc *sa, resolve_service_t *res, resolve str = fmt ; break ; + case E_RESOLVE_SERVICE_NCONTENTS: + fmt[uint32_fmt(fmt,res->dependencies.ncontents)] = 0 ; + str = fmt ; + break ; + // execute case E_RESOLVE_SERVICE_RUN: @@ -338,10 +350,6 @@ int service_resolve_get_field_tosa(stralloc *sa, resolve_service_t *res, resolve str = res->sa.s + res->regex.infiles ; break ; - case E_RESOLVE_SERVICE_REGEX_CONTENTS: - str = res->sa.s + res->regex.contents ; - break ; - case E_RESOLVE_SERVICE_REGEX_NDIRECTORIES: fmt[uint32_fmt(fmt,res->regex.ndirectories)] = 0 ; str = fmt ; @@ -357,11 +365,6 @@ int service_resolve_get_field_tosa(stralloc *sa, resolve_service_t *res, resolve str = fmt ; break ; - case E_RESOLVE_SERVICE_REGEX_NCONTENTS: - fmt[uint32_fmt(fmt,res->regex.ncontents)] = 0 ; - str = fmt ; - break ; - default: return e ; } diff --git a/src/lib66/service/service_resolve_modify_field.c b/src/lib66/service/service_resolve_modify_field.c index d3ee3abfd6a8535f19c04d0c9721c402014e149e..859b824599ab183f50a5a32e27be3d9a2cf77f65 100644 --- a/src/lib66/service/service_resolve_modify_field.c +++ b/src/lib66/service/service_resolve_modify_field.c @@ -41,14 +41,17 @@ resolve_field_table_t resolve_service_field_table[] = { [E_RESOLVE_SERVICE_HOME] = { .field = "home" }, [E_RESOLVE_SERVICE_FRONTEND] = { .field = "frontend" }, [E_RESOLVE_SERVICE_STATUS] = { .field = "status" }, + [E_RESOLVE_SERVICE_SERVICEDIR] = { .field = "servicedir" }, // dependencies [E_RESOLVE_SERVICE_DEPENDS] = { .field = "depends" }, [E_RESOLVE_SERVICE_REQUIREDBY] = { .field = "requiredby" }, [E_RESOLVE_SERVICE_OPTSDEPS] = { .field = "optsdeps" }, + [E_RESOLVE_SERVICE_CONTENTS] = { .field = "contents" }, [E_RESOLVE_SERVICE_NDEPENDS] = { .field = "ndepends" }, [E_RESOLVE_SERVICE_NREQUIREDBY] = { .field = "nrequiredby" }, [E_RESOLVE_SERVICE_NOPTSDEPS] = { .field = "noptsdeps" }, + [E_RESOLVE_SERVICE_NCONTENTS] = { .field = "ncontents" }, // execute [E_RESOLVE_SERVICE_RUN] = { .field = "run" }, @@ -103,11 +106,9 @@ resolve_field_table_t resolve_service_field_table[] = { [E_RESOLVE_SERVICE_REGEX_DIRECTORIES] = { .field = "directories" }, [E_RESOLVE_SERVICE_REGEX_FILES] = { .field = "files" }, [E_RESOLVE_SERVICE_REGEX_INFILES] = { .field = "infiles" }, - [E_RESOLVE_SERVICE_REGEX_CONTENTS] = { .field = "contents" }, [E_RESOLVE_SERVICE_REGEX_NDIRECTORIES] = { .field = "ndirectories" }, [E_RESOLVE_SERVICE_REGEX_NFILES] = { .field = "nfiles" }, [E_RESOLVE_SERVICE_REGEX_NINFILES] = { .field = "ninfiles" }, - [E_RESOLVE_SERVICE_REGEX_NCONTENTS] = { .field = "ncontents" }, [E_RESOLVE_SERVICE_ENDOFKEY] = { .field = 0 } } ; uint32_t resolve_add_uint(char const *data) @@ -203,6 +204,10 @@ int service_resolve_modify_field(resolve_service_t *res, resolve_service_enum_t res->path.status = resolve_add_string(wres, data) ; break ; + case E_RESOLVE_SERVICE_SERVICEDIR: + res->path.servicedir = resolve_add_string(wres, data) ; + break ; + // dependencies case E_RESOLVE_SERVICE_DEPENDS: @@ -217,6 +222,10 @@ int service_resolve_modify_field(resolve_service_t *res, resolve_service_enum_t res->dependencies.optsdeps = resolve_add_string(wres, data) ; break ; + case E_RESOLVE_SERVICE_CONTENTS: + res->dependencies.contents = resolve_add_string(wres, data) ; + break ; + case E_RESOLVE_SERVICE_NDEPENDS: res->dependencies.ndepends = resolve_add_uint(data) ; break ; @@ -229,6 +238,9 @@ int service_resolve_modify_field(resolve_service_t *res, resolve_service_enum_t res->dependencies.noptsdeps = resolve_add_uint(data) ; break ; + case E_RESOLVE_SERVICE_NCONTENTS: + res->dependencies.ncontents = resolve_add_uint(data) ; + break ; // execute @@ -416,10 +428,6 @@ int service_resolve_modify_field(resolve_service_t *res, resolve_service_enum_t res->regex.infiles = resolve_add_string(wres, data) ; break ; - case E_RESOLVE_SERVICE_REGEX_CONTENTS: - res->regex.contents = resolve_add_string(wres, data) ; - break ; - case E_RESOLVE_SERVICE_REGEX_NDIRECTORIES: res->regex.ndirectories = resolve_add_uint(data) ; break ; @@ -432,10 +440,6 @@ int service_resolve_modify_field(resolve_service_t *res, resolve_service_enum_t res->regex.ninfiles = resolve_add_uint(data) ; break ; - case E_RESOLVE_SERVICE_REGEX_NCONTENTS: - res->regex.ncontents = resolve_add_uint(data) ; - break ; - default: return e ; } diff --git a/src/lib66/service/service_resolve_read_cdb.c b/src/lib66/service/service_resolve_read_cdb.c index 15597879ab568ec836a2983c8f29118de523746a..26c799afb58db0c1eb85b66333625824c26d206c 100644 --- a/src/lib66/service/service_resolve_read_cdb.c +++ b/src/lib66/service/service_resolve_read_cdb.c @@ -70,6 +70,8 @@ int service_resolve_read_cdb(cdb *c, resolve_service_t *res) res->path.frontend = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ; resolve_find_cdb(&tmp,c,"status") ; res->path.status = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ; + resolve_find_cdb(&tmp,c,"servicedir") ; + res->path.servicedir = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ; /* dependencies */ resolve_find_cdb(&tmp,c,"depends") ; @@ -78,12 +80,16 @@ int service_resolve_read_cdb(cdb *c, resolve_service_t *res) res->dependencies.requiredby = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ; resolve_find_cdb(&tmp,c,"optsdeps") ; res->dependencies.optsdeps = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ; + resolve_find_cdb(&tmp,c,"contents") ; + res->dependencies.contents = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ; x = resolve_find_cdb(&tmp,c,"ndepends") ; res->dependencies.ndepends = x ; x = resolve_find_cdb(&tmp,c,"nrequiredby") ; res->dependencies.nrequiredby = x ; x = resolve_find_cdb(&tmp,c,"noptsdeps") ; res->dependencies.noptsdeps = x ; + x = resolve_find_cdb(&tmp,c,"ncontents") ; + res->dependencies.ncontents = x ; /* execute */ resolve_find_cdb(&tmp,c,"run") ; @@ -182,17 +188,12 @@ int service_resolve_read_cdb(cdb *c, resolve_service_t *res) res->regex.files = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ; resolve_find_cdb(&tmp,c,"infiles") ; res->regex.infiles = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ; - resolve_find_cdb(&tmp,c,"contents") ; - res->regex.contents = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ; x = resolve_find_cdb(&tmp,c,"ndirectories") ; res->regex.ndirectories = x ; x = resolve_find_cdb(&tmp,c,"nfiles") ; res->regex.nfiles = x ; x = resolve_find_cdb(&tmp,c,"ninfiles") ; res->regex.ninfiles = x ; - x = resolve_find_cdb(&tmp,c,"ncontents") ; - res->regex.ncontents = x ; - free(wres) ; stralloc_free(&tmp) ; diff --git a/src/lib66/service/service_resolve_write_cdb.c b/src/lib66/service/service_resolve_write_cdb.c index f296ecdff9682d6f0adf1085930cb0acf835e472..d842ceea0d1c497adad457b0026f21068a45ae3c 100644 --- a/src/lib66/service/service_resolve_write_cdb.c +++ b/src/lib66/service/service_resolve_write_cdb.c @@ -46,14 +46,17 @@ int service_resolve_write_cdb(cdbmaker *c, resolve_service_t *sres) !resolve_add_cdb(c, "home", str, sres->path.home, 1) || !resolve_add_cdb(c, "frontend", str, sres->path.frontend, 1) || !resolve_add_cdb(c, "status", str, sres->path.status, 1) || + !resolve_add_cdb(c, "servicedir", str, sres->path.servicedir, 1) || // dependencies !resolve_add_cdb(c, "depends", str, sres->dependencies.depends, 1) || !resolve_add_cdb(c, "requiredby", str, sres->dependencies.requiredby, 1) || !resolve_add_cdb(c, "optsdeps", str, sres->dependencies.optsdeps, 1) || + !resolve_add_cdb(c, "contents", str, sres->dependencies.contents, 1) || !resolve_add_cdb_uint(c, "ndepends", sres->dependencies.ndepends) || !resolve_add_cdb_uint(c, "nrequiredby", sres->dependencies.nrequiredby) || !resolve_add_cdb_uint(c, "noptsdeps", sres->dependencies.noptsdeps) || + !resolve_add_cdb_uint(c, "ncontents", sres->dependencies.ncontents) || // execute !resolve_add_cdb(c, "run", str, sres->execute.run.run, 1) || @@ -108,11 +111,9 @@ int service_resolve_write_cdb(cdbmaker *c, resolve_service_t *sres) !resolve_add_cdb(c, "directories", str, sres->regex.directories, 1) || !resolve_add_cdb(c, "files", str, sres->regex.files, 1) || !resolve_add_cdb(c, "infiles", str, sres->regex.infiles, 1) || - !resolve_add_cdb(c, "contents", str, sres->regex.contents, 1) || !resolve_add_cdb_uint(c, "ndirectories", sres->regex.ndirectories) || !resolve_add_cdb_uint(c, "nfiles", sres->regex.nfiles) || - !resolve_add_cdb_uint(c, "ninfiles", sres->regex.ninfiles) || - !resolve_add_cdb_uint(c, "ncontents", sres->regex.ncontents)) return 0 ; + !resolve_add_cdb_uint(c, "ninfiles", sres->regex.ninfiles)) return 0 ; return 1 ; }