Commit Graph

1506 Commits

Author SHA1 Message Date
tg cf6109d912 detect ACK, handle Minix better 2009-04-03 09:42:37 +00:00
tg e64197ba90 experimental: prevent FMONITOR from being set on, say, Minix 3, Plan 9 2009-04-03 09:42:25 +00:00
tg 56c6e384e6 (experimental) implement getrusage via times if not found 2009-04-03 09:39:07 +00:00
tg d6f6834d0d add some CPPFLAGS only if setmode.c 2009-03-29 17:50:45 +00:00
tg 40debc6f55 another cast to void to silence gcc1 on BSD/OS
XXX rlim_t = quad_t there is not detected
2009-03-26 11:22:53 +00:00
tg db6ed8be7c ... and it did in fact require DEC ucode cc to spot this!
gcc, SUNWcc, pcc, llvm-gcc, clang, etc. all didn't say a thing!

now compiles warning-free (testsuite pass) on ULTRIX 4.5 (1986),
and OSF/1 X2.0-8 (testsuite norun: perl missing) has only the usual
bitchings about "volatile sig_atomic_t" because the latter part is
already volatile, but otherwise warning-free compile, works fine
2009-03-25 21:45:28 +00:00
tg edf126c810 just assume realloc(NULL, n) is ANSI C89 (for n>0) but provide a
define to do otherwise; shrinks the code and optimises for speed
2009-03-24 18:34:39 +00:00
tg 9f37ccb368 fix up a bogus gcc4 uninitialised storage warning
(we’d initialise this to NULL anyway if we used realloc-can-take-NULL)
2009-03-24 14:07:41 +00:00
tg c7b2af502e further simplify
XXX check whose platforms’ realloc(3) don’t take NULL
2009-03-24 08:53:45 +00:00
tg ebfce0fafd we do not need the group backpointer, except for a (very little) amount
of sanitising; since this is supposed to be the lightweight allocator,
with the guarding allocator coming back in later, remove it

reduces memory consumption below what espie's allocator used ☺
2009-03-24 08:37:37 +00:00
tg 44202462f5 even more clear; ok «gps23» 2009-03-23 12:21:02 +00:00
tg a6d9fe51dc give example 2009-03-23 12:16:58 +00:00
tg c37c7aea61 document somewhat surprising behaviour
12:58⎜<gps23:#ksh> someone please tell me why:   code=1; if [ "code" -eq 1 ] returns true
13:10⎜<mira|AO:#ksh> hm but I see the problem
13:10⎜<mira|AO:#ksh> code=1; x=code; [ "$x" -eq 1 ]
13:10⎜<mira|AO:#ksh> this is indeed unexpected
13:10⎜«pgas:#ksh» gps23: code=1+1;[ "code" -eq 2 ] && echo true #also works
as of now, we consider
13:13⎜«pgas:#ksh» gps23: when you use -eq there is something like an implicit $(( )) around the
     ⎜    arguments
13:14⎜«pgas:#ksh» [ code -eq 1 ] is the same as [ $((code)) -eq 1 ]
to be documented.
2009-03-23 12:15:33 +00:00
tg a8e3154b7a sometimes I have tomatoes on my eyes (or is it the CRT monitor?)
make SIZE_MAX portable, 10x to Jonathan “ciruZ” Schleifer for the hint
2009-03-23 10:31:15 +00:00
tg 004b3b1e08 unbreak with dietlibc, whose <stdint.h> has no SIZE_MAX, defying SUSv3 2009-03-23 09:08:35 +00:00
tg 0d254e4088 make buildable again after memory allocator change
(why didn’t anybody report this?)
2009-03-23 08:54:12 +00:00
tg 99a8c2a814 bump to R37; the ;& and ;;& are postponed indefinitively for now,
as I don't get to it and it's nontrivial
2009-03-22 18:50:43 +00:00
tg 62b28858d4 sync; fold oksh-seterror test into errexit-*; use print not printf 2009-03-22 18:28:35 +00:00
tg abba28e8b1 the missing part 2009-03-22 18:20:36 +00:00
tg bf7c84eef6 merge manpage and sync RCS IDs
not merged: POSuX character class nonsense
2009-03-22 18:09:17 +00:00
tg 75e01cb305 Revision 1.18: [7]download - view: [8]text, [9]markup, [10]annotated -
[11]select for diffs
   Sun Mar 1 20:11:06 2009 UTC (2 weeks, 6 days ago) by otto
   Branches: [12]MAIN
   CVS tags: [13]HEAD
   Diff to: previous 1.17: [14]preferred, [15]coloured
   Changes since revision 1.17: +17 -9 lines
