Commit Graph

3048 Commits

Author SHA1 Message Date
KO Myung-Hun c8bdf4d149 Define MKSH_NOPROSPECTOFWORK on OS/2
Strangely, sometimes mksh is blocked when it is running in a background
console, that is, a window not having a focus.
2015-06-03 13:00:48 +09:00
KO Myung-Hun d601372feb Fix compilation warnings/errors when MKSH_NOPROSPECTOFWORK is defined
-----
jobs.c: In function `j_waitj':
jobs.c:1117: warning: unused variable `omask'
jobs.c: In function `j_sigchld':
jobs.c:1321: error: `sm_sigchld' undeclared (first use in this function)
jobs.c:1321: error: (Each undeclared identifier is reported only once
jobs.c:1321: error: for each function it appears in.)
-----
2015-06-03 13:00:48 +09:00
KO Myung-Hun 3af76d7f94 Check sh.exe on OS/2 intead of sh 2015-06-03 13:00:47 +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 8168ee626f Disable some tests on OS/2 2015-06-03 13:00:46 +09:00
KO Myung-Hun 431f250762 Use ; as a path separator on OS/2 when testing 2015-06-03 13:00:46 +09:00
KO Myung-Hun a1a8bd3f42 Define MKSH_UNEMPLOYED on OS/2 2015-06-03 13:00:46 +09:00
KO Myung-Hun fc17d48a59 Consider an OS/2-style absolute path when testing
x:* and \* are absolute paths on OS/2 as well as /*.
2015-06-03 13:00:45 +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 a32d1d70bf Support .cmd and .bat on OS/2 2015-06-03 13:00:44 +09:00
KO Myung-Hun 148c019595 MZ magic is supported 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 759b6ec59f Consider OS/2-style path
OS/2 uses 'x:' as a drive prefix and '\' as a directory separator.
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 fdd0831a58 Check EPERM as well on OS/2
fcntl() on OS/2 kLIBC may return EPERM instead of EBADF in this context.
2015-06-03 13:00:42 +09:00
KO Myung-Hun 9b30ce1a6d Support extproc on OS/2
extproc is similar to like #! on OS/2.
2015-06-03 13:00:42 +09:00
KO Myung-Hun 5127457319 Read in text mode, write in binary mode on OS/2
This enables to convert CR+LF to LF when reading, but disables to
convert LF to CR+LF when writing.

Instead, however, CR+LF are not passed into mksh as is.
2015-06-03 13:00:41 +09:00
KO Myung-Hun a3fdbc6802 Make all the files executable on OS/2
On OS/2, an executable status is determined by an extension such as .exe
not real executable mode.

Script files without executable extensions such as .exe, cannot be
executed.
2015-06-03 13:00:41 +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
KO Myung-Hun 8f633da789 Path separator is ; on OS/2 2015-06-03 13:00:40 +09:00
KO Myung-Hun c29f892437 Ignore size on OS/2
Size does not support OS/2 OMF executables.

-----
size mksh.exe
size: mksh.exe: File format not recognized
-----
2015-06-03 13:00:39 +09:00
KO Myung-Hun fb22b94007 Executables have .exe extension on OS/2 2015-06-03 13:00:39 +09:00
KO Myung-Hun aeeabefbe5 Do not define getrusage() stuffs on OS/2 kLIBC
OS/2 kLIBC has only a declaration of getrusage() without implementation.
Due to this, definition of getrusage() stuffs causes compilation to fail.

-----
In file included from lalloc.c:21:
sh.h:379: error: conflicting types for `getrusage'
f:/lang/gcc/usr/include/sys/resource.h:168: error: previous declaration of `getrusage'
-----
2015-06-03 13:00:39 +09:00
KO Myung-Hun a4139c6666 Use gcc on OS/2 2015-06-03 13:00:38 +09:00
tg 643cd0b7e9 add missing initialisation of stack memory to BAFHHostStr(); fix comments for BAFHror() 2015-05-30 22:14:06 +00:00
tg babd9c4cf0 The check for empty patterns and patterns matching the empty string
in commitid 1004D8283F068C41C3C was bogus; it fixed Jb_boin’s issue
but izabers’s 「var=foo; echo "${var/*/x}"」 was broken; in fact we
only want to not do the looping for // if the pattern matches much.

