diff --git a/check.t b/check.t index 0189cf6..27fd81d 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.717 2015/12/31 21:03:44 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.718 2016/01/13 17:20:46 tg Exp $ # -*- mode: sh -*- #- # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, @@ -30,7 +30,7 @@ # (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date expected-stdout: - @(#)MIRBSD KSH R52 2015/12/31 + @(#)MIRBSD KSH R52 2016/01/13 description: Check version of shell. stdin: @@ -39,7 +39,7 @@ name: KSH_VERSION category: shell:legacy-no --- expected-stdout: - @(#)LEGACY KSH R52 2015/12/31 + @(#)LEGACY KSH R52 2016/01/13 description: Check version of legacy shell. stdin: diff --git a/funcs.c b/funcs.c index 2a6fd88..07bd026 100644 --- a/funcs.c +++ b/funcs.c @@ -5,7 +5,7 @@ /*- * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - * 2010, 2011, 2012, 2013, 2014, 2015 + * 2010, 2011, 2012, 2013, 2014, 2015, 2016 * mirabilos * * Provided that these terms and disclaimer and all copyright notices @@ -38,7 +38,7 @@ #endif #endif -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.288 2015/12/12 19:27:36 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.289 2016/01/13 17:20:49 tg Exp $"); #if HAVE_KILLPG /* @@ -2355,16 +2355,14 @@ int c_exitreturn(const char **wp) { int n, how = LEXIT; - const char *arg; - if (ksh_getopt(wp, &builtin_opt, null) == '?') - goto c_exitreturn_err; - arg = wp[builtin_opt.optind]; - - if (arg) - exstat = bi_getn(arg, &n) ? (n & 0xFF) : 1; - else if (trap_exstat != -1) + if (wp[1]) { + if (wp[2]) + goto c_exitreturn_err; + exstat = bi_getn(wp[1], &n) ? (n & 0xFF) : 1; + } else if (trap_exstat != -1) exstat = trap_exstat; + if (wp[0][0] == 'r') { /* return */ struct env *ep; @@ -2385,12 +2383,13 @@ c_exitreturn(const char **wp) how = LSHELL; } - /* get rid of any i/o redirections */ + /* get rid of any I/O redirections */ quitenv(NULL); unwind(how); /* NOTREACHED */ c_exitreturn_err: + bi_errorf("too many arguments"); return (1); } diff --git a/mksh.1 b/mksh.1 index 43dc74d..72da56d 100644 --- a/mksh.1 +++ b/mksh.1 @@ -1,4 +1,4 @@ -.\" $MirOS: src/bin/mksh/mksh.1,v 1.385 2016/01/12 16:33:17 tg Exp $ +.\" $MirOS: src/bin/mksh/mksh.1,v 1.386 2016/01/13 17:20:50 tg Exp $ .\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $ .\"- .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, @@ -74,7 +74,7 @@ .\" with -mandoc, it might implement .Mx itself, but we want to .\" use our own definition. And .Dd must come *first*, always. .\" -.Dd $Mdocdate: January 12 2016 $ +.Dd $Mdocdate: January 13 2016 $ .\" .\" Check which macro package we use, and do other -mdoc setup. .\" @@ -2965,7 +2965,8 @@ Builtins that are not special: Once the type of command has been determined, any command-line parameter assignments are performed and exported for the duration of the command. .Pp -The following describes the special and regular built-in commands: +The following describes the special and regular built-in commands and +builtin-like reserved words: .Pp .Bl -tag -width false -compact .It Ic \&. Ar file Op Ar arg ... diff --git a/sh.h b/sh.h index 39530aa..5d8c0ac 100644 --- a/sh.h +++ b/sh.h @@ -175,9 +175,9 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.752 2015/12/31 21:03:47 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.753 2016/01/13 17:20:52 tg Exp $"); #endif -#define MKSH_VERSION "R52 2015/12/31" +#define MKSH_VERSION "R52 2016/01/13" /* arithmetic types: C implementation */ #if !HAVE_CAN_INTTYPES