Fix PR #[16]723: [17]test(1) operator precedence inconsistent with POSIX
Make sure ksh builtin test and [18]test(1) do not differ.
From Christiano Farina Haesbaert. ok miod@
2009-03-22 17:58:58 +00:00
tg b518621d7d Revision 1.33: [7]download - view: [8]text, [9]markup, [10]annotated -
[11]select for diffs
   Sat Feb 7 14:03:24 2009 UTC (6 weeks, 1 day ago) by kili
   Branches: [12]MAIN
   CVS tags: [13]OPENBSD_4_5_BASE, [14]OPENBSD_4_5, [15]HEAD
   Diff to: previous 1.32: [16]preferred, [17]coloured
   Changes since revision 1.32: +2 -2 lines

Ensure that *wp isn't NULL.

ok otto@
2009-03-22 17:53:50 +00:00
tg f4b24be7e1 revision 1.32
date: 2009/02/07 07:24:37;  author: guenther;  state: Exp;  lines: +24 -17
Make built-in echo behave according to POSIX when set -o posix is in effect:
the only option is -n, and only one of those is parsed.

diff from Ingo Schwarze
ok otto@ kili@; manpage changes ok jmc@
2009-03-22 17:52:48 +00:00
tg b20f49adae patch from oksh (except manpage, I'll merge that later):
pass "xerrok" status across the execution call stack to more closely
match what both POSIX and [18]ksh.1 already describe in regards to set
-e/errexit's behavior in determining when to exit from nonzero return
values.

specifically, the truth values tested as operands to &&' and ||', as
well as the resulting compound expression itself, along with the truth
value resulting from a negated command (i.e. a pipeline prefixed !'),
should not make the shell exit when -e is in effect.

issue reported by matthieu.
testing matthieu, naddy.
ok miod (earlier version), otto.
man page ok jmc.
2009-03-22 17:47:38 +00:00
tg 0fe20ab25f sync with oksh (nop) 2009-03-22 17:31:17 +00:00
tg 2427e028c0 spelling fixes, from oksh 2009-03-22 16:59:18 +00:00
tg ca539f08f0 remove espie's double-linked-list based allocator and write a
similarily simple one from scratch, which however performs
better than espie's with AFREE_DEBUG enabled which took away
the benefit of the double-linked-list approach

all of (core) mksh is now MirOS licenced
2009-03-22 16:55:38 +00:00
tg 7c77d9369c extend and fix the errexit tests:
* Debian pdksh fails #3 (trap) and #6 (BSD make)
* AT&T ksh93 passes all
* zsh does not pass them literally, but the actual functionality
  checked is right there
* dash fails #3 (trap) and does not pass #6 due to missing [[
* GNU bash 2 (MirPorts) and 3 (Debian) fails #6 (BSD make)
* oksh-current passes all
2009-03-22 15:47:23 +00:00
tg 820df9fcfb on GNU/Cygwin32 at least, “env” does not display its output sorted;
make sort(1) presence a conditional though
2009-03-21 11:09:35 +00:00
tg d8c3d6e9c1 another off-by-one, reported by «macaronyde:#!/bin/mksh» 2009-03-17 13:56:47 +00:00
tg d99541d7c8 revert previous commit for now. testscript which breaks:
H4sIAAAAAAACA31TTUvDQBC951c804DtIQ0iiFhSPHiwiCDqzUpIuhO6JN2ETSS16n93Np+GFiGE
zM6bN2/fTPQOro5xENYuEVLzBz9eaF6RlWupSpyHaXqzVuvyljbbDCRV0UR7WeLiHEtT4D2GCcUy
pdNFh4pkg4wGZCV8Z6opTPOw3GI+swoq4ZIVZxqkSv0JqRAiWkBkmAJNegHIGG9vcAWcSnjM6dTo
uby8vsL7+wLllhQQKKr4SoFv/8nbXE5pQcdpk4nlwH6AE7zer17uVs/BmHVftnUdxYh0yHbV3ghY
9wh2rQlBkdMm8PmIe57Bjfs7dTW9X/OoEG6lwzwnzYKA7+8jHpsJTuFN4+IjKhKZM6dpZ0xuQ2Nz
7bGB1F74zlebmzTm/PS+OB0GZz4HLcPgz+BeDxyS9S7YU6e3qZaQk5gZgRHvQtI59Eet7QwBWFnL
O/F+ej9Fpmg0ug7OHrnqHy2+7y8x6DGEG3E0Az41RuPlYfXEEx0psrl8PAUebzf6ZklabgD8V3SS
Z7Vo6xfOuQS6gQMAAA==

「mksh -o posix z」 failed in that it continues; 「mksh z」 correctly aborts
let’s see what the obsd people have to say herefore
2009-03-16 15:50:13 +00:00
tg e39c1f860d bring back the backed-out Debian patch if FPOSIX; test programmes fixed:
H4sIAAAAAAACAz1PywrDIBA8m68YgoT20EN7TMixX1F6yGNFIWhRSw2h/95VmuDB2XmsY2oDRVyo
Si1N2uHlMzQK0b8JHaImy4RQwxIITYPiUs4xqcyeGgdfrfumtWX5dMbGSHy0WQgP1PJa49lhdpkV
ynncYSxkOjjxd/V83dmcX9sQtFGRi0zORmO5042HbwnMzlIBqa9lAmfLVBIZ7XqpKBPDnDu+WXpi
wMhnOgQXYvUD+oKHAhUBAAA=

XXX OpenBSD has something different which may DTST or even DTRT (not break
XXX our make(1) wrt <bsd.subdir.mk>), check that
2009-03-16 15:14:23 +00:00
tg 8a77cd5d6e attempt to get the C1 control character problem temporarily solved:
just output them. sometimes you'll see U+FFFD even. real fix later.
2009-03-15 18:48:43 +00:00
tg 22f1fb6cd6 fix off-by-one calculation mistake making PS1 ending in newline double it 2009-03-15 18:30:40 +00:00
tg 7c040d98f9 sprinkle a few static and clean up the internal APIs 2009-03-15 16:13:40 +00:00
tg 32bc1dc40e sprinkle mksh_ari_t to limit arithmetics to 32 bit even
on Debian Lenny/amd64 (XXX need more verification; this
can be used for 64 bit arithmetics later too)

PPID, PGRP, RANDOM, USER_ID are now unsigned by default
2009-03-14 18:12:55 +00:00
tg 1552bf1576 CHILD_MAX isn’t defined in klibc either, copy dietlibc’s definition
thanks fefe (btw, funny tempnam link time warning… never used colours…)

pending Debian #516294, #516773, #516774, mksh might work with klcc now
2009-02-23 16:17:44 +00:00
tg bbaa186ec6 optimise utf_widthadj 2009-02-22 19:02:27 +00:00
tg 3d3a7e545a preliminary fix for the ${foo/@(%)/x} not working in UTFMODE problem:
the width for control characters (wcwidth(wc) == -1) was hard-coded
to 2 (!) in utf_widthadj, which is true for *only* one of the two x_zotc*
functions in Emacs editing mode, and none of the other functions which
use this piece of code

change to 1, to be more correct in the general case; use of the UTF C1
control characters U+0080‥U+009F is slightly broken anyway, and this
only shifts the brokenness to different places of code

XXX maybe we want to map U+0080‥U+009F into Unicode as if they were
XXX 0x80‥0x9F in ANSI cp1252 instead, at least for displaying?

the editing code is cruel…
2009-02-22 18:57:19 +00:00
tg a97a514aba gmatchx debug (if 0'd) 2009-02-22 18:53:03 +00:00
tg 1b3e4a3a2e when outputting in a row x column formatted way, but the available space
on the screen is not enough for two columns, just output the text line by
line, instead of trying to format it; gets rid of superfluous empty lines
if we did not even have space for one column on the screen (x_cols)

noticed by Gábor Gergely in irc, thanks!
2009-02-22 18:02:31 +00:00
tg 5e22cb486f <sys/file.h> is only required for, and only contains, flock(2) 2009-02-20 13:25:10 +00:00
tg 14bafefa13 bump year 2009-02-20 13:21:06 +00:00
tg 9f79293319 some systems’ (such as klibc) <termios.h> does not define _POSIX_VDISABLE 2009-02-20 13:19:04 +00:00
tg 6aa594849a with Build.sh -combine, only do it if it is usable (gcc only too)
XXX do other compilers support such thing?

sync clog
2008-12-31 16:09:51 +00:00
tg 177b1b4cf9 always set COLUMNS and LINES; make use of the fact in dot.mkshrc 2008-12-29 21:34:22 +00:00
tg de9fe12a4c use a more common/generic routine for TIOCGWINSZ;
ensure x_cols and x_lins always have a sane value
after them (even if not tty_fd)
2008-12-29 21:05:15 +00:00
tg 5e3fcc7ab9 new global x_lins (like x_cols), MIN_LINS (like MIN_COLS) 2008-12-29 20:53:48 +00:00
tg d6d2f03e5f do not lie 2008-12-29 20:52:10 +00:00
tg 2fb7225499 give tty_init() another argument for silent initialisation 2008-12-29 20:47:16 +00:00