Commit Graph

326 Commits

Author SHA1 Message Date
tg d43f4efe60 employ some "nice" constants and comment lalloc.c 2009-04-07 18:56:51 +00:00
tg 4de58fe6fa globalise SIZE_MAX definition 2009-04-07 18:46:07 +00:00
tg 9e83002841 try to do some optimum struct packing except for struct env
(pointers, longs, size_t first; time_t next; int etc. then enum, bool)
2009-04-07 18:41:37 +00:00
tg e88736b5ef decouple conservative file descriptor use from MKSH_SMALL, with the
new MKSH_CONSERVATIVE_FDS præprocessor flag, because Minix 3, for
example, needs it (otherwise “mksh Build.sh” fails)
2009-04-06 08:33:37 +00:00
tg 398be9867a fix jobless mksh so much to make it work on Minix 3 2009-04-05 12:35:32 +00:00
tg 56c6e384e6 (experimental) implement getrusage via times if not found 2009-04-03 09:39:07 +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 c7b2af502e further simplify
XXX check whose platforms’ realloc(3) don’t take NULL
2009-03-24 08:53:45 +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 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 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 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 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 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 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 2fb7225499 give tty_init() another argument for silent initialisation 2008-12-29 20:47:16 +00:00
tg 858d8e8b5a implement unsigned arithmetics as an mksh extension 2008-12-17 19:39:23 +00:00
tg c62d5791ae fix signedness issue wrecking havoc on 64 bit architectures, oops 2008-12-13 18:32:27 +00:00
tg 31d1499219 * back out almost all of the memory allocator related changes, as aalloc
was hard to type and hard to fix, galloc is also hard to fix, and some
  things I learned will probably improve things more but make me use the
  original form as base (especially for space savings)
* let sizeofN die though, remove even more casts
* optimise, polish
* regen Makefiles
* sprinkle a few /* CONSTCOND */ while here
2008-12-13 17:02:18 +00:00
tg 042086e49e rename utf8-hack to utf8-mode (use set -U or set +U instead, anyway)
and announce less hackish things
2008-12-04 18:11:08 +00:00
tg a19bf7253a * sh.h: note that file descriptors SHALL be <100
* syn.c: fix bashiop-4 regression test; failed due to me using a
  simple string when a wdstring was expected, sorry; the new code
  assumes file descriptors take up a maximum of two characters
2008-12-02 13:20:40 +00:00
tg 4897682502 Alias expansion has a recursion check which tries to break the cycle if
encountered. However, when reading end of input, the source type is set
to SEOF while popping, whereas the recursion check code only checks for
an SALIAS type.

Fix: add a new SF_HASALIAS flag; change u.tblp from being valid if type
is SALIAS to being valid if SF_HASALIAS is set; set SF_HASALIAS for the
created SALIAS sources; set SF_HASALIAS and u.tblp when creating SALIAS
whose next is SEOF on the SEOF source as well.

Reported by Michael Hlavinka as Redhat Bug #474115
2008-12-02 12:39:38 +00:00
tg c0703f5f26 if MKSH_SMALL and HAVE_ARC4RANDOM, there is no need to use rand()/srand(3)
ever, since MKSH_SMALL is not required to be as close to compatibility as
normal/generic shells; we can also get rid of time(3) calls
2008-11-30 10:33:40 +00:00
tg 6be05862db meet AALLOC_STATS 2008-11-15 08:52:01 +00:00
tg 6b9cdbbfd6 globalise internal_verrorf() 2008-11-15 08:42:36 +00:00
tg cd716426e4 introduce AALLOC_STATS, which somewhat breaks the encapsulation for need
of a friendly name
2008-11-15 08:03:24 +00:00
tg 32e1ecf5b3 enable passing of a hint how many pointers we’ll need to anew()
if 0, the default is used
2008-11-15 07:35:25 +00:00
tg 3c1e46ee4d prepare for aalloc.c, which I have just written myself, as an area-based
allocator using malloc and free, with mmap malloc and omalloc in mind,
not counterfeiting its security measures such as guard pages, and having
some of our own, e.g. XOR random cookies, optional mprotect, etc.

zero cost (for we have arc4random())
2008-11-12 04:55:19 +00:00
tg 8d5d720f08 get rid of tempting sizeofN macro 2008-11-12 00:55:32 +00:00
tg 4d3fc2413e switch to a (nmemb,size) API from a (nmemb*size) API
cost: text += (308, 256, 4, -100)
2008-11-12 00:54:52 +00:00
tg 246b762af7 isolate all knowledge of the area-based allocator from the rest of the code
cost: bss -= (0, 0, 16, 16); text += (520, 504, 516, 480)
[ gcc,pcc X full,small ]
2008-11-12 00:27:57 +00:00
tg c80c28633b change use of “Area *” to “PArea” and “struct Area” to “TArea”
no change in size (mgcc and pcc, small and full)
2008-11-11 23:50:31 +00:00
tg 2a0e181a70 work around even more format string warning stuff 2008-11-10 19:33:08 +00:00
tg 65b1923b61 build warning-free with LLVM+Clang on MirBSD itself
$ (CCC_LD=mgcc CC=ccc sh Build.sh -r && ./test.sh -v) 2>&1 | tee log
Total failed: 2 (as expected)
Total passed: 278

Just the result is huge, and we could of course build to intermediate
byte code to optimise globally…
2008-11-09 20:32:18 +00:00
tg 89e96b6c86 experimental support for <strings.h>
cf. http://www.opengroup.org/onlinepubs/009695399/basedefs/strings.h.html
QNX seems to bury some functions in there
2008-11-02 22:29:36 +00:00
tg bf3194e937 save 1640 .text bytes in MKSH_SMALL case by not inlining strdupx, strndupx 2008-10-28 14:51:06 +00:00
tg 88d7b7d08b • rewrite code to no longer use statements-as-expressions
• optimise a little
• Build.sh: remove HAVE_EXPSTMT test
• Build.sh, */Makefile: sort tests, regenerate
• mksh.hts: sync clog
2008-10-28 14:32:43 +00:00
ahoka 776cc76ccb Add check for the nice(3) system call.
It may be not implemented on some plaforms, though it's usually present.

Required to compile on Haiku as of 2008 October.
2008-10-26 21:51:27 +00:00
tg 8230c9d8ae • do not use __typeof__ even if we have statements-as-expressions, to
please pcc, prompted for by Anders “ragge” Magnusson, problem spotted
  originally by Adam “replaced” Hoka
  ⇒ rewrote x_bs2() and utf_backch() into a combined x_bs3() function,
    since these are never used in any other way
• whitespace cleanup, while here
2008-10-26 20:59:40 +00:00
tg bc046dd8f2 this will most certainly be mksh R36 2008-10-24 21:35:43 +00:00
tg 331b45af7d • OSF/1 may not have MAP_FAILED defined either
XXX mmap() works only on devices on some DEC OSes, not on files, so,
  XXX instead, it were best to disable it altogether
• bump date
2008-10-24 19:54:23 +00:00
tg 0c2de1902c • change mksh to only then behave more POSuXish when called as /bin/sh or
“-sh” if -DMKSH_BINSHREDUCED was passed during compilation, for example
  for Debian, but d̲e̲f̲i̲n̲i̲t̲i̲v̲e̲l̲y̲ n̲̲o̲̲t̲̲ for MirBSD™
• split up regression test to force this behaviour
• remove the gunk from our MirBSD™ startup scripts again
• mention arc4random.c changes on website, sync clog, warn packagers
2008-10-20 19:29:25 +00:00