--- rxvt-unicode/src/xdefaults.C 2012/05/25 08:27:47 1.164 +++ rxvt-unicode/src/xdefaults.C 2012/06/05 22:23:07 1.167 @@ -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 @@ -446,6 +449,12 @@ (optList_isBool (i) ? "turn on/off " : ""), optList[i].desc); } + +#if ENABLE_PERL + rxvt_perl.init (this); + rxvt_perl.usage (this, 1); +#endif + rxvt_log ("\n --help to list long-options"); break; @@ -459,6 +468,12 @@ optList[i].kw, (INDENT - strlen (optList[i].kw)), "", /* XXX */ (optList_isBool (i) ? "boolean" : optList[i].arg)); + +#if ENABLE_PERL + rxvt_perl.init (this); + rxvt_perl.usage (this, 2); +#endif + rxvt_log ("\n -help to list options"); break; } @@ -575,8 +590,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); + } } }