Commit Graph

16 Commits

Author SHA1 Message Date
tg 718d397fff merge mksh-os2 by KO Myung-Hun <komh@chollian.net> from https://github.com/komh/mksh-os2 2017-04-02 15:00:45 +00: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 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 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 52c47ec69e os2: fix the last character of a response file is splitted
For example, if a response file has the following:

    0123456789

Then, it is splitted into two arguments, 012345678 and 9.

    modified:   os2.c
2016-03-20 11:28:22 +09:00
KO Myung-Hun 25bb7dcec4 exec: fix that executing a file with multiple dots fails on OS/2
For example, [a.b.exe] cannot be executed with [a.b].

    modified:   exec.c
2015-06-11 16:10:29 +09:00
KO Myung-Hun 645b537439 Support BEGINLIBPATH, ENDLIBPATH and LIBPATHSTRICT on OS/2 2015-06-03 13:00:50 +09:00
KO Myung-Hun 011d0abf2c Clean-up temporary files on OS/2
On OS/2, unlink() fails on opened files. For this case, try to unlink()
them at termination.
2015-06-03 13:00:49 +09:00
KO Myung-Hun 29161973e3 Set stdin to text mode, and stdout/stderr to binary mode if not a console 2015-06-03 13:00:47 +09:00
KO Myung-Hun 4076b74ae8 Convert backslashes of PATH and TMPDIR to slashes on OS/2
PATH and TMPDIR are used by OS/2 as well. So they may have backslashes
as a directory separator. A backslash may cause an unexpected behavior
when do 'echo'. Because a backslash may be used as an escaped character.
2015-06-03 13:00:45 +09:00
KO Myung-Hun ffb5e7cd19 Workaround for execve() on OS/2 2015-06-03 13:00:44 +09:00
KO Myung-Hun 07e5cadc54 Support a response file on OS/2 2015-06-03 13:00:43 +09:00
KO Myung-Hun a03cf65602 Consider executable extensions in case of some test commands on OS/2
-r, -w, -x, -a, -e, -f.
2015-06-03 13:00:42 +09:00
KO Myung-Hun 5ed2481df2 Try to append executable suffixes if not having extension on OS/2 2015-06-03 13:00:40 +09:00