s6

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

ftrigr_check.c (351B)


      1 /* ISC license. */
      2 
      3 #include <errno.h>
      4 #include <skalibs/stralloc.h>
      5 #include <s6/ftrigr.h>
      6 
      7 int ftrigr_check (ftrigr_t *a, uint16_t id, char *c)
      8 {
      9   stralloc sa = STRALLOC_ZERO ;
     10   int r = ftrigr_checksa(a, id, &sa) ;
     11 
     12   if (r && sa.len)
     13   {
     14     int e = errno ;
     15     *c = sa.s[sa.len - 1] ;
     16     stralloc_free(&sa) ;
     17     errno = e ;
     18   }
     19   return r ;
     20 }