Commit Graph

323 Commits

Author SHA1 Message Date
tg 85b0cb20eb almost hack ${foo//bar/baz} support for real, now
still one corner case left ☹
→ 11:09⎜«Han:#UnixNL» Ik _haat_ bash
⇒ kann ich mich nur anschließen…
2008-02-27 11:24:12 +00:00
tg 01b54f1fd5 I _think_ this implements ${foo/bar/baz} logic (bar is a glob pattern)
todo tomorrow:
• test case (compare with e.g. GNU bash)
• manpage
• version bump

sqchar is a bit ugly, but \/ must be preserved, as we don’t get wdencoded
strings later on in the process (eval.c CSUBST) and I didn’t want to have
an implementation like ${foo: 2: 3} this time
2008-02-27 01:00:10 +00:00
tg 5ea53a15c7 implement “here strings” 2008-02-26 20:43:11 +00:00
tg 9b1504a221 move some constants private to the lexer into its .c file 2008-02-26 20:35:25 +00:00
tg d16fc19335 live code from FOSDEM: add print \xDB and \u20AC, including regression test
agreed bsiegert@
good idea and manpage diff ok'd by some netbsd person sitting next to me
2008-02-24 15:48:43 +00:00
tg 98f0a3c101 oops 2007-10-25 15:34:57 +00:00
tg 6976ed8bc3 get rid of u_char, u_int, u_long 2007-10-25 15:23:10 +00:00
tg 3b5bbaefcb optimise (struct padding, function→macro, etc.) 2007-10-25 15:19:16 +00:00
tg 13676f4914 even better: don't require 64-bit types at all
also, improve wording of Build.sh (passive terms)
2007-10-25 14:26:53 +00:00
tg bbbe959bf2 only check for 64-bit integer types if needed (arc4random support) 2007-10-25 14:18:56 +00:00
tg 2ca968e25f • fix for the pipeline-as-coprocess problem
• bump to mksh R32
2007-10-25 13:51:19 +00:00
tg 97ba2fabc7 first step towards mksh R32 ☺
allow array indices in the uint32_t range (0‥4294967295) and map negatives
into that range; adjust manual page and regression tests; to be used RSN ☻
2007-10-18 20:32:33 +00:00
tg e2c2a1c1a0 clean up the CHARMASK mess 2007-10-14 13:43:41 +00:00
tg 52b9911ff6 revert the return type of x_e_getc() back from u_char to int
this change broke abortion on failure to read input, was not
needed for gcc warnings and is the fault of Intel’s compiler

this should fix the other busy-loop problem occuring only on
GNU/Linux so far – 10x spaetzle@freewrt.o for pointing me to
the problem; reproduced on my work craptop
2007-10-09 14:50:50 +00:00
tg c1c939e340 • fix memory leaks found by coverity
from netbsd via oksh
  we had the NULL pointer deref already fixed
• avoid a bogus not-setting the return value of edit.c:x_file_glob()
  introduced by the above change in oksh
• escape ? as well (but not ] because that’s wrong)
  reminded by cbiere@netbsd via oksh
• Unsetting a non-existent variable is not an error. See
  http://www.opengroup.org/onlinepubs/009695399/utilities/unset.html
  report from Arkadiusz Miskiewicz; fixed based on
  http://cvs.pld-linux.org diff via oksh but modified slightly
• Be more smart waiting for input for non-interactive scripts.  Fix
  based on a diff from debian:  see their bug#296446 (via oksh)
  modified slightly
  this also fixes cnuke@’s “mksh busy loop” problem, for which I never
  received a bug report, but the Debian bug page contains a set of two
  scripts to reproduce this before (and no longer after) this commit
• some KNF
• bump version
2007-09-09 18:06:42 +00:00
tg b82204aa3d proto 2007-08-20 14:06:10 +00:00
tg 1e3783f030 employ string pooling techniques to save off a few more bytes
(probably more than the new “rename” builtin ever required…)
2007-08-19 23:12:23 +00:00
tg ca46f3dc98 new builtin “rename” (this name sounds better than “mksh_mv_rescue” ☻)
to just call rename(2) directly, e.g. if /bin/mv needs /lib/ld-uClibc.so.0

