summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--doc/upgrade.html3
-rw-r--r--package/deps.mak3
-rw-r--r--src/include/skalibs/sig.h3
-rw-r--r--src/libstddjb/sig0_scan.c13
-rw-r--r--src/libstddjb/sig_scan.c34
6 files changed, 57 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 7d12046..89bc01d 100644
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,8 @@ In 2.6.4.0
----------
- Bugfixes.
- - New functions: execvep_loose(), byte_zzero(), openb_read()
+ - New functions: execvep_loose(), byte_zzero(), openb_read(),
+sig_scan(), sig0_scan()
- New function family: skalibs/genqdyn.h
diff --git a/doc/upgrade.html b/doc/upgrade.html
index f14f557..6a24aa9 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -20,7 +20,8 @@
<ul>
<li> New functions: <a href="libstddjb/djbunix.html">execvep_loose()</a>,
-<tt>byte_zzero()</tt> </li>
+<tt>byte_zzero()</tt>, <a href="libstddjb/djbunix.html">openb_read()</a>,
+<tt>sig_scan()</tt>, <tt>sig0_scan</tt> </li>
<li> New family of functions: <a href="libdatastruct/genqdyn.html">skalibs/genqdyn.h</a> </li>
</ul>
diff --git a/package/deps.mak b/package/deps.mak
index 7c8e154..34081ff 100644
--- a/package/deps.mak
+++ b/package/deps.mak
@@ -124,6 +124,7 @@ src/libdatastruct/genqdyn_free.o src/libdatastruct/genqdyn_free.lo: src/libdatas
src/libdatastruct/genqdyn_init.o src/libdatastruct/genqdyn_init.lo: src/libdatastruct/genqdyn_init.c src/include/skalibs/genqdyn.h src/include/skalibs/stralloc.h
src/libdatastruct/genqdyn_pop.o src/libdatastruct/genqdyn_pop.lo: src/libdatastruct/genqdyn_pop.c src/libdatastruct/genqdyn-internal.h src/include/skalibs/genqdyn.h
src/libdatastruct/genqdyn_push.o src/libdatastruct/genqdyn_push.lo: src/libdatastruct/genqdyn_push.c src/include/skalibs/genqdyn.h src/include/skalibs/stralloc.h
+src/libdatastruct/genqdyn_unpush.o src/libdatastruct/genqdyn_unpush.lo: src/libdatastruct/genqdyn_unpush.c src/include/skalibs/genqdyn.h src/include/skalibs/stralloc.h
src/libdatastruct/genqdyn_zero.o src/libdatastruct/genqdyn_zero.lo: src/libdatastruct/genqdyn_zero.c src/include/skalibs/genqdyn.h
src/libdatastruct/genset.o src/libdatastruct/genset.lo: src/libdatastruct/genset.c src/include/skalibs/genset.h
src/libdatastruct/genset_iter_nocancel.o src/libdatastruct/genset_iter_nocancel.lo: src/libdatastruct/genset_iter_nocancel.c src/include/skalibs/bitarray.h src/include/skalibs/genset.h
@@ -479,6 +480,7 @@ src/libstddjb/selfpipe_trap.o src/libstddjb/selfpipe_trap.lo: src/libstddjb/self
src/libstddjb/selfpipe_trapset.o src/libstddjb/selfpipe_trapset.lo: src/libstddjb/selfpipe_trapset.c src/include/skalibs/nonposix.h src/include/skalibs/nsig.h src/libstddjb/selfpipe-internal.h src/include/skalibs/selfpipe.h src/include/skalibs/sig.h src/include/skalibs/sysdeps.h
src/libstddjb/selfpipe_untrap.o src/libstddjb/selfpipe_untrap.lo: src/libstddjb/selfpipe_untrap.c src/libstddjb/selfpipe-internal.h src/include/skalibs/selfpipe.h src/include/skalibs/sig.h src/include/skalibs/sysdeps.h
src/libstddjb/sgetopt.o src/libstddjb/sgetopt.lo: src/libstddjb/sgetopt.c src/include/skalibs/buffer.h src/include/skalibs/sgetopt.h
+src/libstddjb/sig0_scan.o src/libstddjb/sig0_scan.lo: src/libstddjb/sig0_scan.c src/include/skalibs/sig.h
src/libstddjb/sig_block.o src/libstddjb/sig_block.lo: src/libstddjb/sig_block.c src/include/skalibs/sig.h
src/libstddjb/sig_blocknone.o src/libstddjb/sig_blocknone.lo: src/libstddjb/sig_blocknone.c src/include/skalibs/sig.h
src/libstddjb/sig_blockset.o src/libstddjb/sig_blockset.lo: src/libstddjb/sig_blockset.c src/include/skalibs/sig.h
@@ -488,6 +490,7 @@ src/libstddjb/sig_number.o src/libstddjb/sig_number.lo: src/libstddjb/sig_number
src/libstddjb/sig_pause.o src/libstddjb/sig_pause.lo: src/libstddjb/sig_pause.c src/include/skalibs/sig.h
src/libstddjb/sig_push.o src/libstddjb/sig_push.lo: src/libstddjb/sig_push.c src/include/skalibs/sig.h
src/libstddjb/sig_restoreto.o src/libstddjb/sig_restoreto.lo: src/libstddjb/sig_restoreto.c src/include/skalibs/sig.h
+src/libstddjb/sig_scan.o src/libstddjb/sig_scan.lo: src/libstddjb/sig_scan.c src/include/skalibs/sig.h src/include/skalibs/types.h
src/libstddjb/sig_shield.o src/libstddjb/sig_shield.lo: src/libstddjb/sig_shield.c src/include/skalibs/sig.h
src/libstddjb/sig_stack.o src/libstddjb/sig_stack.lo: src/libstddjb/sig_stack.c src/include/skalibs/nonposix.h src/include/skalibs/nsig.h src/include/skalibs/sig.h
src/libstddjb/sig_table.o src/libstddjb/sig_table.lo: src/libstddjb/sig_table.c src/libstddjb/sig-internal.h
diff --git a/src/include/skalibs/sig.h b/src/include/skalibs/sig.h
index fa46b00..236257b 100644
--- a/src/include/skalibs/sig.h
+++ b/src/include/skalibs/sig.h
@@ -3,6 +3,7 @@
#ifndef SIG_H
#define SIG_H
+#include <sys/types.h>
#include <signal.h>
#include <skalibs/gccattributes.h>
@@ -45,5 +46,7 @@ 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
new file mode 100644
index 0000000..7714bfc
--- /dev/null
+++ b/src/libstddjb/sig0_scan.c
@@ -0,0 +1,13 @@
+/* ISC license. */
+
+#include <sys/types.h>
+#include <skalibs/sig.h>
+
+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 ;
+}
diff --git a/src/libstddjb/sig_scan.c b/src/libstddjb/sig_scan.c
new file mode 100644
index 0000000..f037d8c
--- /dev/null
+++ b/src/libstddjb/sig_scan.c
@@ -0,0 +1,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 ;
+}