make array_index_calc static and don't limit
array indices (well, to 2^31-1, but that's for integer reasons only)
This commit is contained in:
parent
60f7d03fb5
commit
6d8b225141
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: src/bin/ksh/conf-end.h,v 2.1 2004/12/10 18:09:41 tg Exp $ */
|
||||
/** $MirBSD: src/bin/ksh/conf-end.h,v 2.2 2004/12/18 18:39:10 tg Exp $ */
|
||||
/* $OpenBSD: conf-end.h,v 1.2 1996/08/25 12:37:58 downsj Exp $ */
|
||||
|
||||
#ifndef CONF_END_H
|
||||
@ -41,6 +41,10 @@
|
||||
* End of configuration stuff for PD ksh.
|
||||
*/
|
||||
|
||||
#if SIZEOF_INT < 4
|
||||
# error "int cannot hold 32 bit"
|
||||
#endif
|
||||
|
||||
#if defined(EMACS) || defined(VI)
|
||||
# define EDIT
|
||||
#else
|
||||
|
4
ksh.1tbl
4
ksh.1tbl
@ -1,4 +1,4 @@
|
||||
.\" $MirBSD: src/bin/ksh/ksh.1tbl,v 2.5 2004/12/13 19:36:27 tg Exp $
|
||||
.\" $MirBSD: src/bin/ksh/ksh.1tbl,v 2.6 2004/12/18 18:39:10 tg Exp $
|
||||
.\" $OpenBSD: ksh.1tbl,v 1.79 2004/12/04 07:05:13 jaredy Exp $
|
||||
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
|
||||
.\"
|
||||
@ -1100,7 +1100,7 @@ form
|
||||
where
|
||||
.Ar expr
|
||||
is an arithmetic expression.
|
||||
Array indices are currently limited to the range 0 through 4095 (for
|
||||
Array indices are currently limited to the range 0 through 2147483647 (for
|
||||
.Nm mksh )
|
||||
or 0 to 1023 (for other korn shells), inclusive.
|
||||
Parameter substitutions take the form
|
||||
|
3
sh.h
3
sh.h
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: src/bin/ksh/sh.h,v 2.2 2004/12/13 19:05:09 tg Exp $ */
|
||||
/** $MirBSD: src/bin/ksh/sh.h,v 2.3 2004/12/18 18:39:10 tg Exp $ */
|
||||
/* $OpenBSD: sh.h,v 1.18 2004/05/31 10:36:35 otto Exp $ */
|
||||
|
||||
#ifndef SH_H
|
||||
@ -322,7 +322,6 @@ typedef INT32 Tflag;
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 1024 /* pathname size (todo: pathconf()) */
|
||||
#endif
|
||||
#define ARRAYMAX 4095 /* max array index */
|
||||
|
||||
EXTERN const char *kshname; /* $0 */
|
||||
EXTERN pid_t kshpid; /* $$, shell pid */
|
||||
|
10
var.c
10
var.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: src/bin/ksh/var.c,v 2.1 2004/12/10 18:09:42 tg Exp $ */
|
||||
/** $MirBSD: src/bin/ksh/var.c,v 2.2 2004/12/18 18:39:10 tg Exp $ */
|
||||
/* $OpenBSD: var.c,v 1.17 2004/05/08 19:42:35 deraadt Exp $ */
|
||||
|
||||
#include "sh.h"
|
||||
@ -7,7 +7,7 @@
|
||||
#include "ksh_stat.h"
|
||||
#include <ctype.h>
|
||||
|
||||
__RCSID("$MirBSD: src/bin/ksh/var.c,v 2.1 2004/12/10 18:09:42 tg Exp $");
|
||||
__RCSID("$MirBSD: src/bin/ksh/var.c,v 2.2 2004/12/18 18:39:10 tg Exp $");
|
||||
|
||||
/*
|
||||
* Variables
|
||||
@ -125,9 +125,9 @@ initvar(void)
|
||||
* non-zero if this is an array, sets *valp to the array index, returns
|
||||
* the basename of the array.
|
||||
*/
|
||||
const char *array_index_calc(const char *n, bool_t *arrayp, int *valp);
|
||||
static const char *array_index_calc(const char *, bool_t *, int *);
|
||||
|
||||
const char *
|
||||
static const char *
|
||||
array_index_calc(const char *n, bool_t *arrayp, int *valp)
|
||||
{
|
||||
const char *p;
|
||||
@ -146,7 +146,7 @@ array_index_calc(const char *n, bool_t *arrayp, int *valp)
|
||||
afree(tmp, ATEMP);
|
||||
n = str_nsave(n, p - n, ATEMP);
|
||||
evaluate(sub, &rval, KSH_UNWIND_ERROR);
|
||||
if (rval < 0 || rval > ARRAYMAX)
|
||||
if (rval < 0 || rval > 2147483647)
|
||||
errorf("%s: subscript out of range", n);
|
||||
*valp = rval;
|
||||
afree(sub, ATEMP);
|
||||
|
Loading…
x
Reference in New Issue
Block a user