Commit Graph

141 Commits

Author SHA1 Message Date
tg 70a7e1527b oops, this must of course be a pointer 2007-01-18 01:03:10 +00:00
tg 65a86d2f67 bring back sig_t as void pointer in the rare case we
don't have sighandler_t or __sighandler_t either
2007-01-18 00:10:16 +00:00
tg ecc6beb7d5 scan for sig_t (and friends) 2007-01-17 23:54:39 +00:00
tg af606537e2 if we don't have rlim_t, assume it's long 2007-01-17 23:18:55 +00:00
tg 22ab30b556 Linux missing MAP_FAILED? 2007-01-17 23:10:14 +00:00
tg c3de1d7564 <sys/sysmacros.h> contains major/minor/makedev on Linux 2.0 2007-01-17 23:04:19 +00:00
tg ddd2dac47d * support old environments without libgen.h (ancient GNU/Linux)
and stdbool.h (ancient GNU/Linux; NetBSD® 1.6.1)
* __dead must come after, not before, to accomodate gcc 2.7.2.3
2007-01-17 22:51:47 +00:00
tg ceb5a7dba0 check if __RCSID() can be used multiple times; req'd eg. on Mac 2007-01-17 21:42:23 +00:00
tg 263f518dfd * Build.sh: add -fwrapv to standard CFLAGS, just to be on the safe
side (I don't have capacities to scan 71711 files in MirOS for a
  standards-compliance whack)
* copyright: mention CVS changelogs as place of contributors' name
  and credit information, too
* check.t, sh.h: bump
2007-01-17 01:24:29 +00:00
tg c480656076 shrink .data a little 2007-01-15 02:48:28 +00:00
tg 981a515287 bump vsn 2007-01-15 00:38:20 +00:00
tg 87f681b488 * revert some of the const-warning cleanup which must be done
with different means (reads, tricky magical kludgery)
  YES, THIS BREAKS -rHEAD, I KNOW.
* while here, fix spelling
2007-01-12 10:18:22 +00:00
tg 4867c8dcef pasto 2007-01-12 02:02:21 +00:00
tg 5891915f1b * Scan for __attribute__((...)) in general (the earliest was 2.5,
where we had 'noreturn' etc. but no '__noreturn__')
* Scan for __attribute__((bounded)) and __attribute__((used))
  if we have __attribute__((noreturn))
* To be able to scan if certain attributes give warnings,
  scan for -Werror with a simple programme which hopefully triggers none
* Convert __attribute__((unused)) to __unused, noreturn -> __dead
* Unify other attributes
* Clean up typography a little more
2007-01-12 01:49:29 +00:00
tg 2f15a11c55 Clean up the signal mess, saves 172 Bytes:
* 'sigseen' in Build.sh goes away
* Signal name existence is checked in this order:
  have our own¹ -> sys_signame[] -> _sys_signame[] -> build our own²
* Signal description existence is checked in this order:
  sys_siglist[] -> _sys_siglist[] -> strsignal() -> NULL³
¹ Predefined list of items, for operating systems where we
  cannot build² them, i.e. Plan 9 and Minix 3 (e.g. no $CPP -dD)
² The usual cpp(1) stuff
³ Changed later, see below
* Make $CPP test dependent on $NEED_MKSH_SIGNAME (others can
  be added here, this is not absolute)
* Make signal name list generation² dependent on $NEED_MKSH_SIGNAME
* Fix check if the generation worked
* Guarantee that sigtraps[*].name and sigtraps[*].mess are valid
  C strings; this makes the code shorter *and* removes a few pos-
  sible nil pointer dereferences
* Embed autoconf'd usages of sys_sig* / strsignal / mksh_sigpairs
  into inittraps()
* Check for each signal 0<=i<=NSIG that
  name is not NULL or "" -> replace with ("%d", i)
  mess is not NULL or "" -> replace with ("Signal %d", i)
  name does not start (case-insensitive) with "SIG" -> name += 3
