diff --git a/Build.sh b/Build.sh index 2d00b13..27ea2b4 100644 --- a/Build.sh +++ b/Build.sh @@ -1,5 +1,5 @@ #!/bin/sh -srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.412 2009/07/25 21:31:23 tg Exp $' +srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.413 2009/07/30 19:11:09 tg Exp $' #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Thorsten Glaser @@ -21,6 +21,7 @@ srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.412 2009/07/25 21:31:23 tg Exp $' #- # Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF # TARGET_OS TARGET_OSREV +# Feature selectors: USE_PRINTF_BUILTIN # CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI # MKSH_CLS_STRING MKSH_BINSHREDUCED MKSH_UNEMPLOYED # MKSH_CONSERVATIVE_FDS MKSH_MIDNIGHTBSD01ASH_COMPAT @@ -244,8 +245,14 @@ ac_header() { } addsrcs() { + if test x"$1" = x"!"; then + fr=0 + shift + else + fr=1 + fi eval i=\$$1 - test 0 = $i && case " $SRCS " in + test $fr = "$i" && case " $SRCS " in *\ $2\ *) ;; *) SRCS="$SRCS $2" ;; esac @@ -1345,8 +1352,10 @@ mksh_cfg: NSIG' >scn.c $e done. fi -addsrcs HAVE_SETMODE setmode.c -addsrcs HAVE_STRLCPY strlcpy.c +addsrcs ! HAVE_SETMODE setmode.c +addsrcs ! HAVE_STRLCPY strlcpy.c +addsrcs USE_PRINTF_BUILTIN printf.c +test 1 = "$USE_PRINTF_BUILTIN" && CPPFLAGS="$CPPFLAGS -DMKSH_PRINTF_BUILTIN" test 0 = "$HAVE_SETMODE" && CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H -DCONFIG_H_FILENAME=\\\"sh.h\\\"" test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose" diff --git a/Makefile b/Makefile index 60180d3..d5565bd 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/Makefile,v 1.75 2009/06/08 20:34:38 tg Stab $ +# $MirOS: src/bin/mksh/Makefile,v 1.76 2009/07/30 19:11:09 tg Exp $ #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Thorsten Glaser @@ -48,6 +48,13 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 \ COPTS+= -std=gnu99 -Wall .endif +USE_PRINTF_BUILTIN?= 0 +.if ${USE_PRINTF_BUILTIN} == 1 +.PATH: ${BSDSRCDIR}/usr.bin/printf +SRCS+= printf.c +CPPFLAGS+= -DMKSH_PRINTF_BUILTIN +.endif + LINKS+= ${BINDIR}/${PROG} ${BINDIR}/sh MLINKS+= ${PROG}.1 sh.1 diff --git a/check.t b/check.t index 473bdf0..806cb79 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.295 2009/07/25 21:31:24 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.296 2009/07/30 19:11:09 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 $ @@ -25,7 +25,7 @@ # http://www.research.att.com/~gsf/public/ifs.sh expected-stdout: - @(#)MIRBSD KSH R39 2009/07/25 + @(#)MIRBSD KSH R39 2009/07/30 description: Check version of shell. stdin: diff --git a/funcs.c b/funcs.c index 7f87850..7854eca 100644 --- a/funcs.c +++ b/funcs.c @@ -25,7 +25,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.118 2009/07/25 21:31:25 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.119 2009/07/30 19:11:11 tg Exp $"); #if HAVE_KILLPG /* @@ -86,6 +86,9 @@ const struct builtin mkshbuiltins[] = { {"+kill", c_kill}, {"let", c_let}, {"print", c_print}, +#ifdef MKSH_PRINTF_BUILTIN + {"printf", c_printf}, +#endif {"pwd", c_pwd}, {"*=readonly", c_typeset}, {"=typeset", c_typeset}, diff --git a/sh.h b/sh.h index de17a3e..c710cc5 100644 --- a/sh.h +++ b/sh.h @@ -134,9 +134,9 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.317 2009/07/30 18:42:31 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.318 2009/07/30 19:11:12 tg Exp $"); #endif -#define MKSH_VERSION "R39 2009/07/25" +#define MKSH_VERSION "R39 2009/07/30" #ifndef MKSH_INCLUDES_ONLY @@ -1387,6 +1387,9 @@ int c_hash(const char **); int c_cd(const char **); int c_pwd(const char **); int c_print(const char **); +#ifdef MKSH_PRINTF_BUILTIN +int c_printf(const char **); +#endif int c_whence(const char **); int c_command(const char **); int c_typeset(const char **);