Import OpenBSD source tree of short before 17:00 UTC today
This commit is contained in:
4
edit.c
4
edit.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: edit.c,v 1.15 2002/06/09 05:47:27 todd Exp $ */
|
/* $OpenBSD: edit.c,v 1.16 2003/05/05 22:02:33 fgsch Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Command line editing - common code
|
* Command line editing - common code
|
||||||
@ -1058,7 +1058,7 @@ x_escape(s, len, putbuf_func)
|
|||||||
int rval=0;
|
int rval=0;
|
||||||
|
|
||||||
for (add = 0, wlen = len; wlen - add > 0; add++) {
|
for (add = 0, wlen = len; wlen - add > 0; add++) {
|
||||||
if (strchr("\\$(){}*&;#|<>\"'", s[add]) || strchr(ifs, s[add])) {
|
if (strchr("\\$(){}*&;#|<>\"'`", s[add]) || strchr(ifs, s[add])) {
|
||||||
if (putbuf_func(s, add) != 0) {
|
if (putbuf_func(s, add) != 0) {
|
||||||
rval = -1;
|
rval = -1;
|
||||||
break;
|
break;
|
||||||
|
8
emacs.c
8
emacs.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: emacs.c,v 1.18 2003/02/28 09:45:09 jmc Exp $ */
|
/* $OpenBSD: emacs.c,v 1.19 2003/04/16 23:11:52 tdeval Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Emacs-like command line editing and history
|
* Emacs-like command line editing and history
|
||||||
@ -886,9 +886,9 @@ x_load_hist(hp)
|
|||||||
}
|
}
|
||||||
x_histp = hp;
|
x_histp = hp;
|
||||||
oldsize = x_size_str(xbuf);
|
oldsize = x_size_str(xbuf);
|
||||||
(void)strcpy(xbuf, *hp);
|
strlcpy(xbuf, *hp, xend - xbuf);
|
||||||
xbp = xbuf;
|
xbp = xbuf;
|
||||||
xep = xcp = xbuf + strlen(*hp);
|
xep = xcp = xbuf + strlen(xbuf);
|
||||||
xlp_valid = FALSE;
|
xlp_valid = FALSE;
|
||||||
if (xep > x_lastcp())
|
if (xep > x_lastcp())
|
||||||
x_goto(xep);
|
x_goto(xep);
|
||||||
@ -1022,7 +1022,7 @@ x_del_line(c)
|
|||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
*xep = 0;
|
*xep = 0;
|
||||||
i = xep- xbuf;
|
i = xep - xbuf;
|
||||||
j = x_size_str(xbuf);
|
j = x_size_str(xbuf);
|
||||||
xcp = xbuf;
|
xcp = xbuf;
|
||||||
x_push(i);
|
x_push(i);
|
||||||
|
34
eval.c
34
eval.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: eval.c,v 1.12 2003/03/10 03:48:16 david Exp $ */
|
/* $OpenBSD: eval.c,v 1.13 2003/04/16 23:11:52 tdeval Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Expansion - quoting, separation, substitution, globbing
|
* Expansion - quoting, separation, substitution, globbing
|
||||||
@ -175,6 +175,7 @@ expand(cp, wp, f)
|
|||||||
int UNINITIALIZED(newlines); /* For trailing newlines in COMSUB */
|
int UNINITIALIZED(newlines); /* For trailing newlines in COMSUB */
|
||||||
int saw_eq, tilde_ok;
|
int saw_eq, tilde_ok;
|
||||||
int make_magic;
|
int make_magic;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
internal_errorf(1, "expand(NULL)");
|
internal_errorf(1, "expand(NULL)");
|
||||||
@ -415,10 +416,11 @@ expand(cp, wp, f)
|
|||||||
* fatal for special builtins (setstr
|
* fatal for special builtins (setstr
|
||||||
* does readonly check).
|
* does readonly check).
|
||||||
*/
|
*/
|
||||||
setstr(st->var, debunk(
|
len = strlen(dp) + 1;
|
||||||
(char *) alloc(strlen(dp) + 1,
|
setstr(st->var,
|
||||||
ATEMP), dp),
|
debunk((char *) alloc(len, ATEMP),
|
||||||
KSH_UNWIND_ERROR);
|
dp, len),
|
||||||
|
KSH_UNWIND_ERROR);
|
||||||
x.str = str_val(st->var);
|
x.str = str_val(st->var);
|
||||||
type = XSUB;
|
type = XSUB;
|
||||||
if (f&DOBLANK)
|
if (f&DOBLANK)
|
||||||
@ -432,7 +434,7 @@ expand(cp, wp, f)
|
|||||||
errorf("%s: %s", st->var->name,
|
errorf("%s: %s", st->var->name,
|
||||||
dp == s ?
|
dp == s ?
|
||||||
"parameter null or not set"
|
"parameter null or not set"
|
||||||
: (debunk(s, s), s));
|
: (debunk(s, s, strlen(s) + 1), s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
st = st->prev;
|
st = st->prev;
|
||||||
@ -576,7 +578,7 @@ expand(cp, wp, f)
|
|||||||
else if ((f & DOPAT) || !(fdo & DOMAGIC_))
|
else if ((f & DOPAT) || !(fdo & DOMAGIC_))
|
||||||
XPput(*wp, p);
|
XPput(*wp, p);
|
||||||
else
|
else
|
||||||
XPput(*wp, debunk(p, p));
|
XPput(*wp, debunk(p, p, strlen(p) + 1));
|
||||||
fdo = 0;
|
fdo = 0;
|
||||||
saw_eq = 0;
|
saw_eq = 0;
|
||||||
tilde_ok = (f & (DOTILDE|DOASNTILDE)) ? 1 : 0;
|
tilde_ok = (f & (DOTILDE|DOASNTILDE)) ? 1 : 0;
|
||||||
@ -950,7 +952,7 @@ glob(cp, wp, markdirs)
|
|||||||
int oldsize = XPsize(*wp);
|
int oldsize = XPsize(*wp);
|
||||||
|
|
||||||
if (glob_str(cp, wp, markdirs) == 0)
|
if (glob_str(cp, wp, markdirs) == 0)
|
||||||
XPput(*wp, debunk(cp, cp));
|
XPput(*wp, debunk(cp, cp, strlen(cp) + 1));
|
||||||
else
|
else
|
||||||
qsortp(XPptrv(*wp) + oldsize, (size_t)(XPsize(*wp) - oldsize),
|
qsortp(XPptrv(*wp) + oldsize, (size_t)(XPsize(*wp) - oldsize),
|
||||||
xstrcmp);
|
xstrcmp);
|
||||||
@ -1085,7 +1087,7 @@ globit(xs, xpp, sp, wp, check)
|
|||||||
*/
|
*/
|
||||||
if (!has_globbing(sp, se)) {
|
if (!has_globbing(sp, se)) {
|
||||||
XcheckN(*xs, xp, se - sp + 1);
|
XcheckN(*xs, xp, se - sp + 1);
|
||||||
debunk(xp, sp);
|
debunk(xp, sp, Xnleft(*xs, xp));
|
||||||
xp += strlen(xp);
|
xp += strlen(xp);
|
||||||
*xpp = xp;
|
*xpp = xp;
|
||||||
globit(xs, xpp, np, wp, check);
|
globit(xs, xpp, np, wp, check);
|
||||||
@ -1174,15 +1176,18 @@ copy_non_glob(xs, xpp, p)
|
|||||||
|
|
||||||
/* remove MAGIC from string */
|
/* remove MAGIC from string */
|
||||||
char *
|
char *
|
||||||
debunk(dp, sp)
|
debunk(dp, sp, dlen)
|
||||||
char *dp;
|
char *dp;
|
||||||
const char *sp;
|
const char *sp;
|
||||||
|
size_t dlen;
|
||||||
{
|
{
|
||||||
char *d, *s;
|
char *d, *s;
|
||||||
|
|
||||||
if ((s = strchr(sp, MAGIC))) {
|
if ((s = strchr(sp, MAGIC))) {
|
||||||
|
if (s - sp >= dlen)
|
||||||
|
return dp;
|
||||||
memcpy(dp, sp, s - sp);
|
memcpy(dp, sp, s - sp);
|
||||||
for (d = dp + (s - sp); *s; s++)
|
for (d = dp + (s - sp); *s && (d - dp < dlen); s++)
|
||||||
if (!ISMAGIC(*s) || !(*++s & 0x80)
|
if (!ISMAGIC(*s) || !(*++s & 0x80)
|
||||||
|| !strchr("*+?@! ", *s & 0x7f))
|
|| !strchr("*+?@! ", *s & 0x7f))
|
||||||
*d++ = *s;
|
*d++ = *s;
|
||||||
@ -1190,11 +1195,12 @@ debunk(dp, sp)
|
|||||||
/* extended pattern operators: *+?@! */
|
/* extended pattern operators: *+?@! */
|
||||||
if ((*s & 0x7f) != ' ')
|
if ((*s & 0x7f) != ' ')
|
||||||
*d++ = *s & 0x7f;
|
*d++ = *s & 0x7f;
|
||||||
*d++ = '(';
|
if (d - dp < dlen)
|
||||||
|
*d++ = '(';
|
||||||
}
|
}
|
||||||
*d = '\0';
|
*d = '\0';
|
||||||
} else if (dp != sp)
|
} else if (dp != sp)
|
||||||
strcpy(dp, sp);
|
strlcpy(dp, sp, dlen);
|
||||||
return dp;
|
return dp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1337,7 +1343,7 @@ alt_expand(wp, start, exp_start, end, fdo)
|
|||||||
if (fdo & DOGLOB)
|
if (fdo & DOGLOB)
|
||||||
glob(start, wp, fdo & DOMARKDIRS);
|
glob(start, wp, fdo & DOMARKDIRS);
|
||||||
else
|
else
|
||||||
XPput(*wp, debunk(start, start));
|
XPput(*wp, debunk(start, start, end - start));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
brace_end = p;
|
brace_end = p;
|
||||||
|
24
ksh.1tbl
24
ksh.1tbl
@ -1,4 +1,4 @@
|
|||||||
.\" $OpenBSD: ksh.1tbl,v 1.50 2003/03/20 07:30:37 jmc Exp $
|
.\" $OpenBSD: ksh.1tbl,v 1.51 2003/04/28 06:27:36 jmc Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1980, 1990, 1993
|
.\" Copyright (c) 1980, 1990, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
@ -1366,7 +1366,7 @@ Not yet implemented.
|
|||||||
.It Ev EXECSHELL
|
.It Ev EXECSHELL
|
||||||
If set, this parameter is assumed to contain the shell that is to be used to
|
If set, this parameter is assumed to contain the shell that is to be used to
|
||||||
execute commands that
|
execute commands that
|
||||||
.Fn execve 2
|
.Xr execve 2
|
||||||
fails to execute and which do not start with a
|
fails to execute and which do not start with a
|
||||||
.Dq \&#\&! Ns Ar shell
|
.Dq \&#\&! Ns Ar shell
|
||||||
sequence.
|
sequence.
|
||||||
@ -1677,7 +1677,7 @@ characters or
|
|||||||
.Dq [..]
|
.Dq [..]
|
||||||
sequences.
|
sequences.
|
||||||
Once brace expansion has been performed, the shell replaces file
|
Once brace expansion has been performed, the shell replaces file
|
||||||
name patterns with the sorted named of all the files that match the pattern
|
name patterns with the sorted names of all the files that match the pattern
|
||||||
(if no files match, the word is left unchanged).
|
(if no files match, the word is left unchanged).
|
||||||
The pattern elements have the following meaning:
|
The pattern elements have the following meaning:
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
@ -1865,7 +1865,7 @@ except if
|
|||||||
exists it is appended to instead of being truncated.
|
exists it is appended to instead of being truncated.
|
||||||
Also, the file is opened
|
Also, the file is opened
|
||||||
in append mode, so writes always go to the end of the file (see
|
in append mode, so writes always go to the end of the file (see
|
||||||
.Fn open 2 ) .
|
.Xr open 2 ) .
|
||||||
.It Ic \&< Ar file
|
.It Ic \&< Ar file
|
||||||
Standard input is redirected from
|
Standard input is redirected from
|
||||||
.Ar file ,
|
.Ar file ,
|
||||||
@ -2613,7 +2613,7 @@ above).
|
|||||||
.Pp
|
.Pp
|
||||||
When listing aliases, one of two formats is used.
|
When listing aliases, one of two formats is used.
|
||||||
Normally, aliases are listed as
|
Normally, aliases are listed as
|
||||||
.Ar name Ns No = Ar value ,
|
.Ar name Ns No = Ns Ar value ,
|
||||||
where
|
where
|
||||||
.Ar value
|
.Ar value
|
||||||
is quoted.
|
is quoted.
|
||||||
@ -2828,7 +2828,7 @@ option suppresses the trailing newline,
|
|||||||
.Fl e
|
.Fl e
|
||||||
enables backslash interpretation (a no-op, since this is normally done), and
|
enables backslash interpretation (a no-op, since this is normally done), and
|
||||||
.Fl E
|
.Fl E
|
||||||
which suppresses backslash interpretation.
|
suppresses backslash interpretation.
|
||||||
.It Ic eval Ar command ...
|
.It Ic eval Ar command ...
|
||||||
The arguments are concatenated (with spaces between them) to form a single
|
The arguments are concatenated (with spaces between them) to form a single
|
||||||
string which the shell then parses and executes in the current environment.
|
string which the shell then parses and executes in the current environment.
|
||||||
@ -3355,7 +3355,7 @@ Background jobs are run with lower priority.
|
|||||||
Enable brace expansion (a.k.a., alternation).
|
Enable brace expansion (a.k.a., alternation).
|
||||||
.It Ic emacs
|
.It Ic emacs
|
||||||
Enable BRL emacs-like command-line editing (interactive shells only); see
|
Enable BRL emacs-like command-line editing (interactive shells only); see
|
||||||
.Sx Emacs editing mode.
|
.Sx Emacs editing mode .
|
||||||
.It Ic gmacs
|
.It Ic gmacs
|
||||||
Enable gmacs-like command-line editing (interactive shells only).
|
Enable gmacs-like command-line editing (interactive shells only).
|
||||||
Currently identical to emacs editing except that transpose (^T) acts slightly
|
Currently identical to emacs editing except that transpose (^T) acts slightly
|
||||||
@ -3475,7 +3475,7 @@ defaults to 1.
|
|||||||
.Ic test
|
.Ic test
|
||||||
evaluates the
|
evaluates the
|
||||||
.Ar expression
|
.Ar expression
|
||||||
and returns zero status if true, 1 status if false, or greater than 1 if there
|
and returns zero status if true, 1 if false, or greater than 1 if there
|
||||||
was an error.
|
was an error.
|
||||||
It is normally used as the condition command of
|
It is normally used as the condition command of
|
||||||
.Ic if
|
.Ic if
|
||||||
@ -3913,7 +3913,7 @@ option.)
|
|||||||
.It Fl p
|
.It Fl p
|
||||||
Print complete
|
Print complete
|
||||||
.Ic typeset
|
.Ic typeset
|
||||||
commands that can be used to re-create the attributes (but not the values) or
|
commands that can be used to re-create the attributes (but not the values) of
|
||||||
parameters.
|
parameters.
|
||||||
This is the default action (option exists for ksh93 compatibility).
|
This is the default action (option exists for ksh93 compatibility).
|
||||||
.It Fl r
|
.It Fl r
|
||||||
@ -4281,7 +4281,7 @@ interactive session, which is controlled by the
|
|||||||
.Ic gmacs ,
|
.Ic gmacs ,
|
||||||
and
|
and
|
||||||
.Ic vi
|
.Ic vi
|
||||||
options (at most one of these can be set an once).
|
options (at most one of these can be set at once).
|
||||||
If none of these options are enabled, the shell simply reads lines using the
|
If none of these options are enabled, the shell simply reads lines using the
|
||||||
normal tty driver.
|
normal tty driver.
|
||||||
If the
|
If the
|
||||||
@ -4536,7 +4536,7 @@ appended to them.
|
|||||||
Prints a sorted, columnated list of command names (if any) that can complete
|
Prints a sorted, columnated list of command names (if any) that can complete
|
||||||
the partial word containing the cursor.
|
the partial word containing the cursor.
|
||||||
.It Ic list-file ^X^Y
|
.It Ic list-file ^X^Y
|
||||||
Prints a sorted, comunated list of file names (if any) that can complete the
|
Prints a sorted, columnated list of file names (if any) that can complete the
|
||||||
partial word containing the cursor.
|
partial word containing the cursor.
|
||||||
File type indicators are appended as described under
|
File type indicators are appended as described under
|
||||||
.Ic list
|
.Ic list
|
||||||
@ -4786,7 +4786,7 @@ directories in the
|
|||||||
parameter.
|
parameter.
|
||||||
File name expansion matches the big-word against the files in the
|
File name expansion matches the big-word against the files in the
|
||||||
current directory.
|
current directory.
|
||||||
After expansion, the cursor is places just past the last
|
After expansion, the cursor is placed just past the last
|
||||||
word and the editor is in insert mode.
|
word and the editor is in insert mode.
|
||||||
.It n\e,\ n^F,\ n<tab>,\ and\ n<esc>
|
.It n\e,\ n^F,\ n<tab>,\ and\ n<esc>
|
||||||
Command/file name completion.
|
Command/file name completion.
|
||||||
|
4
misc.c
4
misc.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: misc.c,v 1.15 2003/04/04 23:12:02 deraadt Exp $ */
|
/* $OpenBSD: misc.c,v 1.16 2003/04/16 23:11:52 tdeval Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Miscellaneous functions
|
* Miscellaneous functions
|
||||||
@ -542,7 +542,7 @@ gmatch(s, p, isfile)
|
|||||||
char tbuf[64];
|
char tbuf[64];
|
||||||
char *t = len <= sizeof(tbuf) ? tbuf
|
char *t = len <= sizeof(tbuf) ? tbuf
|
||||||
: (char *) alloc(len, ATEMP);
|
: (char *) alloc(len, ATEMP);
|
||||||
debunk(t, p);
|
debunk(t, p, len);
|
||||||
return !strcmp(t, s);
|
return !strcmp(t, s);
|
||||||
}
|
}
|
||||||
return do_gmatch((const unsigned char *) s, (const unsigned char *) se,
|
return do_gmatch((const unsigned char *) s, (const unsigned char *) se,
|
||||||
|
4
proto.h
4
proto.h
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: proto.h,v 1.9 2001/02/19 09:49:54 camield Exp $ */
|
/* $OpenBSD: proto.h,v 1.10 2003/04/16 23:11:52 tdeval Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* prototypes for PD-KSH
|
* prototypes for PD-KSH
|
||||||
@ -62,7 +62,7 @@ char * substitute ARGS((const char *cp, int f));
|
|||||||
char ** eval ARGS((char **ap, int f));
|
char ** eval ARGS((char **ap, int f));
|
||||||
char * evalstr ARGS((char *cp, int f));
|
char * evalstr ARGS((char *cp, int f));
|
||||||
char * evalonestr ARGS((char *cp, int f));
|
char * evalonestr ARGS((char *cp, int f));
|
||||||
char *debunk ARGS((char *dp, const char *sp));
|
char *debunk ARGS((char *dp, const char *sp, size_t dlen));
|
||||||
void expand ARGS((char *cp, XPtrV *wp, int f));
|
void expand ARGS((char *cp, XPtrV *wp, int f));
|
||||||
int glob_str ARGS((char *cp, XPtrV *wp, int markdirs));
|
int glob_str ARGS((char *cp, XPtrV *wp, int markdirs));
|
||||||
/* exec.c */
|
/* exec.c */
|
||||||
|
16
sh.1tbl
16
sh.1tbl
@ -1,4 +1,4 @@
|
|||||||
.\" $OpenBSD: sh.1tbl,v 1.31 2003/03/14 11:05:55 jmc Exp $
|
.\" $OpenBSD: sh.1tbl,v 1.32 2003/04/28 06:27:36 jmc Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1980, 1990, 1993
|
.\" Copyright (c) 1980, 1990, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
@ -1176,7 +1176,7 @@ Not yet implemented.
|
|||||||
.It Ev EXECSHELL
|
.It Ev EXECSHELL
|
||||||
If set, this parameter is assumed to contain the shell that is to be used to
|
If set, this parameter is assumed to contain the shell that is to be used to
|
||||||
execute commands that
|
execute commands that
|
||||||
.Fn execve 2
|
.Xr execve 2
|
||||||
fails to execute and which do not start with a
|
fails to execute and which do not start with a
|
||||||
.Dq \&#\&! Ns Ar shell
|
.Dq \&#\&! Ns Ar shell
|
||||||
sequence.
|
sequence.
|
||||||
@ -1337,7 +1337,7 @@ characters or
|
|||||||
.Dq [..]
|
.Dq [..]
|
||||||
sequences.
|
sequences.
|
||||||
Once brace expansion has been performed, the shell replaces file
|
Once brace expansion has been performed, the shell replaces file
|
||||||
name patterns with the sorted named of all the files that match the pattern
|
name patterns with the sorted names of all the files that match the pattern
|
||||||
(if no files match, the word is left unchanged).
|
(if no files match, the word is left unchanged).
|
||||||
The pattern elements have the following meaning:
|
The pattern elements have the following meaning:
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
@ -1521,7 +1521,7 @@ except if
|
|||||||
exists it is appended to instead of being truncated.
|
exists it is appended to instead of being truncated.
|
||||||
Also, the file is opened
|
Also, the file is opened
|
||||||
in append mode, so writes always go to the end of the file (see
|
in append mode, so writes always go to the end of the file (see
|
||||||
.Fn open 2 ) .
|
.Xr open 2 ) .
|
||||||
.It Ic \&< Ar file
|
.It Ic \&< Ar file
|
||||||
Standard input is redirected from
|
Standard input is redirected from
|
||||||
.Ar file ,
|
.Ar file ,
|
||||||
@ -2208,7 +2208,7 @@ above).
|
|||||||
.Pp
|
.Pp
|
||||||
When listing aliases, one of two formats is used.
|
When listing aliases, one of two formats is used.
|
||||||
Normally, aliases are listed as
|
Normally, aliases are listed as
|
||||||
.Ar name Ns No = Ar value ,
|
.Ar name Ns No = Ns Ar value ,
|
||||||
where
|
where
|
||||||
.Ar value
|
.Ar value
|
||||||
is quoted.
|
is quoted.
|
||||||
@ -2394,7 +2394,7 @@ option suppresses the trailing newline,
|
|||||||
.Fl e
|
.Fl e
|
||||||
enables backslash interpretation (a no-op, since this is normally done), and
|
enables backslash interpretation (a no-op, since this is normally done), and
|
||||||
.Fl E
|
.Fl E
|
||||||
which suppresses backslash interpretation.
|
suppresses backslash interpretation.
|
||||||
.It Ic eval Ar command ...
|
.It Ic eval Ar command ...
|
||||||
The arguments are concatenated (with spaces between them) to form a single
|
The arguments are concatenated (with spaces between them) to form a single
|
||||||
string which the shell then parses and executes in the current environment.
|
string which the shell then parses and executes in the current environment.
|
||||||
@ -2983,7 +2983,7 @@ defaults to 1.
|
|||||||
.Ic test
|
.Ic test
|
||||||
evaluates the
|
evaluates the
|
||||||
.Ar expression
|
.Ar expression
|
||||||
and returns zero status if true, 1 status if false, or greater than 1 if there
|
and returns zero status if true, 1 if false, or greater than 1 if there
|
||||||
was an error.
|
was an error.
|
||||||
It is normally used as the condition command of
|
It is normally used as the condition command of
|
||||||
.Ic if
|
.Ic if
|
||||||
@ -3368,7 +3368,7 @@ option.)
|
|||||||
.It Fl p
|
.It Fl p
|
||||||
Print complete
|
Print complete
|
||||||
.Ic typeset
|
.Ic typeset
|
||||||
commands that can be used to re-create the attributes (but not the values) or
|
commands that can be used to re-create the attributes (but not the values) of
|
||||||
parameters.
|
parameters.
|
||||||
This is the default action (option exists for ksh93 compatibility).
|
This is the default action (option exists for ksh93 compatibility).
|
||||||
.It Fl r
|
.It Fl r
|
||||||
|
7
var.c
7
var.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: var.c,v 1.13 2003/03/13 09:03:07 deraadt Exp $ */
|
/* $OpenBSD: var.c,v 1.14 2003/04/16 23:11:52 tdeval Exp $ */
|
||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
#include "ksh_time.h"
|
#include "ksh_time.h"
|
||||||
@ -1132,6 +1132,7 @@ arraysearch(vp, val)
|
|||||||
int val;
|
int val;
|
||||||
{
|
{
|
||||||
struct tbl *prev, *curr, *new;
|
struct tbl *prev, *curr, *new;
|
||||||
|
size_t namelen = strlen(vp->name) + 1;
|
||||||
|
|
||||||
vp->flag |= ARRAY|DEFINED;
|
vp->flag |= ARRAY|DEFINED;
|
||||||
|
|
||||||
@ -1152,9 +1153,9 @@ arraysearch(vp, val)
|
|||||||
else
|
else
|
||||||
new = curr;
|
new = curr;
|
||||||
} else
|
} else
|
||||||
new = (struct tbl *)alloc(sizeof(struct tbl)+strlen(vp->name)+1,
|
new = (struct tbl *)alloc(sizeof(struct tbl) + namelen,
|
||||||
vp->areap);
|
vp->areap);
|
||||||
strcpy(new->name, vp->name);
|
strlcpy(new->name, vp->name, namelen);
|
||||||
new->flag = vp->flag & ~(ALLOC|DEFINED|ISSET|SPECIAL);
|
new->flag = vp->flag & ~(ALLOC|DEFINED|ISSET|SPECIAL);
|
||||||
new->type = vp->type;
|
new->type = vp->type;
|
||||||
new->areap = vp->areap;
|
new->areap = vp->areap;
|
||||||
|
Reference in New Issue
Block a user