Commit Graph

128 Commits

Author SHA1 Message Date
tg d8662eb228 even more hacks to pass “-O666 -fstrict-overflow -Wstrict-overflow=9 -flto=jobserver” with “gcc version 4.8.0 20120930 (experimental) [trunk revision 191865] (Debian 20120930-1)” ☹ plus make the rtchecks mandatory 2012-10-03 17:24:23 +00:00
tg 0415b74436 Update wcwidth data from Unicode 6.1.0 2012-09-01 23:46:41 +00:00
tg c1f821d4e5 (mksh) tighten 32-bit requirements; (lksh) switch to long; allow any bitness 2012-06-28 20:17:39 +00:00
tg dc5ae267ce make tempvar() and vtemp global 2012-06-28 20:02:29 +00:00
tg 9646c98356 I give up on writing (1 << 31) in any form.
Now we just use 0x80000000UL and cast that to mksh_uari_t and,
if required, that to mksh_ari_t afterwards.
2012-03-31 17:52:33 +00:00
tg e67b98e21b use _setjmp/_longjmp on NeXTstep: its Intel port always restores the signal mask on siglongjmp, which we never have 2012-03-31 17:30:00 +00:00
tg cf75e7b6ce couple of minor/cosmetic fixes from RT’s compile farm:
• promote SCO OpenServer and UnixWare to !oswarn
• omit trying -O2/-O on OpenServer 5 and USL C
• cast mksh_ari_t to int, mksh_uari_t to unsigned int for printf
• skip ulimit-1 on syllable (which is still too broken)
• write ((mksh_ari_t)-2147483648) ipv UB ((mksh_ari_t)1 << 31)
  and add a comment that that is actually meant
• rewrite functions returning !void ending in NOTREACHED
  so they’ve got a jump target returning an error at the
  end, to aid older compilers and just to be safe
• cast struct stat.st_size to off_t or size_t explicitly when needed
• shorten struct env by two bytes and an alignment, at least

also, optimise control flow and fix more paren matching cases
2012-03-29 19:23:01 +00:00
tg 7ec1ae3771 followup for cid 1004EE408E1382C1752 and 1004EE40DDD498FBB0D:
do a mirtoconf run-time check (ugh) to see whether the CPU designers
smoked/were brain-dead or if we don’t actually need the manual check
2011-12-31 02:04:18 +00:00
tg 5070ea2387 skip R/O check in an unevaluated ternary part; 10x jilles 2011-12-16 20:03:02 +00:00
tg e18f4d114a actually, behave with silent wraparound; results validated by bc(1) 2011-12-11 01:56:43 +00:00
tg 971b153933 catch intmin/-1 instead of dumping core on SIGFPE; from Jilles Tjoelker 2011-12-11 01:35:10 +00:00
tg 9782f6b4d1 • access(2) is broken in at least kFreeBSD 9.0 as “modern” OS, so bring
back the wrapper code as well as refactor most other code calling it
• apparently, names can’t end in ‘_’ or contain ‘__’ anywhere…
2011-09-07 15:24:22 +00:00
tg 577c918beb patch most of Jerker Bäck’s concerns out, unless not applicable 2011-08-27 18:06:52 +00:00
tg 210608b199 regenerate all wcwidth code from UCD 6.0.0 and related tables,
and mgk25’s wcwidth.c 5.0 code; add check against 2-byte wchar_t;
optimise libc wcwidth(3) implementation taken from mksh and sync these
2010-12-11 16:05:03 +00:00
tg e57379aab7 regenerate from Unicode 6.0.0 2010-11-01 17:28:49 +00:00
tg 3747722db4 improve string pooling: saves 316 bytes in .text 2010-08-28 18:50:58 +00:00
tg 23f3f58d14 on MirBSD we can use the system wcwidth() and save ~800by on the ramdisc 2010-08-14 21:35:13 +00:00
tg f3b3b4b1fb remove some debugging code 2010-01-25 14:38:04 +00:00
tg 769e222586 re-vamp __attribute__ handling; let this pass on HP-UX bundled compiler
as well as HP aCC
2009-12-12 22:27:10 +00:00
tg a77bbf6123 HP aCC tells me I'm using "const" twice, and /usr/ccs/bin/cc even
errors out here. Let's hope that this form will *still* have the
entirety of that array in .rodata...