some assorted code cleanup
2007-08-19 22:06:27 +00:00
tg e99f988aae feature freeze for mksh R31, to be released as part of MirOS #10 2007-08-18 00:22:09 +00:00
tg f684b0ceb1 Implement the “source” command, as requested by some and agreed bsiegert@
In contrast to AT&T ksh93, its semantics are like GNU bash in that it ap-
pends the current working directory to the search path; it is implemented
as a shell alias instead of enhancing funcs.c:shbuiltins[] like in ksh93.
2007-08-13 19:39:21 +00:00
tg f3bb1472df Debian warning cleanup 2007-08-12 13:52:03 +00:00
tg 499327f7b8 add “set -o arc4random”, RTFM for details 2007-08-12 13:42:23 +00:00
tg cf2eb697e2 use bounds check for function that calls read
prompted by lina output, 10x tarzeau
not a bug
2007-08-06 12:02:39 +00:00
tg 496b8f4dc3 • new way of checking for mknod & friends, due to tcc vs glibc weirdness
• bump vsn for the code restructuring
2007-07-31 11:11:25 +00:00
tg 3718a00106 • test on HURD (gnubber)
• fix unreachable code (break stmt) cought by suncc on yofuh's E420
• bump vsn to today
2007-07-26 13:23:52 +00:00
tg b20e5a90ce initial support for PW32, not quite working yet (same issues as Minix 3 and Plan 9, I think) 2007-07-24 21:47:14 +00:00
tg e37577de42 fix another errexit bug: unwind() is __dead, so the pseudo-signal was never
delivered to the process
• regression test by Clint Pachl, verified against Debian ksh93 by me
• place to fix it in the code discovered by Otto Moerbeek
2007-07-24 11:22:04 +00:00
tg f2a52c65fa … and fix that bug.
Guvf pbzzvg haxabjvatyl fcbafberq
ol NheVFC ToE, fvapr jr hfr zxfu,
naq zl bgure gnfxf ner jnvgvat...
2007-07-23 14:28:52 +00:00
tg b09b3621e2 • we had an unused variable leftover
• make warning-free for both gcc and xlC
2007-07-22 14:01:50 +00:00
tg a1433b7122 • Build.sh: always prepend well-known signal names, so that some signals
will not come up weirdly (e.g. on AIX: SIGSAK (SIGMAX?), SIGIO (SIGAIO?),
  SIGURG (SIGIOINT?)), and add a few more while here
