Commit Graph

638 Commits

Author SHA1 Message Date
tg 9ecf60f6e5 CPPFLAGS+=-DMKSH_SMALL is not the only functionality-reducing option,
yet the others are not similar (mostly: OS reduces functionality, eg.
SunOS doesn't do persistent history, Minix some job control, Plan 9!)
2006-12-11 20:00:28 +00:00
tg a080fc385d add a TODO here 2006-12-11 19:58:37 +00:00
tg 1f6ba50590 this is mksh, benzday edition (2006/12/07)
last code change was on 12/06
2006-12-11 16:09:49 +00:00
tg 15a0b1a021 catch up openbsd manpage changes: typos; from alf schlichting,
and revisit the RLIMIT_AS issue
2006-12-06 13:46:28 +00:00
tg 6775d79b2a Revision [7]1.16 / ([8]download) - [9]annotate - [10][select for
diffs] , Mon Nov 20 21:53:39 2006 UTC (2 weeks, 1 day ago) by miod
Compute user-given ulimit value times ulimit unit as an rlim_t value, not a
long value; catches some 32 bit overflows on 32 bit platforms.

Found by drahn@, ok otto@
2006-12-06 13:41:23 +00:00
tg 2122e253e7 fix bitching of: gcc version 3.3.5 (Debian 1:3.3.5-13) 2006-11-21 21:45:24 +00:00
tg 17cbdbd0f7 sync with reality 2006-11-21 20:58:07 +00:00
tg 98e9111bbc remove the "set -o sh" option (dummy anyway),
"set +o emacs-usemeta" and "set -o vi-show8" which are always on now,
since we have proper internationalisation (i.e. utf-8) support, and
assume the user either has a 'C' locale and can't enter 8-bit chars,
his terminal is 8bit-transparent, or he has a 'UTF-8' locale.
2006-11-19 20:43:14 +00:00
tg 8a4b64fde3 fix 'typeset -p' to act according to TFM and ksh93 2006-11-19 17:13:36 +00:00
tg b21875f20f document hidden behaviour of typeset to clear flags from a certain
set if any other from that set are touched
2006-11-19 17:00:32 +00:00
tg c2e79abc08 make mksh compatible to the AT&T ksh spec which says, according to
twkm (from #ksh on freenode), that $RANDOM is always an unsigned
15-bit decimal integer.

(RANDOM << 15 | RANDOM) thusly yields 30 bit, which is still more
than 36^5, so we can use it on the baselife CD to speed things up
2006-11-19 16:43:43 +00:00
tg 8adc4a2c56 support systems without setresugid 2006-11-16 13:35:07 +00:00
tg d3dea44bb5 whitespace fixes 2006-11-16 13:35:00 +00:00
tg dd63deb8b7 work around a bug in the GNU implementation of the Berkeley mdoc macros
cought by crib in IRC, thanks

(our textproc/groff port is unaffected since it uses the MirOS implementation,
 a BSD derived one with fixes, by default instead but can reproduce the defect
 with -mgdoc instead of -mdoc as parametre)
2006-11-16 13:05:39 +00:00
tg 151d913115 remove all but these __CRAZY=Yes build warnings:
main.c: In function 'main':
 main.c:208: warning: cast discards qualifiers from pointer target type
 main.c:329: warning: cast discards qualifiers from pointer target type

no warnings at autoconf time left either; will take care of these two later
(might revisit changes from this commit), maybe change declararion for the
builtins to have their argv[] be const strings, and go through strict type
and qualifier checking again. this'll further improve stability.

XXX these changes might have introduced (more?) memory leaks,
XXX someone who knows about these tools should verify with
XXX automatic memory usage analysers (valgrind?)

still passes testsuite
2006-11-12 14:58:16 +00:00
tg fa7407a37c __CRAZY=Yes clean autoconf functions 2006-11-12 13:49:22 +00:00
tg 06b5723f83 oops, wrong protos 2006-11-12 13:38:40 +00:00
tg f7ef916ed9 * fix CR-LF accident
* fix gcc4 warnings in autoconf tests
* Debian needs <grp.h> for setgroups, which seems fairly POSIX

Testsuite succeeds on Debian testing/unstable (i386)
2006-11-12 13:35:29 +00:00
tg 623bf49f19 order the same way as Build.sh outputs them 2006-11-12 13:21:50 +00:00
tg abf1944a8e more warnings, cought on interix 2006-11-12 13:20:15 +00:00
tg df01c5b051 strcasestr, oops 2006-11-12 13:19:06 +00:00
tg 2c1ffced08 unbelievably, cygwin doesn't have strcasestr(3) 2006-11-12 13:15:27 +00:00
tg 5267e51098 header checks before function checks 2006-11-12 13:09:09 +00:00
tg c20d203346 check for getmode as well when checking for setmode;
disable this check on winapi systems since their setmode is something else
2006-11-12 13:08:30 +00:00
tg a799f50fea scan for setresuid/setresgid and setgroups
no alternative implementation yet
2006-11-12 12:56:10 +00:00
tg 5b525d79fb format string warnings, courtesy of Interix 3.5 2006-11-12 12:49:25 +00:00
tg 62d9cf9fa9 only auto-enable set -o utf8-hack (set -U) for interactive shells 2006-11-12 10:44:42 +00:00
tg 742b9c6725 not being able to get current working directory shan't yield SIGSEGV, oops 2006-11-10 19:11:57 +00:00
tg 56ffbf7e70 hand-sorted ctypes/chtypes upgrade; use table-driven where they make
sense and preprocessored otherwise; unify the logic
saves 144t 1i and lots of cpp(1) time, as well as improves readability
2006-11-10 07:52:04 +00:00
tg feb7dddd44 * use only macros for ctype stuff any more
XXX one of these uses a gcc extension, ok for now tho
* don't include <ctype.h> any more at all
* don't try nl_langinfo in small mode, just check locale

saves 171 .text, 4 .data, 256 .bss, 1 import
2006-11-10 07:18:58 +00:00
tg 35b30679c7 since so many internal things hardcode 'C' locale anyway,
use own is{digit,lower,upper} macros that go via byte ranges

doesn't affect utf-8 hack because these only operate on single bytes anyway
saves 224t
2006-11-10 06:53:27 +00:00
tg b323a22b59 use tolower_() and toupper_() macros (if not available, our quick 'C' ones)
76t 8d 2i
2006-11-10 06:45:28 +00:00
tg ca2b1d88ca kill two others, saves 55t 8d 2i 2006-11-10 06:40:05 +00:00
tg 251243b253 use strcasestr not strcasecmp, oops
costs 55t 4d 1i
2006-11-10 06:31:47 +00:00
tg a199d23dfa use setresuid(2) and friends instead, saves 88t 4d 1i
XXX revisit this if we encounter systems without at least
XXX one of setresuid, setresgid, setgroups - only tested on BSD
2006-11-10 06:27:09 +00:00
tg c942031805 mark the test that fails ifdef MKSH_SMALL as category:pdksh too,
so people can skip it if they build a small one
2006-11-10 06:18:05 +00:00
tg 2342fa1242 don't use setreuid(2) etc. stuff, like OpenBSD
only affects suid shell scripts, which are *ugh* anyway,
and I really have no idea what the old code did, when, why, etc.
262t 16d 2i
2006-11-10 06:16:25 +00:00
tg 27443bc0c8 skip on cesu-8, we think nl_langinfo(CODESET) at least will
always return utf-8 for it (on wchar_t=16bit systems); 68t
2006-11-10 05:27:43 +00:00
tg 493ad928e3 if MKSH_SMALL, disable persistent history code as well (like on Solaris,
where it can't work anyway), and fix that code to shrink
saves 2071t 20d 5i
2006-11-10 05:23:14 +00:00
tg 7c4f8d7e16 oops 2006-11-10 05:21:38 +00:00
tg d5e4c261db simplify. and, a few byte compares are cheaper than a structure
copy and a structure compare
gain: 103t 4d 1i
loss: had to move some code even though no diff (cvs issue)
2006-11-10 04:31:04 +00:00
tg 208c45da25 more cleanup; incidentally, replacing libc function with syscall maybe speedup
9t 4d 1i
2006-11-10 04:22:13 +00:00
tg 5dff5df5e5 get rid of the 'mksh -T' functionality (chvt) if MKSH_SMALL
848 text 12 data 3 imports
2006-11-10 04:07:59 +00:00
tg a1ff719ba4 thanks to the nice property of my reimplementation of getn to also
return a value in case of an error (0 or the partial result, which
is the full result in case of trailing junk even), using it to rid
atoi() is possible, saving 9t 4d 1i
2006-11-10 04:03:59 +00:00
tg d91d7feff0 exit not _exit, 50 text 4 data 1 import 2006-11-10 03:54:38 +00:00
tg ecc08e9681 use chown not fchown, and move the ownership check to earlier
saves 45 text, 4 data and security peoples' nerves
2006-11-10 03:50:05 +00:00
tg d10dd31b9a correct a few protos and comments
saves 4 .text bytes and my nerves
2006-11-10 03:45:57 +00:00
tg f8e7fdbb71 use qsort(3) instead of rolling our own
saves 284 in .text, no added import since we already use qsort(3) once
2006-11-10 03:23:50 +00:00
tg f103c6b2a0 use errorf not bi_errorf if we want to abort
saves 16 .text ;)
2006-11-10 02:10:45 +00:00
tg 658dc2b407 rewrite getn() which is some kind of atoi with return code
costs 1 .text, saves 4 .data, 1 libc import
2006-11-10 02:05:06 +00:00