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.28 by root, Fri Jul 30 22:36:42 2004 UTC vs.
Revision 1.34 by root, Sun Aug 15 22:09:24 2004 UTC

28 *----------------------------------------------------------------------*/ 28 *----------------------------------------------------------------------*/
29 29
30#include "../config.h" /* NECESSARY */ 30#include "../config.h" /* NECESSARY */
31#include "rxvt.h" /* NECESSARY */ 31#include "rxvt.h" /* NECESSARY */
32#include "version.h" 32#include "version.h"
33#include "xdefaults.intpro" /* PROTOS for internal routines */
34 33
35/* #define DEBUG_RESOURCES */ 34/* #define DEBUG_RESOURCES */
36 35
37static const char *const xnames[2] = { ".Xdefaults", ".Xresources" }; 36static const char *const xnames[2] = { ".Xdefaults", ".Xresources" };
38 37
63#define SWCH(opt, flag, desc) \ 62#define SWCH(opt, flag, desc) \
64 { (flag), -1, NULL, (opt), NULL, (desc)} 63 { (flag), -1, NULL, (opt), NULL, (desc)}
65 64
66/* convenient macros */ 65/* convenient macros */
67#define optList_strlen(i) \ 66#define optList_strlen(i) \
68 (optList[i].flag ? 0 : (optList[i].arg ? STRLEN (optList[i].arg) : 1)) 67 (optList[i].flag ? 0 : (optList[i].arg ? strlen (optList[i].arg) : 1))
69#define optList_isBool(i) \ 68#define optList_isBool(i) \
70 (optList[i].flag & Opt_Boolean) 69 (optList[i].flag & Opt_Boolean)
71#define optList_isReverse(i) \ 70#define optList_isReverse(i) \
72 (optList[i].flag & Opt_Reverse) 71 (optList[i].flag & Opt_Reverse)
73#define optList_size() \ 72#define optList_size() \
128 BOOL (Rs_meta8, "meta8", NULL, Opt_meta8, NULL), 127 BOOL (Rs_meta8, "meta8", NULL, Opt_meta8, NULL),
129#endif 128#endif
130#ifdef MOUSE_WHEEL 129#ifdef MOUSE_WHEEL
131 BOOL (Rs_mouseWheelScrollPage, "mouseWheelScrollPage", NULL, Opt_mouseWheelScrollPage, NULL), 130 BOOL (Rs_mouseWheelScrollPage, "mouseWheelScrollPage", NULL, Opt_mouseWheelScrollPage, NULL),
132#endif 131#endif
133#ifndef NO_FRILLS 132#if ENABLE_FRILLS
134 BOOL (Rs_tripleclickwords, "tripleclickwords", "tcw", Opt_tripleclickwords, "triple click word selection"), 133 BOOL (Rs_tripleclickwords, "tripleclickwords", "tcw", Opt_tripleclickwords, "triple click word selection"),
135 BOOL (Rs_insecure, "insecure", "insecure", Opt_insecure, "enable possibly insecure escape sequences"), 134 BOOL (Rs_insecure, "insecure", "insecure", Opt_insecure, "enable possibly insecure escape sequences"),
136#endif 135#endif
137#ifdef CURSOR_BLINK 136#ifdef CURSOR_BLINK
138 BOOL (Rs_cursorBlink, "cursorBlink", "bc", Opt_cursorBlink, "blinking cursor"), 137 BOOL (Rs_cursorBlink, "cursorBlink", "bc", Opt_cursorBlink, "blinking cursor"),
202#endif /* NO_CURSORCOLOR */ 201#endif /* NO_CURSORCOLOR */
203 STRG (Rs_color + Color_pointer_fg, "pointerColor", "pr", "color", "pointer color"), 202 STRG (Rs_color + Color_pointer_fg, "pointerColor", "pr", "color", "pointer color"),
204 STRG (Rs_color + Color_pointer_bg, "pointerColor2", "pr2", "color", "pointer bg color"), 203 STRG (Rs_color + Color_pointer_bg, "pointerColor2", "pr2", "color", "pointer bg color"),
205 STRG (Rs_color + Color_border, "borderColor", "bd", "color", "border color"), 204 STRG (Rs_color + Color_border, "borderColor", "bd", "color", "border color"),
206 STRG (Rs_saveLines, "saveLines", "sl", "number", "number of scrolled lines to save"), 205 STRG (Rs_saveLines, "saveLines", "sl", "number", "number of scrolled lines to save"),
207#ifndef NO_FRILLS 206#if ENABLE_FRILLS
208 STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"), 207 STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"),
209 STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL), 208 STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL),
210 STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), 209 STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL),
211 STRG (Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels"), 210 STRG (Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels"),
211 BOOL (Rs_borderLess, "borderLess", "bl", Opt_borderLess, "borderless window"),
212#endif 212#endif
213#ifndef NO_LINESPACE 213#ifndef NO_LINESPACE
214 STRG (Rs_lineSpace, "lineSpace", "lsp", "number", "number of extra pixels between rows"), 214 STRG (Rs_lineSpace, "lineSpace", "lsp", "number", "number of extra pixels between rows"),
215#endif 215#endif
216 STRG (Rs_scrollBar_thickness, "thickness", "sbt", "number", "scrollbar thickness/width in pixels"), 216 STRG (Rs_scrollBar_thickness, "thickness", "sbt", "number", "scrollbar thickness/width in pixels"),
250#undef SWCH 250#undef SWCH
251#undef BOOL 251#undef BOOL
252/*}}} */ 252/*}}} */
253 253
254static const char releasestring[] = "Rxvt v" VERSION " - released: " DATE "\n"; 254static const char releasestring[] = "Rxvt v" VERSION " - released: " DATE "\n";
255static const char optionsstring[] = "Options: " 255static const char optionsstring[] = "options: "
256#if XFT
257 "xft,"
258#endif
259#if UNICODE_3
260 "unicode3,"
261#endif
262 "encodings=eu+vn"
263#if ENCODING_JP
264 "+jp"
265#endif
266#if ENCODING_JP_EXT
267 "+jp-ext"
268#endif
269#if ENCODING_KR
270 "+kr"
271#endif
272#if ENCODING_CN
273 "+cn"
274#endif
275#if ENCODING_CN_EXT
276 "+cn-ext"
277#endif
278 ","
279#if ENABLE_COMBINING
280 "combining,"
281#endif
282#if TEXT_BLINK
283 "blink,"
284#endif
285#if OFF_FOCUS_FADING
286 "fade,"
287#endif
256#if defined(XPM_BACKGROUND) 288#if defined(XPM_BACKGROUND)
257 "XPM," 289 "XPM,"
258#endif 290#endif
259#if defined(TRANSPARENT) 291#if defined(TRANSPARENT)
260 "transparent," 292 "transparent,"
261#endif 293#endif
294#if TINTING
295 "tint,"
296#endif
262#if defined(UTMP_SUPPORT) 297#if defined(UTMP_SUPPORT)
263 "utmp," 298 "utmp,"
264#endif 299#endif
265#if defined(MENUBAR) 300#if defined(MENUBAR)
266 "menubar," 301 "menubar,"
267#endif
268#if !defined(NO_FRILLS)
269 "frills,"
270#endif
271#if !defined(NO_LINESPACE)
272 "linespace,"
273#endif
274#if defined(PREFER_24BIT)
275 "24bit,"
276#endif 302#endif
277#if defined(USE_XIM) 303#if defined(USE_XIM)
278 "XIM," 304 "XIM,"
279#endif 305#endif
280 "scrollbars=" 306 "scrollbars="
308 "no_backspace," 334 "no_backspace,"
309#endif 335#endif
310#if defined(NO_DELETE_KEY) 336#if defined(NO_DELETE_KEY)
311 "no_delete," 337 "no_delete,"
312#endif 338#endif
339#if EIGHT_BIT_CONTROLS
340 "8bitctrls,"
341#endif
313#if !defined(NO_STRINGS) 342#if !defined(NO_STRINGS)
314 "strings," 343 "strings,"
315#endif 344#endif
345#if defined(ENABLE_FRILLS)
346 "frills,"
347#endif
348#if !defined(NO_LINESPACE)
349 "linespace,"
350#endif
351#if defined(PREFER_24BIT)
352 "24bit,"
353#endif
354#if defined(SELECTION_SCROLLING)
355 "selectionscrolling,"
356#endif
357#if MOUSE_WHEEL
358 "wheel,"
359#endif
360#if MOUSE_SLIP_WHEELING
361 "slipwheel,"
362#endif
363#if defined(SMART_RESIZE)
364 "smart-resize,"
365#endif
316#if defined(TTY_256COLOR) 366#if defined(TTY_256COLOR)
317 "256colour," 367 "256colour,"
368#endif
369#if defined(CURSOR_BLINK)
370 "cursorBlink,"
371#endif
372#if defined(POINTER_BLANK)
373 "pointerBlank,"
318#endif 374#endif
319#if defined(NO_RESOURCES) 375#if defined(NO_RESOURCES)
320 "NoResources" 376 "NoResources"
321#else 377#else
322# if defined(USE_XGETDEFAULT) 378# if defined(USE_XGETDEFAULT)
355 len++; /* account for space */ 411 len++; /* account for space */
356 } 412 }
357#ifdef DEBUG_STRICT 413#ifdef DEBUG_STRICT
358 assert (optList[i].opt != NULL); 414 assert (optList[i].opt != NULL);
359#endif 415#endif
360 len += 4 + STRLEN (optList[i].opt) + (optList_isBool (i) ? 2: 0); 416 len += 4 + strlen (optList[i].opt) + (optList_isBool (i) ? 2: 0);
361 col += len; 417 col += len;
362 if (col > 79) 418 if (col > 79)
363 { /* assume regular width */ 419 { /* assume regular width */
364 rxvt_log ("\n"); 420 rxvt_log ("\n");
365 col = 1 + len; 421 col = 1 + len;
382#ifdef DEBUG_STRICT 438#ifdef DEBUG_STRICT
383 assert (optList[i].opt != NULL); 439 assert (optList[i].opt != NULL);
384#endif 440#endif
385 rxvt_log (" %s%s %-*s%s%s\n", 441 rxvt_log (" %s%s %-*s%s%s\n",
386 (optList_isBool (i) ? "-/+" : "-"), optList[i].opt, 442 (optList_isBool (i) ? "-/+" : "-"), optList[i].opt,
387 (INDENT - STRLEN (optList[i].opt) 443 (INDENT - strlen (optList[i].opt)
388 + (optList_isBool (i) ? 0 : 2)), 444 + (optList_isBool (i) ? 0 : 2)),
389 (optList[i].arg ? optList[i].arg : ""), 445 (optList[i].arg ? optList[i].arg : ""),
390 (optList_isBool (i) ? "turn on/off " : ""), 446 (optList_isBool (i) ? "turn on/off " : ""),
391 optList[i].desc); 447 optList[i].desc);
392 } 448 }
399 455
400 for (i = 0; i < optList_size (); i++) 456 for (i = 0; i < optList_size (); i++)
401 if (optList[i].kw != NULL) 457 if (optList[i].kw != NULL)
402 rxvt_log (" %s: %*s%s\n", 458 rxvt_log (" %s: %*s%s\n",
403 optList[i].kw, 459 optList[i].kw,
404 (INDENT - STRLEN (optList[i].kw)), "", /* XXX */ 460 (INDENT - strlen (optList[i].kw)), "", /* XXX */
405 (optList_isBool (i) ? "boolean" : optList[i].arg)); 461 (optList_isBool (i) ? "boolean" : optList[i].arg));
406#ifdef KEYSYM_RESOURCE 462#ifdef KEYSYM_RESOURCE
407 rxvt_log (" " "keysym.sym" ": %*s%s\n", 463 rxvt_log (" " "keysym.sym" ": %*s%s\n",
408 (INDENT - sizeof ("keysym.sym") + 1), "", /* XXX */ 464 (INDENT - sizeof ("keysym.sym") + 1), "", /* XXX */
409 "keysym"); 465 "keysym");
452 bad_option = 1; 508 bad_option = 1;
453 rxvt_warn ("\"%s\": malformed option.\n", opt); 509 rxvt_warn ("\"%s\": malformed option.\n", opt);
454 continue; 510 continue;
455 } 511 }
456 512
457 if (!STRCMP (opt, "help")) 513 if (!strcmp (opt, "help"))
458 rxvt_usage (longopt ? 2 : 1); 514 rxvt_usage (longopt ? 2 : 1);
459 if (!STRCMP (opt, "h")) 515 if (!strcmp (opt, "h"))
460 rxvt_usage (0); 516 rxvt_usage (0);
461 517
462 /* feature: always try to match long-options */ 518 /* feature: always try to match long-options */
463 for (entry = 0; entry < optList_size (); entry++) 519 for (entry = 0; entry < optList_size (); entry++)
464 if ((optList[entry].kw && !STRCMP (opt, optList[entry].kw)) 520 if ((optList[entry].kw && !strcmp (opt, optList[entry].kw))
465 || (!longopt 521 || (!longopt
466 && optList[entry].opt && !STRCMP (opt, optList[entry].opt))) 522 && optList[entry].opt && !strcmp (opt, optList[entry].opt)))
467 break; 523 break;
468 524
469 if (entry < optList_size ()) 525 if (entry < optList_size ())
470 { 526 {
471 if (optList_isReverse (entry)) 527 if (optList_isReverse (entry))
488#ifdef DEBUG_RESOURCES 544#ifdef DEBUG_RESOURCES
489 fprintf (stderr, "boolean (%s,%s) = %s\n", 545 fprintf (stderr, "boolean (%s,%s) = %s\n",
490 optList[entry].opt, optList[entry].kw, flag); 546 optList[entry].opt, optList[entry].kw, flag);
491#endif 547#endif
492 if (flag == On) 548 if (flag == On)
493 Options |= (optList[entry].flag); 549 options |= (optList[entry].flag);
494 else 550 else
495 Options &= ~ (optList[entry].flag); 551 options &= ~ (optList[entry].flag);
496 552
497 if (optList[entry].doff != -1) 553 if (optList[entry].doff != -1)
498 rs[optList[entry].doff] = flag; 554 rs[optList[entry].doff] = flag;
499 } 555 }
500 } 556 }
501 else 557 else
502#ifdef KEYSYM_RESOURCE 558#ifdef KEYSYM_RESOURCE
503 /* if (!STRNCMP (opt, "keysym.", sizeof ("keysym.") - 1)) */ 559 /* if (!strncmp (opt, "keysym.", sizeof ("keysym.") - 1)) */
504 if (rxvt_Str_match (opt, "keysym.")) 560 if (rxvt_Str_match (opt, "keysym."))
505 { 561 {
506 const char *str = argv[++i]; 562 const char *str = argv[++i];
507 563
508 if (str != NULL) 564 if (str != NULL)
577 { 633 {
578 if (str[0] == '0' && toupper (str[1]) == 'X') 634 if (str[0] == '0' && toupper (str[1]) == 'X')
579 str += 2; 635 str += 2;
580 if (arg) 636 if (arg)
581 { 637 {
582 if (sscanf (str, (STRCHR (str, ':') ? "%x:" : "%x"), &sym) != 1) 638 if (sscanf (str, (strchr (str, ':') ? "%x:" : "%x"), &sym) != 1)
583 return -1; 639 return -1;
584 } 640 }
585 else 641 else
586 { 642 {
587 if (sscanf (str, "%x:", &sym) != 1) 643 if (sscanf (str, "%x:", &sym) != 1)
588 return -1; 644 return -1;
589 645
590 /* cue to ':', it's there since sscanf () worked */ 646 /* cue to ':', it's there since sscanf () worked */
591 STRNCPY (newargstr, STRCHR (str, ':') + 1, NEWARGLIM - 1); 647 strncpy (newargstr, strchr (str, ':') + 1, NEWARGLIM - 1);
592 newargstr[NEWARGLIM - 1] = '\0'; 648 newargstr[NEWARGLIM - 1] = '\0';
593 newarg = newargstr; 649 newarg = newargstr;
594 } 650 }
595 } 651 }
596 else 652 else
597 { 653 {
598 /* 654 /*
599 * convert keysym name to keysym number 655 * convert keysym name to keysym number
600 */ 656 */
601 STRNCPY (newargstr, str, NEWARGLIM - 1); 657 strncpy (newargstr, str, NEWARGLIM - 1);
602 newargstr[NEWARGLIM - 1] = '\0'; 658 newargstr[NEWARGLIM - 1] = '\0';
603 if (arg == NULL) 659 if (arg == NULL)
604 { 660 {
605 if ((newarg = STRCHR (newargstr, ':')) == NULL) 661 if ((newarg = strchr (newargstr, ':')) == NULL)
606 return -1; 662 return -1;
607 *newarg++ = '\0'; /* terminate keysym name */ 663 *newarg++ = '\0'; /* terminate keysym name */
608 } 664 }
609 if ((sym = XStringToKeysym (newargstr)) == None) 665 if ((sym = XStringToKeysym (newargstr)) == None)
610 return -1; 666 return -1;
616 if (Keysym_map[sym] != NULL) /* already set ? */ 672 if (Keysym_map[sym] != NULL) /* already set ? */
617 return -1; 673 return -1;
618 674
619 if (newarg == NULL) 675 if (newarg == NULL)
620 { 676 {
621 STRNCPY (newargstr, arg, NEWARGLIM - 1); 677 strncpy (newargstr, arg, NEWARGLIM - 1);
622 newargstr[NEWARGLIM - 1] = '\0'; 678 newargstr[NEWARGLIM - 1] = '\0';
623 newarg = newargstr; 679 newarg = newargstr;
624 } 680 }
625 rxvt_Str_trim (newarg); 681 rxvt_Str_trim (newarg);
626 if (*newarg == '\0' || (n = rxvt_Str_escaped (newarg)) == 0) 682 if (*newarg == '\0' || (n = rxvt_Str_escaped (newarg)) == 0)
627 return -1; 683 return -1;
628 MIN_IT (n, 255); 684 MIN_IT (n, 255);
629 key_string = (char *)rxvt_malloc ((n + 1) * sizeof (char)); 685 key_string = (char *)rxvt_malloc ((n + 1) * sizeof (char));
630 686
631 key_string[0] = n; 687 key_string[0] = n;
632 STRNCPY (key_string + 1, newarg, n); 688 strncpy (key_string + 1, newarg, n);
633 Keysym_map[sym] = (unsigned char *)key_string; 689 Keysym_map[sym] = (unsigned char *)key_string;
634 690
635 return 1; 691 return 1;
636} 692}
637 693
649 char *str, buffer[256]; 705 char *str, buffer[256];
650 706
651 if (stream == NULL) 707 if (stream == NULL)
652 return; 708 return;
653 709
654 len = STRLEN (name); 710 len = strlen (name);
655 while ((str = fgets (buffer, sizeof (buffer), stream)) != NULL) 711 while ((str = fgets (buffer, sizeof (buffer), stream)) != NULL)
656 { 712 {
657 unsigned int entry, n; 713 unsigned int entry, n;
658 714
659 while (*str && isspace (*str)) 715 while (*str && isspace (*str))
660 str++; /* leading whitespace */ 716 str++; /* leading whitespace */
661 717
662 if ((str[len] != '*' && str[len] != '.') 718 if ((str[len] != '*' && str[len] != '.')
663 || (len && STRNCMP (str, name, len))) 719 || (len && strncmp (str, name, len)))
664 continue; 720 continue;
665 str += (len + 1); /* skip `name*' or `name.' */ 721 str += (len + 1); /* skip `name*' or `name.' */
666 722
667# ifdef KEYSYM_RESOURCE 723# ifdef KEYSYM_RESOURCE
668 if (!parse_keysym (str, NULL)) 724 if (!parse_keysym (str, NULL))
672 const char *kw = optList[entry].kw; 728 const char *kw = optList[entry].kw;
673 729
674 if (kw == NULL) 730 if (kw == NULL)
675 continue; 731 continue;
676 732
677 n = STRLEN (kw); 733 n = strlen (kw);
678 if (str[n] == ':' && rxvt_Str_match (str, kw)) 734 if (str[n] == ':' && rxvt_Str_match (str, kw))
679 { 735 {
680 /* skip `keyword:' */ 736 /* skip `keyword:' */
681 str += n + 1; 737 str += n + 1;
682 rxvt_Str_trim (str); 738 rxvt_Str_trim (str);
683 n = STRLEN (str); 739 n = strlen (str);
684 if (n && rs[optList[entry].doff] == NULL) 740 if (n && rs[optList[entry].doff] == NULL)
685 { 741 {
686 /* not already set */ 742 /* not already set */
687 int s; 743 int s;
688 char *p = 0; 744 char *p = 0;
689 745
690 for (int o = 0;;) 746 for (int o = 0;;)
691 { 747 {
692 p = (char *)rxvt_realloc (p, o + n + 1); 748 p = (char *)rxvt_realloc (p, o + n + 1);
693 MEMCPY (p + o, str, n); 749 memcpy (p + o, str, n);
694 o += n; 750 o += n;
695 p[o] = 0; 751 p[o] = 0;
696 752
697 if (o == 0 || p[o - 1] != '\\') // continuation line 753 if (o == 0 || p[o - 1] != '\\') // continuation line
698 break; 754 break;
701 757
702 if ((str = fgets (buffer, sizeof (buffer), stream)) == NULL) 758 if ((str = fgets (buffer, sizeof (buffer), stream)) == NULL)
703 break; 759 break;
704 760
705 rxvt_Str_trim (str); 761 rxvt_Str_trim (str);
706 n = STRLEN (str); 762 n = strlen (str);
707 } 763 }
708 764
709 rs[optList[entry].doff] = p; 765 rs[optList[entry].doff] = p;
710 allocated.push_back (p); 766 allocated.push_back (p);
711 767
712 if (optList_isBool (entry)) 768 if (optList_isBool (entry))
713 { 769 {
714 s = STRCASECMP (str, "TRUE") == 0 770 s = strcasecmp (str, "TRUE") == 0
715 || STRCASECMP (str, "YES") == 0 771 || strcasecmp (str, "YES") == 0
716 || STRCASECMP (str, "ON") == 0 772 || strcasecmp (str, "ON") == 0
717 || STRCASECMP (str, "1") == 0; 773 || strcasecmp (str, "1") == 0;
718 774
719 if (optList_isReverse (entry)) 775 if (optList_isReverse (entry))
720 s = !s; 776 s = !s;
721 777
722 if (s) 778 if (s)
723 Options |= optList[entry].flag; 779 options |= optList[entry].flag;
724 else 780 else
725 Options &= ~optList[entry].flag; 781 options &= ~optList[entry].flag;
726 } 782 }
727 } 783 }
728 784
729 break; 785 break;
730 } 786 }
796 if ((ptr = (char *)getenv ("HOME")) == NULL) 852 if ((ptr = (char *)getenv ("HOME")) == NULL)
797 ptr = "."; 853 ptr = ".";
798 854
799 for (i = 0; i < (sizeof (xnames) / sizeof (xnames[0])); i++) 855 for (i = 0; i < (sizeof (xnames) / sizeof (xnames[0])); i++)
800 { 856 {
801 sprintf (fname, "%-.*s/%s", sizeof (fname) - STRLEN (xnames[i]) - 2, 857 sprintf (fname, "%-.*s/%s", sizeof (fname) - strlen (xnames[i]) - 2,
802 ptr, xnames[i]); 858 ptr, xnames[i]);
803 if ((rdb1 = XrmGetFileDatabase (fname))) 859 if ((rdb1 = XrmGetFileDatabase (fname)))
804 { 860 {
805 XrmMergeDatabases (rdb1, &database); 861 XrmMergeDatabases (rdb1, &database);
806# ifndef HAVE_BOTH_XRESOURCE_FILES 862# ifndef HAVE_BOTH_XRESOURCE_FILES
851 if (kw == NULL || rs[optList[entry].doff] != NULL) 907 if (kw == NULL || rs[optList[entry].doff] != NULL)
852 continue; /* previously set */ 908 continue; /* previously set */
853 909
854 p = XGetDefault (display, name, kw); 910 p = XGetDefault (display, name, kw);
855 p0 = XGetDefault (display, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw); 911 p0 = XGetDefault (display, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw);
856 if (p == NULL || (p0 && STRCMP (p, p0) == 0)) 912 if (p == NULL || (p0 && strcmp (p, p0) == 0))
857 { 913 {
858 p = XGetDefault (display, RESCLASS, kw); 914 p = XGetDefault (display, RESCLASS, kw);
859#ifdef RESFALLBACK 915#ifdef RESFALLBACK
860 if (p == NULL || (p0 && STRCMP (p, p0) == 0)) 916 if (p == NULL || (p0 && strcmp (p, p0) == 0))
861 p = XGetDefault (display, RESFALLBACK, kw); 917 p = XGetDefault (display, RESFALLBACK, kw);
862#endif 918#endif
863 } 919 }
864 920
865 if (p == NULL && p0) 921 if (p == NULL && p0)
869 { 925 {
870 rs[optList[entry].doff] = p; 926 rs[optList[entry].doff] = p;
871 927
872 if (optList_isBool (entry)) 928 if (optList_isBool (entry))
873 { 929 {
874 s = STRCASECMP (p, "TRUE") == 0 930 s = strcasecmp (p, "TRUE") == 0
875 || STRCASECMP (p, "YES") == 0 931 || strcasecmp (p, "YES") == 0
876 || STRCASECMP (p, "ON") == 0 932 || strcasecmp (p, "ON") == 0
877 || STRCASECMP (p, "1") == 0; 933 || strcasecmp (p, "1") == 0;
878 if (optList_isReverse (entry)) 934 if (optList_isReverse (entry))
879 s = !s; 935 s = !s;
880 if (s) 936 if (s)
881 Options |= (optList[entry].flag); 937 options |= (optList[entry].flag);
882 else 938 else
883 Options &= ~ (optList[entry].flag); 939 options &= ~ (optList[entry].flag);
884 } 940 }
885 } 941 }
886 } 942 }
887 943
888 /* 944 /*
916 FILE *fd = NULL; 972 FILE *fd = NULL;
917 char *home; 973 char *home;
918 974
919 if ((home = getenv ("HOME")) != NULL) 975 if ((home = getenv ("HOME")) != NULL)
920 { 976 {
921 unsigned int i, len = STRLEN (home) + 2; 977 unsigned int i, len = strlen (home) + 2;
922 char *f = NULL; 978 char *f = NULL;
923 979
924 for (i = 0; i < (sizeof (xnames) / sizeof (xnames[0])); i++) 980 for (i = 0; i < (sizeof (xnames) / sizeof (xnames[0])); i++)
925 { 981 {
926 f = (char *)rxvt_realloc (f, (len + STRLEN (xnames[i])) * sizeof (char)); 982 f = (char *)rxvt_realloc (f, (len + strlen (xnames[i])) * sizeof (char));
927 983
928 sprintf (f, "%s/%s", home, xnames[i]); 984 sprintf (f, "%s/%s", home, xnames[i]);
929 985
930 if ((fd = fopen (f, "r")) != NULL) 986 if ((fd = fopen (f, "r")) != NULL)
931 break; 987 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines