summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2018-12-07 21:00:23 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2018-12-07 21:00:23 +0000
commit2f017fbdd689e025437783cc8d675a7d304b37c3 (patch)
tree57645420ed02a56ab4e6abfc3b1ff9847ee96c8e /src
parent1af5a42e566da1e615abae7868ae7a10260ce0b8 (diff)
downloadskalibs-2f017fbdd689e025437783cc8d675a7d304b37c3.tar.xz
Add mk?temp and autosurf
Diffstat (limited to 'src')
-rw-r--r--src/include/skalibs/functypes.h4
-rw-r--r--src/include/skalibs/posixplz.h10
-rw-r--r--src/include/skalibs/surf.h2
-rw-r--r--src/librandom/random-internal.h1
-rw-r--r--src/librandom/random_name.c4
5 files changed, 19 insertions, 2 deletions
diff --git a/src/include/skalibs/functypes.h b/src/include/skalibs/functypes.h
index 8308fda..9c77f22 100644
--- a/src/include/skalibs/functypes.h
+++ b/src/include/skalibs/functypes.h
@@ -4,6 +4,7 @@
#define FUNCTYPES_H
#include <stdint.h>
+#include <sys/stat.h>
#include <sys/uio.h>
typedef int uintcmpfunc_t (unsigned int, unsigned int, void *) ;
@@ -45,4 +46,7 @@ typedef alliofunc_t *alliofunc_t_ref ;
typedef size_t alliovfunc_t (int, struct iovec const *, unsigned int) ;
typedef alliovfunc_t *alliovfunc_t_ref ;
+typedef int createfunc_t (char const *, mode_t, void *) ;
+typedef createfunc_t *createfunc_t_ref ;
+
#endif
diff --git a/src/include/skalibs/posixplz.h b/src/include/skalibs/posixplz.h
index 97c1ef1..b54faa0 100644
--- a/src/include/skalibs/posixplz.h
+++ b/src/include/skalibs/posixplz.h
@@ -4,7 +4,10 @@
#define SKALIBS_POSIXPLZ_H
#include <sys/types.h>
+#include <sys/stat.h>
+
#include <skalibs/gccattributes.h>
+#include <skalibs/functypes.h>
/*
@@ -44,4 +47,11 @@ extern void unlink_void (char const *) ;
extern pid_t doublefork (void) ;
extern int touch (char const *) ;
+extern int mkfiletemp (char *, createfunc_t_ref, mode_t, void *) ;
+extern int mkptemp (char *) ;
+extern int mkltemp (char const *, char *) ;
+extern int mkLtemp (char const *, char *) ;
+extern int mkctemp (char *, mode_t, dev_t) ;
+extern int mkbtemp (char *, mode_t, dev_t) ;
+
#endif
diff --git a/src/include/skalibs/surf.h b/src/include/skalibs/surf.h
index 99408ca..15e9215 100644
--- a/src/include/skalibs/surf.h
+++ b/src/include/skalibs/surf.h
@@ -19,5 +19,7 @@ struct SURFSchedule
extern void surf_init (SURFSchedule *, char const *) ; /* 160 chars */
extern void surf (SURFSchedule *, char *, size_t) ;
+extern void autosurf (char *, size_t) ;
+extern void autosurf_name (char *, size_t) ;
#endif
diff --git a/src/librandom/random-internal.h b/src/librandom/random-internal.h
index c915170..a8f8be9 100644
--- a/src/librandom/random-internal.h
+++ b/src/librandom/random-internal.h
@@ -5,6 +5,7 @@
#include <skalibs/surf.h>
+extern char const *random_oklist ;
extern int random_fd ;
extern SURFSchedule surf_here ;
diff --git a/src/librandom/random_name.c b/src/librandom/random_name.c
index bba1331..057a5db 100644
--- a/src/librandom/random_name.c
+++ b/src/librandom/random_name.c
@@ -1,10 +1,10 @@
/* ISC license. */
#include <skalibs/random.h>
+#include "random-internal.h"
void random_name (char *s, size_t n)
{
- static char const oklist[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZghijklmnopqrstuvwxyz-_0123456789abcdef" ;
random_string(s, n) ;
- while (n--) s[n] = oklist[s[n] & 63] ;
+ while (n--) s[n] = random_oklist[s[n] & 63] ;
}