Skip to content
Snippets Groups Projects
Commit e6c6e7c8 authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

use env_resolve_conf to display environment

parent 1e8d8122
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,7 @@
#include <66/constants.h>
#include <66/enum.h>
#include <66/resolve.h>
#include <66/environ.h>
#include <s6/s6-supervise.h>//s6_svc_ok
......@@ -606,8 +607,8 @@ int sv_args(int argc, char const *const *argv,char const *const *envp)
stralloc tree = STRALLOC_ZERO ;
genalloc gatree = GENALLOC_ZERO ;
stralloc src = STRALLOC_ZERO ;
stralloc env = STRALLOC_ZERO ;
stralloc conf = STRALLOC_ZERO ;
stralloc env = STRALLOC_ZERO ;
ss_resolve_t res = RESOLVE_ZERO ;
......@@ -651,12 +652,6 @@ int sv_args(int argc, char const *const *argv,char const *const *envp)
size_t newlen ;
/*if (!stralloc_copy(&src,&live)) goto err ;
if (!stralloc_cats(&src,SS_STATE + 1)) goto err ;
if (!stralloc_cats(&src,"/")) goto err ;
if (!stralloc_cats(&src,OWNERSTR)) goto err ;
if (!stralloc_cats(&src,"/")) goto err ;*/
if (!stralloc_copy(&src,&base)) goto err ;
if (!stralloc_cats(&src,SS_SYSTEM)) goto err ;
if (!stralloc_cats(&src,"/")) goto err ;
......@@ -762,26 +757,15 @@ int sv_args(int argc, char const *const *argv,char const *const *envp)
}
}
/** environment */
if(!OWNER)
{
if (!stralloc_cats(&env,SS_SERVICE_ADMCONFDIR)) goto err ;
if (!stralloc_0(&env)) goto err ;
}
else
{
if (!stralloc_cats(&env,base.s)) goto err ;
if (!stralloc_cats(&env,SS_ENVDIR)) goto err ;
if (!stralloc_0(&env)) goto err ;
}
if (dir_search(env.s,svname,S_IFREG))
if (res.srconf)
{
if (!env_resolve_conf(&env,MYUID)) goto err ;
if (!file_readputsa(&conf,env.s,svname)) goto err ;
if (!info_print_title("environment")) goto err ;
if (!bprintf(buffer_1,"%s%s\n","source : ",env.s)) goto err ;
if (!bprintf(buffer_1,"%s",conf.s)) goto err ;
}
/** logger */
if (res.type == CLASSIC || res.type == LONGRUN)
{
......@@ -823,8 +807,8 @@ int sv_args(int argc, char const *const *argv,char const *const *envp)
genalloc_deepfree(stralist,&gatree,stra_free) ;
ss_resolve_free(&res) ;
stralloc_free(&src) ;
stralloc_free(&env) ;
stralloc_free(&conf) ;
stralloc_free(&env) ;
return 1 ;
err:
......@@ -833,8 +817,8 @@ int sv_args(int argc, char const *const *argv,char const *const *envp)
genalloc_deepfree(stralist,&gatree,stra_free) ;
ss_resolve_free(&res) ;
stralloc_free(&src) ;
stralloc_free(&env) ;
stralloc_free(&conf) ;
stralloc_free(&env) ;
return 0 ;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment