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

Apply patches to build on DragonFly BSD and (older) FreeBSD

This now makes ksh build on DragonFly BSD.

bin/package, src/cmd/INIT/package.sh:
- DragonFly also needs the -lm hack for LDFLAGS.

src/cmd/ksh93/sh/main.c, src/cmd/ksh93/tests/basic.sh:
- fixargs() doesn't work on DragonFly either
  (re: 9b7c392a, 159fb9ee, cefe087d).

The following are backported from:
https://github.com/att/ast/issues/26#issuecomment-313927854
https://github.com/att/ast/pull/19

src/lib/libast/comp/setlocale.c:
- Add missing #include <errno.h> since errno is used.

src/lib/libast/features/standards:
- Do not set any standards macros (_POSIX_SOURCE etc) on FreeBSD or
  DragonflyBSD; they disable too much functionality on those.

src/lib/libast/features/wchar:
- Set _STDFILE_DECLARED on DragonFly, too.

src/lib/libast/include/sfio.h, src/lib/libast/include/sfio_t.h,
src/lib/libast/sfio/_sfopen.c, src/lib/libast/sfio/sfclrlock.c,
src/lib/libast/sfio/sfhdr.h, src/lib/libast/sfio/sfnew.c,
src/lib/libast/sfio/sfset.c:
- Rename SF_* macros to SFIO_* to avoid a conflict with system
  headers.

src/lib/libast/string/strexpr.c:
- Rename error() to err() to avoid a conflict.
This commit is contained in:
Martijn Dekker 2021-01-18 09:08:48 +00:00
parent 8633290e63
commit 4dcf5c5066
15 changed files with 45 additions and 30 deletions

View file

@ -55,7 +55,7 @@ char* mode; /* mode of the stream */
{ SFMTXENTER(f, NIL(Sfio_t*));
if(f->mode&SF_INIT ) /* stream uninitialized, ok to set flags */
{ f->flags |= (sflags & (SF_FLAGS & ~SF_RDWR));
{ f->flags |= (sflags & (SFIO_FLAGS & ~SF_RDWR));
if((sflags &= SF_RDWR) != 0) /* reset read/write modes */
{ f->flags = (f->flags & ~SF_RDWR) | sflags;

View file

@ -57,7 +57,7 @@ Sfio_t *f;
/* throw away all lock bits except for stacking state SF_PUSH */
f->mode &= (SF_RDWR|SF_INIT|SF_POOL|SF_PUSH|SF_SYNCED|SF_STDIO);
rv = (f->mode&SF_PUSH) ? 0 : (f->flags&SF_FLAGS);
rv = (f->mode&SF_PUSH) ? 0 : (f->flags&SFIO_FLAGS);
SFMTXRETURN(f, rv);
}

View file

@ -1306,8 +1306,8 @@ extern int poll _ARG_((ulong, struct pollfd*, int));
_END_EXTERNS_
#ifdef _SF_HIDESFFLAGS
#undef SF_FLAGS
#define SF_FLAGS 0177177 /* PUBLIC FLAGS PASSABLE TO SFNEW() */
#undef SFIO_FLAGS
#define SFIO_FLAGS 0177177 /* PUBLIC FLAGS PASSABLE TO SFNEW() */
#endif
#endif /*_SFHDR_H*/

View file

@ -106,7 +106,7 @@ int flags; /* type of file stream */
/* stream type */
f->mode = (flags&SF_READ) ? SF_READ : SF_WRITE;
f->flags = (flags&SF_FLAGS) | (sflags&(SF_MALLOC|SF_STATIC));
f->flags = (flags&SFIO_FLAGS) | (sflags&(SF_MALLOC|SF_STATIC));
f->bits = (flags&SF_RDWR) == SF_RDWR ? SF_BOTH : 0;
f->file = file;
f->here = f->extent = 0;

View file

@ -41,7 +41,7 @@ int set;
SFMTXENTER(f,0);
if(flags == 0 && set == 0)
SFMTXRETURN(f, (f->flags&SF_FLAGS));
SFMTXRETURN(f, (f->flags&SFIO_FLAGS));
if((oflags = (f->mode&SF_RDWR)) != (int)f->mode)
{ /* avoid sfsetbuf() isatty() call if user sets (SF_LINE|SF_WCWIDTH) */
@ -57,7 +57,7 @@ int set;
SFMTXRETURN(f, 0);
}
if(flags == 0)
SFMTXRETURN(f, (f->flags&SF_FLAGS));
SFMTXRETURN(f, (f->flags&SFIO_FLAGS));
SFLOCK(f,0);
@ -95,5 +95,5 @@ int set;
f->flags &= ~SF_PUBLIC;
SFOPEN(f,0);
SFMTXRETURN(f, (oflags&SF_FLAGS));
SFMTXRETURN(f, (oflags&SFIO_FLAGS));
}