Commit Graph

2794 Commits

Author SHA1 Message Date
tg
e88316739e merge from git@github.com:komh/mksh-os2
Use gcc on OS/2

From: KO Myung-Hun <komh@chollian.net>
2015-07-09 19:04:28 +00:00
tg
f463d9da76 • revert the cat hack for realpath and rename
‣ I was convinced by several that more magic is never the solution
• fix a comment: function cat already had precedence
• change cat loader to look for existence, FPATH included, before
  ditching the builtin; note that in manpage
2015-07-06 17:48:37 +00:00
tg
d09aca4175 do the IFS_QUOTE dance right; this finally fixes ""$@ 2015-07-06 17:45:33 +00:00
tg
2e4cd72899 make certain actions flush the history buffer 2015-07-05 19:53:46 +00:00
tg
e0196f47d5 implement completely new multiline code by delaying history store
this commit is valgrind-tested
2015-07-05 19:37:18 +00:00
tg
be8c2fa8c2 optimise by making use of commitid 1005529AD8D33CF99B9 2015-07-05 19:02:16 +00:00
tg
48af854117 fix 'command -v' for "shell reserved words"
From: Martijn Dekker <martijn@inlv.org>

also adjust manpage accordingly
2015-07-05 17:50:40 +00:00
tg
0d5b514e63 now removes *all* trailing newlines (by reusing histsave result, saves code),
plus plugs an ancient memory leak (hist_execute afree’s its arg now);
also partial revert of commitid 78014291f06497b3 as COMPLEX_HISTORY handles
multi-line commands correctly now (r1.4, 2005-05-23)
2015-07-05 17:04:26 +00:00
tg
757d857319 greatly simplify hist_execute (useless to cut a string in twain, then
restore the very same string), except now, the one trailing newline
is not removed (except in histsave)
2015-07-05 16:48:28 +00:00
tg
b87215bbaf when storing commands with embedded newlines, don’t take those as end of string
(inspired fix from Debian #783978; bug in original pdksh COMPLEX_HISTORY code)
2015-07-05 16:47:28 +00:00
tg
b9a8fdf905 implement cat thing for realpath and rename too: if flag, call external 2015-07-05 15:45:18 +00:00
tg
b478d334d9 merge spelling stuff from oksh 2015-07-05 15:22:41 +00:00
tg
69ec1002eb add new expected-fail from POSIX <Pine.BSM.4.64L.1410241226350.12660@herc.mirbsd.org> 2015-07-05 15:12:04 +00:00
tg
5eeeaab8cf ensure at least two spaces of cell-to-cell horizontal padding in print_columns;
audit all callers of print_columns to always pass the exact maximum sizes
2015-07-05 14:58:33 +00:00
tg
69eac312de omit trailing whitespace for print_columns 2015-07-05 14:47:41 +00:00
tg
62e27c3e07 simplify print_columns func argument: no need to return the first arg any more 2015-07-05 14:43:08 +00:00
tg
bbf0558f6a in print_columns, skip space padding for all last cells, not just
those in the last column, for jagged arrays
2015-07-05 14:33:21 +00:00
tg
11a2f9d822 make $LINENO in PS1 equivalent to ! (bug spotted by carstenh in IRC) 2015-07-05 13:49:42 +00:00
tg
7a1acedd4a bump; nothing to merge from oksh, and nothing more from me today 2015-06-28 16:23:24 +00:00
tg
0bdc395a81 permit read -N n (n ≠ -1) and read -t to return partial reads with $? == 1
issue spotted by carstenh, could have been a documentation ambiguity issue
(as -N was designed to read and return exactly n bytes), but this resolves
it in a way both backwards-compatible and user-pleasing
2015-06-28 14:57:25 +00:00
tg
f03037706c cd does weird things wrt. error messages; slightly better, from carstenh via IRC 2015-06-27 20:44:01 +00: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
tg
b19747e3de irrelevant oksh RCSID sync: we already use getint, and our $COLUMNS differs a bit anyway 2015-04-19 14:22:09 +00:00
tg
4bea0cc227 MFC most things (see mksh.hts) to R50-stable; sync clog 2015-04-12 22:32:12 +00:00
tg
cad9bc86d3 Implement the “FKSH functions have local scope for shell options” feature
for mksh but not lksh; bump to R51-alpha.

While here, tweak build scripts a bit, fixup MirBSD-specific Makefile
things, remove part of a comment that’s uninteresting.
2015-04-11 23:28:21 +00:00
tg
3251f18c12 document code to make mksh set ±U match the user locale from the environment
cf. http://thread.gmane.org/gmane.linux.debian.devel.bugs.general/1246729/focus=606
2015-04-11 22:35:10 +00:00