• check.t, sh.h: bump
2007-07-22 13:46:15 +00:00
tg cf5fc9eac2 some null/NUL 2007-07-22 13:38:26 +00:00
tg 979406bba7 • support IBM xlC on AIX
• fix all bugs it could find ☺
2007-07-22 13:34:52 +00:00
tg 56a8da33cf • make the "if called as sh, set FPOSIX" not !SMALL-only
• bump to R30-gamma, feature freeze
2007-07-17 13:56:51 +00:00
tg 78d58de7a0 fix the rest of it 2007-07-06 02:22:57 +00:00
tg 26a6e5acc9 make this pass varexpand-substr-1 and ‘c’ of varexpand-substr-2
by actually using the lexer and parser for that
2007-07-06 01:53:36 +00:00
tg f948c13a78 • fix display problem
• add <libutil.h> if it exists – revoke(2) on UWIN
• add <stdlib.h> for NULL in test of mmap(2)
• regen CPPFLAGS for MirBSD native builds
2007-07-01 21:47:08 +00:00
tg 7004525fcc • add support for the Borland C++ Builder (on UWIN)
• add support for the Digital Mars compiler (on UWIN)
• clean up
• describe new build targets and that UWIN sucks
• bump vsn
2007-07-01 21:27:03 +00:00
tg 572119b454 some <getopt.h> from vendors define a “struct option”, so use a
different name for ours
2007-07-01 16:49:18 +00:00
tg ca17798533 this is bash compatibility week, and by suggestion of actual users,
namely Dr. Robert “Pfeffer” Arnold (in this case, in FreeWRT), make
a half-completed attempt at implementing ${foo:2:3} substring evals
(of course, negatives can't work right now and that the numbers are
in face expressions is something I only read later too – this is to
be revisited later, but it's already late)

don't depend on this behaviour yet though

if someone wants to add more regression tests, feel free to…
2007-06-27 23:12:59 +00:00
tg 3a94b076a0 implement bash-style array initialisation, as requested by many
still experimental
2007-06-22 23:34:42 +00:00
tg d42f966d22 rewrite some code; bug found by HP's C compiler 2007-06-21 16:04:46 +00:00
tg e596de4759 make sure that “integer” and “local” are defined even in FPOSIX mode, which
is a compromise anyway; these lunox people will have to live with that, too
many existing korn shell alike scripts depend on it even if not on the full
korn shell syntax availability (note: this doesn't mean using these in some
script with #!/bin/sh is ok)
2007-06-17 00:50:09 +00:00
tg 17b7a28ac8 • check.t: add some FPOSIX regression tests (1 still fails)
• all: remove vi editing mode #if defined(MKSH_SMALL) || defined(MKSH_NOVI)
  saves 12608 byts on i386
• check.t: add $0 quoting
2007-06-15 21:55:20 +00:00
tg e258f1e9fe bump 2007-06-09 22:02:04 +00:00
tg bf671f42fa don't use __extension__, cought by sunpro on linux 2007-06-09 22:01:42 +00:00
tg 40484a2f21 from sunpro 12 on linux: optimise use of the const-vs-unconst catcher
thanks cnuke@ for testing
2007-06-09 21:59:21 +00:00
tg 3dcf22a319 ok, icc _did_ track down a few ones, and I fixed errno abuse a little too
however, bad S/N ratio

side effect bonus: smaller code size now
2007-06-06 23:28:17 +00:00
tg 5dfde5c670 first part of the Intel C Compiler (Linux) shaddap
| tglaser@hephaistos:~ $ /usr/local/intel/cc/9.1.042/bin/icc -V
| Intel(R) C Compiler for 32-bit applications, Version 9.1    Build 20060706Z Package ID: l_cc_c_9.1.042
this one is muuuuch too verbose IMHO, _and_ it #defines __GNUC__ (eek)
2007-06-06 21:36:29 +00:00
tg 63c31c43e3 fix for the SUNpro 8 on yofuh's E420:
cc: Sun C 5.8 Patch 121015-04 2007/01/10
2007-06-05 19:48:47 +00:00
tg 10b48d1f92 on Linux 2.0, <sys/sysmacros.h> defines makedev(), but on Solaris, both it
and <sys/mkdev.h> do it, where the latter seems to contain the newer ones,
it undefines them before redefining too, so move its inclusion up a little
2007-06-05 19:35:13 +00:00
tg 1e93f97b8c compile warning-free on SUNpro (regression test suite pass) for MirBSD 2007-06-04 21:33:28 +00:00
tg 6e1bfd6e4b When compiling native MirOS BSD binaries with SUNpro 12 (don't look like a
car only slower, yes this is possible, and the resulting binary passes the
testsuite just fine), the definition of __RCSID() in <sys/cdefs.h> expands
to something with __attribute__((used)), which triggers a warning, because
__attribute__ in general is supported but the used attribute isn't. Thusly
always use our own strings and get rid of the MULTI_RCSID test (introduced
because __RCSID() on Darwin is inferiour).

Maybe we should fix <sys/cdefs.h> too? #ifdef __SUNPRO_C helps here.
2007-06-04 21:27:53 +00:00
tg 2beb60ebf3 for R30, don't check for confstr() declaration any more
it was #if solaris'd in R28, and the system I have access
on does declare it now (still Solaris 8)

this can be put back if anyone complains, of course.
2007-05-24 23:07:19 +00:00
tg a3ab909ff6 bump vsn, we had a regression… 2007-05-24 19:50:38 +00:00
tg 9b86b32dc8 ah, of course, bump the date 2007-05-22 19:31:01 +00:00
tg f5d4e21aa2 • fix the third dramsey scrolling bug for both ^D at BOL and ^W at EOL
(I hope)
• fix another one I found: after ^D'ing, insert at BOL, the > is displayed
  one character too late
2007-05-21 19:25:32 +00:00
tg 252861b156 fix the latest appearance of the dramsey backwards movement bug, cf.
Message-ID: <e3fded850705200935h6ac2c9ebgbc7a9b10ac034a49@mail.gmail.com>
and Message-ID: <Pine.BSM.4.64L.0705201659500.8619@odem.66h.42h.de>
2007-05-20 17:53:13 +00:00
tg fcd6e4f07a bump version 2007-05-13 19:18:26 +00:00
tg a84655e3e0 fix Coverity CID #8, #9
it's wrong to use strchr(s, 0) to look for the NUL byte, because in some
environments it apparently might return NULL

use new macro strnul = s+strlen(s) instead (not side-effect safe tho)
2007-05-13 19:14:05 +00:00
tg e392983af7 Possible fix for Coverity CID#7:
convert options() prototype to unsigned (size_t, in fact), and make an
explicitly casted (size_t)-1 the error return code, modelled after what
is often used in Unix libraries
2007-05-13 18:33:29 +00:00
tg 0989f7da67 Fix for Coverity CID#2: false bug, but still a problem.
Analysis:
internal_errorf(int, fmt, ...) was only a __dead function if the int argument
was non-0, which the Prevent probably was unable to follow. Change all uses of
internal_errorf(0, fmt, ...) to internal_warningf(fmt, ...); change the pro-
totype of internal_errorf() to internal_errorf(fmt, ...) and all remaining
uses remove the non-0 int argument; add __dead to internal_errorf() proto;
flesh out guts of internal_errorf() and internal_warningf() into a new local
function for optimisation purposes.

Some whitespace cleanup and dead code removal (return after internal_errorf(1))
2007-05-13 17:51:24 +00:00
tg 384032b729 fix the “dramsey horizontal scrolling bug” – time for you to find another ☺ 2007-05-10 19:08:48 +00:00
tg 1a0b51b697 • arc4random, arc4random_push: use our own protos to check
XXX u_int32_t is not ISO C99, but seems to work well enough
  XXX if it fails anywhere, we'll see in the build logs
  XXX apple doesn't have the standard uint32_t and API doesn't specify it
• sys_siglist_defn: rename to sys_siglist_decl as we're really checking
  for the declaration in the headers; change wording to “check if … does
  not need to be declared” since we don't need to declare if we don't use
• scan for arc4random, arc4random_push, confstr declarations too
• sh.h: confstr declaration is no longer #ifdef __sun__; sort
2007-04-24 10:42:02 +00:00
tg 615a7794a6 AIX has sys_siglist[] but doesn't define it anywhere, so add a means to
scan for defns and use it here; bug reported by Kurt Telep
2007-04-23 20:37:16 +00:00
tg a823a03370 part of the AIX clean-up
with help of <Gurft> on freenode (Kurt)
2007-04-23 14:04:38 +00:00
tg 002904664e version bump here, too (CR-LF shebang) 2007-04-17 23:51:32 +00:00
tg 2785ce3de4 • (re)implement shebang execution file parsing; this makes the “and which
do not start with a "#!shell" sequence” part of mksh(1) true again; this
  was probably lost in mksh R21 or so when I decided/saw that our kernel
  always parses shebang lines (code written myself, not taken from pdksh
  again or MirBSD kernel, but verified against both)
• bom+shebang execution now works, no need setting EXECSHELL in the test
• bump version
2007-04-15 12:09:57 +00:00
tg 1692a6da66 ignore the UTF-8 Byte Order Mark at the beginning of the input (via a file
given to execute, standard input (interactive or not), via -c command line
argument, or after “eval”, but not for $(…) comsubs, at the beginning of a
subsequent line, or within a line, etc.); regression test for it

idea during my “week off” (despite the pain), bsiegert@ thinks it's good –
and utf-8 capable tools ought to be able to do this anyway
2007-04-15 10:45:59 +00:00
tg 7071cada42 • use wdcopy() not str_save() to duplicate an “encoded string”, whatever
• prevent out-of-bounds memory access, cought by glibc malloc on IA-64
2007-03-14 02:41:09 +00:00
tg 377dbe464a some gcc 4.1.2pre warning shutup 2007-03-10 18:16:28 +00:00
tg c61deaea27 remove unused utf_width(); bump vsn 2007-03-10 00:42:00 +00:00
tg e0e432347b Minix 3 has no S_ISSOCK (probably not even UNIX® domain sockets)
and lacks other things (rlimit stuff), so it won't make it today
2007-03-04 05:14:10 +00:00
tg 17d0fd1e23 more NSIG 2007-03-04 05:04:54 +00:00
tg 0a20bb8dd4 • Minix 3 doesn't have <sys/mman.h>
• Some OSes might need <stdint.h> for int32_t (Minix 3 with GCC)
2007-03-04 04:36:45 +00:00
tg 83c2ee87f4 • remove strcasestr.c, use home-grown implementation¹, call it stricmp,
and have it return an API-correct const char *
• enhance and stylify comments
• a little KNF and simplifications
• #ifdef DEBUG: replace strchr and strstr with ucstrchr and ucstrstr
  that take and return a non-const char *, and fix the violations
• new cstrchr, cstrstr (take and give const char *)
• new vstrchr, vstrstr (take const or not, give boolean value)
• new afreechk(x) = afreechv(x,x) = if (x1) afree(x2, ATEMP)
• new ksh_isdash(str) = (str != NULL) && !strcmp(str, "-")
• replace the only use of strrchr with inlined code to shrink
• minor man page fixes
• Minix 3 signames are autogenerated with gcc
• rename strlfun.c to strlcpy.c since we don't do strlcat(3) anyway,
  only strlcpy(3), and shorten it
• dot.mkshrc: move MKSH=… down to the export line
  to not disturb the PS1 visual impression ☺
• dot.mkshrc: Lstripcom(): optimise
• bump version

¹) side effect from creating API-correct cstrchr, cstrstr, etc.
   uses goto so it must be better ☻

tested on mirbsd-current via both Makefile and Build.sh
2007-03-04 03:04:28 +00:00
tg 62b347a1b0 merge the const branch +- a few 2007-03-04 00:13:17 +00:00
tg e31b852abc mirtoconf the checks if to use persistent history support 2007-03-03 21:36:08 +00:00
tg ad05a2414b * edit.c: when tabcompleting a newline to backslash+newline, this
sequence is eaten before the command is called; cought by <TGEN>
  (Thomas E. Spanjaard) via IRC
  fix is to tabcomplete a newline to singlequote+newline+singlequote
* bump version
2007-02-16 17:46:42 +00:00
tg 665fba6dbf bump version 2007-02-07 02:31:06 +00:00
tg 8d696d001e if mksh_small don't even support -T instead of ignoring it 2007-01-26 18:27:34 +00:00
tg 6d157ffe47 autoscan for persistent history support 2007-01-18 16:05:05 +00:00
tg 7b903e4aa9 header overhaul: replace all #ifdef __OS__ with mirtoconf checks
(except the persistent history one)
2007-01-18 15:50:32 +00:00
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
tg 2b375abef1 fix SIGSEGV, we are passed NULL sometimes 2006-11-09 14:58:27 +00:00
tg a1bfc17aa0 optimise and, ahem… plug… 2006-11-09 14:19:31 +00:00
tg 39057dd592 add the new function utf_ptradj() which does the same as utf_widthadj()
except it doesn't return a value and is much cheaper (no internal con-
version to UCS-2, just range checking on the multibytes)
2006-11-09 00:39:27 +00:00
tg 0307ecb492 * instead of including <sys/cdefs.h> (not in Solaris), we hope <sys/types.h>
includes it for us
* autoconf-test for <sys/param.h> (not in SUSv3) existence
2006-11-09 00:11:39 +00:00
tg d8de18df87 can use short form here 2006-11-08 23:50:47 +00:00
tg 11fbdb4378 implement autoconf tests for langstuff; sync date 2006-11-08 23:45:47 +00:00
tg 0e0782c856 first attempts at more autoconf'isation 2006-11-08 23:23:41 +00:00
tg 5e2e209d51 make this R29(beta), mksh -U turn on (or setlocale), and document. 2006-11-05 17:01:47 +00:00
tg a373d2e7ab first part of utf-8 ability in mksh, already works pretty well 2006-11-05 15:31:37 +00:00
tg 1547b04e66 add new "set -o utf8-hack", currently no effect
set automatically on startup if we have locale functions (on MirOS)
2006-11-05 12:11:14 +00:00
tg 02c14f2a62 use the same idstring stuff everywhere, makes sense 2006-10-03 19:46:14 +00:00
tg fe3ada7780 sync with src/sys/sys/cdefs.h,v 1.11 2006-09-30 02:23:22 +00:00
tg 7ae68e335c * avoid unaligned memory access causing SIGBUS on IA-64 (Itanic)
(incidentally, the information xor'd now is more random)
  only affects non-arc4random targets
* bump version
2006-09-30 02:13:21 +00:00
tg 851e2d1bdb pasto: forgot these 2006-09-21 22:05:46 +00:00
tg 3dd0c521d0 use the easier __RCSID() etc. stuff from current <sys/cdefs.h> 2006-09-21 22:03:23 +00:00
tg 33ddf84c63 bump version
our regression tests:
Total failed: 1 (as expected)
Total passed: 213

the IFS testsuite:
# tests 6856 passed 5192 failed 1664
2006-08-28 01:40:54 +00:00
tg 695503952f use an autoconf-like approach to check for arc4random(3)
after gecko2 told me his mac recently has it and I found
out that Interix has it in -lcrypt and soon -lmirmake (:
2006-08-26 20:30:27 +00:00
tg 456bd584a3 bump version (hey, after all, I fixed the persistent history*!)
and that after submitting it to the FSF/UNESCO directory...

*) regression test for that? how?
2006-08-24 20:35:40 +00:00