summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-05-05 12:50:24 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-05-05 12:50:24 +0000
commit7d06701bfaad445e48832ba4fd189ffc36e34387 (patch)
treec3d0d5da0d9328d950a4da4cc3a4f9d84a3e7033 /src/include
parent73ebb5709dc2a5aaee1e676a3c1b0bb7cebcd392 (diff)
downloadskalibs-7d06701bfaad445e48832ba4fd189ffc36e34387.tar.xz
- add stat_at
- make case_diff* work as a function is more cases - make sig_number case-insensitive - make child signal unblocking work in child_spawn*
Diffstat (limited to 'src/include')
-rw-r--r--src/include/skalibs/bytestr.h15
-rw-r--r--src/include/skalibs/unix-transactional.h5
2 files changed, 14 insertions, 6 deletions
diff --git a/src/include/skalibs/bytestr.h b/src/include/skalibs/bytestr.h
index ff2851c..fd602e0 100644
--- a/src/include/skalibs/bytestr.h
+++ b/src/include/skalibs/bytestr.h
@@ -13,16 +13,19 @@
#include <sys/types.h>
#include <string.h>
+#include <strings.h>
#define byte_copy(to, n, from) memmove(to, (from), n)
#define byte_copyr(to, n, from) memmove(to, (from), n)
#define byte_diff(a, n, b) memcmp(a, (b), n)
#define byte_zero(p, n) memset(p, 0, n)
-#define str_len(s) strlen(s)
-#define str_nlen(s, max) strnlen(s, max)
-#define str_diff(a, b) strcmp(a, b)
-#define str_diffn(a, b, n) strncmp(a, b, n)
+#define str_len strlen
+#define str_nlen strnlen
+#define str_diff strcmp
+#define str_diffn strncmp
#define str_copy(to, from) strlen(strcpy(to, from))
+#define case_diffs strcasecmp
+#define case_diffb(a, n, b) strncasecmp(a, (b), n)
#else
@@ -35,6 +38,8 @@ extern unsigned int str_len (char const *) gccattr_pure ;
extern int str_diff (char const *, char const *) gccattr_pure ;
extern int str_diffn (char const *, char const *, unsigned int) gccattr_pure ;
extern unsigned int str_copy (char *, char const *) ;
+extern int case_diffs (char const *, char const *) gccattr_pure ;
+extern int case_diffb (char const *, unsigned int, char const *) gccattr_pure ;
#endif
@@ -58,8 +63,6 @@ extern void case_uppers (char *) ;
extern void case_upperb (char *, unsigned int) ;
#define case_equals(a, b) (!case_diffs(a, b))
#define case_equalb(a, n, b) (!case_diffb(a, n, b))
-extern int case_diffs (char const *, char const *) gccattr_pure ;
-extern int case_diffb (char const *, unsigned int, char const *) gccattr_pure ;
#define case_starts(s, t) case_startb(s, str_len(s), t)
extern int case_startb (char const *, unsigned int, char const *) gccattr_pure ;
extern unsigned int case_str (char const *, char const *) gccattr_pure ;
diff --git a/src/include/skalibs/unix-transactional.h b/src/include/skalibs/unix-transactional.h
index b811c99..13129f1 100644
--- a/src/include/skalibs/unix-transactional.h
+++ b/src/include/skalibs/unix-transactional.h
@@ -3,6 +3,8 @@
#ifndef UNIX_TRANSACTIONAL_H
#define UNIX_TRANSACTIONAL_H
+#include <sys/types.h>
+#include <sys/stat.h>
#include <skalibs/uint64.h>
#include <skalibs/stralloc.h>
@@ -22,6 +24,9 @@ extern int open_truncatb (int, char const *) ;
extern int open_appendat (int, char const *) ;
extern int open_appendatb (int, char const *) ;
+extern int stat_at (int, char const *, struct stat *) ;
+extern int lstat_at (int, char const *, struct stat *) ;
+
extern unsigned int openreadnclose_at (int, char const *, char *, unsigned int) ;
extern int openslurpclose_at (int, char const *, stralloc *) ;
extern int opengetlnclose_at (int, char const *, stralloc *, int) ;