[xinit] XSLASHGLOB

Thomas Klausner wiz at NetBSD.org
Thu Jul 12 04:57:34 PDT 2012


Hi!

While looking at NetBSD xsrc patches I found one for xinit.

Index: xinit/dist/xinitrc.cpp
===================================================================
RCS file: /cvsroot/xsrc/external/mit/xinit/dist/xinitrc.cpp,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -u -r1.1.1.3 -r1.2
--- xinit/dist/xinitrc.cpp      21 Nov 2010 03:47:48 -0000      1.1.1.3
+++ xinit/dist/xinitrc.cpp      6 Mar 2011 01:05:51 -0000       1.2
@@ -84,8 +84,9 @@
 XCOMM This is the fallback case if nothing else is executed above
 #endif /* !defined(__SCO__)  && !defined(__UNIXWARE__) */

+XCOMM do not use slash-star in the glob; slash-questionmark-star is equivalent
 if [ -d XINITDIR/xinitrc.d ] ; then
-       for f in XINITDIR/xinitrc.dXSLASHGLOB.sh ; do
+       for f in XINITDIR/xinitrc.d/?*.sh ; do
                [ -x "$f" ] && . "$f"
        done
        unset f

The commit message was:
Use xinitrc.d/?*.sh as the matching pattern instead of needing a
fragile sed substitution XSLASHGLOB to produce xinitrc.d/*.sh. (If
that were used literally the slash-star would confuse cpp.)

Fixes PR 44619. Patch has been sent upstream.


I don't know where it was sent or if the discussion had a result, so
I'd like to know if the patch would be accepted? (with an additional
patch removing it from cpprules.in as well).


Some history: The variable XSLASHGLOB was introduced by the following commit:

commit aa026deef43a8c1479e6a558194e0a473bbdaeb0
Author: Jeremy Huddleston <jeremy at tifa.local>
Date:   Sat Mar 1 17:30:47 2008 -0800

    Apple: Adding support for an xinitrc.d directory on OSX, so fink doesn't need to clobber files

diff --git a/cpprules.in b/cpprules.in
index 2e50207..f32eafc 100644
--- a/cpprules.in
+++ b/cpprules.in
@@ -10,6 +10,7 @@ CPP_SED_MAGIC = $(SED) -e '/^\#  *[0-9][0-9]*  *.*$$/d' \
                        -e '/^[         ]*XCOMM$$/s/XCOMM/\#/' \
                        -e '/^[         ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
                        -e '/^[         ]*XHASH/s/XHASH/\#/' \
+                       -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \
                        -e '/\@\@$$/s/\@\@$$/\\/'

 # Strings to replace in man pages
diff --git a/xinitrc.cpp b/xinitrc.cpp
index e42002d..89a65ca 100644
--- a/xinitrc.cpp
+++ b/xinitrc.cpp
@@ -87,20 +87,13 @@ XCOMM This is the fallback case if nothing else is executed above

 #ifdef __APPLE__

-if [ -x /usr/X11/bin/xset ] ; then
-       fontpath="/usr/X11/lib/X11/fonts/misc/,/usr/X11/lib/X11/fonts/TTF/,/usr/X11/lib/X11/fonts/OTF,/usr/X11/lib/X11/fonts/Type1/,/usr/X11/lib/X11/fonts/75dpi:unscaled/,/usr
-
-       [ -e "$HOME"/.fonts/fonts.dir ] && fontpath="$fontpath,$HOME/.fonts"
-       [ -e "$HOME"/Library/Fonts/fonts.dir ] && fontpath="$fontpath,$HOME/Library/Fonts"
-       [ -e /Library/Fonts/fonts.dir ] && fontpath="$fontpath,/Library/Fonts"
-       [ -e /System/Library/Fonts/fonts.dir ] && fontpath="$fontpath,/System/Library/Fonts"
-
-       /usr/X11/bin/xset fp= "$fontpath"
-       unset fontpath
+if [ -d XINITDIR/xinitrc.d ] ; then
+       for f in XINITDIR/xinitrc.dXSLASHGLOB.sh ; do
+               [ -x "$f" ] && . "$f"
+       done
+       unset f
 fi

-[ -x /usr/bin/quartz-wm ] && exec /usr/bin/quartz-wm
-
 #endif

 TWM &

Comments welcome,
 Thomas


More information about the xorg-devel mailing list