Revision e81b440f client/client.c

View differences:

client/client.c
311 311
    }
312 312

  
313 313
  if (nstate == STATE_PROMPT)
314
    if (input_initialized)
315
      input_reveal();
316
    else
317
      input_init();
314
    {
315
      if (input_initialized)
316
	input_reveal();
317
      else
318
	input_init();
319
    }
318 320

  
319 321
  if (nstate != STATE_PROMPT)
320 322
    input_hide();
......
372 374
    die("fcntl: %m");
373 375
}
374 376

  
377
#define PRINTF(LEN, PARGS...) do { if (!skip_input) len = printf(PARGS); } while(0)
378

  
375 379
static void
376 380
server_got_reply(char *x)
377 381
{
......
379 383
  int len = 0;
380 384

  
381 385
  if (*x == '+')			/* Async reply */
382
    skip_input || (len = printf(">>> %s\n", x+1));
386
    PRINTF(len, ">>> %s\n", x+1);
383 387
  else if (x[0] == ' ')			/* Continuation */
384
    skip_input || (len = printf("%s%s\n", verbose ? "     " : "", x+1));
388
    PRINTF(len, "%s%s\n", verbose ? "     " : "", x+1);
385 389
  else if (strlen(x) > 4 &&
386 390
	   sscanf(x, "%d", &code) == 1 && code >= 0 && code < 10000 &&
387 391
	   (x[4] == ' ' || x[4] == '-'))
388 392
    {
389 393
      if (code)
390
	skip_input || (len = printf("%s\n", verbose ? x : x+5));
394
	PRINTF(len, "%s\n", verbose ? x : x+5);
391 395
      if (x[4] == ' ')
392 396
      {
393 397
	nstate = STATE_PROMPT;
......
396 400
      }
397 401
    }
398 402
  else
399
    skip_input || (len = printf("??? <%s>\n", x));
403
    PRINTF(len, "??? <%s>\n", x);
400 404

  
401 405
  if (skip_input)
402 406
    return;

Also available in: Unified diff