From 0e21ca9d04d9edd02fde19562d5b98fb38074092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20H=C3=A5llberg?= Date: Mon, 29 Dec 2008 13:51:01 -0500 Subject: fixed problem when a tcp packet ends with an unterminated escape code diff --git a/ChangeLog.old b/ChangeLog.old index 1c654c9..2a62a51 100644 --- a/ChangeLog.old +++ b/ChangeLog.old @@ -1,3 +1,357 @@ +2008-12-29 dain + + * edit.c: Fixed display bug when a partial ANSI code was received + in one TCP packet + +2008-01-09 21:35 bpk + + * README, main.c, powwow.6, powwow.doc: Converted some stuff to + utf8, updated Dain's email from Dain + +2008-01-09 21:33 bpk + + * beam.c: Convert TITLE env variable according to locale from Dain + +2008-01-09 21:32 bpk + + * README, configure.in, debian/changelog: More version bumps + +2008-01-09 21:31 bpk + + * powwow.doc: Version number bump + +2007-10-10 16:25 bpk + + * utils.c: Switched to using pointers to save the last space + because counters could be off if there were ansi sequences + +2007-10-09 21:46 bpk + + * debian/control: Version isn't a valid keyword + +2007-10-09 20:25 bpk + + * debian/changelog, debian/control: Fix debian version numbers + +2007-10-09 20:18 bpk + + * configure.in, powwow.6, powwow.doc: Version bump + +2007-10-09 20:15 bpk + + * utils.c: This should change the option +wrap to do word wrapping + instead of just line wrapping + * cmd.c: Don't try and load non-.so files in cmd_module + +2007-03-08 06:30 bpk + + * ptr.c, ptr.h: This should again fix the double-free bug that was + once fixed in perlwow + +2006-12-07 22:12 bpk + + * debian/changelog, debian/control: Fixed version numbers + +2006-11-08 17:12 bpk + + * cmd2.c: This fixed #bind and #rebind problems, patch from kalev + lember + +2006-10-20 23:47 bpk + + * configure.in: More checks for building in cygwin + +2006-03-24 23:49 bpk + + * cmd2.c, defines.h, follow.c, list.c, main.c: Removed malloc.h + since it's obsolete, fixed follow.c to not use tty_read_fd since + it looks like a copy-paste job that didn't get fixed and causes + brokenness on bsd + +2006-03-24 23:48 bpk + + * debian/control: Fixed maintainer line + +2006-02-06 22:25 bpk + + * configure.in, debian/changelog, debian/rules: Updated debian + build, bumped version + +2006-02-02 22:37 bpk + + * main.c: Fixed up copyright symbols and display (Dain) + +2006-02-02 21:34 bpk + + * main.c: Fixes crash if non-latin-1 character is entered before + connecting to a server (Dain) + +2006-01-31 22:14 bpk + + * cmd.c: Fixes bugged #var $(expression). bug #1: It was possible + to create variables with illegal names. bug #2: Expressions like + "-30" or "+5" were incorrectly interpretted as named variables + which were then completely inaccessible. bug #3: Deletion of + existing named variable via #var $(expression)= caused crash. + (pointer to var-node was not set) (Elestir) + +2006-01-31 21:57 bpk + + * cmd.c: Better handling of line continuation (Elestir) + +2006-01-31 21:55 bpk + + * main.c: 1. Allows empty-line matching using regexp. E.g.: + gagging of all empty lines #action %empty ^$= 2. Fixes the bug + in parameter copy for regexp actions. powwow did not set any + matched regex params after finding an empty match (Elestir) + +2006-01-31 21:50 bpk + + * eval.c: Fixes operator . (dot) which didn't check for valid + index range. (Elestir) + +2006-01-31 21:39 bpk + + * map.c: Make speedwalk execute aliases if defined instead of just + sending directions (Elestir) + +2006-01-31 21:35 bpk + + * cmd.c, cmd2.c, main.c, main.h, utils.c: Allow configuring the + group delimiter to any arbitrary string + +2006-01-31 18:58 bpk + + * tty.c: A patch that fixes a problem with not restoring the fcntl + flags for stdout before running a #! command. To trigger the bug + in 1.2.9, just type "#! cat" and cat will die with EAGAIN. Patch + by Dain + +2005-11-22 16:53 bpk + + * cmd2.c: Fix for segfault when viewing a single alias from Kalev + Lember #alias foo=bar #alias foo Caused + segfault + +2005-11-13 08:55 bpk + + * dist-info.cf: This is the new config for mkdist + * Makefile.in, aclocal.m4, configure: These are autogenerated + files and don't need to be tracked + +2005-11-11 07:09 bpk + + * NEWS: Updated news in preparation for release + +2005-10-28 19:31 bpk + + * debian/control: Added arch and maintainer to debian files + +2005-10-28 19:07 bpk + + * powwow.doc: Added #speedwalk to documentation + +2005-10-28 19:02 bpk + + * cmd.c: Added #speedwalk command for using speedwalks even if you + have opt_speedwalk set to off + +2005-10-27 17:10 bpk + + * powwow.6: Updated where to send patches/bug reports in man page + +2005-10-27 16:39 bpk + + * Makefile.am, Makefile.in, NEWS, README, aclocal.m4, configure, + configure.in, debian/changelog, powwow.doc: Updated version + numbers, added COPYING file to shared dist to that #help + copyright works + +2005-10-27 06:11 bpk + + * eval.c: This fixes a tiny memory leak caused by not freeing the + copy of a variable if used in a comparison on the left side, + valgrind output: ==10477== 10 bytes in 1 blocks are definitely + lost in loss record 3 of 45 ==10477== at 0x1B90459D: malloc + (vg_replace_malloc.c:130) ==10477== by 0x806B08A: ptrdup2 + (ptr.c:65) ==10477== by 0x806B121: ptrdup (ptr.c:80) ==10477== + by 0x805C503: exe_op (eval.c:675) ==10477== by 0x805DDCF: + compare_and_unload (eval.c:1279) ==10477== by 0x805DFBA: _eval + (eval.c:1322) ==10477== by 0x805E0D4: eval_any (eval.c:1362) + ==10477== by 0x805E43C: evall (eval.c:1446) ==10477== by + 0x8052514: cmd_if (cmd.c:1884) ==10477== by 0x806536E: + parse_commands (main.c:1769) ==10477== by 0x8065119: + parse_instruction (main.c:1709) ==10477== by 0x806525F: + parse_user_input (main.c:1735) test file: #( "Don't save the + config file every time" ) #file = #if ($foo > "ho" ) #print + Dwarves #if ($foo > "ho" ) #print Dwarves #if ($foo > "ho" ) + #print Dwarves + +2005-10-21 23:20 bpk + + * tcp.c: Added some casts because byte is unsigned char and some + functions in main wanted to have signed chars, this was the + previous behaviour but the compiler spit out warnings, now it + shouldn't anymore. + +2005-09-16 19:12 bpk + + * muc.c: Fix warnings during muc compile + +2005-09-13 23:14 bpk + + * NEWS, debian/changelog, debian/control: Updated news and some + debian control files + +2005-08-30 19:45 bpk + + * edit.c: Fixed initializing default completions using new command + structures + +2005-06-10 17:18 bpk + + * powwow.doc: Added #module documentation + +2005-06-03 06:58 bpk + + * main.c: Applied patch from Michael Sterrett + that fixes the code that locates the + copyright file + +2005-04-05 06:40 bpk + + * main.c: Changed some contact info to bpk@hoopajoo.net for bug + reports + +2005-04-05 06:11 bpk + + * powwow.doc: Added documentation of the #group command and line + continuation + +2005-04-05 06:06 bpk + + * cmd.c: Added line-continuation support to the #ex command + +2005-04-04 21:00 bpk + + * README: Updated build-process information and updated where bugs + and patches should be sent to + +2005-03-22 00:17 bpk + + * NEWS: Updated news + * NEWS, edit.c: Added 1.2.8 news, fixed but in upcase/downcase + word (Dain) + +2005-03-21 22:55 bpk + + * Makefile.am, Makefile.in, cmd.c, configure, configure.in, + debian/changelog, debian/control: Updated debian version, make + #module loaded objects export their symbols globally (needed to + allow binary xs modules in perl to get to each others symbols) + +2005-03-21 21:41 bpk + + * README.modules: A rough overview of module support + +2005-03-21 21:35 bpk + + * plugtest.c: use tty_printf since printf will not work with + locales + +2005-03-21 21:21 bpk + + * Makefile.am, Makefile.in, configure, configure.in: Install + powwow.doc and powwow.help in $pkgdatadir/ and also set + POWWOW_DIR to match so that online help should be found after a + "make install" + +2005-03-21 21:14 bpk + + * powwow.help: Added help on #module + +2005-03-21 20:56 bpk + + * cmd.c: Moved #module before #movie + +2005-03-21 20:49 bpk + + * cmd2.c, configure, configure.in, main.c, tty.c, tty.h: Wide + character (locale) support from Dain, changed output of the + compiled options line since there are more compile time options + now + +2005-03-21 18:49 bpk + + * cmd.c, cmd2.c, edit.c, eval.c, log.c, main.c, main.h, map.c, + tcp.c, utils.c: Internally renamed some option flags to match + their #opt counterparts: echo_int => opt_info echo_key => + opt_keyecho echo_ext => opt_echo As per the 1.2.6-dain patch + +2005-03-21 18:40 bpk + + * Hacking, README, README.follow, README.term, TODO, beam.c, + cmd.c, cmd2.c, configure, defines.h, eval.c, list.c, log.c, + main.c, movie.c, ptr.h, tcp.c, tty.c, utils.c: Convert all `' to + "" as per the powwow-1.2.6-dain patch. Note I did not apply the + patch since 1.2.7 has some differences to 1.2.5 with regard to + command handling and things, so I'm applying the diff parts by + hand mostly + +2005-03-21 18:16 bpk + + * cmd.c: Don't include dlfcn.h if no libdl + +2005-03-21 18:13 bpk + + * configure.in: Check for libdl + * cmd.c: Do not include #module support if there is no libdl + +2005-03-13 02:18 bpk + + * Makefile.am, Makefile.in, aclocal.m4: Updated to include the + debian build files in the make dist, also regenerated some of + teh automake/conf stuff + +2005-03-12 05:05 bpk + + * cmd.c, ptr.h: Made #module print messages prefixed with #module + instead of #lib, also display the path to the library that was + loaded so that if testing new libraries you can tell which one + was found :p + +2005-03-12 02:43 bpk + + * cmd.c, ptr.h: Changed #module to not require the .so extension, + and added some checks for _GNU_SOURCE in ptr.h so that modules + compiled with GNU externsions will work with powwow.h (like perl) + +2005-03-12 00:41 bpk + + * cmd.c: Changed the #module command to handle searching multiple + (currently compiled in) library paths, and remove the + requirement for the .so part of the filename so that in future + versions we can support .dll under cygwin + +2005-03-12 00:27 bpk + + * AUTHORS, COPYING, ChangeLog.old, Config.demo, Hacking, INSTALL, + Makefile.am, Makefile.in, NEWS, README, README.follow, + README.term, TODO, aclocal.m4, beam.c, beam.h, catrw.c, cmd.c, + cmd.h, cmd2.c, cmd2.h, configure, configure.in, debian, + debian/changelog, debian/control, debian/rules, defines.h, + depcomp, edit.c, edit.h, eval.c, eval.h, follow.c, install-sh, + list.c, list.h, log.c, log.h, main.c, main.h, map.c, map.h, + missing, mkinstalldirs, movie.c, muc.c, plugtest.c, powwow.6, + powwow.doc, powwow.help, ptr.c, ptr.h, tcp.c, tcp.h, tty.c, + tty.h, utils.c, utils.h: Initial revision + +2005-03-12 00:27 + + * projects/powwow/branches, projects/powwow/tags, .: New + repository initialized by cvs2svn. + 2004-07-01 12:05 bpk * main.c: Bug/enhancement fix, # followed by nothing is now diff --git a/edit.c b/edit.c index 2dc1865..ba283ee 100644 --- a/edit.c +++ b/edit.c @@ -107,6 +107,21 @@ int lookup_edit_function __P1 (function_str,funct) return 0; } +/* return pointer to any unterminated escape code at the end of s */ +static char *find_partial_esc __P1 (char *,s) +{ + size_t len = strlen(s); + char *end = s + len; + while (end > s) { + char c = *--end; + if (c == '\033') + return end; + if (isalpha(c)) + return NULL; + } + return NULL; +} + /* * redisplay the prompt * assume cursor is at beginning of line @@ -114,12 +129,23 @@ int lookup_edit_function __P1 (function_str,funct) void draw_prompt __P0 (void) { if (promptlen && prompt_status == 1) { + char *esc, *pstr; int e = error; error = 0; marked_prompt = ptraddmarks(marked_prompt, prompt->str); if (MEM_ERROR) { promptzero(); errmsg("malloc(prompt)"); return; } - tty_puts(ptrdata(marked_prompt)); - col0 = printstrlen(promptstr); /* same as printstrlen(marked_prompt) */ + + /* if prompt ends in unterminated escape code, do not print + * that part */ + pstr = ptrdata(marked_prompt); + esc = find_partial_esc(pstr); + if (esc) + *esc = 0; + tty_puts(pstr); + col0 = printstrlen(pstr); + if (esc) + *esc = '\033'; + error = e; } prompt_status = 0; -- cgit v0.10.2