… | |
… | |
2324 | cmdbuf_ptr = cmdbuf_endp; |
2324 | cmdbuf_ptr = cmdbuf_endp; |
2325 | break; |
2325 | break; |
2326 | } |
2326 | } |
2327 | |
2327 | |
2328 | if (len == (size_t)-1) |
2328 | if (len == (size_t)-1) |
|
|
2329 | { |
|
|
2330 | mbrtowc (0, 0, 0, mbstate); // reset now undefined conversion state |
2329 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2331 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
|
|
2332 | } |
2330 | |
2333 | |
2331 | // assume wchar == unicode |
2334 | // assume wchar == unicode |
2332 | cmdbuf_ptr += len; |
2335 | cmdbuf_ptr += len; |
2333 | return wc & UNICODE_MASK; |
2336 | return wc & UNICODE_MASK; |
2334 | } |
2337 | } |
… | |
… | |
2378 | /*----------------------------------------------------------------------*/ |
2381 | /*----------------------------------------------------------------------*/ |
2379 | #ifdef PRINTPIPE |
2382 | #ifdef PRINTPIPE |
2380 | FILE * |
2383 | FILE * |
2381 | rxvt_term::popen_printer () |
2384 | rxvt_term::popen_printer () |
2382 | { |
2385 | { |
2383 | FILE *stream = popen (rs[Rs_print_pipe], "w"); |
2386 | FILE *stream = popen (rs[Rs_print_pipe] ? rs[Rs_print_pipe] : PRINTPIPE, "w"); |
2384 | |
2387 | |
2385 | if (stream == NULL) |
2388 | if (stream == NULL) |
2386 | rxvt_warn ("can't open printer pipe, not printing.\n"); |
2389 | rxvt_warn ("can't open printer pipe, not printing.\n"); |
2387 | |
2390 | |
2388 | return stream; |
2391 | return stream; |
… | |
… | |
2399 | * simulate attached vt100 printer |
2402 | * simulate attached vt100 printer |
2400 | */ |
2403 | */ |
2401 | void |
2404 | void |
2402 | rxvt_term::process_print_pipe () |
2405 | rxvt_term::process_print_pipe () |
2403 | { |
2406 | { |
2404 | int done; |
2407 | FILE *fd = popen_printer (); |
2405 | FILE *fd; |
|
|
2406 | |
2408 | |
2407 | if ((fd = popen_printer ()) == NULL) |
2409 | if (!fd) |
2408 | return; |
2410 | return; |
2409 | |
2411 | |
2410 | /* |
2412 | /* |
2411 | * Send all input to the printer until either ESC[4i or ESC[?4i |
2413 | * Send all input to the printer until either ESC[4i or ESC[?4i |
2412 | * is received. |
2414 | * is received. |
2413 | */ |
2415 | */ |
2414 | for (done = 0; !done;) |
2416 | for (int done = 0; !done; ) |
2415 | { |
2417 | { |
2416 | unsigned char buf[8]; |
2418 | unsigned char buf[8]; |
2417 | unicode_t ch; |
2419 | unicode_t ch; |
2418 | unsigned int i, len; |
2420 | unsigned int i, len; |
2419 | |
2421 | |