Commit Graph

3174 Commits

Author SHA1 Message Date
tg 7529e350cf small character classes overhaul:
• make fast character classes even faster by removing the C_SUBOP2 hack
  in favour of a separate seldom-used ksh_issubop2 macro (which also
  makes ctype() side-effect-safe) which is a slower class (no change there)
• optimise cases of ksh_isalphx followed by a ksh_isalnux loop
  (used parsing variable names)
• remove a misleading comment in initctypes() about \0 from pdksh
• rename C_ALPHA to C_ALPHX to make it more clear the underscore is included
• sprinkle a few ord() in there
• add new ksh_isalpha() which tests for [A-Za-z] (slow character class)
• there is no '_:\' drive on OS/2 (which inspired the whole changeset)
2017-03-26 00:10:26 +00:00
mirabilos e216226f68 mostly more KNF 2017-03-26 00:18:21 +01:00
mirabilos 859746b30b fix \r followed by something else than \n or EOF 2017-03-26 00:09:46 +01:00
mirabilos 62a5331aee no strcpy() allowed in BSD code 2017-03-26 00:05:25 +01:00
mirabilos de3d3aa5d2 mostly KNF; afree() can be called with NULL argument 2017-03-25 23:56:09 +01:00
KO Myung-Hun c19b8b104c Merge remote-tracking branch 'mksh/master' 2017-03-22 17:50:23 +09:00
tg 034d0c0269 fixup “\builtin” on OS/2; thanks komh for spotting this 2017-03-22 00:20:53 +00:00
tg e991806f2b fixup LINENO in eval and alias; patch and initial testcase
From: Martijn Dekker <martijn@inlv.org>
2017-03-22 00:20:43 +00:00
tg 9466b49fe8 add standard variable PATHSEP, for better and easier OS/2 support 2017-03-19 22:31:29 +00:00
tg 0530264293 embed 2017-03-19 22:23:45 +00:00
tg 0935faa52b introduce a FAQ, move lots of stuff there and add lots of stuff 2017-03-19 22:04:49 +00:00
tg 1dd5ae69ae fix padding in Lb64encode
undefined array elements read as "" or (arithmetically) 0
so this is ok and works as the lines below expect it
2017-03-19 21:08:25 +00:00
tg 06b2d53ea2 use \\builtin ipv \let] and \set internally 2017-03-19 20:59:29 +00:00
tg 73dca6e90f use the new “\builtin” builtin for quoting, everywhere 2017-03-19 20:36:08 +00:00
tg c3fe9d5fb5 Haiku-related ulimit overhaul:
• print ulimit -a with the flag, like most other shells do
• move ulimit-1 regression test to ulimit-2 and exclude on Haiku:
  it can only set the -n and -V limits AFAICT
• document that some OSes (here: Haiku) can only set the soft limits
  (so “ulimit -nS 1024” is okay but -S is required)
• check “ulimit -c 0”, which dot.mkshrc uses, everywhere
  (if it errors out, hack around it or stub it out with MKSH_NO_LIMITS)
2017-03-19 18:05:29 +00:00
tg c98c8e9f5f further change typeset scope description, inspired by Martijn Dekker 2017-03-19 16:48:51 +00:00
tg a741defa53 Harvey-OS fixed APEX, this is reported to work now 2017-03-17 23:47:05 +00:00
tg 5b63e5dcb6 implement “typeset -g”, From: Martijn Dekker <martijn@inlv.org>
also deprecate “global”; thanks!
2017-03-17 22:45:53 +00:00
tg 065f9554fa fix GNU groff-only formatting bug in the manpage
From: Jean Delvare <jdelvare@suse.de>
2017-03-14 11:32:56 +00:00
tg a7654b2657 update testsuite accordingly 2017-03-12 02:35:32 +00:00
tg acf7909fe8 add OS/2 PATH note, for komh 2017-03-12 02:34:54 +00:00
tg 59219161fb document the declaration utility stuff and the new \builtin
also, make global a declaration utility
2017-03-12 02:31:02 +00:00
tg b531baa7fd add a “\builtin” builtin, make it forward assignments, fix some bugs
related to that:
• while AT&T ksh may do it, POSIX says nothing about allowing
  declaration commands only without vars and redirections, and
  “without vars” especially seems against which commands they are
• fix relationship between forwarders and real declaration commands
• clean up c_builtin vs shcomexec mess

