297 Commits

Author SHA1 Message Date
tg
d905bd16e1 rename asc() to asciibetical() to make clear it’s for POSIX ordering only
and switch remaining consumers, except the allowed one, to rtt2asc()
2017-04-28 03:46:50 +00:00
tg
fba6940ba4 control character madness, but more compiler-friendly 2017-04-28 03:28:19 +00:00
tg
1289bc69fb apply most of the remaining parts of the EBCDIC patch, sans the CTRL() changes 2017-04-28 02:24:58 +00:00
tg
8df7c0c94a BEL was, and Vi mode is, not EBCDIC-safe 2017-04-28 00:49:33 +00:00
tg
2231ff566d commit the optimisation result from the new fast character classes 2017-04-28 00:38:33 +00:00
tg
394a8507e8 fix return value to signed 2017-04-27 23:34:20 +00:00
tg
13e91621ca fixup the remaining issues and last optimisations 2017-04-27 23:12:49 +00:00
tg
d54d4aab50 batch of optimisations 2017-04-27 20:22:28 +00:00
tg
1080008a8f eliminate legacy macros 2017-04-27 19:33:53 +00:00
tg
b228c59895 convert to the new fast character classes 2017-04-27 19:16: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
b874c66f61 fix comment 2017-04-20 16:34:39 +00:00
tg
30cae62468 (very few) fixes and a couple of workarounds for Coverity 2017-04-12 16:46:23 +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
tg
86773fcf21 unbreak $'\xz' to expand to 'xz' 2017-03-11 23:56:17 +00:00
tg
2584cd0634 fixup relation between lksh and mksh (somewhat minimal delta) 2017-02-18 02:33:15 +00:00
tg
7d387fd54e fix embarassing pasto and OS/2 UNC logic; thanks komh! 2016-11-12 03:54:48 +00: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
6c04e4a665 make print -c honour line separator 2016-11-11 21:13:25 +00:00
tg
2f63478bc9 restructure so that the trailing separator is output separately from
the inner line separators
2016-11-11 20:22:52 +00:00
tg
5ba6be5837 put print_columns options into a helper struct, eases passing things around 2016-11-11 20:14:18 +00:00
tg
cc6857dfb6 clean up chtypes use 2016-08-01 18:42:42 +00:00
tg
aa9fa0ebfe add a testcase as documentation (why POSIX isn’t everything); fix comments 2016-07-25 20:36:28 +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
cb0604767f address latest Debian gcc-snapshot’s warnings (some actual bugs!) 2016-03-04 14:26:16 +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
3fc8b5eb94 partial oksh sync, up to commit 80be547da108d5c241ae068290ca3e331446aa41? 2015-10-09 16:11:19 +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
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
tg
edf76ec8e6 harden the crlf vs lf tests even more; use binary mode explicitly on OS/2 2015-07-09 20:52:43 +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
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
87c05f813b 2015-04-29 20:21:35 +00:00
tg
b697f0ef70 make it compile 2015-04-29 20:16:48 +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
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
2097d45f7f oksh rcsid-only sync, plus bonus rewrite of strip_nuls
(uses size_t ipv int for buffer size now, and no extra
calls to memchr/memmove, input is typically small)
2015-03-20 21:46:41 +00:00
tg
707add559f keep “set -x” disabled during PS4 expansion, to avoid infinite looping 2015-03-01 15:23:05 +00:00
tg
934929c2ee rcsid sync from obsd; misc sync; small improvements
• mksh testsuite no longer uses printf, again
• use MAXPATHLEN from <sys/param.h> as PATH_MAX fallback
2015-01-25 15:23:43 +00:00
tg
51c370459e bump version and, also, year… I hate this… 2014 is gonna follow us for a while… 2015-01-02 13:21:28 +00:00
tg
7b4951c58f apparently, we’re supposed to setuid() before seteuid()
cf. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=772597
also, groups before users, methinks…
2015-01-02 08:18:44 +00:00
tg
2f52b993a1 • Build.sh: fix NSIG detection for gcc-snapshot
• all: bump version to R50-current; add more comments; whitespace
• all: remove all mkssert(); we’ll do full re-runs of scan-build and,
  hopefully, Coverity Scan/Prevent
• check.t: fix a testcase (sed could exit false, but we don’t care)
• eval.c: fix tilde_ok data type (only unsigned may shl constantly)
• exec.c: fix shebang buf array accesses to always go via uint8_t *
2014-11-25 21:13:31 +00:00
tg
d25612b4b0 stop using ptrdiff_t 2014-11-25 20:00:39 +00:00
tg
89e774fd7e • fix ${12345678901234567890} segfault (OOB access / integer overflow)
‣ not like oksh did, but using mksh’s built-in features
• handle suggested __pure additions
• revert cid 1004F7F096867C83CF0
  ‣ always use our wcwidth code
  ‣ only use our strlcpy code if none found
• fix a couple of gcc-snapshot and clang/scan-build warnings
• mksh R49~rc1
2014-01-05 21:57:29 +00:00