summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2018-03-21 16:41:24 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2018-03-21 16:41:24 +0000
commitbb7dca2f06a27da61587127320dfd73155c93700 (patch)
tree04eddadaf4e64361c1d5cffc5e8b1a04b5aac0d1 /src
parent66ce7fde43f8e8306aecda5f8e52d9aef88e7765 (diff)
downloadskalibs-bb7dca2f06a27da61587127320dfd73155c93700.tar.xz
Remove sig_scan, bleh
Diffstat (limited to 'src')
-rw-r--r--src/include/skalibs/sig.h1
-rw-r--r--src/libstddjb/sig0_scan.c33
-rw-r--r--src/libstddjb/sig_scan.c34
3 files changed, 27 insertions, 41 deletions
diff --git a/src/include/skalibs/sig.h b/src/include/skalibs/sig.h
index 236257b..eb33ed4 100644
--- a/src/include/skalibs/sig.h
+++ b/src/include/skalibs/sig.h
@@ -46,7 +46,6 @@ extern void sig_unshield (void) ;
extern char const *sig_name (int) ;
extern int sig_number (char const *) ;
-extern size_t sig_scan (char const *, int *) ;
extern size_t sig0_scan (char const *, int *) ;
#endif
diff --git a/src/libstddjb/sig0_scan.c b/src/libstddjb/sig0_scan.c
index 7714bfc..d6b2b90 100644
--- a/src/libstddjb/sig0_scan.c
+++ b/src/libstddjb/sig0_scan.c
@@ -1,13 +1,34 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
+#include <strings.h>
+#include <skalibs/types.h>
#include <skalibs/sig.h>
+static size_t sig0_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 = uint0_scan(s, &u) ;
+ if (len) *sig = u ;
+ return len ;
+ }
+}
+
size_t sig0_scan (char const *s, int *sig)
{
- int t ;
- size_t len = sig_scan(s, &t) ;
- if (!len || s[len]) return 0 ;
- *sig = t ;
- return len ;
+ size_t len = sig0_scan_norec(s, sig) ;
+ if (len) return len ;
+ if (!strncasecmp(s, "SIG", 3))
+ {
+ len = sig0_scan_norec(s+3, sig) ;
+ if (len) return 3+len ;
+ }
+ return 0 ;
}
diff --git a/src/libstddjb/sig_scan.c b/src/libstddjb/sig_scan.c
deleted file mode 100644
index f037d8c..0000000
--- a/src/libstddjb/sig_scan.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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 ;
-}