From 496b8f4dc3f67b1c8fe318ca24d3a2e06bd72d82 Mon Sep 17 00:00:00 2001 From: tg Date: Tue, 31 Jul 2007 11:11:25 +0000 Subject: [PATCH] =?UTF-8?q?=E2=80=A2=20new=20way=20of=20checking=20for=20m?= =?UTF-8?q?knod=20&=20friends,=20due=20to=20tcc=20vs=20glibc=20weirdness?= =?UTF-8?q?=20=E2=80=A2=20bump=20vsn=20for=20the=20code=20restructuring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Build.sh | 24 +++++++++++++++--------- Makefile | 11 ++++++----- check.t | 4 ++-- funcs.c | 6 +++--- sh.h | 4 ++-- 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/Build.sh b/Build.sh index cef421c..9debba0 100644 --- a/Build.sh +++ b/Build.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $MirOS: src/bin/mksh/Build.sh,v 1.249 2007/07/31 10:42:14 tg Exp $ +# $MirOS: src/bin/mksh/Build.sh,v 1.250 2007/07/31 11:11:23 tg Exp $ #- # Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS # CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NEED_MKNOD MKSH_NOPWNAM @@ -621,13 +621,6 @@ ac_testn mksh_defutf8 '' "if we assume UTF-8 is enabled" <<-'EOF' int main(void) { return (0); } EOF -ac_testn mksh_need_mknod '!' mksh_full 1 'if we still want c_mknod()' <<-'EOF' - #ifndef MKSH_NEED_MKNOD - #error Nope, the user really wants it teensy. - #endif - int main(void) { return (0); } -EOF - if test 0 = $HAVE_MKSH_FULL; then if test $ct = xlc; then ac_flags 1 fnoinline -qnoinline @@ -794,6 +787,19 @@ ac_test langinfo_codeset setlocale_ctype 0 'nl_langinfo(CODESET)' <<-'EOF' int main(void) { return ((ptrdiff_t)(void *)nl_langinfo(CODESET)); } EOF +ac_test mknod '' 'if we use mknod(), makedev() and friends' <<-'EOF' + #define MKSH_INCLUDES_ONLY + #include "sh.h" + #if defined(MKSH_SMALL) && !defined(MKSH_NEED_MKNOD) + #error We do not want to include the mknod builtin. + #endif + int main(int ac, char *av[]) { + dev_t dv; + dv = makedev(ac, 1); + return (mknod(av[0], 0, dv) ? (int)major(dv) : (int)minor(dv)); + } +EOF + ac_test revoke mksh_full 0 <<-'EOF' #if HAVE_LIBUTIL_H #include @@ -802,7 +808,7 @@ ac_test revoke mksh_full 0 <<-'EOF' int main(int ac, char *av[]) { return (ac + revoke(av[0])); } EOF -ac_test setmode mksh_need_mknod 1 <<-'EOF' +ac_test setmode mknod 1 <<-'EOF' #if defined(__MSVCRT__) || defined(__CYGWIN__) #error Win32 setmode() is different from what we need #endif diff --git a/Makefile b/Makefile index 159ddb5..4034d9e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/Makefile,v 1.44 2007/07/01 21:47:07 tg Exp $ +# $MirOS: src/bin/mksh/Makefile,v 1.45 2007/07/31 11:11:23 tg Exp $ #- # use CPPFLAGS=-DDEBUG __CRAZY=Yes to check for certain more stuff @@ -19,10 +19,11 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 \ -DHAVE_SYS_SIGLIST=1 -DHAVE_STRSIGNAL=0 -DHAVE_ARC4RANDOM=1 \ -DHAVE_ARC4RANDOM_PUSH=1 -DHAVE_FLOCK_EX=1 \ -DHAVE_SETLOCALE_CTYPE=0 -DHAVE_LANGINFO_CODESET=0 \ - -DHAVE_REVOKE=1 -DHAVE_SETMODE=1 -DHAVE_SETRESUGID=1 \ - -DHAVE_SETGROUPS=1 -DHAVE_STRCASESTR=1 -DHAVE_STRLCPY=1 \ - -DHAVE_ARC4RANDOM_DECL=1 -DHAVE_ARC4RANDOM_PUSH_DECL=1 \ - -DHAVE_SYS_SIGLIST_DECL=1 -DHAVE_PERSISTENT_HISTORY=1 + -DHAVE_MKNOD=1 -DHAVE_REVOKE=1 -DHAVE_SETMODE=1 \ + -DHAVE_SETRESUGID=1 -DHAVE_SETGROUPS=1 -DHAVE_STRCASESTR=1 \ + -DHAVE_STRLCPY=1 -DHAVE_ARC4RANDOM_DECL=1 \ + -DHAVE_ARC4RANDOM_PUSH_DECL=1 -DHAVE_SYS_SIGLIST_DECL=1 \ + -DHAVE_PERSISTENT_HISTORY=1 COPTS+= -std=gnu99 -Wall .endif diff --git a/check.t b/check.t index e084f09..0b9ea23 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.131 2007/07/26 13:23:51 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.132 2007/07/31 11:11:23 tg Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ @@ -7,7 +7,7 @@ # http://www.research.att.com/~gsf/public/ifs.sh expected-stdout: - @(#)MIRBSD KSH R30 2007/07/26 + @(#)MIRBSD KSH R30 2007/07/31 description: Check version of shell. category: pdksh diff --git a/funcs.c b/funcs.c index 7fa786d..9e8790d 100644 --- a/funcs.c +++ b/funcs.c @@ -5,7 +5,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.60 2007/07/22 14:01:48 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.61 2007/07/31 11:11:24 tg Exp $"); int c_cd(const char **wp) @@ -2203,7 +2203,7 @@ c_exec(const char **wp __unused) return 0; } -#if !defined(MKSH_SMALL) || defined(MKSH_NEED_MKNOD) +#if HAVE_MKNOD static int c_mknod(const char **wp) { @@ -2324,7 +2324,7 @@ const struct builtin shbuiltins [] = { {"ulimit", c_ulimit}, {"+umask", c_umask}, {"*=unset", c_unset}, -#if !defined(MKSH_SMALL) || defined(MKSH_NEED_MKNOD) +#if HAVE_MKNOD {"mknod", c_mknod}, #endif {NULL, (int (*)(const char **))NULL} diff --git a/sh.h b/sh.h index ed5fac6..8d78005 100644 --- a/sh.h +++ b/sh.h @@ -8,8 +8,8 @@ /* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */ /* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */ -#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.165 2007/07/26 13:23:52 tg Exp $" -#define MKSH_VERSION "R30 2007/07/26" +#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.166 2007/07/31 11:11:25 tg Exp $" +#define MKSH_VERSION "R30 2007/07/31" #if HAVE_SYS_PARAM_H #include