Also, re-run “make repool” with a fixed src/scripts/stringpool.sh,v 1.3
2017-03-12 02:04:15 +00:00
tg 86773fcf21 unbreak $'\xz' to expand to 'xz' 2017-03-11 23:56:17 +00:00
tg 950df6491d add “\builtin” utility 2017-03-11 23:22:36 +00:00
tg ff72ba8399 make “builtin” and “wait” not special
(“\builtin” likely also doesn’t need it, as “command” isn’t)
2017-03-11 23:10:41 +00:00
tg 27cdd075c6 remove odd use of KEEPASN, I believe it really unnecessary now 2017-03-11 22:58:51 +00:00
tg bc4397e28a fixup tilde expansion comments; revert a few bogus dirsep changes
cf. <Pine.BSM.4.64L.1703112129500.29506@herc.mirbsd.org>
2017-03-11 22:49:56 +00:00
tg a112d69c56 add missing -e to print synopsis; From: Jean Delvare <jdelvare@suse.de>
also add missing .Ns (no space) between -u and [n] in its option list
2017-02-27 16:08:04 +00:00
tg 512c152479 improve wording avoiding bad linebreaks 2017-02-27 16:04:37 +00:00
tg 4cc0d14466 exclude PATH manipulation if we guess at OS/2 2017-02-18 02:37:57 +00:00
tg 2584cd0634 fixup relation between lksh and mksh (somewhat minimal delta) 2017-02-18 02:33:15 +00:00
tg 18051b7e8a less assignments 2017-02-18 01:27:24 +00:00
tg 7b02f1ec8d in ${foo=bar}, “bar” must be scalar context; spotted by Martijn Dekker 2017-02-17 22:40:13 +00:00
tg 287507fb21 there’s no evidence for -e in any BSD echo (but in ksh93 print)
spotted by Jean Delvare <jdelvare@suse.de> and Werner Fink <werner@suse.de>
2017-02-17 22:28:26 +00:00
tg ca6529e0a2 oops… 2017-02-17 21:15:55 +00:00
tg 21f70afb26 make ${var@x} with unknown x fail; spotted by izabera, thanks 2017-02-17 20:52:15 +00:00
tg 0cdc87055f improve rendering of contact information 2017-02-17 20:41:56 +00:00
tg 93162d8c3a undocument printf(1), it causes user confusion 2017-02-17 20:38:16 +00:00
tg d9b0b71b1d fix broken indentation accidentally introduced in -r1.293
(after checking whether indeed indentation or braces are wrong)

spotted by Jean Delvare <jdelvare@suse.de> via mailing list, thanks!
2017-02-08 15:27:27 +00:00
KO Myung-Hun 87cea30045 eval: fix typo
modified:   eval.c
2017-01-19 16:36:18 +09:00
KO Myung-Hun a5da1fa0b6 main: find a script executed by extproc in current directory first
extproc does not pass a full path of a script. To find it, check
the existence of it manually in the current directory before in $PATH.

This is the fix of regression of commit
1b4d572b77.

    modified:   main.c
2017-01-11 13:00:46 +09:00
KO Myung-Hun e0355b78a9 eval: trim CR+LF in backtick('') and $()
modified:   eval.c
2017-01-10 17:29:41 +09:00
KO Myung-Hun f814ccfb8f exec: remove the last / or \ when searching $PATH
For example, X:/ becomes to X://name. CMD.EXE is not tolerant of such
a style.

    modified:   exec.c
2016-12-23 15:41:30 +09:00
KO Myung-Hun bf88879b0d Revert "exec: prevent a command in a current dirctory from being executed"
This reverts commit 1b4d572b77.

An empty path is treated as a current directory in Unix, too.
2016-12-23 14:43:35 +09:00
KO Myung-Hun de671a4e1c Revert "exec: set ev to ENOENT properly"
This reverts commit 6739812ea6.
2016-12-23 14:43:20 +09:00
KO Myung-Hun 6739812ea6 exec: set ev to ENOENT properly
modified:   exec.c
2016-12-22 13:06:59 +09:00
KO Myung-Hun 1b4d572b77 exec: prevent a command in a current dirctory from being executed
A command in a current directory should be executed only if $PATH
contains the directory such as '.'.

This will improve the compatibility with Unix shell script and the
security.

    modified:   exec.c
2016-12-22 12:59:04 +09:00
KO Myung-Hun eb43e28996 Revert "exec: search commands in the current directory first on OS/2"
This reverts commit 89d461dd83.

To avoid the incompatibility with Unix shell scripts not expecting that
a current directory is searched first and the security problems, let a
user prepend "." to $PATH explicitly if needed.

    modified:   exec.c
2016-12-22 09:15:28 +09:00
KO Myung-Hun 9f84c65e76 os2: return an error code correctly when a child was signaled
For example, a child process terminates due to abort().

    modified:   os2.c
2016-12-21 20:37:37 +09:00