ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/xdefaults.C
(Generate patch)

Comparing rxvt-unicode/src/xdefaults.C (file contents):
Revision 1.91 by root, Tue Jan 31 19:54:39 2006 UTC vs.
Revision 1.94 by root, Thu Feb 2 18:04:46 2006 UTC

26#include "../config.h" 26#include "../config.h"
27#include "rxvt.h" 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
33 33
34/* place holders used for parsing command-line options */ 34/* place holders used for parsing command-line options */
35#define Optflag_Reverse 0x40000000UL 35#define Optflag_Reverse 0x40000000UL
36#define Optflag_Boolean 0x80000000UL 36#define Optflag_Boolean 0x80000000UL
37#define Optflag_mask 0x3fffffffUL 37#define Optflag_mask 0x3fffffffUL
38 38
39/*{{{ monolithic option/resource structure: */ 39/* monolithic option/resource structure: */
40/* 40/*
41 * `string' options MUST have a usage argument 41 * `string' options MUST have a usage argument
42 * `switch' and `boolean' options have no argument 42 * `switch' and `boolean' options have no argument
43 * if there's no desc (ription), it won't appear in rxvt_usage () 43 * if there's no desc (ription), it won't appear in rxvt_usage ()
44 */ 44 */
266#undef INFO 266#undef INFO
267#undef STRG 267#undef STRG
268#undef RSTRG 268#undef RSTRG
269#undef SWCH 269#undef SWCH
270#undef BOOL 270#undef BOOL
271/*}}} */
272 271
273static const char releasestring[] = "rxvt-unicode (" RXVTNAME ") v" VERSION " - released: " DATE "\n"; 272static const char releasestring[] = "rxvt-unicode (" RXVTNAME ") v" VERSION " - released: " DATE "\n";
274static const char optionsstring[] = "options: " 273static const char optionsstring[] = "options: "
275#if ENABLE_PERL 274#if ENABLE_PERL
276 "perl," 275 "perl,"
407 rxvt_log (" [-help] [--help]\n"); 406 rxvt_log (" [-help] [--help]\n");
408 407
409 for (col = 1, i = 0; i < optList_size; i++) 408 for (col = 1, i = 0; i < optList_size; i++)
410 if (optList[i].desc != NULL) 409 if (optList[i].desc != NULL)
411 { 410 {
412 int len = 0; 411 int len = 0;
413 412
414 if (!optList_isBool (i)) 413 if (!optList_isBool (i))
415 { 414 {
416 len = optList_strlen (i); 415 len = optList_strlen (i);
417 if (len > 0) 416 if (len > 0)
484 483
485/*{{{ get command-line options before getting resources */ 484/*{{{ get command-line options before getting resources */
486void 485void
487rxvt_term::get_options (int argc, const char *const *argv) 486rxvt_term::get_options (int argc, const char *const *argv)
488{ 487{
489 int i, bad_option = 0; 488 int i, bad_option = 0;
490 489
491 for (i = 1; i < argc; i++) 490 for (i = 1; i < argc; i++)
492 { 491 {
493 unsigned int entry, longopt = 0; 492 unsigned int entry, longopt = 0;
494 const char *flag, *opt; 493 const char *flag, *opt;
541 * X resources to set these values before we settle for 540 * X resources to set these values before we settle for
542 * default values 541 * default values
543 */ 542 */
544 543
545 if (optList[entry].doff != -1) 544 if (optList[entry].doff != -1)
545 {
546 if (flag == resval_on && !argv [i+1])
547 rxvt_fatal ("option '%s' needs an argument, aborting.\n", argv [i]);
548
546 rs[optList[entry].doff] = flag == resval_on && argv[i+1] 549 rs[optList[entry].doff] = flag == resval_on ? argv[++i] : resval_undef;
547 ? argv[++i] : resval_undef; 550 }
548 } 551 }
549 else 552 else
550 { /* boolean value */ 553 { /* boolean value */
551 set_option (optList[entry].flag & Optflag_mask, flag == resval_on); 554 set_option (optList[entry].flag & Optflag_mask, flag == resval_on);
552 555
771} 774}
772 775
773const char * 776const char *
774rxvt_term::x_resource (const char *name) 777rxvt_term::x_resource (const char *name)
775{ 778{
776 XrmDatabase database = XrmGetDatabase (xdisp); 779 XrmDatabase database = XrmGetDatabase (dpy);
777 780
778 const char *p = get_res (database, rs[Rs_name], name); 781 const char *p = get_res (database, rs[Rs_name], name);
779 const char *p0 = get_res (database, "!INVALIDPROGRAMMENAMEDONTMATCH!", name); 782 const char *p0 = get_res (database, "!INVALIDPROGRAMMENAMEDONTMATCH!", name);
780 783
781 if (p == NULL || (p0 && strcmp (p, p0) == 0)) 784 if (p == NULL || (p0 && strcmp (p, p0) == 0))
833 836
834 /* 837 /*
835 * [R5 or later]: enumerate the resource database 838 * [R5 or later]: enumerate the resource database
836 */ 839 */
837# ifdef KEYSYM_RESOURCE 840# ifdef KEYSYM_RESOURCE
838 XrmDatabase database = XrmGetDatabase (xdisp); 841 XrmDatabase database = XrmGetDatabase (dpy);
839 XrmName name_prefix[3]; 842 XrmName name_prefix[3];
840 XrmClass class_prefix[3]; 843 XrmClass class_prefix[3];
841 844
842 name_prefix[0] = XrmStringToName (rs[Rs_name]); 845 name_prefix[0] = XrmStringToName (rs[Rs_name]);
843 name_prefix[1] = XrmStringToName ("keysym"); 846 name_prefix[1] = XrmStringToName ("keysym");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines