blob: f037d8cd56ba71a648527b95045f1eb8c8333c1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/* ISC license. */
#include <string.h>
#include <strings.h>
#include <skalibs/types.h>
#include <skalibs/sig.h>
static size_t sig_scan_norec (char const *s, int *sig)
{
int r = sig_number(s) ;
if (r)
{
*sig = r ;
return strlen(s) ;
}
{
unsigned int u ;
size_t len = uint_scan(s, &u) ;
if (len) *sig = u ;
return len ;
}
}
size_t sig_scan (char const *s, int *sig)
{
size_t len = sig_scan_norec(s, sig) ;
if (len) return len ;
if (!strncasecmp(s, "SIG", 3))
{
len = sig_scan_norec(s+3, sig) ;
if (len) return 3+len ;
}
return 0 ;
}
|