* add printf(1) as mksh(1) builtin on MirOS
(or, more general, all systems using Makefile instead of Build.sh) * document this fact
This commit is contained in:
parent
c34c9d7542
commit
6c5d08ea6f
11
Makefile
11
Makefile
@ -1,10 +1,19 @@
|
|||||||
# $MirOS: src/bin/mksh/Makefile,v 1.3 2005/05/23 14:48:21 tg Exp $
|
# $MirOS: src/bin/mksh/Makefile,v 1.4 2005/08/26 22:03:55 tg Exp $
|
||||||
|
|
||||||
PROG= mksh
|
PROG= mksh
|
||||||
SRCS= alloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c \
|
SRCS= alloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c \
|
||||||
jobs.c lex.c main.c misc.c shf.c syn.c tree.c var.c
|
jobs.c lex.c main.c misc.c shf.c syn.c tree.c var.c
|
||||||
CDIAGFLAGS+= -Wno-cast-qual
|
CDIAGFLAGS+= -Wno-cast-qual
|
||||||
|
|
||||||
|
.include <bsd.own.mk>
|
||||||
|
|
||||||
|
.ifndef NO_PRINTF_BUILTIN
|
||||||
|
.PATH: ${BSDSRCDIR}/usr.bin/printf
|
||||||
|
SRCS+= printf.c
|
||||||
|
CFLAGS_printf.o=-DBUILTIN
|
||||||
|
CPPFLAGS+= -DUSE_PRINTF
|
||||||
|
.endif
|
||||||
|
|
||||||
check:
|
check:
|
||||||
@cd ${.CURDIR} && ${MAKE} regress V=-v
|
@cd ${.CURDIR} && ${MAKE} regress V=-v
|
||||||
|
|
||||||
|
4
check.t
4
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.28 2005/08/21 13:02:16 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.29 2005/08/26 22:03:55 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 $
|
||||||
@ -3701,5 +3701,5 @@ category: pdksh
|
|||||||
stdin:
|
stdin:
|
||||||
echo $KSH_VERSION
|
echo $KSH_VERSION
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R24 2005/08/21
|
@(#)MIRBSD KSH R25 2005/08/26 pre
|
||||||
---
|
---
|
||||||
|
25
funcs.c
25
funcs.c
@ -1,4 +1,4 @@
|
|||||||
/** $MirOS: src/bin/mksh/funcs.c,v 1.16 2005/08/21 12:52:29 tg Exp $ */
|
/** $MirOS: src/bin/mksh/funcs.c,v 1.17 2005/08/26 22:03:55 tg Exp $ */
|
||||||
/* $OpenBSD: c_ksh.c,v 1.27 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: c_ksh.c,v 1.27 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
/* $OpenBSD: c_sh.c,v 1.29 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: c_sh.c,v 1.29 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
/* $OpenBSD: c_test.c,v 1.17 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: c_test.c,v 1.17 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
@ -13,7 +13,11 @@
|
|||||||
#include <ulimit.h>
|
#include <ulimit.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.16 2005/08/21 12:52:29 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.17 2005/08/26 22:03:55 tg Exp $");
|
||||||
|
|
||||||
|
#ifdef USE_PRINTF
|
||||||
|
int c_printf(char **);
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
c_cd(char **wp)
|
c_cd(char **wp)
|
||||||
@ -1079,6 +1083,20 @@ c_fgbg(char **wp)
|
|||||||
return bg ? 0 : rv;
|
return bg ? 0 : rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_PRINTF
|
||||||
|
int
|
||||||
|
c_printf(char **wp)
|
||||||
|
{
|
||||||
|
extern int progprintf(int, char *[]);
|
||||||
|
int argc;
|
||||||
|
|
||||||
|
for (argc = 0; wp[argc]; argc++)
|
||||||
|
;
|
||||||
|
|
||||||
|
return progprintf(argc, wp);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct kill_info {
|
struct kill_info {
|
||||||
int num_width;
|
int num_width;
|
||||||
int name_width;
|
int name_width;
|
||||||
@ -1373,6 +1391,9 @@ const struct builtin kshbuiltins [] = {
|
|||||||
{"+bg", c_fgbg},
|
{"+bg", c_fgbg},
|
||||||
{"+fg", c_fgbg},
|
{"+fg", c_fgbg},
|
||||||
{"bind", c_bind},
|
{"bind", c_bind},
|
||||||
|
#ifdef USE_PRINTF
|
||||||
|
{"printf", c_printf},
|
||||||
|
#endif
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
6
main.c
6
main.c
@ -1,4 +1,4 @@
|
|||||||
/** $MirOS: src/bin/mksh/main.c,v 1.24 2005/08/21 13:02:17 tg Exp $ */
|
/** $MirOS: src/bin/mksh/main.c,v 1.25 2005/08/26 22:03:56 tg Exp $ */
|
||||||
/* $OpenBSD: main.c,v 1.38 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: main.c,v 1.38 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
/* $OpenBSD: tty.c,v 1.8 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: tty.c,v 1.8 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
/* $OpenBSD: io.c,v 1.21 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: io.c,v 1.21 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
@ -13,9 +13,9 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.24 2005/08/21 13:02:17 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.25 2005/08/26 22:03:56 tg Exp $");
|
||||||
|
|
||||||
#define MKSH_VERSION "@(#)MIRBSD KSH R24 2005/08/21"
|
#define MKSH_VERSION "@(#)MIRBSD KSH R25 2005/08/26 pre"
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
|
15
mksh.1
15
mksh.1
@ -1,4 +1,4 @@
|
|||||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.17 2005/08/26 21:54:05 tg Exp $
|
.\" $MirOS: src/bin/mksh/mksh.1,v 1.18 2005/08/26 22:03:56 tg Exp $
|
||||||
.\" $OpenBSD: ksh.1,v 1.101 2005/08/01 19:29:57 jmc Exp $
|
.\" $OpenBSD: ksh.1,v 1.101 2005/08/01 19:29:57 jmc Exp $
|
||||||
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
|
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
|
||||||
.\"
|
.\"
|
||||||
@ -2314,7 +2314,8 @@ Additional
|
|||||||
regular commands
|
regular commands
|
||||||
.Pp
|
.Pp
|
||||||
.Ic \&[ , echo , let , print ,
|
.Ic \&[ , echo , let , print ,
|
||||||
.Ic pwd , test , ulimit , whence
|
.Ic printf , pwd , test , ulimit ,
|
||||||
|
.Ic whence
|
||||||
.Pp
|
.Pp
|
||||||
In the future, the additional
|
In the future, the additional
|
||||||
.Nm
|
.Nm
|
||||||
@ -2967,6 +2968,15 @@ As above, the
|
|||||||
.Fl n
|
.Fl n
|
||||||
option suppresses the trailing newline.
|
option suppresses the trailing newline.
|
||||||
.Pp
|
.Pp
|
||||||
|
.It Ic printf Ar format Op Ar arguments
|
||||||
|
This builtin is not included with portable
|
||||||
|
.Nm
|
||||||
|
and only available under
|
||||||
|
.Mx .
|
||||||
|
It mimics the
|
||||||
|
.Xr printf 1
|
||||||
|
behaviour; see there for a complete reference.
|
||||||
|
.Pp
|
||||||
.It Ic pwd Op Fl LP
|
.It Ic pwd Op Fl LP
|
||||||
Print the present working directory.
|
Print the present working directory.
|
||||||
If the
|
If the
|
||||||
@ -5073,6 +5083,7 @@ Shell database.
|
|||||||
.Xr ed 1 ,
|
.Xr ed 1 ,
|
||||||
.Xr getconf 1 ,
|
.Xr getconf 1 ,
|
||||||
.Xr getopt 1 ,
|
.Xr getopt 1 ,
|
||||||
|
.Xr printf 1 ,
|
||||||
.Xr sed 1 ,
|
.Xr sed 1 ,
|
||||||
.Xr sh 1 ,
|
.Xr sh 1 ,
|
||||||
.Xr stty 1 ,
|
.Xr stty 1 ,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user