Hello, This prepares the upcoming libc bump and fixes which are need to complete 'make test'. This program doesn't seem to be maintained. If none is using this, I think deleting this is another way.
ok? comments? Index: Makefile =================================================================== RCS file: /cvs/ports/devel/sfio/Makefile,v retrieving revision 1.13 diff -u -p -r1.13 Makefile --- Makefile 11 Mar 2022 18:53:26 -0000 1.13 +++ Makefile 21 Jul 2023 08:38:46 -0000 @@ -2,7 +2,7 @@ COMMENT= Safe/Fast I/O Library VERSION= 2002 PKGNAME= sfio-${VERSION} -REVISION = 3 +REVISION = 4 DISTNAME= sfio_${VERSION}.src.unix_tar CATEGORIES= devel Index: patches/patch-src_lib_sfio_Sfio_t_runtest =================================================================== RCS file: /cvs/ports/devel/sfio/patches/patch-src_lib_sfio_Sfio_t_runtest,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 patch-src_lib_sfio_Sfio_t_runtest --- patches/patch-src_lib_sfio_Sfio_t_runtest 12 May 2003 07:25:32 -0000 1.1.1.1 +++ patches/patch-src_lib_sfio_Sfio_t_runtest 21 Jul 2023 08:38:46 -0000 @@ -1,6 +1,8 @@ ---- src/lib/sfio/Sfio_t/runtest.orig Sat Apr 26 06:25:02 2003 -+++ src/lib/sfio/Sfio_t/runtest Sat Apr 26 06:25:04 2003 -@@ -75,7 +75,7 @@ +Return 1 if test fail +Index: src/lib/sfio/Sfio_t/runtest +--- src/lib/sfio/Sfio_t/runtest.orig ++++ src/lib/sfio/Sfio_t/runtest +@@ -75,13 +75,13 @@ do if $CC -g $DEFS $HDRS $i $LIBS -o ./t then if ./t @@ -9,3 +11,10 @@ else status=Failed fi else status="Not compiled" + fi + echo " $status" + if test "$status" != "Passed" +- then if test "$exit_on_fail" = "1"; then exit; fi ++ then if test "$exit_on_fail" = "1"; then exit 1; fi + fi + done Index: patches/patch-src_lib_sfio_Sfio_t_sftest_h =================================================================== RCS file: patches/patch-src_lib_sfio_Sfio_t_sftest_h diff -N patches/patch-src_lib_sfio_Sfio_t_sftest_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_lib_sfio_Sfio_t_sftest_h 21 Jul 2023 08:38:46 -0000 @@ -0,0 +1,13 @@ +Index: src/lib/sfio/Sfio_t/sftest.h +--- src/lib/sfio/Sfio_t/sftest.h.orig ++++ src/lib/sfio/Sfio_t/sftest.h +@@ -1,5 +1,9 @@ + #include "../FEATURE/sfio" + ++#if _hdr_stdarg ++#include <stdarg.h> ++#endif ++ + #if _SFIO_H_ONLY + #include <sfio.h> + #else Index: patches/patch-src_lib_sfio_Sfio_t_terror_h =================================================================== RCS file: /cvs/ports/devel/sfio/patches/patch-src_lib_sfio_Sfio_t_terror_h,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 patch-src_lib_sfio_Sfio_t_terror_h --- patches/patch-src_lib_sfio_Sfio_t_terror_h 12 May 2003 07:25:32 -0000 1.1.1.1 +++ patches/patch-src_lib_sfio_Sfio_t_terror_h 21 Jul 2023 08:38:46 -0000 @@ -1,6 +1,7 @@ ---- src/lib/sfio/Sfio_t/terror.h.orig Sat Apr 26 06:28:15 2003 -+++ src/lib/sfio/Sfio_t/terror.h Sat Apr 26 06:29:29 2003 -@@ -119,7 +119,7 @@ +Index: src/lib/sfio/Sfio_t/terror.h +--- src/lib/sfio/Sfio_t/terror.h.orig ++++ src/lib/sfio/Sfio_t/terror.h +@@ -119,7 +119,7 @@ va_list args; s = buf; if(line >= 0) @@ -9,7 +10,7 @@ s += strlen(s); } vsprintf(s,form,args); -@@ -152,7 +152,7 @@ +@@ -152,7 +152,7 @@ va_dcl form = va_arg(args,char*); #endif @@ -18,7 +19,7 @@ tstputmesg(Tstline,failform,args); va_end(args); -@@ -229,7 +229,8 @@ +@@ -229,7 +229,8 @@ int n; if(!Tstfile[n][0]) { #ifdef DEBUG @@ -28,7 +29,7 @@ #else static int pid; static char* tmp; -@@ -238,7 +239,8 @@ +@@ -238,7 +239,8 @@ int n; tmp = "/tmp"; pid = (int)getpid() % 10000; } Index: patches/patch-src_lib_sfio_Sfio_t_twhole_c =================================================================== RCS file: patches/patch-src_lib_sfio_Sfio_t_twhole_c diff -N patches/patch-src_lib_sfio_Sfio_t_twhole_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_lib_sfio_Sfio_t_twhole_c 21 Jul 2023 08:38:46 -0000 @@ -0,0 +1,24 @@ +SF_WHOLE is to expect sfwrite() and sfputs write the data to the device +immediately. So Count == 100 or no buffering is expected. + +Index: src/lib/sfio/Sfio_t/twhole.c +--- src/lib/sfio/Sfio_t/twhole.c.orig ++++ src/lib/sfio/Sfio_t/twhole.c +@@ -42,7 +42,7 @@ MAIN() + if(sfwrite(f,s,52) != 52) + terror("sfwrite failed\n"); + sfclose(f); +- if(Count != 10) ++ if(Count != 100) + terror("Wrong number of writes1\n"); + + Count = 0; +@@ -58,7 +58,7 @@ MAIN() + if(sfputr(f,s,'\n') != 53) + terror("sfputr failed\n"); + sfclose(f); +- if(Count != 10) ++ if(Count != 100) + terror("Wrong number of writes2\n"); + + TSTEXIT(0); Index: patches/patch-src_lib_sfio_Stdio_b_no_stdio_h =================================================================== RCS file: patches/patch-src_lib_sfio_Stdio_b_no_stdio_h diff -N patches/patch-src_lib_sfio_Stdio_b_no_stdio_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_lib_sfio_Stdio_b_no_stdio_h 21 Jul 2023 08:38:46 -0000 @@ -0,0 +1,10 @@ +Index: src/lib/sfio/Stdio_b/no_stdio.h +--- src/lib/sfio/Stdio_b/no_stdio.h.orig ++++ src/lib/sfio/Stdio_b/no_stdio.h +@@ -65,4 +65,6 @@ + #define _FILEDEFED 1 /* stop SUNOS5.8 ... */ + #define __FILE_defined 1 /* stop Linux ... */ + ++#define _STDFILES_DECLARED 1 /* stop OpenBSD */ ++ + #endif/*_NO_STDIO_H*/ Index: patches/patch-src_lib_sfio_Stdio_b_stdstream_c =================================================================== RCS file: patches/patch-src_lib_sfio_Stdio_b_stdstream_c diff -N patches/patch-src_lib_sfio_Stdio_b_stdstream_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_lib_sfio_Stdio_b_stdstream_c 21 Jul 2023 08:38:46 -0000 @@ -0,0 +1,19 @@ +Index: src/lib/sfio/Stdio_b/stdstream.c +--- src/lib/sfio/Stdio_b/stdstream.c.orig ++++ src/lib/sfio/Stdio_b/stdstream.c +@@ -240,6 +240,7 @@ FILE* f; + if(sm && !ISSYNC(f)) + _sfstdsync(sf); + ++ SFMTXLOCK(sf); + if((sf->mode&SF_RDWR) != sf->mode) + { flags = sf->flags; sf->flags |= SF_SHARE|SF_PUBLIC; + n = _sfmode(sf,0,0); +@@ -247,6 +248,7 @@ FILE* f; + if(n < 0) + sfclrlock(sf); + } ++ SFMTXUNLOCK(sf); + + if(sm) + _stdclrerr(f); Index: patches/patch-src_lib_sfio_Stdio_t_runtest =================================================================== RCS file: patches/patch-src_lib_sfio_Stdio_t_runtest diff -N patches/patch-src_lib_sfio_Stdio_t_runtest --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_lib_sfio_Stdio_t_runtest 21 Jul 2023 08:38:46 -0000 @@ -0,0 +1,12 @@ +Return 1 if test fail +Index: src/lib/sfio/Stdio_t/runtest +--- src/lib/sfio/Stdio_t/runtest.orig ++++ src/lib/sfio/Stdio_t/runtest +@@ -114,6 +114,6 @@ do + fi + echo " $status" + if test "$status" != "Passed" +- then if test "$exit_on_fail" = "1"; then exit; fi ++ then if test "$exit_on_fail" = "1"; then exit 1; fi + fi + done Index: patches/patch-src_lib_sfio_sffilbuf_c =================================================================== RCS file: patches/patch-src_lib_sfio_sffilbuf_c diff -N patches/patch-src_lib_sfio_sffilbuf_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_lib_sfio_sffilbuf_c 21 Jul 2023 08:38:46 -0000 @@ -0,0 +1,14 @@ +f->data and f->next might be overwrap. + +Index: src/lib/sfio/sffilbuf.c +--- src/lib/sfio/sffilbuf.c.orig ++++ src/lib/sfio/sffilbuf.c +@@ -48,7 +48,7 @@ reg int n; /* see above */ + /* try shifting left to make room for new data */ + if(!(f->bits&SF_MMAP) && f->next > f->data && + n > (f->size - (f->endb-f->data)) ) +- { memcpy(f->data, f->next, r); ++ { memmove(f->data, f->next, r); + f->next = f->data; + f->endb = f->data + r; + } Index: patches/patch-src_lib_sfio_sfputr_c =================================================================== RCS file: patches/patch-src_lib_sfio_sfputr_c diff -N patches/patch-src_lib_sfio_sfputr_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_lib_sfio_sfputr_c 21 Jul 2023 08:38:46 -0000 @@ -0,0 +1,12 @@ +Index: src/lib/sfio/sfputr.c +--- src/lib/sfio/sfputr.c.orig ++++ src/lib/sfio/sfputr.c +@@ -28,7 +28,7 @@ reg int rc; /* record separator. */ + + if(p == 0 || (f->flags&SF_WHOLE) ) + { n = strlen(s); +- if(p >= (n + (rc < 0 ? 0 : 1)) ) ++ if( !(f->flags&SF_WHOLE) && p >= (n + (rc < 0 ? 0 : 1)) ) + { /* buffer can hold everything */ + if(n > 0) + { memcpy(ps, s, n);