… | |
… | |
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 */ |
… | |
… | |
392 | const char rxvt_term::resval_on [] = "on"; |
392 | const char rxvt_term::resval_on [] = "on"; |
393 | const char rxvt_term::resval_off [] = "off"; |
393 | const char rxvt_term::resval_off [] = "off"; |
394 | |
394 | |
395 | /*{{{ usage: */ |
395 | /*{{{ usage: */ |
396 | /*----------------------------------------------------------------------*/ |
396 | /*----------------------------------------------------------------------*/ |
397 | static void |
397 | void |
398 | rxvt_usage (int type) |
398 | rxvt_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 | } |
… | |
… | |
461 | (optList_isBool (i) ? "boolean" : optList[i].arg)); |
464 | (optList_isBool (i) ? "boolean" : optList[i].arg)); |
462 | rxvt_log ("\n -help to list options"); |
465 | rxvt_log ("\n -help to list options"); |
463 | break; |
466 | break; |
464 | } |
467 | } |
465 | |
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 | |
466 | rxvt_log ("\n\n"); |
477 | rxvt_log ("\n\n"); |
467 | rxvt_exit_failure (); |
478 | rxvt_exit_failure (); |
468 | } |
479 | } |
469 | |
480 | |
470 | /*}}} */ |
481 | /*}}} */ |
… | |
… | |
573 | |
584 | |
574 | return (const char **)argv + i + 1; |
585 | return (const char **)argv + i + 1; |
575 | } |
586 | } |
576 | else |
587 | else |
577 | { |
588 | { |
|
|
589 | #if ENABLE_PERL |
|
|
590 | rxvt_perl.init (this); |
|
|
591 | |
|
|
592 | if (int flags = rxvt_perl.resource (this, opt, true, longopt, flag, argv [i + 1])) |
|
|
593 | { |
|
|
594 | if ((!flags & rxvt_perl.RESOURCE_BOOLEAN)) |
|
|
595 | { |
|
|
596 | if (flag && i + 1 == argc) |
|
|
597 | rxvt_fatal ("option '%s' requires an argument, aborting.\n", argv [i]); |
|
|
598 | |
|
|
599 | ++i; |
|
|
600 | } |
|
|
601 | } |
|
|
602 | else |
|
|
603 | #endif |
|
|
604 | { |
578 | bad_option = 1; |
605 | bad_option = 1; |
579 | rxvt_warn ("\"%s\": unknown or malformed option.\n", opt); |
606 | rxvt_warn ("\"%s\": unknown or malformed option.\n", opt); |
|
|
607 | } |
580 | } |
608 | } |
581 | } |
609 | } |
582 | |
610 | |
583 | if (bad_option) |
611 | if (bad_option) |
584 | rxvt_usage (0); |
612 | rxvt_usage (0); |
… | |
… | |
760 | /* |
788 | /* |
761 | * Query resources for options that affect us |
789 | * Query resources for options that affect us |
762 | */ |
790 | */ |
763 | for (int entry = 0; entry < ecb_array_length (optList); entry++) |
791 | for (int entry = 0; entry < ecb_array_length (optList); entry++) |
764 | { |
792 | { |
765 | int s; |
|
|
766 | const char *kw = optList[entry].kw; |
793 | const char *kw = optList[entry].kw; |
767 | |
794 | |
768 | if (kw == NULL || rs[optList[entry].doff] != NULL) |
795 | if (kw == NULL || rs[optList[entry].doff] != NULL) |
769 | continue; // previously set |
796 | continue; // previously set |
770 | |
797 | |
… | |
… | |
776 | allocated.push_back ((void *)p); |
803 | allocated.push_back ((void *)p); |
777 | rs[optList[entry].doff] = p; |
804 | rs[optList[entry].doff] = p; |
778 | |
805 | |
779 | if (optList_isBool (entry)) |
806 | if (optList_isBool (entry)) |
780 | { |
807 | { |
781 | s = strcasecmp (p, "TRUE") == 0 |
808 | bool s = parse_bool_resource (p); |
782 | || strcasecmp (p, "YES") == 0 |
|
|
783 | || strcasecmp (p, "ON") == 0 |
|
|
784 | || strcasecmp (p, "1") == 0; |
|
|
785 | |
809 | |
786 | if (optList_isReverse (entry)) |
810 | if (optList_isReverse (entry)) |
787 | s = !s; |
811 | s = !s; |
788 | |
812 | |
789 | set_option (optList[entry].index, s); |
813 | set_option (optList[entry].index, s); |
… | |
… | |
794 | } |
818 | } |
795 | |
819 | |
796 | void |
820 | void |
797 | rxvt_term::extract_keysym_resources () |
821 | rxvt_term::extract_keysym_resources () |
798 | { |
822 | { |
799 | #ifndef NO_RESOURCES |
823 | #if !defined NO_RESOURCES && defined KEYSYM_RESOURCE |
|
|
824 | find_resources ("keysym", "Keysym", XrmEnumOneLevel, rxvt_define_key); |
|
|
825 | #endif |
|
|
826 | } |
|
|
827 | |
|
|
828 | #if !defined NO_RESOURCES && (defined KEYSYM_RESOURCE || defined BG_IMAGE_FROM_FILE) |
|
|
829 | void |
|
|
830 | rxvt_term::find_resources (const char *n_prefix, const char *c_prefix, int mode, |
|
|
831 | Bool (*proc)(XrmDatabase *, XrmBindingList, XrmQuarkList, XrmRepresentation *, XrmValue *, XPointer)) |
|
|
832 | { |
800 | /* |
833 | /* |
801 | * [R5 or later]: enumerate the resource database |
834 | * [R5 or later]: enumerate the resource database |
802 | */ |
835 | */ |
803 | # ifdef KEYSYM_RESOURCE |
|
|
804 | XrmDatabase database = XrmGetDatabase (dpy); |
836 | XrmDatabase database = XrmGetDatabase (dpy); |
805 | XrmName name_prefix[3]; |
837 | XrmName name_prefix[3]; |
806 | XrmClass class_prefix[3]; |
838 | XrmClass class_prefix[3]; |
807 | |
839 | |
808 | name_prefix[0] = XrmStringToName (rs[Rs_name]); |
840 | name_prefix[0] = XrmStringToName (rs[Rs_name]); |
809 | name_prefix[1] = XrmStringToName ("keysym"); |
841 | name_prefix[1] = XrmStringToName (n_prefix); |
810 | name_prefix[2] = NULLQUARK; |
842 | name_prefix[2] = NULLQUARK; |
811 | class_prefix[0] = XrmStringToName (RESCLASS); |
843 | class_prefix[0] = XrmStringToName (RESCLASS); |
812 | class_prefix[1] = XrmStringToName ("Keysym"); |
844 | class_prefix[1] = XrmStringToName (c_prefix); |
813 | class_prefix[2] = NULLQUARK; |
845 | class_prefix[2] = NULLQUARK; |
814 | /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ |
846 | /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ |
815 | XrmEnumerateDatabase (database, name_prefix, class_prefix, |
847 | XrmEnumerateDatabase (database, name_prefix, class_prefix, |
816 | XrmEnumOneLevel, rxvt_define_key, NULL); |
848 | mode, proc, NULL); |
817 | # ifdef RESFALLBACK |
849 | # ifdef RESFALLBACK |
818 | name_prefix[0] = class_prefix[0] = XrmStringToName (RESFALLBACK); |
850 | name_prefix[0] = class_prefix[0] = XrmStringToName (RESFALLBACK); |
819 | /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ |
851 | /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ |
820 | XrmEnumerateDatabase (database, name_prefix, class_prefix, |
852 | XrmEnumerateDatabase (database, name_prefix, class_prefix, |
821 | XrmEnumOneLevel, rxvt_define_key, NULL); |
853 | mode, proc, NULL); |
822 | # endif |
854 | # endif |
823 | # endif |
|
|
824 | |
|
|
825 | #endif /* NO_RESOURCES */ |
|
|
826 | } |
855 | } |
|
|
856 | #endif |
827 | |
857 | |
828 | /*----------------------- end-of-file (C source) -----------------------*/ |
858 | /*----------------------- end-of-file (C source) -----------------------*/ |