sprinkle CONSERVATIVE_FDS for many older OSes; DISABLE_TTY_WARNING for BeOS and Coherent (probably more to come); NO_CMDLINE_EDITING to Plan 9; put Hurd NO_PATH_MAX into MKSH__ private namespace

This commit is contained in:
tg 2012-05-05 17:37:44 +00:00
parent 29e36ed2a2
commit ea8f29f428
3 changed files with 22 additions and 12 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.563 2012/05/04 22:34:49 tg Exp $' srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.564 2012/05/05 17:37:42 tg Exp $'
#- #-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 # 2011, 2012
@ -477,6 +477,7 @@ case $TARGET_OS in
: ${HAVE_CAN_OTWO=0} : ${HAVE_CAN_OTWO=0}
add_cppflags -DMKSH_NO_SIGSETJMP add_cppflags -DMKSH_NO_SIGSETJMP
add_cppflags -DMKSH_TYPEDEF_SIG_ATOMIC_T=int add_cppflags -DMKSH_TYPEDEF_SIG_ATOMIC_T=int
add_cppflags -DMKSH_CONSERVATIVE_FDS
;; ;;
AIX) AIX)
add_cppflags -D_ALL_SOURCE add_cppflags -D_ALL_SOURCE
@ -494,6 +495,7 @@ BeOS)
esac esac
# BeOS has no real tty either # BeOS has no real tty either
add_cppflags -DMKSH_UNEMPLOYED add_cppflags -DMKSH_UNEMPLOYED
add_cppflags -DMKSH_DISABLE_TTY_WARNING
# BeOS doesn't have different UIDs and GIDs # BeOS doesn't have different UIDs and GIDs
add_cppflags -DMKSH__NO_SETEUGID add_cppflags -DMKSH__NO_SETEUGID
;; ;;
@ -505,6 +507,8 @@ Coherent)
add_cppflags -DMKSH__NO_SYMLINK add_cppflags -DMKSH__NO_SYMLINK
check_categories="$check_categories nosymlink" check_categories="$check_categories nosymlink"
add_cppflags -DMKSH__NO_SETEUGID add_cppflags -DMKSH__NO_SETEUGID
add_cppflags -DMKSH_CONSERVATIVE_FDS
add_cppflags -DMKSH_DISABLE_TTY_WARNING
;; ;;
CYGWIN*) CYGWIN*)
: ${HAVE_SETLOCALE_CTYPE=0} : ${HAVE_SETLOCALE_CTYPE=0}
@ -518,6 +522,7 @@ FreeBSD)
FreeMiNT) FreeMiNT)
oswarn="; it has minor issues" oswarn="; it has minor issues"
add_cppflags -D_GNU_SOURCE add_cppflags -D_GNU_SOURCE
add_cppflags -DMKSH_CONSERVATIVE_FDS
: ${HAVE_SETLOCALE_CTYPE=0} : ${HAVE_SETLOCALE_CTYPE=0}
;; ;;
GNU) GNU)
@ -525,8 +530,8 @@ GNU)
*tendracc*) ;; *tendracc*) ;;
*) add_cppflags -D_GNU_SOURCE ;; *) add_cppflags -D_GNU_SOURCE ;;
esac esac
# define NO_PATH_MAX to use Hurd-only functions # define MKSH__NO_PATH_MAX to use Hurd-only functions
add_cppflags -DNO_PATH_MAX add_cppflags -DMKSH__NO_PATH_MAX
;; ;;
GNU/kFreeBSD) GNU/kFreeBSD)
case $CC in case $CC in
@ -594,6 +599,7 @@ NEXTSTEP)
oswarn="; it needs libposix.a" oswarn="; it needs libposix.a"
;; ;;
esac esac
add_cppflags -DMKSH_CONSERVATIVE_FDS
;; ;;
Ninix3) Ninix3)
# similar to Minix3 # similar to Minix3
@ -620,6 +626,7 @@ Plan9)
add_cppflags -D_BSD_EXTENSION add_cppflags -D_BSD_EXTENSION
add_cppflags -D_SUSV2_SOURCE add_cppflags -D_SUSV2_SOURCE
add_cppflags -DMKSH_ASSUME_UTF8; HAVE_ISSET_MKSH_ASSUME_UTF8=1 add_cppflags -DMKSH_ASSUME_UTF8; HAVE_ISSET_MKSH_ASSUME_UTF8=1
add_cppflags -DMKSH_NO_CMDLINE_EDITING
oswarn=' and will currently not work' oswarn=' and will currently not work'
add_cppflags -DMKSH_UNEMPLOYED add_cppflags -DMKSH_UNEMPLOYED
;; ;;
@ -651,6 +658,7 @@ SCO_SV)
oswarn="$oswarn$nl$TARGET_OS ${TARGET_OSREV}, please tell me what to do" oswarn="$oswarn$nl$TARGET_OS ${TARGET_OSREV}, please tell me what to do"
;; ;;
esac esac
add_cppflags -DMKSH_CONSERVATIVE_FDS
: ${HAVE_SYS_SIGLIST=0} ${HAVE__SYS_SIGLIST=0} : ${HAVE_SYS_SIGLIST=0} ${HAVE__SYS_SIGLIST=0}
;; ;;
skyos) skyos)
@ -667,10 +675,12 @@ syllable)
ULTRIX) ULTRIX)
: ${CC=cc -YPOSIX} : ${CC=cc -YPOSIX}
add_cppflags -DMKSH_TYPEDEF_SSIZE_T=int add_cppflags -DMKSH_TYPEDEF_SSIZE_T=int
add_cppflags -DMKSH_CONSERVATIVE_FDS
: ${HAVE_SETLOCALE_CTYPE=0} : ${HAVE_SETLOCALE_CTYPE=0}
;; ;;
UnixWare|UNIX_SV) UnixWare|UNIX_SV)
# SCO UnixWare # SCO UnixWare
add_cppflags -DMKSH_CONSERVATIVE_FDS
: ${HAVE_SYS_SIGLIST=0} ${HAVE__SYS_SIGLIST=0} : ${HAVE_SYS_SIGLIST=0} ${HAVE__SYS_SIGLIST=0}
;; ;;
UWIN*) UWIN*)
@ -1410,7 +1420,7 @@ else
#define EXTERN #define EXTERN
#define MKSH_INCLUDES_ONLY #define MKSH_INCLUDES_ONLY
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.563 2012/05/04 22:34:49 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.564 2012/05/05 17:37:42 tg Exp $");
int main(void) { printf("Hello, World!\n"); return (0); } int main(void) { printf("Hello, World!\n"); return (0); }
EOF EOF
case $cm in case $cm in

