Newer
Older
* 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/sastr.h>

Eric Vidal
committed
int instance_create(stralloc *sasv,char const *svname, char const *regex, int len)
char const *copy ;
size_t tlen = len + 1 ;
stralloc tmp = STRALLOC_ZERO ;
if (!auto_stra(&tmp,sasv->s)) goto err ;
copy = svname + tlen ;
if (!sastr_replace_all(&tmp,regex,copy)){
log_warnu("replace instance character for service: ",svname) ;
goto err ;
}
stralloc_0(&tmp) ;
sasv->len = 0 ;
if (!auto_stra(sasv, tmp.s))
goto err ;
e = 1 ;