Also, fix a spelling mistake in the manpage and change some wording
to also work with associative arrays (in the future; no change).
2015-05-23 17:43:22 +00:00
tg d3331c04d4 add binding for another well-known ANSI Del key
From: Ivan Delalande <colona@ycc.fr>
2015-05-03 11:28:53 +00:00
tg 7f48503c66 sometimes, I feel pretty stupid
separate the backslash+newline things out of the *.opt files,
logically not 100% clean, but better as it is not generated
content anyway (keeping the one-liners in there for now, even
though more consistent would be shifting them out as well)
2015-05-01 23:16:31 +00:00
tg a9e1101145 sync with actual z/OS <signal.h> contents 2015-05-01 16:08:26 +00:00
tg 1d347a35fe EBCDIC review 2015-04-29 20:56:18 +00:00
tg 93ccb42114 overhaul the signal handling:
• support NSIG_MAX from http://austingroupbugs.net/view.php?id=741
  and make a TODO for later to use sysconf(_SC_NSIG) at runtime
• bounds-check signals (e.g. no smaller than 1, but smaller than NSIG)
• align trap errorlevel with other shells
• make trap match what’s in POSIX and fixup the manpage
• refactor some code related to signals
• hide from kill builtin both EXIT and ERR pseudo-signals
2015-04-29 20:44:37 +00:00
tg 4e313e705d improve install notes, mention lksh, as requested by Ypnose via IRC 2015-04-29 20:39:00 +00:00
tg 87c05f813b 2015-04-29 20:21:35 +00:00
tg b697f0ef70 make it compile 2015-04-29 20:16:48 +00:00
tg 55c3fb35d8 more OS/390 issues 2015-04-29 20:13:47 +00:00
tg 4a33198f45 manpage fixes (mostly \-x to Fl x inline) 2015-04-29 20:13:26 +00:00
tg 609b311919 more low-hanging fruits for EBCDIC; notes:
• ord() new, From: Daniel Richard G. <skunk@iSKUNK.ORG>
  ‣ used in some places
• (c - '0') → ksh_numdig(c)	# may take *x++ argument
• (c - 'A') → ksh_numuc(c)	# may NOT take *x+= argument
  ‣ idem for ksh_numlc(c) and 'a'
  ‣ these need changing for EBCDIC
  ‣ add testsuite for this
• use macros more, they exist already often
• use digits_lc[foo] instead of ('0' + foo), especially for letters
• caught another ksh_eq case…
• also caught a maybe-UB overflow check, but we don’t have TIME_T_MAX ☹
2015-04-29 20:07:35 +00:00
tg 3eb806b72b inline only user of ksh_min, make it more cool; drop ksh_min, ksh_max;
move ksh_isdigit etc. to ksh_isalpha etc. definitions
2015-04-29 19:11:57 +00:00
tg f460677c77 fix pdksh mistake of using +-= in char class; move - to end and add \d 2015-04-29 19:01:03 +00:00
tg 0661df9940 fix lies; this had to be taken out for security reasons some time ago 2015-04-29 18:56:00 +00:00
tg 82bc5eba9a give a better suggestion: find|read → find|&read 2015-04-29 18:54:05 +00:00
tg 2cb0ea982a EBCDIC helpers and OS/390 signals 2015-04-29 18:38:54 +00:00
tg c3efd2abb2 use already-existing ksh_isdash helper macro 2015-04-29 18:32:44 +00:00
tg c9ccf0bab7 MFC remaining fixes; tested locally a lot, plus remotely with
GNU C11 (Debian 20150413-1) version 5.0.1 20150413 (prerelease) [gcc-5-branch revision 222050] (x86_64-linux-gnu)
including ASan (testsuite) and Valgrind (short)
2015-04-19 19:18:07 +00:00
tg 65f9b93926 ordinarily, lineno must be mksh_uari_t, but edit.c most of all isn’t ready,
so we mitigate a bit (in var.c mostly) and tweak another type already, and
add some checks (mksh_{,u}ari_t must fit into {,unsigned }long) and print
line numbers with %lu already
2015-04-19 18:50:38 +00:00
tg a2a4e41975 make var.c:getint() more like misc.c:getn(), except for the API differences:
getn() parses a decimal 32-bit integer, getint() a POSIX- or ksh-style based
integer with unsigned wraparound to 32 bit, then possible negation (so that,
for example, -0xFFFFFFFF continues to work)
2015-04-19 18:13:31 +00:00
tg 94acf49453 a bit review-inspired getn/bi_getn review 2015-04-19 14:40:23 +00:00
tg b7332de28c a bit oksh-inspired getn return value checking, plus some code optimisation 2015-04-19 14:40:09 +00:00
tg a1ba509bb9 oksh RCSID sync: we use mksh getn() instead of OS strtonum() which is just as safe (audited right now) 2015-04-19 14:23:26 +00:00