summaryrefslogtreecommitdiff
path: root/src/libs6/ftrigr_check.c
blob: 30be701d53d268640fa49740e384a8aecf24bfa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* ISC license. */

#include <errno.h>
#include <skalibs/stralloc.h>
#include <s6/ftrigr.h>

int ftrigr_check (ftrigr_t *a, uint16_t id, char *c)
{
  stralloc sa = STRALLOC_ZERO ;
  int r = ftrigr_checksa(a, id, &sa) ;

  if (r && sa.len)
  {
    int e = errno ;
    *c = sa.s[sa.len - 1] ;
    stralloc_free(&sa) ;
    errno = e ;
  }
  return r ;
}