To: vim-dev@vim.org Subject: Patch 6.4.010 (extra) Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.4.010 (extra) Problem: VMS: Reading typed characters in console mode is inefficient and may not read escape sequences correctly. Solution: Improve the vms_read() function. (Zoltan Arpadffy) Files: src/os_vms.c *** ../vim-6.4.009/src/os_vms.c Tue Jun 14 19:03:58 2005 --- src/os_vms.c Mon Mar 20 14:55:07 2006 *************** *** 300,330 **** { int status, function, len; TT_MODE tt_mode; ! ITEM itmlst[3]; static long trm_mask[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; /* whatever happened earlier we need an iochan here */ if (!iochan) tt_mode = get_tty(); vul_item(&itmlst[0], 0, TRM$_MODIFIERS, ! (char *)( TRM$M_TM_ESCAPE | TRM$M_TM_TIMED | TRM$M_TM_NOECHO | ! TRM$M_TM_NOEDIT | TRM$M_TM_NOFILTR | ! TRM$M_TM_NORECALL| TRM$M_TM_TRMNOECHO), 0); ! vul_item(&itmlst[1], 0, TRM$_TIMEOUT, (char *) 1, 0 ); ! vul_item(&itmlst[2], sizeof(trm_mask), TRM$_TERM, (char *)&trm_mask, 0); function = (IO$_READLBLK | IO$M_EXTEND); ! memset(inbuf, 0, nbytes); - while (1) - { - status = sys$qiow(0, iochan, function, &iosb, 0, 0, inbuf, nbytes - 1, - 0, 0, &itmlst, sizeof(itmlst)); - len = strlen(inbuf); - if (len > 0) - break; - } return len; } --- 300,335 ---- { int status, function, len; TT_MODE tt_mode; ! ITEM itmlst[2]; /* terminates on everything */ static long trm_mask[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; /* whatever happened earlier we need an iochan here */ if (!iochan) tt_mode = get_tty(); + /* important: clean the inbuf */ + memset(inbuf, 0, nbytes); + + /* set up the itemlist for the first read */ vul_item(&itmlst[0], 0, TRM$_MODIFIERS, ! (char *)( TRM$M_TM_NOECHO | TRM$M_TM_NOEDIT | ! TRM$M_TM_NOFILTR | TRM$M_TM_TRMNOECHO | ! TRM$M_TM_NORECALL) , 0); ! vul_item(&itmlst[1], sizeof(trm_mask), TRM$_TERM, (char *)&trm_mask, 0); + /* wait forever for a char */ function = (IO$_READLBLK | IO$M_EXTEND); ! status = sys$qiow(0, iochan, function, &iosb, 0, 0, ! inbuf, nbytes-1, 0, 0, &itmlst, sizeof(itmlst)); ! len = strlen(inbuf); /* how many chars we got? */ ! ! /* read immedatelly the rest in the IO queue */ ! function = (IO$_READLBLK | IO$M_TIMED | IO$M_ESCAPE | IO$M_NOECHO | IO$M_NOFILTR); ! status = sys$qiow(0, iochan, function, &iosb, 0, 0, ! inbuf+len, nbytes-1-len, 0, 0, 0, 0); ! ! len = strlen(inbuf); /* return the total length */ return len; } *** ../vim-6.4.009/src/version.c Wed Mar 15 11:28:16 2006 --- src/version.c Mon Mar 20 14:58:33 2006 *************** *** 643,644 **** --- 643,646 ---- { /* Add new patch number below this line */ + /**/ + 10, /**/ -- hundred-and-one symptoms of being an internet addict: 181. You make up words that go with the "happy tune" your modem makes while dialing your ISP. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://www.ICCF.nl ///