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.166 by root, Tue Jun 5 19:32:29 2012 UTC vs.
Revision 1.169 by sf-exg, Wed Jun 6 22:00:20 2012 UTC

384#if defined(XTERM_SCROLLBAR) 384#if defined(XTERM_SCROLLBAR)
385 "+xterm" 385 "+xterm"
386#endif 386#endif
387 "\nUsage: "; /* Usage */ 387 "\nUsage: "; /* Usage */
388 388
389#define INDENT 18 389#define INDENT 28
390 390
391const char rxvt_term::resval_undef [] = "<undef>"; 391const char rxvt_term::resval_undef [] = "<undef>";
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
447 + (optList_isBool (i) ? 0 : 2)), 447 + (optList_isBool (i) ? 0 : 2)),
448 (optList[i].arg ? optList[i].arg : ""), 448 (optList[i].arg ? optList[i].arg : ""),
449 (optList_isBool (i) ? "turn on/off " : ""), 449 (optList_isBool (i) ? "turn on/off " : ""),
450 optList[i].desc); 450 optList[i].desc);
451 } 451 }
452
453#if ENABLE_PERL
454 rxvt_perl.init (this);
455 rxvt_perl.usage (this, 1);
456#endif
457
452 rxvt_log ("\n --help to list long-options"); 458 rxvt_log ("\n --help to list long-options");
453 break; 459 break;
454 460
455 case 2: /* full resource listing */ 461 case 2: /* full resource listing */
456 rxvt_log (" [options] [-e command args]\n\n" 462 rxvt_log (" [options] [-e command args]\n\n"
458 464
459 for (i = 0; i < ecb_array_length (optList); i++) 465 for (i = 0; i < ecb_array_length (optList); i++)
460 if (optList[i].kw != NULL) 466 if (optList[i].kw != NULL)
461 rxvt_log (" %s: %*s%s\n", 467 rxvt_log (" %s: %*s%s\n",
462 optList[i].kw, 468 optList[i].kw,
463 (INDENT - strlen (optList[i].kw)), "", /* XXX */ 469 (INDENT + 2 - strlen (optList[i].kw)), "", /* XXX */
464 (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
465 rxvt_log ("\n -help to list options"); 477 rxvt_log ("\n -help to list options");
466 break; 478 break;
467 } 479 }
468
469#if ENABLE_PERL
470 if (type) // do not initialise perl for type == 0, as perl does not have "short" options
471 {
472 rxvt_perl.init (this);
473 rxvt_perl.usage (type);
474 }
475#endif
476 480
477 rxvt_log ("\n\n"); 481 rxvt_log ("\n\n");
478 rxvt_exit_failure (); 482 rxvt_exit_failure ();
479} 483}
480 484
542 * default values 546 * default values
543 */ 547 */
544 548
545 if (optList[entry].doff != -1) 549 if (optList[entry].doff != -1)
546 { 550 {
547 if (flag && i+1 == argc) 551 if (flag && i + 1 == argc)
548 rxvt_fatal ("option '%s' requires an argument, aborting.\n", argv [i]); 552 rxvt_fatal ("option '%s' requires an argument, aborting.\n", argv [i]);
549 553
550 rs[optList[entry].doff] = flag ? argv[++i] : resval_undef; 554 rs[optList[entry].doff] = flag ? argv[++i] : resval_undef;
551 } 555 }
552 } 556 }
560 } 564 }
561 } 565 }
562#ifndef NO_RESOURCES 566#ifndef NO_RESOURCES
563 else if (!strcmp (opt, "xrm")) 567 else if (!strcmp (opt, "xrm"))
564 { 568 {
565 if (i+1 < argc) 569 if (i + 1 < argc)
566 XrmPutLineResource (&option_db, argv[++i]); 570 XrmPutLineResource (&option_db, argv[++i]);
567 } 571 }
568#endif 572#endif
569#ifdef KEYSYM_RESOURCE 573#ifdef KEYSYM_RESOURCE
570 else if (!strncmp (opt, "keysym.", sizeof ("keysym.") - 1)) 574 else if (!strncmp (opt, "keysym.", sizeof ("keysym.") - 1))
571 { 575 {
572 if (i+1 < argc) 576 if (i + 1 < argc)
573 { 577 {
574 char *res = rxvt_temp_buf<char> (strlen (opt) + strlen (argv[++i]) + 6); 578 char *res = rxvt_temp_buf<char> (strlen (opt) + strlen (argv[++i]) + 6);
575 sprintf (res, "*.%s: %s\n", opt, argv[i]); 579 sprintf (res, "*.%s: %s\n", opt, argv[i]);
576 XrmPutLineResource (&option_db, res); 580 XrmPutLineResource (&option_db, res);
577 } 581 }
578 } 582 }
579#endif 583#endif
580 else if (!strcmp (opt, "e")) 584 else if (!strcmp (opt, "e"))
581 { 585 {
582 if (i+1 == argc) 586 if (i + 1 < argc)
583 rxvt_fatal ("option '-e' requires an argument, aborting.\n");
584
585 return (const char **)argv + i + 1; 587 return (const char **)argv + i + 1;
588
589 rxvt_warn ("option '-e' requires an argument, aborting.\n");
590 bad_option = 1;
586 } 591 }
587 else 592 else
588 { 593 {
589#if ENABLE_PERL 594#if ENABLE_PERL
590 rxvt_perl.init (this); 595 rxvt_perl.init (this);
591 596
592 if (int flags = rxvt_perl.resource (this, opt, true, longopt, flag, argv [i + 1])) 597 if (int flags = rxvt_perl.parse_resource (this, opt, true, longopt, flag, argv [i + 1]))
593 { 598 {
594 if ((!flags & rxvt_perl.RESOURCE_BOOLEAN)) 599 if (flags & rxvt_perl.RESOURCE_ARG)
595 { 600 {
596 if (flag && i + 1 == argc) 601 if (i + 1 == argc)
602 {
597 rxvt_fatal ("option '%s' requires an argument, aborting.\n", argv [i]); 603 rxvt_warn ("option '%s' requires an argument.\n", argv [i]);
598 604 bad_option = 1;
605 }
606 else
599 ++i; 607 ++i;
600 } 608 }
601 } 609 }
602 else 610 else
603#endif 611#endif
604 { 612 {
613 rxvt_warn ("\"%s\": unknown or malformed option.\n", opt);
605 bad_option = 1; 614 bad_option = 1;
606 rxvt_warn ("\"%s\": unknown or malformed option.\n", opt);
607 } 615 }
608 } 616 }
609 } 617 }
610 618
611 if (bad_option) 619 if (bad_option)
823#if !defined NO_RESOURCES && defined KEYSYM_RESOURCE 831#if !defined NO_RESOURCES && defined KEYSYM_RESOURCE
824 find_resources ("keysym", "Keysym", XrmEnumOneLevel, rxvt_define_key); 832 find_resources ("keysym", "Keysym", XrmEnumOneLevel, rxvt_define_key);
825#endif 833#endif
826} 834}
827 835
828#if !defined NO_RESOURCES && (defined KEYSYM_RESOURCE || defined BG_IMAGE_FROM_FILE) 836#if !defined NO_RESOURCES && defined KEYSYM_RESOURCE
829void 837void
830rxvt_term::find_resources (const char *n_prefix, const char *c_prefix, int mode, 838rxvt_term::find_resources (const char *n_prefix, const char *c_prefix, int mode,
831 Bool (*proc)(XrmDatabase *, XrmBindingList, XrmQuarkList, XrmRepresentation *, XrmValue *, XPointer)) 839 Bool (*proc)(XrmDatabase *, XrmBindingList, XrmQuarkList, XrmRepresentation *, XrmValue *, XPointer))
832{ 840{
833 /* 841 /*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines