--- rxvt-unicode/src/command.C 2008/02/19 10:47:03 1.414 +++ rxvt-unicode/src/command.C 2008/07/15 16:41:22 1.416 @@ -2326,7 +2326,10 @@ } if (len == (size_t)-1) - return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through + { + mbrtowc (0, 0, 0, mbstate); // reset now undefined conversion state + return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through + } // assume wchar == unicode cmdbuf_ptr += len; @@ -2380,7 +2383,7 @@ FILE * rxvt_term::popen_printer () { - FILE *stream = popen (rs[Rs_print_pipe], "w"); + FILE *stream = popen (rs[Rs_print_pipe] ? rs[Rs_print_pipe] : PRINTPIPE, "w"); if (stream == NULL) rxvt_warn ("can't open printer pipe, not printing.\n"); @@ -2401,17 +2404,16 @@ void rxvt_term::process_print_pipe () { - int done; - FILE *fd; + FILE *fd = popen_printer (); - if ((fd = popen_printer ()) == NULL) + if (!fd) return; /* * Send all input to the printer until either ESC[4i or ESC[?4i * is received. */ - for (done = 0; !done;) + for (int done = 0; !done; ) { unsigned char buf[8]; unicode_t ch;