XXX more to come, thanks to HP DSPP PvP, e.g. __attribute__ stuff
2009-12-08 19:23:34 +00:00
tg 703551bd4f attempt a better fix: break off widthadj upon encountering NUL,
add remaining columns as octets (should also speed optimise)
2009-12-05 20:17:59 +00:00
tg a09f05e77a /me is annoyed
I read, IIRC in the Cederqvist, that 'cvs tag' sets a sticky tag onto
the cwd… it doesn’t, apparently. (I actually like it better this way,
but one needs to know!)
2009-11-28 14:28:03 +00:00
tg 883d9d99b3 switch ${%foo} to wcswidth-like behaviour – slightly problematic, and
the “set +U” case isn’t even handled

committed to branch because I’d like to get more input on this, for now
2009-11-28 14:21:47 +00:00
tg 73147a7fe9 fix lazy evaluation of assignments in ternary ops 2009-10-04 13:19:33 +00:00
tg 7b7b75b026 * move the utf_* functions to a smaller file, to reduce the pain the
CPU has to endure while gcc is crunching on edit.c
* comment on mksh not using _exactly_ OPTU-8/OPTU-16 (XXX)
2009-09-26 04:01:34 +00:00
tg 1a28786229 * shrink MKSH_SMALL even further by removing functionality like
some GNU bash extensions (suggested by cnuke@) and bind macros
* make the random cache more efficient (and the code potentially
  smaller, although we have a new implementation of the oaat hash
  function, alongside the old one, now) and pushb only if needed
  (i.e. state has changed or user has set $RANDOM, but not onfork)
2009-09-23 18:04:58 +00:00
tg 9dd98da40d Support Dave Korn’s alternative 「'a'」 (or 「'…'」) form for base-one
integers in addition to my 「1#a」 (or 「1#…」), which also allows for
finer end-of-character checking. Note that this is locale-dependent in
ksh93, set ±U dependent in mksh, and mksh’s OPTU-16 encoding is used.
2009-09-06 17:55:55 +00:00
tg 9b8d4023fa … but since I liked the bonus of having the hval stored so much, merge
it with the array index; var.c says that
│ 1244         /* The table entry is always [0] */
so that we can have a special flag and a union which stores hval for
the table index, the array index otherwise (coïncidentally *hint hint*
they have the same size)
2009-08-28 21:01:27 +00:00
tg bb7a720a00 for now, until we really use kt*() otherwise, ifdef out tablep/hval 2009-08-28 20:38:43 +00:00
tg 4ccdfc8508 much better solution: save tablep and hash value¹ in the struct tbl entry
① also saves time during texpand :D

XXX this doesn’t work well with the current indexed-array implementation
2009-08-28 20:30:59 +00:00
tg 0e1266ef90 While mksh R39 builds fine on MirOS #7s8E on my trusty sparc, pgcc 2.95.3
throws out quite some warnings – fix most of them except most emitted via
-Wconversion; work around some others; discard bogus warnings.

sync clog
2009-08-08 13:08:53 +00:00
tg 0432f97ffe more KNF, mostly whitespace, this time more manual labour applying style(9) 2009-06-10 18:12:51 +00:00
tg bbf00b5d93 merge fix from oksh:
"let --" was crashing ksh; found by phy0@rambler.ru.  Various other expressions
involving ++ and -- also ran into this. Insufficient checks for end of parse in
the tokenizer made it assume that an lvalue had been found
2009-06-08 20:13:07 +00:00
tg 6b2ad96bac some rather mechanical KNF, now that style(9) clarified on the status
of sizeof() as a function-like unary operator; use parenthesēs around
sizeof and return args consistently too
2009-06-08 20:06:50 +00:00
tg b145ca5c9f • sync distrib/special/mksh/Makefile with bin/mksh/Build.sh and
fix the regression test’s results while here, which have been
  broken since cid 10049D9BE5254CE65B8
• get rid of separate copyright file which was intended for De-
  bian; track down commits in all files of oksh-mirbsd and mksh
  to get correct copyright years per-file, as is BSD custom
