skalibs

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

buffer_get.c (264B)


      1 /* ISC license. */
      2 
      3 #include <stddef.h>
      4 
      5 #include <skalibs/allreadwrite.h>
      6 #include <skalibs/buffer.h>
      7 
      8 ssize_t buffer_get (buffer *b, char *s, size_t len)
      9 {
     10   size_t w = 0 ;
     11   ssize_t r = unsanitize_read(buffer_getall(b, s, len, &w)) ;
     12   return r < 0 ? r : w ;
     13 }