aboutsummaryrefslogtreecommitdiff
path: root/lang/siod/files
diff options
context:
space:
mode:
authorMikhail Teterin <mi@FreeBSD.org>2021-02-17 03:00:00 +0000
committerMikhail Teterin <mi@FreeBSD.org>2021-02-17 03:00:00 +0000
commit91ea805744d8e128a60aa855445c1eb12c2ab1f4 (patch)
treef92294ee05f08b76963da98aef9ed4572c0cba7a /lang/siod/files
parent4f55fd65f06f110a5edaddf2c3e50d1c2cd8d2cd (diff)
downloadports-91ea805744d8e128a60aa855445c1eb12c2ab1f4.tar.gz
ports-91ea805744d8e128a60aa855445c1eb12c2ab1f4.zip
Upgrade from circa 2000 to circa 2014 code. Unfortunately, upstream
are somewhat sloppy about releases -- and do not publish versioned files. I'm calling this one 3.6.2, because that's the last version found in the change log. The new build uses bsd.lib.mk and bsd.prog.mk -- in order to: a) build shared libraries cleanly; b) stand a chance of working on the hardware platforms, where the author never tried it. The large patches provide for warning-free compiles with WARNS=7 -- tested on FreeBSD-11/amd64. We now take care to link with libgnuregex.so -- whether from base or provided by devel/libgnuregex instead of using the bundled (ancient) version of Henry Spencer's library. Similarly, the port links with the base -lmd instead of compiling its own MD5-implementation. Additional new feature is options, which currently include: . Socket support -- this used to be built unconditionally and is still on by default. However, someone concerned about the "network daemon" security warning may want to to turn this off. . Regex module -- also on by default. But, because it may, depending on the OS version, drag in a dependency, it can be turned off. . NDBM -- a never-before built (not on FreeBSD) module allowing work with NDBM databases. On by default now, because it has no dependencies. . GD -- the graphics library. Never built before by this port, it remains off by default because it depends on graphics/gd (or ukrainian/gd). . SQL_SYBASE -- for interactions with Sybase (and MS-SQL) database servers. Depends on databases/freetds and therefor off by default. There is also sql_oracle module, which is not enabled (for now), because databases/oracle8-client is, unfortunately, i386-only. The peculiarity of installing siod.html into ${PREFIX}/lib/siod remains for now -- suggestions welcome. Sponsored by: United Marsupials
Notes
Notes: svn path=/head/; revision=565477
Diffstat (limited to 'lang/siod/files')
-rw-r--r--lang/siod/files/BSDmakefile16
-rw-r--r--lang/siod/files/BSDmakefile.lib16
-rw-r--r--lang/siod/files/BSDmakefile.module21
-rw-r--r--lang/siod/files/BSDmakefile.prog14
-rw-r--r--lang/siod/files/patch-gd391
-rw-r--r--lang/siod/files/patch-lib2728
-rw-r--r--lang/siod/files/patch-makefile79
-rw-r--r--lang/siod/files/patch-ndbm173
-rw-r--r--lang/siod/files/patch-parser_pratt48
-rw-r--r--lang/siod/files/patch-regex85
-rw-r--r--lang/siod/files/patch-regex.c21
-rw-r--r--lang/siod/files/patch-sample.c70
-rw-r--r--lang/siod/files/patch-siod.c9
-rw-r--r--lang/siod/files/patch-slibu.c101
-rw-r--r--lang/siod/files/patch-sql_sybase273
-rw-r--r--lang/siod/files/patch-ss332
-rw-r--r--lang/siod/files/patch-tar61
17 files changed, 4237 insertions, 201 deletions
diff --git a/lang/siod/files/BSDmakefile b/lang/siod/files/BSDmakefile
new file mode 100644
index 000000000000..97ec7a44d1ca
--- /dev/null
+++ b/lang/siod/files/BSDmakefile
@@ -0,0 +1,16 @@
+SUBDIR= lib ${MODULES} siod sample
+
+beforeinstall:
+ ${MKDIR} ${STAGEDIR}${PREFIX}/lib/siod
+
+afterinstall:
+ # Install man-pages
+ set -x; for m in *.man; do \
+ ${INSTALL_MAN} $$m ${STAGEDIR}${MAN1PREFIX}/man/man1/$${m%%.man}.1; \
+ done
+ ${INSTALL_SCRIPT} `${MAKE} -f makefile -V CMDFILES` \
+ ${STAGEDIR}${PREFIX}/bin/
+ ${INSTALL_DATA} `${MAKE} -f makefile -V LIBFILES` \
+ ${STAGEDIR}${PREFIX}/lib/siod
+
+.include <bsd.subdir.mk>
diff --git a/lang/siod/files/BSDmakefile.lib b/lang/siod/files/BSDmakefile.lib
new file mode 100644
index 000000000000..a97cf58200fa
--- /dev/null
+++ b/lang/siod/files/BSDmakefile.lib
@@ -0,0 +1,16 @@
+LIB= siod
+MK_PROFILE= no
+SHLIB_MAJOR= 3
+SHLIB_MINOR= 6
+
+WARNS= 7
+
+SRCS= slib.c sliba.c trace.c slibu.c
+INCS= siod.h
+CFLAGS+=-DHAVE_SYS_PARAM_H
+LDADD= -lmd -lm -lcrypt
+
+LIBDIR= ${PREFIX}/lib
+INCSDIR=${PREFIX}/include
+
+.include <bsd.lib.mk>
diff --git a/lang/siod/files/BSDmakefile.module b/lang/siod/files/BSDmakefile.module
new file mode 100644
index 000000000000..faeedc9f1b02
--- /dev/null
+++ b/lang/siod/files/BSDmakefile.module
@@ -0,0 +1,21 @@
+SHLIB_NAME= %%MODULE%%.so
+MK_PROFILE= no
+
+WARNS= 7
+
+# Some modules have dependencies installed by other ports:
+gd_CFLAGS= -isystem ${LOCALBASE}/include
+gd_LDADD= -L${LOCALBASE}/lib -lgd
+regex_CFLAGS= -isystem ${LOCALBASE}/include
+regex_LDADD= -L${LOCALBASE}/lib -lgnuregex
+sql_sybase_CFLAGS=-isystem ${LOCALBASE}/include
+sql_sybase_LDADD=-L${LOCALBASE}/lib -lct
+
+CFLAGS+= -DHAVE_SYS_PARAM_H ${%%MODULE%%_CFLAGS}
+LDADD= ${%%MODULE%%_LDADD}
+
+SRCS= %%MODULE%%.c
+
+LIBDIR= ${PREFIX}/lib/siod
+
+.include <bsd.lib.mk>
diff --git a/lang/siod/files/BSDmakefile.prog b/lang/siod/files/BSDmakefile.prog
new file mode 100644
index 000000000000..9550bce3b453
--- /dev/null
+++ b/lang/siod/files/BSDmakefile.prog
@@ -0,0 +1,14 @@
+PROG= %%PROG%%
+
+WARNS= 7
+
+BINDIR= ${PREFIX}/bin
+MANDIR= ${PREFIX}/man/man
+LDADD= -L${.CURDIR:H}/lib -lsiod
+MK_MAN= no
+
+.if "%%PROG%%" == "sample"
+INTERNALPROG= yes # We want it built -- as proof -- but not installed
+.endif
+
+.include <bsd.prog.mk>
diff --git a/lang/siod/files/patch-gd b/lang/siod/files/patch-gd
new file mode 100644
index 000000000000..51f41a3ea602
--- /dev/null
+++ b/lang/siod/files/patch-gd
@@ -0,0 +1,391 @@
+--- gd.c 2014-03-25 04:10:42.000000000 -0400
++++ gd.c 2021-02-16 11:58:57.946320000 -0500
+@@ -9,5 +9,11 @@
+ #include <stdlib.h>
+ #include <string.h>
+-#include "gd.h"
++#include <gd.h>
++#include <gdfontg.h>
++#include <gdfontl.h>
++#include <gdfontmb.h>
++#include <gdfonts.h>
++#include <gdfontt.h>
++
+ #include "siod.h"
+
+@@ -17,15 +23,9 @@
+ NIL);}
+
+-long tc_gdimage = 0;
+-long tc_gdfont = 0;
+-long tc_gdpoint = 0;
+-
+-extern gdFontPtr gdFontGiant;
+-extern gdFontPtr gdFontLarge;
+-extern gdFontPtr gdFontMediumBold;
+-extern gdFontPtr gdFontSmall;
+-extern gdFontPtr gdFontTiny;
++static long tc_gdimage = 0;
++static long tc_gdfont = 0;
++static long tc_gdpoint = 0;
+
+-LISP lgdImageCreate(LISP sx,LISP sy)
++static LISP lgdImageCreate(LISP sx,LISP sy)
+ {LISP result;
+ long iflag;
+@@ -38,5 +38,5 @@
+ return(result);}
+
+-LISP lgdImageCreateFromGif(LISP f)
++static LISP lgdImageCreateFromGif(LISP f)
+ {LISP result;
+ long iflag;
+@@ -49,5 +49,5 @@
+ return(result);}
+
+-LISP lgdImageCreateFromXbm(LISP f)
++static LISP lgdImageCreateFromXbm(LISP f)
+ {LISP result;
+ long iflag;
+@@ -61,13 +61,13 @@
+
+
+-gdImagePtr get_gdImagePtr(LISP ptr)
++static gdImagePtr get_gdImagePtr(LISP ptr)
+ {gdImagePtr im;
+ if (NTYPEP(ptr,tc_gdimage))
+ err("not a gdImage",ptr);
+- if (!(im = (gdImagePtr) ptr->storage_as.string.data))
++ if (!(im = (gdImagePtr)(void *)ptr->storage_as.string.data))
+ err("gd Image deallocated",ptr);
+ return(im);}
+
+-LISP lcgdFontCreate(gdFontPtr font)
++static LISP lcgdFontCreate(gdFontPtr font)
+ {LISP result;
+ long iflag;
+@@ -80,13 +80,13 @@
+ return(result);}
+
+-gdFontPtr get_gdFontPtr(LISP ptr)
++static gdFontPtr get_gdFontPtr(LISP ptr)
+ {gdFontPtr fn;
+ if (NTYPEP(ptr,tc_gdfont))
+ err("not a gdFont",ptr);
+- if (!(fn = (gdFontPtr) ptr->storage_as.string.data))
++ if (!(fn = (gdFontPtr)(void *)ptr->storage_as.string.data))
+ err("gd Font deallocated",ptr);
+ return(fn);}
+
+-LISP lgdPoint(LISP args)
++static LISP lgdPoint(LISP args)
+ {LISP result,l;
+ long iflag,j,m,n = nlength(args);
+@@ -98,5 +98,5 @@
+ result->type = tc_gdpoint;
+ iflag = no_interrupt(1);
+- pt = (gdPointPtr) must_malloc(sizeof(gdPoint) * m);
++ pt = must_malloc(sizeof(gdPoint) * m);
+ result->storage_as.string.data = (char *) pt;
+ result->storage_as.string.dim = m;
+@@ -107,14 +107,14 @@
+ return(result);}
+
+-gdPointPtr get_gdPointPtr(LISP ptr,long *n)
++static gdPointPtr get_gdPointPtr(LISP ptr,long *n)
+ {gdPointPtr pt;
+ if (NTYPEP(ptr,tc_gdpoint))
+ err("not a gdPoint",ptr);
+- if (!(pt = (gdPointPtr) ptr->storage_as.string.data))
++ if (!(pt = (gdPointPtr)(void *)ptr->storage_as.string.data))
+ err("gd point deallocated",ptr);
+ *n = ptr->storage_as.string.dim;
+ return(pt);}
+
+-LISP lgdPointx(LISP ptr,LISP j,LISP value)
++static LISP lgdPointx(LISP ptr,LISP j,LISP value)
+ {long n,i;
+ gdPointPtr pt;
+@@ -129,5 +129,5 @@
+
+
+-LISP lgdPointy(LISP ptr,LISP j,LISP value)
++static LISP lgdPointy(LISP ptr,LISP j,LISP value)
+ {long n,i;
+ gdPointPtr pt;
+@@ -141,5 +141,5 @@
+ return(value);}
+
+-LISP lgdImageGif(LISP im,LISP f)
++static LISP lgdImageGif(LISP im,LISP f)
+ {long iflag;
+ iflag = no_interrupt(1);
+@@ -156,19 +156,22 @@
+ #include <unistd.h>
+
+-void gdImageGifmem(gdImagePtr im, char *buffer, size_t *len)
++static void gdImageGifmem(gdImagePtr im, char *buffer, size_t *len)
+ {FILE *f;
+ char tmpname[32];
+ struct stat sb;
+- strcpy(tmpname, "/tmp/gd.XXXXXX");
+- mktemp(tmpname);
+- if ((f = fopen(tmpname, "wb+")) != NULL) {
+- gdImageGif(im, f);
+- fstat(fileno(f), &sb);
+- if (sb.st_size < *len) *len = sb.st_size;
+- rewind(f);
+- fread(buffer, 1, *len, f);
++ int fd;
++ strcpy(tmpname, "/tmp/gd.XXXXXX.gif");
++ fd = mkstemps(tmpname, 4);
++ if (fd != -1 && (f = fdopen(fd, "wb+")) != NULL) {
++ gdImageGif(im, f); /* XXX no error-checking from here on */
++ if (fstat(fileno(f), &sb) == 0 && sb.st_size <= (off_t)*len) {
++ *len = sb.st_size;
++ rewind(f);
++ *len = fread(buffer, 1, *len, f);
++ } else
++ *len = 0;
+ fclose(f);
+ } else {
+- *len = 0;
++ *len = 0; /* XXX and no reporting for what little checking there is */
+ }
+ unlink(tmpname);
+@@ -177,10 +180,10 @@
+ #endif
+
+-LISP lgdImageGifmem(LISP im,LISP b)
+-{long iflag,dim;
++static LISP lgdImageGifmem(LISP im, LISP b)
++{long iflag;
+ size_t len;
+ char *buffer;
+- buffer = get_c_string_dim(b,&dim);
+- len = dim;
++ buffer = get_string_data(b);
++ len = b->storage_as.string.dim;
+ iflag = no_interrupt(1);
+ gdImageGifmem(get_gdImagePtr(im),buffer,&len);
+@@ -188,5 +191,5 @@
+ return(flocons(len));}
+
+-LISP lgdImageColorAllocate(LISP l)
++static LISP lgdImageColorAllocate(LISP l)
+ {long iflag;
+ int result;
+@@ -202,5 +205,5 @@
+ return(flocons(result));}
+
+-LISP lgdImageColorClosest(LISP l)
++static LISP lgdImageColorClosest(LISP l)
+ {long iflag;
+ int result;
+@@ -216,5 +219,5 @@
+ return(flocons(result));}
+
+-LISP lgdImageColorExact(LISP l)
++static LISP lgdImageColorExact(LISP l)
+ {long iflag;
+ int result;
+@@ -230,5 +233,5 @@
+ return(flocons(result));}
+
+-LISP lgdImageLine(LISP l)
++static LISP lgdImageLine(LISP l)
+ {gdImagePtr im;
+ int x1,y1,x2,y2,color;
+@@ -242,5 +245,5 @@
+ return(NIL);}
+
+-LISP lgdImageSetPixel(LISP l)
++static LISP lgdImageSetPixel(LISP l)
+ {gdImagePtr im;
+ int x,y,color;
+@@ -252,5 +255,5 @@
+ return(NIL);}
+
+-LISP lgdImagePolygon(LISP im,LISP points,LISP color)
++static LISP lgdImagePolygon(LISP im,LISP points,LISP color)
+ {gdPointPtr pt;
+ long n;
+@@ -262,5 +265,5 @@
+ return(NIL);}
+
+-LISP lgdImageFilledPolygon(LISP im,LISP points,LISP color)
++static LISP lgdImageFilledPolygon(LISP im,LISP points,LISP color)
+ {gdPointPtr pt;
+ long n;
+@@ -272,5 +275,5 @@
+ return(NIL);}
+
+-LISP lgdImageRectangle(LISP l)
++static LISP lgdImageRectangle(LISP l)
+ {gdImagePtr im;
+ int x1,y1,x2,y2,color;
+@@ -284,5 +287,5 @@
+ return(NIL);}
+
+-LISP lgdImageFilledRectangle(LISP l)
++static LISP lgdImageFilledRectangle(LISP l)
+ {gdImagePtr im;
+ int x1,y1,x2,y2,color;
+@@ -296,5 +299,5 @@
+ return(NIL);}
+
+-LISP lgdImageArc(LISP l)
++static LISP lgdImageArc(LISP l)
+ {gdImagePtr im;
+ int cx,cy,w,h,s,e,color;
+@@ -311,5 +314,5 @@
+
+
+-LISP lgdImageFillToBorder(LISP l)
++static LISP lgdImageFillToBorder(LISP l)
+ {gdImagePtr im;
+ int x,y,border,color;
+@@ -322,5 +325,5 @@
+ return(NIL);}
+
+-LISP lgdImageFill(LISP l)
++static LISP lgdImageFill(LISP l)
+ {gdImagePtr im;
+ int x,y,color;
+@@ -331,14 +334,6 @@
+ gdImageFill(im,x,y,color);
+ return(NIL);}
+-
+-/*
+
+-void gdImageSetBrush(gdImagePtr im, gdImagePtr brush)
+-void gdImageSetTile(gdImagePtr im, gdImagePtr tile)
+-void gdImageSetStyle(gdImagePtr im, int *style, int styleLength)
+-
+-*/
+-
+-LISP lgdImageChar(LISP l)
++static LISP lgdImageChar(LISP l)
+ {gdImagePtr im;
+ gdFontPtr font;
+@@ -353,5 +348,5 @@
+ return(NIL);}
+
+-LISP lgdImageCharUp(LISP l)
++static LISP lgdImageCharUp(LISP l)
+ {gdImagePtr im;
+ gdFontPtr font;
+@@ -366,5 +361,5 @@
+ return(NIL);}
+
+-LISP lgdImageString(LISP l)
++static LISP lgdImageString(LISP l)
+ {gdImagePtr im;
+ gdFontPtr font;
+@@ -375,10 +370,10 @@
+ x = get_c_long(poparg(&l,NIL));
+ y = get_c_long(poparg(&l,NIL));
+- c = get_c_string(poparg(&l,NIL));
++ c = get_string_data(poparg(&l, NIL));
+ color = get_c_long(poparg(&l,NIL));
+ gdImageString(im,font,x,y,c,color);
+ return(NIL);}
+
+-LISP lgdImageStringUp(LISP l)
++static LISP lgdImageStringUp(LISP l)
+ {gdImagePtr im;
+ gdFontPtr font;
+@@ -389,21 +384,21 @@
+ x = get_c_long(poparg(&l,NIL));
+ y = get_c_long(poparg(&l,NIL));
+- c = get_c_string(poparg(&l,NIL));
++ c = get_string_data(poparg(&l, NIL));
+ color = get_c_long(poparg(&l,NIL));
+ gdImageStringUp(im,font,x,y,c,color);
+ return(NIL);}
+
+-LISP lgdImageColorTransparent(LISP im,LISP color)
++static LISP lgdImageColorTransparent(LISP im,LISP color)
+ {gdImageColorTransparent(get_gdImagePtr(im),get_c_long(color));
+ return(NIL);}
+
+-LISP lgdImageInterlace(LISP im,LISP interlace)
++static LISP lgdImageInterlace(LISP im,LISP interlace)
+ {gdImageInterlace(get_gdImagePtr(im),get_c_long(interlace));
+ return(NIL);}
+
+-void gdimage_prin1(LISP ptr,struct gen_printio *f)
++static void gdimage_prin1(LISP ptr,struct gen_printio *f)
+ {char buff[256];
+ gdImagePtr im;
+- if ((im = (gdImagePtr) ptr->storage_as.string.data))
++ if ((im = (gdImagePtr)(void *)ptr->storage_as.string.data))
+ sprintf(buff,"#<GDIMAGE %p %d by %d>",
+ im,im->sx,im->sy);
+@@ -412,14 +407,14 @@
+ gput_st(f,buff);}
+
+-void gdimage_gc_free(LISP ptr)
++static void gdimage_gc_free(LISP ptr)
+ {gdImagePtr im;
+- if ((im = (gdImagePtr) ptr->storage_as.string.data))
++ if ((im = (gdImagePtr)(void *)ptr->storage_as.string.data))
+ {gdImageDestroy(im);
+ ptr->storage_as.string.data = NULL;}}
+
+-void gdfont_prin1(LISP ptr,struct gen_printio *f)
++static void gdfont_prin1(LISP ptr,struct gen_printio *f)
+ {char buff[256];
+ gdFontPtr fnt;
+- if ((fnt = (gdFontPtr) ptr->storage_as.string.data))
++ if ((fnt = (gdFontPtr)(void *)ptr->storage_as.string.data))
+ sprintf(buff,"#<GDFONT %p %d by %d>",
+ fnt,fnt->w,fnt->h);
+@@ -428,7 +423,7 @@
+ gput_st(f,buff);}
+
+-void gdfont_gc_free(LISP ptr)
++static void gdfont_gc_free(LISP ptr)
+ {gdFontPtr fnt;
+- if ((fnt = (gdFontPtr) ptr->storage_as.string.data) &&
++ if ((fnt = (gdFontPtr)(void *)ptr->storage_as.string.data) &&
+ ptr->storage_as.string.dim)
+ /* there is no api in gd 1.2 for loading a file from a file.
+@@ -437,29 +432,31 @@
+ }
+
+-void gdpoint_prin1(LISP ptr,struct gen_printio *f)
++static void gdpoint_prin1(LISP ptr,struct gen_printio *f)
+ {char buff[256];
+ gdPointPtr pt;
+- pt = (gdPointPtr) ptr->storage_as.string.data;
++ pt = (gdPointPtr)(void *)ptr->storage_as.string.data;
+ sprintf(buff,"#<GDPOINT %p %ld>",
+ pt,ptr->storage_as.string.dim);
+ gput_st(f,buff);}
+
+-void gdpoint_gc_free(LISP ptr)
++static void gdpoint_gc_free(LISP ptr)
+ {gdPointPtr pt;
+- if ((pt = (gdPointPtr) ptr->storage_as.string.data))
++ if ((pt = (gdPointPtr)(void *)ptr->storage_as.string.data))
+ {free(pt);
+ ptr->storage_as.string.data = NULL;
+ ptr->storage_as.string.dim = 0;}}
+
+-LISP gdfont_w(LISP ptr)
++static LISP gdfont_w(LISP ptr)
+ {gdFontPtr font;
+ font = get_gdFontPtr(ptr);
+ return(flocons(font->w));}
+
+-LISP gdfont_h(LISP ptr)
++static LISP gdfont_h(LISP ptr)
+ {gdFontPtr font;
+ font = get_gdFontPtr(ptr);
+ return(flocons(font->h));}
+
++void init_gd(void); /* Module entry point - our sole exported function */
++
+ void init_gd(void)
+ {long j;
diff --git a/lang/siod/files/patch-lib b/lang/siod/files/patch-lib
new file mode 100644
index 000000000000..46b59623060d
--- /dev/null
+++ b/lang/siod/files/patch-lib
@@ -0,0 +1,2728 @@
+--- siod.h 2014-03-25 04:10:42.000000000 -0400
++++ siod.h 2021-02-15 20:59:39.714149000 -0500
+@@ -20,5 +20,5 @@
+ struct obj * cdr;} cons;
+ struct {double data;} flonum;
+- struct {char *pname;
++ struct {const char *pname;
+ struct obj * vcell;} symbol;
+ struct {char *name;
+@@ -41,5 +41,5 @@
+ struct {char *name;
+ struct obj * (*f)(struct obj **, struct obj **);} subrm;
+- struct {char *name;
++ struct {const char *name;
+ struct obj * (*f)(void *,...);} subr;
+ struct {struct obj *env;
+@@ -151,5 +151,5 @@
+ struct gen_printio
+ {int (*putc_fcn)(int,void *);
+- int (*puts_fcn)(char *,void *);
++ int (*puts_fcn)(const char *, void *);
+ void *cb_argument;};
+
+@@ -160,10 +160,10 @@
+
+ struct repl_hooks
+-{void (*repl_puts)(char *);
++{void (*repl_puts)(const char *);
+ LISP (*repl_read)(void);
+ LISP (*repl_eval)(LISP);
+ void (*repl_print)(LISP);};
+
+-void __stdcall process_cla(int argc,char **argv,int warnflag);
++void __stdcall process_cla(int argc, const char **argv, int warnflag);
+ void __stdcall print_welcome(void);
+ void __stdcall print_hs_1(void);
+@@ -172,6 +172,6 @@
+ LISP get_eof_val(void);
+ long repl_driver(long want_sigint,long want_init,struct repl_hooks *);
+-void set_stdout_hooks(void (*puts_f)(char *));
+-void set_repl_hooks(void (*puts_f)(char *),
++void set_stdout_hooks(void (*puts_f)(const char *));
++void set_repl_hooks(void (*puts_f)(const char *),
+ LISP (*read_f)(void),
+ LISP (*eval_f)(LISP),
+@@ -180,7 +180,8 @@
+ LISP err(const char *message, LISP x);
+ LISP errswitch(void);
+-char *get_c_string(LISP x);
+-char *get_c_string_dim(LISP x,long *);
+-char *try_get_c_string(LISP x);
++void *get_string_data(LISP x);
++const char *get_c_string(LISP x);
++const char *get_c_string_dim(LISP x, long *);
++const char *try_get_c_string(LISP x);
+ long get_c_long(LISP x);
+ double get_c_double(LISP x);
+@@ -204,30 +205,30 @@
+ LISP eq(LISP x,LISP y);
+ LISP eql(LISP x,LISP y);
+-LISP symcons(char *pname,LISP vcell);
++LISP symcons(const char *pname, LISP vcell);
+ LISP symbolp(LISP x);
+ LISP symbol_boundp(LISP x,LISP env);
+ LISP symbol_value(LISP x,LISP env);
+-LISP cintern(char *name);
+-LISP rintern(char *name);
+-LISP subrcons(long type, char *name, SUBR_FUNC f);
++LISP cintern(const char *name);
++LISP rintern(const char *name);
++LISP subrcons(long type, const char *name, SUBR_FUNC f);
+ LISP closure(LISP env,LISP code);
+ void gc_protect(LISP *location);
+ void gc_protect_n(LISP *location,long n);
+-void gc_protect_sym(LISP *location,char *st);
++void gc_protect_sym(LISP *location, const char *st);
+
+ void __stdcall init_storage(void);
+ void __stdcall init_slibu(void);
+
+-void init_subr(char *name, long type, SUBR_FUNC fcn);
+-void init_subr_0(char *name, LISP (*fcn)(void));
+-void init_subr_1(char *name, LISP (*fcn)(LISP));
+-void init_subr_2(char *name, LISP (*fcn)(LISP,LISP));
+-void init_subr_2n(char *name, LISP (*fcn)(LISP,LISP));
+-void init_subr_3(char *name, LISP (*fcn)(LISP,LISP,LISP));
+-void init_subr_4(char *name, LISP (*fcn)(LISP,LISP,LISP,LISP));
+-void init_subr_5(char *name, LISP (*fcn)(LISP,LISP,LISP,LISP,LISP));
+-void init_lsubr(char *name, LISP (*fcn)(LISP));
+-void init_fsubr(char *name, LISP (*fcn)(LISP,LISP));
+-void init_msubr(char *name, LISP (*fcn)(LISP *,LISP *));
++void init_subr(const char *name, long type, SUBR_FUNC fcn);
++void init_subr_0(const char *name, LISP (*fcn)(void));
++void init_subr_1(const char *name, LISP (*fcn)(LISP));
++void init_subr_2(const char *name, LISP (*fcn)(LISP, LISP));
++void init_subr_2n(const char *name, LISP (*fcn)(LISP, LISP));
++void init_subr_3(const char *name, LISP (*fcn)(LISP, LISP, LISP));
++void init_subr_4(const char *name, LISP (*fcn)(LISP, LISP, LISP, LISP));
++void init_subr_5(const char *name, LISP (*fcn)(LISP, LISP, LISP, LISP, LISP));
++void init_lsubr(const char *name, LISP (*fcn)(LISP));
++void init_fsubr(const char *name, LISP (*fcn)(LISP, LISP));
++void init_msubr(const char *name, LISP (*fcn)(LISP *, LISP *));
+
+ LISP assq(LISP x,LISP alist);
+@@ -256,5 +257,5 @@
+ LISP (*fcn2)(char *,long, int *));
+ LISP apropos(LISP);
+-LISP vload(char *fname,long cflag,long rflag);
++LISP vload(const char *fname, long cflag, long rflag);
+ LISP load(LISP fname,LISP cflag,LISP rflag);
+ LISP require(LISP fname);
+@@ -293,5 +294,6 @@
+ void __stdcall init_trace(void);
+ long __stdcall repl_c_string(char *,long want_sigint,long want_init,long want_print);
+-char * __stdcall siod_version(void);
++long __stdcall repl_c_string01(const char *, long want_sigint, long want_init, long want_print);
++const char * __stdcall siod_version(void);
+ LISP nreverse(LISP);
+ LISP number2string(LISP,LISP,LISP,LISP);
+@@ -316,8 +318,8 @@
+ LISP lapply(LISP fcn,LISP args);
+ LISP mallocl(void *lplace,long size);
+-void gput_st(struct gen_printio *,char *);
+-void put_st(char *st);
++void gput_st(struct gen_printio *, const char *);
++void put_st(const char *st);
+ LISP listn(long n, ...);
+-char *must_malloc(unsigned long size);
++void *must_malloc(unsigned long size);
+ LISP lstrbreakup(LISP str,LISP lmarker);
+ LISP lstrunbreakup(LISP elems,LISP lmarker);
+@@ -356,5 +358,5 @@
+
+
+-LISP symalist(char *item,...);
++LISP symalist(const char *item, ...);
+
+ LISP encode_st_mode(LISP l);
+@@ -363,5 +365,5 @@
+ int __stdcall siod_main(int argc,char **argv, char **env);
+ void __stdcall siod_shuffle_args(int *pargc,char ***pargv);
+-void __stdcall siod_init(int argc,char **argv);
++void __stdcall siod_init(int argc, const char **argv);
+
+ #if defined(WIN32) && defined(_WINDOWS_)
+--- siodp.h 2014-03-25 04:10:42.000000000 -0400
++++ siodp.h 2021-02-15 14:47:39.214446000 -0500
+@@ -18,5 +18,5 @@
+
+ extern long siod_verbose_level;
+-extern char *siod_lib;
++extern const char *siod_lib;
+ extern long nointerrupt;
+ extern long interrupt_differed;
+@@ -81,7 +81,7 @@
+
+ #define STACK_CHECK(_ptr) \
+- if (((char *) (_ptr)) < stack_limit_ptr) err_stack((char *) _ptr);
++ if (((char *) (_ptr)) < stack_limit_ptr) err_stack(_ptr);
+
+-void err_stack(char *);
++void err_stack(LISP *);
+
+ #if defined(VMS) && defined(VAX)
+@@ -95,9 +95,9 @@
+ void err_ctrl_c(void);
+ double myruntime(void);
+-void fput_st(FILE *f,char *st);
+-void put_st(char *st);
+-void grepl_puts(char *,void (*)(char *));
++void fput_st(FILE *f, const char *st);
++void put_st(const char *st);
++void grepl_puts(const char *, void (*)(const char *));
+ void gc_fatal_error(void);
+-LISP gen_intern(char *name,long copyp);
++LISP gen_intern(const char *name, long copyp);
+ void scan_registers(void);
+ void init_storage_1(void);
+@@ -136,5 +136,5 @@
+ LISP leval_quote(LISP args,LISP env);
+ LISP leval_tenv(LISP args,LISP env);
+-int flush_ws(struct gen_readio *f,char *eoferr);
++int flush_ws(struct gen_readio *f, const char *eoferr);
+ int f_getc(FILE *f);
+ void f_ungetc(int c, FILE *f);
+@@ -164,6 +164,6 @@
+ void file_gc_free(LISP ptr);
+ void file_prin1(LISP ptr,struct gen_printio *f);
+-LISP fopen_c(char *name,char *how);
+-LISP fopen_cg(FILE *(*)(const char *,const char *),char *,char *);
++LISP fopen_c(const char *name, const char *how);
++LISP fopen_cg(FILE *(*)(const char *, const char *), const char *, const char *);
+ LISP fopen_l(LISP name,LISP how);
+ LISP fclose_l(LISP p);
+--- slib.c 2014-03-25 04:40:18.000000000 -0400
++++ slib.c 2021-02-15 20:55:35.681648000 -0500
+@@ -77,8 +77,12 @@
+ #include <errno.h>
+
++#if defined(HAVE_SYS_PARAM_H)
++#include <sys/param.h>
++#endif
++
+ #include "siod.h"
+ #include "siodp.h"
+
+-#ifdef linux
++#if defined(linux) || defined(BSD)
+ #define sprintf_s snprintf
+ #endif
+@@ -90,57 +94,57 @@
+ NIL);}
+
+-char * __stdcall siod_version(void)
++const char * __stdcall siod_version(void)
+ {return("3.6.2 12-MAY-07");}
+
+-long nheaps = 2;
+-LISP *heaps;
++static long nheaps = 2;
++static LISP *heaps;
+ LISP heap,heap_end,heap_org;
+-long heap_size = 5000;
+-long old_heap_used;
+-long gc_status_flag = 1;
+-char *init_file = (char *) NULL;
++static long heap_size = 5000;
++static long old_heap_used;
++static long gc_status_flag = 1;
++static const char *init_file = NULL;
+ char *tkbuffer = NULL;
+-long gc_kind_copying = 0;
+-long gc_cells_allocated = 0;
+-double gc_time_taken;
+-LISP *stack_start_ptr = NULL;
+-LISP freelist;
+-jmp_buf errjmp;
++static long gc_kind_copying = 0;
++static long gc_cells_allocated = 0;
++static double gc_time_taken;
++static LISP *stack_start_ptr = NULL;
++static LISP freelist;
++static jmp_buf errjmp;
+ long errjmp_ok = 0;
+ long nointerrupt = 1;
+ long interrupt_differed = 0;
+-LISP oblistvar = NIL;
++static LISP oblistvar = NIL;
+ LISP sym_t = NIL;
+-LISP eof_val = NIL;
+-LISP sym_errobj = NIL;
+-LISP sym_catchall = NIL;
+-LISP sym_progn = NIL;
+-LISP sym_lambda = NIL;
+-LISP sym_quote = NIL;
+-LISP sym_dot = NIL;
+-LISP sym_after_gc = NIL;
+-LISP sym_eval_history_ptr = NIL;
++static LISP eof_val = NIL;
++static LISP sym_errobj = NIL;
++static LISP sym_catchall = NIL;
++static LISP sym_progn = NIL;
++static LISP sym_lambda = NIL;
++static LISP sym_quote = NIL;
++static LISP sym_dot = NIL;
++static LISP sym_after_gc = NIL;
++static LISP sym_eval_history_ptr = NIL;
+ LISP unbound_marker = NIL;
+-LISP *obarray;
+-long obarray_dim = 100;
++static LISP *obarray;
++static long obarray_dim = 100;
+ struct catch_frame *catch_framep = (struct catch_frame *) NULL;
+-void (*repl_puts)(char *) = NULL;
+-LISP (*repl_read)(void) = NULL;
+-LISP (*repl_eval)(LISP) = NULL;
+-void (*repl_print)(LISP) = NULL;
+-void (*stdout_puts)(char *) = NULL;
+-LISP *inums;
+-long inums_dim = 256;
+-struct user_type_hooks *user_types = NULL;
+-long user_tc_next = tc_user_min;
+-struct gc_protected *protected_registers = NULL;
+-jmp_buf save_regs_gc_mark;
+-double gc_rt;
+-long gc_cells_collected;
+-char *user_ch_readm = "";
+-char *user_te_readm = "";
+-LISP (*user_readm)(int, struct gen_readio *) = NULL;
+-LISP (*user_readt)(char *,long, int *) = NULL;
+-void (*fatal_exit_hook)(void) = NULL;
++static void (*repl_puts)(const char *) = NULL;
++static LISP (*repl_read)(void) = NULL;
++static LISP (*repl_eval)(LISP) = NULL;
++static void (*repl_print)(LISP) = NULL;
++static void (*stdout_puts)(const char *) = NULL;
++static LISP *inums;
++static long inums_dim = 256;
++static struct user_type_hooks *user_types = NULL;
++static long user_tc_next = tc_user_min;
++static struct gc_protected *protected_registers = NULL;
++static jmp_buf save_regs_gc_mark;
++static double gc_rt;
++static long gc_cells_collected;
++static const char *user_ch_readm = "";
++static const char *user_te_readm = "";
++static LISP (*user_readm)(int, struct gen_readio *) = NULL;
++static LISP (*user_readt)(char *, long, int *) = NULL;
++static void (*fatal_exit_hook)(void) = NULL;
+ #ifdef THINK_C
+ int ipoll_counter = 0;
+@@ -148,5 +152,5 @@
+
+ char *stack_limit_ptr = NULL;
+-long stack_size =
++static long stack_size =
+ #ifdef THINK_C
+ 10000;
+@@ -170,10 +174,10 @@
+ #endif
+
+-char *siod_lib = SIOD_LIB_DEFAULT;
++const char *siod_lib = SIOD_LIB_DEFAULT;
+
+-void __stdcall process_cla(int argc,char **argv,int warnflag)
++void __stdcall process_cla(int argc, const char **argv, int warnflag)
+ {int k;
+ char *ptr;
+- static siod_lib_set = 0;
++ static int siod_lib_set = 0;
+ char msgbuff[256];
+ #if !defined(vms)
+@@ -288,5 +292,5 @@
+ return(x);}
+
+-void handle_sigfpe(int sig SIG_restargs)
++void handle_sigfpe(int sig SIG_restargs __unused)
+ {
+ #ifdef WIN32
+@@ -296,5 +300,5 @@
+ err("floating point exception",NIL);}
+
+-void handle_sigint(int sig SIG_restargs)
++void handle_sigint(int sig SIG_restargs __unused)
+ {signal(SIGINT,handle_sigint);
+ #if defined(WIN32)
+@@ -364,12 +368,12 @@
+ return(rv);}
+
+-static void ignore_puts(char *st)
++static void ignore_puts(const char *st __unused)
+ {}
+
+-static void noprompt_puts(char *st)
++static void noprompt_puts(const char *st)
+ {if (strcmp(st,"> ") != 0)
+ put_st(st);}
+
+-static char *repl_c_string_arg = NULL;
++static const char *repl_c_string_arg = NULL;
+ static char *repl_c_string_out = NULL;
+ static long repl_c_string_flag = 0;
+@@ -386,5 +390,5 @@
+ return(read_from_string(s));}
+
+-static void ignore_print(LISP x)
++static void ignore_print(LISP x __unused)
+ {repl_c_string_flag = 1;}
+
+@@ -397,5 +401,5 @@
+ char *end;};
+
+-static int rcsp_puts(char *from,void *cb)
++static int rcsp_puts(const char *from, void *cb)
+ {long fromlen,intolen,cplen;
+ struct rcsp_puts *p = (struct rcsp_puts *) cb;
+@@ -421,16 +425,11 @@
+ repl_c_string_flag = 1;}
+
+-long __stdcall repl_c_string(char *str,
+- long want_sigint,long want_init,long want_print)
++long __stdcall repl_c_string01(const char *str,
++ long want_sigint, long want_init, long want_print)
+ {struct repl_hooks h;
+ long retval;
+ h.repl_read = repl_c_string_read;
+ h.repl_eval = NULL;
+- if (want_print > 1)
+- {h.repl_puts = ignore_puts;
+- h.repl_print = repl_c_string_print;
+- repl_c_string_print_len = want_print;
+- repl_c_string_out = str;}
+- else if (want_print)
++ if (want_print)
+ {h.repl_puts = noprompt_puts;
+ h.repl_print = not_ignore_print;
+@@ -452,4 +451,25 @@
+ return(2);}
+
++long __stdcall repl_c_string(char *str,
++ long want_sigint, long want_init, long want_print)
++{struct repl_hooks h;
++ long retval;
++ h.repl_read = repl_c_string_read;
++ h.repl_eval = NULL;
++
++ h.repl_puts = ignore_puts;
++ h.repl_print = repl_c_string_print;
++ repl_c_string_print_len = want_print;
++ repl_c_string_out = str;
++ repl_c_string_arg = str;
++ repl_c_string_flag = 0;
++ retval = repl_driver(want_sigint, want_init, &h);
++ if (retval != 0)
++ return(retval);
++ else if (repl_c_string_flag == 1)
++ return(0);
++ else
++ return(2);}
++
+ #ifdef unix
+ #include <sys/types.h>
+@@ -511,11 +531,11 @@
+ #endif
+
+-#if defined(SUN5) || defined(linux)
++#if defined(SUN5) || defined(linux) || defined(BSD)
+
+-#if defined(linux)
++#if defined(linux) || defined(BSD)
+ #include <sys/time.h>
+ #endif
+
+-double myrealtime(void)
++static double myrealtime(void)
+ {struct timeval x;
+ if (gettimeofday(&x,NULL))
+@@ -532,5 +552,5 @@
+ #endif
+
+-#if !defined(__osf__) & !defined(VMS) & !defined(SUN5) & !defined(WIN32) &!defined(linux)
++#if !defined(__osf__) & !defined(VMS) & !defined(SUN5) & !defined(WIN32) &!defined(linux) && !defined(BSD)
+ double myrealtime(void)
+ {time_t x;
+@@ -539,5 +559,5 @@
+ #endif
+
+-void set_repl_hooks(void (*puts_f)(char *),
++void set_repl_hooks(void (*puts_f)(const char *),
+ LISP (*read_f)(void),
+ LISP (*eval_f)(LISP),
+@@ -548,13 +568,13 @@
+ repl_print = print_f;}
+
+-void set_stdout_hooks(void (*puts_f)(char *))
++void set_stdout_hooks(void (*puts_f)(const char *))
+ {
+ stdout_puts = puts_f;
+ }
+
+-void gput_st(struct gen_printio *f,char *st)
++void gput_st(struct gen_printio *f, const char *st)
+ {PUTS_FCN(st,f);}
+
+-void fput_st(FILE *f,char *st)
++void fput_st(FILE *f, const char *st)
+ {long flag;
+ flag = no_interrupt(1);
+@@ -562,9 +582,9 @@
+ no_interrupt(flag);}
+
+-int fputs_fcn(char *st,void *cb)
++static int fputs_fcn(const char *st, void *cb)
+ {fput_st((FILE *)cb,st);
+ return(1);}
+
+-void put_st(char *st)
++void put_st(const char *st)
+ {
+ if (stdout_puts == NULL)
+@@ -574,10 +594,10 @@
+ }
+
+-void grepl_puts(char *st,void (*repl_puts)(char *))
+-{if (repl_puts == NULL)
++void grepl_puts(const char *st, void (*_repl_puts)(const char *))
++{if (_repl_puts == NULL)
+ {put_st(st);
+ fflush(stdout);}
+ else
+- (*repl_puts)(st);}
++ (_repl_puts)(st);}
+
+ long repl(struct repl_hooks *h)
+@@ -691,7 +711,7 @@
+ {return(err("BUG. Reached impossible case",NIL));}
+
+-void err_stack(char *ptr)
++void err_stack(LISP *l)
+ /* The user could be given an option to continue here */
+-{err("the currently assigned stack limit has been exceded",NIL);}
++{err("the currently assigned stack limit has been exceded", *l);}
+
+ LISP stack_limit(LISP amount,LISP silent)
+@@ -707,5 +727,5 @@
+ return(flocons(stack_size));}
+
+-char *try_get_c_string(LISP x)
++const char *try_get_c_string(LISP x)
+ {if TYPEP(x,tc_symbol)
+ return(PNAME(x));
+@@ -715,5 +735,13 @@
+ return(NULL);}
+
+-char *get_c_string(LISP x)
++void *get_string_data(LISP x)
++{switch (TYPE(x))
++ {case tc_string:
++ case tc_byte_array:
++ return(x->storage_as.string.data);}
++ err("Neither a string nor a byte array", x);
++ return(NULL);}
++
++const char *get_c_string(LISP x)
+ {if TYPEP(x,tc_symbol)
+ return(PNAME(x));
+@@ -724,5 +752,5 @@
+ return(NULL);}
+
+-char *get_c_string_dim(LISP x,long *len)
++const char *get_c_string_dim(LISP x, long *len)
+ {switch(TYPE(x))
+ {case tc_symbol:
+@@ -836,5 +864,5 @@
+ return(flocons(FLONM(x)/FLONM(y)));}}
+
+-LISP lllabs(LISP x)
++static LISP lllabs(LISP x)
+ {double v;
+ if NFLONUMP(x) err("wta to abs",x);
+@@ -845,5 +873,5 @@
+ return(x);}
+
+-LISP lsqrt(LISP x)
++static LISP lsqrt(LISP x)
+ {if NFLONUMP(x) err("wta to sqrt",x);
+ return(flocons(sqrt(FLONM(x))));}
+@@ -861,5 +889,5 @@
+ return(NIL);}
+
+-LISP greaterEp(LISP x,LISP y)
++static LISP greaterEp(LISP x, LISP y)
+ {if NFLONUMP(x) err("wta(1st) to greaterp",x);
+ if NFLONUMP(y) err("wta(2nd) to greaterp",y);
+@@ -867,5 +895,5 @@
+ return(NIL);}
+
+-LISP lessEp(LISP x,LISP y)
++static LISP lessEp(LISP x, LISP y)
+ {if NFLONUMP(x) err("wta(1st) to lessp",x);
+ if NFLONUMP(y) err("wta(2nd) to lessp",y);
+@@ -873,5 +901,5 @@
+ return(NIL);}
+
+-LISP lmax(LISP x,LISP y)
++static LISP lmax(LISP x, LISP y)
+ {if NULLP(y) return(x);
+ if NFLONUMP(x) err("wta(1st) to max",x);
+@@ -879,5 +907,5 @@
+ return((FLONM(x) > FLONM(y)) ? x : y);}
+
+-LISP lmin(LISP x,LISP y)
++static LISP lmin(LISP x, LISP y)
+ {if NULLP(y) return(x);
+ if NFLONUMP(x) err("wta(1st) to min",x);
+@@ -895,5 +923,5 @@
+ return(NIL);}
+
+-LISP symcons(char *pname,LISP vcell)
++LISP symcons(const char *pname, LISP vcell)
+ {LISP z;
+ NEWCELL(z,tc_symbol);
+@@ -905,5 +933,5 @@
+ {if SYMBOLP(x) return(sym_t); else return(NIL);}
+
+-LISP err_ubv(LISP v)
++static LISP err_ubv(LISP v)
+ {return(err("unbound variable",v));}
+
+@@ -926,13 +954,13 @@
+
+
+-char *must_malloc(unsigned long size)
+-{char *tmp;
+- tmp = (char *) malloc((size) ? size : 1);
+- if (tmp == (char *)NULL) err("failed to allocate storage from system",NIL);
++void *must_malloc(unsigned long size)
++{void *tmp;
++ tmp = malloc((size) ? size : 1);
++ if (tmp == NULL) err("failed to allocate storage from system", NIL);
+ return(tmp);}
+
+-LISP gen_intern(char *name,long copyp)
++LISP gen_intern(const char *name, long copyp)
+ {LISP l,sym,sl;
+- char *cname;
++ const char *cname;
+ long hash=0,n,c,flag;
+ flag = no_interrupt(1);
+@@ -950,6 +978,6 @@
+ return(CAR(l));}
+ if (copyp == 1)
+- {cname = (char *) must_malloc(strlen(name)+1);
+- strcpy(cname,name);}
++ {char *_cname = must_malloc(strlen(name)+1);
++ strcpy(_cname, name); cname = _cname;}
+ else
+ cname = name;
+@@ -960,8 +988,8 @@
+ return(sym);}
+
+-LISP cintern(char *name)
++LISP cintern(const char *name)
+ {return(gen_intern(name,0));}
+
+-LISP rintern(char *name)
++LISP rintern(const char *name)
+ {return(gen_intern(name,1));}
+
+@@ -969,5 +997,5 @@
+ {return(rintern(get_c_string(name)));}
+
+-LISP subrcons(long type, char *name, SUBR_FUNC f)
++LISP subrcons(long type, const char *name, SUBR_FUNC f)
+ {LISP z;
+ NEWCELL(z,type);
+@@ -988,5 +1016,5 @@
+ void gc_protect_n(LISP *location,long n)
+ {struct gc_protected *reg;
+- reg = (struct gc_protected *) must_malloc(sizeof(struct gc_protected));
++ reg = must_malloc(sizeof(struct gc_protected));
+ (*reg).location = location;
+ (*reg).length = n;
+@@ -994,5 +1022,5 @@
+ protected_registers = reg;}
+
+-void gc_protect_sym(LISP *location,char *st)
++void gc_protect_sym(LISP *location, const char *st)
+ {*location = cintern(st);
+ gc_protect(location);}
+@@ -1021,20 +1049,20 @@
+ {LISP ptr;
+ long j;
+- tkbuffer = (char *) must_malloc(TKBUFFERN+1);
++ tkbuffer = must_malloc(TKBUFFERN+1);
+ if (((gc_kind_copying == 1) && (nheaps != 2)) || (nheaps < 1))
+ err("invalid number of heaps",NIL);
+- heaps = (LISP *) must_malloc(sizeof(LISP) * nheaps);
++ heaps = must_malloc(sizeof(LISP) * nheaps);
+ for(j=0;j<nheaps;++j) heaps[j] = NULL;
+- heaps[0] = (LISP) must_malloc(sizeof(struct obj)*heap_size);
++ heaps[0] = must_malloc(sizeof(struct obj)*heap_size);
+ heap = heaps[0];
+ heap_org = heap;
+ heap_end = heap + heap_size;
+ if (gc_kind_copying == 1)
+- heaps[1] = (LISP) must_malloc(sizeof(struct obj)*heap_size);
++ heaps[1] = must_malloc(sizeof(struct obj)*heap_size);
+ else
+ freelist = NIL;
+ gc_protect(&oblistvar);
+ if (obarray_dim > 1)
+- {obarray = (LISP *) must_malloc(sizeof(LISP) * obarray_dim);
++ {obarray = must_malloc(sizeof(LISP) * obarray_dim);
+ for(j=0;j<obarray_dim;++j)
+ obarray[j] = NIL;
+@@ -1062,5 +1090,5 @@
+ setvar(sym_eval_history_ptr,NIL,NIL);
+ if (inums_dim > 0)
+- {inums = (LISP *) must_malloc(sizeof(LISP) * inums_dim);
++ {inums = must_malloc(sizeof(LISP) * inums_dim);
+ for(j=0;j<inums_dim;++j)
+ {NEWCELL(ptr,tc_flonum);
+@@ -1069,35 +1097,35 @@
+ gc_protect_n(inums,inums_dim);}}
+
+-void init_subr(char *name, long type, SUBR_FUNC fcn)
++void init_subr(const char *name, long type, SUBR_FUNC fcn)
+ {setvar(cintern(name),subrcons(type,name,fcn),NIL);}
+
+-void init_subr_0(char *name, LISP (*fcn)(void))
++void init_subr_0(const char *name, LISP (*fcn)(void))
+ {init_subr(name,tc_subr_0,(SUBR_FUNC)fcn);}
+
+-void init_subr_1(char *name, LISP (*fcn)(LISP))
++void init_subr_1(const char *name, LISP (*fcn)(LISP))
+ {init_subr(name,tc_subr_1,(SUBR_FUNC)fcn);}
+
+-void init_subr_2(char *name, LISP (*fcn)(LISP,LISP))
++void init_subr_2(const char *name, LISP (*fcn)(LISP, LISP))
+ {init_subr(name,tc_subr_2,(SUBR_FUNC)fcn);}
+
+-void init_subr_2n(char *name, LISP (*fcn)(LISP,LISP))
++void init_subr_2n(const char *name, LISP (*fcn)(LISP, LISP))
+ {init_subr(name,tc_subr_2n,(SUBR_FUNC)fcn);}
+
+-void init_subr_3(char *name, LISP (*fcn)(LISP,LISP,LISP))
++void init_subr_3(const char *name, LISP (*fcn)(LISP, LISP, LISP))
+ {init_subr(name,tc_subr_3,(SUBR_FUNC)fcn);}
+
+-void init_subr_4(char *name, LISP (*fcn)(LISP,LISP,LISP,LISP))
++void init_subr_4(const char *name, LISP (*fcn)(LISP, LISP, LISP, LISP))
+ {init_subr(name,tc_subr_4,(SUBR_FUNC)fcn);}
+
+-void init_subr_5(char *name, LISP (*fcn)(LISP,LISP,LISP,LISP,LISP))
++void init_subr_5(const char *name, LISP (*fcn)(LISP, LISP, LISP, LISP, LISP))
+ {init_subr(name,tc_subr_5,(SUBR_FUNC)fcn);}
+
+-void init_lsubr(char *name, LISP (*fcn)(LISP))
++void init_lsubr(const char *name, LISP (*fcn)(LISP))
+ {init_subr(name,tc_lsubr,(SUBR_FUNC)fcn);}
+
+-void init_fsubr(char *name, LISP (*fcn)(LISP,LISP))
++void init_fsubr(const char *name, LISP (*fcn)(LISP, LISP))
+ {init_subr(name,tc_fsubr,(SUBR_FUNC)fcn);}
+
+-void init_msubr(char *name, LISP (*fcn)(LISP *,LISP *))
++void init_msubr(const char *name, LISP (*fcn)(LISP *, LISP *))
+ {init_subr(name,tc_msubr,(SUBR_FUNC)fcn);}
+
+@@ -1116,5 +1144,5 @@
+ if (user_types == NULL)
+ {n = sizeof(struct user_type_hooks) * tc_table_dim;
+- user_types = (struct user_type_hooks *) must_malloc(n);
++ user_types = must_malloc(n);
+ memset(user_types,0,n);}
+ if ((type >= 0) && (type < tc_table_dim))
+@@ -1274,5 +1302,5 @@
+ put_st(msgbuff);
+ }
+- heaps[j] = (LISP) must_malloc(sizeof(struct obj)*heap_size);
++ heaps[j] = must_malloc(sizeof(struct obj)*heap_size);
+ ptr = heaps[j];
+ end = heaps[j] + heap_size;
+@@ -1323,5 +1351,5 @@
+ setjmp(save_regs_gc_mark);
+ mark_locations((LISP *) save_regs_gc_mark,
+- (LISP *) (((char *) save_regs_gc_mark) + sizeof(save_regs_gc_mark)));
++ (LISP *)(void *)(((char *)save_regs_gc_mark) + sizeof(save_regs_gc_mark)));
+ mark_protected_registers();
+ mark_locations((LISP *) stack_start_ptr,
+@@ -1443,5 +1471,5 @@
+ end = org + heap_size;
+ for(ptr=org; ptr < end; ++ptr)
+- if (((*ptr).gc_mark == 0))
++ if ((*ptr).gc_mark == 0)
+ {switch((*ptr).type)
+ {case tc_free_cell:
+@@ -1485,6 +1513,6 @@
+ errjmp_ok = 0;
+ old_status_flag = gc_status_flag;
+- if NNULLP(args)
+- if NULLP(car(args)) gc_status_flag = 0; else gc_status_flag = 1;
++ if NNULLP(args) {
++ if NULLP(car(args)) gc_status_flag = 0; else gc_status_flag = 1; }
+ gc_mark_and_sweep();
+ gc_status_flag = old_status_flag;
+@@ -1507,6 +1535,6 @@
+ LISP gc_status(LISP args)
+ {long n,m;
+- if NNULLP(args)
+- if NULLP(car(args)) gc_status_flag = 0; else gc_status_flag = 1;
++ if NNULLP(args) {
++ if NULLP(car(args)) gc_status_flag = 0; else gc_status_flag = 1;}
+ if (gc_kind_copying == 1)
+ {if (gc_status_flag)
+@@ -1928,5 +1956,5 @@
+ return(sym_t);}
+
+-LISP letstar_macro(LISP form)
++static LISP letstar_macro(LISP form)
+ {LISP bindings = cadr(form);
+ if (NNULLP(bindings) && NNULLP(cdr(bindings)))
+@@ -1939,5 +1967,5 @@
+ return(form);}
+
+-LISP letrec_macro(LISP form)
++static LISP letrec_macro(LISP form)
+ {LISP letb,setb,l;
+ for(letb=NIL,setb=cddr(form),l=cadr(form);NNULLP(l);l=cdr(l))
+@@ -1968,8 +1996,8 @@
+ return(form);}
+
+-LISP leval_quote(LISP args,LISP env)
++LISP leval_quote(LISP args, LISP env __unused)
+ {return(car(args));}
+
+-LISP leval_tenv(LISP args,LISP env)
++LISP leval_tenv(LISP args __unused, LISP env)
+ {return(env);}
+
+@@ -1999,5 +2027,5 @@
+ p->prin1 = fcn;}
+
+-char *subr_kind_str(long n)
++static const char *subr_kind_str(long n)
+ {switch(n)
+ {case tc_subr_0: return("subr_0");
+@@ -2082,5 +2110,5 @@
+ return(NIL);}
+
+-LISP lprin1(LISP exp,LISP lf)
++static LISP lprin1(LISP exp, LISP lf)
+ {FILE *f = get_c_file(lf,stdout);
+ lprin1f(exp,f);
+@@ -2114,10 +2142,10 @@
+ {ungetc(c,f);}
+
+-int flush_ws(struct gen_readio *f,char *eoferr)
++int flush_ws(struct gen_readio *f, const char *eoferr)
+ {int c,commentp;
+ commentp = 0;
+ while(1)
+ {c = GETC_FCN(f);
+- if (c == EOF) if (eoferr) err(eoferr,NIL); else return(c);
++ if (c == EOF) { if (eoferr) err(eoferr, NIL); else return(c);}
+ if (commentp) {if (c == '\n') commentp = 0;}
+ else if (c == ';') commentp = 1;
+@@ -2149,5 +2177,6 @@
+ {int c,j;
+ char *p,*buffer=tkbuffer;
+- STACK_CHECK(&f);
++ const char *pc;
++
+ p = buffer;
+ c = flush_ws(f,"end of file inside read");
+@@ -2165,13 +2194,13 @@
+ switch(c)
+ {case '@':
+- p = "+internal-comma-atsign";
++ pc = "+internal-comma-atsign";
+ break;
+ case '.':
+- p = "+internal-comma-dot";
++ pc = "+internal-comma-dot";
+ break;
+ default:
+- p = "+internal-comma";
++ pc = "+internal-comma";
+ UNGETC_FCN(c,f);}
+- return(cons(cintern(p),lreadr(f)));
++ return(cons(cintern(pc), lreadr(f)));
+ case '"':
+ return(lreadstring(f));
+@@ -2238,5 +2267,5 @@
+ LISP apropos(LISP matchl)
+ {LISP result = NIL,l,ml;
+- char *pname;
++ const char *pname;
+ for(l=oblistvar;CONSP(l);l=CDR(l))
+ {pname = get_c_string(CAR(l));
+@@ -2248,5 +2277,6 @@
+ return(result);}
+
+-LISP fopen_cg(FILE *(*fcn)(const char *,const char *),char *name,char *how)
++LISP fopen_cg(FILE *(*fcn)(const char *, const char *),
++ const char *name, const char *how)
+ {LISP sym;
+ long flag;
+@@ -2260,10 +2290,10 @@
+ SAFE_STRCAT(errmsg,name);
+ err(errmsg,llast_c_errmsg(-1));}
+- sym->storage_as.c_file.name = (char *) must_malloc(strlen(name)+1);
++ sym->storage_as.c_file.name = must_malloc(strlen(name)+1);
+ strcpy(sym->storage_as.c_file.name,name);
+ no_interrupt(flag);
+ return(sym);}
+
+-LISP fopen_c(char *name,char *how)
++LISP fopen_c(const char *name, const char *how)
+ {return(fopen_cg(fopen,name,how));}
+
+@@ -2286,10 +2316,11 @@
+ return(NIL);}
+
+-LISP vload(char *ofname,long cflag,long rflag)
++LISP vload(const char *ofname, long cflag, long rflag)
+ {LISP form,result,tail,lf,reader = NIL;
+ FILE *f;
+ int c;
+- long j,len;
+- char buffer[512],*key = "parser:",*start,*end,*ftype=".scm",*fname;
++ size_t j, len;
++ char buffer[512], *start, *end;
++ const char *key = "parser:", *ftype = ".scm", *fname;
+ if ((start = strchr(ofname,VLOAD_OFFSET_HACK_CHAR)))
+ {len = atol(ofname);
+@@ -2386,5 +2417,5 @@
+
+ LISP save_forms(LISP fname,LISP forms,LISP how)
+-{char *cname,*chow = NULL;
++{const char *cname, *chow = NULL;
+ LISP l,lf;
+ FILE *f;
+@@ -2487,5 +2518,5 @@
+
+ LISP parse_number(LISP x)
+-{char *c;
++{const char *c;
+ c = get_c_string(x);
+ return(flocons(atof(c)));}
+@@ -2525,9 +2556,9 @@
+ {return((siod_verbose_level >= level) ? 1 : 0);}
+
+-LISP lruntime(void)
++static LISP lruntime(void)
+ {return(cons(flocons(myruntime()),
+ cons(flocons(gc_time_taken),NIL)));}
+
+-LISP lrealtime(void)
++static LISP lrealtime(void)
+ {return(flocons(myrealtime()));}
+
+@@ -2538,5 +2569,5 @@
+ {return(car(cdr(x)));}
+
+-LISP cdar(LISP x)
++static LISP cdar(LISP x)
+ {return(cdr(car(x)));}
+
+@@ -2544,5 +2575,5 @@
+ {return(cdr(cdr(x)));}
+
+-LISP lrand(LISP m)
++static LISP lrand(LISP m)
+ {long res;
+ res = rand();
+@@ -2552,5 +2583,5 @@
+ return(flocons(res % get_c_long(m)));}
+
+-LISP lsrand(LISP s)
++static LISP lsrand(LISP s)
+ {srand(get_c_long(s));
+ return(NIL);}
+@@ -2583,5 +2614,5 @@
+ return(cintern(errmsg));}
+
+-LISP lllast_c_errmsg(void)
++static LISP lllast_c_errmsg(void)
+ {return(llast_c_errmsg(-1));}
+
+@@ -2611,5 +2642,5 @@
+ return(s1);}
+
+-static LISP parser_read(LISP ignore)
++static LISP parser_read(LISP ignore __unused)
+ {return(leval(cintern("read"),NIL));}
+
+--- sliba.c 2014-03-25 04:10:42.000000000 -0400
++++ sliba.c 2021-02-15 15:48:21.022022000 -0500
+@@ -16,4 +16,8 @@
+ #include <math.h>
+
++#if defined(HAVE_SYS_PARAM_H)
++#include <sys/param.h>
++#endif
++
+ #include "siod.h"
+ #include "siodp.h"
+@@ -184,9 +188,9 @@
+ return(i);}
+
+-void rfs_ungetc(unsigned char c,unsigned char **p)
++void rfs_ungetc(unsigned char c __unused, unsigned char **p)
+ {*p = *p - 1;}
+
+ LISP read_from_string(LISP x)
+-{char *p;
++{const char *p;
+ struct gen_readio s;
+ p = get_c_string(x);
+@@ -196,5 +200,5 @@
+ return(readtl(&s));}
+
+-int pts_puts(char *from,void *cb)
++static int pts_puts(const char *from, void *cb)
+ {LISP into;
+ size_t fromlen,intolen,intosize,fitsize;
+@@ -210,8 +214,8 @@
+ return(1);}
+
+-LISP err_wta_str(LISP exp)
++static LISP err_wta_str(LISP exp)
+ {return(err("not a string",exp));}
+
+-LISP print_to_string(LISP exp,LISP str,LISP nostart)
++static LISP print_to_string(LISP exp, LISP str, LISP nostart)
+ {struct gen_printio s;
+ if NTYPEP(str,tc_string) err_wta_str(str);
+@@ -390,8 +394,9 @@
+ return(s);}
+
+-LISP bytes_append(LISP args)
++static LISP bytes_append(LISP args)
+ {long size,n,j;
+ LISP l,s;
+- char *data,*ptr;
++ char *data;
++ const char *ptr;
+ size = 0;
+ for(l=args;NNULLP(l);l=cdr(l))
+@@ -408,5 +413,5 @@
+ LISP substring(LISP str,LISP start,LISP end)
+ {long s,e,n;
+- char *data;
++ const char *data;
+ data = get_c_string_dim(str,&n);
+ s = get_c_long(start);
+@@ -420,5 +425,5 @@
+
+ LISP string_search(LISP token,LISP str)
+-{char *s1,*s2,*ptr;
++{const char *s1, *s2, *ptr;
+ s1 = get_c_string(str);
+ s2 = get_c_string(token);
+@@ -432,5 +437,5 @@
+
+ LISP string_trim(LISP str)
+-{char *start,*end;
++{const char *start, *end;
+ start = get_c_string(str);
+ while(*start && IS_TRIM_SPACE(*start)) ++start;
+@@ -440,5 +445,5 @@
+
+ LISP string_trim_left(LISP str)
+-{char *start,*end;
++{const char *start, *end;
+ start = get_c_string(str);
+ while(*start && IS_TRIM_SPACE(*start)) ++start;
+@@ -447,5 +452,5 @@
+
+ LISP string_trim_right(LISP str)
+-{char *start,*end;
++{const char *start, *end;
+ start = get_c_string(str);
+ end = &start[strlen(start)];
+@@ -455,10 +460,11 @@
+ LISP string_upcase(LISP str)
+ {LISP result;
+- char *s1,*s2;
++ const char *s1;
++ char *s2;
+ long j,n;
+ s1 = get_c_string(str);
+ n = strlen(s1);
+ result = strcons(n,s1);
+- s2 = get_c_string(result);
++ s2 = get_string_data(result);
+ for(j=0;j<n;++j) s2[j] = toupper(s2[j]);
+ return(result);}
+@@ -466,10 +472,11 @@
+ LISP string_downcase(LISP str)
+ {LISP result;
+- char *s1,*s2;
++ const char *s1;
++ char *s2;
+ long j,n;
+ s1 = get_c_string(str);
+ n = strlen(s1);
+ result = strcons(n,s1);
+- s2 = get_c_string(result);
++ s2 = get_string_data(result);
+ for(j=0;j<n;++j) s2[j] = tolower(s2[j]);
+ return(result);}
+@@ -544,5 +551,4 @@
+ case 'x': case 'X':
+ {
+- int c, j;
+ char buf[33] ;
+ buf[0]='0' ;
+@@ -570,5 +576,5 @@
+ long c_sxhash(LISP obj,long n)
+ {long hash;
+- unsigned char *s;
++ const unsigned char *s;
+ LISP tmp;
+ struct user_type_hooks *p;
+@@ -585,5 +591,5 @@
+ return(hash);
+ case tc_symbol:
+- for(hash=0,s=(unsigned char *)PNAME(obj);*s;++s)
++ for(hash=0, s = (const unsigned char *)PNAME(obj); *s; ++s)
+ hash = HASH_COMBINE(hash,*s,n);
+ return(hash);
+@@ -597,5 +603,5 @@
+ case tc_fsubr:
+ case tc_msubr:
+- for(hash=0,s=(unsigned char *) obj->storage_as.subr.name;*s;++s)
++ for(hash=0, s = (const unsigned char *)obj->storage_as.subr.name; *s; ++s)
+ hash = HASH_COMBINE(hash,*s,n);
+ return(hash);
+@@ -750,5 +756,5 @@
+ return(err("improper list to assoc",alist));}
+
+-LISP assv(LISP x,LISP alist)
++static LISP assv(LISP x, LISP alist)
+ {LISP l,tmp;
+ for(l=alist;CONSP(l);l=CDR(l))
+@@ -1054,5 +1060,5 @@
+ {FILE *f;
+ long flag;
+- char *data;
++ const char *data;
+ long dim,len;
+ f = get_c_file(file,stdout);
+@@ -1066,5 +1072,5 @@
+ return(NIL);}
+
+-LISP lfflush(LISP file)
++static LISP lfflush(LISP file)
+ {FILE *f;
+ long flag;
+@@ -1079,5 +1085,5 @@
+ return(flocons(strlen(string->storage_as.string.data)));}
+
+-LISP string_dim(LISP string)
++static LISP string_dim(LISP string)
+ {if NTYPEP(string,tc_string) err_wta_str(string);
+ return(flocons((double)string->storage_as.string.dim));}
+@@ -1113,5 +1119,5 @@
+ {char buffer[1000];
+ double y;
+- long base,width,prec;
++ int base, width, prec;
+ if NFLONUMP(x) err("wta",x);
+ y = FLONM(x);
+@@ -1156,5 +1162,5 @@
+
+ LISP string2number(LISP x,LISP b)
+-{char *str;
++{const char *str;
+ long base,value = 0;
+ double result;
+@@ -1181,5 +1187,5 @@
+ return(flocons(result));}
+
+-LISP lstrcmp(LISP s1,LISP s2)
++static LISP lstrcmp(LISP s1, LISP s2)
+ {return(flocons(strcmp(get_c_string(s1),get_c_string(s2))));}
+
+@@ -1191,7 +1197,8 @@
+ err_wta_str(s);}
+
+-LISP lstrcpy(LISP dest,LISP src)
++static LISP lstrcpy(LISP dest, LISP src)
+ {long ddim,slen;
+- char *d,*s;
++ char *d;
++ const char *s;
+ chk_string(dest,&d,&ddim);
+ s = get_c_string(src);
+@@ -1203,7 +1210,8 @@
+ return(NIL);}
+
+-LISP lstrcat(LISP dest,LISP src)
++static LISP lstrcat(LISP dest, LISP src)
+ {long ddim,dlen,slen;
+- char *d,*s;
++ char *d;
++ const char *s;
+ chk_string(dest,&d,&ddim);
+ s = get_c_string(src);
+@@ -1217,5 +1225,5 @@
+
+ LISP lstrbreakup(LISP str,LISP lmarker)
+-{char *start,*end,*marker;
++{const char *start, *end, *marker;
+ size_t k;
+ LISP result = NIL;
+@@ -1238,8 +1246,8 @@
+ return(string_append(nreverse(result)));}
+
+-LISP stringp(LISP x)
++static LISP stringp(LISP x)
+ {return(TYPEP(x,tc_string) ? sym_t : NIL);}
+
+-static char *base64_encode_table = "\
++static const char *base64_encode_table = "\
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ\
+ abcdefghijklmnopqrstuvwxyz\
+@@ -1250,8 +1258,8 @@
+ static void init_base64_table(void)
+ {int j;
+- base64_decode_table = (char *) malloc(256);
++ base64_decode_table = malloc(256);
+ memset(base64_decode_table,-1,256);
+ for(j=0;j<65;++j)
+- base64_decode_table[base64_encode_table[j]] = j;}
++ base64_decode_table[(int)base64_encode_table[j]] = j;}
+
+ #define BITMSK(N) ((1 << (N)) - 1)
+@@ -1262,7 +1270,8 @@
+ #define ITEM4(X) X & BITMSK(6)
+
+-LISP base64encode(LISP in)
+-{char *s,*t = base64_encode_table;
+- unsigned char *p1,*p2;
++static LISP base64encode(LISP in)
++{const char *s, *t = base64_encode_table;
++ const unsigned char *p1;
++ unsigned char *p2;
+ LISP out;
+ long j,m,n,chunks,leftover;
+@@ -1272,6 +1281,6 @@
+ m = (chunks + ((leftover) ? 1 : 0)) * 4;
+ out = strcons(m,NULL);
+- p2 = (unsigned char *) get_c_string(out);
+- for(j=0,p1=(unsigned char *)s;j<chunks;++j,p1 += 3)
++ p2 = (unsigned char *)get_string_data(out);
++ for(j=0, p1=(const unsigned char *)s; j < chunks; ++j, p1 += 3)
+ {*p2++ = t[ITEM1(p1[0])];
+ *p2++ = t[ITEM2(p1[0],p1[1])];
+@@ -1297,8 +1306,9 @@
+ return(out);}
+
+-LISP base64decode(LISP in)
+-{char *s,*t = base64_decode_table;
++static LISP base64decode(LISP in)
++{const char *s, *t = base64_decode_table;
+ LISP out;
+- unsigned char *p1,*p2;
++ const unsigned char *p1;
++ unsigned char *p2;
+ long j,m,n,chunks,leftover,item1,item2,item3,item4;
+ s = get_c_string(in);
+@@ -1317,6 +1327,6 @@
+ m = (chunks * 3) + leftover;
+ out = strcons(m,NULL);
+- p2 = (unsigned char *) get_c_string(out);
+- for(j=0,p1=(unsigned char *)s;j<chunks;++j,p1 += 4)
++ p2 = (unsigned char *)get_string_data(out);
++ for(j = 0, p1 = (const unsigned char *)s; j < chunks; ++j, p1 += 4)
+ {if ((item1 = t[p1[0]]) & ~BITMSK(6)) return(NIL);
+ if ((item2 = t[p1[1]]) & ~BITMSK(6)) return(NIL);
+@@ -1354,5 +1364,5 @@
+ return(err("improper list to memq",il));}
+
+-LISP member(LISP x,LISP il)
++static LISP member(LISP x, LISP il)
+ {LISP l,tmp;
+ for(l=il;CONSP(l);l=CDR(l))
+@@ -1363,5 +1373,5 @@
+ return(err("improper list to member",il));}
+
+-LISP memv(LISP x,LISP il)
++static LISP memv(LISP x, LISP il)
+ {LISP l,tmp;
+ for(l=il;CONSP(l);l=CDR(l))
+@@ -1396,5 +1406,5 @@
+ return(NIL);}
+
+-LISP larg_default(LISP li,LISP x,LISP dval)
++static LISP larg_default(LISP li, LISP x, LISP dval)
+ {LISP l = li,elem;
+ long j=0,n = get_c_long(x);
+@@ -1410,7 +1420,7 @@
+ return(dval);}
+
+-LISP lkey_default(LISP li,LISP key,LISP dval)
++static LISP lkey_default(LISP li, LISP key, LISP dval)
+ {LISP l = li,elem;
+- char *ckey,*celem;
++ const char *ckey, *celem;
+ long n;
+ ckey = get_c_string(key);
+@@ -1425,8 +1435,8 @@
+
+
+-LISP llist(LISP l)
++static LISP llist(LISP l)
+ {return(l);}
+
+-LISP writes1(FILE *f,LISP l)
++static LISP writes1(FILE *f, LISP l)
+ {LISP v;
+ STACK_CHECK(&v);
+@@ -1446,5 +1456,5 @@
+ return(NIL);}
+
+-LISP writes(LISP args)
++static LISP writes(LISP args)
+ {return(writes1(get_c_file(car(args),stdout),cdr(args)));}
+
+@@ -1463,9 +1473,10 @@
+ STACK_CHECK(&l);
+ if NULLP(l) err("list is empty",l);
+- if CONSP(l)
++ if CONSP(l) {
+ if NULLP(CDR(l))
+ return(NIL);
+ else
+ return(cons(CAR(l),butlast(CDR(l))));
++ }
+ return(err("not a list",l));}
+
+@@ -1501,5 +1512,5 @@
+ return(lapply(fcn,cons(a1,cons(a2,NIL))));}}
+
+-LISP lqsort(LISP l,LISP f,LISP g)
++static LISP lqsort(LISP l, LISP f, LISP g)
+ /* this is a stupid recursive qsort */
+ {int j,n;
+@@ -1524,5 +1535,5 @@
+ lqsort(notless,f,g))));}
+
+-LISP string_lessp(LISP s1,LISP s2)
++static LISP string_lessp(LISP s1, LISP s2)
+ {if (strcmp(get_c_string(s1),get_c_string(s2)) < 0)
+ return(sym_t);
+@@ -1530,5 +1541,5 @@
+ return(NIL);}
+
+-LISP benchmark_funcall1(LISP ln,LISP f,LISP a1)
++static LISP benchmark_funcall1(LISP ln, LISP f, LISP a1)
+ {long j,n;
+ LISP value = NIL;
+@@ -1538,5 +1549,5 @@
+ return(value);}
+
+-LISP benchmark_funcall2(LISP l)
++static LISP benchmark_funcall2(LISP l)
+ {long j,n;
+ LISP ln = car(l);LISP f = car(cdr(l)); LISP a1 = car(cdr(cdr(l)));
+@@ -1548,5 +1559,5 @@
+ return(value);}
+
+-LISP benchmark_eval(LISP ln,LISP exp,LISP env)
++static LISP benchmark_eval(LISP ln, LISP exp, LISP env)
+ {long j,n;
+ LISP value = NIL;
+@@ -1556,5 +1567,5 @@
+ return(value);}
+
+-LISP mapcar1(LISP fcn,LISP in)
++static LISP mapcar1(LISP fcn, LISP in)
+ {LISP res,ptr,l;
+ if NULLP(in) return(NIL);
+@@ -1564,5 +1575,5 @@
+ return(res);}
+
+-LISP mapcar2(LISP fcn,LISP in1,LISP in2)
++static LISP mapcar2(LISP fcn, LISP in1, LISP in2)
+ {LISP res,ptr,l1,l2;
+ if (NULLP(in1) || NULLP(in2)) return(NIL);
+@@ -1572,5 +1583,5 @@
+ return(res);}
+
+-LISP mapcar(LISP l)
++static LISP mapcar(LISP l)
+ {LISP fcn = car(l);
+ switch(get_c_long(llength(l)))
+@@ -1582,10 +1593,10 @@
+ return(err("mapcar case not handled",l));}}
+
+-LISP lfmod(LISP x,LISP y)
++static LISP lfmod(LISP x, LISP y)
+ {if NFLONUMP(x) err("wta(1st) to fmod",x);
+ if NFLONUMP(y) err("wta(2nd) to fmod",y);
+ return(flocons(fmod(FLONM(x),FLONM(y))));}
+
+-LISP lsubset(LISP fcn,LISP l)
++static LISP lsubset(LISP fcn, LISP l)
+ {LISP result = NIL,v;
+ for(v=l;CONSP(v);v=CDR(v))
+@@ -1594,5 +1605,5 @@
+ return(nreverse(result));}
+
+-LISP ass(LISP x,LISP alist,LISP fcn)
++static LISP ass(LISP x, LISP alist, LISP fcn)
+ {LISP l,tmp;
+ for(l=alist;CONSP(l);l=CDR(l))
+@@ -1603,5 +1614,5 @@
+ return(err("improper list to ass",alist));}
+
+-LISP append2(LISP l1,LISP l2)
++static LISP append2(LISP l1, LISP l2)
+ {long n;
+ LISP result = NIL,p1,p2;
+@@ -1612,5 +1623,5 @@
+ return(result);}
+
+-LISP append(LISP l)
++static LISP append(LISP l)
+ {STACK_CHECK(&l);
+ INTERRUPT_CHECK();
+@@ -1635,7 +1646,6 @@
+ return(result);}
+
+-
+-LISP fast_load(LISP lfname,LISP noeval)
+-{char *fname;
++static LISP fast_load(LISP lfname, LISP noeval)
++{const char *fname;
+ LISP stream;
+ LISP result = NIL,form;
+@@ -1667,6 +1677,7 @@
+ sprintf(&outstr[j*2],"%02X",data[j]);}
+
+-LISP fast_save(LISP fname,LISP forms,LISP nohash,LISP comment,LISP fmode)
+-{char *cname,msgbuff[100],databuff[50];
++static LISP fast_save(LISP fname, LISP forms, LISP nohash, LISP comment, LISP fmode)
++{const char *cname;
++ char msgbuff[100], databuff[50];
+ LISP stream,l;
+ FILE *f;
+@@ -1687,5 +1698,5 @@
+ sprintf(msgbuff,"# Siod Binary Object Save File\n");
+ fput_st(f,msgbuff);
+- sprintf(msgbuff,"# sizeof(long) = %d\n# sizeof(double) = %d\n",
++ sprintf(msgbuff, "# sizeof(long) = %zu\n# sizeof(double) = %zu\n",
+ sizeof(long),sizeof(double));
+ fput_st(f,msgbuff);
+@@ -1703,5 +1714,5 @@
+ return(NIL);}
+
+-void swrite1(LISP stream,LISP data)
++static void swrite1(LISP stream, LISP data)
+ {FILE *f = get_c_file(stream,stdout);
+ switch TYPE(data)
+@@ -1730,5 +1741,5 @@
+ return(value);}
+
+-LISP swrite(LISP stream,LISP table,LISP data)
++static LISP swrite(LISP stream, LISP table, LISP data)
+ {long j,k,m,n;
+ switch(TYPE(data))
+@@ -1753,44 +1764,44 @@
+ return(NIL);}
+
+-LISP lpow(LISP x,LISP y)
++static LISP lpow(LISP x, LISP y)
+ {if NFLONUMP(x) err("wta(1st) to pow",x);
+ if NFLONUMP(y) err("wta(2nd) to pow",y);
+ return(flocons(pow(FLONM(x),FLONM(y))));}
+
+-LISP lexp(LISP x)
++static LISP lexp(LISP x)
+ {return(flocons(exp(get_c_double(x))));}
+
+-LISP llog(LISP x)
++static LISP llog(LISP x)
+ {return(flocons(log(get_c_double(x))));}
+
+-LISP lsin(LISP x)
++static LISP lsin(LISP x)
+ {return(flocons(sin(get_c_double(x))));}
+
+-LISP lcos(LISP x)
++static LISP lcos(LISP x)
+ {return(flocons(cos(get_c_double(x))));}
+
+-LISP ltan(LISP x)
++static LISP ltan(LISP x)
+ {return(flocons(tan(get_c_double(x))));}
+
+-LISP lasin(LISP x)
++static LISP lasin(LISP x)
+ {return(flocons(asin(get_c_double(x))));}
+
+-LISP lacos(LISP x)
++static LISP lacos(LISP x)
+ {return(flocons(acos(get_c_double(x))));}
+
+-LISP latan(LISP x)
++static LISP latan(LISP x)
+ {return(flocons(atan(get_c_double(x))));}
+
+-LISP latan2(LISP x,LISP y)
++static LISP latan2(LISP x, LISP y)
+ {return(flocons(atan2(get_c_double(x),get_c_double(y))));}
+
+-LISP hexstr(LISP a)
+-{unsigned char *in;
++static LISP hexstr(LISP a)
++{const unsigned char *in;
+ char *out;
+ LISP result;
+ long j,dim;
+- in = (unsigned char *) get_c_string_dim(a,&dim);
++ in = (const unsigned char *)get_c_string_dim(a, &dim);
+ result = strcons(dim*2,NULL);
+- for(out=get_c_string(result),j=0;j<dim;++j,out += 2)
++ for (out = get_string_data(result), j = 0; j < dim; ++j, out += 2)
+ sprintf(out,"%02x",in[j]);
+ return(result);}
+@@ -1803,6 +1814,6 @@
+ return(0);}
+
+-LISP hexstr2bytes(LISP a)
+-{char *in;
++static LISP hexstr2bytes(LISP a)
++{const char *in;
+ unsigned char *out;
+ LISP result;
+@@ -1811,10 +1822,10 @@
+ dim = strlen(in) / 2;
+ result = arcons(tc_byte_array,dim,0);
+- out = (unsigned char *) result->storage_as.string.data;
++ out = (unsigned char *)get_string_data(result);
+ for(j=0;j<dim;++j)
+ out[j] = xdigitvalue(in[j*2]) * 16 + xdigitvalue(in[j*2+1]);
+ return(result);}
+
+-LISP getprop(LISP plist,LISP key)
++static LISP getprop(LISP plist, LISP key)
+ {LISP l;
+ for(l=cdr(plist);NNULLP(l);l=cddr(l))
+@@ -1825,12 +1836,12 @@
+ return(NIL);}
+
+-LISP setprop(LISP plist,LISP key,LISP value)
++static LISP setprop(LISP plist __unused, LISP key __unused, LISP value __unused)
+ {err("not implemented",NIL);
+ return(NIL);}
+
+-LISP putprop(LISP plist,LISP value,LISP key)
++static LISP putprop(LISP plist, LISP value, LISP key)
+ {return(setprop(plist,key,value));}
+
+-LISP ltypeof(LISP obj)
++static LISP ltypeof(LISP obj)
+ {long x;
+ x = TYPE(obj);
+@@ -1884,5 +1895,5 @@
+ {return(cdr(cdr(cdr(x))));}
+
+-LISP ash(LISP value,LISP n)
++static LISP ash(LISP value, LISP n)
+ {long m,k;
+ m = get_c_long(value);
+@@ -1894,17 +1905,17 @@
+ return(flocons(m));}
+
+-LISP bitand(LISP a,LISP b)
++static LISP bitand(LISP a, LISP b)
+ {return(flocons(get_c_long(a) & get_c_long(b)));}
+
+-LISP bitor(LISP a,LISP b)
++static LISP bitor(LISP a, LISP b)
+ {return(flocons(get_c_long(a) | get_c_long(b)));}
+
+-LISP bitxor(LISP a,LISP b)
++static LISP bitxor(LISP a, LISP b)
+ {return(flocons(get_c_long(a) ^ get_c_long(b)));}
+
+-LISP bitnot(LISP a)
++static LISP bitnot(LISP a)
+ {return(flocons(~get_c_long(a)));}
+
+-LISP leval_prog1(LISP args,LISP env)
++static LISP leval_prog1(LISP args, LISP env)
+ {LISP retval,l;
+ retval = leval(car(args),env);
+@@ -1913,5 +1924,5 @@
+ return(retval);}
+
+-LISP leval_cond(LISP *pform,LISP *penv)
++static LISP leval_cond(LISP *pform, LISP *penv)
+ {LISP args,env,clause,value,next;
+ args = cdr(*pform);
+@@ -1957,12 +1968,12 @@
+ return(sym_t);}
+
+-LISP lstrspn(LISP str1,LISP str2)
++static LISP lstrspn(LISP str1, LISP str2)
+ {return(flocons(strspn(get_c_string(str1),get_c_string(str2))));}
+
+-LISP lstrcspn(LISP str1,LISP str2)
++static LISP lstrcspn(LISP str1, LISP str2)
+ {return(flocons(strcspn(get_c_string(str1),get_c_string(str2))));}
+
+-LISP substring_equal(LISP str1,LISP str2,LISP start,LISP end)
+-{char *cstr1,*cstr2;
++static LISP substring_equal(LISP str1, LISP str2, LISP start, LISP end)
++{const char *cstr1, *cstr2;
+ long len1,n,s,e;
+ cstr1 = get_c_string_dim(str1,&len1);
+@@ -1988,6 +1999,6 @@
+ #endif
+
+-LISP substring_equalcase(LISP str1,LISP str2,LISP start,LISP end)
+-{char *cstr1,*cstr2;
++static LISP substring_equalcase(LISP str1, LISP str2, LISP start, LISP end)
++{const char *cstr1, *cstr2;
+ long len1,n,s,e;
+ cstr1 = get_c_string_dim(str1,&len1);
+@@ -1999,5 +2010,5 @@
+ return((strncasecmp(cstr1,&cstr2[s],e-s) == 0) ? a_true_value() : NIL);}
+
+-LISP set_eval_history(LISP len,LISP circ)
++static LISP set_eval_history(LISP len, LISP circ)
+ {LISP data;
+ data = NULLP(len) ? len : make_list(len,NIL);
+@@ -2008,5 +2019,5 @@
+ return(len);}
+
+-static LISP parser_fasl(LISP ignore)
++static LISP parser_fasl(LISP ignore __unused)
+ {return(closure(listn(3,
+ NIL,
+--- slibu.c 2014-03-25 06:32:41.000000000 -0400
++++ slibu.c 2021-02-15 21:10:45.383193000 -0500
+@@ -21,4 +21,8 @@
+ #include <stdarg.h>
+
++#if defined(HAVE_SYS_PARAM_H)
++#include <sys/param.h>
++#endif
++
+ #if defined(unix)
+ #include <unistd.h>
+@@ -51,5 +55,5 @@
+ #endif
+
+-#if defined(__osf__) || defined(sun) || defined(linux) || defined(sgi)
++#if defined(__osf__) || defined(sun) || defined(linux) || defined(sgi) || defined(BSD)
+ #include <dlfcn.h>
+ #endif
+@@ -98,5 +102,5 @@
+ #include "siod.h"
+ #include "siodp.h"
+-#include "md5.h"
++#include <md5.h>
+
+ static void init_slibu_version(void)
+@@ -106,8 +110,10 @@
+
+
+-LISP sym_channels = NIL;
+-long tc_opendir = 0;
++static LISP sym_channels = NIL;
++static long tc_opendir = 0;
+
+-char *ld_library_path_env = "LD_LIBRARY_PATH";
++#if defined(unix) && !defined(BSD)
++static const char *ld_library_path_env = "LD_LIBRARY_PATH";
++#endif
+
+ #ifdef VMS
+@@ -119,5 +125,5 @@
+ #endif
+
+-LISP lsystem(LISP args)
++static LISP lsystem(LISP args)
+ {int retval;
+ long iflag;
+@@ -131,8 +137,8 @@
+
+ #ifndef WIN32
+-LISP lgetuid(void)
++static LISP lgetuid(void)
+ {return(flocons(getuid()));}
+
+-LISP lgetgid(void)
++static LISP lgetgid(void)
+ {return(flocons(getgid()));}
+ #endif
+@@ -140,5 +146,5 @@
+ #ifdef unix
+
+-LISP lcrypt(LISP key,LISP salt)
++static LISP lcrypt(LISP key, LISP salt)
+ {char *result;
+ if ((result = crypt(get_c_string(key),get_c_string(salt))))
+@@ -156,5 +162,5 @@
+ #endif
+
+-LISP lgetcwd(void)
++static LISP lgetcwd(void)
+ {char path[PATH_MAX+1];
+ if (getcwd(path,sizeof(path)))
+@@ -167,6 +173,5 @@
+ #ifdef unix
+
+-
+-LISP ldecode_pwent(struct passwd *p)
++static LISP ldecode_pwent(const struct passwd *p)
+ {return(symalist(
+ "name",strcons(strlen(p->pw_name),p->pw_name),
+@@ -188,11 +193,12 @@
+ NULL));}
+
+-static char *strfield(char *name,LISP alist)
++#if !defined(BSD)
++static char *strfield(const char *name, LISP alist)
+ {LISP value,key = rintern(name);
+ if NULLP(value = assq(key,alist))
+- return("");
+- return(get_c_string(cdr(value)));}
++ return(NULL);
++ return(get_string_data(cdr(value)));}
+
+-static long longfield(char *name,LISP alist)
++static long longfield(const char *name, LISP alist)
+ {LISP value,key = rintern(name);
+ if NULLP(value = assq(key,alist))
+@@ -200,5 +206,5 @@
+ return(get_c_long(cdr(value)));}
+
+-void lencode_pwent(LISP alist,struct passwd *p)
++static void lencode_pwent(LISP alist, struct passwd *p)
+ {p->pw_name = strfield("name",alist);
+ p->pw_passwd = strfield("passwd",alist);
+@@ -217,6 +223,7 @@
+ #endif
+ p->pw_shell = strfield("shell",alist);}
++#endif
+
+-LISP lgetpwuid(LISP luid)
++static LISP lgetpwuid(LISP luid)
+ {int iflag;
+ uid_t uid;
+@@ -230,5 +237,5 @@
+ return(result);}
+
+-LISP lgetpwnam(LISP nam)
++static LISP lgetpwnam(LISP nam)
+ {int iflag;
+ struct passwd *p;
+@@ -240,5 +247,5 @@
+ return(result);}
+
+-LISP lgetpwent(void)
++static LISP lgetpwent(void)
+ {int iflag;
+ LISP result = NIL;
+@@ -250,5 +257,5 @@
+ return(result);}
+
+-LISP lsetpwent(void)
++static LISP lsetpwent(void)
+ {int iflag = no_interrupt(1);
+ setpwent();
+@@ -256,5 +263,5 @@
+ return(NIL);}
+
+-LISP lendpwent(void)
++static LISP lendpwent(void)
+ {int iflag = no_interrupt(1);
+ endpwent();
+@@ -262,5 +269,5 @@
+ return(NIL);}
+
+-LISP lsetuid(LISP n)
++static LISP lsetuid(LISP n)
+ {uid_t uid;
+ uid = (uid_t) get_c_long(n);
+@@ -270,5 +277,5 @@
+ return(NIL);}
+
+-LISP lseteuid(LISP n)
++static LISP lseteuid(LISP n)
+ {uid_t uid;
+ uid = (uid_t) get_c_long(n);
+@@ -278,5 +285,5 @@
+ return(NIL);}
+
+-LISP lgeteuid(void)
++static LISP lgeteuid(void)
+ {return(flocons(geteuid()));}
+
+@@ -289,4 +296,5 @@
+ #endif
+
++#if !defined(BSD)
+ LISP lputpwent(LISP alist,LISP file)
+ {int iflag = no_interrupt(1);
+@@ -297,8 +305,9 @@
+ no_interrupt(iflag);
+ return(NIL);}
++#endif
+
+-LISP laccess_problem(LISP lfname,LISP lacc)
+-{char *fname = get_c_string(lfname);
+- char *acc = get_c_string(lacc),*p;
++static LISP laccess_problem(LISP lfname, LISP lacc)
++{const char *fname = get_c_string(lfname);
++ const char *acc = get_c_string(lacc), *p;
+ int amode = 0,iflag = no_interrupt(1),retval;
+ for(p=acc;*p;++p)
+@@ -325,5 +334,5 @@
+ return(NIL);}
+
+-LISP lsymlink(LISP p1,LISP p2)
++static LISP lsymlink(LISP p1, LISP p2)
+ {long iflag;
+ iflag = no_interrupt(1);
+@@ -333,5 +342,5 @@
+ return(NIL);}
+
+-LISP llink(LISP p1,LISP p2)
++static LISP llink(LISP p1, LISP p2)
+ {long iflag;
+ iflag = no_interrupt(1);
+@@ -341,5 +350,5 @@
+ return(NIL);}
+
+-LISP lunlink(LISP p)
++static LISP lunlink(LISP p)
+ {long iflag;
+ iflag = no_interrupt(1);
+@@ -349,5 +358,5 @@
+ return(NIL);}
+
+-LISP lrmdir(LISP p)
++static LISP lrmdir(LISP p)
+ {long iflag;
+ iflag = no_interrupt(1);
+@@ -357,5 +366,5 @@
+ return(NIL);}
+
+-LISP lmkdir(LISP p,LISP m)
++static LISP lmkdir(LISP p, LISP m)
+ {long iflag;
+ iflag = no_interrupt(1);
+@@ -365,5 +374,5 @@
+ return(NIL);}
+
+-LISP lreadlink(LISP p)
++static LISP lreadlink(LISP p)
+ {long iflag;
+ char buff[PATH_MAX+1];
+@@ -375,5 +384,5 @@
+ return(strcons(size,buff));}
+
+-LISP lrename(LISP p1,LISP p2)
++static LISP lrename(LISP p1, LISP p2)
+ {long iflag;
+ iflag = no_interrupt(1);
+@@ -385,15 +394,15 @@
+ #endif
+
+-LISP lrandom(LISP n)
++static LISP lrandom(LISP n)
+ {int res;
+ #if defined(hpux) || defined(vms) || defined(sun) || defined(sgi) || defined(WIN32)
+ res = rand();
+ #endif
+-#if defined(__osf__) || defined(linux)
++#if defined(__osf__) || defined(linux) || defined(BSD)
+ res = random();
+ #endif
+ return(flocons(NNULLP(n) ? res % get_c_long(n) : res));}
+
+-LISP lsrandom(LISP n)
++static LISP lsrandom(LISP n)
+ {long seed;
+ seed = get_c_long(n);
+@@ -401,5 +410,5 @@
+ srand(seed);
+ #endif
+-#if defined(__osf__) || defined(linux)
++#if defined(__osf__) || defined(linux) || defined(BSD)
+ srandom(seed);
+ #endif
+@@ -408,5 +417,5 @@
+ #ifdef unix
+
+-LISP lfork(void)
++static LISP lfork(void)
+ {int iflag;
+ pid_t pid;
+@@ -423,6 +432,7 @@
+ #endif
+
+-char **list2char(LISP *safe,LISP v)
+-{char **x,*tmp;
++static char **list2char(LISP *safe, LISP v)
++{char **x;
++ const char *tmp;
+ long j,n;
+ LISP l;
+@@ -438,5 +448,5 @@
+ #ifdef unix
+
+-LISP lexec(LISP path,LISP args,LISP env)
++static LISP lexec(LISP path, LISP args, LISP env)
+ {int iflag;
+ char **argv = NULL, **envp = NULL;
+@@ -453,5 +463,5 @@
+ return(err("exec",llast_c_errmsg(-1)));}
+
+-LISP lnice(LISP val)
++static LISP lnice(LISP val)
+ {int iflag,n;
+ n = get_c_long(val);
+@@ -490,5 +500,5 @@
+ #ifdef unix
+
+-LISP lwait(LISP lpid,LISP loptions)
++static LISP lwait(LISP lpid, LISP loptions)
+ {pid_t pid,ret;
+ int iflag,status = 0,options;
+@@ -515,5 +525,5 @@
+ return(cons(flocons(ret),cons(flocons(status),NIL)));}
+
+-LISP lkill(LISP pid,LISP sig)
++static LISP lkill(LISP pid, LISP sig)
+ {long iflag;
+ iflag = no_interrupt(1);
+@@ -527,12 +537,12 @@
+ #endif
+
+-LISP lgetpid(void)
++static LISP lgetpid(void)
+ {return(flocons(getpid()));}
+
+ #ifdef unix
+-LISP lgetpgrp(void)
++static LISP lgetpgrp(void)
+ {return(flocons(getpgrp()));}
+
+-LISP lgetgrgid(LISP n)
++static LISP lgetgrgid(LISP n)
+ {gid_t gid;
+ struct group *gr;
+@@ -552,13 +562,13 @@
+
+ #ifndef WIN32
+-LISP lgetppid(void)
++static LISP lgetppid(void)
+ {return(flocons(getppid()));}
+ #endif
+
+-LISP lmemref_byte(LISP addr)
++static LISP lmemref_byte(LISP addr)
+ {unsigned char *ptr = (unsigned char *) get_c_long(addr);
+ return(flocons(*ptr));}
+
+-LISP lexit(LISP val)
++static LISP lexit(LISP val)
+ {int iflag = no_interrupt(1);
+ exit(get_c_long(val));
+@@ -566,5 +576,5 @@
+ return(NIL);}
+
+-LISP ltrunc(LISP x)
++static LISP ltrunc(LISP x)
+ {long i;
+ if NFLONUMP(x) err("wta to trunc",x);
+@@ -573,10 +583,11 @@
+
+ #ifdef unix
+-LISP lputenv(LISP lstr)
+-{char *orig,*cpy;
++static LISP lputenv(LISP lstr)
++{const char *orig;
++ char *cpy;
+ orig = get_c_string(lstr);
+ /* unix putenv keeps a pointer to the string we pass,
+ therefore we must make a fresh copy, which is memory leaky. */
+- cpy = (char *) must_malloc(strlen(orig)+1);
++ cpy = must_malloc(strlen(orig)+1);
+ strcpy(cpy,orig);
+ if (putenv(cpy))
+@@ -586,28 +597,31 @@
+ #endif
+
+-MD5_CTX * get_md5_ctx(LISP a)
++static MD5_CTX * get_md5_ctx(LISP a)
+ {if (TYPEP(a,tc_byte_array) &&
+ (a->storage_as.string.dim == sizeof(MD5_CTX)))
+- return((MD5_CTX *)a->storage_as.string.data);
++ return((MD5_CTX *)(void *)a->storage_as.string.data);
+ else
+ {err("not an MD5_CTX array",a);
+ return(NULL);}}
+
+-LISP md5_init(void)
++static LISP md5_init(void)
+ {LISP a = arcons(tc_byte_array,sizeof(MD5_CTX),1);
+ MD5Init(get_md5_ctx(a));
+ return(a);}
+
+-void md5_update_from_file(MD5_CTX *ctx,FILE *f,unsigned char *buff,long dim)
++static void md5_update_from_file(MD5_CTX *ctx, FILE *f, void *buff, long dim)
+ {size_t len;
+- while((len = fread(buff,sizeof(buff[0]),dim,f)))
+- MD5Update(ctx,buff,len);}
+-
+-LISP md5_update(LISP ctx,LISP str,LISP len)
+-{char *buffer; long dim,n;
+- buffer = get_c_string_dim(str,&dim);
++ while((len = fread(buff, 1, dim, f)))
++ MD5Update(ctx, buff, len);
++ if (!feof(f))
++ err("fread", llast_c_errmsg(-1));}
++
++static LISP md5_update(LISP ctx, LISP str, LISP len)
++{void *buffer; long dim, n;
++ buffer = get_string_data(str);
++ dim = str->storage_as.string.dim;
+ if TYPEP(len,tc_c_file)
+ {md5_update_from_file(get_md5_ctx(ctx), get_c_file(len,NULL),
+- (unsigned char *)buffer,dim);
++ buffer, dim);
+ return(NIL);}
+ else if NULLP(len)
+@@ -616,10 +630,10 @@
+ {n = get_c_long(len);
+ if ((n < 0) || (n > dim)) err("invalid length for string",len);}
+- MD5Update(get_md5_ctx(ctx),(unsigned char *)buffer,n);
++ MD5Update(get_md5_ctx(ctx), buffer, n);
+ return(NIL);}
+
+-LISP md5_final(LISP ctx)
++static LISP md5_final(LISP ctx)
+ {LISP result = arcons(tc_byte_array,16,0);
+- MD5Final((unsigned char *) result->storage_as.string.data,
++ MD5Final(get_string_data(result),
+ get_md5_ctx(ctx));
+ return(result);}
+@@ -662,5 +676,5 @@
+ static int handle_sigalrm_flag = 0;
+
+-void handle_sigalrm(int sig)
++static void handle_sigalrm(int sig __unused)
+ {if (nointerrupt == 1)
+ {if (handle_sigalrm_flag)
+@@ -673,5 +687,5 @@
+ err("alarm signal",NIL);}
+
+-LISP lalarm(LISP seconds,LISP flag)
++static LISP lalarm(LISP seconds, LISP flag)
+ {long iflag;
+ int retval;
+@@ -686,5 +700,5 @@
+
+
+-#if defined(__osf__) || defined(SUN5) || defined(linux)
++#if defined(__osf__) || defined(SUN5) || defined(linux) || defined(BSD)
+
+ #define TV_FRAC(x) (((double)x.tv_usec) * 1.0e-6)
+@@ -694,5 +708,5 @@
+ #endif
+
+-LISP current_resource_usage(LISP kind)
++static LISP current_resource_usage(LISP kind)
+ {struct rusage u;
+ int code;
+@@ -729,5 +743,5 @@
+ #ifdef unix
+
+-LISP l_opendir(LISP name)
++static LISP l_opendir(LISP name)
+ {long iflag;
+ LISP value;
+@@ -742,5 +756,5 @@
+ return(value);}
+
+-DIR *get_opendir(LISP v,long oflag)
++static DIR *get_opendir(LISP v, long oflag)
+ {if NTYPEP(v,tc_opendir) err("not an opendir",v);
+ if NULLP(CAR(v))
+@@ -749,5 +763,5 @@
+ return((DIR *)CAR(v));}
+
+-LISP l_closedir(LISP v)
++static LISP l_closedir(LISP v)
+ {long iflag,old_errno;
+ DIR *d;
+@@ -761,10 +775,10 @@
+ return(NIL);}
+
+-void opendir_gc_free(LISP v)
++static void opendir_gc_free(LISP v)
+ {DIR *d;
+ if ((d = get_opendir(v,0)))
+ closedir(d);}
+
+-LISP l_readdir(LISP v)
++static LISP l_readdir(LISP v)
+ {long iflag,namlen;
+ DIR *d;
+@@ -782,5 +796,5 @@
+ return(strcons(namlen,r->d_name));}
+
+-void opendir_prin1(LISP ptr,struct gen_printio *f)
++static void opendir_prin1(LISP ptr, struct gen_printio *f)
+ {char buffer[256];
+ sprintf(buffer,"#<OPENDIR %p>",get_opendir(ptr,0));
+@@ -879,5 +893,5 @@
+ #endif
+
+-LISP file_times(LISP fname)
++static LISP file_times(LISP fname)
+ {struct stat st;
+ int iflag,ret;
+@@ -894,5 +908,5 @@
+
+ #if defined(unix)
+-LISP decode_st_moden(mode_t mode)
++static LISP decode_st_moden(mode_t mode)
+ {LISP ret = NIL;
+ if (mode & S_ISUID) ret = cons(cintern("SUID"),ret);
+@@ -952,8 +966,8 @@
+ #endif
+
+-LISP decode_st_mode(LISP value)
++static LISP decode_st_mode(LISP value)
+ {return(decode_st_moden(get_c_long(value)));}
+
+-LISP decode_stat(struct stat *s)
++static LISP decode_stat(struct stat *s)
+ {return(symalist("dev",flocons(s->st_dev),
+ "ino",flocons(s->st_ino),
+@@ -978,5 +992,5 @@
+
+
+-LISP g_stat(LISP fname,int (*fcn)(const char *,struct stat *))
++static LISP g_stat(LISP fname, int (*fcn)(const char *, struct stat *))
+ {struct stat st;
+ int iflag,ret;
+@@ -989,8 +1003,8 @@
+ return(decode_stat(&st));}
+
+-LISP l_stat(LISP fname)
++static LISP l_stat(LISP fname)
+ {return(g_stat(fname,stat));}
+
+-LISP l_fstat(LISP f)
++static LISP l_fstat(LISP f)
+ {struct stat st;
+ int iflag,ret;
+@@ -1004,5 +1018,5 @@
+
+ #ifdef unix
+-LISP l_lstat(LISP fname)
++static LISP l_lstat(LISP fname)
+ {return(g_stat(fname,lstat));}
+ #endif
+@@ -1022,5 +1036,5 @@
+ #if defined(unix) || defined(WIN32)
+
+-LISP l_chmod(LISP path,LISP mode)
++static LISP l_chmod(LISP path, LISP mode)
+ {if (chmod(get_c_string(path),get_c_long(mode)))
+ return(err("chmod",llast_c_errmsg(-1)));
+@@ -1030,8 +1044,17 @@
+ #endif
+
++#if defined(unix) || defined(WIN32)
++
++static LISP l_lchmod(LISP path, LISP mode)
++{if (lchmod(get_c_string(path), get_c_long(mode)))
++ return(err("lchmod", llast_c_errmsg(-1)));
++ else
++ return(NIL);}
++
++#endif
+
+ #ifdef unix
+
+-LISP lutime(LISP fname,LISP mod,LISP ac)
++static LISP lutime(LISP fname, LISP mod, LISP ac)
+ {struct utimbuf x;
+ x.modtime = get_c_long(mod);
+@@ -1043,5 +1066,5 @@
+
+
+-LISP lfchmod(LISP file,LISP mode)
++static LISP lfchmod(LISP file, LISP mode)
+ {if (fchmod(fileno(get_c_file(file,NULL)),get_c_long(mode)))
+ return(err("fchmod",llast_c_errmsg(-1)));
+@@ -1061,5 +1084,5 @@
+ NULL)));}
+
+-int get_fd(LISP ptr)
++static int get_fd(LISP ptr)
+ {if TYPEP(ptr,tc_c_file)
+ return(fileno(get_c_file(ptr,NULL)));
+@@ -1067,5 +1090,5 @@
+ return(get_c_long(ptr));}
+
+-LISP gsetlk(int op,LISP lfd,LISP ltype,LISP whence,LISP start,LISP len)
++static LISP gsetlk(int op, LISP lfd, LISP ltype, LISP whence, LISP start, LISP len)
+ {struct flock f;
+ int fd = get_fd(lfd);
+@@ -1084,11 +1107,11 @@
+ return(listn(2,flocons(f.l_type),flocons(f.l_pid)));}
+
+-LISP lF_SETLK(LISP fd,LISP ltype,LISP whence,LISP start,LISP len)
++static LISP lF_SETLK(LISP fd, LISP ltype, LISP whence, LISP start, LISP len)
+ {return(gsetlk(F_SETLK,fd,ltype,whence,start,len));}
+
+-LISP lF_SETLKW(LISP fd,LISP ltype,LISP whence,LISP start,LISP len)
++static LISP lF_SETLKW(LISP fd, LISP ltype, LISP whence, LISP start, LISP len)
+ {return(gsetlk(F_SETLKW,fd,ltype,whence,start,len));}
+
+-LISP lF_GETLK(LISP fd,LISP ltype,LISP whence,LISP start,LISP len)
++static LISP lF_GETLK(LISP fd, LISP ltype, LISP whence, LISP start, LISP len)
+ {return(gsetlk(F_GETLK,fd,ltype,whence,start,len));}
+
+@@ -1097,5 +1120,5 @@
+ #endif
+
+-LISP delete_file(LISP fname)
++static LISP delete_file(LISP fname)
+ {int iflag,ret;
+ iflag = no_interrupt(1);
+@@ -1111,5 +1134,5 @@
+ return(NIL);}
+
+-LISP utime2str(LISP u)
++static LISP utime2str(LISP u)
+ {time_t bt;
+ struct tm *btm;
+@@ -1218,5 +1241,5 @@
+ #endif
+
+-LISP lgetenv(LISP var)
++static LISP lgetenv(LISP var)
+ {char *str;
+ if ((str = getenv(get_c_string(var))))
+@@ -1225,8 +1248,8 @@
+ return(NIL);}
+
+-LISP unix_time(void)
++static LISP unix_time(void)
+ {return(flocons((double)time(NULL)));}
+
+-LISP unix_ctime(LISP value)
++static LISP unix_ctime(LISP value)
+ {time_t b;
+ char *buff,*p;
+@@ -1241,5 +1264,5 @@
+ return(NIL);}
+
+-LISP http_date(LISP value)
++static LISP http_date(LISP value)
+ /* returns the internet standard RFC 1123 format */
+ {time_t b;
+@@ -1320,5 +1343,5 @@
+ #endif
+
+-LISP lsleep(LISP ns)
++static LISP lsleep(LISP ns)
+ {double val = get_c_double(ns);
+ #ifdef unix
+@@ -1333,7 +1356,8 @@
+ return(NIL);}
+
+-LISP url_encode(LISP in)
++static LISP url_encode(LISP in)
+ {int spaces=0,specials=0,regulars=0,c;
+- char *str = get_c_string(in),*p,*r;
++ const char *str = get_c_string(in), *p;
++ char *r;
+ LISP out;
+ for(p=str,spaces=0,specials=0,regulars=0;(c = *p);++p)
+@@ -1344,5 +1368,5 @@
+ return(in);
+ out = strcons(spaces + regulars + specials * 3,NULL);
+- for(p=str,r=get_c_string(out);(c = *p);++p)
++ for (p = str, r = get_string_data(out); (c = *p); ++p)
+ if (c == ' ')
+ *r++ = '+';
+@@ -1352,10 +1376,11 @@
+ else
+ *r++ = c;
+- *r = 0;
++ *r = '\0';
+ return(out);}
+
+-LISP url_decode(LISP in)
++static LISP url_decode(LISP in)
+ {int pluses=0,specials=0,regulars=0,c,j;
+- char *str = get_c_string(in),*p,*r;
++ const char *str = get_c_string(in), *p;
++ char *r;
+ LISP out;
+ for(p=str,pluses=0,specials=0,regulars=0;(c = *p);++p)
+@@ -1371,5 +1396,5 @@
+ return(in);
+ out = strcons(regulars + pluses + specials,NULL);
+- for(p=str,r=get_c_string(out);(c = *p);++p)
++ for (p = str, r = get_string_data(out); (c = *p); ++p)
+ if (c == '+')
+ *r++ = ' ';
+@@ -1386,7 +1411,8 @@
+ return(out);}
+
+-LISP html_encode(LISP in)
++static LISP html_encode(LISP in)
+ {long j,n,m;
+- char *str,*ptr;
++ const char *str;
++ char *ptr;
+ LISP out;
+ switch(TYPE(in))
+@@ -1411,5 +1437,5 @@
+ if (n == m) return(in);
+ out = strcons(m,NULL);
+- for(j=0,ptr=get_c_string(out);j < n; ++j)
++ for(j = 0, ptr = get_string_data(out); j < n; ++j)
+ switch(str[j])
+ {case '>':
+@@ -1429,11 +1455,11 @@
+ return(out);}
+
+-LISP html_decode(LISP in)
++static LISP html_decode(LISP in)
+ {return(in);}
+
+-LISP lgets(LISP file,LISP buffn)
++static LISP lgets(LISP file, LISP buffn)
+ {FILE *f;
+ int iflag;
+- long n;
++ size_t n;
+ char buffer[2048],*ptr;
+ f = get_c_file(file,stdin);
+@@ -1451,11 +1477,12 @@
+ return(NIL);}
+
+-LISP readline(LISP file)
++static LISP readline(LISP file)
+ {LISP result;
+- char *start,*ptr;
++ const char *start;
++ char *ptr;
+ result = lgets(file,NIL);
+ if NULLP(result) return(NIL);
+ start = get_c_string(result);
+- if ((ptr = strchr(start,'\n')))
++ if ((ptr = strchr(start, '\n')) != NULL)
+ {*ptr = 0;
+ /* we also change the dim, because otherwise our equal? function
+@@ -1470,5 +1497,5 @@
+ #ifndef WIN32
+
+-LISP l_chown(LISP path,LISP uid,LISP gid)
++static LISP l_chown(LISP path, LISP uid, LISP gid)
+ {long iflag;
+ iflag = no_interrupt(1);
+@@ -1481,5 +1508,5 @@
+
+ #if defined(unix) && !defined(linux)
+-LISP l_lchown(LISP path,LISP uid,LISP gid)
++static LISP l_lchown(LISP path, LISP uid, LISP gid)
+ {long iflag;
+ iflag = no_interrupt(1);
+@@ -1493,5 +1520,5 @@
+ #ifdef unix
+
+-LISP popen_l(LISP name,LISP how)
++static LISP popen_l(LISP name, LISP how)
+ {return(fopen_cg(popen,
+ get_c_string(name),
+@@ -1504,5 +1531,5 @@
+ So beware.
+ */
+-LISP pclose_l(LISP ptr)
++static LISP pclose_l(LISP ptr)
+ {FILE *f = get_c_file(ptr,NULL);
+ long iflag = no_interrupt(1);
+@@ -1520,5 +1547,5 @@
+ #endif
+
+-LISP so_init_name(LISP fname,LISP iname)
++static LISP so_init_name(LISP fname, LISP iname)
+ {LISP init_name;
+ if NNULLP(iname)
+@@ -1533,6 +1560,6 @@
+ return(intern(init_name));}
+
+-LISP so_ext(LISP fname)
+-{char *ext = ".so";
++static LISP so_ext(LISP fname)
++{const char *ext = ".so";
+ LISP lext;
+ #if defined(hpux)
+@@ -1551,9 +1578,9 @@
+ return(string_append(listn(2,fname,lext)));}
+
+-LISP load_so(LISP fname,LISP iname)
++static LISP load_so(LISP fname, LISP iname)
+ /* note: error cases can leak memory in this procedure. */
+ {LISP init_name;
+ void (*fcn)(void) = NULL;
+-#if defined(__osf__) || defined(sun) || defined(linux) || defined(sgi)
++#if defined(__osf__) || defined(sun) || defined(linux) || defined(sgi) || defined(BSD)
+ void *handle;
+ #endif
+@@ -1576,5 +1603,5 @@
+ put_st(get_c_string(fname));
+ put_st("\n");}
+-#if defined(__osf__) || defined(sun) || defined(linux) || defined(sgi)
++#if defined(__osf__) || defined(sun) || defined(linux) || defined(sgi) || defined(BSD)
+ #if !defined(__osf__)
+ /* Observed bug: values of LD_LIBRARY_PATH established with putenv
+@@ -1637,5 +1664,5 @@
+ return(init_name);}
+
+-LISP require_so(LISP fname)
++static LISP require_so(LISP fname)
+ {LISP init_name;
+ init_name = so_init_name(fname,NIL);
+@@ -1647,9 +1674,9 @@
+ return(NIL);}
+
+-LISP siod_lib_l(void)
++static LISP siod_lib_l(void)
+ {return(rintern(siod_lib));}
+
+
+-LISP ccall_catch_1(LISP (*fcn)(void *),void *arg)
++static LISP ccall_catch_1(LISP (*fcn)(void *), void *arg)
+ {LISP val;
+ val = (*fcn)(arg);
+@@ -1669,5 +1696,5 @@
+ return(ccall_catch_1(fcn,arg));}
+
+-LISP decode_tm(struct tm *t)
++static LISP decode_tm(struct tm *t)
+ {return(symalist("sec",flocons(t->tm_sec),
+ "min",flocons(t->tm_min),
+@@ -1685,8 +1712,8 @@
+ NULL));}
+
+-LISP symalist(char *arg,...)
++LISP symalist(const char *arg, ...)
+ {va_list args;
+ LISP result,l,val;
+- char *key;
++ const char *key;
+ if (!arg) return(NIL);
+ va_start(args,arg);
+@@ -1694,5 +1721,5 @@
+ result = cons(cons(cintern(arg),val),NIL);
+ l = result;
+- while((key = va_arg(args,char *)))
++ while((key = va_arg(args, const char *)))
+ {val = va_arg(args,LISP);
+ CDR(l) = cons(cons(cintern(key),val),NIL);
+@@ -1701,5 +1728,5 @@
+ return(result);}
+
+-void encode_tm(LISP alist,struct tm *t)
++static void encode_tm(LISP alist, struct tm *t)
+ {LISP val;
+ val = cdr(assq(cintern("sec"),alist));
+@@ -1727,5 +1754,5 @@
+ }
+
+-LISP llocaltime(LISP value)
++static LISP llocaltime(LISP value)
+ {time_t b;
+ struct tm *t;
+@@ -1739,5 +1766,5 @@
+ return(err("localtime",llast_c_errmsg(-1)));}
+
+-LISP lgmtime(LISP value)
++static LISP lgmtime(LISP value)
+ {time_t b;
+ struct tm *t;
+@@ -1752,10 +1779,10 @@
+
+ #if defined(unix) || defined(WIN32)
+-LISP ltzset(void)
++static LISP ltzset(void)
+ {tzset();
+ return(NIL);}
+ #endif
+
+-LISP lmktime(LISP alist)
++static LISP lmktime(LISP alist)
+ {struct tm tm;
+ time_t t;
+@@ -1764,7 +1791,7 @@
+ return(flocons((double)t));}
+
+-#if defined(__osf__) || defined(SUN5) || defined(linux)
++#if defined(__osf__) || defined(SUN5) || defined(linux) || defined(BSD)
+
+-LISP lstrptime(LISP str,LISP fmt,LISP in)
++static LISP lstrptime(LISP str,LISP fmt,LISP in)
+ {struct tm tm;
+ encode_tm(in,&tm);
+@@ -1785,5 +1812,5 @@
+ #ifdef unix
+
+-LISP lstrftime(LISP fmt,LISP in)
++static LISP lstrftime(LISP fmt, LISP in)
+ {struct tm tm;
+ time_t b;
+@@ -1805,5 +1832,5 @@
+ #endif
+
+-LISP lchdir(LISP dir)
++static LISP lchdir(LISP dir)
+ {long iflag;
+ #ifdef unix
+@@ -1811,5 +1838,5 @@
+ int fd;
+ #endif
+- char *path;
++ const char *path;
+ switch(TYPE(dir))
+ {case tc_c_file:
+@@ -1844,5 +1871,5 @@
+
+ #ifdef unix
+-LISP lgetpass(LISP lprompt)
++static LISP lgetpass(LISP lprompt)
+ {long iflag;
+ char *result;
+@@ -1857,5 +1884,5 @@
+
+ #ifdef unix
+-LISP lpipe(void)
++static LISP lpipe(void)
+ {int filedes[2];
+ long iflag;
+@@ -1886,9 +1913,9 @@
+ #define CTYPE_ULONG 10
+
+-LISP err_large_index(LISP ind)
++static LISP err_large_index(LISP ind)
+ {return(err("index too large",ind));}
+
+-LISP datref(LISP dat,LISP ctype,LISP ind)
+-{char *data;
++static LISP datref(LISP dat, LISP ctype, LISP ind)
++{const void *data;
+ long size,i;
+ data = get_c_string_dim(dat,&size);
+@@ -1898,46 +1925,46 @@
+ {case CTYPE_FLOAT:
+ if (((i+1) * (int) sizeof(float)) > size) err_large_index(ind);
+- return(flocons(((float *)data)[i]));
++ return(flocons(((const float *)data)[i]));
+ case CTYPE_DOUBLE:
+ if (((i+1) * (int) sizeof(double)) > size) err_large_index(ind);
+- return(flocons(((double *)data)[i]));
++ return(flocons(((const double *)data)[i]));
+ case CTYPE_LONG:
+ if (((i+1) * (int) sizeof(long)) > size) err_large_index(ind);
+- return(flocons(((long *)data)[i]));
++ return(flocons(((const long *)data)[i]));
+ case CTYPE_SHORT:
+ if (((i+1) * (int) sizeof(short)) > size) err_large_index(ind);
+- return(flocons(((short *)data)[i]));
++ return(flocons(((const short *)data)[i]));
+ case CTYPE_CHAR:
+ if (((i+1) * (int) sizeof(char)) > size) err_large_index(ind);
+- return(flocons(((char *)data)[i]));
++ return(flocons(((const char *)data)[i]));
+ case CTYPE_INT:
+ if (((i+1) * (int) sizeof(int)) > size) err_large_index(ind);
+- return(flocons(((int *)data)[i]));
++ return(flocons(((const int *)data)[i]));
+ case CTYPE_ULONG:
+ if (((i+1) * (int) sizeof(unsigned long)) > size) err_large_index(ind);
+- return(flocons(((unsigned long *)data)[i]));
++ return(flocons(((const unsigned long *)data)[i]));
+ case CTYPE_USHORT:
+ if (((i+1) * (int) sizeof(unsigned short)) > size) err_large_index(ind);
+- return(flocons(((unsigned short *)data)[i]));
++ return(flocons(((const unsigned short *)data)[i]));
+ case CTYPE_UCHAR:
+ if (((i+1) * (int) sizeof(unsigned char)) > size) err_large_index(ind);
+- return(flocons(((unsigned char *)data)[i]));
++ return(flocons(((const unsigned char *)data)[i]));
+ case CTYPE_UINT:
+ if (((i+1) * (int) sizeof(unsigned int)) > size) err_large_index(ind);
+- return(flocons(((unsigned int *)data)[i]));
++ return(flocons(((const unsigned int *)data)[i]));
+ default:
+ return(err("unknown CTYPE",ctype));}}
+
+-LISP sdatref(LISP spec,LISP dat)
++static LISP sdatref(LISP spec, LISP dat)
+ {return(datref(dat,car(spec),cdr(spec)));}
+
+-LISP mkdatref(LISP ctype,LISP ind)
++static LISP mkdatref(LISP ctype, LISP ind)
+ {return(closure(cons(ctype,ind),
+ leval(cintern("sdatref"),NIL)));}
+
+-LISP datlength(LISP dat,LISP ctype)
+-{char *data;
++static LISP datlength(LISP dat, LISP ctype)
++{
+ long size;
+- data = get_c_string_dim(dat,&size);
++ (void)get_c_string_dim(dat, &size);
+ switch(get_c_long(ctype))
+ {case CTYPE_FLOAT:
+@@ -1981,7 +2008,7 @@
+ return(NIL);}
+
+-
+-static int htqs_arg(char *value)
+-{char tmpbuff[1024],*p1,*p2;
++static int htqs_arg(const char *value)
++{char tmpbuff[1024], *p1;
++ const char *p2;
+ if ((strcmp(value,"(repl)") == 0) ||
+ (strcmp(value,"repl") == 0))
+@@ -1994,12 +2021,12 @@
+ *p1 = 0;
+ strcat(tmpbuff,"\")");
+- return(repl_c_string(tmpbuff,0,0,0));}
++ return(repl_c_string01(tmpbuff, 0, 0, 0));}
+ else
+- return(repl_c_string(value,0,0,0));}
+-
++ return(repl_c_string01(value, 0, 0, 0));}
+
+ int __stdcall siod_main(int argc,char **argv, char **env)
+ {int j,retval = 0,iargc,mainflag = 0,text_plain_flag = 0;
+- char *iargv[2],*start,*end;
++ const char *iargv[2], *start, *end;
++ char *iargv1;
+ LISP l;
+ iargv[0] = "";
+@@ -2008,14 +2035,15 @@
+ {while(*start)
+ {if (!(end = strstr(start,",-"))) end = &start[strlen(start)];
+- iargv[1] = (char *) malloc(end-start+1);
+- memcpy(iargv[1],start,end-start);
+- iargv[1][end-start] = 0;
+- if ((strncmp(iargv[1],"-v",2) == 0) &&
+- (atol(&iargv[1][2]) > 0) &&
+- (iargv[1][2] != '0'))
++ iargv1 = malloc(end-start+1);
++ iargv[1] = iargv1;
++ memcpy(iargv1, start, end - start);
++ iargv1[end - start] = 0;
++ if ((strncmp(iargv1, "-v", 2) == 0) &&
++ (atol(iargv1 + 2) > 0) &&
++ (iargv1[2] != '0'))
+ {put_st("Content-type: text/plain\r\n\r\n");
+ text_plain_flag = 1;}
+- if ((strncmp(iargv[1],"-m",2) == 0))
+- mainflag = atol(&iargv[1][2]);
++ if ((strncmp(iargv1, "-m", 2) == 0))
++ mainflag = atol(iargv1 + 2);
+ else
+ process_cla(2,iargv,1);
+@@ -2064,5 +2092,5 @@
+ #define BOOTSTRAP_EXE_FILE_SIZE_LIMIT 1000000
+
+-long position_script(FILE *f,char *buff,size_t bufflen)
++static long position_script(FILE *f, char *buff, size_t bufflen)
+ /* This recognizes #!/ sequence. Exersize: compute the probability
+ of the sequence showing up in a file of N random bytes. */
+@@ -2131,10 +2159,10 @@
+ if (pos < 0) return;
+ nargc = argc + ((*flagbuff) ? 2 : 1);
+- nargv = (char **) malloc(sizeof(char *) * nargc);
++ nargv = malloc(sizeof(char *) * nargc);
+ j = 0;
+- nargv[j++] = "siod.exe";
++ nargv[j++] = argv[0];
+ if (*flagbuff) nargv[j++] = strdup(flagbuff);
+ sprintf(offbuff,"%ld",pos);
+- nargv[j] = (char *) malloc(strlen(offbuff)+strlen(argv[0])+2);
++ nargv[j] = malloc(strlen(offbuff)+strlen(argv[0])+2);
+ sprintf(nargv[j],"%s%c%s",offbuff,VLOAD_OFFSET_HACK_CHAR,argv[0]);
+ j++;
+@@ -2144,5 +2172,5 @@
+ }
+
+-LISP lposition_script(LISP lfile)
++static LISP lposition_script(LISP lfile)
+ {FILE *f;
+ long iflag,pos;
+@@ -2157,5 +2185,5 @@
+ return(cons(flocons(pos),strcons(-1,flbuff)));}
+
+-void __stdcall siod_init(int argc,char **argv)
++void __stdcall siod_init(int argc, const char **argv)
+ {process_cla(argc,argv,0);
+ init_storage();
+@@ -2166,5 +2194,5 @@
+ void __stdcall init_slibu(void)
+ {long j;
+-#if defined(unix)
++#if defined(unix) && !defined(BSD)
+ char *tmp1,*tmp2;
+ #endif
+@@ -2179,4 +2207,5 @@
+ set_print_hooks(tc_opendir,opendir_prin1);
+ init_subr_2("chmod",l_chmod);
++ init_subr_2("lchmod", l_lchmod);
+ #endif
+
+@@ -2212,5 +2241,7 @@
+ init_subr_1("setpwfile",lsetpwfile);
+ #endif
++#if !defined(BSD)
+ init_subr_2("putpwent",lputpwent);
++#endif
+ init_subr_2("access-problem?",laccess_problem);
+ init_subr_3("utime",lutime);
+@@ -2246,5 +2277,5 @@
+ init_subr_2("cpu-usage-limits",cpu_usage_limits);
+ #endif
+-#if defined(__osf__) || defined(SUN5) || defined(linux)
++#if defined(__osf__) || defined(SUN5) || defined(linux) || defined(BSD)
+ init_subr_1("current-resource-usage",current_resource_usage);
+ #endif
+@@ -2320,5 +2351,5 @@
+ init_subr_0("siod-lib",siod_lib_l);
+
+-#ifdef unix
++#if defined(unix) && !defined(BSD)
+ if ((!(tmp1 = getenv(ld_library_path_env))) ||
+ (!strstr(tmp1,siod_lib)))
+@@ -2351,5 +2382,5 @@
+ init_subr_0("rld-pathnames",rld_pathnames);
+ #endif
+-#if defined(__osf__) || defined(SUN5) || defined(linux)
++#if defined(__osf__) || defined(SUN5) || defined(linux) || defined(BSD)
+ init_subr_3("strptime",lstrptime);
+ #endif
diff --git a/lang/siod/files/patch-makefile b/lang/siod/files/patch-makefile
deleted file mode 100644
index b3ff3a4244ea..000000000000
--- a/lang/siod/files/patch-makefile
+++ /dev/null
@@ -1,79 +0,0 @@
---- makefile.orig 2000-03-14 16:26:55.000000000 +0100
-+++ makefile 2014-06-01 15:48:40.620294169 +0200
-@@ -19,10 +19,10 @@
- #
- #
- MANSEC=1
--MANDIR=$(IROOT)/usr/local/man/man$(MANSEC)
--BINDIR=$(IROOT)/usr/local/bin
--INCDIR=$(IROOT)/usr/local/include
--LIBDIR=$(IROOT)/usr/local/lib
-+MANDIR=$(PREFIX)/man/man$(MANSEC)
-+BINDIR=$(PREFIX)/bin
-+INCDIR=$(PREFIX)/include
-+LIBDIR=$(PREFIX)/lib
- LIBSIODDIR=$(LIBDIR)/siod
- CP_F=cp -f
- # -Wmissing-prototypes
-@@ -300,6 +300,19 @@
- LD_EXE_LIBS="-lm -ldl" \
- build_driver
-
-+## FreeBSD, possibly other BSDs
-+freebsd:
-+ $(MAKE) \
-+ PROGS="siod tar.so parser_pratt.so ss.so \
-+ regex.so" \
-+ CFLAGS="$(CDEBUG) $(GCCW) -DHAVE_SYS_PARAM_H $(CFLAGS) -fPIC" \
-+ LD_LIB_LIBS="-lcrypt -lm" \
-+ LD_LIB_FLAGS="-shared" \
-+ LD_EXE_FLAGS="-rdynamic -Xlinker -rpath -Xlinker $(LIBDIR) -Xlinker -rpath -Xlinker $(LIBSIODDIR)" \
-+ SO="so" \
-+ build_driver
-+
-+
- unknown:
- -ln -s ssiod siod
- $(MAKE) \
-@@ -457,30 +470,30 @@
- install: $(DISTFILES)
- @echo "Note: This does not do a build. Only installs what already"
- @echo " sits in the directory."
-- -mkdir -p $(MANDIR)
-- -mkdir -p $(BINDIR)
-- -mkdir -p $(LIBDIR)
-- -mkdir -p $(INCDIR)
-- -mkdir -p $(LIBSIODDIR)
-+ -mkdir -p $(DESTDIR)$(MANDIR)
-+ -mkdir -p $(DESTDIR)$(BINDIR)
-+ -mkdir -p $(DESTDIR)$(LIBDIR)
-+ -mkdir -p $(DESTDIR)$(INCDIR)
-+ -mkdir -p $(DESTDIR)$(LIBSIODDIR)
- -for X in $(INTO_BINDIR) ; do \
-- $(CP_F) $$X $(BINDIR) ;\
-+ $(CP_F) $$X $(DESTDIR)$(BINDIR) ;\
- done
- -for X in $(LIBFILES) ; do \
-- $(CP_F) $$X $(LIBSIODDIR) ;\
-+ $(CP_F) $$X $(DESTDIR)$(LIBSIODDIR) ;\
- done
- -for X in $(SOLIBFILES) ; do \
- for E in so sl ; do \
-- $(CP_F) $$X.$$E $(LIBSIODDIR) ;\
-+ $(BSD_INSTALL_LIB) $$X.$$E $(DESTDIR)$(LIBSIODDIR) ;\
- done ;\
- done
- -for X in $(INTO_LIBDIR) ; do \
-- $(CP_F) $$X $(LIBDIR) ;\
-+ $(BSD_INSTALL_LIB) $$X $(DESTDIR)$(LIBDIR) ;\
- done
- -for X in $(MANPAGES) ; do \
-- $(CP_F) $$X.man $(MANDIR)/$$X.$(MANSEC) ;\
-+ $(CP_F) $$X.man $(DESTDIR)$(MANDIR)/$$X.$(MANSEC) ;\
- done
- -for X in $(PUBINCS) ; do \
-- $(CP_F) $$X $(INCDIR) ;\
-+ $(CP_F) $$X $(DESTDIR)$(INCDIR) ;\
- done
- @echo "Install done."
-
diff --git a/lang/siod/files/patch-ndbm b/lang/siod/files/patch-ndbm
new file mode 100644
index 000000000000..f6d240858752
--- /dev/null
+++ b/lang/siod/files/patch-ndbm
@@ -0,0 +1,173 @@
+--- ndbm.c 2014-03-25 04:10:42.000000000 -0400
++++ ndbm.c 2021-02-16 21:28:56.638550000 -0500
+@@ -7,5 +7,9 @@
+ #include <sys/types.h>
+ #endif
+-
++#ifdef dbm_pagfno
++#include <fcntl.h>
++#undef dbm_pagfno
++#define dbm_pagfno dbm_dirfno
++#endif
+
+ static void init_ndbm_version(void)
+@@ -14,11 +18,11 @@
+ NIL);}
+
+-long tc_dbm = 0;
++static long tc_dbm = 0;
+
+-DBM *get_DBM(LISP ptr,int errflg)
++static DBM *get_DBM(LISP ptr,int errflg)
+ {DBM *p;
+ if (NTYPEP(ptr,tc_dbm))
+ err("not a DBM",ptr);
+- if ((p = (DBM *) ptr->storage_as.string.data))
++ if ((p = (DBM *)(void *)ptr->storage_as.string.data))
+ return(p);
+ else if (errflg)
+@@ -26,8 +30,8 @@
+ return(NULL);}
+
+-LISP ldbm_open(LISP lfname,LISP lflags,LISP lmode)
++static LISP ldbm_open(LISP lfname,LISP lflags,LISP lmode)
+ {mode_t mode;
+ int flags;
+- char *fname;
++ const char *fname;
+ long iflag;
+ LISP result;
+@@ -45,5 +49,5 @@
+ return(result);}
+
+-LISP ldbm_close(LISP ldbm)
++static LISP ldbm_close(LISP ldbm)
+ {long iflag;
+ DBM *db;
+@@ -64,14 +68,11 @@
+ return(result);}}
+
+-LISP ldbm_fetch(LISP ldbm,LISP lkey)
++static LISP ldbm_fetch(LISP ldbm, LISP lkey)
+ {long iflag;
+ DBM *db;
+- char *key;
+- long keysize;
+ datum dat1,dat2;
+ db = get_DBM(ldbm,1);
+- key = get_c_string_dim(lkey,&keysize);
+- dat1.dptr = key;
+- dat1.dsize = keysize;
++ dat1.dptr = get_string_data(lkey);
++ dat1.dsize = lkey->storage_as.string.dim;
+ iflag = no_interrupt(1);
+ dat2 = dbm_fetch(db,dat1);
+@@ -79,5 +80,5 @@
+ return(cons_from_datum(&dat2));}
+
+-LISP ldbm_firstkey(LISP ldbm)
++static LISP ldbm_firstkey(LISP ldbm)
+ {long iflag;
+ DBM *db;
+@@ -89,5 +90,5 @@
+ return(cons_from_datum(&dat));}
+
+-LISP ldbm_nextkey(LISP ldbm)
++static LISP ldbm_nextkey(LISP ldbm)
+ {long iflag;
+ DBM *db;
+@@ -99,14 +100,11 @@
+ return(cons_from_datum(&dat));}
+
+-LISP ldbm_delete(LISP ldbm,LISP lkey)
++static LISP ldbm_delete(LISP ldbm, LISP lkey)
+ {long iflag,status;
+ DBM *db;
+- char *key;
+- long keysize;
+ datum dat;
+ db = get_DBM(ldbm,1);
+- key = get_c_string_dim(lkey,&keysize);
+- dat.dptr = key;
+- dat.dsize = keysize;
++ dat.dptr = get_string_data(lkey);
++ dat.dsize = lkey->storage_as.string.dim;
+ iflag = no_interrupt(1);
+ status = dbm_delete(db,dat);
+@@ -116,19 +114,15 @@
+ return(NIL);}
+
+-LISP ldbm_store(LISP ldb,LISP lkey,LISP ldata,LISP lflags)
++static LISP ldbm_store(LISP ldb, LISP lkey, LISP ldata, LISP lflags)
+ {long iflag,status;
+ DBM *db;
+- char *key,*data;
+- long keysize,datasize;
+ datum dat1,dat2;
+ int flags;
+ db = get_DBM(ldb,1);
+- key = get_c_string_dim(lkey,&keysize);
+- data = get_c_string_dim(ldata,&datasize);
+ flags = NULLP(lflags) ? 0 : get_c_long(lflags);
+- dat1.dptr = key;
+- dat1.dsize = keysize;
+- dat2.dptr = data;
+- dat2.dsize = datasize;
++ dat1.dptr = get_string_data(lkey);
++ dat1.dsize = lkey->storage_as.string.dim;
++ dat2.dptr = get_string_data(ldata);
++ dat2.dsize = ldata->storage_as.string.dim;
+ iflag = no_interrupt(1);
+ status = dbm_store(db,dat1,dat2,flags);
+@@ -141,11 +135,11 @@
+ return(a_true_value());}
+
+-LISP ldbm_dirfno(LISP ldb)
++static LISP ldbm_dirfno(LISP ldb)
+ {return(flocons(dbm_dirfno(get_DBM(ldb,1))));}
+
+-LISP ldbm_pagfno(LISP ldb)
++static LISP ldbm_pagfno(LISP ldb)
+ {return(flocons(dbm_pagfno(get_DBM(ldb,1))));}
+
+-void dbm_gc_free(LISP ptr)
++static void dbm_gc_free(LISP ptr)
+ {DBM *p;
+ if ((p = get_DBM(ptr,0)))
+@@ -153,5 +147,5 @@
+ ptr->storage_as.string.data = NULL;}
+
+-void dbm_prin1(LISP ptr,struct gen_printio *f)
++static void dbm_prin1(LISP ptr,struct gen_printio *f)
+ {char buff[256];
+ DBM *p;
+@@ -160,10 +154,26 @@
+ gput_st(f,buff);}
+
+-LISP ldbm_rdonly(LISP ldb)
+-{return((dbm_rdonly(get_DBM(ldb,1))) ? a_true_value() : NIL);}
++static LISP ldbm_rdonly(LISP ldb)
++{
++#ifdef dbm_pagfno
++ /*
++ * On BSD, for example, ndbm is emulated using db,
++ * and does not provide dbm_rdonly(). We emulate
++ * it by looking at the database's file-descriptor.
++ * XXX Untested!
++ */
++ int fd = dbm_dirfno(get_DBM(ldb, 1));
++ return (fcntl(fd, F_GETFL) & O_ACCMODE) == O_RDONLY ?
++ a_true_value() : NIL;
++#else
++ return((dbm_rdonly(get_DBM(ldb,1))) ? a_true_value() : NIL);
++#endif
++}
+
+-LISP ldbm_error(LISP ldb)
++static LISP ldbm_error(LISP ldb)
+ {return((dbm_error(get_DBM(ldb,1))) ? a_true_value() : NIL);}
+
++void init_ndbm(void); /* init_FOO is the only symbol exported by a module */
++
+ void init_ndbm(void)
+ {long j;
diff --git a/lang/siod/files/patch-parser_pratt b/lang/siod/files/patch-parser_pratt
new file mode 100644
index 000000000000..2a58cc38c211
--- /dev/null
+++ b/lang/siod/files/patch-parser_pratt
@@ -0,0 +1,48 @@
+--- parser_pratt.c 2014-03-25 04:10:42.000000000 -0400
++++ parser_pratt.c 2021-02-15 22:35:51.027451000 -0500
+@@ -27,9 +27,10 @@
+ {return(err("token_overflow",NIL));}
+
+-LISP pratt_read_token(LISP buffer,LISP chars,LISP stream)
++static LISP pratt_read_token(LISP buffer, LISP chars, LISP stream)
+ {LISP c,tail;
+ char *tk;
+ long j=0,tkdim;
+- tk = get_c_string_dim(buffer,&tkdim);
++ tk = get_string_data(buffer);
++ tkdim = buffer->storage_as.string.dim;
+ while(1)
+ if NULLP(c = lgetc(stream))
+@@ -39,5 +40,5 @@
+ else if NEQ(sym_whitespace,tail)
+ break;
+- if EQ(sym_string_delim,tail)
++ if EQ(sym_string_delim,tail) {
+ while(NNULLP(c = lgetc(stream)))
+ if EQ(sym_back_slash,aref1(chars,c))
+@@ -58,4 +59,5 @@
+ else
+ err_token_overflow();
++ }
+ if EQ(tail,sym_back_slash)
+ c = lgetc(stream);
+@@ -66,5 +68,5 @@
+ if NULLP(tail)
+ return(lreadtk(tk,j));
+- else if CONSP(tail)
++ else if CONSP(tail) {
+ while(1)
+ if NULLP(c = lgetc(stream))
+@@ -78,4 +80,5 @@
+ {if NEQ(sym_whitespace,aref1(chars,c)) lungetc(c,stream);
+ return(lreadtk(tk,j));}
++ }
+ while(1)
+ if NULLP(c = lgetc(stream))
+@@ -96,4 +99,6 @@
+ return(NIL);}
+
++void init_parser_pratt(void); /* Our sole exported symbol */
++
+ void init_parser_pratt(void)
+ {init_subr_3("pratt_read_token",pratt_read_token);
diff --git a/lang/siod/files/patch-regex b/lang/siod/files/patch-regex
new file mode 100644
index 000000000000..cf935cf1254e
--- /dev/null
+++ b/lang/siod/files/patch-regex
@@ -0,0 +1,85 @@
+--- regex.c 2014-03-25 04:31:33.000000000 -0400
++++ regex.c 2021-02-15 22:12:33.365564000 -0500
+@@ -4,6 +4,9 @@
+ author: george j. carrette
+ */
+
++#if defined(HAVE_SYS_PARAM_H)
++#include <sys/param.h>
++#endif
+
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -15,5 +18,5 @@
+ #include <sys/types.h>
+ #endif
+-#if defined(linux)
++#if defined(linux) || defined(BSD)
+ #include <regex.h>
+ #else
+@@ -27,5 +30,5 @@
+ NIL);}
+
+-long tc_regex = 0;
++static long tc_regex = 0;
+
+ struct tc_regex
+@@ -35,11 +38,12 @@
+ regmatch_t *m;};
+
+-struct tc_regex *get_tc_regex(LISP ptr)
++static struct tc_regex *get_tc_regex(LISP ptr)
+ {if NTYPEP(ptr,tc_regex) err("not a regular expression",ptr);
+- return((struct tc_regex *)ptr->storage_as.string.data);}
++ return((struct tc_regex *)(void *)ptr->storage_as.string.data);}
+
+-LISP regcomp_l(LISP pattern,LISP flags)
++static LISP regcomp_l(LISP pattern,LISP flags)
+ {long iflag,iflags;
+- char *str,errbuff[1024];
++ const char *str;
++ char errbuff[1024];
+ int error;
+ LISP result;
+@@ -69,10 +73,10 @@
+ return(result);}
+
+-LISP regerror_l(LISP code,LISP ptr)
++static LISP regerror_l(LISP code,LISP ptr)
+ {char errbuff[1024];
+ regerror(get_c_long(code),get_tc_regex(ptr)->r,errbuff,sizeof(errbuff));
+ return(strcons(strlen(errbuff),errbuff));}
+
+-LISP regexec_l(LISP ptr,LISP str,LISP eflags)
++static LISP regexec_l(LISP ptr,LISP str,LISP eflags)
+ {size_t j;
+ int error;
+@@ -92,7 +96,7 @@
+ return(nreverse(result));}
+
+-void regex_gc_free(LISP ptr)
++static void regex_gc_free(LISP ptr)
+ {struct tc_regex *h;
+- if ((h = (struct tc_regex *)ptr->storage_as.string.data))
++ if ((h = (struct tc_regex *)(void *)ptr->storage_as.string.data))
+ {if ((h->compflag) && h->r)
+ regfree(h->r);
+@@ -106,9 +110,9 @@
+ ptr->storage_as.string.data = NULL;}}
+
+-void regex_prin1(LISP ptr,struct gen_printio *f)
++static void regex_prin1(LISP ptr,struct gen_printio *f)
+ {char buffer[256];
+ regex_t *p;
+ p = get_tc_regex(ptr)->r;
+- sprintf(buffer,"#<REGEX %p nsub=%d",
++ sprintf(buffer, "#<REGEX %p nsub=%zu",
+ p,p->re_nsub);
+ gput_st(f,buffer);
+@@ -120,4 +124,6 @@
+ gput_st(f,">");}
+
++void init_regex(void); /* The sole symbol exported from a module */
++
+ void init_regex(void)
+ {long j;
diff --git a/lang/siod/files/patch-regex.c b/lang/siod/files/patch-regex.c
deleted file mode 100644
index de4127a62ef9..000000000000
--- a/lang/siod/files/patch-regex.c
+++ /dev/null
@@ -1,21 +0,0 @@
---- regex.c-- Mon Dec 1 23:48:17 1997
-+++ regex.c Wed Apr 28 12:59:44 1999
-@@ -4,6 +4,9 @@
- author: george j. carrette
- */
-
-+#if defined(HAVE_SYS_PARAM_H)
-+#include <sys/param.h>
-+#endif
-
- #include <stdio.h>
- #include <stdlib.h>
-@@ -11,7 +14,7 @@
- #if defined(VMS)
- #include <types.h>
- #endif
--#if defined(sgi)
-+#if defined(sgi) || defined(BSD)
- #include <sys/types.h>
- #endif
- #include <regex.h>
diff --git a/lang/siod/files/patch-sample.c b/lang/siod/files/patch-sample.c
new file mode 100644
index 000000000000..36bc6f919801
--- /dev/null
+++ b/lang/siod/files/patch-sample.c
@@ -0,0 +1,70 @@
+--- sample.c 2014-03-25 04:10:42.000000000 -0400
++++ sample.c 2021-02-15 23:14:05.303485000 -0500
+@@ -33,13 +33,13 @@
+ NIL);}
+
+-LISP my_one;
+-LISP my_two;
+-LISP my_99;
+-LISP my_0;
++static LISP my_one;
++static LISP my_two;
++static LISP my_99;
++static LISP my_0;
+
+-LISP cfib(LISP x);
+-LISP clooptest(LISP x,LISP f);
++static LISP cfib(LISP x);
++static LISP clooptest(LISP x,LISP f);
+
+-static char *standard_fib = "\
++static const char *standard_fib = "\
+ \
+ (define (fib x) \
+@@ -49,7 +49,8 @@
+ (fib (- x 2))))) ";
+
+-int main(int argc,char **argv)
++int main(int argc, const char **argv)
+ {int j,xflag = 0,retval = 0;
+ char *linebuffer = NULL,*ptr,*iobuff;
++ const char *ex;
+ print_welcome();
+ #ifdef THINK_C
+@@ -63,5 +64,5 @@
+ else if (strncmp(argv[j],"-e",2) == 0)
+ {xflag = 2;
+- linebuffer = &argv[j][2];}
++ ex = &argv[j][2];}
+ process_cla(argc,argv,(xflag) ? 0 : 1);
+ print_hs_1();
+@@ -81,5 +82,5 @@
+ init_subr_1("cfib",cfib);
+ init_subr_2("cloop-test",clooptest);
+- repl_c_string(standard_fib,0,0,0);
++ repl_c_string01(standard_fib, 0, 0, 0);
+ switch(xflag)
+ {case 0:
+@@ -88,17 +89,17 @@
+ case 1:
+ printf("Using repl_c_string\n");
+- linebuffer = (char *) malloc(256);
++ linebuffer = malloc(256);
+ while(fgets(linebuffer,256,stdin))
+ {if ((ptr = strchr(linebuffer,'\n'))) *ptr = 0;
+- retval = repl_c_string(linebuffer,1,xflag,0);
++ retval = repl_c_string01(linebuffer, 1, xflag, 0);
+ xflag = 0;}
+ break;
+ case 2:
+- retval = repl_c_string(linebuffer,1,xflag,1);
++ retval = repl_c_string01(ex, 1, xflag, 1);
+ break;
+ case 3:
+ printf("Using repl_c_string I/O case\n");
+- linebuffer = (char *) malloc(256);
+- iobuff = (char *) malloc(1024);
++ linebuffer = malloc(256);
++ iobuff = malloc(1024);
+ while(fgets(linebuffer,256,stdin))
+ {if ((ptr = strchr(linebuffer,'\n'))) *ptr = 0;
diff --git a/lang/siod/files/patch-siod.c b/lang/siod/files/patch-siod.c
new file mode 100644
index 000000000000..4814278c403f
--- /dev/null
+++ b/lang/siod/files/patch-siod.c
@@ -0,0 +1,9 @@
+--- siod.c 2014-03-25 04:10:42.000000000 -0400
++++ siod.c 2021-02-15 23:07:49.223752000 -0500
+@@ -13,5 +13,5 @@
+ #include "siod.h"
+
+-static char *siod_argv[] = {
++static const char *siod_argv[] = {
+ "siod",
+ "-h1000000:50",
diff --git a/lang/siod/files/patch-slibu.c b/lang/siod/files/patch-slibu.c
deleted file mode 100644
index b0d5be2349c5..000000000000
--- a/lang/siod/files/patch-slibu.c
+++ /dev/null
@@ -1,101 +0,0 @@
---- slibu.c.orig Mon Dec 1 19:16:38 1997
-+++ slibu.c Thu Jan 6 15:04:04 2000
-@@ -20,6 +20,10 @@
- #include <errno.h>
- #include <stdarg.h>
-
-+#if defined(HAVE_SYS_PARAM_H)
-+#include <sys/param.h>
-+#endif
-+
- #if defined(unix)
- #include <unistd.h>
- #include <dirent.h>
-@@ -50,7 +54,7 @@
- #include <dl.h>
- #endif
-
--#if defined(__osf__) || defined(sun) || defined(linux) || defined(sgi)
-+#if defined(__osf__) || defined(sun) || defined(linux) || defined(sgi) || defined(BSD)
- #include <dlfcn.h>
- #endif
-
-@@ -288,6 +292,7 @@
- return(NIL);}
- #endif
-
-+#if !defined(BSD)
- LISP lputpwent(LISP alist,LISP file)
- {int iflag = no_interrupt(1);
- int status;
-@@ -296,6 +301,7 @@
- status = putpwent(&p,get_c_file(file,NULL));
- no_interrupt(iflag);
- return(NIL);}
-+#endif
-
- LISP laccess_problem(LISP lfname,LISP lacc)
- {char *fname = get_c_string(lfname);
-@@ -1021,7 +1027,7 @@
-
- #if defined(unix) || defined(WIN32)
-
--LISP lchmod(LISP path,LISP mode)
-+LISP l_chmod(LISP path,LISP mode)
- {if (chmod(get_c_string(path),get_c_long(mode)))
- return(err("chmod",llast_c_errmsg(-1)));
- else
-@@ -1029,6 +1035,15 @@
-
- #endif
-
-+#if defined(unix) || defined(WIN32)
-+
-+LISP l_lchmod(LISP path,LISP mode)
-+{if (lchmod(get_c_string(path),get_c_long(mode)))
-+ return(err("lchmod",llast_c_errmsg(-1)));
-+ else
-+ return(NIL);}
-+
-+#endif
-
- #ifdef unix
-
-@@ -1554,7 +1569,7 @@
- /* note: error cases can leak memory in this procedure. */
- {LISP init_name;
- void (*fcn)(void) = NULL;
--#if defined(__osf__) || defined(sun) || defined(linux) || defined(sgi)
-+#if defined(__osf__) || defined(sun) || defined(linux) || defined(sgi) || defined(BSD)
- void *handle;
- #endif
- #if defined(hpux)
-@@ -1575,7 +1590,7 @@
- {put_st("so-loading ");
- put_st(get_c_string(fname));
- put_st("\n");}
--#if defined(__osf__) || defined(sun) || defined(linux) || defined(sgi)
-+#if defined(__osf__) || defined(sun) || defined(linux) || defined(sgi) || defined(BSD)
- #if !defined(__osf__)
- /* Observed bug: values of LD_LIBRARY_PATH established with putenv
- -after- a process has started are ignored. Work around follows. */
-@@ -2163,7 +2178,8 @@
- opendir_gc_free,
- &j);
- set_print_hooks(tc_opendir,opendir_prin1);
-- init_subr_2("chmod",lchmod);
-+ init_subr_2("chmod",l_chmod);
-+ init_subr_2("lchmod",l_lchmod);
- #endif
-
- gc_protect_sym(&sym_channels,"*channels*");
-@@ -2197,7 +2213,9 @@
- #if defined(__osf__)
- init_subr_1("setpwfile",lsetpwfile);
- #endif
-+#if !defined(BSD)
- init_subr_2("putpwent",lputpwent);
-+#endif
- init_subr_2("access-problem?",laccess_problem);
- init_subr_3("utime",lutime);
- init_subr_2("fchmod",lfchmod);
diff --git a/lang/siod/files/patch-sql_sybase b/lang/siod/files/patch-sql_sybase
new file mode 100644
index 000000000000..0df6eee14585
--- /dev/null
+++ b/lang/siod/files/patch-sql_sybase
@@ -0,0 +1,273 @@
+--- sql_sybase.c 2014-03-25 04:10:42.000000000 -0400
++++ sql_sybase.c 2021-02-16 12:43:21.514873000 -0500
+@@ -19,6 +19,6 @@
+ #include <pwd.h>
+ #include <errno.h>
+-#include <ctpublic.h>
+-#include "siod.h"
++
++#include "sql_sybasec.c"
+
+ #ifdef SUN5
+@@ -31,21 +31,10 @@
+ NIL);}
+
+-char *sybase_retstr(CS_RETCODE n);
+-char *sybase_typestr(CS_INT n);
+-void init_sql_sybasec(void);
+-
+-long tc_sybase_state = 0;
+-
+-LISP sym_sybase = NIL;
+-LISP sym_sybase_messages = NIL;
+-
+-static void complain(char *msg, ...)
+-{va_list args;
+- char msgbuff[1024];
+- if (siod_verbose_check(1))
+- {va_start(args,msg);
+- vsprintf(msgbuff,msg,args);
+- va_end(args);
+- fprintf(stdout,"\nSYBASE: %s\n",msgbuff);}}
++static long tc_sybase_state = 0;
++
++static LISP sym_sybase = NIL;
++static LISP sym_sybase_messages = NIL;
++
++#define complain(...) fprintf(stderr, "\nSYBASE: " __VA_ARGS__)
+
+ struct sybase_state
+@@ -171,14 +160,14 @@
+ return(status);}
+
+-static char *getarg(LISP l,char *name,char *dflt)
++static char *getarg(LISP l, const char *name)
+ {LISP cell,key;
+ key = rintern(name);
+ for(cell=l;NNULLP(cell);cell=cdr(cdr(cell)))
+ if EQ(car(cell),key)
+- return(get_c_string(cadr(cell)));
+- return(dflt);}
++ return(get_string_data(cadr(cell)));
++ return(NULL);}
+
+ static LISP statcons(CS_RETCODE n)
+-{char *str;
++{const char *str;
+ if ((str = sybase_retstr(n)))
+ return(cintern(str));
+@@ -186,8 +175,8 @@
+ return(flocons(n));}
+
+-struct sybase_state *get_sybase_state(LISP ptr,long openp)
++static struct sybase_state *get_sybase_state(LISP ptr, long openp)
+ {struct sybase_state *s;
+ if TYPEP(ptr,tc_sybase_state)
+- {if ((s = (struct sybase_state *) ptr->storage_as.string.data))
++ {if ((s = (struct sybase_state *)(void *)ptr->storage_as.string.data))
+ return(s);
+ else if (openp)
+@@ -200,5 +189,5 @@
+ return(NULL);}}
+
+-LISP sybase_open(LISP args)
++static LISP sybase_open(LISP args)
+ {int iflag;
+ CS_RETCODE status;
+@@ -212,7 +201,7 @@
+ setvar(sym_sybase_messages,NIL,NIL);
+ status = sybase_setup(get_sybase_state(value,0),
+- getarg(args,"username","sa"),
+- getarg(args,"password",""),
+- getarg(args,"appname","htqx"));
++ getarg(args,"username"),
++ getarg(args,"password"),
++ getarg(args,"appname"));
+ no_interrupt(iflag);
+ if (status != CS_SUCCEED)
+@@ -222,5 +211,5 @@
+ return(value);}
+
+-LISP sybase_close(LISP value)
++static LISP sybase_close(LISP value)
+ {int iflag;
+ CS_RETCODE status;
+@@ -240,5 +229,5 @@
+ return(statcons(status));}
+
+-LISP sybase_status(LISP value)
++static LISP sybase_status(LISP value)
+ {int iflag;
+ CS_RETCODE status;
+@@ -290,5 +279,5 @@
+ for the above sort of thing */
+
+-CS_RETCODE CS_PUBLIC fetch_data(CS_COMMAND *cmd,LISP *header,LISP *items)
++static CS_RETCODE CS_PUBLIC fetch_data(CS_COMMAND *cmd,LISP *header,LISP *items)
+ {CS_RETCODE retcode;
+ CS_INT num_cols,i,row_count = 0,rows_read = 0;
+@@ -463,8 +452,8 @@
+ static CS_INT *param_data = NULL;
+
+-LISP sybase_execute(LISP arglist)
++static LISP sybase_execute(LISP arglist)
+ {CS_RETCODE status = CS_SUCCEED;
+ LISP obj,str,kind,args;
+- char *cmdstr,*argname;
++ const char *cmdstr, *argname;
+ int iflag,j,m;
+ CS_INT restype,ivalue;
+@@ -489,6 +478,6 @@
+ iflag = no_interrupt(1);
+ if (!param_fmt)
+- {param_fmt = (CS_DATAFMT *) malloc(sizeof(CS_DATAFMT) * MAX_PARAM_ARGS);
+- param_data = (CS_INT *) malloc(sizeof(CS_INT) * MAX_PARAM_ARGS);}
++ {param_fmt = malloc(sizeof(CS_DATAFMT) * MAX_PARAM_ARGS);
++ param_data = malloc(sizeof(CS_INT) * MAX_PARAM_ARGS);}
+ status = ct_command(sybase_state->cmd,
+ NNULLP(kind) ? get_c_long(kind) : CS_LANG_CMD,
+@@ -537,7 +526,6 @@
+ param_fmt[j].maxlength = datalen;}
+ break;
+- case tc_symbol:
+ case tc_string:
+- data = get_c_string(argvalue);
++ data = get_string_data(argvalue);
+ datalen = strlen(data);
+ param_fmt[j].datatype = CS_CHAR_TYPE;
+@@ -560,5 +548,5 @@
+ status = ct_param(sybase_state->cmd,
+ &param_fmt[j],data,datalen,
+- CS_UNUSED);
++ (CS_SMALLINT)CS_UNUSED);
+ if (status != CS_SUCCEED)
+ {complain("sybase-execute ct_param %d",status);
+@@ -630,5 +618,5 @@
+ static long ignore_msgs[] = {5701,5703,5704};
+
+-void push_sybase_messages(LISP value)
++static void push_sybase_messages(LISP value)
+ {setvar(sym_sybase_messages,
+ cons(value,leval(sym_sybase_messages,NIL)),
+@@ -636,8 +624,8 @@
+
+
+-static CS_RETCODE server_err_handler(CS_CONTEXT *cp,
+- CS_CONNECTION *chp,
++static CS_RETCODE server_err_handler(CS_CONTEXT *cp __unused,
++ CS_CONNECTION *chp __unused,
+ CS_SERVERMSG *msgp)
+-{long j,docomplain = 1;
++{size_t j,docomplain = 1;
+ for(j=0;j<(sizeof(ignore_msgs)/sizeof(ignore_msgs[0]));++j)
+ if (msgp->msgnumber == ignore_msgs[j])
+@@ -657,6 +645,6 @@
+ return(CS_SUCCEED);}
+
+-static CS_RETCODE client_err_handler(CS_CONTEXT *cp,
+- CS_CONNECTION *chp,
++static CS_RETCODE client_err_handler(CS_CONTEXT *cp __unused,
++ CS_CONNECTION *chp __unused,
+ CS_CLIENTMSG *emsgp)
+ {LISP note;
+@@ -681,7 +669,7 @@
+ return (CS_SUCCEED);}
+
+-static CS_RETCODE cs_err_handler(CS_CONTEXT *cp,CS_CLIENTMSG *msg)
++static CS_RETCODE cs_err_handler(CS_CONTEXT *cp __unused, CS_CLIENTMSG *msg)
+ {LISP note;
+- complain("CS-Library error %ld/%ld/%ld/%ld - %s",
++ complain("CS-Library error %d/%d/%d/%d - %s",
+ CS_LAYER(msg->msgnumber),
+ CS_ORIGIN(msg->msgnumber),
+@@ -690,5 +678,5 @@
+ msg->msgstring);
+ if (msg->osstringlen > 0)
+- complain("CS-Library OS error %ld - %s.",
++ complain("CS-Library OS error %d - %s.",
+ msg->osnumber, msg->osstring);
+ note = listn(6,
+@@ -708,16 +696,18 @@
+ return (CS_SUCCEED);}
+
+-void sybase_prin1(LISP ptr,struct gen_printio *f)
++static void sybase_prin1(LISP ptr,struct gen_printio *f)
+ {char buff[256];
+ sprintf(buff,"#<SYBASE %p>",ptr->storage_as.string.data);
+ gput_st(f,buff);}
+
+-void sybase_gc_free(LISP ptr)
++static void sybase_gc_free(LISP ptr)
+ {struct sybase_state *sybase_state;
+- if ((sybase_state = (struct sybase_state *) ptr->storage_as.string.data))
++ if ((sybase_state = (struct sybase_state *)(void *)ptr->storage_as.string.data))
+ {sybase_teardown(sybase_state);
+ free(ptr->storage_as.string.data);
+ ptr->storage_as.string.data = NULL;}}
+
++void init_sql_sybase(void); /* Our sole exported symbol - the entrypoint */
++
+ void init_sql_sybase(void)
+ {long j;
+--- sql_sybasec.c 2014-03-25 04:10:42.000000000 -0400
++++ sql_sybasec.c 2021-02-16 12:42:51.031627000 -0500
+@@ -10,9 +10,9 @@
+ struct a_cs_retcode
+ {CS_RETCODE n;
+- char *name;};
++ const char *name;};
+
+ struct a_cs_int
+ {CS_INT n;
+- char *name;};
++ const char *name;};
+
+ static struct a_cs_retcode retcodes[] = {
+@@ -34,4 +34,5 @@
+ {CS_NOMSG, "CS_NOMSG"},
+ {CS_TIMED_OUT, "CS_TIMED_OUT"},
++#ifdef CS_PASSTHRU_EOM /* A bunch of defines not provided by FreeTDS */
+ {CS_PASSTHRU_EOM, "CS_PASSTHRU_EOM"},
+ {CS_PASSTHRU_MORE, "CS_PASSTHRU_MORE"},
+@@ -55,12 +56,18 @@
+ {CS_ESTYLE, "CS_ESTYLE"},
+ {CS_EBADXLT, "CS_EBADXLT"},
+- {CS_ENOXLT, "CS_ENOXLT"}};
++ {CS_ENOXLT, "CS_ENOXLT"}
++#endif
++};
+
+ static struct a_cs_int cmds[] = {
+ {CS_LANG_CMD, "CS_LANG_CMD"},
+ {CS_RPC_CMD, "CS_RPC_CMD"},
++#ifdef CS_MSG_CMD
+ {CS_MSG_CMD, "CS_MSG_CMD"},
++#endif
+ {CS_SEND_DATA_CMD, "CS_SEND_DATA_CMD"},
++#ifdef CS_PACKAGE_CMD
+ {CS_PACKAGE_CMD, "CS_PACKAGE_CMD"},
++#endif
+ {CS_SEND_BULK_CMD, "CS_SEND_BULK_CMD"}};
+
+@@ -91,5 +98,5 @@
+ {CS_BOUNDARY_TYPE, "CS_BOUNDARY_TYPE"}};
+
+-char *sybase_retstr(CS_RETCODE n)
++static const char *sybase_retstr(CS_RETCODE n)
+ {long j,m;
+ m = sizeof(retcodes) / sizeof(struct a_cs_retcode);
+@@ -99,5 +106,5 @@
+ return(NULL);}
+
+-char *sybase_typestr(CS_INT n)
++static const char *sybase_typestr(CS_INT n)
+ {long j,m;
+ m = sizeof(types) / sizeof(struct a_cs_int);
+@@ -107,6 +114,5 @@
+ return(NULL);}
+
+-
+-void init_sql_sybasec(void)
++static void init_sql_sybasec(void)
+ {long j,n;
+ n = sizeof(retcodes) / sizeof(struct a_cs_retcode);
diff --git a/lang/siod/files/patch-ss b/lang/siod/files/patch-ss
new file mode 100644
index 000000000000..56c6942c6560
--- /dev/null
+++ b/lang/siod/files/patch-ss
@@ -0,0 +1,332 @@
+--- ss.h 2014-03-25 04:10:42.000000000 -0400
++++ ss.h 2021-02-15 21:54:42.171506000 -0500
+@@ -16,11 +16,2 @@
+ (--(p)->ocnt < 0 ? ss_flsbuf((int)(c),(p)) : \
+ (int)(*(p)->optr++ = (unsigned char)(c)))
+-
+-
+-LISP s_open(LISP lhost,LISP lport,LISP aflag);
+-LISP s_close(LISP s);
+-int ss_filbuf(struct sock_stream *ss);
+-int ss_flsbuf(int c,struct sock_stream *ss);
+-struct sock_stream *get_ss(LISP s,long openchk);
+-void ss_force(struct sock_stream *ss);
+-LISP s_accept(LISP s,LISP tmo);
+--- ss.c 2014-03-25 04:25:34.000000000 -0400
++++ ss.c 2021-02-15 21:51:58.557028000 -0500
+@@ -72,5 +72,5 @@
+ static long tc_sock_stream = 0;
+
+-LISP lgetproto(LISP lproto)
++static LISP lgetproto(LISP lproto)
+ {long iflag,j;
+ LISP result = NIL;
+@@ -84,5 +84,5 @@
+ return(nreverse(result));}
+
+-LISP lgetservice(LISP lport,LISP lproto)
++static LISP lgetservice(LISP lport,LISP lproto)
+ {long iflag,j;
+ LISP result = NIL;
+@@ -98,5 +98,5 @@
+ return(nreverse(result));}
+
+-LISP s_open(LISP lhost,LISP lport,LISP aflag)
++static LISP s_open(LISP lhost,LISP lport,LISP aflag)
+ /* to make these "easy" we have over-encapsulated things
+ a bit. at some point rework things, but for now the
+@@ -107,5 +107,5 @@
+ short port;
+ LISP s;
+- char *hname;
++ const char *hname;
+ struct sockaddr_in local, remote;
+ struct hostent *hostinfo;
+@@ -187,5 +187,5 @@
+ return(s);}
+
+-LISP gethostbyaddr_l(LISP addr)
++static LISP gethostbyaddr_l(LISP addr)
+ {struct hostent *hostinfo;
+ unsigned int x;
+@@ -196,5 +196,5 @@
+ return(strcons(strlen(hostinfo->h_name),hostinfo->h_name));}
+
+-LISP decode_hostent(struct hostent *p)
++static LISP decode_hostent(struct hostent *p)
+ {LISP name;
+ LISP aliases = NIL,addr_list = NIL,addr;
+@@ -215,5 +215,5 @@
+ cons(cintern("addrtype"),flocons(p->h_addrtype))));}
+
+-LISP gethostbyname_l(LISP name)
++static LISP gethostbyname_l(LISP name)
+ {struct hostent *hostinfo;
+ if (!(hostinfo = gethostbyname(get_c_string(name))))
+@@ -221,5 +221,5 @@
+ return(decode_hostent(hostinfo));}
+
+-LISP inet_addr_l(LISP str)
++static LISP inet_addr_l(LISP str)
+ {unsigned int x;
+ double g;
+@@ -228,5 +228,5 @@
+ if (str->storage_as.string.dim != 4)
+ err("address must be 4 bytes",str);
+- x = *((int *)str->storage_as.string.data);
++ x = *((unsigned int *)(void *)str->storage_as.string.data);
+ break;
+ default:
+@@ -240,5 +240,5 @@
+ return(NIL);}
+
+-LISP inet_ntoa_l(LISP str)
++static LISP inet_ntoa_l(LISP str)
+ {char buff[50];
+ unsigned int x;
+@@ -284,5 +284,7 @@
+ #endif
+
+-LISP s_accept(LISP as,LISP tmo)
++static struct sock_stream *get_ss(LISP s, long openchk);
++
++static LISP s_accept(LISP as, LISP tmo)
+ {struct sock_stream *ss;
+ int iflag,sd;
+@@ -320,12 +322,12 @@
+ return(s);}
+
+-struct sock_stream *get_ss(LISP s,long openchk)
++static struct sock_stream *get_ss(LISP s, long openchk)
+ {if NTYPEP(s,tc_sock_stream)
+ err("not a socket stream",s);
+ if (openchk && !s->storage_as.string.dim)
+ err("socket is closed",s);
+- return((struct sock_stream *) s->storage_as.string.data);}
++ return((struct sock_stream *)(void *)s->storage_as.string.data);}
+
+-LISP s_close(LISP s)
++static LISP s_close(LISP s)
+ {struct sock_stream *ss;
+ int iflag,sd;
+@@ -344,5 +346,5 @@
+
+
+-LISP s_shutdown(LISP s,LISP flag)
++static LISP s_shutdown(LISP s, LISP flag)
+ {struct sock_stream *ss;
+ int iflag,sd,how;
+@@ -363,5 +365,5 @@
+ return(NIL);}
+
+-int ss_filbuf(struct sock_stream *ss)
++static int ss_filbuf(struct sock_stream *ss)
+ {int status;
+ ss->icnt = 0;
+@@ -388,5 +390,5 @@
+ }
+
+-void ss_force(struct sock_stream *ss)
++static void ss_force(struct sock_stream *ss)
+ {int status,size,j;
+ size = ss->bufsiz - ((ss->ocnt > 0) ? ss->ocnt : 0);
+@@ -399,5 +401,5 @@
+ sent_zero();}
+
+-int ss_flsbuf(int c,struct sock_stream *ss)
++static int ss_flsbuf(int c, struct sock_stream *ss)
+ {ss_force(ss);
+ --(ss)->ocnt;
+@@ -405,5 +407,5 @@
+ return(c);}
+
+-LISP s_getc(LISP s)
++static LISP s_getc(LISP s)
+ {struct sock_stream *ss = get_ss(s,1);
+ int c,iflag;
+@@ -413,8 +415,8 @@
+ return((c == EOF) ? NIL : flocons(c));}
+
+-LISP s_icnt(LISP s)
++static LISP s_icnt(LISP s)
+ {return(flocons(get_ss(s,1)->icnt));}
+
+-LISP s_putc(LISP lc,LISP s)
++static LISP s_putc(LISP lc,LISP s)
+ {struct sock_stream *ss = get_ss(s,1);
+ int c = get_c_long(lc),iflag;
+@@ -424,7 +426,7 @@
+ return(NIL);}
+
+-LISP s_puts(LISP str,LISP s)
++static LISP s_puts(LISP str,LISP s)
+ {struct sock_stream *ss = get_ss(s,1);
+- char *data = get_c_string(str);
++ const char *data = get_c_string(str);
+ int c,iflag;
+ iflag = no_interrupt(1);
+@@ -433,7 +435,7 @@
+ return(NIL);}
+
+-LISP s_write(LISP string,LISP file)
++static LISP s_write(LISP string,LISP file)
+ {long flag;
+- char *data;
++ const char *data;
+ struct sock_stream *ss = get_ss(file,1);
+ long j,dim,len,status;
+@@ -457,5 +459,5 @@
+ return(NIL);}
+
+-LISP s_drain(LISP s)
++static LISP s_drain(LISP s)
+ {struct sock_stream *ss = get_ss(s,1);
+ int c,iflag;
+@@ -465,7 +467,8 @@
+ return(NIL);}
+
+-LISP s_gets(LISP str,LISP s)
++static LISP s_gets(LISP str,LISP s)
+ {struct sock_stream *ss;
+- int c,iflag,j;
++ int c, iflag;
++ size_t j;
+ char buffer[4096];
+ if NULLP(s)
+@@ -490,5 +493,5 @@
+ return(strcons(j,buffer));}
+
+-LISP s_read(LISP size,LISP file)
++static LISP s_read(LISP size, LISP file)
+ {long flag,n,ret,m,maxlen;
+ char *buffer;
+@@ -508,5 +511,6 @@
+ case tc_cons:
+ s = car(size);
+- buffer = get_c_string_dim(s,&maxlen);
++ buffer = get_string_data(s);
++ maxlen = s->storage_as.string.dim;
+ n = get_c_long(cadr(size));
+ if (n > maxlen)
+@@ -516,5 +520,5 @@
+ default:
+ n = get_c_long(size);
+- buffer = (char *) must_malloc(n+1);
++ buffer = must_malloc(n+1);
+ buffer[n] = 0;
+ m = 1;}
+@@ -547,5 +551,5 @@
+
+
+-LISP s_force_output(LISP s)
++static LISP s_force_output(LISP s)
+ {struct sock_stream *ss = get_ss(s,1);
+ int iflag;
+@@ -555,5 +559,5 @@
+ return(NIL);}
+
+-void ss_gc_free(LISP s)
++static void ss_gc_free(LISP s)
+ {struct sock_stream *ss;
+ ss = get_ss(s,0);
+@@ -564,10 +568,11 @@
+ free(ss);}}
+
+-void ss_prin1(LISP s,struct gen_printio *f)
++static void ss_prin1(LISP s,struct gen_printio *f)
+ {char buff[512];
+ unsigned char *p;
+ struct sock_stream *ss;
+ struct sockaddr_in a;
+- size_t len,j;
++ size_t j;
++ socklen_t len;
+ ss = get_ss(s,0);
+ if (s->storage_as.string.dim)
+@@ -590,8 +595,8 @@
+ #ifndef WIN32
+
+-LISP l_getname(int (*fcn)(int fn, struct sockaddr *,size_t *),char *msg,LISP s)
++static LISP l_getname(int (*fcn)(int fn, struct sockaddr *, socklen_t *), const char *msg, LISP s)
+ {struct sock_stream *ss = get_ss(s,1);
+ struct sockaddr_in a;
+- size_t len;
++ socklen_t len;
+ char buff[512];
+ unsigned char *p;
+@@ -602,11 +607,11 @@
+ sprintf(buff,"%d.%d.%d.%d:%d",(int)p[0],(int)p[1],(int)p[2],(int)p[3],
+ (int)ntohs(a.sin_port));
+- printf("buff is %d long\n",strlen(buff));
++ printf("buff is %zu long\n", strlen(buff));
+ return(strcons(-1,buff));}
+
+-LISP l_getsockname(LISP s)
++static LISP l_getsockname(LISP s)
+ {return(l_getname(getsockname,"getsockname",s));}
+
+-LISP l_getpeername(LISP s)
++static LISP l_getpeername(LISP s)
+ {return(l_getname(getpeername,"getpeername",s));}
+
+@@ -618,5 +623,5 @@
+
+
+-LISP l_getsockname(LISP s)
++static LISP l_getsockname(LISP s)
+ {struct sock_stream *ss = get_ss(s,1);
+ struct sockaddr_in a;
+@@ -632,5 +637,5 @@
+ return(strcons(-1,buff));}
+
+-LISP l_getpeername(LISP s)
++static LISP l_getpeername(LISP s)
+ {struct sock_stream *ss = get_ss(s,1);
+ struct sockaddr_in a;
+@@ -646,10 +651,7 @@
+ return(strcons(-1,buff));}
+
+-
+-
+ #endif
+-
+
+-int ss_getc_fcn(struct sock_stream *ss)
++static int ss_getc_fcn(struct sock_stream *ss)
+ {int c,iflag;
+ iflag = no_interrupt(1);
+@@ -658,5 +660,5 @@
+ return(c);}
+
+-void ss_ungetc_fcn(int c,struct sock_stream *ss)
++static void ss_ungetc_fcn(int c,struct sock_stream *ss)
+ {int iflag;
+ if (c == EOF) return;
+@@ -668,5 +670,5 @@
+ no_interrupt(iflag);}
+
+-LISP s_read_sexp(LISP s)
++static LISP s_read_sexp(LISP s)
+ {struct gen_readio r;
+ r.getc_fcn = (int (*)(void *)) ss_getc_fcn;
+@@ -675,5 +677,5 @@
+ return(readtl(&r));}
+
+-LISP lgethostname(void)
++static LISP lgethostname(void)
+ {char buff[256];
+ if (gethostname(buff,sizeof(buff)))
+@@ -684,5 +686,5 @@
+ #if defined(unix)
+
+-LISP lgethostid(void)
++static LISP lgethostid(void)
+ {return(flocons(gethostid()));}
+
+@@ -701,4 +703,6 @@
+ #endif
+
++void init_ss(void); /* Our sole exported symbol */
++
+ void init_ss(void)
+ {long j;
diff --git a/lang/siod/files/patch-tar b/lang/siod/files/patch-tar
new file mode 100644
index 000000000000..b4e9069e6cdd
--- /dev/null
+++ b/lang/siod/files/patch-tar
@@ -0,0 +1,61 @@
+--- tar.c 2014-03-25 04:10:42.000000000 -0400
++++ tar.c 2021-02-15 21:31:22.208797000 -0500
+@@ -41,5 +41,5 @@
+ #define SAFE_ATOL8(_buff) (safe_atol8((_buff),sizeof(_buff)))
+
+-LISP decode_tartype(char c)
++static LISP decode_tartype(char c)
+ {switch(c)
+ {case 0:
+@@ -61,13 +61,13 @@
+ return(NIL);}}
+
+-static struct tar_header *get_tar_header(LISP bytes)
+-{long n;
+- struct tar_header *h;
+- h = (struct tar_header *) get_c_string_dim(bytes,&n);
++static const struct tar_header *get_tar_header(LISP bytes)
++{unsigned long n;
++ const struct tar_header *h;
++ h = (const struct tar_header *) get_c_string_dim(bytes,&n);
+ if (n < sizeof(struct tar_header)) err("too small for tar header",bytes);
+ return(h);}
+
+-LISP decode_tar_header(LISP bytes)
+-{struct tar_header *h = get_tar_header(bytes);
++static LISP decode_tar_header(LISP bytes)
++{const struct tar_header *h = get_tar_header(bytes);
+ return(listn(16,
+ cons(cintern("name"),
+@@ -104,14 +104,14 @@
+ strcons(SAFE_STRLEN(h->prefix),h->prefix))));}
+
+-static unsigned long checksum(void *start,
+- void *end)
+-{unsigned char *ptr;
++static unsigned long checksum(const void *start,
++ const void *end)
++{const unsigned char *ptr;
+ unsigned long sum = 0;
+- for(ptr=(unsigned char *)start;ptr<(unsigned char *)end;++ptr)
++ for(ptr=(const unsigned char *)start; ptr < (const unsigned char *)end; ++ptr)
+ sum += *ptr;
+ return(sum);}
+
+-LISP checksum_tar_header(LISP bytes,LISP whole)
+-{struct tar_header *h = get_tar_header(bytes);
++static LISP checksum_tar_header(LISP bytes,LISP whole)
++{const struct tar_header *h = get_tar_header(bytes);
+ if NNULLP(whole)
+ return(flocons(checksum(&h->name[0],
+@@ -123,4 +123,6 @@
+ &h->end_pad[sizeof(h->end_pad)])));}
+
++void init_tar(void); /* Our sole exported function */
++
+ void init_tar(void)
+ {init_subr_1("decode-tar-header",decode_tar_header);
+@@ -130,3 +132,2 @@
+ NIL);
+ init_tar_version();}
+-