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

add resolve_read_g() function

parent e8bfda67
No related branches found
No related tags found
No related merge requests found
......@@ -64,9 +64,11 @@ struct resolve_field_table_s
extern resolve_wrapper_t *resolve_set_struct(uint8_t type, void *s) ;
extern int resolve_init(resolve_wrapper_t *wres) ;
extern int resolve_check(char const *src, char const *name) ;
extern int resolve_read(resolve_wrapper_t *wres, char const *src, char const *name) ;
/* convenient API: do a resolve_check then a resolve_read */
extern int resolve_read_g(resolve_wrapper_t *wres, char const *src, char const *name) ;
extern int resolve_write(resolve_wrapper_t *wres, char const *dst, char const *name) ;
extern int resolve_check(char const *src, char const *name) ;
extern int resolve_append(genalloc *ga, resolve_wrapper_t *wres) ;
extern int resolve_search(genalloc *ga, char const *name, uint8_t type) ;
extern int resolve_cmp(genalloc *ga, char const *name, uint8_t type) ;
......
/*
* resolve_read_g.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 <string.h>
#include <oblibs/log.h>
#include <oblibs/string.h>
#include <66/resolve.h>
int resolve_read_g(resolve_wrapper_t *wres, char const *src, char const *name)
{
log_flow() ;
size_t srclen = strlen(src) ;
size_t namelen = strlen(name) ;
char tmp[srclen + SS_RESOLVE_LEN + 1 + namelen + 1] ;
auto_strings(tmp,src,SS_RESOLVE,"/",name) ;
r = scan_mode(tmp,S_IFREG) ;
if (r <= 0)
log_warnusys_return(LOG_EXIT_ZERO,"found resolve file: ", tmp) ;
if (!resolve_read_cdb(wres,tmp))
return 0 ;
return 1 ;
}
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