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

Comparing rxvt-unicode/src/xdefaults.C (file contents):
Revision 1.165 by root, Mon Jun 4 15:18:53 2012 UTC vs.
Revision 1.167 by root, Tue Jun 5 22:23:07 2012 UTC

392const char rxvt_term::resval_on [] = "on"; 392const char rxvt_term::resval_on [] = "on";
393const char rxvt_term::resval_off [] = "off"; 393const char rxvt_term::resval_off [] = "off";
394 394
395/*{{{ usage: */ 395/*{{{ usage: */
396/*----------------------------------------------------------------------*/ 396/*----------------------------------------------------------------------*/
397static void 397void
398rxvt_usage (int type) 398rxvt_term::rxvt_usage (int type)
399{ 399{
400 unsigned int i, col; 400 unsigned int i, col;
401 401
402 rxvt_log ("%s%s%s", releasestring, optionsstring, RESNAME); 402 rxvt_log ("%s%s%s", releasestring, optionsstring, RESNAME);
403 403
411 { 411 {
412 int len = 0; 412 int len = 0;
413 413
414 if (optList[i].arg) 414 if (optList[i].arg)
415 len = strlen (optList[i].arg) + 1; 415 len = strlen (optList[i].arg) + 1;
416
416 assert (optList[i].opt != NULL); 417 assert (optList[i].opt != NULL);
417 len += 4 + strlen (optList[i].opt) + (optList_isBool (i) ? 2 : 0); 418 len += 4 + strlen (optList[i].opt) + (optList_isBool (i) ? 2 : 0);
418 col += len; 419 col += len;
420
419 if (col > 79) 421 if (col > 79)
420 { 422 {
421 /* assume regular width */ 423 /* assume regular width */
422 rxvt_log ("\n"); 424 rxvt_log ("\n");
423 col = 1 + len; 425 col = 1 + len;
424 } 426 }
425 427
426 rxvt_log (" [-%s%s", (optList_isBool (i) ? "/+" : ""), optList[i].opt); 428 rxvt_log (" [-%s%s", (optList_isBool (i) ? "/+" : ""), optList[i].opt);
429
427 if (optList[i].arg) 430 if (optList[i].arg)
428 rxvt_log (" %s]", optList[i].arg); 431 rxvt_log (" %s]", optList[i].arg);
429 else 432 else
430 rxvt_log ("]"); 433 rxvt_log ("]");
431 } 434 }
444 + (optList_isBool (i) ? 0 : 2)), 447 + (optList_isBool (i) ? 0 : 2)),
445 (optList[i].arg ? optList[i].arg : ""), 448 (optList[i].arg ? optList[i].arg : ""),
446 (optList_isBool (i) ? "turn on/off " : ""), 449 (optList_isBool (i) ? "turn on/off " : ""),
447 optList[i].desc); 450 optList[i].desc);
448 } 451 }
452
453#if ENABLE_PERL
454 rxvt_perl.init (this);
455 rxvt_perl.usage (this, 1);
456#endif
457
449 rxvt_log ("\n --help to list long-options"); 458 rxvt_log ("\n --help to list long-options");
450 break; 459 break;
451 460
452 case 2: /* full resource listing */ 461 case 2: /* full resource listing */
453 rxvt_log (" [options] [-e command args]\n\n" 462 rxvt_log (" [options] [-e command args]\n\n"
457 if (optList[i].kw != NULL) 466 if (optList[i].kw != NULL)
458 rxvt_log (" %s: %*s%s\n", 467 rxvt_log (" %s: %*s%s\n",
459 optList[i].kw, 468 optList[i].kw,
460 (INDENT - strlen (optList[i].kw)), "", /* XXX */ 469 (INDENT - strlen (optList[i].kw)), "", /* XXX */
461 (optList_isBool (i) ? "boolean" : optList[i].arg)); 470 (optList_isBool (i) ? "boolean" : optList[i].arg));
471
472#if ENABLE_PERL
473 rxvt_perl.init (this);
474 rxvt_perl.usage (this, 2);
475#endif
476
462 rxvt_log ("\n -help to list options"); 477 rxvt_log ("\n -help to list options");
463 break; 478 break;
464 } 479 }
465 480
466 rxvt_log ("\n\n"); 481 rxvt_log ("\n\n");
573 588
574 return (const char **)argv + i + 1; 589 return (const char **)argv + i + 1;
575 } 590 }
576 else 591 else
577 { 592 {
593#if ENABLE_PERL
594 rxvt_perl.init (this);
595
596 if (int flags = rxvt_perl.resource (this, opt, true, longopt, flag, argv [i + 1]))
597 {
598 if ((!flags & rxvt_perl.RESOURCE_BOOLEAN))
599 {
600 if (flag && i + 1 == argc)
601 rxvt_fatal ("option '%s' requires an argument, aborting.\n", argv [i]);
602
603 ++i;
604 }
605 }
606 else
607#endif
608 {
578 bad_option = 1; 609 bad_option = 1;
579 rxvt_warn ("\"%s\": unknown or malformed option.\n", opt); 610 rxvt_warn ("\"%s\": unknown or malformed option.\n", opt);
611 }
580 } 612 }
581 } 613 }
582 614
583 if (bad_option) 615 if (bad_option)
584 rxvt_usage (0); 616 rxvt_usage (0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines