chiark / gitweb /
portability: Provide implementation of fmemopen
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 26 Nov 2019 22:16:22 +0000 (22:16 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Dec 2019 17:08:51 +0000 (17:08 +0000)
commitf38db8f2049fb35c32bb801f4a6fff6a509d8e06
treef67847f12acf14b049bc86c97366aa377ead1724
parent1ff49f93eeb1104b13ab76065be13068367db342
portability: Provide implementation of fmemopen

We are going to want one of these.  I have tested it as follows:

1. In configure.ac just before AC_CHECK_FUNCS, add:  LIBS+=-lbsd
2. In osdep.c, add:  #include <bsd/stdio.h>
3. Change all fmemopen to Yfmemopen, with
     git-ls-files | perl -lne 'print if lstat and -f _' | xargs perl -i~ -pe 's/fmemopen/Y$&/gi'

The result is that we do not find Yfmemopen.  The tests still pass and
I have verified that my stunt implementation is called.

FTR, this rune undoes the Y:
     git-ls-files | perl -lne 'print if lstat and -f _' | xargs perl -i~ -pe 's/Y(fmemopen)/$1/gi'

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
config.h.in
configure
configure.ac
osdep.c
osdep.h