Commit Graph

110 Commits

Author SHA1 Message Date
tg 25bb4815d2 remove a redundant function 2007-05-10 18:46:38 +00:00
tg 377dbe464a some gcc 4.1.2pre warning shutup 2007-03-10 18:16:28 +00:00
tg db81d72dea in the utf-8 mode, invalid multibytes are now handled more strongly:
• if it's in x_literal() (“quote” / ^V) mode, it's accepted like now
• if it's a mb sequence start, it's rejected with a beep
• if it's a mb continuation, the whole sequence is silently rejected

this makes command line editing when accidentally hitting, e.g. with
my mircvs://contrib/samples/dot.Xmodmap, Mode_switch-x much more ro-
bust.
2007-03-10 00:36:44 +00:00
tg 08ccbacdf6 bugfix: display UTF-8 control characters (U+0080..U+009F, i.e. width == -1)
the same as ASCII control characters (U+0001..U+001F), i.e. with a ctrl ca-
ret and its value XOR U+0040; treat their width as 2

fixes crash+cpu hog on 'meta-tab backspace'
2007-03-10 00:23:31 +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 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 dd462f00d3 repair 'bind' builtin with no args output; damage taken in -r1.80 2007-02-07 02:01:43 +00:00
tg dc10f66070 optimise 2007-01-15 02:14:02 +00:00
tg 0c809f3db9 static int (which was const) -> integrated into its only use 2007-01-15 02:11:34 +00:00
tg 29b62b186d okay, this didn't work out; changing window sizes when we're
actually within a (the emacs) editing mode does not work at
all, whether forced or not, only if we leave the editing mode
(at end of input); probably due to it saving stuff from e.g.
x_cols into xx_cols, etc.

-> remove SIGWINCH handling(!)
-> TIOCGWINSZ is now executed at end of every input line
-> use 'ESC #' if you direly need to change line size
2007-01-14 01:56:23 +00:00
tg 36e761840e * do *not* check the terminal size after each line processing,
only if we got a SIGWINCH -> interactive use speed-up on the
  slower boxen (slowness courtesy of otto@obsd)
* ^L (redraw line) now (always) checks window size; use this
  instead if required while editing the prompt; changes to the
  variables will still be propagated after the line is entered
2007-01-14 01:09:09 +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 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 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 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