against better judgement, allow unsetting COLUMNS:
• GNU coreutils’ test suite insists on it, even despite it can run successfully without doing it (WTF‽)… • we already unspecial, explicitly commented as “hands-off” it, when imported from the environment • it was already changeable (though that didn’t unspecial it on the command line)
This commit is contained in:
parent
28a08dc7a0
commit
2e1150c8e8
12
mksh.1
12
mksh.1
@ -1,4 +1,4 @@
|
|||||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.457 2018/07/15 13:57:18 tg Exp $
|
.\" $MirOS: src/bin/mksh/mksh.1,v 1.458 2018/07/15 17:21:22 tg Exp $
|
||||||
.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $
|
.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $
|
||||||
.\"-
|
.\"-
|
||||||
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||||
@ -1824,10 +1824,10 @@ built-in command will display the resulting directory when a match is found
|
|||||||
in any search path other than the empty path.
|
in any search path other than the empty path.
|
||||||
.It Ev COLUMNS
|
.It Ev COLUMNS
|
||||||
Set to the number of columns on the terminal or window.
|
Set to the number of columns on the terminal or window.
|
||||||
Always set, defaults to 80, unless the
|
If never unset and not imported, always set dynamically;
|
||||||
value as reported by
|
unless the value as reported by
|
||||||
.Xr stty 1
|
.Xr stty 1
|
||||||
is non-zero and sane enough (minimum is 12x3); similar for
|
is non-zero and sane enough (minimum is 12x3), defaults to 80; similar for
|
||||||
.Ev LINES .
|
.Ev LINES .
|
||||||
This parameter is used by the interactive line editing modes and by the
|
This parameter is used by the interactive line editing modes and by the
|
||||||
.Ic select ,
|
.Ic select ,
|
||||||
@ -1996,7 +1996,7 @@ The line number of the function or shell script that is currently being
|
|||||||
executed.
|
executed.
|
||||||
.It Ev LINES
|
.It Ev LINES
|
||||||
Set to the number of lines on the terminal or window.
|
Set to the number of lines on the terminal or window.
|
||||||
Always set, defaults to 24.
|
Defaults to 24; always set, unless imported or unset.
|
||||||
See
|
See
|
||||||
.Ev COLUMNS .
|
.Ev COLUMNS .
|
||||||
.It Ev OLDPWD
|
.It Ev OLDPWD
|
||||||
@ -6705,7 +6705,7 @@ for the in-memory portion of the history is slow, should use
|
|||||||
.Xr memmove 3 .
|
.Xr memmove 3 .
|
||||||
.Pp
|
.Pp
|
||||||
This document attempts to describe
|
This document attempts to describe
|
||||||
.Nm mksh\ R56
|
.Nm mksh\ R57
|
||||||
and up,
|
and up,
|
||||||
.\" with vendor patches from insert-your-name-here,
|
.\" with vendor patches from insert-your-name-here,
|
||||||
compiled without any options impacting functionality, such as
|
compiled without any options impacting functionality, such as
|
||||||
|
4
sh.h
4
sh.h
@ -182,9 +182,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.863 2018/06/26 21:22:24 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.864 2018/07/15 17:21:23 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R56 2018/06/26"
|
#define MKSH_VERSION "R56 2018/07/15"
|
||||||
|
|
||||||
/* arithmetic types: C implementation */
|
/* arithmetic types: C implementation */
|
||||||
#if !HAVE_CAN_INTTYPES
|
#if !HAVE_CAN_INTTYPES
|
||||||
|
24
var.c
24
var.c
@ -28,7 +28,7 @@
|
|||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.225 2018/05/07 00:07:23 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.226 2018/07/15 17:21:24 tg Exp $");
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Variables
|
* Variables
|
||||||
@ -54,7 +54,7 @@ static int special(const char *);
|
|||||||
static void unspecial(const char *);
|
static void unspecial(const char *);
|
||||||
static void getspec(struct tbl *);
|
static void getspec(struct tbl *);
|
||||||
static void setspec(struct tbl *);
|
static void setspec(struct tbl *);
|
||||||
static void unsetspec(struct tbl *);
|
static void unsetspec(struct tbl *, bool);
|
||||||
static int getint(struct tbl *, mksh_ari_u *, bool);
|
static int getint(struct tbl *, mksh_ari_u *, bool);
|
||||||
static const char *array_index_calc(const char *, bool *, uint32_t *);
|
static const char *array_index_calc(const char *, bool *, uint32_t *);
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ popblock(void)
|
|||||||
if ((vq = global(vp->name))->flag & ISSET)
|
if ((vq = global(vp->name))->flag & ISSET)
|
||||||
setspec(vq);
|
setspec(vq);
|
||||||
else
|
else
|
||||||
unsetspec(vq);
|
unsetspec(vq, false);
|
||||||
}
|
}
|
||||||
if (l->flags & BF_DOGETOPTS)
|
if (l->flags & BF_DOGETOPTS)
|
||||||
user_opt = l->getopts_state;
|
user_opt = l->getopts_state;
|
||||||
@ -1054,7 +1054,7 @@ unset(struct tbl *vp, int flags)
|
|||||||
vp->flag &= SPECIAL | ((flags & 1) ? 0 : ARRAY|DEFINED);
|
vp->flag &= SPECIAL | ((flags & 1) ? 0 : ARRAY|DEFINED);
|
||||||
if (vp->flag & SPECIAL)
|
if (vp->flag & SPECIAL)
|
||||||
/* responsible for 'unspecial'ing var */
|
/* responsible for 'unspecial'ing var */
|
||||||
unsetspec(vp);
|
unsetspec(vp, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1441,7 +1441,7 @@ setspec(struct tbl *vp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unsetspec(struct tbl *vp)
|
unsetspec(struct tbl *vp, bool dounset)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* AT&T ksh man page says OPTIND, OPTARG and _ lose special
|
* AT&T ksh man page says OPTIND, OPTARG and _ lose special
|
||||||
@ -1466,13 +1466,13 @@ unsetspec(struct tbl *vp)
|
|||||||
#endif
|
#endif
|
||||||
case V_IFS:
|
case V_IFS:
|
||||||
set_ifs(TC_IFSWS);
|
set_ifs(TC_IFSWS);
|
||||||
break;
|
return;
|
||||||
case V_PATH:
|
case V_PATH:
|
||||||
afree(path, APERM);
|
afree(path, APERM);
|
||||||
strdupx(path, def_path, APERM);
|
strdupx(path, def_path, APERM);
|
||||||
/* clear tracked aliases */
|
/* clear tracked aliases */
|
||||||
flushcom(true);
|
flushcom(true);
|
||||||
break;
|
return;
|
||||||
#ifndef MKSH_NO_CMDLINE_EDITING
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
case V_TERM:
|
case V_TERM:
|
||||||
x_initterm(null);
|
x_initterm(null);
|
||||||
@ -1484,14 +1484,14 @@ unsetspec(struct tbl *vp)
|
|||||||
afree(tmpdir, APERM);
|
afree(tmpdir, APERM);
|
||||||
tmpdir = NULL;
|
tmpdir = NULL;
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
case V_LINENO:
|
case V_LINENO:
|
||||||
case V_RANDOM:
|
case V_RANDOM:
|
||||||
case V_SECONDS:
|
case V_SECONDS:
|
||||||
case V_TMOUT:
|
case V_TMOUT:
|
||||||
/* AT&T ksh leaves previous value in place */
|
/* AT&T ksh leaves previous value in place */
|
||||||
unspecial(vp->name);
|
unspecial(vp->name);
|
||||||
break;
|
return;
|
||||||
#ifdef MKSH_EARLY_LOCALE_TRACKING
|
#ifdef MKSH_EARLY_LOCALE_TRACKING
|
||||||
case V_LANG:
|
case V_LANG:
|
||||||
case V_LC_ALL:
|
case V_LC_ALL:
|
||||||
@ -1499,6 +1499,12 @@ unsetspec(struct tbl *vp)
|
|||||||
recheck_ctype();
|
recheck_ctype();
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
/* should not become unspecial, but allow unsetting */
|
||||||
|
case V_COLUMNS:
|
||||||
|
case V_LINES:
|
||||||
|
if (dounset)
|
||||||
|
unspecial(vp->name);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user