Commit Graph

932 Commits

Author SHA1 Message Date
tg d54d4aab50 batch of optimisations 2017-04-27 20:22:28 +00:00
tg 91a3d6751e fix C_LEX1 which does STILL N̲O̲T̲ include the NUL… 2017-04-27 19:19:05 +00:00
tg b228c59895 convert to the new fast character classes 2017-04-27 19:16:10 +00:00
tg 3dff460cde prepare the new fast character classes, not live yet: need sanity check
unfortunately we need at least 21 or so, maybe 19, classes, so sizing
things down to short is not possible; we can splurge with 32 bit thus
2017-04-22 00:07:10 +00:00
tg d3be19ac69 now actually do comparisons for sorting ASCIIbetically 2017-04-21 20:06:06 +00:00
tg e18a509a80 make ord() result unsigned int; add asc() which is:
• not designed to be emitted, only used in comparisons with
  other asc() results
• on EBCDIC platforms, the mapping of an EBCDIC octet to their
  corresponding ASCII or Unicode/UCS-4 codepoint or, if there
  is no mapping, a distinct value above all valid Unicode codepoints
• on nōn-EBCDIC platforms, just the identity mapping of the input
  octet into their ord() value

Intended use are ASCII-ish character ops, including ranges (“A-Z”),
mapping from those to the corresponding digit offset, and sorting
of things in an ASCIIbetical way
2017-04-21 19:50:09 +00:00
tg c35a5db0ac restore ‘.’ as allowed char in alias names 2017-04-20 20:50:14 +00:00
tg cb7280db1d amend MAGIC comment 2017-04-20 16:50:48 +00:00
tg 2699a0686e do not apply alias name restrictions to directories or “hash”
reported by Seb <sbb@tuxfamily.org>
2017-04-17 19:51:47 +00:00
tg 833cb27f5c add test -v, initially from Martijn Dekker 2017-04-12 17:38:46 +00:00
tg fae945962b allow 'eval break', from Martijn Dekker
also, more string pooling, while here
2017-04-08 01:07:18 +00:00
tg cadc884008 put the hyphen-minus back into the allowed alias name characters, for
Steffen Nurpmeso <steffen@sdaoden.eu>, except disallow it at the start
2017-04-06 19:02:07 +00:00
tg 3909a42540 fix reentrancy of 'typeset -f' output in the face of aliases; also,
move alias handling for COMSUBs and friends to parse time by request
of Martijn Dekker (and for consistency with function definitions)
2017-04-06 01:59:58 +00:00
tg e00f693cba limit alias characters to what POSIX requires 2017-04-06 00:53:35 +00:00
tg bcde17a8fc streamline some error messages 2017-04-06 00:41:42 +00:00
tg fa5cfa12ed string pooling, and more consistent look for error messages 2017-04-02 16:47:43 +00:00
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 a6619d1ef2 use new MKSH_WITH_TEXTMODE for several of the #ifdefs 2017-04-02 16:41:01 +02:00
mirabilos 7fb9d283c5 Merge mksh CVS HEAD 2017-04-02 16:32:16 +02:00
tg 8bf6cad8bc introduce the -T flag to set TEXTMODE (ASCII CR+LF newline support) 2017-04-02 14:14:08 +00:00
tg d68e69bd59 split path-specific ('C:\FOO' instead of '/foo') stuff into MKSH_DOSPATH:
• backslashes as directory separators
• semicolon as $PATH separator
• drive letters are absolute paths
2017-04-02 13:08:07 +00:00
tg 7529e350cf small character classes overhaul:
• make fast character classes even faster by removing the C_SUBOP2 hack
  in favour of a separate seldom-used ksh_issubop2 macro (which also
  makes ctype() side-effect-safe) which is a slower class (no change there)
• optimise cases of ksh_isalphx followed by a ksh_isalnux loop
  (used parsing variable names)
