Commit Graph

1523 Commits

Author SHA1 Message Date
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 , , , 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
tg
dc79b9b118 new option -combine (complementary to -llvm):
compile all source files at once using -fwhole-program --combine,
similarily to how it used to be done in older mksh versions, except
that the flags are now hardcoded; tested with llvm-gcc4.2 from MirPorts
2008-12-20 20:39:05 +00:00
tg
d363c6a729 revision 1.13 told lies and was an incomplete commit
d’oh, nobody noticed, as nobody uses icc anyway… but
MirPorts llvm-gcc currently is similarily broken ;-)
2008-12-20 20:21:19 +00:00
tg
858d8e8b5a implement unsigned arithmetics as an mksh extension 2008-12-17 19:39:23 +00:00
tg
06626b0de2 ensure sizes of long and unsigned long are the same #ifdef DEBUG 2008-12-17 19:37:08 +00:00
tg
ee0f60411c 64 bit mksh do not limit to 32 bit integer variables in *all* places ☹
XXX this has to be sorted out; we want to bump the internal integer
XXX types to 64 bits some day anyway
2008-12-17 19:32:47 +00:00
tg
4d56eb849c if we set the S̲pacing m̲ode to off, we must set it back to on too 2008-12-17 19:25:54 +00:00
tg
c62d5791ae fix signedness issue wrecking havoc on 64 bit architectures, oops 2008-12-13 18:32:27 +00:00
tg
553ff601b7 optimise: embed ^A and ^M inside the default PS1 string 2008-12-13 17:09:45 +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
732e10c982 comment on slow machines and OEs like GNU/Cygwin32 2008-12-08 13:57:35 +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
ef5a465acd fix botched testcase from 10049352E9F5DBF7056 - check.pl offers
a time-limit functionality after all...
2008-12-02 13:19:28 +00:00
tg
330948eafd add a test case for the recursion limit fix 2008-12-02 12:48:16 +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 
2008-12-02 12:39:38 +00:00
tg
177f707a9f ah, so this is how it fails, in a function! 2008-11-30 16:57:40 +00:00
tg
667c0ba026 add another regression test (XXX why did a similar thing fail?) 2008-11-30 16:53:15 +00:00
tg
65b1e6c09c forgot to bump version here too
savings: 523 .text, 16 .data, 32 .bss (small), ceteris paribus (full)
2008-11-30 10:45:42 +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
abb6bea6d8 b0rken for now… 2008-11-19 21:05:48 +00:00
tg
d97691ca61 by the principle of the working tree, we cannot enable aalloc as of now.
damn, pointers in C are so uselessly complicated… in asm it’s much easier
2008-11-17 01:14:57 +00:00
tg
90e8e7ea72 rewrite the cookie logic… while this is better than previously,
we still have issues:

(gdb) r
Starting program: /usr/obj/bin/mksh/mksh -c print\ \$KSH_VERSION
mksh in free(): error: modified (chunk-) pointer

Program received signal SIGABRT, Aborted.
2008-11-15 11:42:18 +00:00
tg
1ca9790f1d typo 2008-11-15 09:05:29 +00:00
tg
546d5d0def give hints to anew() according to aalloc stats output for testsuite and a
little interactive use, to reduce the number realloc(3) must be called
2008-11-15 09:00:19 +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
d8bc1cf161 thread-safety in the atexit function, justin case 2008-11-15 07:59:46 +00:00
tg
24a23d52d8 add plugs for thread-safety, requested by Jonathan Schleifer
example:
#define AALLOC_THREAD_ENTER(ap)	@synchronized(aalloc_guard) {
#define AALLOC_THREAD_LEAVE(ap)	}

notes:
• you must declare and define eventual guard objects yourself
• while there will not be any direct “return” calls inside the
  locked area, AALLOC_ABORT and AALLOC_WARN may be called
• AALLOC_RANDOM does not need to be thread-safe, but malloc
  and free should be; if “ap” is used for locking, all functions
  called must be thread-safe though
2008-11-15 07:51:53 +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
03acb8ce51 this was NOT intended to be committed; my sincere apologies 2008-11-13 00:36:07 +00:00
tg
4e975aa081 make silently leaking a define for better integration into other programmes 2008-11-12 23:34:02 +00:00
tg
e0853c5908 it is, apparently, not portably guaranteed that realloc can deal with NULL 2008-11-12 19:23:09 +00:00