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

split instance headers files, add instance_splitname_to_char function

parent 1bf6d685
No related branches found
No related tags found
No related merge requests found
/*
* instance.h
*
* 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./
*/
#ifndef SS_INSTANCE_H
#define SS_INSTANCE_H
#include <sys/types.h>
#include <unistd.h> //getuid
#include <oblibs/log.h>
#include <skalibs/stralloc.h>
#include <skalibs/genalloc.h>
#include <66/ssexec.h>
#include <66/service.h>
/** ss_instance.c file */
extern int instance_check(char const *svname) ;
extern int instance_splitname(stralloc *sa,char const *name,int len,int what) ;
extern int instance_create(stralloc *sasv,char const *svname, char const *regex, int len) ;
extern void instance_splitname_to_char(char *store, char const *name, int len, int what) ;
#endif
......@@ -44,10 +44,6 @@ extern int set_ownersysdir(stralloc *base,uid_t owner) ;
extern int read_svfile(stralloc *sasv,char const *name,char const *src) ;
extern int module_in_cmdline(genalloc *gares, resolve_service_t *res, char const *dir) ;
extern int module_search_service(char const *src, genalloc *gares, char const *name,uint8_t *found, char module_name[256]) ;
/** ss_instance.c file */
extern int instance_check(char const *svname) ;
extern int instance_splitname(stralloc *sa,char const *name,int len,int what) ;
extern int instance_create(stralloc *sasv,char const *svname, char const *regex, int len) ;
extern int module_path(stralloc *sdir, stralloc *mdir, char const *sv,char const *frontend_src, uid_t owner) ;
extern int sa_pointo(stralloc *sa, ssexec_t *info, int type, unsigned int where) ;
......
instance_check.o
instance_create.o
instance_splitname.o
instance_splitname_to_char.o
-loblibs
-lskarnet
/*
* instance_splitname_to_char.c
*
* Copyright (c) 2018-2022 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 <oblibs/log.h>
#include <oblibs/string.h>
void instance_splitname_to_char(char *store, char const *name, int len, int what)
{
log_flow() ;
char const *copy ;
size_t tlen = len + 1, clen = 0 ;
char template[tlen + 1] ;
memcpy(template,name,tlen) ;
template[tlen] = 0 ;
copy = name + tlen ;
if (!what) {
auto_strings(store, template) ;
} else {
clen = strlen(copy) ;
memcpy(store, copy, clen) ;
store[clen] = 0 ;
}
}
......@@ -22,6 +22,7 @@
#include <66/constants.h>
#include <66/utils.h>
#include <66/instance.h>
/* @sdir -> service dir
* @mdir -> module dir */
......
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