• remove a misleading comment in initctypes() about \0 from pdksh
• rename C_ALPHA to C_ALPHX to make it more clear the underscore is included
• sprinkle a few ord() in there
• add new ksh_isalpha() which tests for [A-Za-z] (slow character class)
• there is no '_:\' drive on OS/2 (which inspired the whole changeset)
2017-03-26 00:10:26 +00:00
mirabilos e216226f68 mostly more KNF 2017-03-26 00:18:21 +01:00
KO Myung-Hun c19b8b104c Merge remote-tracking branch 'mksh/master' 2017-03-22 17:50:23 +09:00
tg 034d0c0269 fixup “\builtin” on OS/2; thanks komh for spotting this 2017-03-22 00:20:53 +00:00
tg 9466b49fe8 add standard variable PATHSEP, for better and easier OS/2 support 2017-03-19 22:31:29 +00:00
tg 5b63e5dcb6 implement “typeset -g”, From: Martijn Dekker <martijn@inlv.org>
also deprecate “global”; thanks!
2017-03-17 22:45:53 +00:00
tg b531baa7fd add a “\builtin” builtin, make it forward assignments, fix some bugs
related to that:
• while AT&T ksh may do it, POSIX says nothing about allowing
  declaration commands only without vars and redirections, and
  “without vars” especially seems against which commands they are
• fix relationship between forwarders and real declaration commands
• clean up c_builtin vs shcomexec mess

Also, re-run “make repool” with a fixed src/scripts/stringpool.sh,v 1.3
2017-03-12 02:04:15 +00:00
tg 2584cd0634 fixup relation between lksh and mksh (somewhat minimal delta) 2017-02-18 02:33:15 +00:00
tg 7b02f1ec8d in ${foo=bar}, “bar” must be scalar context; spotted by Martijn Dekker 2017-02-17 22:40:13 +00: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 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 5ee8ba10b3 fix lazy evaluation with side effects; spotted by ormaaj via IRC 2016-11-07 16:58:48 +00:00
tg 56bdf24e54 fix error propagation in TAND/TOR constructs, noted by Martijn Dekker
still a bit unsure about the whole XERROK and *xerrok stuff, but…
it seems to work
2016-10-02 22:21:47 +00:00
tg d18f9133c8 fix English (thanks to Andreas Buschka); TIL:
• to start ⇒ a start
• to begin ⇒ a beginning
2016-09-01 12:59:12 +00:00
tg e5e3fb3fc7 outstanding bumps 2016-08-25 16:21:34 +00:00
KO Myung-Hun ef42532640 Merge tag 'mksh-R53a' into HEAD 2016-08-13 15:11:41 +09:00
KO Myung-Hun d4be6d4358 Merge tag 'mksh-R53' into HEAD
Conflicts:
    exec.c
2016-08-13 15:05:49 +09:00
tg 879c6a0911 fix refactoro, spotted by Natureshadow; add (working) testsuite for all operators 2016-08-12 16:48:05 +00:00
tg 2db6d0a08c bump, required by XTaran 2016-08-10 18:20:18 +00:00
tg f26cf0562b fixup a bad OpenBSD reaction on a bug afl showed:
set source to NULL only if the memory backing source is actually reclaimed;
fixes segfault due to NULL(+24) pointer dereference reported by Score_Under
(simplified testcase added; thanks!)
2016-08-04 20:51:35 +00:00
tg 757e25fb21 implement $KSH_MATCH and, to make it usable, ${foo@/bar/baz};
add a real-life example (for slagtc’s programmable tab completion)
to the manpage
2016-08-01 21:38:07 +00:00
tg e5a54ebb6b fix the occasional issue printing \xFF from a string 2016-08-01 20:23:15 +00:00
tg f21d6a3ffd fix (POSIX) errorlevel of ‘.’ when sourced file has no commands; issue discovered by Natureshadow 2016-07-28 21:39:19 +00:00
tg dd281c52ec defer to external rename(1) too 2016-07-26 21:50:46 +00:00
tg f9d131133e remove fd>9 support in favour of upcoming named file descriptors; bump 2016-07-25 21:05:25 +00:00
tg 4310e75f75 make tmux hack workable for now (libtermcap is… ugly)
• track $TERM for the types tmux uses /^screen(-.*)?$/
• when tmux is in use (or GNU screen, really), use the, now
  hardcoded, clear-to-EOL string; otherwise, use the old behaviour
• drop unnecessary x_e_rebuildline()

carefully tested to behave no worse than R52b
2016-07-25 20:43:54 +00:00
tg c3e794c4d0 rework string pooling; disable our own (rely on compiler’s)…
• if HAVE_STRING_POOLING is set to 1
• if HAVE_STRING_POOLING is set to 2 and not GCC < 4 is used
• if HAVE_STRING_POOLING is not set to 0 and LLVM or GCC >= 4 is used

