skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

cdb_init.c (277B)


      1 /* ISC license. */
      2 
      3 #include <skalibs/djbunix.h>
      4 #include <skalibs/cdb.h>
      5 
      6 int cdb_init (cdb *c, char const *file)
      7 {
      8   int fd = openc_read(file) ;
      9   if (fd < 0) return 0 ;
     10   if (!cdb_init_fromfd(c, fd))
     11   {
     12     fd_close(fd) ;
     13     return 0 ;
     14   }
     15   fd_close(fd) ;
     16   return 1 ;
     17 }