Commit Graph

602 Commits

Author SHA1 Message Date
tg c1f821d4e5 (mksh) tighten 32-bit requirements; (lksh) switch to long; allow any bitness 2012-06-28 20:17:39 +00:00
tg ea01d80833 hackish work-around the lexer to make alias definitions in mksh -c
work (Closes: #517009) and mention in the manpage why they sometimes
do not work (doing so for COMSUBs is not worth the effort)
2012-06-28 20:05:11 +00:00
tg dc5ae267ce make tempvar() and vtemp global 2012-06-28 20:02:29 +00:00
tg 45fba44292 sync w/ oksh (RCSID only # no change needed) 2012-06-28 20:01:01 +00:00
tg 1fa4453946 mh… all I’m gonna hack on upstream today… fix -t for manpage generation and cleanup code snippets; bump vsn; sync clog 2012-06-26 19:33:33 +00:00
tg c212458922 bump for mksh with lksh-except-long, so we get the ball moving 2012-06-26 18:11:05 +00:00
tg 967e929e98 add basic LEGACY KSH mode (Build.sh -L), no changes yet 2012-06-25 16:05:10 +00:00
tg 6f1078606e bump after dealing with all things Benny had Coverity find
remainging CIDs not listed are either

• false positive (bug in coverity)
• intentional (possibly with lint override coverity doesn't parse)
• VLA (XXX find out how to mix C99 and ANSI VLAs)
• things flagged as possible resource leaks I have no idea about
  (no biggie though, and only in error cases I think)
2012-06-24 20:39:26 +00:00
tg 3125146b43 Fix typeset issues (LP: #993847)
This was actually more evil:
• use a recursive function to display blocks in reverse order,
  so that local variable values overwrite global ones
• add array support to typeset -p (from typeset -p -)
• display 'set -A varname' line before setting values, for -p
• if -p got arguments, only display those (from the innermost scope)

Also, the usual amount of code cleanup…
2012-05-09 23:21:00 +00:00
tg ea8f29f428 sprinkle CONSERVATIVE_FDS for many older OSes; DISABLE_TTY_WARNING for BeOS and Coherent (probably more to come); NO_CMDLINE_EDITING to Plan 9; put Hurd NO_PATH_MAX into MKSH__ private namespace 2012-05-05 17:37:44 +00:00
tg f34cae3997 keep up 2012-05-04 22:44:34 +00:00
tg e6ace01f12 last parts of Coherent patchkit: O_ACCMODE and termio 2012-05-04 22:18:27 +00:00
tg fef3808126 more symlink(7) nonexistence support code 2012-05-04 22:05:02 +00:00
tg 7beac6668d provide for Coherent not having gettimeofday(2), imake style (bad, but this is not for others to use without a second thought anyway) 2012-05-04 21:47:04 +00:00
tg 2d31aca859 more int→bool while trying to let ^D output CR+LF (which shan’t be, oh my…) 2012-05-04 21:15:34 +00:00
tg 5780bc5eb7 new MKSH_NO_CMDLINE_EDITING to disable command line editing in its entirety
mainly for the Plan 9 port though it may also help the WinAPI variant,
other porting efforts, as well as a new project I cannot say yet
2012-05-04 20:49:08 +00:00
tg 7c4bf78446 move bi_getn from misc.c to funcs.c and make it static
even antique gcc versions will usually inline it now
2012-05-04 20:08:25 +00:00
tg b67de6ba17 add experimental code to use sigprocmask+pause+sigprocmask ipv sigsuspend (and harden j_sigchld handler for that) to improve working on BeOS 5.0 and Coherent UNIX, found by RT 2012-04-27 16:16:23 +00:00
tg 5204e7cc4f after discussion with ciruZ, switch mksh from NZAT to NZAAT fully
to get rid of the bias introduced by making the hash never zero

… he also pointed out a memory (heap) usage optimisation… which
may impact code size a bit though as I’d need to pass an additional
argument on hashtable function calls… or, forgo the benefit of not
having to pointer-align the key in the structure, which can be as
much as 3/7 octets per item, heap storage… OTOH the saved space is
4/8 octets per not-allocated item, possibly some code (use of an
multiply-add opcode), but the function call overhead/cost would
possibly be quite a bit… I guess I’ll have to measure…
2012-04-22 21:50:35 +00:00
tg 5eea59ad57 rewrite maketemp() obsoleting tempnam(3) and mkstemp(3) external deps 2012-04-14 16:07:48 +00:00
tg 70e6988d25 factor out rndget() code, for adding users
XXX in the future, the entire scheme must be rethinked when we need more
XXX entropy for the hash tables; possibly a cheap add using NZAT and re-
XXX initialise the LCG only on access and when added (so keep NZAT state
XXX separate from LCG state); also, then we will need a more elaborate
XXX scheme, such as adding from environment, editor keypresses and timing
2012-04-14 14:35:13 +00:00
tg b49abfac18 genericise MKSH_NO_SIGSETJMP 2012-04-14 14:07:47 +00:00
tg 29e4269f33 if the OS does not provide sig_atomic_t and/or ssize_t, you can now define
MKSH_TYPEDEF_SIG_ATOMIC_T and MKSH_TYPEDEF_SSIZE_T via CPPFLAGS to the
*correct* definitions (it’s absolutely critical they be correct!)
2012-04-14 14:02:40 +00:00
tg 5b4d0dbbc5 drop all deprecated code, you have been warned 2012-04-07 11:19:53 +00:00
tg 5d4492608a more speling 2012-04-06 15:23:11 +00:00
tg 3d3081115b if LDSTATIC is not empty (i.e. "-static" or " "), always add “our” sources:
• strlcpy
• utf_wcwidth
note strchr/strstr from misc.c are still #ifdef DEBUG only, as they are
not eligible: they’re for const-cleanliness debugging purposes

XXX get rid of multiple occurrences of binary search code, too…
2012-04-06 15:20:42 +00:00
tg 981ad02dbe drop str{,n}casecmp, too 2012-04-06 13:29:01 +00:00
tg 4a89ae1cd0 drop the need for strcasestr: just uppercase a copy and compare with uppercased 2012-04-06 12:59:28 +00:00
tg 6faa68ff8b LynxOS defines PRINT somewhere, undef it 2012-04-06 11:51:43 +00:00
tg e67b98e21b use _setjmp/_longjmp on NeXTstep: its Intel port always restores the signal mask on siglongjmp, which we never have 2012-03-31 17:30:00 +00:00
tg cf75e7b6ce couple of minor/cosmetic fixes from RT’s compile farm:
• 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
2012-03-29 19:23:01 +00:00
tg 45fa321c23 fail in a clean way even on b0rken compilers 2012-03-28 23:09:24 +00:00
tg c4a4b8b275 I don’t know what those compiler authors were smoking… 2012-03-28 11:05:16 +00:00
tg 6dd03ddfad pass the version to avoid stale Makefile.inc files 2012-03-27 23:13:42 +00:00
tg 16ac73b074 g/c magic definitions for simple chars (as opposed to e.g. tokens/lexems)
some (such as NOT) were already gone; this should unconfuse; most were
unused anyway…
2012-03-27 22:58:39 +00:00
tg 2a47cab08f add a note that mksh_{,u}ari_t are, sadly, not currently configurable 2012-03-27 22:49:47 +00:00
tg 340cd95cf0 #undef flock (LP: #912691) 2012-03-27 22:41:17 +00:00
tg 95a2c63096 • implement fcntl(2)-based advisory locking as an alternative iff flock(2)
is not found, from a suggestion by RT (LP: #912691)
• try harder (in a loop) to acquire a file lock if the locking mechanism
  documents EINTR is a possibility (fcntl always, flock on Linux not .Ox)
• use -std=c99 not -std=gnu99 if it must be at all
2012-03-27 22:36:53 +00:00
tg e3b9f14d88 You have this ↓ guy a lot to thank for.
00:45 -!- variable [root@freebsd/developer/variable] has joined #!/bin/mksh

• +b *!*root@*, +b $a:root, +b $r:root on one more channel
• certain checks to prevent:
00:47 < variable> wjcw: sh.h:308: error: conflicting types for 'getrusage'
01:19 < variable> oh
01:19 < variable> I needed to run Build.sh
2012-03-27 21:23:52 +00:00
tg 4f8b7de3a9 Susv3mon says: rlim_t are unsigned 2012-03-26 21:10:44 +00:00
tg 87654270ab fix regression w.r.t. TTY and external programmes:
• release the TTY after the initial change_winsz()
• since we release it, we can skip initialising tty_state, too
2012-03-25 14:28:14 +00:00
tg 1f96d87aea • MFC almost everything not breaking backwards compatibility or introducing
deep changes into R40-stable branch
• Version accordingly: HEAD gets 2012/03/24 (hi Eddy/Chris) so we backdate
  $KSH_VERSION for R40-stable to 2012/03/20 (hi David) as that comes before
  even though it includes today’s latest fixes
• Also, sync clog (including MFC indicators)
2012-03-24 21:22:25 +00:00
tg 21c15c0b8f huh, I thought I had extended ${parameter@#hash} already; make it so now,
but not yet things like ${parameter@Fi} (1 if integer, 0 otherwise), etc.
also bump patchlevel and © years in recently changed files
2012-03-23 23:25:30 +00:00
tg 24e8a6996b always keep x_cols and x_lins valid; check once at start including tty init
if we find any, but not later; do not check on every read

⇒ allows changing COLUMNS and LINES (independent of each other, or both)
  for script shells by passing them in an environment setting, even if
  we get a tty; interactive shells still check before each line is read…

reported by the PLD guys, thanks
2012-03-23 21:58:24 +00:00
tg 3795e667c5 drop use of the NOT macro, [^foo] ≠ [!foo] anyway, and we’re not gonna change that 2012-03-23 20:07:13 +00:00
tg c5cc22a13f efficient debug-to-file output (/tmp racy, but hey) 2012-03-23 19:38:12 +00:00
tg e141394a83 RCSID sync from oksh; reduce hash table #elements if !MKSH_SMALL to speed up 2012-03-03 21:30:59 +00:00
tg 929bc9ee9e make jobs reporting deal with UTF-8 (in utf8-mode)
reported by Andrew Kudryashov, 10x
2012-02-06 17:42:24 +00:00
tg bee3bbaaf8 reduce stack usage a bit (several candidates for more, including $CC itself…) 2012-01-29 01:41:15 +00:00
tg ac29bad3fe fix regression escaping single-char strings 2012-01-04 19:09:36 +00:00