From ea8f29f4282e99b39f6582e693e2481309869b3d Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 5 May 2012 17:37:44 +0000 Subject: [PATCH] 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 --- Build.sh | 18 ++++++++++++++---- misc.c | 10 +++++----- sh.h | 6 +++--- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Build.sh b/Build.sh index 5851586..17344fc 100644 --- a/Build.sh +++ b/Build.sh @@ -1,5 +1,5 @@ #!/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, # 2011, 2012 @@ -477,6 +477,7 @@ case $TARGET_OS in : ${HAVE_CAN_OTWO=0} add_cppflags -DMKSH_NO_SIGSETJMP add_cppflags -DMKSH_TYPEDEF_SIG_ATOMIC_T=int + add_cppflags -DMKSH_CONSERVATIVE_FDS ;; AIX) add_cppflags -D_ALL_SOURCE @@ -494,6 +495,7 @@ BeOS) esac # BeOS has no real tty either add_cppflags -DMKSH_UNEMPLOYED + add_cppflags -DMKSH_DISABLE_TTY_WARNING # BeOS doesn't have different UIDs and GIDs add_cppflags -DMKSH__NO_SETEUGID ;; @@ -505,6 +507,8 @@ Coherent) add_cppflags -DMKSH__NO_SYMLINK check_categories="$check_categories nosymlink" add_cppflags -DMKSH__NO_SETEUGID + add_cppflags -DMKSH_CONSERVATIVE_FDS + add_cppflags -DMKSH_DISABLE_TTY_WARNING ;; CYGWIN*) : ${HAVE_SETLOCALE_CTYPE=0} @@ -518,6 +522,7 @@ FreeBSD) FreeMiNT) oswarn="; it has minor issues" add_cppflags -D_GNU_SOURCE + add_cppflags -DMKSH_CONSERVATIVE_FDS : ${HAVE_SETLOCALE_CTYPE=0} ;; GNU) @@ -525,8 +530,8 @@ GNU) *tendracc*) ;; *) add_cppflags -D_GNU_SOURCE ;; esac - # define NO_PATH_MAX to use Hurd-only functions - add_cppflags -DNO_PATH_MAX + # define MKSH__NO_PATH_MAX to use Hurd-only functions + add_cppflags -DMKSH__NO_PATH_MAX ;; GNU/kFreeBSD) case $CC in @@ -594,6 +599,7 @@ NEXTSTEP) oswarn="; it needs libposix.a" ;; esac + add_cppflags -DMKSH_CONSERVATIVE_FDS ;; Ninix3) # similar to Minix3 @@ -620,6 +626,7 @@ Plan9) add_cppflags -D_BSD_EXTENSION add_cppflags -D_SUSV2_SOURCE add_cppflags -DMKSH_ASSUME_UTF8; HAVE_ISSET_MKSH_ASSUME_UTF8=1 + add_cppflags -DMKSH_NO_CMDLINE_EDITING oswarn=' and will currently not work' add_cppflags -DMKSH_UNEMPLOYED ;; @@ -651,6 +658,7 @@ SCO_SV) oswarn="$oswarn$nl$TARGET_OS ${TARGET_OSREV}, please tell me what to do" ;; esac + add_cppflags -DMKSH_CONSERVATIVE_FDS : ${HAVE_SYS_SIGLIST=0} ${HAVE__SYS_SIGLIST=0} ;; skyos) @@ -667,10 +675,12 @@ syllable) ULTRIX) : ${CC=cc -YPOSIX} add_cppflags -DMKSH_TYPEDEF_SSIZE_T=int + add_cppflags -DMKSH_CONSERVATIVE_FDS : ${HAVE_SETLOCALE_CTYPE=0} ;; UnixWare|UNIX_SV) # SCO UnixWare + add_cppflags -DMKSH_CONSERVATIVE_FDS : ${HAVE_SYS_SIGLIST=0} ${HAVE__SYS_SIGLIST=0} ;; UWIN*) @@ -1410,7 +1420,7 @@ else #define EXTERN #define MKSH_INCLUDES_ONLY #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); } EOF case $cm in diff --git a/misc.c b/misc.c index 39f6d58..bfc1734 100644 --- a/misc.c +++ b/misc.c @@ -30,7 +30,7 @@ #include #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 */ unsigned char chtypes[UCHAR_MAX + 1]; @@ -1288,7 +1288,7 @@ reset_nonblock(int fd) char * ksh_get_wd(void) { -#ifdef NO_PATH_MAX +#ifdef MKSH__NO_PATH_MAX char *rv, *cp; if ((cp = get_current_dir_name())) { @@ -1321,7 +1321,7 @@ do_realpath(const char *upath) size_t len; int llen; struct stat sb; -#ifdef NO_PATH_MAX +#ifdef MKSH__NO_PATH_MAX size_t ldestlen = 0; #define pathlen sb.st_size #define pathcnd (ldestlen < (pathlen + 1)) @@ -1418,7 +1418,7 @@ do_realpath(const char *upath) /* get symlink(7) target */ if (pathcnd) { -#ifdef NO_PATH_MAX +#ifdef MKSH__NO_PATH_MAX if (notoktoadd(pathlen, 1)) { errno = ENAMETOOLONG; goto notfound; @@ -1806,7 +1806,7 @@ c_cd(const char **wp) return (2); } -#ifdef NO_PATH_MAX +#ifdef MKSH__NO_PATH_MAX /* only a first guess; make_path will enlarge xs if necessary */ XinitN(xs, 1024, ATEMP); #else diff --git a/sh.h b/sh.h index 12db0dc..bf1954a 100644 --- a/sh.h +++ b/sh.h @@ -157,7 +157,7 @@ #endif #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 #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_isspace(c) ((((c) >= 0x09) && ((c) <= 0x0D)) || ((c) == 0x20)) -#ifdef NO_PATH_MAX +#ifdef MKSH__NO_PATH_MAX #undef PATH_MAX #else #ifndef PATH_MAX @@ -571,7 +571,7 @@ im_sorry_dave(void) #define free_ossetmode(p) free(p) #endif -#ifdef NO_PATH_MAX +#ifdef MKSH__NO_PATH_MAX /* GNU libc: get_current_dir_name(3) -> free(3) */ #define free_gnu_gcdn(p) free(p) #endif