Commit 08b4ef42 authored by Jehan's avatar Jehan

Just a few variable renaming...

parent 287b3e94
......@@ -6978,12 +6978,14 @@ rxvt_tt_printf(rxvt_t* r, int page, const char *fmt,...)
/* Addresses pasting large amounts of data and rxvt hang
* code pinched from xterm (v_write()) and applied originally to
* rxvt-2.18 - Hops
* Write data to the pty as typed by the user, pasted with the mouse,
* Write data to the child's pty as typed by the user, pasted with the mouse,
* or generated by us in response to a query ESC sequence.
* If len = 0, this function can be used to simply write any pending data
* in the input buffer to the child.
*/
/* EXTPROTO */
void
rxvt_tt_write(rxvt_t* r, int page, const unsigned char *d, int len)
rxvt_tt_write (rxvt_t* r, int page, const unsigned char *str, int len)
{
#define MAX_PTY_WRITE 128 /* 1/2 POSIX minimum MAX_INPUT */
register int k, beg, end;
......@@ -6999,7 +7001,7 @@ rxvt_tt_write(rxvt_t* r, int page, const unsigned char *d, int len)
for (k = beg; k <= end; k ++)
{
int riten;
int written;
int p;
/* start of physical buffer */
unsigned char* inbuf_base;
......@@ -7010,13 +7012,19 @@ rxvt_tt_write(rxvt_t* r, int page, const unsigned char *d, int len)
/* remaining room in physical buffer */
int inbuf_room;
rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "rxvt_tt_write %d (%s)\n", k, d ? (char*) d: "nil"));
rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "rxvt_tt_write (r, %d, %s, %d)\n", k, str ? (char*) str: "nil", len));
if (IS_NULL(PVTS(r, k)->inbuf_start) && len > 0)
{
p = (len / MAX_PTY_WRITE + 1) * MAX_PTY_WRITE;
if (p <= 0) /* possible integer overflow */
return ;
if (p <= 0)
{
/* possible integer overflow
* Or maybe len was already < 0. */
rxvt_msg (DBG_ERROR, DBG_COMMAND,
"\e[31Possible integer overflow or logical error in rxvt_tt_write: probable data loss.\e[0m\n");
return;
}
inbuf_base = inbuf_start = inbuf_end = rxvt_malloc(p);
inbuf_room = p;
}
......@@ -7076,7 +7084,7 @@ rxvt_tt_write(rxvt_t* r, int page, const unsigned char *d, int len)
if (inbuf_room >= len)
{
/* new stuff will fit */
MEMCPY(inbuf_end, d, len);
MEMCPY(inbuf_end, str, len);
inbuf_end += len;
}
}
......@@ -7097,11 +7105,11 @@ rxvt_tt_write(rxvt_t* r, int page, const unsigned char *d, int len)
if ((p = inbuf_end - inbuf_start) > 0)
{
riten = write(PVTS(r, k)->cmd_fd, inbuf_start, min(p, MAX_PTY_WRITE));
rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "tt_write %d chars to vts[%d].cmd_fd = %d\n", riten, k, PVTS(r, k)->cmd_fd));
if (riten < 0)
riten = 0;
inbuf_start += riten;
written = write (PVTS(r, k)->cmd_fd, inbuf_start, min (p, MAX_PTY_WRITE));
rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "\t%d bytes have been written to vts[%d].cmd_fd = %d\n", written, k, PVTS(r, k)->cmd_fd));
if (written < 0)
written = 0;
inbuf_start += written;
if (inbuf_start >= inbuf_end) /* we wrote it all */
inbuf_start = inbuf_end = inbuf_base;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment