Commit Graph

1431 Commits

Author SHA1 Message Date
tg 31d2796169 simplify
if ((flags & (1 | 2) == 0) || (flags & (1 | 2) == (1 | 2)))
to
	if (!(flags & 1) ^ !(flags & 2))
which works because ! returns 1 or 0, making the ^ an ^^, and
because XOR survives NOTting its arguments
2009-04-07 19:08:25 +00:00
tg edeb22fb96 tabs vs spaces 2009-04-07 19:06:44 +00:00
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 18199e20fd pass LOCPATH environment variable too, might be needed on glibc systems 2009-04-07 18:45:19 +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 c7ccde864e apply workaround given to me in IRC yesternight, just define away the
const keyword to not trigger the famous ACK const bug (no chance it’ll
get fixed, not even in Minix 3’s ACK version)
2009-04-06 08:37:42 +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 b6dcee70fd fix CPPFLAGS detection logic for MKSH_ASSUME_UTF8 2009-04-06 08:29:21 +00:00
tg 2d2b3f0b2d on Minix 3, <strings.h> needs <ansi.h> (via <sys/types.h>) 2009-04-06 08:24:57 +00:00
tg 5bfb6c97df remove extra parenthesēs; the error on WIFSIGNALED is still there:
unary - and & prios on Minix are correct, but gcc4 warns too much…
2009-04-05 13:37:37 +00:00
tg 7e7c648bd8 more extra parenthesēs (gcc4 strict warnings + broken system headers) 2009-04-05 13:07:11 +00:00
tg 5c76604402 replaced cannot sort 2009-04-05 13:07:06 +00:00
tg 3dc6b813fd • document new (clarified) macro behaviour – bugfix
• make bind ^X vs ^[[ section more clear
2009-04-05 12:45:25 +00:00
tg 43de9f8dff shorten 2009-04-05 12:42:34 +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 97c9d172d7 add comments, remove dead code 2009-04-05 12:35:21 +00:00
tg 5e4ffcbedd From: Alexander Hall <alexander@beard.se>
when following bind key macros, do not so recursively
2009-04-05 12:28:55 +00:00
tg 81b84b63b0 assume Plan 9 will also want a jobless mksh 2009-04-05 12:21:14 +00:00
tg efbdae7892 add (commented out) compatibility to MidnightBSD 0.1 /bin/sh – not
desired, because it defaces standards compliance

cf. https://www.mirbsd.org/permalinks/wlog-10_e20090329-tg-g10024.htm
2009-04-05 11:44:56 +00:00
tg e8fad467cf From: Alexander Hall <alexander <at> beard.se>
support multi-line bind macros (part 1 of 2 of entire diff)
2009-04-05 11:18:34 +00:00
tg 81c6c80fd6 persistent history needs munmap, not just mmap (Minix 3 lacks only the former, WTF?) 2009-04-03 10:56:32 +00:00
tg 9aec05ce6a fix compilation 2009-04-03 10:54:58 +00:00
tg e6a4798170 extra parens around WIFSIGNALLED seem necessary on some OSes (gcc 4.1) 2009-04-03 09:48:10 +00:00
tg 9aff4d78fe make {get,set}rlimit code depend on RLIM_INFINITY existence (PW32, Minix 3) 2009-04-03 09:45:23 +00:00
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