mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-12-29 16:25:35 +01:00
27648, 267650/1, unposted README change:
Turn off repeat and turn on ulimit in emulation modes
This commit is contained in:
parent
7e9952e016
commit
8ac97f3308
9 changed files with 112 additions and 28 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2010-02-03 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 27648, 267650/1, unposted README change: README,
|
||||
Doc/Zsh/builtins.yo, Doc/Zsh/grammar.yo,
|
||||
Etc/zsh-development-guide, Src/builtin.c, Src/init.c,
|
||||
Src/mkbltnmlst.sh, Src/Builtins/rlimits.mdd: "repeat"
|
||||
is not available when starting in emulation mode,
|
||||
"ulimit" is; document that "sched", "limit", "unlimit"
|
||||
already aren't.
|
||||
|
||||
2010-02-02 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* Mikael: 27647: Completion/Unix/Command/_cp: update
|
||||
|
@ -12669,5 +12679,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.4880 $
|
||||
* $Revision: 1.4881 $
|
||||
*****************************************************
|
||||
|
|
|
@ -872,6 +872,10 @@ sitem(var(n)tt(k))(kilobytes (default))
|
|||
sitem(var(n)tt(m))(megabytes or minutes)
|
||||
sitem([var(mm)tt(:)]var(ss))(minutes and seconds)
|
||||
endsitem()
|
||||
|
||||
The tt(limit) command is not made available by default when the
|
||||
shell starts in a mode emulating another shell. It can be made available
|
||||
with the command `tt(zmodload -F zsh/rlimits b:limit)'.
|
||||
)
|
||||
findex(local)
|
||||
item(tt(local) [ {tt(PLUS())|tt(-)}tt(AEFHUahlprtux) ] \
|
||||
|
@ -1286,6 +1290,10 @@ all parameters are printed on the standard output. If the only argument is
|
|||
For historical reasons, `tt(set -)' is treated as `tt(set +xv)'
|
||||
and `tt(set -) var(args)' as `tt(set +xv --) var(args)' when in
|
||||
any other emulation mode than zsh's native mode.
|
||||
|
||||
The tt(sched) builtin is not made available by default when the shell
|
||||
starts in a mode emulating another shell. It can be made available
|
||||
with the command `tt(zmodload -F zsh/sched b:sched)'.
|
||||
)
|
||||
module(setcap)(zsh/cap)
|
||||
findex(setopt)
|
||||
|
@ -1794,6 +1802,10 @@ If the tt(-h) flag is given and the shell has appropriate privileges,
|
|||
the hard resource limit for each var(resource) is removed.
|
||||
The resources of the shell process are only changed if the tt(-s)
|
||||
flag is given.
|
||||
|
||||
The tt(unlimit) command is not made available by default when the
|
||||
shell starts in a mode emulating another shell. It can be made available
|
||||
with the command `tt(zmodload -F zsh/rlimits b:unlimit)'.
|
||||
)
|
||||
findex(unset)
|
||||
cindex(parameters, unsetting)
|
||||
|
|
|
@ -222,6 +222,10 @@ item(tt(repeat) var(word) tt(do) var(list) tt(done))(
|
|||
var(word) is expanded and treated as an arithmetic expression,
|
||||
which must evaluate to a number var(n).
|
||||
var(list) is then executed var(n) times.
|
||||
|
||||
The tt(repeat) syntax is disabled by default when the
|
||||
shell starts in a mode emulating another shell. It can be enabled
|
||||
with the command `tt(enable -r repeat)'
|
||||
)
|
||||
findex(case)
|
||||
cindex(case selection)
|
||||
|
|
|
@ -198,12 +198,16 @@ following shell variables:
|
|||
- nozshdep non-empty indicates no dependence on the `zsh/main'
|
||||
pseudo-module
|
||||
- alwayslink if non-empty, always link the module into the executable
|
||||
- autobins builtins defined by the module, for autoloading
|
||||
- autoinfixconds infix condition codes defined by the module, for
|
||||
autoloading (without the leading `-')
|
||||
- autoprefixconds like autoinfixconds, but for prefix condition codes
|
||||
- autoparams parameters defined by the module, for autoloading
|
||||
- automathfuncs math functions defined by the module, for autoloading
|
||||
- autofeatures features defined by the module for autoloading,
|
||||
a space-separated list. The syntax for features is as
|
||||
for zmodload -F, e.g. b:mybin refers to the builtin
|
||||
mybin. This replaces the previous mechanism with
|
||||
separate variables for builtins, conditions, math
|
||||
functions and parameters. Note the features are only
|
||||
available in zsh's native mode, not in emulation modes.
|
||||
- autofeatures_emu As autofeatures, but the features so presented are
|
||||
available in modes that are *not* zsh's native mode.
|
||||
The variable autofeatures must also be present.
|
||||
- objects .o files making up this module (*must* be defined)
|
||||
- proto .syms files for this module (default generated from $objects)
|
||||
- headers extra headers for this module (default none)
|
||||
|
|
43
README
43
README
|
@ -136,6 +136,17 @@ The variable HOME is no longer set by the shell if zsh is emulating any
|
|||
other shell at startup; it must be present in the environment or set
|
||||
subsequently by the user. It is valid for the variable to be unset.
|
||||
|
||||
If the shell starts in a mode where it is emulating another shell
|
||||
(typically because the base name of the shell was "sh" or another known
|
||||
shell), the "repeat" syntax is not available by default, to avoid clashes
|
||||
with external commands, but the "ulimit" command is available by default.
|
||||
"limit", "sched" and "unlimit" are not available by default in such modes:
|
||||
this has been the case for many versions but is now documented for the
|
||||
first time. (Users should note that emulation modes are not designed for
|
||||
backwards compatibility with previous versions of zsh, but to maximise
|
||||
compatibility with other shells, hence it is not safe to assume emulation
|
||||
modes will behave consistently between zsh versions.)
|
||||
|
||||
Parameter substitutions in the form ${param//#%search/replace} match
|
||||
against "search" anchored at both ends of the parameter value. Previously
|
||||
this syntax would have matched against "%search", anchored only at the head
|
||||
|
@ -143,23 +154,33 @@ of the value. The form ${param//#$search/replace} where the value
|
|||
$search starts with "%" considers the "%" to be part of the search
|
||||
string as before.
|
||||
|
||||
The MULTIBYTE option is on by default where it is available; this
|
||||
causes many operations to recognise characters as in the current locale.
|
||||
Older versions of the shell always assumed a character was one byte.
|
||||
In some places the width of the character will be used; this is transparent
|
||||
when used for calculations of screen position, but also occurs, for
|
||||
example, in calculations of padding width. Note that MULTIBYTE is
|
||||
not automatically set when emulating Bourne- and POSIX-style shells;
|
||||
for interative use of these emulations it may be necessary to set
|
||||
it by hand.
|
||||
Configure attempts to decide if multibyte characters are supported by the
|
||||
system and if so sets the effect of --enable-multibyte, unless
|
||||
--disable-multibyte was passed on the command line. When
|
||||
--enable-multibyte is in effect, the MULTIBYTE shell option is on by
|
||||
default; this causes many operations to recognise characters in the current
|
||||
locale. (Most typically this is used for a UTF-8 character set but the
|
||||
shell will work with any character set provided by the system where
|
||||
individual octets are either US ASCII characters or have the top bit set.)
|
||||
Older versions of the shell always assumed a character was one byte; this
|
||||
remains the case if --disable-multibyte is in effect or if the MULTIBYTE
|
||||
option is unset. In some places the width of characters will be taken into
|
||||
account where previously a raw string length was used; this is transparent
|
||||
in calculations of screen position, but also occurs, for example, in
|
||||
calculations of padding width. Note that MULTIBYTE is not automatically
|
||||
set when emulating Bourne- and POSIX-style shells; for interactive use of
|
||||
these emulations it may be necessary to set it by hand. Note also that the
|
||||
option COMBINING_CHARS is not set by default due to difficulties detecting
|
||||
the ability of the terminal to display combining characters correctly; MAC
|
||||
users in particular will probably wish to set this option.
|
||||
|
||||
Zsh has previously been lax about whether it allows octets with the
|
||||
top bit set to be part of a shell identifier. Older versions of the shell
|
||||
assumed all such octets were allowed in identifiers, however the POSIX
|
||||
standard does not allow such characters in identifiers. The older
|
||||
behaviour is still obtained with --disable-multibyte in effect.
|
||||
With --enable-multibyte in effect (this is now the default anywhere
|
||||
it is supported) there are three possible cases:
|
||||
With --enable-multibyte in effect (see previous paragraph) there are three
|
||||
possible cases:
|
||||
MULTIBYTE option unset: only ASCII characters are allowed; the
|
||||
shell does not attempt to identify non-ASCII characters at all.
|
||||
MULTIBYTE option set, POSIX_IDENTIFIERS option unset: in addition
|
||||
|
|
|
@ -3,6 +3,7 @@ link=either
|
|||
load=yes
|
||||
|
||||
autofeatures="b:limit b:ulimit b:unlimit"
|
||||
autofeatures_emu="b:ulimit"
|
||||
|
||||
objects="rlimits.o"
|
||||
|
||||
|
|
|
@ -206,6 +206,17 @@ freebuiltinnode(HashNode hn)
|
|||
}
|
||||
}
|
||||
|
||||
/**/
|
||||
void
|
||||
init_builtins(void)
|
||||
{
|
||||
if (!EMULATION(EMULATE_ZSH)) {
|
||||
HashNode hn = reswdtab->getnode2(reswdtab, "repeat");
|
||||
if (hn)
|
||||
reswdtab->disablenode(hn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure we have space for a new option and increment. */
|
||||
|
||||
#define OPT_ALLOC_CHUNK 16
|
||||
|
|
|
@ -1443,6 +1443,7 @@ zsh_main(UNUSED(int argc), char **argv)
|
|||
setupvals();
|
||||
init_signals();
|
||||
init_bltinmods();
|
||||
init_builtins();
|
||||
run_init_scripts();
|
||||
init_misc();
|
||||
|
||||
|
|
|
@ -37,18 +37,38 @@ for x_mod in $x_mods; do
|
|||
echo "/* non-linked-in known module \`$x_mod' */"
|
||||
linked=no
|
||||
esac
|
||||
unset moddeps autofeatures
|
||||
unset moddeps autofeatures autofeatures_emu
|
||||
. $srcdir/../$modfile
|
||||
if test "x$autofeatures" != x; then
|
||||
echo " if (EMULATION(EMULATE_ZSH)) {"
|
||||
echo " char *features[] = { "
|
||||
for feature in $autofeatures; do
|
||||
echo " \"$feature\","
|
||||
done
|
||||
echo " NULL"
|
||||
echo " }; "
|
||||
echo " autofeatures(\"zsh\", \"$x_mod\", features, 0, 1);"
|
||||
echo " }"
|
||||
if test "x$autofeatures_emu" != x; then
|
||||
echo " {"
|
||||
echo " char *zsh_features[] = { "
|
||||
for feature in $autofeatures; do
|
||||
echo " \"$feature\","
|
||||
done
|
||||
echo " NULL"
|
||||
echo " }; "
|
||||
echo " char *emu_features[] = { "
|
||||
for feature in $autofeatures_emu; do
|
||||
echo " \"$feature\","
|
||||
done
|
||||
echo " NULL"
|
||||
echo " }; "
|
||||
echo " autofeatures(\"zsh\", \"$x_mod\","
|
||||
echo " EMULATION(EMULATE_ZSH) ? zsh_features : emu_features,"
|
||||
echo " 0, 1);"
|
||||
echo " }"
|
||||
else
|
||||
echo " if (EMULATION(EMULATE_ZSH)) {"
|
||||
echo " char *features[] = { "
|
||||
for feature in $autofeatures; do
|
||||
echo " \"$feature\","
|
||||
done
|
||||
echo " NULL"
|
||||
echo " }; "
|
||||
echo " autofeatures(\"zsh\", \"$x_mod\", features, 0, 1);"
|
||||
echo " }"
|
||||
fi
|
||||
fi
|
||||
for dep in $moddeps; do
|
||||
echo " add_dep(\"$x_mod\", \"$dep\");"
|
||||
|
|
Loading…
Reference in a new issue