Commit Graph

315 Commits

Author SHA1 Message Date
tg 0ba04f9bb7 apply fixes from code review by @komh 2017-10-12 15:17:04 +00:00
tg 34fc7afc8c note on rooted pathnames, concept found in original pdksh which had
various forms of path attributes (not just absolute or not), though
we shouldn’t just copy theirs either
2017-10-11 23:48:36 +00:00
tg 5db583cd81 handle drive-qualified nōn-absolute pathnames in do_realpath(), untested
the idea here is that:

- /foo/bar and a:/foo/bar are absolute
- foo/bar is relative
- a:foo/bar needs to be handled specially,
  mostly per making it into an absolute (“a:/” + getcwd(a:) + “foo/bar”)
2017-10-11 23:23:03 +00:00
tg 2cdd9d77de further OS/2 fixes for simplify_path() 2017-10-11 21:49:06 +00:00
tg 9dc689dd17 keep drive letter when simplifying path (untested) 2017-10-11 20:46:14 +00:00
tg f20af3a14f turns out the slash was already added (later), 10x komh 2017-10-11 19:06:44 +00:00
tg 694aab50ce fix part of realpath for drive-qualified DOS paths:
if a path or symlink target is drive-qualified, keep the drive letter
(this part from komh) and, if present, a leading (back)slash (from me)

missing: if a drive qualification is *not* followed by a (back)slash,
we must retrieve the per-drive cwd for the target drive and insert it
just like we insert the cwd for (normal/Unix) relative paths; maybe
consider redoing absolute/relative path logic, DOS paths are tristate

komh’s commit: fix realpath failure on OS/2

On OS/2, an absolute path is 'x:/path/to/file'. Because it has not
a leading slash, '/' is prepended, that is, '/x:/path/to/file'. As a
result, it fails to find a requested file.
2017-10-10 21:30:43 +00:00
tg de7e092ad7 release 2017-08-07 21:39:26 +00:00
tg 1854fb9b3d turn off UTF-8 mode upon entering POSIX mode, for J�rg 2017-08-07 20:49:42 +00:00
tg 868d982efb sprinkle tons more ord() around
this is really not funny… mksh-ng will use even more “unsigned only”
2017-05-05 22:53:32 +00:00
tg 6dc1ab0379 some more small EBCDIC fixes 2017-05-05 19:43:52 +00:00
tg c03372e8a4 first cut at the new matching code, IT WORKS!!! in the FIRST try!
missing:
- tons of new testcases
- EBCDIC support with ASCII ordering for POSIX ranges
2017-05-03 17:48:08 +00:00
tg 241b072099 commit my WIP for the Beltane Snapshot of the Mainframe Korn Shell, not going to make finishing it tonight ☹ 2017-05-01 19:44:29 +00:00
tg 7c433ba94b add BSDish [[:<:]] and [[:>:]] matching (angle brackets must be escaped) 2017-05-01 15:59:45 +00:00
tg e6395046df use strnul(); optimise 2017-04-29 22:04:31 +00:00
tg f2de19c41f reimplement has_globbing() with proper bracket expression parsing,
and take ahead parsing collating symbols, equivalence classes and
character classes already (heck my first draft of this already did
better than GNU bash, ksh93 I still don’t grok its code at all)
2017-04-29 21:49:07 +00:00
tg 12988793b1 optimise <0x20/>0x7E into !C_PRINT 2017-04-28 21:43:30 +00:00
tg 5743c00a5b add -DMKSH_FAUX_EBCDIC to test the codepaths better
waking up to: Lanfear - Just Another Broken Shell
2017-04-28 11:13:49 +00:00
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