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.164 by sf-exg, Fri May 25 08:27:47 2012 UTC vs.
Revision 1.169 by sf-exg, Wed Jun 6 22:00:20 2012 UTC

192 RSTRG (Rs_color + Color_cursor2, "cursorColor2", "color"), 192 RSTRG (Rs_color + Color_cursor2, "cursorColor2", "color"),
193#endif /* NO_CURSORCOLOR */ 193#endif /* NO_CURSORCOLOR */
194 STRG (Rs_color + Color_pointer_fg, "pointerColor", "pr", "color", "pointer color"), 194 STRG (Rs_color + Color_pointer_fg, "pointerColor", "pr", "color", "pointer color"),
195 STRG (Rs_color + Color_pointer_bg, "pointerColor2", "pr2", "color", "pointer bg color"), 195 STRG (Rs_color + Color_pointer_bg, "pointerColor2", "pr2", "color", "pointer bg color"),
196 STRG (Rs_color + Color_border, "borderColor", "bd", "color", "border color"), 196 STRG (Rs_color + Color_border, "borderColor", "bd", "color", "border color"),
197#ifdef BG_IMAGE_FROM_FILE 197#if BG_IMAGE_FROM_FILE
198 RSTRG (Rs_path, "path", "search path"), 198 RSTRG (Rs_path, "path", "search path"),
199 STRG (Rs_backgroundPixmap, "backgroundPixmap", "pixmap", "file[;geom]", "background pixmap"), 199 STRG (Rs_backgroundPixmap, "backgroundPixmap", "pixmap", "file[;geom]", "background pixmap"),
200# if ENABLE_EWMH 200# if ENABLE_EWMH
201 STRG (Rs_iconfile, "iconFile", "icon", "file", "path to application icon image"), 201 STRG (Rs_iconfile, "iconFile", "icon", "file", "path to application icon image"),
202# endif 202# endif
207 STRG (Rs_boldFont, "boldFont", "fb", "fontname", "bold font"), 207 STRG (Rs_boldFont, "boldFont", "fb", "fontname", "bold font"),
208 STRG (Rs_italicFont, "italicFont", "fi", "fontname", "italic font"), 208 STRG (Rs_italicFont, "italicFont", "fi", "fontname", "italic font"),
209 STRG (Rs_boldItalicFont, "boldItalicFont", "fbi", "fontname", "bold italic font"), 209 STRG (Rs_boldItalicFont, "boldItalicFont", "fbi", "fontname", "bold italic font"),
210 BOOL (Rs_intensityStyles, "intensityStyles", "is", Opt_intensityStyles, 0, "font styles imply intensity changes"), 210 BOOL (Rs_intensityStyles, "intensityStyles", "is", Opt_intensityStyles, 0, "font styles imply intensity changes"),
211#endif 211#endif
212#ifdef USE_XIM 212#if USE_XIM
213 STRG (Rs_inputMethod, "inputMethod", "im", "name", "name of input method"), 213 STRG (Rs_inputMethod, "inputMethod", "im", "name", "name of input method"),
214 STRG (Rs_preeditType, "preeditType", "pt", "style", "input style: style = OverTheSpot|OffTheSpot|Root"), 214 STRG (Rs_preeditType, "preeditType", "pt", "style", "input style: style = OverTheSpot|OffTheSpot|Root"),
215 STRG (Rs_imLocale, "imLocale", "imlocale", "string", "locale to use for input method"), 215 STRG (Rs_imLocale, "imLocale", "imlocale", "string", "locale to use for input method"),
216 STRG (Rs_imFont, "imFont", "imfont", "fontname", "fontset for styles OverTheSpot and OffTheSpot"), 216 STRG (Rs_imFont, "imFont", "imfont", "fontname", "fontset for styles OverTheSpot and OffTheSpot"),
217#endif /* USE_XIM */ 217#endif /* USE_XIM */
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
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"
455 464
456 for (i = 0; i < ecb_array_length (optList); i++) 465 for (i = 0; i < ecb_array_length (optList); i++)
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 + 2 - 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");
531 * default values 546 * default values
532 */ 547 */
533 548
534 if (optList[entry].doff != -1) 549 if (optList[entry].doff != -1)
535 { 550 {
536 if (flag && i+1 == argc) 551 if (flag && i + 1 == argc)
537 rxvt_fatal ("option '%s' requires an argument, aborting.\n", argv [i]); 552 rxvt_fatal ("option '%s' requires an argument, aborting.\n", argv [i]);
538 553
539 rs[optList[entry].doff] = flag ? argv[++i] : resval_undef; 554 rs[optList[entry].doff] = flag ? argv[++i] : resval_undef;
540 } 555 }
541 } 556 }
549 } 564 }
550 } 565 }
551#ifndef NO_RESOURCES 566#ifndef NO_RESOURCES
552 else if (!strcmp (opt, "xrm")) 567 else if (!strcmp (opt, "xrm"))
553 { 568 {
554 if (i+1 < argc) 569 if (i + 1 < argc)
555 XrmPutLineResource (&option_db, argv[++i]); 570 XrmPutLineResource (&option_db, argv[++i]);
556 } 571 }
557#endif 572#endif
558#ifdef KEYSYM_RESOURCE 573#ifdef KEYSYM_RESOURCE
559 else if (!strncmp (opt, "keysym.", sizeof ("keysym.") - 1)) 574 else if (!strncmp (opt, "keysym.", sizeof ("keysym.") - 1))
560 { 575 {
561 if (i+1 < argc) 576 if (i + 1 < argc)
562 { 577 {
563 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);
564 sprintf (res, "*.%s: %s\n", opt, argv[i]); 579 sprintf (res, "*.%s: %s\n", opt, argv[i]);
565 XrmPutLineResource (&option_db, res); 580 XrmPutLineResource (&option_db, res);
566 } 581 }
567 } 582 }
568#endif 583#endif
569 else if (!strcmp (opt, "e")) 584 else if (!strcmp (opt, "e"))
570 { 585 {
571 if (i+1 == argc) 586 if (i + 1 < argc)
572 rxvt_fatal ("option '-e' requires an argument, aborting.\n");
573
574 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;
575 } 591 }
576 else 592 else
577 { 593 {
594#if ENABLE_PERL
595 rxvt_perl.init (this);
596
597 if (int flags = rxvt_perl.parse_resource (this, opt, true, longopt, flag, argv [i + 1]))
598 {
599 if (flags & rxvt_perl.RESOURCE_ARG)
600 {
601 if (i + 1 == argc)
602 {
603 rxvt_warn ("option '%s' requires an argument.\n", argv [i]);
578 bad_option = 1; 604 bad_option = 1;
605 }
606 else
607 ++i;
608 }
609 }
610 else
611#endif
612 {
579 rxvt_warn ("\"%s\": unknown or malformed option.\n", opt); 613 rxvt_warn ("\"%s\": unknown or malformed option.\n", opt);
614 bad_option = 1;
615 }
580 } 616 }
581 } 617 }
582 618
583 if (bad_option) 619 if (bad_option)
584 rxvt_usage (0); 620 rxvt_usage (0);
795#if !defined NO_RESOURCES && defined KEYSYM_RESOURCE 831#if !defined NO_RESOURCES && defined KEYSYM_RESOURCE
796 find_resources ("keysym", "Keysym", XrmEnumOneLevel, rxvt_define_key); 832 find_resources ("keysym", "Keysym", XrmEnumOneLevel, rxvt_define_key);
797#endif 833#endif
798} 834}
799 835
800#if !defined NO_RESOURCES && (defined KEYSYM_RESOURCE || defined BG_IMAGE_FROM_FILE) 836#if !defined NO_RESOURCES && defined KEYSYM_RESOURCE
801void 837void
802rxvt_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,
803 Bool (*proc)(XrmDatabase *, XrmBindingList, XrmQuarkList, XrmRepresentation *, XrmValue *, XPointer)) 839 Bool (*proc)(XrmDatabase *, XrmBindingList, XrmQuarkList, XrmRepresentation *, XrmValue *, XPointer))
804{ 840{
805 /* 841 /*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines