From 58fbbbca5a1f6b94885ce47e46c28e1cd03583d7 Mon Sep 17 00:00:00 2001 From: axtloss Date: Sun, 14 Jul 2024 17:44:20 +0200 Subject: move to autotools --- src/Makefile.am | 4 ++++ src/extlib.c | 7 +++---- src/extlib.h | 4 +++- src/memset_s.c | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 src/Makefile.am (limited to 'src') 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 #include #include -#include #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_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; -- cgit v1.2.3