--- rxvt-unicode/src/xdefaults.C 2012/05/25 08:27:47 1.164 +++ rxvt-unicode/src/xdefaults.C 2012/06/05 19:32:29 1.166 @@ -194,7 +194,7 @@ STRG (Rs_color + Color_pointer_fg, "pointerColor", "pr", "color", "pointer color"), STRG (Rs_color + Color_pointer_bg, "pointerColor2", "pr2", "color", "pointer bg color"), STRG (Rs_color + Color_border, "borderColor", "bd", "color", "border color"), -#ifdef BG_IMAGE_FROM_FILE +#if BG_IMAGE_FROM_FILE RSTRG (Rs_path, "path", "search path"), STRG (Rs_backgroundPixmap, "backgroundPixmap", "pixmap", "file[;geom]", "background pixmap"), # if ENABLE_EWMH @@ -209,7 +209,7 @@ STRG (Rs_boldItalicFont, "boldItalicFont", "fbi", "fontname", "bold italic font"), BOOL (Rs_intensityStyles, "intensityStyles", "is", Opt_intensityStyles, 0, "font styles imply intensity changes"), #endif -#ifdef USE_XIM +#if USE_XIM STRG (Rs_inputMethod, "inputMethod", "im", "name", "name of input method"), STRG (Rs_preeditType, "preeditType", "pt", "style", "input style: style = OverTheSpot|OffTheSpot|Root"), STRG (Rs_imLocale, "imLocale", "imlocale", "string", "locale to use for input method"), @@ -394,8 +394,8 @@ /*{{{ usage: */ /*----------------------------------------------------------------------*/ -static void -rxvt_usage (int type) +void +rxvt_term::rxvt_usage (int type) { unsigned int i, col; @@ -413,9 +413,11 @@ if (optList[i].arg) len = strlen (optList[i].arg) + 1; + assert (optList[i].opt != NULL); len += 4 + strlen (optList[i].opt) + (optList_isBool (i) ? 2 : 0); col += len; + if (col > 79) { /* assume regular width */ @@ -424,6 +426,7 @@ } rxvt_log (" [-%s%s", (optList_isBool (i) ? "/+" : ""), optList[i].opt); + if (optList[i].arg) rxvt_log (" %s]", optList[i].arg); else @@ -463,6 +466,14 @@ break; } +#if ENABLE_PERL + if (type) // do not initialise perl for type == 0, as perl does not have "short" options + { + rxvt_perl.init (this); + rxvt_perl.usage (type); + } +#endif + rxvt_log ("\n\n"); rxvt_exit_failure (); } @@ -575,8 +586,25 @@ } else { - bad_option = 1; - rxvt_warn ("\"%s\": unknown or malformed option.\n", opt); +#if ENABLE_PERL + rxvt_perl.init (this); + + if (int flags = rxvt_perl.resource (this, opt, true, longopt, flag, argv [i + 1])) + { + if ((!flags & rxvt_perl.RESOURCE_BOOLEAN)) + { + if (flag && i + 1 == argc) + rxvt_fatal ("option '%s' requires an argument, aborting.\n", argv [i]); + + ++i; + } + } + else +#endif + { + bad_option = 1; + rxvt_warn ("\"%s\": unknown or malformed option.\n", opt); + } } }