aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraxtloss <axtlos@getcryst.al>2024-07-14 17:44:20 +0200
committeraxtloss <axtlos@getcryst.al>2024-07-14 17:44:20 +0200
commit58fbbbca5a1f6b94885ce47e46c28e1cd03583d7 (patch)
treea9c53614295d8a6733f356679c0b633c5ce48e7c /src
parent1a4696492e3cd478080e438950a7664a68fefcd6 (diff)
downloadextlib-58fbbbca5a1f6b94885ce47e46c28e1cd03583d7.tar.gz
extlib-58fbbbca5a1f6b94885ce47e46c28e1cd03583d7.tar.bz2
move to autotools
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/extlib.c7
-rw-r--r--src/extlib.h4
-rw-r--r--src/memset_s.c2
4 files changed, 11 insertions, 6 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..f51de0c
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,4 @@
+lib_LTLIBRARIES = libextlib.la
+libextlib_la_SOURCES = constraint_handler.c extlib.c extstring.c memset_s.c
+libextlib_la_LDFLAGS = -version-info 1:0:0
+include_HEADERS = extlib.h
diff --git a/src/extlib.c b/src/extlib.c
index ce11709..4ee5744 100644
--- a/src/extlib.c
+++ b/src/extlib.c
@@ -27,7 +27,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <time.h>
#undef free
#undef malloc
@@ -67,13 +66,13 @@ fcopy (FILE *src, FILE *dst)
if (src == NULL || dst == NULL)
return -1;
- while ((n = fread (buffer, sizeof (char), sizeof (buffer), f1)) > 0)
+ while ((n = fread (buffer, sizeof (char), sizeof (buffer), src)) > 0)
{
- if (fwrite (buffer, sizeof (char), n, f2) != n) {
+ if (fwrite (buffer, sizeof (char), n, dst) != n) {
fprintf (stderr, "Failed to copy data");
return -1;
}
- fflush (f2);
+ fflush (dst);
copied += n;
}
return copied;
diff --git a/src/extlib.h b/src/extlib.h
index 5264195..80c79d0 100644
--- a/src/extlib.h
+++ b/src/extlib.h
@@ -19,7 +19,9 @@ void *malloc_secure (size_t len);
#endif
#if (__STDC_WANT_LIB_EXT1__ == 1)
+#ifndef RSIZE_MAX
#define RSIZE_MAX SIZE_MAX
+#endif
typedef int errno_t;
typedef size_t rsize_t;
@@ -60,5 +62,5 @@ char *strupr(char *s);
char *trim (char *s, int *rem_front, int *rem_back);
/// Match string s for old and replace it with string replace
-char *replace_str (char *s, char *old, char *replace);
+ char *replace_str (char *s, char *old, char *replace);
diff --git a/src/memset_s.c b/src/memset_s.c
index dbe26ca..039be20 100644
--- a/src/memset_s.c
+++ b/src/memset_s.c
@@ -6,10 +6,10 @@
#include "extlib.h"
#include <errno.h>
-
errno_t
memset_s(void *s, rsize_t smax, int c, rsize_t n)
{
+ puts ("memset");
volatile unsigned char *dest = (unsigned char *) s;
errno_t ret = EINVAL;
rsize_t limit = n < smax ? n : smax;