* In gettrap(), fix check if signal name starts, case-sensitive
  or case-insensitive, depending on need, with "SIG" (bug from millert@)

Other changes:
* Build.sh: ac_test[n]() are documented
* Build.sh: ac_test[n]() can have negative prereqs as well now
* Build.sh: use <<-'EOF' consistently
* bump patchlevel to today
2007-01-12 00:25:40 +00:00
tg e960fabf63 expand ~foo to getpwnam("foo")->dir only #if !defined(MKSH_SMALL)
this makes it possible to build a (small) mksh on glibc systems statically
2007-01-11 00:32:31 +00:00
tg b725114422 use RLIMIT_AS, after much RTFM 2007-01-06 18:48:27 +00:00
tg dbf5cdf632 * main.c: prevent segmentation faults on inferiour operating systems
such as Debian GNU/Linux "etch" 4.0 with not installed locale file
  corresponding to the current environmental settings. ばかたち!
2007-01-06 17:08:14 +00:00
tg 17a3fffc26 * main.c: when doing the conversion from strcasecmp (wrongly used)
to strcasestr, it was used in a wrong way (reverse logic error in
  checking its return value), turning to mis-detection of UTF-8 locale.
* sh.h, check.t: bump version
* copyright: bump year
2007-01-03 22:43:48 +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 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 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 d3dea44bb5 whitespace fixes 2006-11-16 13:35:00 +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 2c1ffced08 unbelievably, cygwin doesn't have strcasestr(3) 2006-11-12 13:15:27 +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 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 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 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 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 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 c60dbdc6cb * change EXECSHELL to /bin/sh (we can override it via environment anyway,
and this is a sensible choice instead of ourselves)
* move this stuff from sh.h into exec.c where it belongs
* simplify set -o stuff

saves 8 bytes
2006-11-10 01:44:40 +00:00
tg cd9202835c cosmetics 2006-11-10 01:25:22 +00:00
tg ebf58f6b42 if !MKSH_SMALL, str_save() can be a macro 2006-11-10 01:19:17 +00:00
tg 273ca89019 * check.t: add new regression test "typeset-padding-1" according to TFM
* edit.c: remove debug stuff again; next time better use shl.c functions ;)
* sh.h: add format attributes to a few shf functions
* histrap.c, var.c: fix format string mistakes
* main.c, sh.h: error_prefix and warningf take bool not int
* misc.c: make chvt() stuff use shf_* functions
* misc.c: rewrite the TIOCSTTY stuff to be better integrated in mksh,
  since it originally was an external patch
* misc.c: chvt() no longer fails if e.g. chown fails due to e.g. R/O / fs
* var.c: fix typeset padding for right-justified zero-filled
2006-11-10 01:13:52 +00:00
tg 320f503391 get rid of ulton() - a joke
saves 32 bss, but adds 84 text oO
2006-11-09 23:55:52 +00:00
tg 88bf6422d9 shrink chtypes array down to 8 bit
saves 72 text and a lot bss
2006-11-09 23:39:16 +00:00
tg 3c33cbcecc don't compile mknod(1) builtin if MKSH_SMALL
saves 1037 text, 20 data (on i386)
2006-11-09 22:18:10 +00:00
tg 2345d8b72b more getconf/confstr fixes 2006-11-09 22:11:08 +00:00
tg d4ca2c9141 simplify getconf and confstr stuff 2006-11-09 22:08:08 +00:00
tg bc215df211 make a few functions static that should be, and optimise a little 2006-11-09 21:20:49 +00:00
tg c43e701025 optional (#ifdef MKSH_SMALL) saving of 364 more bytes of .text
intended e.g. for FreeWRT
2006-11-09 21:00:13 +00:00
tg 35776a9d4d using a function instead of a macro saves 896 bytes of .text 2006-11-09 20:53:42 +00:00
tg 617950554f missed these 2006-11-09 15:03:56 +00:00
tg 36ac8dc0f7 get rid of the need of strlcat() altogether (only one use was left) 2006-11-09 15:02:31 +00:00