--- rxvt-unicode/src/xdefaults.C 2012/06/04 15:18:53 1.165 +++ rxvt-unicode/src/xdefaults.C 2012/06/05 19:32:29 1.166 @@ -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); + } } }