Commit Graph

3151 Commits

Author SHA1 Message Date
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
KO Myung-Hun 89d461dd83 exec: search commands in the current directory first on OS/2
On OS/2, commands(executables) are searched in the current directory
before in $PATH.

    modified:   exec.c
2016-12-19 15:50:58 +09:00
KO Myung-Hun 20dbf6b45b Read in text mode in a needed place only
Converting CR+LF to LF in blocking_read() which is a underlying read
function, may affect to the functions which do not perform line-based
operation.

    modified:   funcs.c
    modified:   main.c
    modified:   misc.c
    modified:   os2.c
    modified:   shf.c
2016-12-19 08:27:06 +09:00
KO Myung-Hun 18ff277047 Write in binary mode through pipes
On kLIBC, a child inherits a translation mode of stdio/stdout/stderr
of a parent. So if setting stdio handles of a parent to text mode,
a child reads CR+LF as LF and write LF to CR+LF. Especially, LF to
CR+LF conversion causes many troubles in UNIX programs.

Instead, if a child inherts a child inherit a current translation mode,
where stdin is text mode, stdout and stderr are binary mode, a child
would write LF as is.

This is the way for OS/2 to survive in UNIX jungle.

For example, 'make check' of libiconv fails due to mismatch of CR+LF
and LF.
2016-12-15 17:37:04 +09:00
KO Myung-Hun 2b9eed78a0 move os2_init() from main() to main_init() 2016-12-14 11:05:50 +09:00
KO Myung-Hun 224fd5aebe Merge remote-tracking branch 'mksh/master'
Conflicts:
    misc.c
2016-11-12 15:41:31 +09:00
KO Myung-Hun cc49df380e fix mksh_sdirsep() and simplify mksh_vdirsep() on OS/2
mksh_sdirsep() returned a position of a more far directory separator
if '/' and '\' were mixed.

And mksh_sdirsep() returned a position of ':' even if a directory
separator follows. For example, in case of 'x:/', the position of
'/' should be returned not ':'.

mksh_vdirsep() were simplified with mksh_sdirsep().
2016-11-12 15:23:24 +09:00
KO Myung-Hun a2e965cad3 Merge remote-tracking branch 'mksh/master'
Conflicts:
    Makefile
    edit.c
    eval.c
    exec.c
    main.c
    misc.c
    sh.h
    var.c
2016-11-12 13:22:58 +09:00
tg 7d387fd54e fix embarassing pasto and OS/2 UNC logic; thanks komh! 2016-11-12 03:54:48 +00:00
tg 6d5496a81c make both cats 2016-11-12 00:20:37 +00:00
tg 0ba220d2c4 gcc 6.2 warnings (stupid uninitialised that wasn't, plus FALLTHROUGH fixes) 2016-11-11 23:48:30 +00:00
tg 7b4bee7e58 collective R54 release preparation multi-merger:
install both lksh and mksh manpages from Build.sh (Martijn Dekker)
spelling fixes (Larry Hynes)
manpage improvements (Martijn Dekker)
initial port to Harvey-OS’ APEX (Ronald G. Minnich, Elbing Miss, Álvaro Jurado)
more from komh’s OS/2 port (KO Myung-Hun)
2016-11-11 23:31:39 +00:00
tg 3aac3c30b5 return 128+SIGALRM if read with timeout timeouts, inspired by GNU bash 2016-11-11 22:17:09 +00:00
tg 945ef46af1 document print builtin changes 2016-11-11 21:37:44 +00:00
tg 6267ea36a4 fix print -cn 2016-11-11 21:37:35 +00:00
tg 6c04e4a665 make print -c honour line separator 2016-11-11 21:13:25 +00:00
tg 26689a7c81 just 'print -c' outputs not even a newline; plug a memleak while here 2016-11-11 20:53:15 +00:00
tg 2f63478bc9 restructure so that the trailing separator is output separately from
the inner line separators
2016-11-11 20:22:52 +00:00
tg 5ba6be5837 put print_columns options into a helper struct, eases passing things around 2016-11-11 20:14:18 +00:00
tg e16b0b9d5b first implementation of “print -c” for columnising, currently hardcoded newlines 2016-11-11 19:59:39 +00:00
tg 6a9dae2144 implement print -N: set output word and line separator to NUL 2016-11-11 19:18:40 +00:00
tg 8c2eda2f0f implement print -l: change output word separator to newline 2016-11-11 19:12:52 +00:00
tg d4b81df050 goto keeps us from evaluating the loop condition twice in immediate succession
(and shaves off an indentation level)
2016-11-11 19:09:44 +00:00
tg 1c07e75fc0 implement: empty arg in print -A is input word separator 2016-11-11 19:02:26 +00:00