commit bb7dca2f06a27da61587127320dfd73155c93700
parent 66ce7fde43f8e8306aecda5f8e52d9aef88e7765
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Wed, 21 Mar 2018 16:41:24 +0000
Remove sig_scan, bleh
Diffstat:
6 files changed, 30 insertions(+), 46 deletions(-)
diff --git a/NEWS b/NEWS
@@ -4,8 +4,7 @@ In 2.6.4.0
----------
- Bugfixes.
- - New functions: execvep_loose(), byte_zzero(), openb_read(),
-sig_scan(), sig0_scan()
+ - New functions: execvep_loose(), byte_zzero(), openb_read(), sig0_scan()
- New function family: skalibs/genqdyn.h
diff --git a/doc/upgrade.html b/doc/upgrade.html
@@ -21,7 +21,7 @@
<ul>
<li> New functions: <a href="libstddjb/djbunix.html">execvep_loose()</a>,
<tt>byte_zzero()</tt>, <a href="libstddjb/djbunix.html">openb_read()</a>,
-<tt>sig_scan()</tt>, <tt>sig0_scan</tt> </li>
+<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
@@ -480,7 +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/sig0_scan.o src/libstddjb/sig0_scan.lo: src/libstddjb/sig0_scan.c src/include/skalibs/sig.h src/include/skalibs/types.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
@@ -490,7 +490,6 @@ 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
@@ -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
@@ -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
@@ -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 ;
-}