2009-05-16 16:59:42 +00:00
tg 8a7223d4cd split utf_ptradjx into utf_ptradj function (to save space) and
self-assignment macro; remove some uses of the macro in favour
of foo += utf_ptradj(foo)
2009-05-16 15:09:07 +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 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 858d8e8b5a implement unsigned arithmetics as an mksh extension 2008-12-17 19:39:23 +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 4d3fc2413e switch to a (nmemb,size) API from a (nmemb*size) API
cost: text += (308, 256, 4, -100)
2008-11-12 00:54:52 +00:00
tg 88d7b7d08b • rewrite code to no longer use statements-as-expressions
• optimise a little
• Build.sh: remove HAVE_EXPSTMT test
• Build.sh, */Makefile: sort tests, regenerate
• mksh.hts: sync clog
2008-10-28 14:32:43 +00:00
tg 0b4f34e0a8 • syn.c: replace expanded use of str_save() with the actual macro
• others: fix 6 (!) cases of non-constant or side-effect arguments
  to the str_save() or str_nsave() macros, and other abuse of them
• also fix some cosmetics and other un-nice code while here
2008-07-12 16:56:40 +00:00
tg 309c674ed7 mostly revert 100480A853206FB56FA and parse utf-8 lead bytes ourselves 2008-04-20 00:24:26 +00:00
tg f1ab7789e3 solve the issue (although not quite how I’d like it) 2008-04-19 23:49:59 +00:00
tg 9b62cf15bf • more unsigned → unsigned int
• more int → bool
• more regression tests: check if the utf8-hack flag is really disabled
  at non-interactive startup, enabled at interactive startup, if the
  current locale is a UTF-8 one
• make the mksh-local multibyte handling functions globally accessible,
  change their names, syntax and semantics a little (XXX more work needed)
• optimise
• utf_wctomb: src → dst, as we’re writing to that char array (pasto?)
• edit.c:x_e_getmbc(): if the second byte of a 2- or 3-byte multibyte
  sequence is invalid utf-8, ungetc it (not possible for the 3rd byte yet)
• edit.c:x_zotc3(): easier (and faster) handling of UTF-8
• implement, document and test for base-1 numbers: they just get the
  ASCII (8-bit) or Unicode (UTF-8) value of the octet(s) after the ‘1#’,
  or do the same as print \x## or \u#### (depending on the utf8-hack flag),
  plus support the PUA assignment of EF80‥EFFF for the MirBSD encoding “hack”
  (print doesn’t, as it has \x## and \u#### to distinguish, but we cannot use
  base-0 numbers which I had planned to use for raw octets first, as they are
  used internally): http://thread.gmane.org/gmane.os.miros.general/7938
• as an application example, add a hexdumper to the regression tests ☺
2008-04-19 22:15:06 +00:00
tg 5d41a86e86 don’t do arithmetics on an enumerated type, sez the MIPSpro complainer 2008-03-28 13:33:37 +00:00
tg 3b5bbaefcb optimise (struct padding, function→macro, etc.) 2007-10-25 15:19:16 +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 979406bba7 • support IBM xlC on AIX
• fix all bugs it could find ☺
2007-07-22 13:34:52 +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 f6ff09ccbe don't have two functions token(), helps ctags 2007-03-03 21:12:51 +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 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 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 7672b9b346 apply some fixes from OpenBSD and don't apply some others
but sync RCS IDs for easier future adaption:
* Simplify savefd() by removing the "noclose" flag and make noclose
  behavior the default. Almost all uses of savefd() are followed
  by an implicit or explicit close.
* fix typos
* might as well make ksh_getopt() match real getopt(), ie. get rid of that
  stupid EOF concept that was never true. adobriyan@gmail
* use SEEK_* for lseek()
* fix lint comments, no functional changes
* remove excessive optimization; from adobriyan@gmail
* only santa checks things twice; from adobriyan@gmail
* Interpret zero-filled numbers as decimal; PR 4213; from Alexey Dobriyan
2006-05-10 18:54:13 +00:00
tg 95cfad6339 * only have one $MirOS RCS ID per file to shrink source size
(this is an exception from normal use)
* bump to R26
2005-11-22 18:40:44 +00:00
tg 9b97d72d5e * move _all_ #include stuff into sh.h
* sort out #include stuff which isn't necessary on MirOS into compat.h
2005-10-25 19:53:29 +00:00
tg cd7b8bd79b Add mirbsdksh R21, which was developed in a temporary external CVS repo-
sitory whose ChangeLog follows. mksh R21 is licenced under the MirOS li-
cence, shown in "sh.h", and a two-clause UCB-style licence by Marc Espie
as shown in "alloc.c".

This executable is a fair bit smaller and shorter than our /bin/ksh that
it is designed to eventually replace (as /bin/sh hardlink), with the old
/bin/ksh to completely vanish. It is still in beta testing though, and I
don't think it will compile on other operating systems.

