capitalise AT&T®
This commit is contained in:
parent
be7764778f
commit
e1d8d7ed01
28
check.t
28
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.287 2009/06/10 18:11:25 tg Stab $
|
# $MirOS: src/bin/mksh/check.t,v 1.288 2009/06/11 12:42:15 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 $
|
||||||
@ -1005,7 +1005,7 @@ expected-stdout:
|
|||||||
name: eglob-bad-2
|
name: eglob-bad-2
|
||||||
description:
|
description:
|
||||||
Check that globbing isn't done when glob has syntax error
|
Check that globbing isn't done when glob has syntax error
|
||||||
(at&t ksh fails this test)
|
(AT&T ksh fails this test)
|
||||||
file-setup: file 644 "abcx"
|
file-setup: file 644 "abcx"
|
||||||
file-setup: file 644 "abcz"
|
file-setup: file 644 "abcz"
|
||||||
file-setup: file 644 "bbc"
|
file-setup: file 644 "bbc"
|
||||||
@ -1095,7 +1095,7 @@ expected-stdout:
|
|||||||
name: eglob-trim-1
|
name: eglob-trim-1
|
||||||
description:
|
description:
|
||||||
Eglobbing in trim expressions...
|
Eglobbing in trim expressions...
|
||||||
(at&t ksh fails this - docs say # matches shortest string, ## matches
|
(AT&T ksh fails this - docs say # matches shortest string, ## matches
|
||||||
longest...)
|
longest...)
|
||||||
stdin:
|
stdin:
|
||||||
x=abcdef
|
x=abcdef
|
||||||
@ -1373,7 +1373,7 @@ expected-stdout:
|
|||||||
name: glob-range-2
|
name: glob-range-2
|
||||||
description:
|
description:
|
||||||
Test range matching
|
Test range matching
|
||||||
(at&t ksh fails this; POSIX says invalid)
|
(AT&T ksh fails this; POSIX says invalid)
|
||||||
file-setup: file 644 "abc"
|
file-setup: file 644 "abc"
|
||||||
stdin:
|
stdin:
|
||||||
echo [a--]*
|
echo [a--]*
|
||||||
@ -1403,7 +1403,7 @@ expected-stdout:
|
|||||||
name: glob-range-5
|
name: glob-range-5
|
||||||
description:
|
description:
|
||||||
Results unspecified according to POSIX
|
Results unspecified according to POSIX
|
||||||
(at&t ksh treats this like [a-cc-e]*)
|
(AT&T ksh treats this like [a-cc-e]*)
|
||||||
file-setup: file 644 "abc"
|
file-setup: file 644 "abc"
|
||||||
file-setup: file 644 "bbc"
|
file-setup: file 644 "bbc"
|
||||||
file-setup: file 644 "cbc"
|
file-setup: file 644 "cbc"
|
||||||
@ -2532,7 +2532,7 @@ expected-stdout:
|
|||||||
name: IFS-space-colon-2
|
name: IFS-space-colon-2
|
||||||
description:
|
description:
|
||||||
Simple test, IFS=<white-space>:
|
Simple test, IFS=<white-space>:
|
||||||
At&t ksh fails this, POSIX says the test is correct.
|
AT&T ksh fails this, POSIX says the test is correct.
|
||||||
stdin:
|
stdin:
|
||||||
showargs() { for i; do echo -n " <$i>"; done; echo; }
|
showargs() { for i; do echo -n " <$i>"; done; echo; }
|
||||||
IFS="$IFS:"
|
IFS="$IFS:"
|
||||||
@ -2572,7 +2572,7 @@ expected-stdout:
|
|||||||
name: IFS-space-colon-5
|
name: IFS-space-colon-5
|
||||||
description:
|
description:
|
||||||
Simple test, IFS=<white-space>:
|
Simple test, IFS=<white-space>:
|
||||||
Don't know what POSIX thinks of this. at&t ksh does not do this.
|
Don't know what POSIX thinks of this. AT&T ksh does not do this.
|
||||||
stdin:
|
stdin:
|
||||||
showargs() { for i; do echo -n " <$i>"; done; echo; }
|
showargs() { for i; do echo -n " <$i>"; done; echo; }
|
||||||
IFS="$IFS:"
|
IFS="$IFS:"
|
||||||
@ -3050,7 +3050,7 @@ description:
|
|||||||
The following:
|
The following:
|
||||||
set -- `false`
|
set -- `false`
|
||||||
echo $?
|
echo $?
|
||||||
shoud not print 0. (according to /bin/sh, at&t ksh88, and the
|
shoud not print 0. (according to /bin/sh, AT&T ksh88, and the
|
||||||
getopt(1) man page - not according to POSIX)
|
getopt(1) man page - not according to POSIX)
|
||||||
stdin:
|
stdin:
|
||||||
set -- `false`
|
set -- `false`
|
||||||
@ -3113,7 +3113,7 @@ description:
|
|||||||
foobar: not found
|
foobar: not found
|
||||||
Also, the command
|
Also, the command
|
||||||
$ foobar 2> /dev/null
|
$ foobar 2> /dev/null
|
||||||
generates an error under /bin/sh and pdksh, but at&t ksh88 produces
|
generates an error under /bin/sh and pdksh, but AT&T ksh88 produces
|
||||||
no error (redirected to /dev/null).
|
no error (redirected to /dev/null).
|
||||||
stdin:
|
stdin:
|
||||||
(you/should/not/see/this/error/1) 2> /dev/null
|
(you/should/not/see/this/error/1) 2> /dev/null
|
||||||
@ -3125,10 +3125,10 @@ description:
|
|||||||
The command
|
The command
|
||||||
$ whence foobar
|
$ whence foobar
|
||||||
generates a blank line under pdksh and sets the exit status to 0.
|
generates a blank line under pdksh and sets the exit status to 0.
|
||||||
at&t ksh88 generates no output and sets the exit status to 1. Also,
|
AT&T ksh88 generates no output and sets the exit status to 1. Also,
|
||||||
the command
|
the command
|
||||||
$ whence foobar cat
|
$ whence foobar cat
|
||||||
generates no output under at&t ksh88 (pdksh generates a blank line
|
generates no output under AT&T ksh88 (pdksh generates a blank line
|
||||||
and /bin/cat).
|
and /bin/cat).
|
||||||
stdin:
|
stdin:
|
||||||
whence does/not/exist > /dev/null
|
whence does/not/exist > /dev/null
|
||||||
@ -3169,7 +3169,7 @@ name: regression-17
|
|||||||
description:
|
description:
|
||||||
The command
|
The command
|
||||||
. /foo/bar
|
. /foo/bar
|
||||||
should set the exit status to non-zero (sh and at&t ksh88 do).
|
should set the exit status to non-zero (sh and AT&T ksh88 do).
|
||||||
XXX doting a non existent file is a fatal error for a script
|
XXX doting a non existent file is a fatal error for a script
|
||||||
stdin:
|
stdin:
|
||||||
. does/not/exist
|
. does/not/exist
|
||||||
@ -3213,7 +3213,7 @@ name: regression-22
|
|||||||
description:
|
description:
|
||||||
Quoting backquotes inside backquotes doesn't work:
|
Quoting backquotes inside backquotes doesn't work:
|
||||||
$ echo `echo hi \`echo there\` folks`
|
$ echo `echo hi \`echo there\` folks`
|
||||||
asks for more info. sh and at&t ksh88 both echo
|
asks for more info. sh and AT&T ksh88 both echo
|
||||||
hi there folks
|
hi there folks
|
||||||
stdin:
|
stdin:
|
||||||
echo `echo hi \`echo there\` folks`
|
echo `echo hi \`echo there\` folks`
|
||||||
@ -3290,7 +3290,7 @@ expected-stderr-pattern: /a\.x=1/
|
|||||||
---
|
---
|
||||||
name: regression-29
|
name: regression-29
|
||||||
description:
|
description:
|
||||||
alias expansion different from at&t ksh88
|
alias expansion different from AT&T ksh88
|
||||||
stdin:
|
stdin:
|
||||||
alias a='for ' b='i in'
|
alias a='for ' b='i in'
|
||||||
a b hi ; do echo $i ; done
|
a b hi ; do echo $i ; done
|
||||||
|
20
edit.c
20
edit.c
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.170 2009/06/10 19:34:18 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.171 2009/06/11 12:42:16 tg Exp $");
|
||||||
|
|
||||||
/* tty driver characters we are interested in */
|
/* tty driver characters we are interested in */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -159,7 +159,7 @@ x_do_comment(char *buf, int bsize, int *lenp)
|
|||||||
int i, j, len = *lenp;
|
int i, j, len = *lenp;
|
||||||
|
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return (1); /* somewhat arbitrary - it's what at&t ksh does */
|
return (1); /* somewhat arbitrary - it's what AT&T ksh does */
|
||||||
|
|
||||||
/* Already commented? */
|
/* Already commented? */
|
||||||
if (buf[0] == '#') {
|
if (buf[0] == '#') {
|
||||||
@ -2381,12 +2381,12 @@ x_transpose(int c __unused)
|
|||||||
* is a general summary of the options; the text is abcd with the
|
* is a general summary of the options; the text is abcd with the
|
||||||
* upper case character or underscore indicating the cursor position:
|
* upper case character or underscore indicating the cursor position:
|
||||||
* Who Before After Before After
|
* Who Before After Before After
|
||||||
* at&t ksh in emacs mode: abCd abdC abcd_ (bell)
|
* AT&T ksh in emacs mode: abCd abdC abcd_ (bell)
|
||||||
* at&t ksh in gmacs mode: abCd baCd abcd_ abdc_
|
* AT&T ksh in gmacs mode: abCd baCd abcd_ abdc_
|
||||||
* gnu emacs: abCd acbD abcd_ abdc_
|
* gnu emacs: abCd acbD abcd_ abdc_
|
||||||
* Pdksh currently goes with GNU behavior since I believe this is the
|
* Pdksh currently goes with GNU behavior since I believe this is the
|
||||||
* most common version of emacs, unless in gmacs mode, in which case
|
* most common version of emacs, unless in gmacs mode, in which case
|
||||||
* it does the at&t ksh gmacs mode.
|
* it does the AT&T ksh gmacs mode.
|
||||||
* This should really be broken up into 3 functions so users can bind
|
* This should really be broken up into 3 functions so users can bind
|
||||||
* to the one they want.
|
* to the one they want.
|
||||||
*/
|
*/
|
||||||
@ -3142,7 +3142,7 @@ x_version(int c __unused)
|
|||||||
|
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
return (KSTD);
|
return (KSTD);
|
||||||
/* This is what at&t ksh seems to do... Very bizarre */
|
/* This is what AT&T ksh seems to do... Very bizarre */
|
||||||
if (c != ' ')
|
if (c != ' ')
|
||||||
x_e_ungetc(c);
|
x_e_ungetc(c);
|
||||||
|
|
||||||
@ -4563,7 +4563,7 @@ vi_cmd(int argcnt, const char *cmd)
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
case '=': /* at&t ksh */
|
case '=': /* AT&T ksh */
|
||||||
case Ctrl('e'): /* Nonstandard vi/ksh */
|
case Ctrl('e'): /* Nonstandard vi/ksh */
|
||||||
print_expansions(es, 1);
|
print_expansions(es, 1);
|
||||||
break;
|
break;
|
||||||
@ -4575,16 +4575,16 @@ vi_cmd(int argcnt, const char *cmd)
|
|||||||
complete_word(1, argcnt);
|
complete_word(1, argcnt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Ctrl('['): /* some annoying at&t kshs */
|
case Ctrl('['): /* some annoying AT&T kshs */
|
||||||
if (!Flag(FVIESCCOMPLETE))
|
if (!Flag(FVIESCCOMPLETE))
|
||||||
return (-1);
|
return (-1);
|
||||||
case '\\': /* at&t ksh */
|
case '\\': /* AT&T ksh */
|
||||||
case Ctrl('f'): /* Nonstandard vi/ksh */
|
case Ctrl('f'): /* Nonstandard vi/ksh */
|
||||||
complete_word(1, argcnt);
|
complete_word(1, argcnt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case '*': /* at&t ksh */
|
case '*': /* AT&T ksh */
|
||||||
case Ctrl('x'): /* Nonstandard vi/ksh */
|
case Ctrl('x'): /* Nonstandard vi/ksh */
|
||||||
expand_word(1);
|
expand_word(1);
|
||||||
break;
|
break;
|
||||||
|
8
eval.c
8
eval.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.59 2009/06/10 18:12:45 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.60 2009/06/11 12:42:17 tg Exp $");
|
||||||
|
|
||||||
#ifdef MKSH_SMALL
|
#ifdef MKSH_SMALL
|
||||||
#define MKSH_NOPWNAM
|
#define MKSH_NOPWNAM
|
||||||
@ -612,7 +612,7 @@ expand(const char *cp, /* input word */
|
|||||||
* like x[i+=1] to be evaluated twice.
|
* like x[i+=1] to be evaluated twice.
|
||||||
*/
|
*/
|
||||||
/* Note: not exported by FEXPORT
|
/* Note: not exported by FEXPORT
|
||||||
* in at&t ksh.
|
* in AT&T ksh.
|
||||||
*/
|
*/
|
||||||
/* XXX POSIX says readonly is only
|
/* XXX POSIX says readonly is only
|
||||||
* fatal for special builtins (setstr
|
* fatal for special builtins (setstr
|
||||||
@ -764,7 +764,7 @@ expand(const char *cp, /* input word */
|
|||||||
* IFS_WS -/WS w/NWS -
|
* IFS_WS -/WS w/NWS -
|
||||||
* IFS_NWS -/NWS w/NWS w
|
* IFS_NWS -/NWS w/NWS w
|
||||||
* (w means generate a word)
|
* (w means generate a word)
|
||||||
* Note that IFS_NWS/0 generates a word (at&t ksh
|
* Note that IFS_NWS/0 generates a word (AT&T ksh
|
||||||
* doesn't do this, but POSIX does).
|
* doesn't do this, but POSIX does).
|
||||||
*/
|
*/
|
||||||
if (word == IFS_WORD ||
|
if (word == IFS_WORD ||
|
||||||
@ -1474,7 +1474,7 @@ alt_expand(XPtrV *wp, char *start, char *exp_start, char *end, int fdo)
|
|||||||
/* no valid expansions... */
|
/* no valid expansions... */
|
||||||
if (!p || count != 0) {
|
if (!p || count != 0) {
|
||||||
/* Note that given a{{b,c} we do not expand anything (this is
|
/* Note that given a{{b,c} we do not expand anything (this is
|
||||||
* what at&t ksh does. This may be changed to do the {b,c}
|
* what AT&T ksh does. This may be changed to do the {b,c}
|
||||||
* expansion. }
|
* expansion. }
|
||||||
*/
|
*/
|
||||||
if (fdo & DOGLOB)
|
if (fdo & DOGLOB)
|
||||||
|
8
exec.c
8
exec.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.58 2009/06/10 18:12:45 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.59 2009/06/11 12:42:17 tg Exp $");
|
||||||
|
|
||||||
static int comexec(struct op *, struct tbl *volatile, const char **,
|
static int comexec(struct op *, struct tbl *volatile, const char **,
|
||||||
int volatile, volatile int *);
|
int volatile, volatile int *);
|
||||||
@ -410,7 +410,7 @@ comexec(struct op *t, struct tbl *volatile tp, const char **ap,
|
|||||||
int fcflags = FC_BI|FC_FUNC|FC_PATH;
|
int fcflags = FC_BI|FC_FUNC|FC_PATH;
|
||||||
int bourne_function_call = 0;
|
int bourne_function_call = 0;
|
||||||
|
|
||||||
/* snag the last argument for $_ XXX not the same as at&t ksh,
|
/* snag the last argument for $_ XXX not the same as AT&T ksh,
|
||||||
* which only seems to set $_ after a newline (but not in
|
* which only seems to set $_ after a newline (but not in
|
||||||
* functions/dot scripts, but in interactive and script) -
|
* functions/dot scripts, but in interactive and script) -
|
||||||
* perhaps save last arg here and set it in shell()?.
|
* perhaps save last arg here and set it in shell()?.
|
||||||
@ -608,7 +608,7 @@ comexec(struct op *t, struct tbl *volatile tp, const char **ap,
|
|||||||
e->type = E_FUNC;
|
e->type = E_FUNC;
|
||||||
i = sigsetjmp(e->jbuf, 0);
|
i = sigsetjmp(e->jbuf, 0);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
/* seems odd to pass XERROK here, but at&t ksh does */
|
/* seems odd to pass XERROK here, but AT&T ksh does */
|
||||||
exstat = execute(tp->val.t, flags & XERROK, xerrok);
|
exstat = execute(tp->val.t, flags & XERROK, xerrok);
|
||||||
i = LRETURN;
|
i = LRETURN;
|
||||||
}
|
}
|
||||||
@ -967,7 +967,7 @@ findcom(const char *name, int flags)
|
|||||||
(fpath = str_val(global("FPATH"))) != null &&
|
(fpath = str_val(global("FPATH"))) != null &&
|
||||||
(npath.ro = search(name, fpath, R_OK,
|
(npath.ro = search(name, fpath, R_OK,
|
||||||
&tp->u2.errno_)) != NULL) {
|
&tp->u2.errno_)) != NULL) {
|
||||||
/* An undocumented feature of at&t ksh is that it
|
/* An undocumented feature of AT&T ksh is that it
|
||||||
* searches FPATH if a command is not found, even
|
* searches FPATH if a command is not found, even
|
||||||
* if the command hasn't been set up as an autoloaded
|
* if the command hasn't been set up as an autoloaded
|
||||||
* function (ie, no typeset -uf).
|
* function (ie, no typeset -uf).
|
||||||
|
38
funcs.c
38
funcs.c
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.114 2009/06/10 18:12:46 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.115 2009/06/11 12:42:18 tg Exp $");
|
||||||
|
|
||||||
#if HAVE_KILLPG
|
#if HAVE_KILLPG
|
||||||
/*
|
/*
|
||||||
@ -74,7 +74,7 @@ const struct builtin mkshbuiltins[] = {
|
|||||||
{"ulimit", c_ulimit},
|
{"ulimit", c_ulimit},
|
||||||
{"+umask", c_umask},
|
{"+umask", c_umask},
|
||||||
{"*=unset", c_unset},
|
{"*=unset", c_unset},
|
||||||
{"+alias", c_alias}, /* no =: at&t manual wrong */
|
{"+alias", c_alias}, /* no =: AT&T manual wrong */
|
||||||
{"+cd", c_cd},
|
{"+cd", c_cd},
|
||||||
{"+command", c_command},
|
{"+command", c_command},
|
||||||
{"echo", c_print},
|
{"echo", c_print},
|
||||||
@ -279,7 +279,7 @@ c_cd(const char **wp)
|
|||||||
flushcom(0);
|
flushcom(0);
|
||||||
|
|
||||||
/* Set OLDPWD (note: unsetting OLDPWD does not disable this
|
/* Set OLDPWD (note: unsetting OLDPWD does not disable this
|
||||||
* setting in at&t ksh)
|
* setting in AT&T ksh)
|
||||||
*/
|
*/
|
||||||
if (current_wd[0])
|
if (current_wd[0])
|
||||||
/* Ignore failure (happens if readonly or integer) */
|
/* Ignore failure (happens if readonly or integer) */
|
||||||
@ -751,7 +751,7 @@ c_typeset(const char **wp)
|
|||||||
|
|
||||||
fieldstr = basestr = NULL;
|
fieldstr = basestr = NULL;
|
||||||
builtin_opt.flags |= GF_PLUSOPT;
|
builtin_opt.flags |= GF_PLUSOPT;
|
||||||
/* at&t ksh seems to have 0-9 as options which are multiplied
|
/* AT&T ksh seems to have 0-9 as options which are multiplied
|
||||||
* to get a number that is used with -L, -R, -Z or -i (eg, -1R2
|
* to get a number that is used with -L, -R, -Z or -i (eg, -1R2
|
||||||
* sets right justify in a field of 12). This allows options
|
* sets right justify in a field of 12). This allows options
|
||||||
* to be grouped in an order (eg, -Lu12), but disallows -i8 -L3 and
|
* to be grouped in an order (eg, -Lu12), but disallows -i8 -L3 and
|
||||||
@ -771,7 +771,7 @@ c_typeset(const char **wp)
|
|||||||
fieldstr = builtin_opt.optarg;
|
fieldstr = builtin_opt.optarg;
|
||||||
break;
|
break;
|
||||||
case 'U':
|
case 'U':
|
||||||
/* at&t ksh uses u, but this conflicts with
|
/* AT&T ksh uses u, but this conflicts with
|
||||||
* upper/lower case. If this option is changed,
|
* upper/lower case. If this option is changed,
|
||||||
* need to change the -U below as well
|
* need to change the -U below as well
|
||||||
*/
|
*/
|
||||||
@ -877,7 +877,7 @@ c_typeset(const char **wp)
|
|||||||
f = findfunc(wp[i], hash(wp[i]),
|
f = findfunc(wp[i], hash(wp[i]),
|
||||||
(fset&UCASEV_AL) ? true : false);
|
(fset&UCASEV_AL) ? true : false);
|
||||||
if (!f) {
|
if (!f) {
|
||||||
/* at&t ksh does ++rv: bogus */
|
/* AT&T ksh does ++rv: bogus */
|
||||||
rv = 1;
|
rv = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -949,7 +949,7 @@ c_typeset(const char **wp)
|
|||||||
continue;
|
continue;
|
||||||
/* no arguments */
|
/* no arguments */
|
||||||
if (thing == 0 && flag == 0) {
|
if (thing == 0 && flag == 0) {
|
||||||
/* at&t ksh prints things
|
/* AT&T ksh prints things
|
||||||
* like export, integer,
|
* like export, integer,
|
||||||
* leftadj, zerofill, etc.,
|
* leftadj, zerofill, etc.,
|
||||||
* but POSIX says must
|
* but POSIX says must
|
||||||
@ -981,7 +981,7 @@ c_typeset(const char **wp)
|
|||||||
char *s = str_val(vp);
|
char *s = str_val(vp);
|
||||||
|
|
||||||
shf_putc('=', shl_stdout);
|
shf_putc('=', shl_stdout);
|
||||||
/* at&t ksh can't have
|
/* AT&T ksh can't have
|
||||||
* justified integers.. */
|
* justified integers.. */
|
||||||
if ((vp->flag &
|
if ((vp->flag &
|
||||||
(INTEGER|LJUST|RJUST)) ==
|
(INTEGER|LJUST|RJUST)) ==
|
||||||
@ -1011,7 +1011,7 @@ c_typeset(const char **wp)
|
|||||||
char *s = str_val(vp);
|
char *s = str_val(vp);
|
||||||
|
|
||||||
shf_putc('=', shl_stdout);
|
shf_putc('=', shl_stdout);
|
||||||
/* at&t ksh can't have
|
/* AT&T ksh can't have
|
||||||
* justified integers.. */
|
* justified integers.. */
|
||||||
if ((vp->flag &
|
if ((vp->flag &
|
||||||
(INTEGER|LJUST|RJUST)) ==
|
(INTEGER|LJUST|RJUST)) ==
|
||||||
@ -1154,7 +1154,7 @@ c_alias(const char **wp)
|
|||||||
ap->flag &= ~(ALLOC|ISSET);
|
ap->flag &= ~(ALLOC|ISSET);
|
||||||
afree(ap->val.s, APERM);
|
afree(ap->val.s, APERM);
|
||||||
}
|
}
|
||||||
/* ignore values for -t (at&t ksh does this) */
|
/* ignore values for -t (AT&T ksh does this) */
|
||||||
newval = tflag ? search(alias, path, X_OK, NULL) : val;
|
newval = tflag ? search(alias, path, X_OK, NULL) : val;
|
||||||
if (newval) {
|
if (newval) {
|
||||||
strdupx(ap->val.s, newval, APERM);
|
strdupx(ap->val.s, newval, APERM);
|
||||||
@ -1235,7 +1235,7 @@ c_let(const char **wp)
|
|||||||
int rv = 1;
|
int rv = 1;
|
||||||
mksh_ari_t val;
|
mksh_ari_t val;
|
||||||
|
|
||||||
if (wp[1] == NULL) /* at&t ksh does this */
|
if (wp[1] == NULL) /* AT&T ksh does this */
|
||||||
bi_errorf("no arguments");
|
bi_errorf("no arguments");
|
||||||
else
|
else
|
||||||
for (wp++; *wp; wp++)
|
for (wp++; *wp; wp++)
|
||||||
@ -1484,14 +1484,14 @@ c_getopts(const char **wp)
|
|||||||
buf[1] = optc;
|
buf[1] = optc;
|
||||||
buf[2] = '\0';
|
buf[2] = '\0';
|
||||||
} else {
|
} else {
|
||||||
/* POSIX says var is set to ? at end-of-options, at&t ksh
|
/* POSIX says var is set to ? at end-of-options, AT&T ksh
|
||||||
* sets it to null - we go with POSIX...
|
* sets it to null - we go with POSIX...
|
||||||
*/
|
*/
|
||||||
buf[0] = optc < 0 ? '?' : optc;
|
buf[0] = optc < 0 ? '?' : optc;
|
||||||
buf[1] = '\0';
|
buf[1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* at&t ksh does not change OPTIND if it was an unknown option.
|
/* AT&T ksh does not change OPTIND if it was an unknown option.
|
||||||
* Scripts counting on this are prone to break... (ie, don't count
|
* Scripts counting on this are prone to break... (ie, don't count
|
||||||
* on this staying).
|
* on this staying).
|
||||||
*/
|
*/
|
||||||
@ -1500,7 +1500,7 @@ c_getopts(const char **wp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
voptarg = global("OPTARG");
|
voptarg = global("OPTARG");
|
||||||
voptarg->flag &= ~RDONLY; /* at&t ksh clears ro and int */
|
voptarg->flag &= ~RDONLY; /* AT&T ksh clears ro and int */
|
||||||
/* Paranoia: ensure no bizarre results. */
|
/* Paranoia: ensure no bizarre results. */
|
||||||
if (voptarg->flag & INTEGER)
|
if (voptarg->flag & INTEGER)
|
||||||
typeset("OPTARG", 0, INTEGER, 0, 0);
|
typeset("OPTARG", 0, INTEGER, 0, 0);
|
||||||
@ -1840,7 +1840,7 @@ c_read(const char **wp)
|
|||||||
wpalloc[cp - *wp] = '\0';
|
wpalloc[cp - *wp] = '\0';
|
||||||
*wp = wpalloc;
|
*wp = wpalloc;
|
||||||
if (isatty(fd)) {
|
if (isatty(fd)) {
|
||||||
/* at&t ksh says it prints prompt on fd if it's open
|
/* AT&T ksh says it prints prompt on fd if it's open
|
||||||
* for writing and is a tty, but it doesn't do it
|
* for writing and is a tty, but it doesn't do it
|
||||||
* (it also doesn't check the interactive flag,
|
* (it also doesn't check the interactive flag,
|
||||||
* as is indicated in the Kornshell book).
|
* as is indicated in the Kornshell book).
|
||||||
@ -1853,7 +1853,7 @@ c_read(const char **wp)
|
|||||||
* make sure the other side of the pipe is closed first. This allows
|
* make sure the other side of the pipe is closed first. This allows
|
||||||
* the detection of eof.
|
* the detection of eof.
|
||||||
*
|
*
|
||||||
* This is not compatible with at&t ksh... the fd is kept so another
|
* This is not compatible with AT&T ksh... the fd is kept so another
|
||||||
* coproc can be started with same output, however, this means eof
|
* coproc can be started with same output, however, this means eof
|
||||||
* can't be detected... This is why it is closed here.
|
* can't be detected... This is why it is closed here.
|
||||||
* If this call is removed, remove the eof check below, too.
|
* If this call is removed, remove the eof check below, too.
|
||||||
@ -2109,7 +2109,7 @@ c_brkcont(const char **wp)
|
|||||||
return (1);
|
return (1);
|
||||||
quit = n;
|
quit = n;
|
||||||
if (quit <= 0) {
|
if (quit <= 0) {
|
||||||
/* at&t ksh does this for non-interactive shells only - weird */
|
/* AT&T ksh does this for non-interactive shells only - weird */
|
||||||
bi_errorf("%s: bad value", arg);
|
bi_errorf("%s: bad value", arg);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
@ -2124,7 +2124,7 @@ c_brkcont(const char **wp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (quit) {
|
if (quit) {
|
||||||
/* at&t ksh doesn't print a message - just does what it
|
/* AT&T ksh doesn't print a message - just does what it
|
||||||
* can. We print a message 'cause it helps in debugging
|
* can. We print a message 'cause it helps in debugging
|
||||||
* scripts, but don't generate an error (ie, keep going).
|
* scripts, but don't generate an error (ie, keep going).
|
||||||
*/
|
*/
|
||||||
@ -2268,7 +2268,7 @@ timex(struct op *t, int f, volatile int *xerrok)
|
|||||||
* Two ways of getting cpu usage of a command: just use t0
|
* Two ways of getting cpu usage of a command: just use t0
|
||||||
* and t1 (which will get cpu usage from other jobs that
|
* and t1 (which will get cpu usage from other jobs that
|
||||||
* finish while we are executing t->left), or get the
|
* finish while we are executing t->left), or get the
|
||||||
* cpu usage of t->left. at&t ksh does the former, while
|
* cpu usage of t->left. AT&T ksh does the former, while
|
||||||
* pdksh tries to do the later (the j_usrtime hack doesn't
|
* pdksh tries to do the later (the j_usrtime hack doesn't
|
||||||
* really work as it only counts the last job).
|
* really work as it only counts the last job).
|
||||||
*/
|
*/
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.84 2009/06/10 18:12:46 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.85 2009/06/11 12:42:18 tg Exp $");
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* MirOS: This is the default mapping type, and need not be specified.
|
* MirOS: This is the default mapping type, and need not be specified.
|
||||||
@ -96,7 +96,7 @@ c_fc(const char **wp)
|
|||||||
memcpy(editor + len, " $_", 4);
|
memcpy(editor + len, " $_", 4);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'g': /* non-at&t ksh */
|
case 'g': /* non-AT&T ksh */
|
||||||
gflag++;
|
gflag++;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
@ -183,7 +183,7 @@ c_fc(const char **wp)
|
|||||||
hlast = hist_get_newest(false);
|
hlast = hist_get_newest(false);
|
||||||
} else {
|
} else {
|
||||||
/* POSIX says not an error if first/last out of bounds
|
/* POSIX says not an error if first/last out of bounds
|
||||||
* when range is specified; at&t ksh and pdksh allow out of
|
* when range is specified; AT&T ksh and pdksh allow out of
|
||||||
* bounds for -l as well.
|
* bounds for -l as well.
|
||||||
*/
|
*/
|
||||||
hfirst = hist_get(first, (lflag || last) ? true : false,
|
hfirst = hist_get(first, (lflag || last) ? true : false,
|
||||||
|
8
jobs.c
8
jobs.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.56 2009/06/10 18:12:47 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.57 2009/06/11 12:42:19 tg Exp $");
|
||||||
|
|
||||||
#if HAVE_KILLPG
|
#if HAVE_KILLPG
|
||||||
#define mksh_killpg killpg
|
#define mksh_killpg killpg
|
||||||
@ -586,7 +586,7 @@ waitfor(const char *cp, int *sigp)
|
|||||||
* don't have to worry about exited/signaled jobs
|
* don't have to worry about exited/signaled jobs
|
||||||
*/
|
*/
|
||||||
for (j = job_list; j; j = j->next)
|
for (j = job_list; j; j = j->next)
|
||||||
/* at&t ksh will wait for stopped jobs - we don't */
|
/* AT&T ksh will wait for stopped jobs - we don't */
|
||||||
if (j->ppid == procpid && j->state == PRUNNING)
|
if (j->ppid == procpid && j->state == PRUNNING)
|
||||||
break;
|
break;
|
||||||
if (!j) {
|
if (!j) {
|
||||||
@ -607,7 +607,7 @@ waitfor(const char *cp, int *sigp)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* at&t ksh will wait for stopped jobs - we don't */
|
/* AT&T ksh will wait for stopped jobs - we don't */
|
||||||
rv = j_waitj(j, flags, "jw:waitfor");
|
rv = j_waitj(j, flags, "jw:waitfor");
|
||||||
|
|
||||||
sigprocmask(SIG_SETMASK, &omask, NULL);
|
sigprocmask(SIG_SETMASK, &omask, NULL);
|
||||||
@ -1048,7 +1048,7 @@ j_waitj(Job *j,
|
|||||||
}
|
}
|
||||||
#ifndef MKSH_UNEMPLOYED
|
#ifndef MKSH_UNEMPLOYED
|
||||||
/* If it looks like user hit ^C to kill a job, pretend we got
|
/* If it looks like user hit ^C to kill a job, pretend we got
|
||||||
* one too to break out of for loops, etc. (at&t ksh does this
|
* one too to break out of for loops, etc. (AT&T ksh does this
|
||||||
* even when not monitoring, but this doesn't make sense since
|
* even when not monitoring, but this doesn't make sense since
|
||||||
* a tty generated ^C goes to the whole process group)
|
* a tty generated ^C goes to the whole process group)
|
||||||
*/
|
*/
|
||||||
|
8
lex.c
8
lex.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.87 2009/06/10 18:12:47 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.88 2009/06/11 12:42:19 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* states while lexing word
|
* states while lexing word
|
||||||
@ -437,7 +437,7 @@ yylex(int cf)
|
|||||||
PUSH_STATE(SBQUOTE);
|
PUSH_STATE(SBQUOTE);
|
||||||
*wp++ = COMSUB;
|
*wp++ = COMSUB;
|
||||||
/* Need to know if we are inside double quotes
|
/* Need to know if we are inside double quotes
|
||||||
* since sh/at&t-ksh translate the \" to " in
|
* since sh/AT&T-ksh translate the \" to " in
|
||||||
* "`..\"..`".
|
* "`..\"..`".
|
||||||
* This is not done in posix mode (section
|
* This is not done in posix mode (section
|
||||||
* 3.2.3, Double Quotes: "The backquote shall
|
* 3.2.3, Double Quotes: "The backquote shall
|
||||||
@ -665,7 +665,7 @@ yylex(int cf)
|
|||||||
ungetsc(c2);
|
ungetsc(c2);
|
||||||
} else if (c == '(')
|
} else if (c == '(')
|
||||||
/* parenthesis inside quotes and backslashes
|
/* parenthesis inside quotes and backslashes
|
||||||
* are lost, but at&t ksh doesn't count them
|
* are lost, but AT&T ksh doesn't count them
|
||||||
* either
|
* either
|
||||||
*/
|
*/
|
||||||
++statep->ls_sletparen.nparen;
|
++statep->ls_sletparen.nparen;
|
||||||
@ -1295,7 +1295,7 @@ set_prompt(int to, Source *s)
|
|||||||
case PS1: /* command */
|
case PS1: /* command */
|
||||||
/* Substitute ! and !! here, before substitutions are done
|
/* Substitute ! and !! here, before substitutions are done
|
||||||
* so ! in expanded variables are not expanded.
|
* so ! in expanded variables are not expanded.
|
||||||
* NOTE: this is not what at&t ksh does (it does it after
|
* NOTE: this is not what AT&T ksh does (it does it after
|
||||||
* substitutions, POSIX doesn't say which is to be done.
|
* substitutions, POSIX doesn't say which is to be done.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
10
main.c
10
main.c
@ -33,7 +33,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.132 2009/06/10 18:12:47 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.133 2009/06/11 12:42:19 tg Exp $");
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ static const char *initcoms[] = {
|
|||||||
"source=PATH=$PATH:. command .",
|
"source=PATH=$PATH:. command .",
|
||||||
"login=exec login",
|
"login=exec login",
|
||||||
NULL,
|
NULL,
|
||||||
/* this is what at&t ksh seems to track, with the addition of emacs */
|
/* this is what AT&T ksh seems to track, with the addition of emacs */
|
||||||
"alias", "-tU",
|
"alias", "-tU",
|
||||||
"cat", "cc", "chmod", "cp", "date", "ed", "emacs", "grep", "ls",
|
"cat", "cc", "chmod", "cp", "date", "ed", "emacs", "grep", "ls",
|
||||||
"make", "mv", "pr", "rm", "sed", "sh", "vi", "who", NULL,
|
"make", "mv", "pr", "rm", "sed", "sh", "vi", "who", NULL,
|
||||||
@ -184,7 +184,7 @@ main(int argc, const char *argv[])
|
|||||||
|
|
||||||
/* Turn on nohup by default for now - will change to off
|
/* Turn on nohup by default for now - will change to off
|
||||||
* by default once people are aware of its existence
|
* by default once people are aware of its existence
|
||||||
* (at&t ksh does not have a nohup option - it always sends
|
* (AT&T ksh does not have a nohup option - it always sends
|
||||||
* the hup).
|
* the hup).
|
||||||
*/
|
*/
|
||||||
Flag(FNOHUP) = 1;
|
Flag(FNOHUP) = 1;
|
||||||
@ -610,7 +610,7 @@ shell(Source * volatile s, volatile int toplevel)
|
|||||||
void
|
void
|
||||||
unwind(int i)
|
unwind(int i)
|
||||||
{
|
{
|
||||||
/* ordering for EXIT vs ERR is a bit odd (this is what at&t ksh does) */
|
/* ordering for EXIT vs ERR is a bit odd (this is what AT&T ksh does) */
|
||||||
if (i == LEXIT || (Flag(FERREXIT) && (i == LERROR || i == LINTR) &&
|
if (i == LEXIT || (Flag(FERREXIT) && (i == LERROR || i == LINTR) &&
|
||||||
sigtraps[SIGEXIT_].trap)) {
|
sigtraps[SIGEXIT_].trap)) {
|
||||||
runtrap(&sigtraps[SIGEXIT_]);
|
runtrap(&sigtraps[SIGEXIT_]);
|
||||||
@ -692,7 +692,7 @@ quitenv(struct shf *shf)
|
|||||||
if (ep->flags & EF_FAKE_SIGDIE) {
|
if (ep->flags & EF_FAKE_SIGDIE) {
|
||||||
int sig = exstat - 128;
|
int sig = exstat - 128;
|
||||||
|
|
||||||
/* ham up our death a bit (at&t ksh
|
/* ham up our death a bit (AT&T ksh
|
||||||
* only seems to do this for SIGTERM)
|
* only seems to do this for SIGTERM)
|
||||||
* Don't do it for SIGQUIT, since we'd
|
* Don't do it for SIGQUIT, since we'd
|
||||||
* dump a core..
|
* dump a core..
|
||||||
|
4
misc.c
4
misc.c
@ -29,7 +29,7 @@
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.110 2009/06/10 18:12:48 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.111 2009/06/11 12:42:20 tg Exp $");
|
||||||
|
|
||||||
#undef USE_CHVT
|
#undef USE_CHVT
|
||||||
#if defined(TIOCSCTTY) && !defined(MKSH_SMALL)
|
#if defined(TIOCSCTTY) && !defined(MKSH_SMALL)
|
||||||
@ -407,7 +407,7 @@ parse_args(const char **argv,
|
|||||||
default:
|
default:
|
||||||
if (what == OF_FIRSTTIME)
|
if (what == OF_FIRSTTIME)
|
||||||
break;
|
break;
|
||||||
/* -s: sort positional params (at&t ksh stupidity) */
|
/* -s: sort positional params (AT&T ksh stupidity) */
|
||||||
if (what == OF_SET && optc == 's') {
|
if (what == OF_SET && optc == 's') {
|
||||||
sortargs = 1;
|
sortargs = 1;
|
||||||
break;
|
break;
|
||||||
|
16
syn.c
16
syn.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.37 2009/06/10 18:12:50 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.38 2009/06/11 12:42:20 tg Exp $");
|
||||||
|
|
||||||
struct nesting_state {
|
struct nesting_state {
|
||||||
int start_token; /* token than began nesting (eg, FOR) */
|
int start_token; /* token than began nesting (eg, FOR) */
|
||||||
@ -267,7 +267,7 @@ get_command(int cf)
|
|||||||
case LWORD:
|
case LWORD:
|
||||||
ACCEPT;
|
ACCEPT;
|
||||||
/* the iopn == 0 and XPsize(vars) == 0 are
|
/* the iopn == 0 and XPsize(vars) == 0 are
|
||||||
* dubious but at&t ksh acts this way
|
* dubious but AT&T ksh acts this way
|
||||||
*/
|
*/
|
||||||
if (iopn == 0 && XPsize(vars) == 0 &&
|
if (iopn == 0 && XPsize(vars) == 0 &&
|
||||||
XPsize(args) == 0 &&
|
XPsize(args) == 0 &&
|
||||||
@ -281,7 +281,7 @@ get_command(int cf)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '(':
|
case '(':
|
||||||
/* Check for "> foo (echo hi)" which at&t ksh
|
/* Check for "> foo (echo hi)" which AT&T ksh
|
||||||
* allows (not POSIX, but not disallowed)
|
* allows (not POSIX, but not disallowed)
|
||||||
*/
|
*/
|
||||||
afree(t, ATEMP);
|
afree(t, ATEMP);
|
||||||
@ -618,8 +618,8 @@ function_body(char *name,
|
|||||||
t->lineno = source->line;
|
t->lineno = source->line;
|
||||||
|
|
||||||
/* Note that POSIX allows only compound statements after foo(), sh and
|
/* Note that POSIX allows only compound statements after foo(), sh and
|
||||||
* at&t ksh allow any command, go with the later since it shouldn't
|
* AT&T ksh allow any command, go with the later since it shouldn't
|
||||||
* break anything. However, for function foo, at&t ksh only accepts
|
* break anything. However, for function foo, AT&T ksh only accepts
|
||||||
* an open-brace.
|
* an open-brace.
|
||||||
*/
|
*/
|
||||||
if (ksh_func) {
|
if (ksh_func) {
|
||||||
@ -663,7 +663,7 @@ wordlist(void)
|
|||||||
XPinit(args, 16);
|
XPinit(args, 16);
|
||||||
/* Posix does not do alias expansion here... */
|
/* Posix does not do alias expansion here... */
|
||||||
if ((c = token(CONTIN|KEYWORD|ALIAS)) != IN) {
|
if ((c = token(CONTIN|KEYWORD|ALIAS)) != IN) {
|
||||||
if (c != ';') /* non-POSIX, but at&t ksh accepts a ; here */
|
if (c != ';') /* non-POSIX, but AT&T ksh accepts a ; here */
|
||||||
REJECT;
|
REJECT;
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -843,10 +843,10 @@ compile(Source *s)
|
|||||||
return (outtree);
|
return (outtree);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This kludge exists to take care of sh/at&t ksh oddity in which
|
/* This kludge exists to take care of sh/AT&T ksh oddity in which
|
||||||
* the arguments of alias/export/readonly/typeset have no field
|
* the arguments of alias/export/readonly/typeset have no field
|
||||||
* splitting, file globbing, or (normal) tilde expansion done.
|
* splitting, file globbing, or (normal) tilde expansion done.
|
||||||
* at&t ksh seems to do something similar to this since
|
* AT&T ksh seems to do something similar to this since
|
||||||
* $ touch a=a; typeset a=[ab]; echo "$a"
|
* $ touch a=a; typeset a=[ab]; echo "$a"
|
||||||
* a=[ab]
|
* a=[ab]
|
||||||
* $ x=typeset; $x a=[ab]; echo "$a"
|
* $ x=typeset; $x a=[ab]; echo "$a"
|
||||||
|
18
var.c
18
var.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.74 2009/06/10 18:12:51 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.75 2009/06/11 12:42:21 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Variables
|
* Variables
|
||||||
@ -555,7 +555,7 @@ formatstr(struct tbl *vp, const char *s)
|
|||||||
|
|
||||||
while (i < slen)
|
while (i < slen)
|
||||||
i += utf_widthadj(qq, &qq);
|
i += utf_widthadj(qq, &qq);
|
||||||
/* strip trailing spaces (at&t uses qq[-1] == ' ') */
|
/* strip trailing spaces (AT&T uses qq[-1] == ' ') */
|
||||||
while (qq > s && ksh_isspace(qq[-1])) {
|
while (qq > s && ksh_isspace(qq[-1])) {
|
||||||
--qq;
|
--qq;
|
||||||
--slen;
|
--slen;
|
||||||
@ -685,7 +685,7 @@ typeset(const char *var, Tflag set, Tflag clr, int field, int base)
|
|||||||
|
|
||||||
vpbase = (vp->flag & ARRAY) ? global(arrayname(var)) : vp;
|
vpbase = (vp->flag & ARRAY) ? global(arrayname(var)) : vp;
|
||||||
|
|
||||||
/* only allow export flag to be set. at&t ksh allows any attribute to
|
/* only allow export flag to be set. AT&T ksh allows any attribute to
|
||||||
* be changed which means it can be truncated or modified (-L/-R/-Z/-i)
|
* be changed which means it can be truncated or modified (-L/-R/-Z/-i)
|
||||||
*/
|
*/
|
||||||
if ((vpbase->flag&RDONLY) &&
|
if ((vpbase->flag&RDONLY) &&
|
||||||
@ -1179,7 +1179,7 @@ setspec(struct tbl *vp)
|
|||||||
vp->flag |= SPECIAL;
|
vp->flag |= SPECIAL;
|
||||||
break;
|
break;
|
||||||
case V_TMOUT:
|
case V_TMOUT:
|
||||||
/* at&t ksh seems to do this (only listen if integer) */
|
/* AT&T ksh seems to do this (only listen if integer) */
|
||||||
if (vp->flag & INTEGER)
|
if (vp->flag & INTEGER)
|
||||||
ksh_tmout = vp->val.i >= 0 ? vp->val.i : 0;
|
ksh_tmout = vp->val.i >= 0 ? vp->val.i : 0;
|
||||||
break;
|
break;
|
||||||
@ -1216,16 +1216,16 @@ unsetspec(struct tbl *vp)
|
|||||||
case V_LINENO:
|
case V_LINENO:
|
||||||
case V_RANDOM:
|
case V_RANDOM:
|
||||||
case V_SECONDS:
|
case V_SECONDS:
|
||||||
case V_TMOUT: /* at&t ksh leaves previous value in place */
|
case V_TMOUT: /* AT&T ksh leaves previous value in place */
|
||||||
unspecial(vp->name);
|
unspecial(vp->name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* at&t ksh man page says OPTIND, OPTARG and _ lose special meaning,
|
/* AT&T ksh man page says OPTIND, OPTARG and _ lose special meaning,
|
||||||
* but OPTARG does not (still set by getopts) and _ is also still
|
* but OPTARG does not (still set by getopts) and _ is also still
|
||||||
* set in various places.
|
* set in various places.
|
||||||
* Don't know what at&t does for:
|
* Don't know what AT&T does for:
|
||||||
* HISTSIZE, HISTFILE,
|
* HISTSIZE, HISTFILE,
|
||||||
* Unsetting these in at&t ksh does not loose the 'specialness':
|
* Unsetting these in AT&T ksh does not loose the 'specialness':
|
||||||
* no effect: IFS, COLUMNS, PATH, TMPDIR
|
* no effect: IFS, COLUMNS, PATH, TMPDIR
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@ -1320,7 +1320,7 @@ set_array(const char *var, int reset, const char **vals)
|
|||||||
/* to get local array, use "typeset foo; set -A foo" */
|
/* to get local array, use "typeset foo; set -A foo" */
|
||||||
vp = global(var);
|
vp = global(var);
|
||||||
|
|
||||||
/* Note: at&t ksh allows set -A but not set +A of a read-only var */
|
/* Note: AT&T ksh allows set -A but not set +A of a read-only var */
|
||||||
if ((vp->flag&RDONLY))
|
if ((vp->flag&RDONLY))
|
||||||
errorf("%s: is read only", var);
|
errorf("%s: is read only", var);
|
||||||
/* This code is quite non-optimal */
|
/* This code is quite non-optimal */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user