"official" but unsupported printf-as-builtin code, cleaner API than
in the branch; USE_PRINTF_BUILTIN=1 to enable it (Build.sh + Makefile)
This commit is contained in:
parent
918aca2c45
commit
cb2fd22c38
17
Build.sh
17
Build.sh
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/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
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||||
# Thorsten Glaser <tg@mirbsd.org>
|
# Thorsten Glaser <tg@mirbsd.org>
|
||||||
|
@ -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
|
# Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF
|
||||||
# TARGET_OS TARGET_OSREV
|
# TARGET_OS TARGET_OSREV
|
||||||
|
# Feature selectors: USE_PRINTF_BUILTIN
|
||||||
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI
|
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI
|
||||||
# MKSH_CLS_STRING MKSH_BINSHREDUCED MKSH_UNEMPLOYED
|
# MKSH_CLS_STRING MKSH_BINSHREDUCED MKSH_UNEMPLOYED
|
||||||
# MKSH_CONSERVATIVE_FDS MKSH_MIDNIGHTBSD01ASH_COMPAT
|
# MKSH_CONSERVATIVE_FDS MKSH_MIDNIGHTBSD01ASH_COMPAT
|
||||||
|
@ -244,8 +245,14 @@ ac_header() {
|
||||||
}
|
}
|
||||||
|
|
||||||
addsrcs() {
|
addsrcs() {
|
||||||
|
if test x"$1" = x"!"; then
|
||||||
|
fr=0
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
fr=1
|
||||||
|
fi
|
||||||
eval i=\$$1
|
eval i=\$$1
|
||||||
test 0 = $i && case " $SRCS " in
|
test $fr = "$i" && case " $SRCS " in
|
||||||
*\ $2\ *) ;;
|
*\ $2\ *) ;;
|
||||||
*) SRCS="$SRCS $2" ;;
|
*) SRCS="$SRCS $2" ;;
|
||||||
esac
|
esac
|
||||||
|
@ -1345,8 +1352,10 @@ mksh_cfg: NSIG' >scn.c
|
||||||
$e done.
|
$e done.
|
||||||
fi
|
fi
|
||||||
|
|
||||||
addsrcs HAVE_SETMODE setmode.c
|
addsrcs ! HAVE_SETMODE setmode.c
|
||||||
addsrcs HAVE_STRLCPY strlcpy.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 0 = "$HAVE_SETMODE" && CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H -DCONFIG_H_FILENAME=\\\"sh.h\\\""
|
||||||
test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose"
|
test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose"
|
||||||
|
|
||||||
|
|
9
Makefile
9
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
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||||
# Thorsten Glaser <tg@mirbsd.org>
|
# Thorsten Glaser <tg@mirbsd.org>
|
||||||
|
@ -48,6 +48,13 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 \
|
||||||
COPTS+= -std=gnu99 -Wall
|
COPTS+= -std=gnu99 -Wall
|
||||||
.endif
|
.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
|
LINKS+= ${BINDIR}/${PROG} ${BINDIR}/sh
|
||||||
MLINKS+= ${PROG}.1 sh.1
|
MLINKS+= ${PROG}.1 sh.1
|
||||||
|
|
||||||
|
|
4
check.t
4
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: 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: 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 $
|
# $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
|
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R39 2009/07/25
|
@(#)MIRBSD KSH R39 2009/07/30
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
stdin:
|
stdin:
|
||||||
|
|
5
funcs.c
5
funcs.c
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include "sh.h"
|
#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
|
#if HAVE_KILLPG
|
||||||
/*
|
/*
|
||||||
|
@ -86,6 +86,9 @@ const struct builtin mkshbuiltins[] = {
|
||||||
{"+kill", c_kill},
|
{"+kill", c_kill},
|
||||||
{"let", c_let},
|
{"let", c_let},
|
||||||
{"print", c_print},
|
{"print", c_print},
|
||||||
|
#ifdef MKSH_PRINTF_BUILTIN
|
||||||
|
{"printf", c_printf},
|
||||||
|
#endif
|
||||||
{"pwd", c_pwd},
|
{"pwd", c_pwd},
|
||||||
{"*=readonly", c_typeset},
|
{"*=readonly", c_typeset},
|
||||||
{"=typeset", c_typeset},
|
{"=typeset", c_typeset},
|
||||||
|
|
7
sh.h
7
sh.h
|
@ -134,9 +134,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#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
|
#endif
|
||||||
#define MKSH_VERSION "R39 2009/07/25"
|
#define MKSH_VERSION "R39 2009/07/30"
|
||||||
|
|
||||||
#ifndef MKSH_INCLUDES_ONLY
|
#ifndef MKSH_INCLUDES_ONLY
|
||||||
|
|
||||||
|
@ -1387,6 +1387,9 @@ int c_hash(const char **);
|
||||||
int c_cd(const char **);
|
int c_cd(const char **);
|
||||||
int c_pwd(const char **);
|
int c_pwd(const char **);
|
||||||
int c_print(const char **);
|
int c_print(const char **);
|
||||||
|
#ifdef MKSH_PRINTF_BUILTIN
|
||||||
|
int c_printf(const char **);
|
||||||
|
#endif
|
||||||
int c_whence(const char **);
|
int c_whence(const char **);
|
||||||
int c_command(const char **);
|
int c_command(const char **);
|
||||||
int c_typeset(const char **);
|
int c_typeset(const char **);
|
||||||
|
|
Loading…
Reference in New Issue