Closes: LP#1580348
2016-07-25 00:04:48 +00:00
tg e8bbf79d8c invent builtin flags instead of special-casing cat and printf for prefer-external-over-builtin stuff 2016-07-24 23:10:04 +00:00
tg 8370c0dd4d experimentally use MKSH_CLRTOEOL_STRING instead of lots of spaces followed
by lots of backspaces for many clearing scenarios; requested by tmux user
slagtc on IRC
2016-07-12 23:07:10 +00:00
KO Myung-Hun 0d730e1ad9 Merge remote-tracking branch 'mksh/master' 2016-06-29 08:17:29 +09:00
tg a41a62dad7 efficient $(<<<foo) and $(<<EOF … ) implementation, requested by izabera 2016-06-26 00:44:59 +00:00
tg 58f36a9f3a increase default input line, from PLD Linux
(for as long as we still have the size static, and !MKSH_SMALL)
2016-06-25 23:49:50 +00:00
tg 9ab9ee194c fix shf.c-internal buffer overread on printing digits,
introduced by the utf_skipcols()-related fixes, more
specifically the check for combining multibyte characters
past end of given width (bogus mixed-up semantics we have here)
by reïntroducing the NUL byte from commitid 1005474EE1E4024A4E4
2016-05-17 15:36:35 +00:00
KO Myung-Hun e8966076c8 Merge remote-tracking branch 'mksh/master' 2016-05-06 17:12:52 +09:00
tg 92833fc6ce fix utf_widthadj/utf_skipcols handling for the remaining cases I can spot 2016-05-05 22:56:15 +00:00
tg 3da248755a bump 2016-04-14 15:38:38 +00:00
tg 4c4131dddf commitid 10056D5D8AF01B31531 broke fix for Debian #783978 (add testsuite) 2016-04-09 13:55:12 +00:00
KO Myung-Hun 68f6e899ef Merge tag 'mksh-R52c' 2016-03-05 14:59:34 +09:00
tg 4ccfd5fab5 document upcoming set +o changes; bump 2016-03-04 18:28:42 +00:00
tg cb0604767f address latest Debian gcc-snapshot’s warnings (some actual bugs!) 2016-03-04 14:26:16 +00:00
tg c2bdb1b9dd check not-begun heredocs at EOF earlier
izabera reported they were not caught with “set -n”
2016-03-01 18:30:05 +00:00
tg f23ed68f00 clean up, avoid aliasing concerns in non-debug case 2016-02-26 21:53:37 +00:00
tg 3b5f9c744c I didn’t like the code behind command -[Vv] and whence, so I rewrote it.
Bugreport by Martijn Dekker <martijn@inlv.org> about POSIX non-compliance
2016-02-26 20:56:45 +00:00
tg a3c28ebd67 plug a few display problems with special parameter name expansions
reported by Stéphane Chazelas
2016-02-26 18:48:14 +00:00
KO Myung-Hun e9364a4318 Merge remote-tracking branch 'mksh/master' 2016-02-25 14:56:35 +09:00
tg 2a3773b70b share structures better, less (void *) casts when we can stay typed 2016-02-24 02:08:39 +00:00
tg f0a042f070 implement mmap-using mechanism to catch buffer underruns inside mksh
(pulls stdio, is rather BSD-specific and memory-hungry and a bit slow)
2016-02-24 01:44:46 +00:00
KO Myung-Hun 36ea6b5f88 Merge remote-tracking branch 'mksh/master' 2016-01-24 16:43:45 +09:00
KO Myung-Hun 6eb125c18a Merge commit '91ae6ad199035b1cf' 2016-01-24 16:36:38 +09:00
tg 7c58621bc7 so, GCC is a real bitch 2016-01-21 19:58:13 +00:00
tg 27179454a9 hotfix for newer GCC 2016-01-21 19:38:09 +00:00
tg 188691d285 save 200 bytes off .text by revisiting string pooling
also, forgotten version bump
2016-01-21 18:24:45 +00:00
tg 61f7661b92 fix errno in print/echo builtin; optimise (with partial rewrite) 2016-01-20 21:34:13 +00:00
tg 046d8e5b7a align with future POSIX on http://austingroupbugs.net/view.php?id=351
with accepted interpretation (*sigh*); merge VARASN|ARRAYVAR→CMDASN
2016-01-19 23:12:15 +00:00
tg c51e067e62 incorporate more feedback from schily 2016-01-14 23:18:11 +00:00
tg 1b0e4f54cb permit 'read -A/-a arr[idx]' as long as only one element is read;
fix corruption of array indicēs with this construct (LP#1533396)
2016-01-14 22:49:33 +00:00
tg 2492c5692b incorporate suggestions by J�rg Schilling 2016-01-13 17:20:52 +00:00
tg 4059e105a2 fstat(2) after open(2) for set -C case when initial stat(2) was !S_ISREG
to fix race condition as suggested by jilles
2015-12-31 21:03:47 +00:00
KO Myung-Hun 0c41f2fdc8 Merge remote-tracking branch 'mksh/master' 2015-12-13 17:59:43 +09:00
tg b2b0c0bbb6 update for recent changes 2015-12-12 22:25:15 +00:00
KO Myung-Hun 788fdcd188 Merge remote-tracking branch 'mksh/master' 2015-10-26 11:24:15 +09:00
tg 1a4f644d6e save ~1½K from the bootfloppy by reusing MirBSD libkern wcwidth(3)
but don’t bother for this for the regular /bin/mksh either
to keep the generic code path tested well
2015-10-24 19:45:23 +00:00
KO Myung-Hun 780f220e23 Merge remote-tracking branch 'mksh/master'
Conflicts:
    check.t
    exec.c
    sh.h
2015-10-11 19:42:38 +09:00
tg cef386fb60 make “source” into a built-in command (keepasn, to match ksh93 and “dot”);
remove the “stop” alias and drop old Android and OS/2 hacks and auto-unalias
2015-10-09 21:36:59 +00:00
tg fc48729336 tweak some iop/conservative_fds-related things I picked up while thinking lksh 2015-10-09 19:29:50 +00:00
tg af35e9a6de revert most of commitid 3ec342c92b3a8874 and fixup the rest;
this should bring us closer to POSIX again
2015-10-09 17:48:53 +00:00
tg 3fc8b5eb94 partial oksh sync, up to commit 80be547da108d5c241ae068290ca3e331446aa41? 2015-10-09 16:11:19 +00:00
tg eb9050b8f8 stop using issetugid(2) for ±p check as it’s probably not the right tool 2015-10-05 17:59:00 +00:00
KO Myung-Hun bd9de444e3 Merge remote-tracking branch 'mksh/master' 2015-09-12 12:50:57 +09:00
tg ed5cb56849 replace the code related to << changes and <<< with cleaner code,
fixing a few bugs also (including new testcases, except x=<< issue)
2015-09-06 19:47:01 +00:00
tg edc2acd61d fix tree printing multiple heredocs in one command, bug found by izabera 2015-09-05 20:20:48 +00:00
tg 4adcfe8b58 oksh sync, simplify *all* if(x)free(x); constructs, simplify x_push() and sync boilerplate while here 2015-09-05 19:19:12 +00:00
KO Myung-Hun df20ee1fff Merge remote-tracking branch 'mksh/master'
Conflicts:
	check.t
	main.c
2015-08-15 23:45:52 +09:00
tg 1b8b792b7e quote path separator if ; in some cases; pointed out by komh 2015-08-13 22:06:23 +00:00
tg c674e71377 be more careful with signals and errorlevels; bounds-check them better;
don’t trust the OS as POSuX comes up with more-than-8-bit exit codes now;
also, one more int → bool
2015-08-13 21:38:19 +00:00
KO Myung-Hun 4c61aeebe5 Use upstream style macro/function names
modified:   edit.c
    modified:   eval.c
    modified:   exec.c
    modified:   main.c
    modified:   misc.c
    modified:   sh.h
2015-07-21 16:30:47 +09:00
KO Myung-Hun 834349f3be Merge remote-tracking branch 'mksh/master'
Conflicts:
	Build.sh
	check.pl
	check.t
	edit.c
	emacsfn.h
	exec.c
	funcs.c
	main.c
	misc.c
	sh.h
	var.c
2015-07-21 16:30:46 +09:00
tg ba8a6e9461 merge OS/2 style PATH (absolute with drive letters, ‘;’ as separator)
From: KO Myung-Hun <komh@chollian.net>
2015-07-10 19:36:38 +00:00