mksh R21 is a completely new port, bringing together the OpenBSD-current
/bin/ksh, the MirOS-current /bin/ksh and the older mksh R20 (which still
was portable, ocvs-based).
2005-05-23 03:06:10 +00:00
tg d8d708aa45 * un-hook bin/ksh, usr.bin/xmlwf and lib/libexpat from the build
- expat as discussed with bsiegert@ today on the phone
  - ksh as announced earlier on the lists
* un-hook lib/libexpat from make includes
* remove /usr/include/{,open}ssl upgrade workaround from includes/Makefile
* nuke old bin/ksh
* nuke libexpat and xmlwf
2005-10-21 11:33:15 +00:00
tg a90702a5a1 Initial revision 2005-03-06 15:42:55 +00:00
tg e824f36ff0 catch up with diffs/fixed we already had
From: Otto Moerbeek <otto@cvs.openbsd.org>
2004-12-28 22:40:40 +00:00
tg 0114af375d Use stdbool.h instead of rolling our own bools.
From: Todd C. Miller <millert@cvs.openbsd.org>

XXX #ifndef HAVE_STDBOOL_H ?
2004-12-28 22:32:09 +00:00
tg d5ff21ea1d (anything *)0 -> NULL 2004-12-18 19:22:30 +00:00
tg 4c4a9323f8 unifdef: KSH
no binary change
2004-12-18 18:58:32 +00:00
tg b99edc6cc1 From: Todd C. Miller <Todd.Miller@courtesan.com>
Cool, thanks for testing.
 - todd
2004-12-13 16:48:54 +00:00
tg 97d9512149 bump to mksh R19 2004-12-10 18:12:32 +00:00
tg 7920708324 Initial revision 2004-12-10 18:12:29 +00:00
tg 8a1afa6087 experimental diff:
From: Todd C. Miller <Todd.Miller@courtesan.com>
The following ksh diff needs wide testing.  It does the following:
 1) proper error message for bad substitution.
    Before:
        $ echo ${a[@]:foo}
        ksh: : bad substitution
    After:
        $ echo ${a[@]:foo}
        ksh: ${a[@]:foo}: bad substitution
 2) fix a core dump for "echo ${a[@]:?foo}".
 3) fix a use-after-free bug (from otto@)
2004-12-10 22:21:26 +00:00
tg b2de14e57c run GNU protoize
protect header files
nuke some dead code
regenerate configure script
let silly code die
2004-10-28 11:53:44 +00:00
tg 75e25d6e50 de-register, de-inline, de-__P 2004-10-28 11:11:19 +00:00
tg 7ad780aa98 -Wall -Werror -W -pedantic clean 2004-10-28 11:03:24 +00:00
tg ecdd4d5568 unify spacing of RCS IDs 2004-09-21 11:57:17 +00:00
tg 6c8eabf72e polish, mop up whitespace, etc.
passes regressions on MirOS
2004-05-24 19:56:25 +00:00
tg 8d3634d008 throw out a bunch more of 0x60 characters throughout code and comments 2004-04-17 00:47:20 +00:00
tg f7ecabd91c Time to import OpenBSD once again. Expect breakage. 2003-12-22 20:22:51 +00:00
tg a34b05d2e6 Import OpenBSD 3.3 source repository from CTM 3132 the first time
This opens an OpenBSD-mirabile (aka MirBSD) repository.

### MirBSD is:
# Copyright (c) 1982-2003 by Thorsten "mirabile" Glaser <x86@ePost.de>
# Copyright © 1968-2003  The authors of And contributors to UNIX®, the
#       C Language, BSD/Berkeley Unix; 386BSD, NetBSD 1.1 and OpenBSD.
#
# Anyone who obtained a copy of this work is hereby permitted to freely use,
# distribute, modify, merge, sublicence, give away or sell it as long as the
# authors are given due credit and the following notice is retained:
#
# This work is provided "as is", with no explicit or implicit warranty what-
# soever. Use it only at your own risk. In no event may an author or contri-
# butor be held liable for any damage, directly or indirectly, that origina-
# ted through or is caused by creation or modification of this work.

MirBSD is my private tree. MirBSD does not differ very much from OpenBSD
and intentionally tracks OpenBSD. That's why it _is_ OpenBSD, just not the
official one. It's like with DarrenBSD.

At time of this writing, no advertising for MirBSD must be done,
because the advertising clause has not yet been sorted out.

http://templeofhate.com/tglaser/MirBSD/index.php
2003-03-22 17:35:03 +00:00