1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

iffe: revert <stdio.h> removal, add different fix (re: 308696ec)

Commit 308696ec caused the build to fail on macOS Catalina.

src/cmd/INIT/iffe.sh:
- Fix a blatantly unportable practice of passing multiple
  "|"-separated 'case' patterns through a variable. This was a way
  of grepping for some headers including stdio.h, but it only works
  this way on ksh93 and possibly the original Bourne shell, and not
  on *any* other shell (not even pdksh or mksh) -- and the fact
  that it works on ksh93 is arguably a bug. Fix by eliminating the
  "noext" variable (which is init'ed once and never changes) and
  using the pattern in the relevant 'case' statement directly.

src/cmd/builtin/features/pty:
- No matter what I try, including <stdio.h> causes the build to
  fail on Gentoo Linux (i386) with mysterious "invalid identifier:
  off64_t" errors -- this is probably some AST preprocessor hackery
  gone awry, but I've no idea where to even begin with that. This
  works around the problem by using AST sfio instead, which is
  built and functional by the time this feature test is run.
- Remove explicit extern declaration for ptsname(2) that was never
  used because it depended on an npt_ptsname feature test that
  doesn't exist (or no longer exists).
- Add missing <fcntl.h>, <stdlib.h>, and <unistd.h> for open(2),
  ptsname(2) and close(2), respectively.

src/lib/libast/features/float,
src/lib/libast/features/sfio,
src/lib/libast/features/stdio:
- Re-include <stdio.h>.

Fixes: https://github.com/ksh93/ksh/issues/164 (I hope)
This commit is contained in:
Martijn Dekker 2021-01-27 15:03:06 +00:00
parent 399886daa9
commit 77ab60a149
5 changed files with 18 additions and 13 deletions

View file

@ -1327,7 +1327,6 @@ std='#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
#define _NIL_(x) ((x)0)'
tst=
ext="#include <stdio.h>"
noext='*[<"][Ss][Tt][Dd][Ii][Oo].[Hh][">]*|*<ast.h>*|*<sfio.h>*|*/[*]<NOSTDIO>[*]/*'
# loop on op [ arg [ ... ] ] [ : op [ arg [ ... ] ] ]
@ -3376,7 +3375,9 @@ int x;
esac
case $src in
?*) case $src in
$noext) EXT= ;;
*[\<\"][Ss][Tt][Dd][Ii][Oo].[Hh][\"\>]* | *\<ast.h\>* | *\<sfio.h\>* | */[*]\<NOSTDIO\>[*]/*)
EXT=
;;
*) EXT="$tst
$ext"
;;