• 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 ☹
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
bug initially found by Pawel Wylecial (LP#1440685)
additional bug found and suggested fix by enh (elliott hughes)
This commit also renames struct ioword.flag to ioflag to disambiguate
it from other members named “flag”, changes it to an unsigned type,
and packs ioflag and unit into shorts each, to make the struct smaller
(aligned even: 16 bytes on 32-bit systems) and reviews some of the
code involved in fd handling, though there wasn’t much to be found.
prompt display routines; make Emacs and Vi share
code, permitting reducing of duplication and code
removal as well as more consistent behaviour; put
some common code into shared helper functions, too
• New x_adjust() logic (Emacs mode): when determining
what portion of a line to render use a much more
sophisticated algorithm and try to fill up ⅔ of the
total screen width (with line and prompt both) also
as wished from Steffen Daode Nurpmeso
take the states that may open a string, only permit them by virtue of
moving the code out of Subst: to handle $+" and $+' at all; then add
S[Q]BRACE to that
side benefits:
• clearer, cleaner code flow
• smaller code
• better “business logic” ☺
• defuses one heavy use of duff’s device a bit
• promote SCO OpenServer and UnixWare to !oswarn
• omit trying -O2/-O on OpenServer 5 and USL C
• cast mksh_ari_t to int, mksh_uari_t to unsigned int for printf
• skip ulimit-1 on syllable (which is still too broken)
• write ((mksh_ari_t)-2147483648) ipv UB ((mksh_ari_t)1 << 31)
and add a comment that that is actually meant
• rewrite functions returning !void ending in NOTREACHED
so they’ve got a jump target returning an error at the
end, to aid older compilers and just to be safe
• cast struct stat.st_size to off_t or size_t explicitly when needed
• shorten struct env by two bytes and an alignment, at least
also, optimise control flow and fix more paren matching cases