10
misc.c
View File

@ -30,7 +30,7 @@
#include <grp.h> #include <grp.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.192 2012/05/05 15:10:39 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/misc.c,v 1.193 2012/05/05 17:37:43 tg Exp $");
/* type bits for unsigned char */ /* type bits for unsigned char */
unsigned char chtypes[UCHAR_MAX + 1]; unsigned char chtypes[UCHAR_MAX + 1];
@ -1288,7 +1288,7 @@ reset_nonblock(int fd)
char * char *
ksh_get_wd(void) ksh_get_wd(void)
{ {
#ifdef NO_PATH_MAX #ifdef MKSH__NO_PATH_MAX
char *rv, *cp; char *rv, *cp;
if ((cp = get_current_dir_name())) { if ((cp = get_current_dir_name())) {
@ -1321,7 +1321,7 @@ do_realpath(const char *upath)
size_t len; size_t len;
int llen; int llen;
struct stat sb; struct stat sb;
#ifdef NO_PATH_MAX #ifdef MKSH__NO_PATH_MAX
size_t ldestlen = 0; size_t ldestlen = 0;
#define pathlen sb.st_size #define pathlen sb.st_size
#define pathcnd (ldestlen < (pathlen + 1)) #define pathcnd (ldestlen < (pathlen + 1))
@ -1418,7 +1418,7 @@ do_realpath(const char *upath)
/* get symlink(7) target */ /* get symlink(7) target */
if (pathcnd) { if (pathcnd) {
#ifdef NO_PATH_MAX #ifdef MKSH__NO_PATH_MAX
if (notoktoadd(pathlen, 1)) { if (notoktoadd(pathlen, 1)) {
errno = ENAMETOOLONG; errno = ENAMETOOLONG;
goto notfound; goto notfound;
@ -1806,7 +1806,7 @@ c_cd(const char **wp)
return (2); return (2);
} }
#ifdef NO_PATH_MAX #ifdef MKSH__NO_PATH_MAX
/* only a first guess; make_path will enlarge xs if necessary */ /* only a first guess; make_path will enlarge xs if necessary */
XinitN(xs, 1024, ATEMP); XinitN(xs, 1024, ATEMP);
#else #else

6
sh.h
View File

@ -157,7 +157,7 @@
#endif #endif
#ifdef EXTERN #ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.558 2012/05/04 22:44:34 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.559 2012/05/05 17:37:44 tg Exp $");
#endif #endif
#define MKSH_VERSION "R40 2012/05/04" #define MKSH_VERSION "R40 2012/05/04"
@ -289,7 +289,7 @@ struct rusage {
#define ksh_isdash(s) (((s) != NULL) && ((s)[0] == '-') && ((s)[1] == '\0')) #define ksh_isdash(s) (((s) != NULL) && ((s)[0] == '-') && ((s)[1] == '\0'))
#define ksh_isspace(c) ((((c) >= 0x09) && ((c) <= 0x0D)) || ((c) == 0x20)) #define ksh_isspace(c) ((((c) >= 0x09) && ((c) <= 0x0D)) || ((c) == 0x20))
#ifdef NO_PATH_MAX #ifdef MKSH__NO_PATH_MAX
#undef PATH_MAX #undef PATH_MAX
#else #else
#ifndef PATH_MAX #ifndef PATH_MAX
@ -571,7 +571,7 @@ im_sorry_dave(void)
#define free_ossetmode(p) free(p) #define free_ossetmode(p) free(p)
#endif #endif
#ifdef NO_PATH_MAX #ifdef MKSH__NO_PATH_MAX
/* GNU libc: get_current_dir_name(3) -> free(3) */ /* GNU libc: get_current_dir_name(3) -> free(3) */
#define free_gnu_gcdn(p) free(p) #define free_gnu_gcdn(p) free(p)
#endif #endif