2707 Commits

Author SHA1 Message Date
KO Myung-Hun
edc36cce7f edit: set edchars manually on OS/2
OS/2 kLIBC have termio.h and termios.h. But the real functions are
dummies.

Now Ctrl-C and Ctrl-D work well.

    modified:   edit.c
2015-07-07 08:28:55 +09:00
KO Myung-Hun
01648d4495 scriptexec: cosmetic 2015-06-11 22:44:00 +09:00
KO Myung-Hun
df2cf83f8b scriptexec: preserve original shell/interpreter path
For example,

When failing to execute the script which starts with the above line,
an error message does not contain information for /path/to/name.
Instead, it contains only name. In addition, if /path/to/dir/, an error
message contains empty string for a name of a failed script.
2015-06-11 22:16:17 +09:00
KO Myung-Hun
b27e10a32e scriptexec: try to use shell/interpreter name as well on OS/2
If specified path does not exist, try to use shell/interpreter name
without directory.

On OS/2, directory structures of distribution is quite different. And
Some scripts have hard coded shell/interpreter. To overcome this, allow
to use shell/interpreter name if specified path does not exist.
2015-06-11 16:16:07 +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
a041295dae BEGINLIBPATH, ENDLIBPATH and LIBPATHSTRICT are not inhertied on OS/2 2015-06-03 15:27:32 +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
89324074c4 Prepend /@unixroot to rooted paths on OS/2
$UNIXROOT is a root directory of FHS on OS/2. /@unixroot is replaced by
$UNIXROOT at runtime.
2015-06-03 13:00:49 +09:00
KO Myung-Hun
0fbbbed49c Support arrow keys on emacs/vi mode on OS/2 2015-06-03 13:00:49 +09:00
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
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