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

add service_switch_tree function

parent 73614ba8
No related branches found
No related tags found
No related merge requests found
......@@ -316,6 +316,7 @@ extern void service_resolve_write(resolve_service_t *res) ;
extern void service_resolve_write_tmp(resolve_service_t *res, char const *dst, uint8_t force) ;
extern int service_resolve_write_cdb(cdbmaker *c, resolve_service_t *sres) ;
extern void service_enable_disable(graph_t *g, unsigned int idx, resolve_service_t *ares, unsigned int areslen, uint8_t action, visit_t *visit, uint8_t propagate) ;
extern void service_switch_tree(resolve_service_t *res, char const *base, char const *totreename) ;
/* avoid circular dependencies by prototyping the ss_state_t instead
* of calling the state.h header file*/
typedef struct ss_state_s ss_state_t, *ss_state_t_ref ;
......
......@@ -16,6 +16,7 @@ service_resolve_write.o
service_resolve_read_cdb.o
service_resolve_write_cdb.o
service_resolve_write_tmp.o
service_switch_tree.o
-loblibs
-lskarnet
/*
* service_switch_tree.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 <stdlib.h>
#include <oblibs/log.h>
#include <66/service.h>
#include <66/resolve.h>
#include <66/tree.h>
void service_switch_tree(resolve_service_t *res, char const *base, char const *totreename)
{
log_flow() ;
resolve_wrapper_t_ref wres = resolve_set_struct(DATA_SERVICE, res) ;
tree_service_remove(base, res->sa.s + res->treename, res->sa.s + res->name) ;
tree_service_add(base, totreename, res->sa.s + res->name) ;
if (!service_resolve_modify_field(res, E_RESOLVE_SERVICE_TREENAME, totreename))
log_dieu(LOG_EXIT_SYS, "modify resolve file of: ", res->sa.s + res->name) ;
if (!resolve_write_g(wres, base, res->sa.s + res->name))
log_dieu(LOG_EXIT_SYS, "write resolve file of: ", res->sa.s + res->name) ;
free(wres) ;
}
\ No newline at end of file
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