also get back octal crap for LEGACY KSH
This commit is contained in:
parent
1f5c10c8b6
commit
5386859b3f
12
check.t
12
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.540 2012/06/25 16:17:51 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.541 2012/06/25 16:31:16 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 $
|
||||
@ -3653,11 +3653,21 @@ name: integer-base-check-flat
|
||||
description:
|
||||
Check behaviour does not match POSuX, because a not type-safe
|
||||
scripting language has *no* business interpreting "010" as octal
|
||||
category: shell:legacy-no
|
||||
stdin:
|
||||
echo :$((10)).$((010)).$((0x10)).
|
||||
expected-stdout:
|
||||
:10.10.16.
|
||||
---
|
||||
name: integer-base-check-flat-legacy
|
||||
description:
|
||||
Check behaviour matches POSuX for LEGACY KSH
|
||||
category: shell:legacy-yes
|
||||
stdin:
|
||||
echo :$((10)).$((010)).$((0x10)).
|
||||
expected-stdout:
|
||||
:10.8.16.
|
||||
---
|
||||
name: integer-base-check-numeric-from
|
||||
description:
|
||||
Check behaviour for base one to 36, and that 37 errors out
|
||||
|
10
var.c
10
var.c
@ -27,7 +27,7 @@
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.149 2012/05/09 23:21:00 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.150 2012/06/25 16:31:18 tg Exp $");
|
||||
|
||||
/*-
|
||||
* Variables
|
||||
@ -493,6 +493,14 @@ getint(struct tbl *vp, mksh_ari_t *nump, bool arith)
|
||||
base = 16;
|
||||
have_base = true;
|
||||
}
|
||||
#ifdef MKSH_LEGACY_MODE
|
||||
if (arith && s[0] == '0' && ksh_isdigit(s[1]) &&
|
||||
!(vp->flag & ZEROFIL)) {
|
||||
/* interpret as octal (deprecated) */
|
||||
base = 8;
|
||||
have_base = true;
|
||||
}
|
||||
#endif
|
||||
while ((c = *s++)) {
|
||||
if (c == '-') {
|
||||
neg++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user