ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.415 by root, Sat Apr 26 03:37:18 2008 UTC vs.
Revision 1.417 by root, Mon Jul 21 16:51:31 2008 UTC

2179 wchar_t ch = NOCHAR; 2179 wchar_t ch = NOCHAR;
2180 char *seq_begin; // remember start of esc-sequence here 2180 char *seq_begin; // remember start of esc-sequence here
2181 2181
2182 for (;;) 2182 for (;;)
2183 { 2183 {
2184 if (ch == NOCHAR) 2184 if (expect_false (ch == NOCHAR))
2185 { 2185 {
2186 seq_begin = cmdbuf_ptr; 2186 seq_begin = cmdbuf_ptr;
2187 ch = next_char (); 2187 ch = next_char ();
2188 2188
2189 if (ch == NOCHAR) 2189 if (ch == NOCHAR)
2190 break; 2190 break;
2191 } 2191 }
2192 2192
2193 if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) 2193 if (expect_true (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT))
2194 { 2194 {
2195 if (!seen_input) 2195 if (expect_false (!seen_input))
2196 { 2196 {
2197 seen_input = 1; 2197 seen_input = 1;
2198 // many badly-written programs (e.g. jed) contain a race condition: 2198 // many badly-written programs (e.g. jed) contain a race condition:
2199 // they first read the screensize and then install a SIGWINCH handler. 2199 // they first read the screensize and then install a SIGWINCH handler.
2200 // some window managers resize the window early, and these programs 2200 // some window managers resize the window early, and these programs
2213 wchar_t *str = buf; 2213 wchar_t *str = buf;
2214 wchar_t *eol = str + min (ncol, UBUFSIZ); 2214 wchar_t *eol = str + min (ncol, UBUFSIZ);
2215 2215
2216 for (;;) 2216 for (;;)
2217 { 2217 {
2218 if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) 2218 if (expect_false (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)))
2219 break; 2219 break;
2220 2220
2221 *str++ = ch; 2221 *str++ = ch;
2222 2222
2223 if (ch == C0_LF || str >= eol) 2223 if (expect_false (ch == C0_LF || str >= eol))
2224 { 2224 {
2225 if (ch == C0_LF) 2225 if (ch == C0_LF)
2226 nlines++; 2226 nlines++;
2227 2227
2228 refresh_count++; 2228 refresh_count++;
2310rxvt_term::next_char () NOTHROW 2310rxvt_term::next_char () NOTHROW
2311{ 2311{
2312 while (cmdbuf_ptr < cmdbuf_endp) 2312 while (cmdbuf_ptr < cmdbuf_endp)
2313 { 2313 {
2314 // assume 7-bit to be ascii ALWAYS 2314 // assume 7-bit to be ascii ALWAYS
2315 if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) 2315 if (expect_true ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b))
2316 return *cmdbuf_ptr++; 2316 return *cmdbuf_ptr++;
2317 2317
2318 wchar_t wc; 2318 wchar_t wc;
2319 size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); 2319 size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate);
2320 2320
2381/*----------------------------------------------------------------------*/ 2381/*----------------------------------------------------------------------*/
2382#ifdef PRINTPIPE 2382#ifdef PRINTPIPE
2383FILE * 2383FILE *
2384rxvt_term::popen_printer () 2384rxvt_term::popen_printer ()
2385{ 2385{
2386 FILE *stream = popen (rs[Rs_print_pipe], "w"); 2386 FILE *stream = popen (rs[Rs_print_pipe] ? rs[Rs_print_pipe] : PRINTPIPE, "w");
2387 2387
2388 if (stream == NULL) 2388 if (stream == NULL)
2389 rxvt_warn ("can't open printer pipe, not printing.\n"); 2389 rxvt_warn ("can't open printer pipe, not printing.\n");
2390 2390
2391 return stream; 2391 return stream;
2402 * simulate attached vt100 printer 2402 * simulate attached vt100 printer
2403 */ 2403 */
2404void 2404void
2405rxvt_term::process_print_pipe () 2405rxvt_term::process_print_pipe ()
2406{ 2406{
2407 int done; 2407 FILE *fd = popen_printer ();
2408 FILE *fd;
2409 2408
2410 if ((fd = popen_printer ()) == NULL) 2409 if (!fd)
2411 return; 2410 return;
2412 2411
2413 /* 2412 /*
2414 * 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
2415 * is received. 2414 * is received.
2416 */ 2415 */
2417 for (done = 0; !done;) 2416 for (int done = 0; !done; )
2418 { 2417 {
2419 unsigned char buf[8]; 2418 unsigned char buf[8];
2420 unicode_t ch; 2419 unicode_t ch;
2421 unsigned int i, len; 2420 unsigned int i, len;
2422 2421

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines