… | |
… | |
21 | * You should have received a copy of the GNU General Public License |
21 | * You should have received a copy of the GNU General Public License |
22 | * along with this program; if not, write to the Free Software |
22 | * along with this program; if not, write to the Free Software |
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
24 | *----------------------------------------------------------------------*/ |
24 | *----------------------------------------------------------------------*/ |
25 | |
25 | |
26 | #include "../config.h" /* NECESSARY */ |
26 | #include "../config.h" |
27 | #include "rxvt.h" /* NECESSARY */ |
27 | #include "rxvt.h" |
28 | #include "version.h" |
28 | #include "version.h" |
29 | |
29 | |
30 | #ifdef KEYSYM_RESOURCE |
30 | #ifdef KEYSYM_RESOURCE |
31 | #include "keyboard.h" |
31 | #include "keyboard.h" |
32 | #endif |
32 | #endif |
… | |
… | |
211 | STRG (Rs_iconName, "iconName", "n", "string", "icon name for window"), |
211 | STRG (Rs_iconName, "iconName", "n", "string", "icon name for window"), |
212 | STRG (Rs_saveLines, "saveLines", "sl", "number", "number of scrolled lines to save"), |
212 | STRG (Rs_saveLines, "saveLines", "sl", "number", "number of scrolled lines to save"), |
213 | #if ENABLE_XEMBED |
213 | #if ENABLE_XEMBED |
214 | STRG (Rs_embed, NULL, "embed", "windowid", "window id to embed terminal in"), |
214 | STRG (Rs_embed, NULL, "embed", "windowid", "window id to embed terminal in"), |
215 | #endif |
215 | #endif |
|
|
216 | #if XFT |
|
|
217 | STRG (Rs_depth, "depth", "depth", "number", "depth of visual to request"), |
|
|
218 | #endif |
216 | #if ENABLE_FRILLS |
219 | #if ENABLE_FRILLS |
217 | RSTRG (Rs_transient_for, "transient-for", "windowid"), |
220 | RSTRG (Rs_transient_for, "transient-for", "windowid"), |
218 | BOOL (Rs_override_redirect, "override-redirect", "override-redirect", Opt_override_redirect, "set override-redirect on the terminal window"), |
221 | BOOL (Rs_override_redirect, "override-redirect", "override-redirect", Opt_override_redirect, "set override-redirect on the terminal window"), |
219 | STRG (Rs_pty_fd, NULL, "pty-fd", "fileno", "file descriptor of pty to use"), |
222 | STRG (Rs_pty_fd, NULL, "pty-fd", "fileno", "file descriptor of pty to use"), |
220 | BOOL (Rs_hold, "hold", "hold", Opt_hold, "retain window after shell exit"), |
223 | BOOL (Rs_hold, "hold", "hold", Opt_hold, "retain window after shell exit"), |
221 | STRG (Rs_depth, "depth", "depth", "number", "depth of visual to request"), |
|
|
222 | STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"), |
224 | STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"), |
223 | STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL), |
225 | STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL), |
224 | STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), |
226 | STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), |
225 | STRG (Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels"), |
227 | STRG (Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels"), |
226 | BOOL (Rs_borderLess, "borderLess", "bl", Opt_borderLess, "borderless window"), |
228 | BOOL (Rs_borderLess, "borderLess", "bl", Opt_borderLess, "borderless window"), |
… | |
… | |
384 | #endif |
386 | #endif |
385 | "\nUsage: "; /* Usage */ |
387 | "\nUsage: "; /* Usage */ |
386 | |
388 | |
387 | #define INDENT 18 |
389 | #define INDENT 18 |
388 | |
390 | |
|
|
391 | const char rxvt_term::resval_undef [] = "<undef>"; |
|
|
392 | const char rxvt_term::resval_on [] = "on"; |
|
|
393 | const char rxvt_term::resval_off [] = "off"; |
|
|
394 | |
389 | /*{{{ usage: */ |
395 | /*{{{ usage: */ |
390 | /*----------------------------------------------------------------------*/ |
396 | /*----------------------------------------------------------------------*/ |
391 | static void |
397 | static void |
392 | rxvt_usage (int type) |
398 | rxvt_usage (int type) |
393 | { |
399 | { |
… | |
… | |
479 | /*{{{ get command-line options before getting resources */ |
485 | /*{{{ get command-line options before getting resources */ |
480 | void |
486 | void |
481 | rxvt_term::get_options (int argc, const char *const *argv) |
487 | rxvt_term::get_options (int argc, const char *const *argv) |
482 | { |
488 | { |
483 | int i, bad_option = 0; |
489 | int i, bad_option = 0; |
484 | static const char On[3] = "ON", Off[4] = "OFF"; |
|
|
485 | |
490 | |
486 | for (i = 1; i < argc; i++) |
491 | for (i = 1; i < argc; i++) |
487 | { |
492 | { |
488 | unsigned int entry, longopt = 0; |
493 | unsigned int entry, longopt = 0; |
489 | const char *flag, *opt; |
494 | const char *flag, *opt; |
490 | |
495 | |
491 | opt = argv[i]; |
496 | opt = argv[i]; |
492 | |
497 | |
493 | if (*opt == '-') |
498 | if (*opt == '-') |
494 | { |
499 | { |
495 | flag = On; |
500 | flag = resval_on; |
|
|
501 | |
496 | if (*++opt == '-') |
502 | if (*++opt == '-') |
497 | longopt = *opt++; /* long option */ |
503 | longopt = *opt++; /* long option */ |
498 | } |
504 | } |
499 | else if (*opt == '+') |
505 | else if (*opt == '+') |
500 | { |
506 | { |
501 | flag = Off; |
507 | flag = resval_off; |
|
|
508 | |
502 | if (*++opt == '+') |
509 | if (*++opt == '+') |
503 | longopt = *opt++; /* long option */ |
510 | longopt = *opt++; /* long option */ |
504 | } |
511 | } |
505 | else |
512 | else |
506 | { |
513 | { |
… | |
… | |
509 | continue; |
516 | continue; |
510 | } |
517 | } |
511 | |
518 | |
512 | if (!strcmp (opt, "help")) |
519 | if (!strcmp (opt, "help")) |
513 | rxvt_usage (longopt ? 2 : 1); |
520 | rxvt_usage (longopt ? 2 : 1); |
|
|
521 | |
514 | if (!strcmp (opt, "h")) |
522 | if (!strcmp (opt, "h")) |
515 | rxvt_usage (0); |
523 | rxvt_usage (0); |
516 | |
524 | |
517 | /* feature: always try to match long-options */ |
525 | /* feature: always try to match long-options */ |
518 | for (entry = 0; entry < optList_size; entry++) |
526 | for (entry = 0; entry < optList_size; entry++) |
… | |
… | |
522 | break; |
530 | break; |
523 | |
531 | |
524 | if (entry < optList_size) |
532 | if (entry < optList_size) |
525 | { |
533 | { |
526 | if (optList_isReverse (entry)) |
534 | if (optList_isReverse (entry)) |
527 | flag = flag == On ? Off : On; |
535 | flag = flag == resval_on ? resval_off : resval_on; |
528 | |
536 | |
529 | if (optList_strlen (entry)) |
537 | if (optList_strlen (entry)) |
530 | { |
538 | { |
531 | /* |
539 | /* |
532 | * special cases are handled in main.c:main () to allow |
540 | * special cases are handled in main.c:main () to allow |
533 | * X resources to set these values before we settle for |
541 | * X resources to set these values before we settle for |
534 | * default values |
542 | * default values |
535 | */ |
543 | */ |
536 | |
544 | |
537 | if (optList[entry].doff != -1) |
545 | if (optList[entry].doff != -1) |
538 | rs[optList[entry].doff] = flag == On && argv[i+1] |
546 | rs[optList[entry].doff] = flag == resval_on && argv[i+1] |
539 | ? argv[++i] : 0; |
547 | ? argv[++i] : resval_undef; |
540 | } |
548 | } |
541 | else |
549 | else |
542 | { /* boolean value */ |
550 | { /* boolean value */ |
543 | set_option (optList[entry].flag & Optflag_mask, flag == On); |
551 | set_option (optList[entry].flag & Optflag_mask, flag == resval_on); |
544 | |
552 | |
545 | if (optList[entry].doff != -1) |
553 | if (optList[entry].doff != -1) |
546 | rs[optList[entry].doff] = flag; |
554 | rs[optList[entry].doff] = flag; |
547 | } |
555 | } |
548 | } |
556 | } |