Commit Graph

95 Commits

Author SHA1 Message Date
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 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 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 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 f1e29cb1a1 use NELEM 2006-11-10 01:24:38 +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 68caa9afdd save 464 text with restructuring 2006-11-09 22:38:31 +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 36ac8dc0f7 get rid of the need of strlcat() altogether (only one use was left) 2006-11-09 15:02: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 fb9c6e30bb fix another warning
now builds on MirOS, DragonFly, NetBSD, Debian stale (i386), Solaris 8,
Debian testing (s390x) - Solaris /bin/sh, bash, ksh93, mksh
2006-11-09 00:28:36 +00:00
tg dc9f457f24 don't use __predict_false() here either 2006-11-09 00:01:36 +00:00
tg 3d61efea7d fix backward deletion off-by-one in non-border case
take #if 0'd back debugging code for a while, until
the next release comes out… you never know…
2006-11-06 19:57:19 +00:00
tg 230d52135d remove debugging, simplify 2006-11-05 21:11:17 +00:00
tg 1b55015772 fix that inherited pdksh buglet as well... the xlp wasn't invalidated once… 2006-11-05 21:00:08 +00:00
tg 45f1602850 nuke some of the dbg 2006-11-05 19:56:20 +00:00
tg a3331fd8e9 fix another cursor positioning glitch (cause for \b at x_col == 0) 2006-11-05 19:48:58 +00:00
tg b03ed7b315 * catch limit off in x_redraw (bytes vs chars vs curpos)
XXX should probably be screenpos, might need to use x_size* here
  XXX this seems to be the tab bug I noticed which we inherited from obsd
* catch backspace if x_col == 0 (XXX better)
2006-11-05 19:35:52 +00:00
tg 47daa0eadc fix issue with line splits inmidst of multibyte characters 2006-11-05 19:15:15 +00:00
tg 6b02a01833 track down an off-by-one and a segfault 2006-11-05 19:12:41 +00:00
tg 33ac6cb0d9 multibyte search-character-{for,back}ward 2006-11-05 17:54:46 +00:00
tg 72f958edea fix deleting AND moving left 2006-11-05 17:34:39 +00:00
tg 15fd277841 delete and move word fore- and backwards by the right amount, too 2006-11-05 17:24:00 +00:00
tg 260eaa9d51 eliminate segfault 2006-11-05 17:11:25 +00:00
tg abe860d486 fix deleting forward with count 2006-11-05 16:53:34 +00:00
tg aa867d19bb if we can't delete, keep position, as before 2006-11-05 16:48:17 +00:00
tg dba2dec094 backspace counting
rest'll follow
2006-11-05 16:43:57 +00:00
tg cc261c7968 make backspacing (and moving forward and backward) work perfectly
(in Emacs mode, of course) - for count=1 only though (yet)
2006-11-05 16:41:02 +00:00
tg 4787566fb6 multibyte insertion, the Plan 9 way 2006-11-05 16:10:10 +00:00
tg 08d3457cff utf hack depends on emacs-usemeta off (the default) 2006-11-05 15:36:09 +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 c81966621a merge non-Plan9-specific stuff from the branch, add KNF, etc. 2006-08-24 20:32:53 +00:00
tg 4fac7ec24b * remove redundancy
* integrate compat.h, version.h into sh.h (dependency trick didn't work anyway)
* mention #ksh in mksh(1) since the founder (twkm) said it's on topic too
  (don't remove mention of #mksh despite it's usually empty because of control)
2006-08-22 22:49:38 +00:00
tg 4661992d5b remove the 'stuff' functionality altogether,
ksh93 doesn't have it, and I don't know, nor
do I care about what "the BRL ^T mini-systat
feature" is.
2006-08-08 20:17:22 +00:00
tg 5176249248 * bind ^T to transpose-chars as documented in the manual page,
not to stuff, even if TIOCSTI is available
* it's transpose-chars not transpose

bug spotted by hondza who wondered that on ^T the line repeats itself forever
2006-08-08 20:07:53 +00:00
tg 174b4c5a1d the 'delete' key does *not* act as Ctrl-D (EOT, cf. ascii(7)) 2006-08-02 14:02:55 +00:00
tg 58e5606710 bind xterm-xfree86 and wscons (NetBSD®) wsvt25/vt220 too 2006-08-02 14:00:19 +00:00
tg c96e31a707 implement a hack whereas you can now bind functions (and macros)
to keys with a trailing tilde (after prefix + control char); the
function is then invoked after prefices, control char and one more
character X are entered; if X is not a tilde, it is ungetc(3)d
2006-08-02 13:32:18 +00:00
tg b99aa06d9b save whitespace 2006-08-02 12:54:48 +00:00
tg 99007d97e7 cry if the 'bind' editing command gets too long arguments
minor KNF while here
2006-08-02 12:49:04 +00:00
tg 790c312e9f fix the prompt redrawal routines for multi-line prompts, prompts
with embedded newline (\n), and multi-line prompts with embedded
newlines. single-line prompts should be not affected; prompts with
embedded carriage return (\r) should be fixed by this as well.
also fix prompt_redraw comment (can't remove the variable though,
since it's required if the shell inserts a newline after the prompt
herself).
tested on cygwin and interix
2006-08-02 11:33:37 +00:00
tg 857fb659bc fix multiline prompts with "delimiter chars"
(only the last line of the prompt is redrawn, keep this in mind
when doing the ANSI colour game)

TODO:
* maybe go back up one line and redraw whole prompt?
* optionally edit command on multiple lines, bash-like,
  instead of scrolling horizontally
2006-08-01 14:59:51 +00:00
tg a15c5c319a * use modulo operation, Mr Glockner
* allow promptlen to return values > $COLUMNS
2006-08-01 14:35:44 +00:00
tg ce18e01f2c move promptlen from edit.c into lex.c 2006-08-01 14:10:25 +00:00
tg c504a42ac1 (partial) sync with openbsd (and fix after them),
gives us a better wrapping prompt and a manpage wording cleanup
2006-08-01 14:09:20 +00:00
tg db107a9b05 bring back the 'version' editing command at "ESC ^V" like AT&T ksh93+r 2006-08-01 12:44:17 +00:00