From 2a991a811de4c7b22f812682b267b616a809fd9a Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Mon, 2 Mar 2009 00:42:28 -0500 Subject: [PATCH] http://ftp.x.org/contrib/applications/xscreensaver-2.34.tar.gz -rw-r--r-- 1 zblaxell zblaxell 949582 Oct 8 1998 xscreensaver-2.34.tar.gz 5705e6f80bec56888beba7a9d17029c29feab717 xscreensaver-2.34.tar.gz --- Makefile.in | 81 +- README | 65 +- README.debugging | 56 +- config.h-vms | 65 +- config.h.in | 13 +- configure | 707 +++++----- configure.in | 71 +- driver/Makefile.in | 22 +- driver/XScreenSaver.ad.in | 81 +- driver/XScreenSaver_ad.h | 67 +- driver/demo.c | 10 +- driver/dialogs-Xaw.c | 135 -- driver/dialogs-Xm.c | 270 ---- driver/dotfile.c | 698 ++++++++++ driver/lock.c | 1201 +++++++++-------- driver/passwd.c | 8 +- driver/setuid.c | 293 +++-- driver/splash.c | 782 ++++++++--- driver/stderr.c | 12 +- driver/subprocs.c | 190 ++- driver/test-passwd.c | 205 ++- driver/test-uid.c | 13 +- driver/test-xdpms.c | 156 +++ driver/timers.c | 26 +- driver/windows.c | 140 +- driver/xscreensaver-command.c | 213 ++- driver/xscreensaver-command.man | 19 +- driver/xscreensaver.c | 1339 +++++++++++-------- driver/xscreensaver.h | 84 +- driver/xscreensaver.man | 175 +-- driver/xset.c | 4 + hacks/ant.c | 3 +- hacks/distort.c | 92 +- hacks/glx/Makefile.in | 125 +- hacks/glx/b_draw.c | 260 ++++ hacks/glx/b_lockglue.c | 181 +++ hacks/glx/b_sphere.c | 231 ++++ hacks/glx/bubble3d.h | 90 ++ hacks/glx/glplanet.c | 777 +++++++++++ hacks/glx/lament.c | 107 +- hacks/glx/pipes.c | 5 +- hacks/glx/rubik.c | 65 +- hacks/glx/xpm-ximage.c | 141 ++ hacks/glx/xpm-ximage.h | 28 + hacks/images/earth.xbm | 2192 +++++++++++++++++++++++++++++++ hacks/kumppa.c | 4 +- hacks/maze.c | 2 +- hacks/rd-bomb.c | 2 +- hacks/xlockmore.c | 7 +- utils/resources.c | 9 +- utils/version.h | 2 +- utils/xshm.c | 64 +- xscreensaver.lsm | 12 +- 53 files changed, 8872 insertions(+), 2728 deletions(-) create mode 100644 driver/dotfile.c create mode 100644 driver/test-xdpms.c create mode 100644 hacks/glx/b_draw.c create mode 100644 hacks/glx/b_lockglue.c create mode 100644 hacks/glx/b_sphere.c create mode 100644 hacks/glx/bubble3d.h create mode 100644 hacks/glx/glplanet.c create mode 100644 hacks/glx/xpm-ximage.c create mode 100644 hacks/glx/xpm-ximage.h create mode 100644 hacks/images/earth.xbm diff --git a/Makefile.in b/Makefile.in index 2127292b..89d3a43b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -62,7 +62,7 @@ tar: mv xscreensaver.lsm.$$$$ xscreensaver.lsm ; \ NAME=`sed -n \ 's/[^0-9]*\([0-9]\.[0-9][0-9]*\).*/xscreensaver-\1/p' utils/version.h` ; \ - rm -f $$NAME ; ln -s . $$NAME ; \ + rm -rf $$NAME ; ln -s . $$NAME ; \ FILES= ; \ for subdir in $(SUBDIRS) ; do \ d=`pwd` ; \ @@ -151,18 +151,76 @@ bump-version:: echo "overwrote $$SRC"; \ ls -lFd $$SRC +test-tar:: + @ \ + VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][0-9]*\).*/\1/p' utils/version.h` ; \ + D=xscreensaver-$$VERS ; \ + NAME="$$D.tar.gz" ; \ + if [ ! -f $$NAME ]; then \ + echo "$$NAME does not exist! Did you forget to \`make tar'?" ; \ + exit 1 ; \ + fi ; \ + \ + set -e ; \ + set -x ; \ + \ + if [ -d $$D ]; then \ + chmod -R u+w $$D ; \ + fi ; \ + rm -rf $$D ; \ + zcat $$D.tar.gz | tar -xf - ; \ + cd $$D ; \ + chmod -R a-w . ; \ + chmod u+w . ; \ + mkdir BIN ; \ + mkdir BIN/athena ; \ + mkdir BIN/motif ; \ + mkdir BIN/lesstif ; \ + chmod a-w . ; \ + \ + ( cd BIN/athena ; \ + CC=cc ; \ + export CC ; \ + ../../configure --with-athena ; \ + echo --------------------------------------------------------------- ; \ + gmake ; \ + echo --------------------------------------------------------------- ); \ + \ + ( cd BIN/motif ; \ + CC=cc ; \ + export CC ; \ + ../../configure --with-motif=/usr/local/motif ; \ + echo --------------------------------------------------------------- ; \ + ( cd utils; gmake ) ; \ + ( cd driver; gmake ) ; \ + echo --------------------------------------------------------------- ); \ + \ + ( cd BIN/lesstif ; \ + CC=cc ; \ + export CC ; \ + ../../configure --with-motif=/usr/local/lesstif ; \ + echo --------------------------------------------------------------- ; \ + ( cd utils; gmake ) ; \ + ( cd driver; gmake ) ; \ + echo --------------------------------------------------------------- ); \ + \ + chmod -R u+w . ; \ + + www:: @ \ DEST=$$HOME/www/xscreensaver ; \ VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][0-9]*\).*/\1/p' utils/version.h` ; \ - NAME="xscreensaver-$$VERS.tar.gz" ; \ + HEAD="xscreensaver-$$VERS" ; \ + NAME="$$HEAD.tar.gz" ; \ + \ if [ ! -f $$NAME ]; then \ echo "$$NAME does not exist! Did you forget to \`make tar'?" ; \ exit 1 ; \ fi ; \ if [ -f $$DEST/$$NAME ]; then \ echo -n "WARNING: $$DEST/$$NAME already exists! Overwrite? "; \ - read line; \ + read line; \ if [ "x$$line" != "xyes" -a "x$$line" != "xy" ]; then \ exit 1 ; \ fi ; \ @@ -172,10 +230,9 @@ www:: cd $$DEST ; \ \ TMP=/tmp/xd.$$$$ ; \ - sed "s/xscreensaver-[0-9]\.[0-9][0-9]\.tar\.gz/$$NAME/g" index.html \ - > $$TMP ; \ + sed "s/xscreensaver-[0-9]\.[0-9][0-9]*/$$HEAD/g" download.html > $$TMP ; \ echo '' ; \ - diff -u0 index.html $$TMP ; \ + diff -u0 download.html $$TMP ; \ echo '' ; \ \ OLDEST=`ls xscreensaver*.tar.gz | head -1` ; \ @@ -189,6 +246,16 @@ www:: set -x ; \ fi ; \ cvs add -kb $$NAME ; \ - cat $$TMP > index.html ; \ + cat $$TMP > download.html ; \ rm -f $$TMP ; \ + \ + (cd ..; $(MAKE) xscreensaver/changelog.html ); \ + cvs diff -u0 changelog.html ; \ + \ + echo -n "Ok? "; \ + read line; \ + if [ "x$$line" != "xyes" -a "x$$line" != "xy" ]; then \ + exit 1 ; \ + fi ; \ + \ cvs commit -m "$$VERS" diff --git a/README b/README index 70ddfda5..5d64fc62 100644 --- a/README +++ b/README @@ -73,6 +73,47 @@ http://www.jwz.org/xscreensaver/. ============ +Changes since 2.33: * Fixed a bug that was making `pipes' generate way too + many valves. Made the viewpoint in `pipes' be selected + randomly instead of always being -10 degrees. + * Fixed a bug in the XSHM code, in the case where the + server supports the XSHM extension but is not the same + machine as the client. + * Made `rd-bomb' default to taking up the whole screen. + * Made it not try to do fading/unfading if no PseudoColor + visuals exist. + * Initial attempt at supporting VT-locking (doesn't work + yet.) + * Eliminated the `captureStdout' resource; now + `captureStderr' controls both streams. + * Added `-capture-stderr' and `-no-capture-stderr' + command-line arguments. + * Added `glplanet' hack. + * When a hack is selected with `xscreensaver-command + -select', that hack will be used until further notice + (until the saver turns off, or another activation + command is issued.) +Changes since 2.32: * Made `xscreensaver-command' print error messages: + the xscreensaver daemon now responds to ClientMessage + events by writing a response message on a window + property, instead of just writing to its stderr. + * Made the ~/.xscreensaver file be automatically reloaded + when the file date changes. + * The password dialog and splash screen no longer depend + on Motif or Athena. This should clear up a number of + focus problems, and is the first step on the path + toward moving all of the Motif/Athena/whatever code + out of the xscreensaver daemon, and into external + processes. + * Don't complain about LessTif 0.86 any more, since the + new password dialog makes that problem go away. + * Configure tweaks for Irix 6.5, SunOS 5.something. + * New `-reflect' option to `distort'. +Changes since 2.31: * Added reading and writing of a ~/.xscreensaver file, + so that the Preferences panel can save its settings. + * New version of `rubik'. + * Added `-select N' argument to `xscreensaver-command'. + * Oops, left out some of the `bubbles3d' files... Changes since 2.30: * The cursor was invisible in the password dialog. Fixed. * Made configure warn against MesaGL 2.6. * Fixed X error at startup when using non-default visual. @@ -121,7 +162,7 @@ Changes since 2.24: * Improved motion in `rd-bomb'. `swirl' hacks, which speeds them up a bit. * Added `lament' hack. Changes since 2.23: * Tweaked the order of the -L options again. - * Cleaned up configure's --help message. + * Cleaned up configure's `--help' message. * Added `kumppa' hack. * Smarter maze-solving algorithm in `maze'. * Took `xlyap' out of the default list of hacks, since @@ -136,12 +177,12 @@ Changes since 2.23: * Tweaked the order of the -L options again. * Some random configure tweaks. * Added a `timestamp' resource that makes the `-verbose' messages include the time at which they were printed. -Changes since 2.22: * The fix for SGI's "scheme" nonsense broke things, and +Changes since 2.22: * The fix for SGI's ``scheme'' nonsense broke things, and let the user's "*background" resource show through. Fixed it in a different way. Changes since 2.21: * Added support for the DPMS server extension (Display Power Management System.) - * Made configure advertize the --enable-subdir option a + * Made configure advertize the `--enable-subdir' option a little more, since that seemed to cause some people stress. Also, made that directory be built into the xscreensaver executable, as a hardcoded prefix to @@ -149,11 +190,11 @@ Changes since 2.21: * Added support for the DPMS server extension (Display * Made configure prefer the two-arg gettimeofday to the one-arg version, since AIX doesn't have any prototypes. * Made it work with Xaw3d (the 3D Athena library.) - * Made "make install" create directories as necessary. + * Made `make install' create directories as necessary. * New version of lmorph from Sverre. * Added `crystal' and `discreet' hacks from xlockmore. * Added a new mode to `bsod'. -Changes since 2.20: * Made "xscreensaver-command -time" use different words. +Changes since 2.20: * Made `xscreensaver-command -time' use different words. (It now describes the two states as "screen blanked since..." and "screen non-blanked since..." instead of "active since..." and "inactive since..." which a lot @@ -164,14 +205,14 @@ Changes since 2.20: * Made "xscreensaver-command -time" use different words. xscreensaver-command programs more obvious. * Rewrote (and reorganized) parts of the xscreensaver and xscreensaver-command manual pages. - * Renamed xscreensaver's "-lock" command-line option to - be "-lock-mode", to avoid confusion with the "-lock" + * Renamed xscreensaver's `-lock' command-line option to + be `-lock-mode', to avoid confusion with the `-lock' option to xscreensaver-command, which does a totally different thing. - * Removed xscreensaver's "-demo" command-line option for - a similar reason; use "xscreensaver-command -demo" + * Removed xscreensaver's `-demo' command-line option for + a similar reason; use `xscreensaver-command -demo' instead. - * Disabled SGI's "scheme" nonsense in a better way than + * Disabled SGI's ``scheme'' nonsense in a better way than fully-qualifying the background colors in every single hack. * Fixed some other minor cosmetic problems when *sgiMode @@ -249,7 +290,7 @@ Changes since 2.12: * Made `decayscreen' do directions other than down. Changes since 2.11: * Added `README.debugging'. * Added `puzzle' hack. * Added `xlyap' hack. - * Added "default-n" as a visual name, so that one can + * Added `default-n' as a visual name, so that one can have -install on by default, but turn it off for certain poorly-behaved hacks (like xv.) * Added support for grabbing frames of external video @@ -279,7 +320,7 @@ Changes since 2.07: * New hacks `rd-bomb' and `coral'. * Fixed a bug in the -time option. * Fixed a bug in configure related to LessTif. Changes since 2.06: * Minor header tweaks in windows.c and flag.c. - * Made multi-architecture (VPATH) builds work properly. + * Made multi-architecture ($VPATH) builds work properly. * Merged new GL stuff from xlockmore (rubik, morph3d.) * Fixed intermittent crashes in `imsmap' and `munch'. * Added `fadeplot' hack from xlockmore. diff --git a/README.debugging b/README.debugging index 87ebb4d2..f5ca66eb 100644 --- a/README.debugging +++ b/README.debugging @@ -9,8 +9,8 @@ document gives some hints for isolating them; the more information you can give me about the problem, the better the odds that I'll be able to fix it. But, if you don't have time to go through these - steps, report the bug anyway -- even vague bug reports can be - better than no bug report at all. + steps, please report the bug anyway -- even vague bug reports can + be better than no bug report at all. -------- STEP ZERO: @@ -20,9 +20,9 @@ STEP ZERO: STEP ZERO, PART TWO: Do you have the most recent version? Go make sure. - http://www.jwz.org/xscreensaver/ + http://www.jwz.org/xscreensaver/. -BUILDING: +COMPILATION PROBLEMS: If you get an error running the `configure' script, the first thing you should try is deleting the `config.cache' file, and running again. @@ -48,8 +48,9 @@ BUILDING: * rearrange your $PATH so that the broken gcc is not on it; * or pass $CC in the environment, like so: - csh: setenv CC cc ; ./configure - sh: CC=cc ; ./configure + + csh: setenv CC cc ; ./configure + sh: CC=cc ; ./configure Before doing this, you'll need to nuke `config.cache'. @@ -63,7 +64,7 @@ BUILDING: free Unixes systems, a Motif clone is available from http://www.lesstif.org/. -RUNNING: +RUN-TIME PROBLEMS: For runtime errors, it's important to keep in mind that there are two parts to xscreensaver: there is the screensaver driver process @@ -109,13 +110,26 @@ RUNNING: * If it dumps core, what does the core file say? Run the program under a debugger, and show me the stack trace. - (If you don't know how to do that, that's ok.) + To extract a stack trace from a core file with gdb, do this: + + gdb ./the-program ./core + bt + + To extract a stack trace from a core file with dbx, do this: + + dbx ./the-program ./core + where + + If the bottom few lines of the output don't include the functions + `main_loop()' and `main()', then something's wrong: are you sure + the core file came from that program? * If it gets an X error, where did it come from? Run - xscreensaver with the `-sync' command-line option; if -sync - is used, then X errors will cause xscreensaver to dump a core - file. Look at the core file with a debugger and show me the - stack trace: were in xscreensaver did that X error come from? + xscreensaver with the `-sync' command-line option. When `-sync' + is used, X errors will cause xscreensaver to dump a core file. + Look at the core file with a debugger and show me the stack trace, + as above: I need to know where in xscreensaver that X error came + from. If the problem is with the xscreensaver process itself, or if you can't figure out which demo is causing the problem, or if you can't @@ -124,13 +138,12 @@ RUNNING: * Start `xscreensaver' with the command-line arguments - -verbose -xrm '*captureStderr:false' -xrm '*captureStdout:false' + -verbose -no-capture-stderr - This will cause it to write a lot of debugging info to the - stdout and stderr of the xscreensaver process (the -verbose - argument turns on the diagnostics; the remaining arguments - prevent the data from being displayed on the screensaver - window as well. + This will cause it to write a lot of debugging info to the stderr + of the xscreensaver process (the `-verbose' option turns on the + diagnostics; the `-no-capture-stderr' option prevents the data + from being displayed on the screensaver window as well.) You also might want to use the `-timestamp' option, which will cause the xscreensaver messages to include the time at which @@ -140,10 +153,9 @@ RUNNING: log information to a file and examine it later. For example, you could start it from your login script like this (csh syntax): - ( cd ~/src/xscreensaver/ ; \ - xscreensaver -sync -verbose -timestamp \ - -xrm '*captureStderr:false' -xrm '*captureStdout:false' \ - >>&LOG & ) + ( cd ~/src/xscreensaver/ ; \ + xscreensaver -sync -verbose -timestamp -no-capture-stderr \ + >>&LOG & ) * Hackers only: If you're feeling adventurous enough to run gdb on the xscreensaver driver process itself, make sure you've diff --git a/config.h-vms b/config.h-vms index d91ebfc4..5dd8158b 100644 --- a/config.h-vms +++ b/config.h-vms @@ -4,7 +4,7 @@ -/* config.h.in --- xscreensaver, Copyright (c) 1997 Jamie Zawinski. +/* config.h.in --- xscreensaver, Copyright (c) 1998 Jamie Zawinski. * * The best way to set these parameters is by running the included `configure' * script. That examines your system, and generates `config.h' from @@ -14,16 +14,22 @@ * that your changes will be lost if you ever run `configure' again. */ + /* ************************************************************************* CONFIGURING SERVER EXTENSIONS ************************************************************************* */ /* Define this if you have the XReadDisplay extension (I think this is an - SGI-only thing; it's in .) A couple of - the screenhacks will take advantage of this if it's available. + SGI-only thing; it's in .) A few of the + screenhacks will take advantage of this if it's available. */ #undef HAVE_READ_DISPLAY_EXTENSION +/* Define this if you have the Iris Video Library (dmedia/vl.h on SGI.) + A few of the screenhacks will take advantage of this if it's available. + */ +#undef HAVE_SGI_VIDEO + /* Define this if you have the XHPDisableReset function (an HP only thing.) */ #undef HAVE_XHPDISABLERESET @@ -85,6 +91,16 @@ */ #undef HAVE_SGI_SAVER_EXTENSION +/* Define this if you have the SGI-VIDEO-CONTROL extension. This is standard + * on Irix systems, and not available elsewhere. + */ +#undef HAVE_SGI_VC_EXTENSION + +/* Define this if you have the XDPMS extension. This is standard on + * sufficiently-recent XFree86 systems, and possibly elsewhere. (It's + * available if the file /usr/include/X11/extensions/dpms.h exists.) + */ +#define HAVE_DPMS_EXTENSION 1 /* ************************************************************************* @@ -93,7 +109,7 @@ /* Define this if you have Motif. */ -#define HAVE_MOTIF +#define HAVE_MOTIF 1 /* Define this if you don't have Motif, but you have Athena (-Xaw). */ @@ -108,12 +124,12 @@ /* Define this if you have the XPM library installed. Some of the demos can * make use of this if it is available. */ -#undef HAVE_XPM +#define HAVE_XPM 1 /* Define this if you have the Xmu library. This is standard part of X, and * if your vendor doesn't ship it, you should report that as a bug. */ -#define HAVE_XMU +#define HAVE_XMU 1 /* Define this if you have OpenGL. Some of the demos require it, so if you * don't have it, then those particular demos won't be built. (This won't @@ -121,11 +137,20 @@ */ #undef HAVE_GL -/* Define this if you have GL, but it's the MesaGL variant. (The libraries - have different names.) (HAVE_GL should be defined too.) +/* Define this if you have OpenGL, but it's the MesaGL variant. (The + libraries have different names.) (HAVE_GL should be defined too.) */ #undef HAVE_MESA_GL +/* Define this if your version of OpenGL has the glBindTexture() routine. + This is the case for OpenGL 1.1, but not for OpenGL 1.0. + */ +#undef HAVE_GLBINDTEXTURE + +/* Define this if you have the X Shared Memory Extension. + */ +#undef HAVE_XSHM_EXTENSION + /* Some screenhacks like to run an external program to generate random pieces of text; set this to the one you like ("yow" and "fortune" are the most likely prospects.) Note that this is just the default; X resources can @@ -182,6 +207,14 @@ */ #undef HAVE_HPUX_PASSWD +/* Define this if you are on a system that supports the VT_LOCKSWITCH and + VT_UNLOCKSWITCH ioctls. If this is defined, then when the screen is + locked, switching to another virtual terminal will also be prevented. + That is, the whole console will be locked, rather than just the VT on + which X is running. + */ +#define HAVE_VT_LOCKSWITCH 1 + /* ************************************************************************* OTHER C ENVIRONMENT JUNK @@ -218,7 +251,7 @@ #undef size_t /* Define if you have the ANSI C header files. */ -#define STDC_HEADERS +#define STDC_HEADERS 1 /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME @@ -243,9 +276,23 @@ /* Define if you have the uname function. */ #undef HAVE_UNAME +#if (__VMS_VER >= 70000000) +# define HAVE_UNAME 1 +#endif /* Define if you have the fcntl function. */ #undef HAVE_FCNTL +/* Define if you have the sigaction function. */ +#undef HAVE_SIGACTION + /* Define if you have the header file. */ #undef HAVE_UNISTD_H + +/* Define if you have the header file. */ +#undef HAVE_CRYPT_H + +/* Define to use sigaction() instead of signal() for SIGCHLD-related activity. + This is necessary at least on SCO OpenServer 5, due to a Unix kernel bug. + */ +#undef USE_SIGACTION diff --git a/config.h.in b/config.h.in index 98e6a91b..b0121fd2 100644 --- a/config.h.in +++ b/config.h.in @@ -1,4 +1,4 @@ -/* config.h.in --- xscreensaver, Copyright (c) 1997 Jamie Zawinski. +/* config.h.in --- xscreensaver, Copyright (c) 1998 Jamie Zawinski. * * The best way to set these parameters is by running the included `configure' * script. That examines your system, and generates `config.h' from @@ -201,6 +201,14 @@ */ #undef HAVE_HPUX_PASSWD +/* Define this if you are on a system that supports the VT_LOCKSWITCH and + VT_UNLOCKSWITCH ioctls. If this is defined, then when the screen is + locked, switching to another virtual terminal will also be prevented. + That is, the whole console will be locked, rather than just the VT on + which X is running. + */ +#undef HAVE_VT_LOCKSWITCH + /* ************************************************************************* OTHER C ENVIRONMENT JUNK @@ -272,6 +280,9 @@ /* Define if you have the header file. */ #undef HAVE_UNISTD_H +/* Define if you have the header file. */ +#undef HAVE_CRYPT_H + /* Define to use sigaction() instead of signal() for SIGCHLD-related activity. This is necessary at least on SCO OpenServer 5, due to a Unix kernel bug. */ diff --git a/configure b/configure index d35d9773..73a1ef5f 100755 --- a/configure +++ b/configure @@ -102,6 +102,13 @@ Screen Locking options: --disable-locking Do not allow locking at all." ac_help="$ac_help + --enable-vt-locking Compile in support for locking Virtual Terminals. + This is the default if the system supports it, and + if locking support is included (--enable-locking.) + --disable-vt-locking Do not allow locking of VTs, even if locking is + enabled." +ac_help="$ac_help + --with-kerberos Include support for Kerberos authentication, if possible (this is the default.) --without-kerberos Do not compile in support for Kerberos." @@ -635,7 +642,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:650: checking host system type" >&5 +echo "configure:657: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -659,7 +666,7 @@ echo "$ac_t""$host" 1>&6 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:674: checking for $ac_word" >&5 +echo "configure:681: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -688,7 +695,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:703: checking for $ac_word" >&5 +echo "configure:710: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -736,7 +743,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:751: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:758: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -746,11 +753,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -770,12 +777,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:785: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:792: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:790: checking whether we are using GNU C" >&5 +echo "configure:797: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -784,7 +791,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:799: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:806: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -799,7 +806,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:814: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:821: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -829,7 +836,7 @@ fi if test -z "$GCC"; then echo $ac_n "checking how to request ANSI compilation""... $ac_c" 1>&6 -echo "configure:844: checking how to request ANSI compilation" >&5 +echo "configure:851: checking how to request ANSI compilation" >&5 case "$host" in *-hpux*) echo "$ac_t""HPUX: adding -Ae" 1>&6 @@ -853,16 +860,16 @@ fi echo $ac_n "checking whether the compiler works on ANSI C""... $ac_c" 1>&6 -echo "configure:868: checking whether the compiler works on ANSI C" >&5 +echo "configure:875: checking whether the compiler works on ANSI C" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: Couldn't build even a trivial ANSI C program: check CC." 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 else @@ -877,7 +884,7 @@ fi case "$host" in - *-irix*) + *-irix5* |*-irix6.0-3* ) if test -n "$GCC"; then echo "$ac_t""Turning on gcc compiler warnings." 1>&6 CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format" @@ -911,7 +918,7 @@ esac echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:926: checking how to run the C preprocessor" >&5 +echo "configure:933: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -926,13 +933,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:947: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:954: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -943,13 +950,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:964: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:971: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -982,7 +989,7 @@ echo "$ac_t""$CPP" 1>&6 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:997: checking for a BSD compatible install" >&5 +echo "configure:1004: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1033,7 +1040,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' INSTALL_DIRS='${INSTALL} -d' echo $ac_n "checking whether \"\${INSTALL} -d\" creates intermediate directories""... $ac_c" 1>&6 -echo "configure:1048: checking whether \"\${INSTALL} -d\" creates intermediate directories" >&5 +echo "configure:1055: checking whether \"\${INSTALL} -d\" creates intermediate directories" >&5 rm -rf conftestdir if mkdir conftestdir; then cd conftestdir >&- @@ -1044,7 +1051,7 @@ echo "configure:1048: checking whether \"\${INSTALL} -d\" creates intermediate d else echo "$ac_t""no" 1>&6 echo $ac_n "checking whether \"mkdir -p\" creates intermediate directories""... $ac_c" 1>&6 -echo "configure:1059: checking whether \"mkdir -p\" creates intermediate directories" >&5 +echo "configure:1066: checking whether \"mkdir -p\" creates intermediate directories" >&5 rm -rf dir1 mkdir -p dir1/dir2 >&- 2>&- if test -d dir1/dir2/. ; then @@ -1059,7 +1066,7 @@ echo "configure:1059: checking whether \"mkdir -p\" creates intermediate directo fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1074: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1081: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1087,12 +1094,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1102: checking for working const" >&5 +echo "configure:1109: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1163: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1162,21 +1169,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1177: checking for inline" >&5 +echo "configure:1184: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1198: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1203,12 +1210,12 @@ esac echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1218: checking for ANSI C header files" >&5 +echo "configure:1225: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1216,7 +1223,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1231: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1238: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1233,7 +1240,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1251,7 +1258,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1272,7 +1279,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1283,7 +1290,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1307,12 +1314,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1322: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1329: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1321,7 +1328,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1336: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1343: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1342,12 +1349,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1357: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1364: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1363,7 +1370,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1378: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1385: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1388,12 +1395,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1403: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1410: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -1401,7 +1408,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1423: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1426,7 +1433,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1441: checking for opendir in -ldir" >&5 +echo "configure:1448: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1434,7 +1441,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1467,7 +1474,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1482: checking for opendir in -lx" >&5 +echo "configure:1489: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1475,7 +1482,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1510,12 +1517,12 @@ fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:1525: checking for mode_t" >&5 +echo "configure:1532: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1543,12 +1550,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:1558: checking for pid_t" >&5 +echo "configure:1565: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1576,12 +1583,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1591: checking for size_t" >&5 +echo "configure:1598: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1609,12 +1616,12 @@ EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1624: checking return type of signal handlers" >&5 +echo "configure:1631: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1631,7 +1638,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1646: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1653: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1651,12 +1658,12 @@ EOF echo $ac_n "checking how to call gettimeofday""... $ac_c" 1>&6 -echo "configure:1666: checking how to call gettimeofday" >&5 +echo "configure:1673: checking how to call gettimeofday" >&5 if eval "test \"`echo '$''{'ac_cv_gettimeofday_args'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1665,7 +1672,7 @@ struct timeval tv; struct timezone tzp; gettimeofday(&tv, &tzp); ; return 0; } EOF -if { (eval echo configure:1680: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1687: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_gettimeofday_args=2 else @@ -1673,7 +1680,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < #include @@ -1681,7 +1688,7 @@ int main() { struct timeval tv; gettimeofday(&tv); ; return 0; } EOF -if { (eval echo configure:1696: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1703: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_gettimeofday_args=1 else @@ -1721,12 +1728,12 @@ fi for ac_func in select fcntl uname nice setpriority getcwd getwd putenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1736: checking for $ac_func" >&5 +echo "configure:1743: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1776,12 +1783,12 @@ done for ac_func in sigaction do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1791: checking for $ac_func" >&5 +echo "configure:1798: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1829,21 +1836,21 @@ fi done -for ac_hdr in unistd.h +for ac_hdr in unistd.h crypt.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1848: checking for $ac_hdr" >&5 +echo "configure:1855: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1858: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1865: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1902,7 +1909,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:1917: checking for X" >&5 +echo "configure:1924: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -1964,12 +1971,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1991: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2038,14 +2045,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -2151,17 +2158,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:2166: checking whether -R must be followed by a space" >&5 +echo "configure:2173: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_nospace=yes else @@ -2177,14 +2184,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_space=yes else @@ -2216,7 +2223,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:2231: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:2238: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2224,7 +2231,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2257,7 +2264,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:2272: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:2279: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2265,7 +2272,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2305,12 +2312,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:2320: checking for gethostbyname" >&5 +echo "configure:2327: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -2354,7 +2361,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:2369: checking for gethostbyname in -lnsl" >&5 +echo "configure:2376: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2362,7 +2369,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2403,12 +2410,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:2418: checking for connect" >&5 +echo "configure:2425: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -2452,7 +2459,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:2467: checking for connect in -lsocket" >&5 +echo "configure:2474: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2460,7 +2467,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2495,12 +2502,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:2510: checking for remove" >&5 +echo "configure:2517: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -2544,7 +2551,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:2559: checking for remove in -lposix" >&5 +echo "configure:2566: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2552,7 +2559,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2587,12 +2594,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:2602: checking for shmat" >&5 +echo "configure:2609: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -2636,7 +2643,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:2651: checking for shmat in -lipc" >&5 +echo "configure:2658: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2644,7 +2651,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2688,7 +2695,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:2703: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:2710: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2696,7 +2703,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2744,7 +2751,7 @@ fi echo $ac_n "checking for X app-defaults directory""... $ac_c" 1>&6 -echo "configure:2759: checking for X app-defaults directory" >&5 +echo "configure:2766: checking for X app-defaults directory" >&5 if eval "test \"`echo '$''{'ac_cv_x_app_defaults'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2891,7 +2898,7 @@ APPDEFAULTS=$ac_x_app_defaults fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < EOF @@ -2912,7 +2919,7 @@ rm -f conftest* # Check for the availability of the XPointer typedef, and define it otherwise. # echo $ac_n "checking for XPointer""... $ac_c" 1>&6 -echo "configure:2927: checking for XPointer" >&5 +echo "configure:2934: checking for XPointer" >&5 if eval "test \"`echo '$''{'ac_cv_xpointer'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2923,14 +2930,14 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < int main() { XPointer foo = (XPointer) 0; ; return 0; } EOF -if { (eval echo configure:2945: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2952: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_xpointer=yes else @@ -3064,7 +3071,7 @@ case "$host" in # Some versions of Slowlaris Motif require -lgen. But not all. Why? echo $ac_n "checking for regcmp in -lgen""... $ac_c" 1>&6 -echo "configure:3079: checking for regcmp in -lgen" >&5 +echo "configure:3086: checking for regcmp in -lgen" >&5 ac_lib_var=`echo gen'_'regcmp | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3072,7 +3079,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3120,17 +3127,17 @@ have_xmu=no CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/Xmu/Error.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xmu/Error.h""... $ac_c" 1>&6 -echo "configure:3135: checking for X11/Xmu/Error.h" >&5 +echo "configure:3142: checking for X11/Xmu/Error.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3145: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3152: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3174,7 +3181,7 @@ if test $have_xmu = yes ; then case "$host" in *-sunos4*) echo $ac_n "checking for the SunOS 4.1.x _get_wmShellWidgetClass bug""... $ac_c" 1>&6 -echo "configure:3189: checking for the SunOS 4.1.x _get_wmShellWidgetClass bug" >&5 +echo "configure:3196: checking for the SunOS 4.1.x _get_wmShellWidgetClass bug" >&5 if eval "test \"`echo '$''{'ac_cv_sunos_xmu_bug'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3187,14 +3194,14 @@ else # with X libraries because we know it's SunOS. LDFLAGS="$LDFLAGS -lXmu -lXt -lX11 -lXext -lm" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3216: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_sunos_xmu_bug=no else @@ -3210,21 +3217,21 @@ fi echo "$ac_t""$ac_cv_sunos_xmu_bug" 1>&6 if test $ac_cv_sunos_xmu_bug = yes ; then echo $ac_n "checking whether the compiler understands -static""... $ac_c" 1>&6 -echo "configure:3225: checking whether the compiler understands -static" >&5 +echo "configure:3232: checking whether the compiler understands -static" >&5 if eval "test \"`echo '$''{'ac_cv_ld_static'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -static" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_ld_static=yes else @@ -3269,7 +3276,7 @@ fi /*) echo $ac_n "checking for SGI SCREEN_SAVER headers""... $ac_c" 1>&6 -echo "configure:3284: checking for SGI SCREEN_SAVER headers" >&5 +echo "configure:3291: checking for SGI SCREEN_SAVER headers" >&5 d=$with_sgi/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -3279,7 +3286,7 @@ echo "configure:3284: checking for SGI SCREEN_SAVER headers" >&5 fi echo $ac_n "checking for SGI SCREEN_SAVER libs""... $ac_c" 1>&6 -echo "configure:3294: checking for SGI SCREEN_SAVER libs" >&5 +echo "configure:3301: checking for SGI SCREEN_SAVER libs" >&5 d=$with_sgi/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -3317,17 +3324,17 @@ if test $with_sgi = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/XScreenSaver.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/XScreenSaver.h""... $ac_c" 1>&6 -echo "configure:3332: checking for X11/extensions/XScreenSaver.h" >&5 +echo "configure:3339: checking for X11/extensions/XScreenSaver.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3342: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3349: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3380,7 +3387,7 @@ fi /*) echo $ac_n "checking for MIT-SCREEN-SAVER headers""... $ac_c" 1>&6 -echo "configure:3395: checking for MIT-SCREEN-SAVER headers" >&5 +echo "configure:3402: checking for MIT-SCREEN-SAVER headers" >&5 d=$with_mit/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -3390,7 +3397,7 @@ echo "configure:3395: checking for MIT-SCREEN-SAVER headers" >&5 fi echo $ac_n "checking for MIT-SCREEN-SAVER libs""... $ac_c" 1>&6 -echo "configure:3405: checking for MIT-SCREEN-SAVER libs" >&5 +echo "configure:3412: checking for MIT-SCREEN-SAVER libs" >&5 d=$with_mit/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -3429,17 +3436,17 @@ if test $have_sgi != yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/scrnsaver.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/scrnsaver.h""... $ac_c" 1>&6 -echo "configure:3444: checking for X11/extensions/scrnsaver.h" >&5 +echo "configure:3451: checking for X11/extensions/scrnsaver.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3454: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3461: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3483,7 +3490,7 @@ fi LDFLAGS="$LDFLAGS -L$x_libraries" fi echo $ac_n "checking for XScreenSaverRegister in -lXext""... $ac_c" 1>&6 -echo "configure:3498: checking for XScreenSaverRegister in -lXext" >&5 +echo "configure:3505: checking for XScreenSaverRegister in -lXext" >&5 ac_lib_var=`echo Xext'_'XScreenSaverRegister | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3491,7 +3498,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3553,7 +3560,7 @@ fi LDFLAGS="$LDFLAGS -L$x_libraries" fi echo $ac_n "checking for XScreenSaverRegister in -lXExExt""... $ac_c" 1>&6 -echo "configure:3568: checking for XScreenSaverRegister in -lXExExt" >&5 +echo "configure:3575: checking for XScreenSaverRegister in -lXExExt" >&5 ac_lib_var=`echo XExExt'_'XScreenSaverRegister | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3561,7 +3568,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXExExt -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3618,7 +3625,7 @@ fi LDFLAGS="$LDFLAGS -L$x_libraries" fi echo $ac_n "checking for XScreenSaverRegister in -lXss""... $ac_c" 1>&6 -echo "configure:3633: checking for XScreenSaverRegister in -lXss" >&5 +echo "configure:3640: checking for XScreenSaverRegister in -lXss" >&5 ac_lib_var=`echo Xss'_'XScreenSaverRegister | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3626,7 +3633,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXss -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3697,7 +3704,7 @@ fi /*) echo $ac_n "checking for XIDLE headers""... $ac_c" 1>&6 -echo "configure:3712: checking for XIDLE headers" >&5 +echo "configure:3719: checking for XIDLE headers" >&5 d=$with_xidle/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -3707,7 +3714,7 @@ echo "configure:3712: checking for XIDLE headers" >&5 fi echo $ac_n "checking for XIDLE libs""... $ac_c" 1>&6 -echo "configure:3722: checking for XIDLE libs" >&5 +echo "configure:3729: checking for XIDLE libs" >&5 d=$with_xidle/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -3745,17 +3752,17 @@ if test $with_xidle = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/xidle.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/xidle.h""... $ac_c" 1>&6 -echo "configure:3760: checking for X11/extensions/xidle.h" >&5 +echo "configure:3767: checking for X11/extensions/xidle.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3770: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3777: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3807,7 +3814,7 @@ fi /*) echo $ac_n "checking for XSHM headers""... $ac_c" 1>&6 -echo "configure:3822: checking for XSHM headers" >&5 +echo "configure:3829: checking for XSHM headers" >&5 d=$with_xshm/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -3817,7 +3824,7 @@ echo "configure:3822: checking for XSHM headers" >&5 fi echo $ac_n "checking for XSHM libs""... $ac_c" 1>&6 -echo "configure:3832: checking for XSHM libs" >&5 +echo "configure:3839: checking for XSHM libs" >&5 d=$with_xshm/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -3857,17 +3864,17 @@ if test $with_xshm = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/XShm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/XShm.h""... $ac_c" 1>&6 -echo "configure:3872: checking for X11/extensions/XShm.h" >&5 +echo "configure:3879: checking for X11/extensions/XShm.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3882: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3889: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3901,17 +3908,17 @@ fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "sys/ipc.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/ipc.h""... $ac_c" 1>&6 -echo "configure:3916: checking for sys/ipc.h" >&5 +echo "configure:3923: checking for sys/ipc.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3926: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3933: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3946,17 +3953,17 @@ fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "sys/shm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/shm.h""... $ac_c" 1>&6 -echo "configure:3961: checking for sys/shm.h" >&5 +echo "configure:3968: checking for sys/shm.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3971: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3978: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4005,7 +4012,7 @@ fi LDFLAGS="$LDFLAGS -L$x_libraries" fi echo $ac_n "checking for XShmQueryExtension in -lXextSam""... $ac_c" 1>&6 -echo "configure:4020: checking for XShmQueryExtension in -lXextSam" >&5 +echo "configure:4027: checking for XShmQueryExtension in -lXextSam" >&5 ac_lib_var=`echo XextSam'_'XShmQueryExtension | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4013,7 +4020,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXextSam -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4083,7 +4090,7 @@ fi /*) echo $ac_n "checking for SGI-VIDEO-CONTROL headers""... $ac_c" 1>&6 -echo "configure:4098: checking for SGI-VIDEO-CONTROL headers" >&5 +echo "configure:4105: checking for SGI-VIDEO-CONTROL headers" >&5 d=$with_sgivc/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -4093,7 +4100,7 @@ echo "configure:4098: checking for SGI-VIDEO-CONTROL headers" >&5 fi echo $ac_n "checking for SGI-VIDEO-CONTROL libs""... $ac_c" 1>&6 -echo "configure:4108: checking for SGI-VIDEO-CONTROL libs" >&5 +echo "configure:4115: checking for SGI-VIDEO-CONTROL libs" >&5 d=$with_sgivc/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -4133,17 +4140,17 @@ if test $with_sgivc = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/XSGIvc.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/XSGIvc.h""... $ac_c" 1>&6 -echo "configure:4148: checking for X11/extensions/XSGIvc.h" >&5 +echo "configure:4155: checking for X11/extensions/XSGIvc.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4158: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4165: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4186,7 +4193,7 @@ fi LDFLAGS="$LDFLAGS -L$x_libraries" fi echo $ac_n "checking for XSGIvcQueryGammaMap in -lXsgivc""... $ac_c" 1>&6 -echo "configure:4201: checking for XSGIvcQueryGammaMap in -lXsgivc" >&5 +echo "configure:4208: checking for XSGIvcQueryGammaMap in -lXsgivc" >&5 ac_lib_var=`echo Xsgivc'_'XSGIvcQueryGammaMap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4194,7 +4201,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXsgivc -lXext -lX11 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4263,7 +4270,7 @@ fi /*) echo $ac_n "checking for DPMS headers""... $ac_c" 1>&6 -echo "configure:4278: checking for DPMS headers" >&5 +echo "configure:4285: checking for DPMS headers" >&5 d=$with_dpms/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -4273,7 +4280,7 @@ echo "configure:4278: checking for DPMS headers" >&5 fi echo $ac_n "checking for DPMS libs""... $ac_c" 1>&6 -echo "configure:4288: checking for DPMS libs" >&5 +echo "configure:4295: checking for DPMS libs" >&5 d=$with_dpms/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -4313,17 +4320,17 @@ if test $with_dpms = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/dpms.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/dpms.h""... $ac_c" 1>&6 -echo "configure:4328: checking for X11/extensions/dpms.h" >&5 +echo "configure:4335: checking for X11/extensions/dpms.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4338: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4345: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4366,7 +4373,7 @@ fi LDFLAGS="$LDFLAGS -L$x_libraries" fi echo $ac_n "checking for DPMSInfo in -lXdpms""... $ac_c" 1>&6 -echo "configure:4381: checking for DPMSInfo in -lXdpms" >&5 +echo "configure:4388: checking for DPMSInfo in -lXdpms" >&5 ac_lib_var=`echo Xdpms'_'DPMSInfo | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4374,7 +4381,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXdpms -lXext -lX11 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4448,7 +4455,7 @@ fi /*) echo $ac_n "checking for Motif headers""... $ac_c" 1>&6 -echo "configure:4463: checking for Motif headers" >&5 +echo "configure:4470: checking for Motif headers" >&5 d=$with_motif/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -4458,7 +4465,7 @@ echo "configure:4463: checking for Motif headers" >&5 fi echo $ac_n "checking for Motif libs""... $ac_c" 1>&6 -echo "configure:4473: checking for Motif libs" >&5 +echo "configure:4480: checking for Motif libs" >&5 d=$with_motif/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -4503,7 +4510,7 @@ fi /*) echo $ac_n "checking for Athena headers""... $ac_c" 1>&6 -echo "configure:4518: checking for Athena headers" >&5 +echo "configure:4525: checking for Athena headers" >&5 d=$with_athena/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -4513,7 +4520,7 @@ echo "configure:4518: checking for Athena headers" >&5 fi echo $ac_n "checking for Athena libs""... $ac_c" 1>&6 -echo "configure:4528: checking for Athena libs" >&5 +echo "configure:4535: checking for Athena libs" >&5 d=$with_athena/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -4576,17 +4583,17 @@ check_motif() { CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "Xm/Xm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for Xm/Xm.h""... $ac_c" 1>&6 -echo "configure:4591: checking for Xm/Xm.h" >&5 +echo "configure:4598: checking for Xm/Xm.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4601: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4608: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4626,17 +4633,17 @@ check_athena() { CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/Xaw/Dialog.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xaw/Dialog.h""... $ac_c" 1>&6 -echo "configure:4641: checking for X11/Xaw/Dialog.h" >&5 +echo "configure:4648: checking for X11/Xaw/Dialog.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4651: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4658: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4675,7 +4682,7 @@ fi LDFLAGS="$LDFLAGS -L$x_libraries" fi echo $ac_n "checking for Xaw3dComputeTopShadowRGB in -lXaw3d""... $ac_c" 1>&6 -echo "configure:4690: checking for Xaw3dComputeTopShadowRGB in -lXaw3d" >&5 +echo "configure:4697: checking for Xaw3dComputeTopShadowRGB in -lXaw3d" >&5 ac_lib_var=`echo Xaw3d'_'Xaw3dComputeTopShadowRGB | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4683,7 +4690,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXaw3d -lXt -lXmu -lXext -lX11 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4770,7 +4777,7 @@ fi # XawViewportSetCoordinates in Viewport.h (R3 (or R4?) don't.) if test $have_athena = yes ; then echo $ac_n "checking for XawViewportSetCoordinates in Viewport.h""... $ac_c" 1>&6 -echo "configure:4785: checking for XawViewportSetCoordinates in Viewport.h" >&5 +echo "configure:4792: checking for XawViewportSetCoordinates in Viewport.h" >&5 if eval "test \"`echo '$''{'ac_cv_have_XawViewportSetCoordinates'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4782,7 +4789,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < EOF @@ -4811,7 +4818,7 @@ fi have_lesstif=no if test $have_motif = yes ; then echo $ac_n "checking whether Motif is really LessTif""... $ac_c" 1>&6 -echo "configure:4826: checking whether Motif is really LessTif" >&5 +echo "configure:4833: checking whether Motif is really LessTif" >&5 if eval "test \"`echo '$''{'ac_cv_have_lesstif'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4822,14 +4829,14 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < int main() { long vers = LesstifVersion; ; return 0; } EOF -if { (eval echo configure:4844: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4851: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_lesstif=yes else @@ -4857,7 +4864,7 @@ if test $have_lesstif = yes ; then ltv=unknown echo unknown > conftest-lt echo $ac_n "checking LessTif version number""... $ac_c" 1>&6 -echo "configure:4872: checking LessTif version number" >&5 +echo "configure:4879: checking LessTif version number" >&5 if eval "test \"`echo '$''{'ac_cv_lesstif_version_string'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4872,7 +4879,7 @@ else ac_cv_lesstif_version_string=unknown else cat > conftest.$ac_ext < #include @@ -4885,7 +4892,7 @@ else exit(0); } EOF -if { (eval echo configure:4900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ltv=`cat conftest-lt` ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'` @@ -4935,7 +4942,7 @@ if test $have_motif = yes ; then LDFLAGS="$LDFLAGS -L$x_libraries" fi echo $ac_n "checking for XpQueryExtension in -lXp""... $ac_c" 1>&6 -echo "configure:4950: checking for XpQueryExtension in -lXp" >&5 +echo "configure:4957: checking for XpQueryExtension in -lXp" >&5 ac_lib_var=`echo Xp'_'XpQueryExtension | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4943,7 +4950,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXp -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4976: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4999,7 +5006,7 @@ fi /*) echo $ac_n "checking for XPM headers""... $ac_c" 1>&6 -echo "configure:5014: checking for XPM headers" >&5 +echo "configure:5021: checking for XPM headers" >&5 d=$with_xpm/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -5009,7 +5016,7 @@ echo "configure:5014: checking for XPM headers" >&5 fi echo $ac_n "checking for XPM libs""... $ac_c" 1>&6 -echo "configure:5024: checking for XPM libs" >&5 +echo "configure:5031: checking for XPM libs" >&5 d=$with_xpm/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -5047,17 +5054,17 @@ if test $with_xpm = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/xpm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/xpm.h""... $ac_c" 1>&6 -echo "configure:5062: checking for X11/xpm.h" >&5 +echo "configure:5069: checking for X11/xpm.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5072: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5079: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5093,6 +5100,7 @@ fi # check for the GL header # have_gl=no +ac_have_mesa_gl=no with_gl_req=unspecified # Check whether --with-gl or --without-gl was given. if test "${with_gl+set}" = set; then @@ -5110,7 +5118,7 @@ fi /*) echo $ac_n "checking for GL headers""... $ac_c" 1>&6 -echo "configure:5125: checking for GL headers" >&5 +echo "configure:5133: checking for GL headers" >&5 d=$with_gl/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -5120,7 +5128,7 @@ echo "configure:5125: checking for GL headers" >&5 fi echo $ac_n "checking for GL libs""... $ac_c" 1>&6 -echo "configure:5135: checking for GL libs" >&5 +echo "configure:5143: checking for GL libs" >&5 d=$with_gl/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -5161,17 +5169,17 @@ if test $with_gl = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "GL/gl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for GL/gl.h""... $ac_c" 1>&6 -echo "configure:5176: checking for GL/gl.h" >&5 +echo "configure:5184: checking for GL/gl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5186: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5194: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5202,17 +5210,17 @@ fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "GL/glx.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for GL/glx.h""... $ac_c" 1>&6 -echo "configure:5217: checking for GL/glx.h" >&5 +echo "configure:5225: checking for GL/glx.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5227: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5235: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5249,7 +5257,7 @@ EOF # to link against. # echo $ac_n "checking whether GL is really MesaGL""... $ac_c" 1>&6 -echo "configure:5264: checking whether GL is really MesaGL" >&5 +echo "configure:5272: checking whether GL is really MesaGL" >&5 if eval "test \"`echo '$''{'ac_cv_have_mesa_gl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5261,7 +5269,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < EOF @@ -5302,12 +5310,12 @@ EOF unset ac_cv_mesagl_version_string echo $ac_n "checking MesaGL version number""... $ac_c" 1>&6 -echo "configure:5317: checking MesaGL version number" >&5 +echo "configure:5325: checking MesaGL version number" >&5 if eval "test \"`echo '$''{'ac_cv_mesagl_version_string'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #configure: MESA_MAJOR_VERSION MESA_MINOR_VERSION @@ -5354,7 +5362,7 @@ fi LDFLAGS="$LDFLAGS -L$x_libraries" fi echo $ac_n "checking for glBindTexture in -l$gl_lib_1""... $ac_c" 1>&6 -echo "configure:5369: checking for glBindTexture in -l$gl_lib_1" >&5 +echo "configure:5377: checking for glBindTexture in -l$gl_lib_1" >&5 ac_lib_var=`echo $gl_lib_1'_'glBindTexture | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5362,7 +5370,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$gl_lib_1 $GL_LIBS -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5427,7 +5435,7 @@ fi /*) echo $ac_n "checking for XReadDisplay headers""... $ac_c" 1>&6 -echo "configure:5442: checking for XReadDisplay headers" >&5 +echo "configure:5450: checking for XReadDisplay headers" >&5 d=$with_readdisplay/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -5437,7 +5445,7 @@ echo "configure:5442: checking for XReadDisplay headers" >&5 fi echo $ac_n "checking for XReadDisplay libs""... $ac_c" 1>&6 -echo "configure:5452: checking for XReadDisplay libs" >&5 +echo "configure:5460: checking for XReadDisplay libs" >&5 d=$with_readdisplay/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -5475,17 +5483,17 @@ if test $with_readdisplay = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/readdisplay.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/readdisplay.h""... $ac_c" 1>&6 -echo "configure:5490: checking for X11/extensions/readdisplay.h" >&5 +echo "configure:5498: checking for X11/extensions/readdisplay.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5500: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5508: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5536,7 +5544,7 @@ fi /*) echo $ac_n "checking for Iris Video headers""... $ac_c" 1>&6 -echo "configure:5551: checking for Iris Video headers" >&5 +echo "configure:5559: checking for Iris Video headers" >&5 d=$with_sgivideo/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -5546,7 +5554,7 @@ echo "configure:5551: checking for Iris Video headers" >&5 fi echo $ac_n "checking for Iris Video libs""... $ac_c" 1>&6 -echo "configure:5561: checking for Iris Video libs" >&5 +echo "configure:5569: checking for Iris Video libs" >&5 d=$with_sgivideo/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -5584,17 +5592,17 @@ if test $with_sgivideo = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "dmedia/vl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dmedia/vl.h""... $ac_c" 1>&6 -echo "configure:5599: checking for dmedia/vl.h" >&5 +echo "configure:5607: checking for dmedia/vl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5609: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5619,7 +5627,7 @@ fi if test $have_sgivideo = yes; then have_sgivideo=no echo $ac_n "checking for vlOpenVideo in -lvl""... $ac_c" 1>&6 -echo "configure:5634: checking for vlOpenVideo in -lvl" >&5 +echo "configure:5642: checking for vlOpenVideo in -lvl" >&5 ac_lib_var=`echo vl'_'vlOpenVideo | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5627,7 +5635,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lvl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5706,7 +5714,7 @@ if test -n "$with_zippy_req" ; then case "$with_zippy_req" in /*) echo $ac_n "checking for $with_zippy_req""... $ac_c" 1>&6 -echo "configure:5721: checking for $with_zippy_req" >&5 +echo "configure:5729: checking for $with_zippy_req" >&5 if test -x "$with_zippy_req" ; then echo "$ac_t""yes" 1>&6 else @@ -5720,7 +5728,7 @@ echo "configure:5721: checking for $with_zippy_req" >&5 # Extract the first word of "$with_zippy_req", so it can be a program name with args. set dummy $with_zippy_req; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5735: checking for $ac_word" >&5 +echo "configure:5743: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_zip2'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5766,7 +5774,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5781: checking for $ac_word" >&5 +echo "configure:5789: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_emacs_exe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5799,7 +5807,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5814: checking for $ac_word" >&5 +echo "configure:5822: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_xemacs_exe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5833,7 +5841,7 @@ done if test -n "$emacs_exe" ; then echo $ac_n "checking for emacs yow""... $ac_c" 1>&6 -echo "configure:5848: checking for emacs yow" >&5 +echo "configure:5856: checking for emacs yow" >&5 # # get emacs to tell us where the libexec directory is. # @@ -5855,7 +5863,7 @@ echo "configure:5848: checking for emacs yow" >&5 if test -z "$ac_cv_zippy_program" ; then echo $ac_n "checking for xemacs yow""... $ac_c" 1>&6 -echo "configure:5870: checking for xemacs yow" >&5 +echo "configure:5878: checking for xemacs yow" >&5 if test -n "$xemacs_exe" ; then # # get xemacs to tell us where the libexec directory is. @@ -5901,7 +5909,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5916: checking for $ac_word" >&5 +echo "configure:5924: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_fortune'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5936,7 +5944,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5951: checking for $ac_word" >&5 +echo "configure:5959: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_fortune'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5986,7 +5994,6 @@ EOF # Allow locking to be disabled at compile-time. # -have_locking=yes have_kerberos=no with_kerberos_req=unspecified have_shadow=no @@ -6001,6 +6008,82 @@ else enable_locking=yes fi +if test $enable_locking = yes; then + true +elif test $enable_locking = no; then + cat >> confdefs.h <<\EOF +#define NO_LOCKING 1 +EOF + +else + echo "error: must be yes or no: --enable-locking=$enable_locking" + exit 1 +fi + + + +# Check to see if we can lock Virtual-Terminal switching, but allow that +# to be disabled at compile-time. +# +ac_vt_lockswitch=no +# Check whether --enable-vt-locking or --disable-vt-locking was given. +if test "${enable_vt_locking+set}" = set; then + enableval="$enable_vt_locking" + enable_vt_locking="$enableval" +else + enable_vt_locking=yes +fi + +if test $enable_vt_locking = yes; then + + echo $ac_n "checking for VT_LOCKSWITCH ioctl""... $ac_c" 1>&6 +echo "configure:6052: checking for VT_LOCKSWITCH ioctl" >&5 + if eval "test \"`echo '$''{'ac_cv_vt_lockswitch'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < + #include + #include +int main() { +int x = VT_LOCKSWITCH; int y = VT_UNLOCKSWITCH; +; return 0; } +EOF +if { (eval echo configure:6066: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_vt_lockswitch=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_vt_lockswitch=no +fi +rm -f conftest* +fi + + ac_vt_lockswitch=$ac_cv_vt_lockswitch + echo "$ac_t""$ac_vt_lockswitch" 1>&6 + +elif test $enable_locking = no; then + true +else + echo "error: must be yes or no: --enable-vt-locking=$enable_vt_locking" + exit 1 +fi + +if test $ac_vt_lockswitch = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_VT_LOCKSWITCH 1 +EOF + + # the VT_LOCKSWITCH ioctl can only be used when running as root. + need_setuid=yes +fi + + + if test $enable_locking = yes; then # Check for Kerberos. @@ -6021,7 +6104,7 @@ fi /*) echo $ac_n "checking for Kerberos headers""... $ac_c" 1>&6 -echo "configure:6036: checking for Kerberos headers" >&5 +echo "configure:6119: checking for Kerberos headers" >&5 d=$with_kerberos/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -6031,7 +6114,7 @@ echo "configure:6036: checking for Kerberos headers" >&5 fi echo $ac_n "checking for Kerberos libs""... $ac_c" 1>&6 -echo "configure:6046: checking for Kerberos libs" >&5 +echo "configure:6129: checking for Kerberos libs" >&5 d=$with_kerberos/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -6062,7 +6145,7 @@ echo "configure:6046: checking for Kerberos libs" >&5 if test $with_kerberos = yes; then echo $ac_n "checking for Kerberos""... $ac_c" 1>&6 -echo "configure:6077: checking for Kerberos" >&5 +echo "configure:6160: checking for Kerberos" >&5 if eval "test \"`echo '$''{'ac_cv_kerberos'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6073,14 +6156,14 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < int main() { ; return 0; } EOF -if { (eval echo configure:6095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6178: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_kerberos=yes else @@ -6104,12 +6187,12 @@ EOF # from Tim Showalter PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes" echo $ac_n "checking for res_search""... $ac_c" 1>&6 -echo "configure:6119: checking for res_search" >&5 +echo "configure:6202: checking for res_search" >&5 if eval "test \"`echo '$''{'ac_cv_func_res_search'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6230: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_res_search=yes" else @@ -6150,7 +6233,7 @@ if eval "test \"`echo '$ac_cv_func_'res_search`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6 -echo "configure:6165: checking for res_search in -lresolv" >&5 +echo "configure:6248: checking for res_search in -lresolv" >&5 ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6158,7 +6241,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6219,7 +6302,7 @@ fi /*) echo $ac_n "checking for shadow password headers""... $ac_c" 1>&6 -echo "configure:6234: checking for shadow password headers" >&5 +echo "configure:6317: checking for shadow password headers" >&5 d=$with_shadow/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -6229,7 +6312,7 @@ echo "configure:6234: checking for shadow password headers" >&5 fi echo $ac_n "checking for shadow password libs""... $ac_c" 1>&6 -echo "configure:6244: checking for shadow password libs" >&5 +echo "configure:6327: checking for shadow password libs" >&5 d=$with_shadow/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -6270,7 +6353,7 @@ echo "configure:6244: checking for shadow password libs" >&5 # if test $passwd_cruft_done = no ; then echo $ac_n "checking for Sun-style shadow passwords""... $ac_c" 1>&6 -echo "configure:6285: checking for Sun-style shadow passwords" >&5 +echo "configure:6368: checking for Sun-style shadow passwords" >&5 if eval "test \"`echo '$''{'ac_cv_sun_adjunct'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6281,7 +6364,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < #include @@ -6294,7 +6377,7 @@ struct passwd_adjunct *p = getpwanam("nobody"); const char *pw = p->pwa_passwd; ; return 0; } EOF -if { (eval echo configure:6309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6392: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sun_adjunct=yes else @@ -6323,7 +6406,7 @@ EOF # if test $passwd_cruft_done = no ; then echo $ac_n "checking for DEC-style shadow passwords""... $ac_c" 1>&6 -echo "configure:6338: checking for DEC-style shadow passwords" >&5 +echo "configure:6421: checking for DEC-style shadow passwords" >&5 if eval "test \"`echo '$''{'ac_cv_enhanced_passwd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6334,7 +6417,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < #include @@ -6351,7 +6434,7 @@ struct pr_passwd *p; pw = p->ufld.fd_encrypt; ; return 0; } EOF -if { (eval echo configure:6366: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6449: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_enhanced_passwd=yes else @@ -6377,7 +6460,7 @@ EOF # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx) # (I'm told it needs -lcurses too, but I don't understand why.) echo $ac_n "checking for getprpwnam in -lprot""... $ac_c" 1>&6 -echo "configure:6392: checking for getprpwnam in -lprot" >&5 +echo "configure:6475: checking for getprpwnam in -lprot" >&5 ac_lib_var=`echo prot'_'getprpwnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6385,7 +6468,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lprot -lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6416,7 +6499,7 @@ else echo "$ac_t""no" 1>&6 # On DEC, getprpwnam() is in -lsecurity echo $ac_n "checking for getprpwnam in -lsecurity""... $ac_c" 1>&6 -echo "configure:6431: checking for getprpwnam in -lsecurity" >&5 +echo "configure:6514: checking for getprpwnam in -lsecurity" >&5 ac_lib_var=`echo security'_'getprpwnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6424,7 +6507,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsecurity $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6464,7 +6547,7 @@ fi # if test $passwd_cruft_done = no ; then echo $ac_n "checking for HP-style shadow passwords""... $ac_c" 1>&6 -echo "configure:6479: checking for HP-style shadow passwords" >&5 +echo "configure:6562: checking for HP-style shadow passwords" >&5 if eval "test \"`echo '$''{'ac_cv_hpux_passwd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6475,7 +6558,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < #include @@ -6488,7 +6571,7 @@ struct s_passwd *p = getspwnam("nobody"); const char *pw = p->pw_passwd; ; return 0; } EOF -if { (eval echo configure:6503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6586: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_hpux_passwd=yes else @@ -6513,7 +6596,7 @@ EOF # on HPUX, bigcrypt is in -lsec echo $ac_n "checking for bigcrypt in -lsec""... $ac_c" 1>&6 -echo "configure:6528: checking for bigcrypt in -lsec" >&5 +echo "configure:6611: checking for bigcrypt in -lsec" >&5 ac_lib_var=`echo sec'_'bigcrypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6521,7 +6604,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsec $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6559,7 +6642,7 @@ fi # if test $passwd_cruft_done = no ; then echo $ac_n "checking for generic shadow passwords""... $ac_c" 1>&6 -echo "configure:6574: checking for generic shadow passwords" >&5 +echo "configure:6657: checking for generic shadow passwords" >&5 if eval "test \"`echo '$''{'ac_cv_shadow'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6570,7 +6653,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < #include @@ -6582,7 +6665,7 @@ struct spwd *p = getspnam("nobody"); const char *pw = p->sp_pwdp; ; return 0; } EOF -if { (eval echo configure:6597: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6680: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_shadow=yes else @@ -6608,7 +6691,7 @@ EOF # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc. have_getspnam=no echo $ac_n "checking for getspnam in -lc""... $ac_c" 1>&6 -echo "configure:6623: checking for getspnam in -lc" >&5 +echo "configure:6706: checking for getspnam in -lc" >&5 ac_lib_var=`echo c'_'getspnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6616,7 +6699,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6649,7 +6732,7 @@ fi if test $have_getspnam = no ; then echo $ac_n "checking for getspnam in -lgen""... $ac_c" 1>&6 -echo "configure:6664: checking for getspnam in -lgen" >&5 +echo "configure:6747: checking for getspnam in -lgen" >&5 ac_lib_var=`echo gen'_'getspnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6657,7 +6740,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6699,7 +6782,7 @@ fi # if test $passwd_cruft_done = no ; then echo $ac_n "checking for FreeBSD-style shadow passwords""... $ac_c" 1>&6 -echo "configure:6714: checking for FreeBSD-style shadow passwords" >&5 +echo "configure:6797: checking for FreeBSD-style shadow passwords" >&5 if eval "test \"`echo '$''{'ac_cv_master_passwd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6720,7 +6803,7 @@ echo "$ac_t""$ac_cv_master_passwd" 1>&6 # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc. have_crypt=no echo $ac_n "checking for crypt in -lc""... $ac_c" 1>&6 -echo "configure:6735: checking for crypt in -lc" >&5 +echo "configure:6818: checking for crypt in -lc" >&5 ac_lib_var=`echo c'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6728,7 +6811,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6761,7 +6844,7 @@ fi if test $have_crypt = no ; then echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:6776: checking for crypt in -lcrypt" >&5 +echo "configure:6859: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6769,7 +6852,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6815,14 +6898,6 @@ fi esac fi -elif test $enable_locking = no; then - cat >> confdefs.h <<\EOF -#define NO_LOCKING 1 -EOF - -else - echo "error: must be yes or no: --enable-locking=$enable_locking" - exit 1 fi @@ -7017,7 +7092,7 @@ fi if test $have_motif = yes -a $have_lesstif = yes ; then - preferred_lesstif=0.87 + preferred_lesstif=0.86 if test $lesstif_version = unknown; then warnL "Unable to determine the LessTif version number!" @@ -7030,14 +7105,6 @@ if test $have_motif = yes -a $have_lesstif = yes ; then warn2 "use with XScreenSaver; it is strongly recommended" warn2 "that you upgrade to at least version $preferred_lesstif!" warn2 "See ." - - elif test \! $lesstif_version -gt 86; then - warnL "LessTif version $lesstif_version_string is being used." - warn2 "LessTif versions 0.86 and earlier have a bug that" - warn2 "can cause a security problem with xscreensaver." - warn2 "If you want to use xscreensaver as a screen locker," - warn2 "it is strongly recommended that you upgrade to at" - warn2 "least version $preferred_lesstif. See ." fi fi diff --git a/configure.in b/configure.in index c805692d..d636d21e 100644 --- a/configure.in +++ b/configure.in @@ -39,7 +39,7 @@ AC_TRY_RUN([ main(int ac, char **av) { return 0; } ], AC_MSG_ERROR(Couldn't build even a trivial ANSI C program: check CC.)) case "$host" in - *-irix*) + *-irix5* |*-irix6.[0-3]* ) if test -n "$GCC"; then AC_MSG_RESULT(Turning on gcc compiler warnings.) CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format" @@ -144,7 +144,7 @@ fi AC_CHECK_FUNCS(select fcntl uname nice setpriority getcwd getwd putenv) AC_CHECK_FUNCS(sigaction) -AC_CHECK_HEADERS(unistd.h) +AC_CHECK_HEADERS(unistd.h crypt.h) dnl /usr/local/src/ssh-1.2.17/putenv.c -- AC_REPLACE_FUNCS(putenv) @@ -1057,6 +1057,7 @@ fi # check for the GL header # have_gl=no +ac_have_mesa_gl=no with_gl_req=unspecified AC_ARG_WITH(gl, [ --with-gl Build those demos which depend on OpenGL, @@ -1352,7 +1353,6 @@ AC_DEFINE_UNQUOTED(ZIPPY_PROGRAM, "$ac_cv_zippy_program") # Allow locking to be disabled at compile-time. # -have_locking=yes have_kerberos=no with_kerberos_req=unspecified have_shadow=no @@ -1366,6 +1366,56 @@ Screen Locking options: (this is the default.) --disable-locking Do not allow locking at all.], [enable_locking="$enableval"],[enable_locking=yes]) +if test $enable_locking = yes; then + true +elif test $enable_locking = no; then + AC_DEFINE(NO_LOCKING) +else + echo "error: must be yes or no: --enable-locking=$enable_locking" + exit 1 +fi + + + +# Check to see if we can lock Virtual-Terminal switching, but allow that +# to be disabled at compile-time. +# +ac_vt_lockswitch=no +AC_ARG_ENABLE(vt-locking,[ + --enable-vt-locking Compile in support for locking Virtual Terminals. + This is the default if the system supports it, and + if locking support is included (--enable-locking.) + --disable-vt-locking Do not allow locking of VTs, even if locking is + enabled.], + [enable_vt_locking="$enableval"],[enable_vt_locking=yes]) +if test $enable_vt_locking = yes; then + + AC_MSG_CHECKING(for VT_LOCKSWITCH ioctl) + AC_CACHE_VAL(ac_cv_vt_lockswitch, + [AC_TRY_COMPILE([#include + #include + #include ], + [int x = VT_LOCKSWITCH; int y = VT_UNLOCKSWITCH;], + [ac_cv_vt_lockswitch=yes], + [ac_cv_vt_lockswitch=no])]) + ac_vt_lockswitch=$ac_cv_vt_lockswitch + AC_MSG_RESULT($ac_vt_lockswitch) + +elif test $enable_locking = no; then + true +else + echo "error: must be yes or no: --enable-vt-locking=$enable_vt_locking" + exit 1 +fi + +if test $ac_vt_lockswitch = yes; then + AC_DEFINE(HAVE_VT_LOCKSWITCH) + # the VT_LOCKSWITCH ioctl can only be used when running as root. + need_setuid=yes +fi + + + if test $enable_locking = yes; then # Check for Kerberos. @@ -1570,11 +1620,6 @@ if test $enable_locking = yes; then esac fi -elif test $enable_locking = no; then - AC_DEFINE(NO_LOCKING) -else - echo "error: must be yes or no: --enable-locking=$enable_locking" - exit 1 fi @@ -1763,7 +1808,7 @@ fi if test $have_motif = yes -a $have_lesstif = yes ; then - preferred_lesstif=0.87 + preferred_lesstif=0.86 if test $lesstif_version = unknown; then warnL "Unable to determine the LessTif version number!" @@ -1776,14 +1821,6 @@ if test $have_motif = yes -a $have_lesstif = yes ; then warn2 "use with XScreenSaver; it is strongly recommended" warn2 "that you upgrade to at least version $preferred_lesstif!" warn2 "See ." - - elif test \! $lesstif_version -gt 86; then - warnL "LessTif version $lesstif_version_string is being used." - warn2 "LessTif versions 0.86 and earlier have a bug that" - warn2 "can cause a security problem with xscreensaver." - warn2 "If you want to use xscreensaver as a screen locker," - warn2 "it is strongly recommended that you upgrade to at" - warn2 "least version $preferred_lesstif. See ." fi fi diff --git a/driver/Makefile.in b/driver/Makefile.in index 9c789a9f..148883d7 100644 --- a/driver/Makefile.in +++ b/driver/Makefile.in @@ -77,7 +77,7 @@ KERBEROS_OBJS = kpasswd.o LOCK_SRCS_1 = lock.c LOCK_OBJS_1 = lock.o -TEST_SRCS = test-passwd.c test-uid.c +TEST_SRCS = test-passwd.c test-uid.c test-xdpms.c DIALOG_SRCS = @DIALOG_SRCS@ DIALOG_OBJS = @DIALOG_OBJS@ @@ -98,9 +98,9 @@ UTIL_OBJS = $(UTILS_BIN)/fade.o $(UTILS_BIN)/overlay.o \ $(UTILS_BIN)/yarandom.o @XMU_OBJS@ SAVER_SRCS_1 = demo.c stderr.c subprocs.c setuid.c timers.c windows.c \ - xscreensaver.c splash.c xset.c + xscreensaver.c splash.c xset.c dotfile.c SAVER_OBJS_1 = demo.o stderr.o subprocs.o setuid.o timers.o windows.o \ - xscreensaver.o splash.o xset.o + xscreensaver.o splash.o xset.o dotfile.o SAVER_SRCS = $(SAVER_SRCS_1) $(DIALOG_SRCS) $(LOCK_SRCS) $(UTIL_SRCS) SAVER_OBJS = $(SAVER_OBJS_1) $(DIALOG_OBJS) $(LOCK_OBJS) $(UTIL_OBJS) @@ -321,12 +321,19 @@ xscreensaver-command: $(CMD_OBJS) TEST_PASSWD_OBJS = test-passwd.o $(LOCK_OBJS_1) $(PWENT_OBJS) $(DIALOG_OBJS) \ - subprocs.o setuid.o demo.o \ + subprocs.o setuid.o demo.o splash.o \ $(UTIL_OBJS) +test-passwd.o: XScreenSaver_ad.h -test-passwd: $(TEST_PASSWD_OBJS) +test-passwd: $(TEST_PASSWD_OBJS) XScreenSaver_ad.h $(CC) $(LDFLAGS) -o $@ $(TEST_PASSWD_OBJS) $(SAVER_LIBS) +test-uid: test-uid.o + $(CC) $(LDFLAGS) -o $@ test-uid.o + +test-xdpms: test-xdpms.o + $(CC) $(LDFLAGS) -o $@ test-xdpms.o $(SAVER_LIBS) + ############################################################################## # # DO NOT DELETE: updated by make distdepend @@ -359,9 +366,12 @@ xscreensaver.o: $(UTILS_SRC)/visual.h xscreensaver.o: XScreenSaver_ad.h splash.o: ../config.h splash.o: $(srcdir)/xscreensaver.h -splash.o: $(UTILS_SRC)/visual.h +splash.o: $(UTILS_SRC)/resources.h xset.o: ../config.h xset.o: $(srcdir)/xscreensaver.h +dotfile.o: ../config.h +dotfile.o: $(srcdir)/xscreensaver.h +dotfile.o: $(UTILS_SRC)/resources.h dialogs-Xm.o: ../config.h dialogs-Xm.o: $(UTILS_SRC)/visual.h dialogs-Xaw.o: ../config.h diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in index 932dead4..daec6ff4 100644 --- a/driver/XScreenSaver.ad.in +++ b/driver/XScreenSaver.ad.in @@ -4,8 +4,8 @@ ! a screen saver and locker for the X window system ! by Jamie Zawinski ! -! version 2.31 -! 02-Oct-98 +! version 2.34 +! 08-Oct-98 ! ! See "man xscreensaver" for more info. The latest version is always ! available at http://www.jwz.org/xscreensaver/ @@ -16,6 +16,7 @@ *passwdTimeout: 30 *nice: 10 *lock: False +*lockVTs: True *verbose: False *timestamp: False *fade: True @@ -26,7 +27,6 @@ *splashDuration: 5 *captureStderr: True -*captureStdout: True *overlayTextForeground: #FFFF00 *overlayTextBackground: #000000 *overlayStderr: True @@ -175,7 +175,8 @@ @GL_KLUDGE_2@ rubik -root \n\ @GL_KLUDGE_2@ atlantis -root \n\ @GL_KLUDGE_2@ lament -root \n\ -@GL_KLUDGE_2@ bubble3d -root \n +@GL_KLUDGE_2@ bubble3d -root \n\ +@GL_KLUDGE_2@ glplanet -root \n ! A few of the hacks require OpenGL, and will only be built if you have it. @@ -281,13 +282,48 @@ !============================================================================= +! Resources for the password and splash-screen dialog boxes. +! +*Dialog.headingFont: *-times-bold-r-*-*-*-180-*-*-*-iso8859-1 +*Dialog.bodyFont: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1 +*Dialog.labelFont: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1 +*Dialog.buttonFont: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1 +*Dialog.foreground: #000000 +*Dialog.background: #BFBFBF +*Dialog.Button.foreground: #000000 +*Dialog.Button.background: #D0D0D0 +*Dialog.text.foreground: #000000 +*Dialog.text.background: #FFFFFF +*Dialog.logo.foreground: #FF0000 +*Dialog.logo.background: #FFFFFF +*Dialog.topShadowColor: #E7E7E7 +*Dialog.bottomShadowColor: #737373 +*Dialog.logo.width: 200 +*Dialog.logo.height: 200 +*Dialog.internalBorderWidth: 30 +*Dialog.borderWidth: 1 +*Dialog.shadowThickness: 4 + +*passwd.heading.label: XScreenSaver %s +*passwd.body.label: This display is locked. +*passwd.user.label: User: +*passwd.passwd.label: Password: +*passwd.passwdFont: *-courier-medium-r-*-*-*-140-*-*-*-iso8859-1 +*passwd.thermometer.width: 8 + +*splash.heading.label: XScreenSaver %s +*splash.body.label: Copyright © 1991-1998 by +*splash.body2.label: Jamie Zawinski +*splash.demo.label: Demo +*splash.prefs.label: Prefs +*splash.help.label: Help + + ! Resources for the Motif dialog boxes: ! *fontList: *-helvetica-medium-r-*-*-*-120-*-*-*-iso8859-1 *demoDialog*label1.fontList: *-helvetica-medium-r-*-*-*-140-*-*-*-iso8859-1 -*passwdDialog*fontList: *-helvetica-medium-r-*-*-*-140-*-*-*-iso8859-1 *XmTextField.fontList: *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1 -*passwdDialog.passwdText.fontList: *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1 *splashDialog*fontList: *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1 *splashDialog*splashLabel1.fontList: *-times-bold-r-*-*-*-180-*-*-*-iso8859-1 *splashDialog*splashLabel2.fontList: *-times-bold-r-*-*-*-140-*-*-*-iso8859-1 @@ -343,18 +379,6 @@ XScreenSaver*XmDialogShell*rogerLabel.background: #FFFFFF *resourcesDone.labelString: OK *resourcesCancel.labelString: Cancel -*passwdDialog.title: Password -*passwdLabel1.labelString: XScreenSaver %s -*passwdLabel2.labelString: This display is locked. -*passwdLabel3.labelString: Please type %s's password to unlock it. -*passwdDone.labelString: OK -*passwdCancel.labelString: Cancel - -*passwdLabel1.alignment: ALIGNMENT_BEGINNING -*passwdLabel2.alignment: ALIGNMENT_BEGINNING -*passwdLabel3.alignment: ALIGNMENT_BEGINNING -*rogerLabel.width: 150 - *splashDialog.title: XScreenSaver *splashLabel1.labelString: XScreenSaver %s *splashLabel2.labelString: Copyright © 1991-1998 by @@ -383,7 +407,6 @@ XScreenSaver*dragReceiverProtocolStyle: DRAG_NONE ! *demo_dialog*font: *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1 *resources_dialog*font: *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1 -*passwd_dialog*font: *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1 *splash_dialog*font: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1 *splash_dialog*splashLabel1.font: *-times-bold-r-*-*-*-180-*-*-*-iso8859-1 *splash_dialog*splashLabel2.font: *-times-bold-r-*-*-*-140-*-*-*-iso8859-1 @@ -411,13 +434,6 @@ XScreenSaver.resources_dialog*Text*background: #FFFFFF *resources_dialog*Dialog.value.translations: #override\n\ Return: beginning-of-line()\n -XScreenSaver.passwd_dialog*foreground: #000000 -XScreenSaver.passwd_dialog*background: #E5E5E5 -XScreenSaver.passwd_dialog*Command.background: #D9D9D9 -XScreenSaver.passwd_dialog*Text*background: #FFFFFF -XScreenSaver.passwd_dialog*roger.foreground: #CD0000 -XScreenSaver.passwd_dialog*roger.background: #FFFFFF - XScreenSaver.splash_dialog*foreground: #000000 XScreenSaver.splash_dialog*background: #E5E5E5 XScreenSaver.splash_dialog*Command.background: #D9D9D9 @@ -455,19 +471,6 @@ XScreenSaver.demo_dialog*Command.internalHeight: 4 *resources_dialog*done.label: OK *resources_dialog*cancel.label: Cancel -*passwd_dialog*label1.label: XScreenSaver %s -*passwd_dialog*label2.label: This display is locked. -*passwd_dialog*label3.label: Please type %s's password to unlock it. -*passwd_dialog*ok.label: OK -*passwd_dialog*cancel.label: Cancel -*passwd_dialog*passwd_form*label.label: -*passwd_dialog*Dialog.label: -*passwd_dialog*passwd_form*Text.width: 200 -*passwd_dialog*passwd_form.borderWidth: 0 -*passwd_dialog*roger.width: 150 -*passwd_dialog*roger.height: 150 -*passwd_dialog*roger.borderWidth: 1 - *splash_dialog*splashLabel1.label: XScreenSaver %s *splash_dialog*splashLabel2.label: Copyright © 1991-1998 by *splash_dialog*splashLabel3.label: Jamie Zawinski diff --git a/driver/XScreenSaver_ad.h b/driver/XScreenSaver_ad.h index bb83d0fb..680d8619 100644 --- a/driver/XScreenSaver_ad.h +++ b/driver/XScreenSaver_ad.h @@ -4,6 +4,7 @@ "*passwdTimeout: 30", "*nice: 10", "*lock: False", +"*lockVTs: True", "*verbose: False", "*timestamp: False", "*fade: True", @@ -13,7 +14,6 @@ "*splash: True", "*splashDuration: 5", "*captureStderr: True", -"*captureStdout: True", "*overlayTextForeground: #FFFF00", "*overlayTextBackground: #000000", "*overlayStderr: True", @@ -122,13 +122,43 @@ rubik -root \\n\ atlantis -root \\n\ lament -root \\n\ - bubble3d -root \\n", + bubble3d -root \\n\ + glplanet -root \\n", " ", +"*Dialog.headingFont: *-times-bold-r-*-*-*-180-*-*-*-iso8859-1", +"*Dialog.bodyFont: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1", +"*Dialog.labelFont: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1", +"*Dialog.buttonFont: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1", +"*Dialog.foreground: #000000", +"*Dialog.background: #BFBFBF", +"*Dialog.Button.foreground: #000000", +"*Dialog.Button.background: #D0D0D0", +"*Dialog.text.foreground: #000000", +"*Dialog.text.background: #FFFFFF", +"*Dialog.logo.foreground: #FF0000", +"*Dialog.logo.background: #FFFFFF", +"*Dialog.topShadowColor: #E7E7E7", +"*Dialog.bottomShadowColor: #737373", +"*Dialog.logo.width: 200", +"*Dialog.logo.height: 200", +"*Dialog.internalBorderWidth: 30", +"*Dialog.borderWidth: 1", +"*Dialog.shadowThickness: 4", +"*passwd.heading.label: XScreenSaver %s", +"*passwd.body.label: This display is locked.", +"*passwd.user.label: User:", +"*passwd.passwd.label: Password:", +"*passwd.passwdFont: *-courier-medium-r-*-*-*-140-*-*-*-iso8859-1", +"*passwd.thermometer.width: 8", +"*splash.heading.label: XScreenSaver %s", +"*splash.body.label: Copyright © 1991-1998 by", +"*splash.body2.label: Jamie Zawinski ", +"*splash.demo.label: Demo", +"*splash.prefs.label: Prefs", +"*splash.help.label: Help", "*fontList: *-helvetica-medium-r-*-*-*-120-*-*-*-iso8859-1", "*demoDialog*label1.fontList: *-helvetica-medium-r-*-*-*-140-*-*-*-iso8859-1", -"*passwdDialog*fontList: *-helvetica-medium-r-*-*-*-140-*-*-*-iso8859-1", "*XmTextField.fontList: *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1", -"*passwdDialog.passwdText.fontList: *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1", "*splashDialog*fontList: *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1", "*splashDialog*splashLabel1.fontList: *-times-bold-r-*-*-*-180-*-*-*-iso8859-1", "*splashDialog*splashLabel2.fontList: *-times-bold-r-*-*-*-140-*-*-*-iso8859-1", @@ -172,16 +202,6 @@ "*lockToggle.labelString: Require Password", "*resourcesDone.labelString: OK", "*resourcesCancel.labelString: Cancel", -"*passwdDialog.title: Password", -"*passwdLabel1.labelString: XScreenSaver %s", -"*passwdLabel2.labelString: This display is locked.", -"*passwdLabel3.labelString: Please type %s's password to unlock it.", -"*passwdDone.labelString: OK", -"*passwdCancel.labelString: Cancel", -"*passwdLabel1.alignment: ALIGNMENT_BEGINNING", -"*passwdLabel2.alignment: ALIGNMENT_BEGINNING", -"*passwdLabel3.alignment: ALIGNMENT_BEGINNING", -"*rogerLabel.width: 150", "*splashDialog.title: XScreenSaver", "*splashLabel1.labelString: XScreenSaver %s", "*splashLabel2.labelString: Copyright © 1991-1998 by", @@ -198,7 +218,6 @@ "XScreenSaver*dragReceiverProtocolStyle: DRAG_NONE", "*demo_dialog*font: *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1", "*resources_dialog*font: *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1", -"*passwd_dialog*font: *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1", "*splash_dialog*font: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1", "*splash_dialog*splashLabel1.font: *-times-bold-r-*-*-*-180-*-*-*-iso8859-1", "*splash_dialog*splashLabel2.font: *-times-bold-r-*-*-*-140-*-*-*-iso8859-1", @@ -222,12 +241,6 @@ "XScreenSaver.resources_dialog*Text*background: #FFFFFF", "*resources_dialog*Dialog.value.translations: #override\\n\ Return: beginning-of-line()\\n", -"XScreenSaver.passwd_dialog*foreground: #000000", -"XScreenSaver.passwd_dialog*background: #E5E5E5", -"XScreenSaver.passwd_dialog*Command.background: #D9D9D9", -"XScreenSaver.passwd_dialog*Text*background: #FFFFFF", -"XScreenSaver.passwd_dialog*roger.foreground: #CD0000", -"XScreenSaver.passwd_dialog*roger.background: #FFFFFF", "XScreenSaver.splash_dialog*foreground: #000000", "XScreenSaver.splash_dialog*background: #E5E5E5", "XScreenSaver.splash_dialog*Command.background: #D9D9D9", @@ -260,18 +273,6 @@ "*resources_dialog*buttonbox.lock.label: Require Password", "*resources_dialog*done.label: OK", "*resources_dialog*cancel.label: Cancel", -"*passwd_dialog*label1.label: XScreenSaver %s", -"*passwd_dialog*label2.label: This display is locked.", -"*passwd_dialog*label3.label: Please type %s's password to unlock it.", -"*passwd_dialog*ok.label: OK", -"*passwd_dialog*cancel.label: Cancel", -"*passwd_dialog*passwd_form*label.label: ", -"*passwd_dialog*Dialog.label: ", -"*passwd_dialog*passwd_form*Text.width: 200", -"*passwd_dialog*passwd_form.borderWidth: 0", -"*passwd_dialog*roger.width: 150", -"*passwd_dialog*roger.height: 150", -"*passwd_dialog*roger.borderWidth: 1", "*splash_dialog*splashLabel1.label: XScreenSaver %s", "*splash_dialog*splashLabel2.label: Copyright © 1991-1998 by", "*splash_dialog*splashLabel3.label: Jamie Zawinski ", diff --git a/driver/demo.c b/driver/demo.c index 99ea27cb..c7a12ba3 100644 --- a/driver/demo.c +++ b/driver/demo.c @@ -71,8 +71,6 @@ extern Widget lock_time_text, passwd_time_text; extern Widget verbose_toggle, cmap_toggle, fade_toggle, unfade_toggle, lock_toggle; -extern Widget splash_dialog; - #ifdef HAVE_MOTIF @@ -592,8 +590,7 @@ pop_up_dialog_box (Widget dialog, Widget form, int where) XtManageChild (form); #endif /* HAVE_MOTIF */ - if (dialog != splash_dialog) - steal_focus_and_colormap (dialog); + steal_focus_and_colormap (dialog); } @@ -900,6 +897,8 @@ res_done_cb (Widget button, XtPointer client_data, XtPointer call_data) } } #endif /* HAVE_MIT_SAVER_EXTENSION || HAVE_SGI_SAVER_EXTENSION */ + + write_init_file (si); } @@ -959,7 +958,7 @@ make_resources_dialog (saver_info *si, Widget parent) disable_widget (lock_time_text); disable_widget (lock_toggle); } - if (CellsOfScreen (XtScreen (parent)) <= 2) + if (!si->fading_possible_p) { disable_widget (fade_text); disable_widget (ticks_text); @@ -1053,6 +1052,7 @@ demo_mode (saver_info *si) if (p->verbose_p) fprintf (stderr, "%s: Demo Mode.\n", blurb()); + si->selection_mode = 0; si->dbox_up_p = True; monitor_power_on (si); raise_window (si, True, False, False); diff --git a/driver/dialogs-Xaw.c b/driver/dialogs-Xaw.c index 2487754d..5b652b11 100644 --- a/driver/dialogs-Xaw.c +++ b/driver/dialogs-Xaw.c @@ -33,15 +33,6 @@ #include "visual.h" /* for visual_depth() */ -Widget passwd_dialog; -Widget passwd_form; -Widget roger_label; -Widget passwd_label1; -Widget passwd_label3; -/*Widget passwd_text;*/ -/*Widget passwd_done;*/ -/*Widget passwd_cancel;*/ - Widget resources_dialog; Widget resources_form; Widget timeout_text; @@ -73,75 +64,9 @@ Widget done; Widget restart; /*Widget spacer;*/ -Widget splash_dialog; -Widget splash_form; -Widget splash_roger_label; -Widget splash_label1; -Widget splash_label3; -Widget splash_demo; -Widget splash_prefs; -Widget splash_help; - static Widget buttonbox, textbox, okbox; -void -create_passwd_dialog(Widget parent, Visual *visual, Colormap colormap) -{ - Widget box, passwd_label2; - int depth = visual_depth(XtScreen(parent), visual); - - passwd_dialog = - XtVaCreatePopupShell("passwd_dialog", transientShellWidgetClass, parent, - XtNtitle, NULL, - XtNoverrideRedirect, TRUE, - XtNvisual, visual, - XtNcolormap, colormap, - XtNdepth, depth, - NULL); - - box = XtVaCreateManagedWidget("box", formWidgetClass, passwd_dialog, - XtNleft, XtChainLeft, - XtNright, XtChainRight, - XtNtop, XtChainTop, - XtNbottom, XtChainBottom, - XtNvisual, visual, - XtNcolormap, colormap, - XtNdepth, depth, - NULL); - - roger_label = XtVaCreateManagedWidget("roger", labelWidgetClass, box, - XtNlabel, "", - XtNleft, XtChainLeft, - XtNright, XtChainRight, - XtNtop, XtChainTop, - NULL); - - passwd_label1 = XtVaCreateManagedWidget("label1", labelWidgetClass, box, - XtNfromHoriz, roger_label, - XtNright, XtChainRight, - XtNtop, XtChainTop, - NULL); - passwd_label2 = XtVaCreateManagedWidget("label2", labelWidgetClass, box, - XtNfromHoriz, roger_label, - XtNright, XtChainRight, - XtNfromVert, passwd_label1, - NULL); - passwd_label3 = XtVaCreateManagedWidget("label3", labelWidgetClass, box, - XtNfromHoriz, roger_label, - XtNright, XtChainRight, - XtNfromVert, passwd_label2, - NULL); - - passwd_form = - XtVaCreateManagedWidget("passwd_form", dialogWidgetClass, box, - XtNfromHoriz, roger_label, - XtNright, XtChainRight, - XtNfromVert, passwd_label3, - NULL); -} - - void create_resources_dialog(Widget parent, Visual *visual, Colormap colormap) { @@ -330,63 +255,3 @@ create_demo_dialog(Widget parent, Visual *visual, Colormap colormap) restart = XtVaCreateManagedWidget("restart", commandWidgetClass, box, NULL); done = XtVaCreateManagedWidget("done", commandWidgetClass, box, NULL); } - - -void -create_splash_dialog(Widget parent, Visual *visual, Colormap colormap) -{ - Widget box, splash_label2; - int depth = visual_depth(XtScreen(parent), visual); - - splash_dialog = - XtVaCreatePopupShell("splash_dialog", transientShellWidgetClass, parent, - XtNtitle, NULL, - XtNoverrideRedirect, TRUE, - XtNvisual, visual, - XtNcolormap, colormap, - XtNdepth, depth, - NULL); - - box = XtVaCreateManagedWidget("box", formWidgetClass, splash_dialog, - XtNleft, XtChainLeft, - XtNright, XtChainRight, - XtNtop, XtChainTop, - XtNbottom, XtChainBottom, - XtNvisual, visual, - XtNcolormap, colormap, - XtNdepth, depth, - NULL); - - splash_roger_label = XtVaCreateManagedWidget("roger", labelWidgetClass, box, - XtNlabel, "", - XtNleft, XtChainLeft, - XtNright, XtChainRight, - XtNtop, XtChainTop, - NULL); - - splash_label1 = XtVaCreateManagedWidget("splashLabel1", labelWidgetClass, - box, - XtNfromHoriz, splash_roger_label, - XtNright, XtChainRight, - XtNtop, XtChainTop, - NULL); - splash_label2 = XtVaCreateManagedWidget("splashLabel2", labelWidgetClass, - box, - XtNfromHoriz, splash_roger_label, - XtNright, XtChainRight, - XtNfromVert, splash_label1, - NULL); - splash_label3 = XtVaCreateManagedWidget("splashLabel3", labelWidgetClass, - box, - XtNfromHoriz, splash_roger_label, - XtNright, XtChainRight, - XtNfromVert, splash_label2, - NULL); - - splash_form = - XtVaCreateManagedWidget("splash_form", dialogWidgetClass, box, - XtNfromHoriz, splash_roger_label, - XtNright, XtChainRight, - XtNfromVert, splash_label3, - NULL); -} diff --git a/driver/dialogs-Xm.c b/driver/dialogs-Xm.c index 5a5d73e8..22aa9705 100644 --- a/driver/dialogs-Xm.c +++ b/driver/dialogs-Xm.c @@ -40,15 +40,6 @@ #include "visual.h" /* for visual_depth() */ -Widget passwd_dialog; -Widget passwd_form; -Widget roger_label; -Widget passwd_label1; -Widget passwd_label3; -Widget passwd_text; -Widget passwd_done; -Widget passwd_cancel; - Widget resources_dialog; Widget resources_form; Widget timeout_text; @@ -80,137 +71,6 @@ Widget done; Widget restart; Widget spacer; -Widget splash_dialog; -Widget splash_form; -Widget splash_roger_label; -Widget splash_label1; -Widget splash_label3; -Widget splash_demo; -Widget splash_prefs; -Widget splash_help; - -void -create_passwd_dialog(Widget parent, Visual *visual, Colormap colormap) -{ - Widget shell; - Widget form1; - Widget roger; - Widget dialog; - Widget form2; - Widget label1, label2, label3; - Widget text; - Widget ok, cancel; - Widget w; - Arg al[64]; - int ac = 0; - - ac = 0; - XtSetArg (al[ac], XmNvisual, visual); ac++; - XtSetArg (al[ac], XmNcolormap, colormap); ac++; - XtSetArg (al[ac], XmNdepth, visual_depth(XtScreen(parent), visual)); ac++; - - shell = XmCreateDialogShell (parent, "passwdDialog", al, ac); - - form1 = XmCreateForm (shell, "form", 0, 0); - - roger = XmCreateDrawnButton (form1, "rogerLabel", 0, 0); - - dialog = XmCreateSelectionBox (form1, "passwdForm", al, ac); - - form2 = XmCreateForm ( dialog, "form", 0, 0); - label1 = XmCreateLabel ( form2, "passwdLabel1", 0, 0); - label2 = XmCreateLabel ( form2, "passwdLabel2", 0, 0); - label3 = XmCreateLabel ( form2, "passwdLabel3", 0, 0); - - text = XmSelectionBoxGetChild (dialog, XmDIALOG_TEXT); - ok = XmSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON); - cancel = XmSelectionBoxGetChild (dialog, XmDIALOG_CANCEL_BUTTON); - - w = XmSelectionBoxGetChild (dialog, XmDIALOG_LIST_LABEL); - if (w) XtUnmanageChild (w); - w = XmSelectionBoxGetChild (dialog, XmDIALOG_LIST); - if (w) XtUnmanageChild (XtParent(w)); - w = XmSelectionBoxGetChild (dialog, XmDIALOG_SELECTION_LABEL); - if (w) XtUnmanageChild (w); - w = XmSelectionBoxGetChild (dialog, XmDIALOG_SEPARATOR); - if (w) XtUnmanageChild (w); - w = XmSelectionBoxGetChild (dialog, XmDIALOG_APPLY_BUTTON); - if (w) XtUnmanageChild (w); - w = XmSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON); - if (w) XtUnmanageChild (w); - - XtVaSetValues(label1, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_NONE, - 0); - XtVaSetValues(label2, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, label1, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_NONE, - 0); - XtVaSetValues(label3, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, label2, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - 0); - - XtVaSetValues(roger, - XmNsensitive, FALSE, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_FORM, - 0); - XtVaSetValues(dialog, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, roger, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - 0); - - XtManageChild(label1); - XtManageChild(label2); - XtManageChild(label3); - - XtManageChild(form2); - XtManageChild(text); - XtManageChild(ok); - XtManageChild(cancel); - - XtManageChild(roger); - XtManageChild(dialog); - - { - Dimension width = 0, height = 0; - XtRealizeWidget(form1); - XtVaGetValues(roger, XmNwidth, &width, XmNheight, &height, 0); - if (width == height) - ; - else if (width > height) - XtVaSetValues(roger, XmNwidth, width, XmNheight, width, 0); - else - XtVaSetValues(roger, XmNwidth, height, XmNheight, height, 0); - } - - passwd_dialog = shell; - passwd_form = form1; - roger_label = roger; - passwd_label1 = label1; - passwd_label3 = label3; - passwd_text = text; - passwd_done = ok; - passwd_cancel = cancel; -} - - - void create_resources_dialog(Widget parent, Visual *visual, Colormap colormap) { @@ -707,133 +567,3 @@ create_demo_dialog(Widget parent, Visual *visual, Colormap colormap) demo_form = real_dialog; } - - -void -create_splash_dialog(Widget parent, Visual *visual, Colormap colormap) -{ - Widget shell; - Widget form1; - Widget roger; - Widget dialog; - Widget form2; - Widget label1, label2, label3; - Widget demo, prefs, help; - Widget w; - Arg al[64]; - int ac = 0; - - ac = 0; - XtSetArg (al[ac], XmNvisual, visual); ac++; - XtSetArg (al[ac], XmNcolormap, colormap); ac++; - XtSetArg (al[ac], XmNdepth, visual_depth(XtScreen(parent), visual)); ac++; - - shell = XmCreateDialogShell (parent, "splashDialog", al, ac); - - form1 = XmCreateForm (shell, "form", 0, 0); - - roger = XmCreateDrawnButton (form1, "rogerLabel", 0, 0); - - dialog = XmCreateSelectionBox (form1, "splashForm", al, ac); - - form2 = XmCreateForm ( dialog, "form", 0, 0); - label1 = XmCreateLabel ( form2, "splashLabel1", 0, 0); - label2 = XmCreateLabel ( form2, "splashLabel2", 0, 0); - label3 = XmCreateLabel ( form2, "splashLabel3", 0, 0); - - ac = 0; - XtSetArg(al[ac], XmNtraversalOn, False); ac++; - - demo = XmCreatePushButton (dialog, "splashDemo", al, ac); - prefs = XmCreatePushButton (dialog, "splashPrefs", al, ac); - help = XmSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON); - XtSetValues(help, al, ac); - - w = XmSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON); - if (w) XtUnmanageChild (w); - w = XmSelectionBoxGetChild (dialog, XmDIALOG_CANCEL_BUTTON); - if (w) XtUnmanageChild (w); - w = XmSelectionBoxGetChild (dialog, XmDIALOG_APPLY_BUTTON); - if (w) XtUnmanageChild (w); - w = XmSelectionBoxGetChild (dialog, XmDIALOG_TEXT); - if (w) XtUnmanageChild (w); - w = XmSelectionBoxGetChild (dialog, XmDIALOG_LIST_LABEL); - if (w) XtUnmanageChild (w); - w = XmSelectionBoxGetChild (dialog, XmDIALOG_LIST); - if (w) XtUnmanageChild (XtParent(w)); - w = XmSelectionBoxGetChild (dialog, XmDIALOG_SELECTION_LABEL); - if (w) XtUnmanageChild (w); - w = XmSelectionBoxGetChild (dialog, XmDIALOG_SEPARATOR); - if (w) XtUnmanageChild (w); - w = XmSelectionBoxGetChild (dialog, XmDIALOG_APPLY_BUTTON); - if (w) XtUnmanageChild (w); - - XtVaSetValues(label1, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_NONE, - 0); - XtVaSetValues(label2, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, label1, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_NONE, - 0); - XtVaSetValues(label3, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, label2, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - 0); - - XtVaSetValues(roger, - XmNsensitive, FALSE, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_FORM, - 0); - XtVaSetValues(dialog, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, roger, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - 0); - - XtManageChild(label1); - XtManageChild(label2); - XtManageChild(label3); - - XtManageChild(form2); - XtManageChild(demo); - XtManageChild(prefs); - XtManageChild(help); - - XtManageChild(roger); - XtManageChild(dialog); - - { - Dimension width = 0, height = 0; - XtRealizeWidget(form1); - XtVaGetValues(roger, XmNwidth, &width, XmNheight, &height, 0); - if (width == height) - ; - else if (width > height) - XtVaSetValues(roger, XmNwidth, width, XmNheight, width, 0); - else - XtVaSetValues(roger, XmNwidth, height, XmNheight, height, 0); - } - - splash_dialog = shell; - splash_form = form1; - splash_roger_label = roger; - splash_label1 = label1; - splash_label3 = label3; - splash_demo = demo; - splash_prefs = prefs; - splash_help = help; -} diff --git a/driver/dotfile.c b/driver/dotfile.c new file mode 100644 index 00000000..cba794b6 --- /dev/null +++ b/driver/dotfile.c @@ -0,0 +1,698 @@ +/* dotfile.c --- management of the ~/.xscreensaver file. + * xscreensaver, Copyright (c) 1998 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#include +#include + +#ifndef VMS +# include +#else /* VMS */ +# include "vms-pwd.h" +#endif /* VMS */ + + +/* This file doesn't need the Xt headers, so stub these types out... */ +#undef XtPointer +#define XtAppContext void* +#define XtIntervalId void* +#define XtPointer void* +#define Widget void* + +#include "xscreensaver.h" +#include "resources.h" + +/* Just in case there's something pathological about stat.h... */ +#ifndef S_IRUSR +# define S_IRUSR 00400 +#endif +#ifndef S_IWUSR +# define S_IWUSR 00200 +#endif +#ifndef S_IXUSR +# define S_IXUSR 00100 +#endif +#ifndef S_IXGRP +# define S_IXGRP 00010 +#endif +#ifndef S_IXOTH +# define S_IXOTH 00001 +#endif + + +static const char * +init_file_name (void) +{ + static char *file = 0; + + if (!file) + { + struct passwd *p = getpwuid (getuid ()); + + if (!p || !p->pw_name || !*p->pw_name) + { + fprintf (stderr, "%s: couldn't get user info of uid %d\n", + blurb(), getuid ()); + file = ""; + } + else if (!p->pw_dir || !*p->pw_dir) + { + fprintf (stderr, "%s: couldn't get home directory of %s\n", + blurb(), (p->pw_name ? p->pw_name : "???")); + file = ""; + } + else + { + const char *home = p->pw_dir; + const char *name = ".xscreensaver"; + file = (char *) malloc(strlen(home) + strlen(name) + 2); + strcpy(file, home); + if (!*home || home[strlen(home)-1] != '/') + strcat(file, "/"); + strcat(file, name); + } + } + + if (file && *file) + return file; + else + return 0; +} + + +static const char * +init_file_tmp_name (void) +{ + static char *file = 0; + if (!file) + { + const char *name = init_file_name(); + const char *suffix = ".tmp"; + if (!name || !*name) + file = ""; + else + { + file = (char *) malloc(strlen(name) + strlen(suffix) + 2); + strcpy(file, name); + strcat(file, suffix); + } + } + + if (file && *file) + return file; + else + return 0; +} + + +static const char * const prefs[] = { + "timeout", + "cycle", + "lock", + "lockVTs", + "lockTimeout", + "passwdTimeout", + "visualID", + "installColormap", + "verbose", + "timestamp", + "splash", /* not saved -- same as "splashDuration: 0" */ + "splashDuration", + "helpURL", + "loadURL", + "nice", + "fade", + "unfade", + "fadeSeconds", + "fadeTicks", + "captureStderr", + "captureStdout", /* not saved -- obsolete */ + "font", + "", + "programs", + "", + "pointerPollTime", + "windowCreationTimeout", + "initialDelay", + "sgiSaverExtension", + "mitSaverExtension", + "xidleExtension", + "overlayStderr", + "overlayTextBackground", /* not saved -- X resources only */ + "overlayTextForeground", /* not saved -- X resources only */ + "bourneShell", /* not saved -- X resources only */ + 0 +}; + +static char *strip(char *s) +{ + char *s2; + while (*s == '\t' || *s == ' ' || *s == '\r' || *s == '\n') + s++; + for (s2 = s; *s2; s2++) + ; + for (s2--; s2 >= s; s2--) + if (*s2 == '\t' || *s2 == ' ' || *s2 == '\r' || *s2 =='\n') + *s2 = 0; + else + break; + return s; +} + + +/* Reading + */ + +static int +handle_entry (saver_info *si, const char *key, const char *value, + const char *filename, int line) +{ + int i; + for (i = 0; prefs[i]; i++) + if (*prefs[i] && !strcasecmp(key, prefs[i])) + { + char *val = strdup(value); + char *spec = (char *) malloc(strlen(progclass) + strlen(prefs[i]) +10); + strcpy(spec, progclass); + strcat(spec, "."); + strcat(spec, prefs[i]); + + XrmPutStringResource (&si->db, spec, val); + + free(spec); + free(val); + return 0; + } + + fprintf(stderr, "%s: %s:%d: unknown option \"%s\"\n", + blurb(), filename, line, key); + return 1; +} + +int +read_init_file (saver_info *si) +{ + time_t write_date = 0; + const char *name = init_file_name(); + int line = 0; + struct stat st; + FILE *in; + int buf_size = 1024; + char *buf; + + if (!name) return 0; + + if (stat(name, &st) != 0) + { + si->init_file_date = 0; + return 0; + } + + in = fopen(name, "r"); + if (!in) + { + char *buf = (char *) malloc(1024 + strlen(name)); + sprintf(buf, "%s: error reading %s", blurb(), name); + perror(buf); + free(buf); + return -1; + } + + if (fstat (fileno(in), &st) == 0) + { + write_date = st.st_mtime; + } + else + { + char *buf = (char *) malloc(1024 + strlen(name)); + sprintf(buf, "%s: couldn't re-stat %s", blurb(), name); + perror(buf); + free(buf); + return -1; + } + + buf = (char *) malloc(buf_size); + + while (fgets (buf, buf_size-1, in)) + { + char *key, *value; + int L = strlen(buf); + + line++; + while (L > 2 && + (buf[L-1] != '\n' || /* whole line didn't fit in buffer */ + buf[L-2] == '\\')) /* or line ended with backslash */ + { + if (buf[L-2] == '\\') /* backslash-newline gets swallowed */ + { + buf[L-2] = 0; + L -= 2; + } + buf_size += 1024; + buf = (char *) realloc(buf, buf_size); + if (!buf) exit(1); + + line++; + if (!fgets (buf + L, buf_size-L-1, in)) + break; + L = strlen(buf); + } + + /* Now handle other backslash escapes. */ + { + int i, j; + for (i = 0; buf[i]; i++) + if (buf[i] == '\\') + { + switch (buf[i+1]) + { + case 'n': buf[i] = '\n'; break; + case 'r': buf[i] = '\r'; break; + case 't': buf[i] = '\t'; break; + default: buf[i] = buf[i+1]; break; + } + for (j = i+2; buf[j]; j++) + buf[j-1] = buf[j]; + buf[j-1] = 0; + } + } + + key = strip(buf); + + if (*key == '#' || *key == '!' || *key == ';' || + *key == '\n' || *key == 0) + continue; + + value = strchr (key, ':'); + if (!value) + { + fprintf(stderr, "%s: %s:%d: unparsable line: %s\n", blurb(), + name, line, key); + continue; + } + else + { + *value++ = 0; + value = strip(value); + } + + handle_entry (si, key, value, name, line); + } + free(buf); + + si->init_file_date = write_date; + return 0; +} + + +int +maybe_reload_init_file (saver_info *si) +{ + saver_preferences *p = &si->prefs; + const char *name = init_file_name(); + struct stat st; + int status = 0; + + if (!name) return 0; + + if (stat(name, &st) != 0) + return 0; + + if (si->init_file_date == st.st_mtime) + return 0; + + if (p->verbose_p) + fprintf (stderr, "%s: file %s has changed, reloading.\n", blurb(), name); + + status = read_init_file (si); + if (status == 0) + get_resources (si); + return status; +} + + +/* Writing + */ + +static int +tab_to (FILE *out, int from, int to) +{ + int tab_width = 8; + int to_mod = (to / tab_width) * tab_width; + while (from < to_mod) + { + fprintf(out, "\t"); + from = (((from / tab_width) + 1) * tab_width); + } + while (from < to) + { + fprintf(out, " "); + from++; + } + return from; +} + +static void +write_entry (FILE *out, const char *key, const char *value) +{ + char *v = strdup(value ? value : ""); + char *v2 = v; + char *nl = 0; + int col; + Bool do_visual_kludge = (!strcmp(key, "programs")); + Bool do_wrap = do_visual_kludge; + int tab = (do_visual_kludge ? 16 : 23); + int tab2 = 3; + Bool first = True; + + fprintf(out, "%s:", key); + col = strlen(key) + 1; + + while (1) + { + char *s; + if (first) + first = False; + else + { + col = tab_to(out, col, 75); + fprintf(out, " \\n\\\n"); + col = 0; + } + + v2 = strip(v2); + nl = strchr(v2, '\n'); + if (nl) + *nl = 0; + + s = (do_visual_kludge ? strpbrk(v2, " \t\n:") : 0); + if (s && *s == ':') + col = tab_to (out, col, tab2); + else + col = tab_to (out, col, tab); + + if (do_wrap && + strlen(v2) + col > 75) + { + int L = strlen(v2); + int start = 0; + int end = start; + while (start < L) + { + while (v2[end] == ' ' || v2[end] == '\t') + end++; + while (v2[end] != ' ' && v2[end] != '\t' && + v2[end] != '\n' && v2[end] != 0) + end++; + if (col + (end - start) >= 74) + { + col = tab_to (out, col, 75); + fprintf(out, " \\\n"); + col = tab_to (out, 0, tab + 2); + while (v2[start] == ' ' || v2[start] == '\t') + start++; + } + + while (start < end) + { + fputc(v2[start++], out); + col++; + } + } + } + else + { + fprintf (out, "%s", v2); + col += strlen(v2); + } + + if (nl) + v2 = nl + 1; + else + break; + } + + fprintf(out, "\n"); + free(v); +} + +int +write_init_file (saver_info *si) +{ + const char *name = init_file_name(); + const char *tmp_name = init_file_tmp_name(); + struct stat st; + saver_preferences *p = &si->prefs; + int i, j; + + /* Kludge, since these aren't in the saver_preferences struct as strings... + */ + char *visual_name; + char *programs; + Bool capture_stderr_p; + Bool overlay_stderr_p; + char *stderr_font; + FILE *out; + + if (!name) return 0; + + if (si->dangerous_uid_p) + { + if (p->verbose_p) + { + fprintf (stderr, "%s: not writing \"%s\":\n", blurb(), name); + describe_uids (si, stderr); + } + return 0; + } + + if (p->verbose_p) + fprintf (stderr, "%s: writing \"%s\".\n", blurb(), name); + + unlink (tmp_name); + out = fopen(tmp_name, "w"); + if (!out) + { + char *buf = (char *) malloc(1024 + strlen(name)); + sprintf(buf, "%s: error writing %s", blurb(), name); + perror(buf); + free(buf); + return -1; + } + + /* Give the new .xscreensaver file the same permissions as the old one; + except ensure that it is readable and writable by owner, and not + executable. + */ + if (stat(name, &st) == 0) + { + mode_t mode = st.st_mode; + mode |= S_IRUSR | S_IWUSR; + mode &= ~(S_IXUSR | S_IXGRP | S_IXOTH); + if (fchmod (fileno(out), mode) != 0) + { + char *buf = (char *) malloc(1024 + strlen(name)); + sprintf (buf, "%s: error fchmodding %s to 0%o", blurb(), + tmp_name, (unsigned int) mode); + perror(buf); + free(buf); + return -1; + } + } + + /* Kludge, since these aren't in the saver_preferences struct... */ + visual_name = get_string_resource ("visualID", "VisualID"); + programs = 0; + capture_stderr_p = get_boolean_resource ("captureStderr", "Boolean"); + overlay_stderr_p = get_boolean_resource ("overlayStderr", "Boolean"); + stderr_font = get_string_resource ("font", "Font"); + + i = 0; + for (j = 0; j < p->screenhacks_count; j++) + i += strlen(p->screenhacks[j]) + 2; + { + char *ss = programs = (char *) malloc(i + 10); + *ss = 0; + for (j = 0; j < p->screenhacks_count; j++) + { + strcat(ss, p->screenhacks[j]); + ss += strlen(ss); + *ss++ = '\n'; + *ss = 0; + } + } + + { + struct passwd *p = getpwuid (getuid ()); + char *whoami = (p && p->pw_name && *p->pw_name + ? p->pw_name : ""); + fprintf (out, + "# %s Preferences File\n" + "# Written by %s %s for %s on %s.\n" + "# http://www.jwz.org/xscreensaver/\n" + "\n", + progclass, progname, si->version, + (whoami ? whoami : ""), + timestring()); + } + + for (j = 0; prefs[j]; j++) + { + char buf[255]; + const char *pr = prefs[j]; + enum pref_type { pref_str, pref_int, pref_bool, pref_time + } type = pref_str; + const char *s = 0; + int i = 0; + Bool b = False; + Time t = 0; + + if (pr && !*pr) + { + fprintf(out, "\n"); + continue; + } + +# undef CHECK +# define CHECK(X) else if (!strcmp(pr, X)) + if (!pr || !*pr) ; + CHECK("timeout") type = pref_time, t = p->timeout; + CHECK("cycle") type = pref_time, t = p->cycle; + CHECK("lock") type = pref_bool, b = p->lock_p; +# if 0 /* #### not ready yet */ + CHECK("lockVTs") type = pref_bool, b = p->lock_vt_p; +# else + CHECK("lockVTs") continue; /* don't save */ +# endif + CHECK("lockTimeout") type = pref_time, t = p->lock_timeout; + CHECK("passwdTimeout") type = pref_time, t = p->passwd_timeout; + CHECK("visualID") type = pref_str, s = visual_name; + CHECK("installColormap") type = pref_bool, b = p->install_cmap_p; + CHECK("verbose") type = pref_bool, b = p->verbose_p; + CHECK("timestamp") type = pref_bool, b = p->timestamp_p; + CHECK("splash") continue; /* don't save */ + CHECK("splashDuration") type = pref_time, t = p->splash_duration; + CHECK("helpURL") type = pref_str, s = p->help_url; + CHECK("loadURL") type = pref_str, s = p->load_url_command; + CHECK("nice") type = pref_int, i = p->nice_inferior; + CHECK("fade") type = pref_bool, b = p->fade_p; + CHECK("unfade") type = pref_bool, b = p->unfade_p; + CHECK("fadeSeconds") type = pref_time, t = p->fade_seconds; + CHECK("fadeTicks") type = pref_int, i = p->fade_ticks; + CHECK("captureStderr") type = pref_bool, b = capture_stderr_p; + CHECK("captureStdout") continue; /* don't save */ + CHECK("font") type = pref_str, s = stderr_font; + CHECK("programs") type = pref_str, s = programs; + CHECK("pointerPollTime") type = pref_time, t = p->pointer_timeout; + CHECK("windowCreationTimeout")type=pref_time,t= p->notice_events_timeout; + CHECK("initialDelay") type = pref_time, t = p->initial_delay; + CHECK("sgiSaverExtension")type = pref_bool, b=p->use_sgi_saver_extension; + CHECK("mitSaverExtension")type = pref_bool, b=p->use_mit_saver_extension; + CHECK("xidleExtension") type = pref_bool, b = p->use_xidle_extension; + CHECK("overlayStderr") type = pref_bool, b = overlay_stderr_p; + CHECK("overlayTextBackground") continue; /* don't save */ + CHECK("overlayTextForeground") continue; /* don't save */ + CHECK("bourneShell") continue; + else abort(); +# undef CHECK + + switch (type) + { + case pref_str: + break; + case pref_int: + sprintf(buf, "%d", i); + s = buf; + break; + case pref_bool: + s = b ? "True" : "False"; + break; + case pref_time: + { + unsigned int hour = 0, min = 0, sec = (unsigned int) (t/1000); + if (sec >= 60) + { + min += (sec / 60); + sec %= 60; + } + if (min >= 60) + { + hour += (min / 60); + min %= 60; + } + sprintf (buf, "%u:%02u:%02u", hour, min, sec); + s = buf; + } + break; + default: + abort(); + break; + } + write_entry (out, pr, s); + } + + fprintf(out, "\n"); + + if (visual_name) free(visual_name); + if (stderr_font) free(stderr_font); + if (programs) free(programs); + + if (fclose(out) == 0) + { + time_t write_date = 0; + + if (stat(tmp_name, &st) == 0) + { + write_date = st.st_mtime; + } + else + { + char *buf = (char *) malloc(1024 + strlen(tmp_name) + strlen(name)); + sprintf(buf, "%s: couldn't stat %s", blurb(), tmp_name); + perror(buf); + unlink (tmp_name); + free(buf); + return -1; + } + + if (rename (tmp_name, name) != 0) + { + char *buf = (char *) malloc(1024 + strlen(tmp_name) + strlen(name)); + sprintf(buf, "%s: error renaming %s to %s", blurb(), tmp_name, name); + perror(buf); + unlink (tmp_name); + free(buf); + return -1; + } + else + { + si->init_file_date = write_date; + } + } + else + { + char *buf = (char *) malloc(1024 + strlen(name)); + sprintf(buf, "%s: error closing %s", blurb(), name); + perror(buf); + free(buf); + unlink (tmp_name); + return -1; + } + + return 0; +} diff --git a/driver/lock.c b/driver/lock.c index f388c0d6..7a3ed6a2 100644 --- a/driver/lock.c +++ b/driver/lock.c @@ -19,657 +19,774 @@ #ifndef NO_LOCKING /* whole file */ -#include #include -#include /* for XtResizeWidget */ #include "xscreensaver.h" #include "resources.h" +#ifdef _VROOT_H_ +ERROR! You must not include vroot.h in this file. +#endif + #ifndef VMS # include #else /* VMS */ + extern char *getenv(const char *name); extern int validate_user(char *name, char *password); + +static Bool +vms_passwd_valid_p(char *pw) +{ + return (validate_user (getenv("USER"), typed_passwd) == 1); +} +# undef passwd_valid_p +# define passwd_valid_p vms_passwd_valid_p + #endif /* VMS */ -#ifdef HAVE_ATHENA +#undef MAX +#define MAX(a,b) ((a)>(b)?(a):(b)) -# include -# include -# include -# include -# include +enum passwd_state { pw_read, pw_ok, pw_fail, pw_cancel, pw_time }; -#else /* HAVE_MOTIF */ +struct passwd_dialog_data { -# include -# include -# include + enum passwd_state state; + char typed_passwd [80]; + XtIntervalId timer; + int i_beam; -#endif /* HAVE_MOTIF */ + float ratio; + Dimension width; + Dimension height; -#ifdef _VROOT_H_ -ERROR! You must not include vroot.h in this file. -#endif + char *heading_label; + char *body_label; + char *user_label; + char *passwd_label; + char *user_string; + char *passwd_string; -extern Widget passwd_dialog; -extern Widget passwd_form; -extern Widget roger_label; -extern Widget passwd_label1; -extern Widget passwd_label3; -extern Widget passwd_cancel; + XFontStruct *heading_font; + XFontStruct *body_font; + XFontStruct *label_font; + XFontStruct *passwd_font; -#ifdef HAVE_MOTIF -extern Widget passwd_text; -extern Widget passwd_done; -#else /* HAVE_ATHENA */ -static Widget passwd_text = 0; /* gag... */ -static Widget passwd_done = 0; -#endif /* HAVE_ATHENA */ + Pixel foreground; + Pixel background; + Pixel passwd_foreground; + Pixel passwd_background; + Pixel logo_foreground; + Pixel logo_background; + Pixel shadow_top; + Pixel shadow_bottom; + Dimension logo_width; + Dimension logo_height; + Dimension thermo_width; + Dimension internal_border; + Dimension shadow_width; + Dimension passwd_field_x, passwd_field_y; + Dimension passwd_field_width, passwd_field_height; -static enum { pw_read, pw_ok, pw_fail, pw_cancel, pw_time } passwd_state; -static char typed_passwd [80]; + Dimension thermo_field_x, thermo_field_y; + Dimension thermo_field_height; +}; - -#if defined(HAVE_ATHENA) || (XmVersion >= 1002) - /* The `destroy' bug apears to be fixed as of Motif 1.2.1, but - the `verify-callback' bug is still present. */ -# define DESTROY_WORKS -#endif -static void -passwd_cancel_cb (Widget button, XtPointer client_data, XtPointer call_data) +void +make_passwd_window (saver_info *si) { - passwd_state = pw_cancel; -} + struct passwd *p = getpwuid (getuid ()); + int x, y, bw; + XSetWindowAttributes attrs; + unsigned long attrmask = 0; + Screen *screen = si->default_screen->screen; + passwd_dialog_data *pw = (passwd_dialog_data *) calloc (1, sizeof(*pw)); + Colormap cmap = DefaultColormapOfScreen (screen); + char *f; + + pw->ratio = 1.0; + + pw->heading_label = get_string_resource ("passwd.heading.label", + "Dialog.Label.Label"); + pw->body_label = get_string_resource ("passwd.body.label", + "Dialog.Label.Label"); + pw->user_label = get_string_resource ("passwd.user.label", + "Dialog.Label.Label"); + pw->passwd_label = get_string_resource ("passwd.passwd.label", + "Dialog.Label.Label"); + + if (!pw->heading_label) + pw->heading_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY"); + if (!pw->body_label) + pw->body_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY"); + if (!pw->user_label) pw->user_label = strdup("ERROR"); + if (!pw->passwd_label) pw->passwd_label = strdup("ERROR"); + + /* Put the version number in the label. */ + { + char *s = (char *) malloc (strlen(pw->heading_label) + 20); + sprintf(s, pw->heading_label, si->version); + free (pw->heading_label); + pw->heading_label = s; + } + pw->user_string = (p->pw_name ? p->pw_name : "???"); + pw->passwd_string = strdup(""); + + f = get_string_resource ("passwd.headingFont", "Dialog.Font"); + pw->heading_font = XLoadQueryFont (si->dpy, (f ? f : "fixed")); + if (!pw->heading_font) pw->heading_font = XLoadQueryFont (si->dpy, "fixed"); + if (f) free (f); + + f = get_string_resource("passwd.bodyFont", "Dialog.Font"); + pw->body_font = XLoadQueryFont (si->dpy, (f ? f : "fixed")); + if (!pw->body_font) pw->body_font = XLoadQueryFont (si->dpy, "fixed"); + if (f) free (f); + + f = get_string_resource("passwd.labelFont", "Dialog.Font"); + pw->label_font = XLoadQueryFont (si->dpy, (f ? f : "fixed")); + if (!pw->label_font) pw->label_font = XLoadQueryFont (si->dpy, "fixed"); + if (f) free (f); + + f = get_string_resource("passwd.passwdFont", "Dialog.Font"); + pw->passwd_font = XLoadQueryFont (si->dpy, (f ? f : "fixed")); + if (!pw->passwd_font) pw->passwd_font = XLoadQueryFont (si->dpy, "fixed"); + if (f) free (f); + + pw->foreground = get_pixel_resource ("passwd.foreground", + "Dialog.Foreground", + si->dpy, cmap); + pw->background = get_pixel_resource ("passwd.background", + "Dialog.Background", + si->dpy, cmap); + + if (pw->foreground == pw->background) + { + /* Make sure the error messages show up. */ + pw->foreground = BlackPixelOfScreen (screen); + pw->background = WhitePixelOfScreen (screen); + } -#ifdef VMS -static Bool -vms_passwd_valid_p(char *pw) -{ - char *u = getenv("USER"); - return (validate_user (i, typed_passwd) == 1); -} -# undef passwd_valid_p -# define passwd_valid_p vms_passwd_valid_p + pw->passwd_foreground = get_pixel_resource ("passwd.text.foreground", + "Dialog.Text.Foreground", + si->dpy, cmap); + pw->passwd_background = get_pixel_resource ("passwd.text.background", + "Dialog.Text.Background", + si->dpy, cmap); + pw->logo_foreground = get_pixel_resource ("passwd.logo.foreground", + "Dialog.Logo.Foreground", + si->dpy, cmap); + pw->logo_background = get_pixel_resource ("passwd.logo.background", + "Dialog.Logo.Background", + si->dpy, cmap); + pw->shadow_top = get_pixel_resource ("passwd.topShadowColor", + "Dialog.Foreground", + si->dpy, cmap); + pw->shadow_bottom = get_pixel_resource ("passwd.bottomShadowColor", + "Dialog.Background", + si->dpy, cmap); + + pw->logo_width = get_integer_resource ("passwd.logo.width", + "Dialog.Logo.Width"); + pw->logo_height = get_integer_resource ("passwd.logo.height", + "Dialog.Logo.Height"); + pw->thermo_width = get_integer_resource ("passwd.thermometer.width", + "Dialog.Thermometer.Width"); + pw->internal_border = get_integer_resource ("passwd.internalBorderWidth", + "Dialog.InternalBorderWidth"); + pw->shadow_width = get_integer_resource ("passwd.shadowThickness", + "Dialog.ShadowThickness"); + + if (pw->logo_width == 0) pw->logo_width = 150; + if (pw->logo_height == 0) pw->logo_height = 150; + if (pw->internal_border == 0) pw->internal_border = 15; + if (pw->shadow_width == 0) pw->shadow_width = 4; + if (pw->thermo_width == 0) pw->thermo_width = pw->shadow_width; -#endif /* VMS */ + { + int direction, ascent, descent; + XCharStruct overall; + + pw->width = 0; + pw->height = 0; + + /* Measure the heading_label. */ + XTextExtents (pw->heading_font, + pw->heading_label, strlen(pw->heading_label), + &direction, &ascent, &descent, &overall); + if (overall.width > pw->width) pw->width = overall.width; + pw->height += ascent + descent; + + /* Measure the body_label. */ + XTextExtents (pw->body_font, + pw->body_label, strlen(pw->body_label), + &direction, &ascent, &descent, &overall); + if (overall.width > pw->width) pw->width = overall.width; + pw->height += ascent + descent; + { + Dimension w2 = 0, w3 = 0; + Dimension h2 = 0, h3 = 0; + const char *passwd_string = "MMMMMMMMMMMM"; + + /* Measure the user_label. */ + XTextExtents (pw->label_font, + pw->user_label, strlen(pw->user_label), + &direction, &ascent, &descent, &overall); + if (overall.width > w2) w2 = overall.width; + h2 += ascent + descent; + + /* Measure the passwd_label. */ + XTextExtents (pw->label_font, + pw->passwd_label, strlen(pw->passwd_label), + &direction, &ascent, &descent, &overall); + if (overall.width > w2) w2 = overall.width; + h2 += ascent + descent; + + /* Measure the user_string. */ + XTextExtents (pw->passwd_font, + pw->user_string, strlen(pw->user_string), + &direction, &ascent, &descent, &overall); + overall.width += (pw->shadow_width * 4); + ascent += (pw->shadow_width * 4); + if (overall.width > w3) w3 = overall.width; + h3 += ascent + descent; + + /* Measure the (maximally-sized, dummy) passwd_string. */ + XTextExtents (pw->passwd_font, + passwd_string, strlen(passwd_string), + &direction, &ascent, &descent, &overall); + overall.width += (pw->shadow_width * 4); + ascent += (pw->shadow_width * 4); + if (overall.width > w3) w3 = overall.width; + h3 += ascent + descent; + + w2 = w2 + w3 + (pw->shadow_width * 2); + h2 = MAX (h2, h3); + + if (w2 > pw->width) pw->width = w2; + pw->height += h2; + } -static void -passwd_done_cb (Widget button, XtPointer client_data, XtPointer call_data) -{ - if (passwd_state != pw_read) return; /* already done */ + pw->width += (pw->internal_border * 2); + pw->height += (pw->internal_border * 4); - if (passwd_valid_p (typed_passwd)) - passwd_state = pw_ok; - else - passwd_state = pw_fail; -} + pw->width += pw->thermo_width + (pw->shadow_width * 3); + if (pw->logo_height > pw->height) + pw->height = pw->logo_height; + else if (pw->height > pw->logo_height) + pw->logo_height = pw->height; -#if defined(HAVE_MOTIF) && defined(VERIFY_CALLBACK_WORKS) + pw->logo_width = pw->logo_height; - /* It looks to me like adding any modifyVerify callback causes - Motif 1.1.4 to free the the TextF_Value() twice. I can't see - the bug in the Motif source, but Purify complains, even if - check_passwd_cb() is a no-op. + pw->width += pw->logo_width; + } - Update: Motif 1.2.1 also loses, but in a different way: it - writes beyond the end of a malloc'ed block in ModifyVerify(). - Probably this block is the text field's text. - */ + attrmask |= CWOverrideRedirect; attrs.override_redirect = True; + attrmask |= CWEventMask; attrs.event_mask = ExposureMask|KeyPressMask; -static void -check_passwd_cb (Widget button, XtPointer client_data, XtPointer call_data) -{ - XmTextVerifyCallbackStruct *vcb = (XmTextVerifyCallbackStruct *) call_data; + { + Dimension w = WidthOfScreen(screen); + Dimension h = HeightOfScreen(screen); + if (si->prefs.debug_p) w /= 2; + x = ((w + pw->width) / 2) - pw->width; + y = ((h + pw->height) / 2) - pw->height; + if (x < 0) x = 0; + if (y < 0) y = 0; + } - if (passwd_state != pw_read) - return; - else if (vcb->reason == XmCR_ACTIVATE) - { - passwd_done_cb (0, 0, 0); - } - else if (vcb->text->length > 1) /* don't allow "paste" operations */ - { - vcb->doit = False; - } - else if (vcb->text->ptr != 0) - { - int i; - int L = vcb->text->length; - if (L >= sizeof(typed_passwd)) - L = sizeof(typed_passwd)-1; - strncat (typed_passwd, vcb->text->ptr, L); - typed_passwd [vcb->endPos + L] = 0; - for (i = 0; i < vcb->text->length; i++) - vcb->text->ptr [i] = '*'; - } -} + bw = get_integer_resource ("passwd.borderWidth", "Dialog.BorderWidth"); -# else /* HAVE_ATHENA || !VERIFY_CALLBACK_WORKS */ - -static void keypress (Widget w, XEvent *event, String *av, Cardinal *ac); -static void backspace (Widget w, XEvent *event, String *av, Cardinal *ac); -static void kill_line (Widget w, XEvent *event, String *av, Cardinal *ac); -static void done (Widget w, XEvent *event, String *av, Cardinal *ac); - -static XtActionsRec actions[] = {{"keypress", keypress}, - {"backspace", backspace}, - {"kill_line", kill_line}, - {"done", done} - }; - -# if 0 /* This works for Athena, but not Motif: keypress() gets called - for all keys anyway. So, the implementation of keypress() - has BackSpace, etc, hardcoded into it instead. FMH! - */ -static char translations[] = "BackSpace: backspace()\n" - "Delete: backspace()\n" - "CtrlH: backspace()\n" - "CtrlU: kill_line()\n" - "CtrlX: kill_line()\n" - "CtrlJ: done()\n" - "CtrlM: done()\n" - ": keypress()\n"; -# else /* !0 */ -static char translations[] = ": keypress()\n"; -# endif /* !0 */ + si->passwd_dialog = + XCreateWindow (si->dpy, + RootWindowOfScreen(screen), + x, y, pw->width, pw->height, bw, + DefaultDepthOfScreen (screen), InputOutput, + DefaultVisualOfScreen(screen), + attrmask, &attrs); + XSetWindowBackground (si->dpy, si->passwd_dialog, pw->background); + XMapRaised (si->dpy, si->passwd_dialog); + XSync (si->dpy, False); -static void -text_field_set_string (Widget widget, char *text, int position) -{ -#ifdef HAVE_MOTIF - XmTextFieldSetString (widget, text); - XmTextFieldSetInsertionPosition (widget, position); - -#else /* HAVE_ATHENA */ - char *buf; - int end_pos; - - XawTextBlock block; - block.firstPos = 0; - block.length = strlen (text); - block.ptr = text; - block.format = 0; - if (block.length == 0) - { - buf = XawDialogGetValueString(passwd_form); - if (buf) - end_pos = strlen(buf); - else - end_pos = -1; - } - XawTextReplace (widget, 0, end_pos, &block); - XawTextSetInsertionPoint (widget, position); -#endif /* HAVE_ATHENA */ + si->pw_data = pw; + + draw_passwd_window (si); + XSync (si->dpy, False); } -static void -keypress (Widget w, XEvent *event, String *argv, Cardinal *argc) +void +draw_passwd_window (saver_info *si) { - int i, j; - char s [sizeof(typed_passwd)]; - int size = XLookupString ((XKeyEvent *) event, s, sizeof(s)-1, 0, 0); - if (size != 1) return; + passwd_dialog_data *pw = si->pw_data; + XGCValues gcv; + GC gc1, gc2; + int spacing, height; + int x1, x2, x3, y1, y2; + int sw; + int tb_height; + + height = (pw->heading_font->ascent + pw->heading_font->descent + + pw->body_font->ascent + pw->body_font->descent + + (2 * MAX ((pw->label_font->ascent + pw->label_font->descent), + (pw->passwd_font->ascent + pw->passwd_font->descent + + (pw->shadow_width * 4))))); + spacing = ((pw->height - (2 * pw->shadow_width) - + pw->internal_border - height)) / 8; + if (spacing < 0) spacing = 0; + + gcv.foreground = pw->foreground; + gc1 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground, &gcv); + gc2 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground, &gcv); + x1 = pw->logo_width + pw->thermo_width + (pw->shadow_width * 3); + x3 = pw->width - (pw->shadow_width * 2); + y1 = (pw->shadow_width * 2) + spacing + spacing; + + /* top heading + */ + XSetFont (si->dpy, gc1, pw->heading_font->fid); + sw = string_width (pw->heading_font, pw->heading_label); + x2 = (x1 + ((x3 - x1 - sw) / 2)); + y1 += spacing + pw->heading_font->ascent + pw->heading_font->descent; + XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1, + pw->heading_label, strlen(pw->heading_label)); + + /* text below top heading + */ + XSetFont (si->dpy, gc1, pw->body_font->fid); + y1 += spacing + pw->body_font->ascent + pw->body_font->descent; + sw = string_width (pw->body_font, pw->body_label); + x2 = (x1 + ((x3 - x1 - sw) / 2)); + XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1, + pw->body_label, strlen(pw->body_label)); - /* hack because I can't get translations to dance to my tune... */ - if (*s == '\010') { backspace (w, event, argv, argc); return; } - if (*s == '\177') { backspace (w, event, argv, argc); return; } - if (*s == '\025') { kill_line (w, event, argv, argc); return; } - if (*s == '\030') { kill_line (w, event, argv, argc); return; } - if (*s == '\012') { done (w, event, argv, argc); return; } - if (*s == '\015') { done (w, event, argv, argc); return; } - i = j = strlen (typed_passwd); + tb_height = (pw->passwd_font->ascent + pw->passwd_font->descent + + (pw->shadow_width * 4)); - if (i >= (sizeof(typed_passwd)-1)) - { - XBell(XtDisplay(w), 0); - return; - } + /* the "User:" prompt + */ + y1 += spacing; + y2 = y1; + XSetForeground (si->dpy, gc1, pw->foreground); + XSetFont (si->dpy, gc1, pw->label_font->fid); + y1 += (spacing + tb_height); + x2 = (x1 + pw->internal_border + + MAX(string_width (pw->label_font, pw->user_label), + string_width (pw->label_font, pw->passwd_label))); + XDrawString (si->dpy, si->passwd_dialog, gc1, + x2 - string_width (pw->label_font, pw->user_label), + y1, + pw->user_label, strlen(pw->user_label)); + + /* the "Password:" prompt + */ + y1 += (spacing + tb_height); + XDrawString (si->dpy, si->passwd_dialog, gc1, + x2 - string_width (pw->label_font, pw->passwd_label), + y1, + pw->passwd_label, strlen(pw->passwd_label)); - typed_passwd [i] = *s; - s [++i] = 0; - while (i--) - s [i] = '*'; - text_field_set_string (passwd_text, s, j + 1); -} + XSetForeground (si->dpy, gc2, pw->passwd_background); -static void -backspace (Widget w, XEvent *event, String *argv, Cardinal *argc) -{ - char s [sizeof(typed_passwd)]; - int i = strlen (typed_passwd); - int j = i; - if (i == 0) - return; - typed_passwd [--i] = 0; - s [i] = 0; - while (i--) - s [i] = '*'; - - text_field_set_string (passwd_text, s, j + 1); -} + /* the "user name" text field + */ + y1 = y2; + XSetForeground (si->dpy, gc1, pw->passwd_foreground); + XSetFont (si->dpy, gc1, pw->passwd_font->fid); + y1 += (spacing + tb_height); + x2 += (pw->shadow_width * 4); + + pw->passwd_field_width = x3 - x2 - pw->internal_border; + pw->passwd_field_height = (pw->passwd_font->ascent + + pw->passwd_font->descent + + pw->shadow_width); + + XFillRectangle (si->dpy, si->passwd_dialog, gc2, + x2 - pw->shadow_width, + y1 - (pw->passwd_font->ascent + pw->passwd_font->descent), + pw->passwd_field_width, pw->passwd_field_height); + XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1, + pw->user_string, strlen(pw->user_string)); + + /* the "password" text field + */ + y1 += (spacing + tb_height); -static void -kill_line (Widget w, XEvent *event, String *argv, Cardinal *argc) -{ - memset (typed_passwd, 0, sizeof(typed_passwd)); - text_field_set_string (passwd_text, "", 0); -} + pw->passwd_field_x = x2 - pw->shadow_width; + pw->passwd_field_y = y1 - (pw->passwd_font->ascent + + pw->passwd_font->descent); -static void -done (Widget w, XEvent *event, String *argv, Cardinal *argc) -{ - passwd_done_cb (w, 0, 0); -} + /* The shadow around the text fields + */ + y1 = y2; + y1 += (spacing + (pw->shadow_width * 3)); + x1 = x2 - (pw->shadow_width * 2); + x2 = pw->passwd_field_width + (pw->shadow_width * 2); + y2 = pw->passwd_field_height + (pw->shadow_width * 2); + + draw_shaded_rectangle (si->dpy, si->passwd_dialog, + x1, y1, x2, y2, + pw->shadow_width, + pw->shadow_bottom, pw->shadow_top); + + y1 += (spacing + pw->passwd_font->ascent + pw->passwd_font->descent + + (pw->shadow_width * 4)); + draw_shaded_rectangle (si->dpy, si->passwd_dialog, + x1, y1, x2, y2, + pw->shadow_width, + pw->shadow_bottom, pw->shadow_top); + + /* the logo + */ + XSetForeground (si->dpy, gc1, pw->logo_foreground); + XSetForeground (si->dpy, gc2, pw->logo_background); -#endif /* HAVE_ATHENA || !VERIFY_CALLBACK_WORKS */ + x1 = pw->shadow_width * 3; + y1 = pw->shadow_width * 3; + x2 = pw->logo_width - (pw->shadow_width * 6); + y2 = pw->logo_height - (pw->shadow_width * 6); + XFillRectangle (si->dpy, si->passwd_dialog, gc2, x1, y1, x2, y2); + skull (si->dpy, si->passwd_dialog, gc1, gc2, + x1 + pw->shadow_width, y1 + pw->shadow_width, + x2 - (pw->shadow_width * 2), y2 - (pw->shadow_width * 2)); -static void -make_passwd_dialog (saver_info *si) -{ - char *username = 0; - saver_screen_info *ssi = si->default_screen; - Widget parent = ssi->toplevel_shell; + /* The thermometer + */ + pw->thermo_field_x = pw->logo_width + pw->shadow_width; + pw->thermo_field_y = pw->shadow_width * 3; + pw->thermo_field_height = pw->height - (pw->shadow_width * 6); - if (ssi->demo_cmap && - ssi->demo_cmap != ssi->cmap && - ssi->demo_cmap != DefaultColormapOfScreen (ssi->screen)) - { - XFreeColormap (si->dpy, ssi->demo_cmap); - ssi->demo_cmap = 0; - } + /* Solid border inside the logo box. */ + XSetForeground (si->dpy, gc1, pw->foreground); + XDrawRectangle (si->dpy, si->passwd_dialog, gc1, x1, y1, x2-1, y2-1); - if (ssi->default_visual == DefaultVisualOfScreen (ssi->screen)) - ssi->demo_cmap = DefaultColormapOfScreen (ssi->screen); - else - ssi->demo_cmap = XCreateColormap (si->dpy, - RootWindowOfScreen (ssi->screen), - ssi->default_visual, AllocNone); + /* The shadow around the logo + */ + draw_shaded_rectangle (si->dpy, si->passwd_dialog, + pw->shadow_width * 2, + pw->shadow_width * 2, + pw->logo_width - (pw->shadow_width * 4), + pw->logo_height - (pw->shadow_width * 4), + pw->shadow_width, + pw->shadow_bottom, pw->shadow_top); + + /* The shadow around the thermometer + */ + draw_shaded_rectangle (si->dpy, si->passwd_dialog, + pw->logo_width, + pw->shadow_width * 2, + pw->thermo_width + (pw->shadow_width * 2), + pw->height - (pw->shadow_width * 4), + pw->shadow_width, + pw->shadow_bottom, pw->shadow_top); + + /* Solid border inside the thermometer. */ + XSetForeground (si->dpy, gc1, pw->foreground); + XDrawRectangle (si->dpy, si->passwd_dialog, gc1, + pw->logo_width + pw->shadow_width, + pw->shadow_width * 3, + pw->thermo_width - 1, + pw->height - (pw->shadow_width * 6) - 1); + + /* The shadow around the whole window + */ + draw_shaded_rectangle (si->dpy, si->passwd_dialog, + 0, 0, pw->width, pw->height, pw->shadow_width, + pw->shadow_top, pw->shadow_bottom); - create_passwd_dialog (parent, ssi->default_visual, ssi->demo_cmap); + XFreeGC (si->dpy, gc1); + XFreeGC (si->dpy, gc2); -#ifdef HAVE_ATHENA - XtVaSetValues(passwd_form, XtNvalue, typed_passwd, 0); + update_passwd_window (si, pw->passwd_string, pw->ratio); +} - XawDialogAddButton(passwd_form,"ok", passwd_done_cb, 0); - XawDialogAddButton(passwd_form,"cancel", passwd_cancel_cb, 0); - passwd_done = XtNameToWidget(passwd_form,"ok"); - passwd_text = XtNameToWidget(passwd_form,"value"); - XtAppAddActions(XtWidgetToApplicationContext(passwd_text), - actions, XtNumber(actions)); - XtOverrideTranslations(passwd_text, XtParseTranslationTable(translations)); +void +update_passwd_window (saver_info *si, const char *printed_passwd, float ratio) +{ + passwd_dialog_data *pw = si->pw_data; + XGCValues gcv; + GC gc1, gc2; + int x, y; + + pw->ratio = ratio; + gcv.foreground = pw->passwd_foreground; + gcv.font = pw->passwd_font->fid; + gc1 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground|GCFont, &gcv); + gcv.foreground = pw->passwd_background; + gc2 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground, &gcv); + + if (printed_passwd) + { + char *s = strdup (printed_passwd); + if (pw->passwd_string) free (pw->passwd_string); + pw->passwd_string = s; + } - /* Lose the label on the inner dialog. */ - { - Widget w = XtNameToWidget(passwd_form, "label"); - if (w) XtUnmanageChild(w); - } + /* the "password" text field + */ + XFillRectangle (si->dpy, si->passwd_dialog, gc2, + pw->passwd_field_x, pw->passwd_field_y, + pw->passwd_field_width, pw->passwd_field_height); + XDrawString (si->dpy, si->passwd_dialog, gc1, + pw->passwd_field_x + pw->shadow_width, + pw->passwd_field_y + (pw->passwd_font->ascent + + pw->passwd_font->descent), + pw->passwd_string, strlen(pw->passwd_string)); + + /* The I-beam + */ + if (pw->i_beam != 0) + { + x = (pw->passwd_field_x + pw->shadow_width + + string_width (pw->passwd_font, pw->passwd_string)); + y = pw->passwd_field_y + pw->shadow_width; + XDrawLine (si->dpy, si->passwd_dialog, gc1, + x, y, x, y + pw->passwd_font->ascent); + } -#else /* HAVE_MOTIF */ + pw->i_beam = (pw->i_beam + 1) % 4; - XtAddCallback (passwd_done, XmNactivateCallback, passwd_done_cb, 0); - XtAddCallback (passwd_cancel, XmNactivateCallback, passwd_cancel_cb, 0); - XtAddCallback (roger_label, XmNexposeCallback, roger, 0); -# ifdef VERIFY_CALLBACK_WORKS - XtAddCallback (passwd_text, XmNmodifyVerifyCallback, check_passwd_cb, 0); - XtAddCallback (passwd_text, XmNactivateCallback, check_passwd_cb, 0); -# else /* !VERIFY_CALLBACK_WORKS */ - XtAddCallback (passwd_text, XmNactivateCallback, passwd_done_cb, 0); - XtOverrideTranslations (passwd_text, XtParseTranslationTable (translations)); -# endif /* !VERIFY_CALLBACK_WORKS */ + /* the thermometer + */ + y = pw->thermo_field_height * (1.0 - pw->ratio); + if (y > 0) + { + XFillRectangle (si->dpy, si->passwd_dialog, gc2, + pw->thermo_field_x + 1, + pw->thermo_field_y + 1, + pw->thermo_width-2, + y); + XSetForeground (si->dpy, gc1, pw->logo_foreground); + XFillRectangle (si->dpy, si->passwd_dialog, gc1, + pw->thermo_field_x + 1, + pw->thermo_field_y + 1 + y, + pw->thermo_width-2, + MAX (0, pw->thermo_field_height - y - 2)); + } -# if defined(HAVE_MOTIF) && (XmVersion >= 1002) - /* The focus stuff changed around; this didn't exist in 1.1.5. */ - XtVaSetValues (passwd_form, XmNinitialFocus, passwd_text, 0); -# endif /* HAVE_MOTIF && XmVersion >= 1002 */ + XFreeGC (si->dpy, gc1); + XFreeGC (si->dpy, gc2); + XSync (si->dpy, False); +} - /* Another random thing necessary in 1.2.1 but not 1.1.5... */ - XtVaSetValues (roger_label, XmNborderWidth, 2, 0); -#endif /* HAVE_MOTIF */ +void +destroy_passwd_window (saver_info *si) +{ + passwd_dialog_data *pw = si->pw_data; + Screen *screen = si->default_screen->screen; + Colormap cmap = DefaultColormapOfScreen (screen); + Pixel black = BlackPixelOfScreen (screen); + Pixel white = WhitePixelOfScreen (screen); -#ifndef VMS - { - struct passwd *pw = getpwuid (getuid ()); - username = pw->pw_name; - } -#else /* VMS -- from "R.S.Niranjan" who says - that on OpenVMS 6.1, using `struct passwd' crashes... */ - username = getenv("USER"); -#endif /* VMS */ + if (pw->timer) + XtRemoveTimeOut (pw->timer); - format_into_label (passwd_label1, si->version); - format_into_label (passwd_label3, (username ? username : "???")); + if (si->passwd_dialog) + { + XDestroyWindow (si->dpy, si->passwd_dialog); + si->passwd_dialog = 0; + } + + if (pw->heading_label) free (pw->heading_label); + if (pw->body_label) free (pw->body_label); + if (pw->user_label) free (pw->user_label); + if (pw->passwd_label) free (pw->passwd_label); + + if (pw->heading_font) XFreeFont (si->dpy, pw->heading_font); + if (pw->body_font) XFreeFont (si->dpy, pw->body_font); + if (pw->label_font) XFreeFont (si->dpy, pw->label_font); + if (pw->passwd_font) XFreeFont (si->dpy, pw->passwd_font); + + if (pw->foreground != black && pw->foreground != white) + XFreeColors (si->dpy, cmap, &pw->foreground, 1, 0L); + if (pw->background != black && pw->background != white) + XFreeColors (si->dpy, cmap, &pw->background, 1, 0L); + if (pw->passwd_foreground != black && pw->passwd_foreground != white) + XFreeColors (si->dpy, cmap, &pw->passwd_foreground, 1, 0L); + if (pw->passwd_background != black && pw->passwd_background != white) + XFreeColors (si->dpy, cmap, &pw->passwd_background, 1, 0L); + if (pw->logo_foreground != black && pw->logo_foreground != white) + XFreeColors (si->dpy, cmap, &pw->logo_foreground, 1, 0L); + if (pw->logo_background != black && pw->logo_background != white) + XFreeColors (si->dpy, cmap, &pw->logo_background, 1, 0L); + if (pw->shadow_top != black && pw->shadow_top != white) + XFreeColors (si->dpy, cmap, &pw->shadow_top, 1, 0L); + if (pw->shadow_bottom != black && pw->shadow_bottom != white) + XFreeColors (si->dpy, cmap, &pw->shadow_bottom, 1, 0L); + + memset (pw, 0, sizeof(*pw)); + free (pw); + + si->pw_data = 0; } -static int passwd_idle_timer_tick = -1; -static XtIntervalId passwd_idle_id; + +/* Interactions + */ static void -passwd_idle_timer (XtPointer closure, XtIntervalId *id) +passwd_animate_timer (XtPointer closure, XtIntervalId *id) { saver_info *si = (saver_info *) closure; - saver_preferences *p = &si->prefs; - - Display *dpy = XtDisplay (passwd_form); -#ifdef HAVE_ATHENA - Window window = XtWindow (passwd_form); -#else /* MOTIF */ - Window window = XtWindow (XtParent(passwd_done)); -#endif /* MOTIF */ - static Dimension x, y, d, s, ss; - static GC gc = 0; - int max = p->passwd_timeout / 1000; + int tick = 166; + passwd_dialog_data *pw = si->pw_data; - idle_timer ((XtPointer) si, id); + if (!pw) return; - if (passwd_idle_timer_tick == max) /* first time */ + pw->ratio -= (1.0 / ((double) si->prefs.passwd_timeout / (double) tick)); + if (pw->ratio < 0) { - XGCValues gcv; -#ifdef HAVE_MOTIF - unsigned long fg = 0, bg = 0, ts = 0, bs = 0; - Dimension w = 0, h = 0; - XtVaGetValues(XtParent(passwd_done), - XmNwidth, &w, - 0); - XtVaGetValues(passwd_done, - XmNheight, &h, - XmNy, &y, - 0); - XtVaGetValues(passwd_form, - XtNforeground, &fg, - XtNbackground, &bg, - XmNtopShadowColor, &ts, - XmNbottomShadowColor, &bs, - 0); - - if (ts != bg && ts != fg) - fg = ts; - if (bs != bg && bs != fg) - fg = bs; - - d = h / 2; - if (d & 1) d++; - - x = (w / 2); - -# ifdef __sgi /* Kludge -- SGI's Motif hacks place buttons differently. */ - { - static int sgi_mode = -1; - if (sgi_mode == -1) - sgi_mode = get_boolean_resource("sgiMode", "sgiMode") ? 1 : 0; - - if (sgi_mode) - x = d; - } -# endif /* __sgi */ - - x -= d/2; - y += d/2; - -#else /* HAVE_ATHENA */ - - Arg av [100]; - int ac = 0; - unsigned long fg = 0, bg = 0; - XtSetArg (av [ac], XtNheight, &d); ac++; - XtGetValues (passwd_done, av, ac); - ac = 0; - XtSetArg (av [ac], XtNwidth, &x); ac++; - XtSetArg (av [ac], XtNheight, &y); ac++; - XtSetArg (av [ac], XtNforeground, &fg); ac++; - XtSetArg (av [ac], XtNbackground, &bg); ac++; - XtGetValues (passwd_form, av, ac); - x -= d; - y -= d; - d -= 4; - -#endif /* HAVE_ATHENA */ - - gcv.foreground = fg; - if (gc) XFreeGC (dpy, gc); - gc = XCreateGC (dpy, window, GCForeground, &gcv); - s = 360*64 / (passwd_idle_timer_tick - 1); - ss = 90*64; - XFillArc (dpy, window, gc, x, y, d, d, 0, 360*64); - XSetForeground (dpy, gc, bg); - x += 1; - y += 1; - d -= 2; + pw->ratio = 0; + if (pw->state == pw_read) + pw->state = pw_time; } - if (--passwd_idle_timer_tick) - { - passwd_idle_id = XtAppAddTimeOut (si->app, 1000, passwd_idle_timer, - (XtPointer) si); - XFillArc (dpy, window, gc, x, y, d, d, ss, s); - ss += s; - } + update_passwd_window (si, 0, pw->ratio); + + if (pw->state == pw_read) + pw->timer = XtAppAddTimeOut (si->app, tick, passwd_animate_timer, + (XtPointer) si); + else + pw->timer = 0; + + idle_timer ((XtPointer) si, id); } -static Bool -pop_passwd_dialog (saver_info *si) +static void +handle_passwd_key (saver_info *si, XKeyEvent *event) { - saver_preferences *p = &si->prefs; - saver_screen_info *ssi = si->default_screen; - Widget parent = ssi->toplevel_shell; - Display *dpy = XtDisplay (passwd_dialog); - Window focus; - int revert_to; + passwd_dialog_data *pw = si->pw_data; + int pw_size = sizeof (pw->typed_passwd) - 1; + char *typed_passwd = pw->typed_passwd; + char s[2]; + char *stars = 0; int i; - Window grab_window = RootWindowOfScreen(si->screens[0].screen); - - typed_passwd [0] = 0; - passwd_state = pw_read; - text_field_set_string (passwd_text, "", 0); - - /* In case one of the hacks has unmapped it temporarily... - Get that sucker on stage now! */ - for (i = 0; i < si->nscreens; i++) - XMapRaised(si->dpy, si->screens[i].screensaver_window); - - XGetInputFocus (dpy, &focus, &revert_to); -#if defined(HAVE_MOTIF) && !defined(DESTROY_WORKS) - /* This fucker blows up if we destroy the widget. I can't figure - out why. The second destroy phase dereferences freed memory... - So we just keep it around; but unrealizing or unmanaging it - doesn't work right either, so we hack the window directly. FMH. - */ - if (XtWindow (passwd_form)) - XMapRaised (dpy, XtWindow (passwd_dialog)); -#endif /* HAVE_MOTIF && !DESTROY_WORKS */ - - monitor_power_on (si); - pop_up_dialog_box (passwd_dialog, passwd_form, - /* for debugging -- don't ask */ - (si->prefs.debug_p ? 69 : 0) + - 2); - XtManageChild (passwd_form); - -#ifdef HAVE_ATHENA - steal_focus_and_colormap (passwd_text); - - /* For some reason, the passwd_form box is not stretching all the way - to the right edge of the window, despite being XtChainRight. - So... resize it by hand. - */ - { - Dimension x=0, w=0, h=0; - XtVaGetValues(passwd_form, XtNx, &x, XtNwidth, &w, XtNheight, &h, 0); - XtVaGetValues(XtParent(passwd_form), XtNwidth, &w, 0); - w -= x; - w -= 6; - if (w > 0) XtResizeWidget(passwd_form, w, h, 0); - } + int size = XLookupString (event, s, 1, 0, 0); + + if (size != 1) return; -#endif /* HAVE_ATHENA */ + s[1] = 0; + switch (*s) + { + case '\010': case '\177': /* Backspace */ + if (!*typed_passwd) + XBell (si->dpy, 0); + else + typed_passwd [strlen(typed_passwd)-1] = 0; + break; + + case '\025': case '\030': /* Erase line */ + memset (typed_passwd, 0, pw_size); + break; + + case '\012': case '\015': /* Enter */ + if (pw->state != pw_read) + ; /* already done? */ + else if (passwd_valid_p (typed_passwd)) + pw->state = pw_ok; + else + pw->state = pw_fail; + break; -#if defined(HAVE_MOTIF) && (XmVersion < 1002) - /* The focus stuff changed around; this causes problems in 1.2.1 - but is necessary in 1.1.5. */ - XmProcessTraversal (passwd_text, XmTRAVERSE_CURRENT); -#endif /* HAVE_MOTIF && XmVersion < 1002 */ + default: + i = strlen (typed_passwd); + if (i >= pw_size-1) + XBell (si->dpy, 0); + else + { + typed_passwd [i] = *s; + typed_passwd [i+1] = 0; + } + break; + } - passwd_idle_timer_tick = p->passwd_timeout / 1000; - passwd_idle_id = XtAppAddTimeOut (si->app, 1000, passwd_idle_timer, - (XtPointer) si); + i = strlen(typed_passwd); + stars = (char *) malloc(i+1); + memset (stars, '*', i); + stars[i] = 0; + update_passwd_window (si, stars, pw->ratio); + free (stars); +} -#ifdef HAVE_ATHENA - if (roger_label) - roger(roger_label, 0, 0); -#endif /* HAVE_ATHENA */ +static void +passwd_event_loop (saver_info *si) +{ + char *msg = 0; + XEvent event; + passwd_animate_timer ((XtPointer) si, 0); - /* Make sure the mouse cursor is visible. - Since the screensaver was already active, we had already called - grab_keyboard_and_mouse() with our "invisible" Cursor object. - Now we need to change that. (cursor == 0 means "server default - cursor.") - */ - if (grab_window != si->mouse_grab_window || - grab_window != si->keyboard_grab_window) - fprintf(stderr, - "%s: WARNING: expected mouse and keyboard grabs on 0x%x,\n" - "\tbut mouse-grab is 0x%x and keyboard-grab is 0x%x.\n", - blurb(), - (unsigned long) grab_window, - (unsigned long) si->mouse_grab_window, - (unsigned long) si->keyboard_grab_window); - - if (p->verbose_p) - fprintf(stderr, "%s: re-grabbing keyboard and mouse to expose cursor.\n", - blurb()); - grab_keyboard_and_mouse (si, grab_window, 0); - - - if (!si->prefs.debug_p) - XGrabServer (dpy); /* ############ DANGER! */ - - while (passwd_state == pw_read) + while (si->pw_data && si->pw_data->state == pw_read) { - XEvent event; XtAppNextEvent (si->app, &event); - /* wait for timer event */ - if (event.xany.type == 0 && passwd_idle_timer_tick == 0) - passwd_state = pw_time; - XtDispatchEvent (&event); + if (event.xany.window == si->passwd_dialog && event.xany.type == Expose) + draw_passwd_window (si); + else if (event.xany.type == KeyPress) + handle_passwd_key (si, &event.xkey); + else + XtDispatchEvent (&event); } - XUngrabServer (dpy); - XSync (dpy, False); /* ###### (danger over) */ - - - /* Now turn off the mouse cursor again. - */ - if (p->verbose_p) - fprintf(stderr, "%s: re-grabbing keyboard and mouse to hide cursor.\n", - blurb()); - grab_keyboard_and_mouse (si, grab_window, si->screens[0].cursor); - - if (passwd_state != pw_time) - XtRemoveTimeOut (passwd_idle_id); - - if (passwd_state != pw_ok) + switch (si->pw_data->state) { - char *lose; - switch (passwd_state) - { - case pw_time: lose = "Timed out!"; break; - case pw_fail: lose = "Sorry!"; break; - case pw_cancel: lose = 0; break; - default: abort (); - } - -#ifdef HAVE_MOTIF - XmProcessTraversal (passwd_cancel, 0); /* turn off I-beam */ -#else /* HAVE_ATHENA */ - steal_focus_and_colormap (passwd_done); -#endif /* HAVE_ATHENA */ - - if (lose) - { - text_field_set_string (passwd_text, lose, strlen (lose) + 1); - - passwd_idle_timer_tick = 1; - passwd_idle_id = XtAppAddTimeOut (si->app, 3000, passwd_idle_timer, - (XtPointer) si); - while (1) - { - XEvent event; - XtAppNextEvent (si->app, &event); - if (event.xany.type == 0 && /* wait for timer event */ - passwd_idle_timer_tick == 0) - break; - XtDispatchEvent (&event); - } - } + case pw_ok: msg = 0; break; + case pw_time: msg = "Timed out!"; break; + default: msg = "Sorry!"; break; } - memset (typed_passwd, 0, sizeof(typed_passwd)); - text_field_set_string (passwd_text, "", 0); - XtSetKeyboardFocus (parent, None); - -#ifdef DESTROY_WORKS - XtDestroyWidget (passwd_dialog); - passwd_dialog = 0; -#else /* !DESTROY_WORKS */ - XUnmapWindow (XtDisplay (passwd_dialog), XtWindow (passwd_dialog)); -#endif /* !DESTROY_WORKS */ - { - XErrorHandler old_handler = XSetErrorHandler (BadWindow_ehandler); - /* I don't understand why this doesn't refocus on the old selected - window when MWM is running in click-to-type mode. The value of - `focus' seems to be correct. */ - XSetInputFocus (dpy, focus, revert_to, CurrentTime); - XSync (dpy, False); - XSetErrorHandler (old_handler); - } - /* Since we installed our colormap to display the dialog properly, put - the old one back, so that the screensaver_window is now displayed - properly. */ - for (i = 0; i < si->nscreens; i++) + if (msg) { - saver_screen_info *ssi = &si->screens[i]; - if (ssi->cmap) - XInstallColormap (si->dpy, ssi->cmap); - } + si->pw_data->i_beam = 0; + update_passwd_window (si, msg, 0.0); + XBell (si->dpy, False); + XSync (si->dpy, False); + sleep (1); - return (passwd_state == pw_ok ? True : False); + /* Swallow all pending KeyPress/KeyRelease events. */ + { + XEvent e; + while (XCheckMaskEvent (si->dpy, KeyPressMask|KeyReleaseMask, &e)) + ; + } + } } Bool unlock_p (saver_info *si) { - static Bool initted = False; - if (! initted) - { + Screen *screen = si->default_screen->screen; + Colormap cmap = DefaultColormapOfScreen (screen); + Bool status; -#ifndef VERIFY_CALLBACK_WORKS - XtAppAddActions (si->app, actions, XtNumber (actions)); -#endif /* !VERIFY_CALLBACK_WORKS */ + if (si->pw_data || si->passwd_dialog) + destroy_passwd_window (si); - passwd_dialog = 0; - initted = True; - } - if (! passwd_dialog) - make_passwd_dialog (si); - return pop_passwd_dialog (si); + make_passwd_window (si); + if (cmap) XInstallColormap (si->dpy, cmap); + + passwd_event_loop (si); + + status = (si->pw_data->state == pw_ok); + destroy_passwd_window (si); + + cmap = si->default_screen->cmap; + if (cmap) XInstallColormap (si->dpy, cmap); + + return status; } #endif /* !NO_LOCKING -- whole file */ diff --git a/driver/passwd.c b/driver/passwd.c index d331b3bb..2b2eadbb 100644 --- a/driver/passwd.c +++ b/driver/passwd.c @@ -21,6 +21,10 @@ # include #endif +#ifdef HAVE_CRYPT_H +# include +#endif + #include #include #include @@ -88,7 +92,7 @@ #define False 0 -extern char *progname; +extern const char *blurb(void); static char *encrypted_root_passwd = 0; static char *encrypted_user_passwd = 0; @@ -179,7 +183,7 @@ get_encrypted_passwd(const char *user) /* This has to be called before we've changed our effective user ID, - because it might need priveleges to get at the encrypted passwords. + because it might need privileges to get at the encrypted passwords. Returns false if we weren't able to get any passwords, and therefore, locking isn't possible. (It will also have written to stderr.) */ diff --git a/driver/setuid.c b/driver/setuid.c index 87bb4c3a..399f7df0 100644 --- a/driver/setuid.c +++ b/driver/setuid.c @@ -1,4 +1,4 @@ -/* setuid.c --- management of runtime priveleges. +/* setuid.c --- management of runtime privileges. * xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its @@ -62,9 +62,12 @@ describe_uids (saver_info *si, FILE *out) char *s1 = strdup (uid_gid_string (uid, gid)); char *s2 = strdup (uid_gid_string (euid, egid)); - if (si->orig_uid && *si->orig_uid) + if (si->orig_uid && *si->orig_uid && + (!!strcmp (si->orig_uid, s1) || + !!strcmp (si->orig_uid, s2))) fprintf (out, "%s: initial effective uid/gid was %s\n", blurb(), si->orig_uid); + fprintf (out, "%s: running as %s", blurb(), s1); if (uid != euid || gid != egid) fprintf (out, "; effectively %s", s2); @@ -74,6 +77,114 @@ describe_uids (saver_info *si, FILE *out) } +static int +set_ids_by_name (struct passwd *p, struct group *g, char **message_ret) +{ + int uid_errno = 0; + int gid_errno = 0; + uid_t uid = p->pw_uid; + gid_t gid = g->gr_gid; + + if (message_ret) + *message_ret = 0; + + /* Rumor has it that some implementations of of setuid() do nothing + when called with -1; therefore, if the "nobody" user has a uid of + -1, then that would be Really Bad. Rumor further has it that such + systems really ought to be using -2 for "nobody", since that works. + So, if we get a uid (or gid, for good measure) of -1, switch to -2 + instead. + */ + if (gid == (gid_t) -1) gid = (gid_t) -2; + if (uid == (uid_t) -1) uid = (uid_t) -2; + + errno = 0; + if (setgid (gid) != 0) + gid_errno = errno ? errno : -1; + + errno = 0; + if (setuid (uid) != 0) + uid_errno = errno ? errno : -1; + + if (uid_errno == 0 && gid_errno == 0) + { + static char buf [1024]; + sprintf (buf, "changed uid/gid to %s/%s (%ld/%ld).", + p->pw_name, (g ? g->gr_name : "???"), + (long) uid, (long) gid); + if (message_ret) + *message_ret = buf; + return 0; + } + else + { + char buf [1024]; + if (gid_errno) + { + sprintf (buf, "%s: couldn't set gid to %s (%ld)", + blurb(), + (g ? g->gr_name : "???"), + (long) gid); + if (gid_errno == -1) + fprintf(stderr, "%s: unknown error\n", buf); + else + perror(buf); + } + + if (uid_errno) + { + sprintf (buf, "%s: couldn't set uid to %s (%ld)", + blurb(), + (p ? p->pw_name : "???"), + (long) uid); + if (uid_errno == -1) + fprintf(stderr, "%s: unknown error\n", buf); + else + perror(buf); + } + + return -1; + } +} + +static int +set_ids_by_number (uid_t uid, gid_t gid, char **message_ret) +{ + struct passwd *p; + struct group *g; + + errno = 0; + p = getpwuid (uid); + if (!p) + { + char buf [1024]; + sprintf (buf, "%s: error looking up name of user %d", blurb(), + (long) uid); + if (errno) + perror (buf); + else + fprintf (stderr, "%s: unknown error.\n", buf); + return -1; + } + + errno = 0; + g = getgrgid (gid); + if (!g) + { + char buf [1024]; + sprintf (buf, "%s: error looking up name of group %d", blurb(), + (long) gid); + if (errno) + perror (buf); + else + fprintf (stderr, "%s: unknown error.\n", buf); + return -1; + } + + return set_ids_by_name (p, g, message_ret); +} + + /* If we've been run as setuid or setgid to someone else (most likely root) turn off the extra permissions so that random user-specified programs don't get special privileges. (On some systems it is necessary to install @@ -83,26 +194,43 @@ describe_uids (saver_info *si, FILE *out) void hack_uid (saver_info *si) { - si->orig_uid = strdup (uid_gid_string (geteuid(), getegid())); - setgid (getgid ()); - setuid (getuid ()); + /* Discard privileges, and set the effective user/group ids to the + real user/group ids. That is, give up our "chmod +s" rights. + */ + { + uid_t euid = geteuid(); + gid_t egid = getegid(); + uid_t uid = getuid(); + gid_t gid = getgid(); + + si->orig_uid = strdup (uid_gid_string (euid, egid)); + + if (uid != euid || gid != egid) + if (set_ids_by_number (uid, gid, &si->uid_message) != 0) + saver_exit (si, 1, 0); + } - /* If we're being run as root (as from xdm) then switch the user id - to something safe. */ - if (getuid () == 0) + /* Locking can't work when running as root, because we have no way of + knowing what the user id of the logged in user is (so we don't know + whose password to prompt for.) + */ + if (getuid() == (uid_t) 0) { - struct passwd *p = 0; - struct group *g = 0; - int uid_errno = 0; - int gid_errno = 0; - - /* Locking can't work when running as root, because we have no way of - knowing what the user id of the logged in user is (so we don't know - whose password to prompt for.) - */ si->locking_disabled_p = True; si->nolock_reason = "running as root"; + } + + /* If we're running as root, switch to a safer user. This is above and + beyond the fact that we've disabling locking, above -- the theory is + that running graphics demos as root is just always a stupid thing + to do, since they have probably never been security reviewed and are + more likely to be buggy than just about any other kind of program. + */ + if (getuid() == (uid_t) 0) + { + struct passwd *p; + p = getpwnam ("nobody"); if (! p) p = getpwnam ("noaccess"); if (! p) p = getpwnam ("daemon"); @@ -114,102 +242,55 @@ hack_uid (saver_info *si) saver_exit(si, 1, 0); } - g = getgrgid (p->pw_gid); - - /* Rumor has it that some implementations of of setuid() do nothing - when called with -1; therefore, if the "nobody" user has a uid of - -1, then that would be Really Bad. Rumor further has it that such - systems really ought to be using -2 for "nobody", since that works. - So, if we get a uid (or gid, for good measure) of -1, switch to -2 - instead. - */ - - if (p->pw_gid == -1) p->pw_gid = -2; - if (p->pw_uid == -1) p->pw_uid = -2; + if (set_ids_by_number (p->pw_uid, p->pw_gid, &si->uid_message) != 0) + saver_exit (si, -1, 0); + } - /* Change the gid to be a safe one, then change the uid to be a safe - one (must do it in this order, because root privs vanish when uid - is changed, and after that, gid can't be changed.) - */ - if (setgid (p->pw_gid) != 0) - gid_errno = errno ? errno : -1; - if (setuid (p->pw_uid) != 0) - uid_errno = errno ? errno : -1; + /* If there's anything even remotely funny looking about the passwd struct, + or if we're running as some other user from the list below (a + non-comprehensive selection of users known to be privileged in some way, + and not normal end-users) then disable locking. If it was possible, + switching to "nobody" would be the thing to do, but only root itself has + the privs to do that. + */ + { + uid_t uid = getuid (); /* get it again */ + struct passwd *p = getpwuid (uid); /* get it again */ - if (uid_errno == 0 && gid_errno == 0) - { - static char buf [1024]; - sprintf (buf, "changed uid/gid to %s/%s (%ld/%ld).", - p->pw_name, (g ? g->gr_name : "???"), - (long) p->pw_uid, (long) p->pw_gid); - si->uid_message = buf; - } - else - { - char buf [1024]; - if (gid_errno) - { - sprintf (buf, "%s: couldn't set gid to %s (%ld)", - blurb(), - (g ? g->gr_name : "???"), - (long) p->pw_gid); - if (gid_errno == -1) - fprintf(stderr, "%s: unknown error\n", buf); - else - perror(buf); - } - - if (uid_errno) - { - sprintf (buf, "%s: couldn't set uid to %s (%ld)", - blurb(), - (p ? p->pw_name : "???"), - (long) p->pw_uid); - if (uid_errno == -1) - fprintf(stderr, "%s: unknown error\n", buf); - else - perror(buf); - } - } - - if (uid_errno != 0) - { - /* We'd better exit rather than continue running as root. - But if we switched uid but not gid, continue running, - since that doesn't really matter. (Right?) - */ - saver_exit (si, -1, 0); - } - } -# ifndef NO_LOCKING - else /* disable locking if already being run as "someone else" */ - { - struct passwd *p = getpwuid (getuid ()); - if (!p || - !strcmp (p->pw_name, "root") || - !strcmp (p->pw_name, "nobody") || - !strcmp (p->pw_name, "noaccess") || - !strcmp (p->pw_name, "operator") || - !strcmp (p->pw_name, "daemon") || - !strcmp (p->pw_name, "bin") || - !strcmp (p->pw_name, "adm") || - !strcmp (p->pw_name, "sys") || - !strcmp (p->pw_name, "games")) - { - static char buf [1024]; - sprintf (buf, "running as %s", p->pw_name); - si->nolock_reason = buf; - si->locking_disabled_p = True; - } - } -# endif /* !NO_LOCKING */ + if (!p || + uid == (uid_t) 0 || + uid == (uid_t) -1 || + uid == (uid_t) -2 || + p->pw_uid == (uid_t) 0 || + p->pw_uid == (uid_t) -1 || + p->pw_uid == (uid_t) -2 || + !p->pw_name || + !*p->pw_name || + !strcmp (p->pw_name, "root") || + !strcmp (p->pw_name, "nobody") || + !strcmp (p->pw_name, "noaccess") || + !strcmp (p->pw_name, "operator") || + !strcmp (p->pw_name, "daemon") || + !strcmp (p->pw_name, "bin") || + !strcmp (p->pw_name, "adm") || + !strcmp (p->pw_name, "sys") || + !strcmp (p->pw_name, "games")) + { + static char buf [1024]; + sprintf (buf, "running as %s", + (p && p->pw_name && *p->pw_name + ? p->pw_name : "")); + si->nolock_reason = buf; + si->locking_disabled_p = True; + si->dangerous_uid_p = True; + } + } } #else /* !NO_SETUID */ void hack_uid (saver_info *si) { } -void hack_uid_warn (saver_info *si) { } -void describe_uids (saver_info *si) { } +void describe_uids (saver_info *si, FILE *out) { } #endif /* NO_SETUID */ diff --git a/driver/splash.c b/driver/splash.c index 630c44d7..e715f4fc 100644 --- a/driver/splash.c +++ b/driver/splash.c @@ -14,92 +14,83 @@ #endif #include -#include - -#ifdef HAVE_MOTIF -# include - -#else /* HAVE_ATHENA */ -# include -# include -# include -# include -# include -#endif /* HAVE_ATHENA */ #include "xscreensaver.h" -#include "visual.h" -#include -#include -#include +#include "resources.h" -extern void skull (Display *, Window, GC, GC, int, int, int, int); +#undef MAX +#define MAX(a,b) ((a)>(b)?(a):(b)) void -roger (Widget button, XtPointer client_data, XtPointer call_data) +draw_shaded_rectangle (Display *dpy, Window window, + int x, int y, + int width, int height, + int thickness, + unsigned long top_color, + unsigned long bottom_color) { - Display *dpy = XtDisplay (button); - Screen *screen = XtScreen (button); - Window window = XtWindow (button); - Arg av [10]; - int ac = 0; + XPoint points[4]; XGCValues gcv; - Colormap cmap; - GC draw_gc, erase_gc; - unsigned int fg, bg; - int x, y, size; - XWindowAttributes xgwa; - XGetWindowAttributes (dpy, window, &xgwa); - cmap = xgwa.colormap; - if (xgwa.width > xgwa.height) size = xgwa.height; - else size = xgwa.width; - if (size > 40) size -= 30; - x = (xgwa.width - size) / 2; - y = (xgwa.height - size) / 2; - XtSetArg (av [ac], XtNforeground, &fg); ac++; - XtSetArg (av [ac], XtNbackground, &bg); ac++; - XtGetValues (button, av, ac); - /* if it's black on white, swap it cause it looks better (hack hack) */ - if (fg == BlackPixelOfScreen (screen) && bg == WhitePixelOfScreen (screen)) - fg = WhitePixelOfScreen (screen), bg = BlackPixelOfScreen (screen); - gcv.foreground = bg; - erase_gc = XCreateGC (dpy, window, GCForeground, &gcv); - gcv.foreground = fg; - draw_gc = XCreateGC (dpy, window, GCForeground, &gcv); - XFillRectangle (dpy, window, erase_gc, 0, 0, xgwa.width, xgwa.height); - skull (dpy, window, draw_gc, erase_gc, x, y, size, size); - XFreeGC (dpy, draw_gc); - XFreeGC (dpy, erase_gc); + GC gc1, gc2; + if (thickness == 0) return; + + gcv.foreground = top_color; + gc1 = XCreateGC (dpy, window, GCForeground, &gcv); + gcv.foreground = bottom_color; + gc2 = XCreateGC (dpy, window, GCForeground, &gcv); + + points [0].x = x; + points [0].y = y; + points [1].x = x + width; + points [1].y = y; + points [2].x = x + width - thickness; + points [2].y = y + thickness; + points [3].x = x; + points [3].y = y + thickness; + XFillPolygon (dpy, window, gc1, points, 4, Convex, CoordModeOrigin); + + points [0].x = x; + points [0].y = y + thickness; + points [1].x = x; + points [1].y = y + height; + points [2].x = x + thickness; + points [2].y = y + height - thickness; + points [3].x = x + thickness; + points [3].y = y + thickness; + XFillPolygon (dpy, window, gc1, points, 4, Convex, CoordModeOrigin); + + points [0].x = x + width; + points [0].y = y; + points [1].x = x + width - thickness; + points [1].y = y + thickness; + points [2].x = x + width - thickness; + points [2].y = y + height - thickness; + points [3].x = x + width; + points [3].y = y + height - thickness; + XFillPolygon (dpy, window, gc2, points, 4, Convex, CoordModeOrigin); + + points [0].x = x; + points [0].y = y + height; + points [1].x = x + width; + points [1].y = y + height; + points [2].x = x + width; + points [2].y = y + height - thickness; + points [3].x = x + thickness; + points [3].y = y + height - thickness; + XFillPolygon (dpy, window, gc2, points, 4, Convex, CoordModeOrigin); + + XFreeGC (dpy, gc1); + XFreeGC (dpy, gc2); } -static Widget splash_shell; -extern Widget splash_dialog; -extern Widget splash_form; -extern Widget splash_roger_label; -extern Widget splash_label1; -extern Widget splash_label3; -extern Widget splash_demo; -extern Widget splash_prefs; -extern Widget splash_help; - -static void -splash_sink(saver_info *si) -{ - if (si->splash_dialog) - { - XtDestroyWidget(si->splash_dialog); - XtDestroyWidget(splash_shell); - si->splash_dialog = 0; - splash_shell = 0; - } -} - -static void -splash_sink_timer (XtPointer closure, XtIntervalId *id) +int +string_width (XFontStruct *font, char *s) { - saver_info *si = (saver_info *) closure; - splash_sink(si); + int direction, ascent, descent; + XCharStruct overall; + XTextExtents (font, s, strlen(s), &direction, &ascent, &descent, &overall); + return overall.width; } @@ -114,132 +105,597 @@ send_self_clientmessage (saver_info *si, Atom command) event.xclient.window = window; event.xclient.message_type = XA_SCREENSAVER; event.xclient.format = 32; + memset (&event.xclient.data, 0, sizeof(event.xclient.data)); event.xclient.data.l[0] = (long) command; if (! XSendEvent (dpy, window, False, 0L, &event)) fprintf (stderr, "%s: XSendEvent(dpy, 0x%x ...) failed.\n", progname, (unsigned int) window); } -static void -splash_demo_cb (Widget button, XtPointer client_data, XtPointer call_data) -{ - saver_info *si = (saver_info *) client_data; - splash_sink(si); - send_self_clientmessage (si, XA_DEMO); -} static void -splash_prefs_cb (Widget button, XtPointer client_data, XtPointer call_data) +get_help (saver_info *si) { - saver_info *si = (saver_info *) client_data; - splash_sink(si); - send_self_clientmessage (si, XA_PREFS); -} - -static void -splash_help_cb (Widget button, XtPointer client_data, XtPointer call_data) -{ - saver_info *si = (saver_info *) client_data; saver_preferences *p = &si->prefs; - splash_sink(si); - if (!p->help_url || !*p->help_url) - fprintf(stderr, "%s: no Help URL has been specified.\n"); + fprintf (stderr, "%s: no Help URL has been specified.\n", blurb()); else if (!p->load_url_command || !*p->load_url_command) - fprintf(stderr, "%s: no URL-loading command has been specified.\n"); + fprintf (stderr, "%s: no URL-loading command has been specified.\n", + blurb()); else { char *buf = (char *) malloc (strlen(p->load_url_command) + (strlen(p->help_url) * 2) + 10); - sprintf(buf, p->load_url_command, p->help_url, p->help_url); - system(buf); + sprintf (buf, p->load_url_command, p->help_url, p->help_url); + system (buf); } } -static void +static void update_splash_window (saver_info *si); +static void draw_splash_window (saver_info *si); +static void destroy_splash_window (saver_info *si); +static void unsplash_timer (XtPointer closure, XtIntervalId *id); + + +struct splash_dialog_data { + XtIntervalId timer; + + Dimension width; + Dimension height; + + char *heading_label; + char *body_label; + char *body2_label; + char *demo_label; + char *prefs_label; + char *help_label; + + XFontStruct *heading_font; + XFontStruct *body_font; + XFontStruct *button_font; + + Pixel foreground; + Pixel background; + Pixel button_foreground; + Pixel button_background; + Pixel logo_foreground; + Pixel logo_background; + Pixel shadow_top; + Pixel shadow_bottom; + + Dimension logo_width; + Dimension logo_height; + Dimension internal_border; + Dimension shadow_width; + + Dimension button_width, button_height; + Dimension demo_button_x, demo_button_y; + Dimension prefs_button_x, prefs_button_y; + Dimension help_button_x, help_button_y; + + int pressed; +}; + + +void make_splash_dialog (saver_info *si) { - saver_screen_info *ssi = si->default_screen; - Visual *v = DefaultVisualOfScreen(ssi->screen); + int x, y, bw; + XSetWindowAttributes attrs; + unsigned long attrmask = 0; + splash_dialog_data *sp; + Screen *screen = si->default_screen->screen; + Colormap cmap = DefaultColormapOfScreen (screen); + char *f; + + if (si->sp_data) + return; + if (si->prefs.splash_duration <= 0) + return; - /* The splash dialog must always be created on the default visual and - with the default colormap, so that it shows up in the right colors - when viewed along with the rest of the desktop. The other xscreensaver - dialogs don't have this constraint, since they are only seen when the - blackout window is also exposed. + sp = (splash_dialog_data *) calloc (1, sizeof(*sp)); + + sp->heading_label = get_string_resource ("splash.heading.label", + "Dialog.Label.Label"); + sp->body_label = get_string_resource ("splash.body.label", + "Dialog.Label.Label"); + sp->body2_label = get_string_resource ("splash.body2.label", + "Dialog.Label.Label"); + sp->demo_label = get_string_resource ("splash.demo.label", + "Dialog.Button.Label"); + sp->prefs_label = get_string_resource ("splash.prefs.label", + "Dialog.Button.Label"); + sp->help_label = get_string_resource ("splash.help.label", + "Dialog.Button.Label"); + + if (!sp->heading_label) + sp->heading_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY"); + if (!sp->body_label) + sp->body_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY"); + if (!sp->body2_label) + sp->body2_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY"); + if (!sp->demo_label) sp->demo_label = strdup("ERROR"); + if (!sp->prefs_label) sp->prefs_label = strdup("ERROR"); + if (!sp->help_label) sp->help_label = strdup("ERROR"); + + /* Put the version number in the label. */ + { + char *s = (char *) malloc (strlen(sp->heading_label) + 20); + sprintf(s, sp->heading_label, si->version); + free (sp->heading_label); + sp->heading_label = s; + } + + f = get_string_resource ("splash.headingFont", "Dialog.Font"); + sp->heading_font = XLoadQueryFont (si->dpy, (f ? f : "fixed")); + if (!sp->heading_font) sp->heading_font = XLoadQueryFont (si->dpy, "fixed"); + if (f) free (f); + + f = get_string_resource("splash.bodyFont", "Dialog.Font"); + sp->body_font = XLoadQueryFont (si->dpy, (f ? f : "fixed")); + if (!sp->body_font) sp->body_font = XLoadQueryFont (si->dpy, "fixed"); + if (f) free (f); + + f = get_string_resource("splash.buttonFont", "Dialog.Font"); + sp->button_font = XLoadQueryFont (si->dpy, (f ? f : "fixed")); + if (!sp->button_font) sp->button_font = XLoadQueryFont (si->dpy, "fixed"); + if (f) free (f); + + sp->foreground = get_pixel_resource ("splash.foreground", + "Dialog.Foreground", + si->dpy, cmap); + sp->background = get_pixel_resource ("splash.background", + "Dialog.Background", + si->dpy, cmap); + + if (sp->foreground == sp->background) + { + /* Make sure the error messages show up. */ + sp->foreground = BlackPixelOfScreen (screen); + sp->background = WhitePixelOfScreen (screen); + } + + sp->button_foreground = get_pixel_resource ("splash.Button.foreground", + "Dialog.Button.Foreground", + si->dpy, cmap); + sp->button_background = get_pixel_resource ("splash.Button.background", + "Dialog.Button.Background", + si->dpy, cmap); + sp->logo_foreground = get_pixel_resource ("splash.logo.foreground", + "Dialog.Logo.Foreground", + si->dpy, cmap); + sp->logo_background = get_pixel_resource ("splash.logo.background", + "Dialog.Logo.Background", + si->dpy, cmap); + sp->shadow_top = get_pixel_resource ("splash.topShadowColor", + "Dialog.Foreground", + si->dpy, cmap); + sp->shadow_bottom = get_pixel_resource ("splash.bottomShadowColor", + "Dialog.Background", + si->dpy, cmap); + + sp->logo_width = get_integer_resource ("splash.logo.width", + "Dialog.Logo.Width"); + sp->logo_height = get_integer_resource ("splash.logo.height", + "Dialog.Logo.Height"); + sp->internal_border = get_integer_resource ("splash.internalBorderWidth", + "Dialog.InternalBorderWidth"); + sp->shadow_width = get_integer_resource ("splash.shadowThickness", + "Dialog.ShadowThickness"); + + if (sp->logo_width == 0) sp->logo_width = 150; + if (sp->logo_height == 0) sp->logo_height = 150; + if (sp->internal_border == 0) sp->internal_border = 15; + if (sp->shadow_width == 0) sp->shadow_width = 4; + + { + int direction, ascent, descent; + XCharStruct overall; + + sp->width = 0; + sp->height = 0; + + /* Measure the heading_label. */ + XTextExtents (sp->heading_font, + sp->heading_label, strlen(sp->heading_label), + &direction, &ascent, &descent, &overall); + if (overall.width > sp->width) sp->width = overall.width; + sp->height += ascent + descent; + + /* Measure the body_label. */ + XTextExtents (sp->body_font, + sp->body_label, strlen(sp->body_label), + &direction, &ascent, &descent, &overall); + if (overall.width > sp->width) sp->width = overall.width; + sp->height += ascent + descent; + + /* Measure the body2_label. */ + XTextExtents (sp->body_font, + sp->body2_label, strlen(sp->body2_label), + &direction, &ascent, &descent, &overall); + if (overall.width > sp->width) sp->width = overall.width; + sp->height += ascent + descent; + + { + Dimension w2 = 0, w3 = 0, w4 = 0; + Dimension h2 = 0, h3 = 0, h4 = 0; + + /* Measure the Demo button. */ + XTextExtents (sp->button_font, + sp->demo_label, strlen(sp->demo_label), + &direction, &ascent, &descent, &overall); + w2 = overall.width; + h2 = ascent + descent; + + /* Measure the Prefs button. */ + XTextExtents (sp->button_font, + sp->prefs_label, strlen(sp->prefs_label), + &direction, &ascent, &descent, &overall); + w3 = overall.width; + h3 = ascent + descent; + + /* Measure the Help button. */ + XTextExtents (sp->button_font, + sp->help_label, strlen(sp->help_label), + &direction, &ascent, &descent, &overall); + w4 = overall.width; + h4 = ascent + descent; + + w2 = MAX(w2, w3); w2 = MAX(w2, w4); + h2 = MAX(h2, h3); h2 = MAX(h2, h4); + + w2 += ((ascent + descent) / 2) + (sp->shadow_width * 2); + h2 += ((ascent + descent) / 2) + (sp->shadow_width * 2); + + sp->button_width = w2; + sp->button_height = h2; + + w2 *= 3; + + w2 += ((ascent + descent) * 2); /* for space between buttons */ + + if (w2 > sp->width) sp->width = w2; + sp->height += h2; + } + + sp->width += (sp->internal_border * 2); + sp->height += (sp->internal_border * 3); + + if (sp->logo_height > sp->height) + sp->height = sp->logo_height; + else if (sp->height > sp->logo_height) + sp->logo_height = sp->height; + + sp->logo_width = sp->logo_height; + + sp->width += sp->logo_width; + } + + attrmask |= CWOverrideRedirect; attrs.override_redirect = True; + attrmask |= CWEventMask; + attrs.event_mask = (ExposureMask | ButtonPressMask | ButtonReleaseMask); - To accomplish this, we need our own ApplicationShell, since the shell - in si->default_screen->toplevel_shell might have a non-default visual. - */ - splash_shell = XtVaAppCreateShell (progname, progclass, - applicationShellWidgetClass, - si->dpy, - XtNscreen, ssi->screen, - XtNvisual, v, - XtNdepth, visual_depth(ssi->screen, v), - 0); - - create_splash_dialog (splash_shell, v, - DefaultColormapOfScreen (ssi->screen)); - si->splash_dialog = splash_dialog; /* gaaah... */ - -#ifdef HAVE_ATHENA - XawDialogAddButton(splash_form,"demo", splash_demo_cb, si); - XawDialogAddButton(splash_form,"prefs", splash_prefs_cb, si); - XawDialogAddButton(splash_form,"help", splash_help_cb, si); - splash_demo = XtNameToWidget(splash_form,"demo"); - splash_prefs = XtNameToWidget(splash_form,"prefs"); - splash_help = XtNameToWidget(splash_form,"help"); - - /* Lose the label on the inner dialog. */ { - Widget w = XtNameToWidget(splash_form, "label"); - if (w) XtUnmanageChild(w); + Dimension w = WidthOfScreen(screen); + Dimension h = HeightOfScreen(screen); + if (si->prefs.debug_p) w /= 2; + x = ((w + sp->width) / 2) - sp->width; + y = ((h + sp->height) / 2) - sp->height; + if (x < 0) x = 0; + if (y < 0) y = 0; } -#else /* HAVE_MOTIF */ - /* Another random thing necessary in 1.2.1 but not 1.1.5... */ - XtVaSetValues (splash_roger_label, XmNborderWidth, 1, 0); + bw = get_integer_resource ("splash.borderWidth", "Dialog.BorderWidth"); - XtAddCallback (splash_demo, XmNactivateCallback, splash_demo_cb, si); - XtAddCallback (splash_prefs, XmNactivateCallback, splash_prefs_cb, si); - XtAddCallback (splash_help, XmNactivateCallback, splash_help_cb, si); - XtAddCallback (splash_roger_label, XmNexposeCallback, roger, si); + si->splash_dialog = + XCreateWindow (si->dpy, + RootWindowOfScreen(screen), + x, y, sp->width, sp->height, bw, + DefaultDepthOfScreen (screen), InputOutput, + DefaultVisualOfScreen(screen), + attrmask, &attrs); + XSetWindowBackground (si->dpy, si->splash_dialog, sp->background); -#endif /* HAVE_MOTIF */ + XMapRaised (si->dpy, si->splash_dialog); + XSync (si->dpy, False); - format_into_label (splash_label1, si->version); + si->sp_data = sp; - XtRealizeWidget(splash_dialog); + sp->timer = XtAppAddTimeOut (si->app, si->prefs.splash_duration, + unsplash_timer, (XtPointer) si); + + draw_splash_window (si); + XSync (si->dpy, False); } -void -pop_splash_dialog (saver_info *si) +static void +draw_splash_window (saver_info *si) { - XtIntervalId splash_sink_id; + splash_dialog_data *sp = si->sp_data; + XGCValues gcv; + GC gc1, gc2; + int hspacing, vspacing, height; + int x1, x2, x3, y1, y2; + int sw; + + height = (sp->heading_font->ascent + sp->heading_font->descent + + sp->body_font->ascent + sp->body_font->descent + + sp->body_font->ascent + sp->body_font->descent + + sp->button_font->ascent + sp->button_font->descent); + vspacing = ((sp->height + - (4 * sp->shadow_width) + - (2 * sp->internal_border) + - height) / 5); + if (vspacing < 0) vspacing = 0; + if (vspacing > (sp->heading_font->ascent * 2)) + vspacing = (sp->heading_font->ascent * 2); + + gcv.foreground = sp->foreground; + gc1 = XCreateGC (si->dpy, si->splash_dialog, GCForeground, &gcv); + gc2 = XCreateGC (si->dpy, si->splash_dialog, GCForeground, &gcv); + x1 = sp->logo_width; + x3 = sp->width - (sp->shadow_width * 2); + y1 = sp->internal_border; + + /* top heading + */ + XSetFont (si->dpy, gc1, sp->heading_font->fid); + sw = string_width (sp->heading_font, sp->heading_label); + x2 = (x1 + ((x3 - x1 - sw) / 2)); + y1 += sp->heading_font->ascent; + XDrawString (si->dpy, si->splash_dialog, gc1, x2, y1, + sp->heading_label, strlen(sp->heading_label)); + y1 += sp->heading_font->descent; + + /* text below top heading + */ + XSetFont (si->dpy, gc1, sp->body_font->fid); + y1 += vspacing + sp->body_font->ascent; + sw = string_width (sp->body_font, sp->body_label); + x2 = (x1 + ((x3 - x1 - sw) / 2)); + XDrawString (si->dpy, si->splash_dialog, gc1, x2, y1, + sp->body_label, strlen(sp->body_label)); + y1 += sp->body_font->descent; + + y1 += sp->body_font->ascent; + sw = string_width (sp->body_font, sp->body2_label); + x2 = (x1 + ((x3 - x1 - sw) / 2)); + XDrawString (si->dpy, si->splash_dialog, gc1, x2, y1, + sp->body2_label, strlen(sp->body2_label)); + y1 += sp->body_font->descent; + + /* The buttons + */ + XSetForeground (si->dpy, gc1, sp->button_foreground); + XSetForeground (si->dpy, gc2, sp->button_background); + +/* y1 += (vspacing * 2);*/ + y1 = sp->height - sp->internal_border - sp->button_height; + + x1 += sp->internal_border; + y2 = (y1 + ((sp->button_height - + (sp->button_font->ascent + sp->button_font->descent)) + / 2) + + sp->button_font->ascent); + hspacing = ((sp->width - x1 - (sp->shadow_width * 2) - + sp->internal_border - (sp->button_width * 3)) + / 2); + + x2 = x1 + ((sp->button_width - string_width(sp->button_font, sp->demo_label)) + / 2); + XFillRectangle (si->dpy, si->splash_dialog, gc2, x1, y1, + sp->button_width, sp->button_height); + XDrawString (si->dpy, si->splash_dialog, gc1, x2, y2, + sp->demo_label, strlen(sp->demo_label)); + sp->demo_button_x = x1; + sp->demo_button_y = y1; + + x1 += hspacing + sp->button_width; + x2 = x1 + ((sp->button_width - string_width(sp->button_font,sp->prefs_label)) + / 2); + XFillRectangle (si->dpy, si->splash_dialog, gc2, x1, y1, + sp->button_width, sp->button_height); + XDrawString (si->dpy, si->splash_dialog, gc1, x2, y2, + sp->prefs_label, strlen(sp->prefs_label)); + sp->prefs_button_x = x1; + sp->prefs_button_y = y1; + + x1 += hspacing + sp->button_width; + x2 = x1 + ((sp->button_width - string_width(sp->button_font,sp->help_label)) + / 2); + XFillRectangle (si->dpy, si->splash_dialog, gc2, x1, y1, + sp->button_width, sp->button_height); + XDrawString (si->dpy, si->splash_dialog, gc1, x2, y2, + sp->help_label, strlen(sp->help_label)); + sp->help_button_x = x1; + sp->help_button_y = y1; + + + /* the logo + */ + XSetForeground (si->dpy, gc1, sp->logo_foreground); + XSetForeground (si->dpy, gc2, sp->logo_background); - if (si->prefs.splash_duration <= 0) - return; + x1 = sp->shadow_width * 3; + y1 = sp->shadow_width * 3; + x2 = sp->logo_width - (sp->shadow_width * 6); + y2 = sp->logo_height - (sp->shadow_width * 6); - if (! si->splash_dialog) - make_splash_dialog (si); + XFillRectangle (si->dpy, si->splash_dialog, gc2, x1, y1, x2, y2); + skull (si->dpy, si->splash_dialog, gc1, gc2, + x1 + sp->shadow_width, y1 + sp->shadow_width, + x2 - (sp->shadow_width * 2), y2 - (sp->shadow_width * 2)); -#ifdef HAVE_ATHENA - splash_form = splash_dialog; /* kludge */ -#endif - pop_up_dialog_box (splash_dialog, splash_form, - /* for debugging -- don't ask */ - (si->prefs.debug_p ? 69 : 0) + - 3); - XtManageChild (splash_form); + /* The shadow around the logo + */ + draw_shaded_rectangle (si->dpy, si->splash_dialog, + sp->shadow_width * 2, + sp->shadow_width * 2, + sp->logo_width - (sp->shadow_width * 4), + sp->logo_height - (sp->shadow_width * 4), + sp->shadow_width, + sp->shadow_bottom, sp->shadow_top); + + /* The shadow around the whole window + */ + draw_shaded_rectangle (si->dpy, si->splash_dialog, + 0, 0, sp->width, sp->height, sp->shadow_width, + sp->shadow_top, sp->shadow_bottom); + + XFreeGC (si->dpy, gc1); + XFreeGC (si->dpy, gc2); + + update_splash_window (si); +} -#ifdef HAVE_ATHENA - if (splash_roger_label) - roger (splash_roger_label, 0, 0); -#endif /* HAVE_ATHENA */ - splash_sink_id = XtAppAddTimeOut (si->app, si->prefs.splash_duration, - splash_sink_timer, (XtPointer) si); +static void +update_splash_window (saver_info *si) +{ + splash_dialog_data *sp = si->sp_data; + int pressed; + if (!sp) return; + pressed = sp->pressed; + + /* The shadows around the buttons + */ + draw_shaded_rectangle (si->dpy, si->splash_dialog, + sp->demo_button_x, sp->demo_button_y, + sp->button_width, sp->button_height, sp->shadow_width, + (pressed == 1 ? sp->shadow_bottom : sp->shadow_top), + (pressed == 1 ? sp->shadow_top : sp->shadow_bottom)); + draw_shaded_rectangle (si->dpy, si->splash_dialog, + sp->prefs_button_x, sp->prefs_button_y, + sp->button_width, sp->button_height, sp->shadow_width, + (pressed == 2 ? sp->shadow_bottom : sp->shadow_top), + (pressed == 2 ? sp->shadow_top : sp->shadow_bottom)); + draw_shaded_rectangle (si->dpy, si->splash_dialog, + sp->help_button_x, sp->help_button_y, + sp->button_width, sp->button_height, sp->shadow_width, + (pressed == 3 ? sp->shadow_bottom : sp->shadow_top), + (pressed == 3 ? sp->shadow_top : sp->shadow_bottom)); +} + +static void +destroy_splash_window (saver_info *si) +{ + splash_dialog_data *sp = si->sp_data; + Screen *screen = si->default_screen->screen; + Colormap cmap = DefaultColormapOfScreen (screen); + Pixel black = BlackPixelOfScreen (screen); + Pixel white = WhitePixelOfScreen (screen); + + if (sp->timer) + XtRemoveTimeOut (sp->timer); + + if (si->splash_dialog) + { + XDestroyWindow (si->dpy, si->splash_dialog); + si->splash_dialog = 0; + } + + if (sp->heading_label) free (sp->heading_label); + if (sp->body_label) free (sp->body_label); + if (sp->demo_label) free (sp->demo_label); + if (sp->prefs_label) free (sp->prefs_label); + if (sp->help_label) free (sp->help_label); + + if (sp->heading_font) XFreeFont (si->dpy, sp->heading_font); + if (sp->body_font) XFreeFont (si->dpy, sp->body_font); + if (sp->button_font) XFreeFont (si->dpy, sp->button_font); + + if (sp->foreground != black && sp->foreground != white) + XFreeColors (si->dpy, cmap, &sp->foreground, 1, 0L); + if (sp->background != black && sp->background != white) + XFreeColors (si->dpy, cmap, &sp->background, 1, 0L); + if (sp->button_foreground != black && sp->button_foreground != white) + XFreeColors (si->dpy, cmap, &sp->button_foreground, 1, 0L); + if (sp->button_background != black && sp->button_background != white) + XFreeColors (si->dpy, cmap, &sp->button_background, 1, 0L); + if (sp->logo_foreground != black && sp->logo_foreground != white) + XFreeColors (si->dpy, cmap, &sp->logo_foreground, 1, 0L); + if (sp->logo_background != black && sp->logo_background != white) + XFreeColors (si->dpy, cmap, &sp->logo_background, 1, 0L); + if (sp->shadow_top != black && sp->shadow_top != white) + XFreeColors (si->dpy, cmap, &sp->shadow_top, 1, 0L); + if (sp->shadow_bottom != black && sp->shadow_bottom != white) + XFreeColors (si->dpy, cmap, &sp->shadow_bottom, 1, 0L); + + memset (sp, 0, sizeof(*sp)); + free (sp); + + si->sp_data = 0; +} + +void +handle_splash_event (saver_info *si, XEvent *event) +{ + splash_dialog_data *sp = si->sp_data; + int which = 0; + if (!sp) return; + + switch (event->xany.type) + { + case Expose: + draw_splash_window (si); + break; + + case ButtonPress: case ButtonRelease: + + if (event->xbutton.x >= sp->demo_button_x && + event->xbutton.x < sp->demo_button_x + sp->button_width && + event->xbutton.y >= sp->demo_button_y && + event->xbutton.y < sp->demo_button_y + sp->button_height) + which = 1; + + else if (event->xbutton.x >= sp->prefs_button_x && + event->xbutton.x < sp->prefs_button_x + sp->button_width && + event->xbutton.y >= sp->prefs_button_y && + event->xbutton.y < sp->prefs_button_y + sp->button_height) + which = 2; + + else if (event->xbutton.x >= sp->help_button_x && + event->xbutton.x < sp->help_button_x + sp->button_width && + event->xbutton.y >= sp->help_button_y && + event->xbutton.y < sp->help_button_y + sp->button_height) + which = 3; + + if (event->xany.type == ButtonPress) + { + sp->pressed = which; + update_splash_window (si); + if (which == 0) + XBell (si->dpy, False); + } + else if (event->xany.type == ButtonRelease) + { + if (which && sp->pressed == which) + { + destroy_splash_window (si); + switch (which) + { + case 1: send_self_clientmessage (si, XA_DEMO); break; + case 2: send_self_clientmessage (si, XA_PREFS); break; + case 3: get_help (si); break; + default: abort(); + } + } + sp->pressed = 0; + update_splash_window (si); + } + break; + + default: + break; + } +} + +static void +unsplash_timer (XtPointer closure, XtIntervalId *id) +{ + saver_info *si = (saver_info *) closure; + if (si && si->sp_data) + destroy_splash_window (si); } diff --git a/driver/stderr.c b/driver/stderr.c index 798d4efb..4258f874 100644 --- a/driver/stderr.c +++ b/driver/stderr.c @@ -339,7 +339,7 @@ initialize_stderr (saver_info *si) int stdout_fd = 1; int stderr_fd = 2; int flags = 0; - Boolean stderr_dialog_p, stdout_dialog_p; + Boolean stderr_dialog_p; if (done) return; done = True; @@ -348,9 +348,8 @@ initialize_stderr (saver_info *si) real_stdout = stdout; stderr_dialog_p = get_boolean_resource ("captureStderr", "Boolean"); - stdout_dialog_p = get_boolean_resource ("captureStdout", "Boolean"); - if (!stderr_dialog_p && !stdout_dialog_p) + if (!stderr_dialog_p) return; if (pipe (fds)) @@ -392,6 +391,8 @@ initialize_stderr (saver_info *si) if (stderr_dialog_p) { FILE *new_stderr_file; + FILE *new_stdout_file; + new_stderr = dup (stderr_fd); if (new_stderr < 0) { @@ -411,11 +412,8 @@ initialize_stderr (saver_info *si) perror ("could not dup() a new stderr:"); return; } - } - if (stdout_dialog_p) - { - FILE *new_stdout_file; + new_stdout = dup (stdout_fd); if (new_stdout < 0) { diff --git a/driver/subprocs.c b/driver/subprocs.c index 166ae599..3f431398 100644 --- a/driver/subprocs.c +++ b/driver/subprocs.c @@ -22,39 +22,39 @@ #include /* not used for much... */ #ifndef ESRCH -#include +# include #endif #include /* sys/resource.h needs this for timeval */ -#ifndef VMS - -# include /* for setpriority() and PRIO_PROCESS */ +#ifdef HAVE_SYS_WAIT_H # include /* for waitpid() and associated macros */ +#endif -#else /* VMS */ - -# if __DECC_VER >= 50200000 -# include -# endif +#if defined(HAVE_SETPRIORITY) && defined(PRIO_PROCESS) +# include /* for setpriority() and PRIO_PROCESS */ +#endif +#ifdef VMS # include # include /* for close */ # include /* for getpid */ -# define pid_t int -# define fork vfork - +# define pid_t int +# define fork vfork #endif /* VMS */ #include /* for the signal names */ #if !defined(SIGCHLD) && defined(SIGCLD) -#define SIGCHLD SIGCLD +# define SIGCHLD SIGCLD #endif +#if 0 /* putenv() is declared in stdlib.h on modern linux systems. */ #ifdef HAVE_PUTENV extern int putenv (/* const char * */); /* getenv() is in stdlib.h... */ #endif +#endif + extern int kill (pid_t, int); /* signal() is in sys/signal.h... */ /* This file doesn't need the Xt headers, so stub these types out... */ @@ -766,11 +766,13 @@ spawn_screenhack_1 (saver_screen_info *ssi, Bool first_time_p) AGAIN: if (p->screenhacks_count == 1) new_hack = 0; - else if (si->next_mode_p == 1) + else if (si->selection_mode == -1) new_hack = (ssi->current_hack + 1) % p->screenhacks_count; - else if (si->next_mode_p == 2) + else if (si->selection_mode == -2) new_hack = ((ssi->current_hack + p->screenhacks_count - 1) % p->screenhacks_count); + else if (si->selection_mode > 0) + new_hack = ((si->selection_mode - 1) % p->screenhacks_count); else while ((new_hack = random () % p->screenhacks_count) == ssi->current_hack) @@ -797,7 +799,9 @@ spawn_screenhack_1 (saver_screen_info *ssi, Bool first_time_p) goto AGAIN; } } - si->next_mode_p = 0; + + if (si->selection_mode < 0) + si->selection_mode = 0; /* If there's a visual description on the front of the command, nuke it. @@ -927,51 +931,32 @@ screenhack_running_p (saver_info *si) } -/* Restarting the xscreensaver process from scratch. */ +/* Environment variables. */ -static char **saved_argv; +/* Modifies $PATH in the current environment, so that if DEFAULT_PATH_PREFIX + is defined, the xscreensaver daemon will search that directory for hacks. + */ void -save_argv (int argc, char **argv) +hack_environment (saver_info *si) { - saved_argv = (char **) malloc ((argc + 2) * sizeof (char *)); - saved_argv [argc] = 0; - while (argc--) +#if defined(HAVE_PUTENV) && defined(DEFAULT_PATH_PREFIX) + static const char *def_path = DEFAULT_PATH_PREFIX; + if (def_path && *def_path) { - int i = strlen (argv [argc]) + 1; - saved_argv [argc] = (char *) malloc (i); - memcpy (saved_argv [argc], argv [argc], i); - } -} + const char *opath = getenv("PATH"); + char *npath = (char *) malloc(strlen(def_path) + strlen(opath) + 20); + strcpy (npath, "PATH="); + strcat (npath, def_path); + strcat (npath, ":"); + strcat (npath, opath); -void -restart_process (saver_info *si) -{ - fflush (real_stdout); - fflush (real_stderr); - execvp (saved_argv [0], saved_argv); /* shouldn't return */ - { - char buf [512]; - sprintf (buf, "%s: could not restart process", blurb()); - perror(buf); - fflush(stderr); - } + if (putenv (npath)) + abort (); + } +#endif /* HAVE_PUTENV && DEFAULT_PATH_PREFIX */ } -/* Like restart_process(), but ensures that when it restarts, - it comes up in demo-mode. */ -void -demo_mode_restart_process (saver_info *si) -{ - int i; - for (i = 0; saved_argv [i]; i++); - /* add the -initial-demo-mode switch; save_argv() left room for this. */ - saved_argv [i] = "-initial-demo-mode"; - saved_argv [i+1] = 0; - restart_process (si); /* shouldn't return */ - saved_argv [i] = 0; - XBell(si->dpy, 0); -} static void hack_subproc_environment (saver_screen_info *ssi) @@ -994,7 +979,6 @@ hack_subproc_environment (saver_screen_info *ssi) for (screen_number = 0; screen_number < si->nscreens; screen_number++) if (ssi == &si->screens[screen_number]) break; - if (screen_number >= si->nscreens) abort(); strcpy (ndpy, "DISPLAY="); s = ndpy + strlen(ndpy); @@ -1015,23 +999,95 @@ hack_subproc_environment (saver_screen_info *ssi) #endif /* HAVE_PUTENV */ } + +/* Restarting the xscreensaver process from scratch. */ + +static char **saved_argv; void -hack_environment (saver_info *si) +save_argv (int argc, char **argv) { -#if defined(HAVE_PUTENV) && defined(DEFAULT_PATH_PREFIX) - static const char *def_path = DEFAULT_PATH_PREFIX; - if (def_path && *def_path) + /* Leave room for one more argument, the -initial-demo-mode switch. */ + saved_argv = (char **) calloc (argc+2, sizeof (char *)); + saved_argv [argc] = 0; + while (argc--) { - const char *opath = getenv("PATH"); - char *npath = (char *) malloc(strlen(def_path) + strlen(opath) + 20); - strcpy (npath, "PATH="); - strcat (npath, def_path); - strcat (npath, ":"); - strcat (npath, opath); + int i = strlen (argv [argc]) + 1; + saved_argv [argc] = (char *) malloc (i); + memcpy (saved_argv [argc], argv [argc], i); + } +} - if (putenv (npath)) - abort (); +/* Modifies saved_argv to either contain or not contain "-initial-demo-mode". + */ +static void +hack_saved_argv (Bool demo_mode_p) +{ + static char *demo_mode_switch = "-initial-demo-mode"; + + if (demo_mode_p) /* We want the switch to be in the args. */ + { + /* See if the switch is there already. If so, we're done. */ + int i; + for (i = 0; saved_argv[i]; i++) + if (!strcmp (saved_argv[i], demo_mode_switch)) + return; + + /* If it wasn't there, add it to the end. save_argv() made room. */ + saved_argv [i] = demo_mode_switch; + saved_argv [i+1] = 0; } -#endif /* HAVE_PUTENV && DEFAULT_PATH_PREFIX */ + else /* We want the switch to not be in the args. */ + { + int i; + for (i = 0; saved_argv[i]; i++) + while (!strcmp (saved_argv [i], demo_mode_switch)) + { + int j; + for (j = i; saved_argv[j]; j++) + saved_argv [j] = saved_argv [j+1]; + } + } +} + + +/* Re-execs the process with the arguments in saved_argv. + Does not return unless there was an error. + */ +static void +restart_process_1 (saver_info *si) +{ + fflush (real_stdout); + fflush (real_stderr); + execvp (saved_argv [0], saved_argv); /* shouldn't return */ + { + char buf [512]; + sprintf (buf, "%s: could not restart process", blurb()); + perror(buf); + fflush(stderr); + } + XBell(si->dpy, 0); +} + + +/* Re-execs the process with the arguments in saved_argv, + minus -initial-demo-mode. + Does not return unless there was an error. + */ +void +restart_process (saver_info *si) +{ + hack_saved_argv (True); + restart_process_1 (si); +} + +/* Re-execs the process with the arguments in saved_argv, + plus -initial-demo-mode. + Does not return unless there was an error. + */ +void +demo_mode_restart_process (saver_info *si) +{ + hack_saved_argv (False); + restart_process_1 (si); } diff --git a/driver/test-passwd.c b/driver/test-passwd.c index 019f86da..318c9453 100644 --- a/driver/test-passwd.c +++ b/driver/test-passwd.c @@ -14,6 +14,8 @@ itself. */ +#define WHICH 0 + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -41,6 +43,7 @@ void reset_stderr(saver_screen_info *ssi) {} void clear_stderr(saver_screen_info *ssi) {} void reset_watchdog_timer(saver_info *si, Bool on_p) {} void monitor_power_on (saver_info *si) {} +void grab_keyboard_and_mouse (saver_info *si, Window w, Cursor c) {} void ungrab_keyboard_and_mouse (saver_info *si) {} Bool select_visual (saver_screen_info *ssi, const char *v) { return False; } void raise_window (saver_info *si, Bool i, Bool b, Bool d) {} @@ -54,8 +57,12 @@ void blank_screen (saver_info *si) {} void unblank_screen (saver_info *si) {} Bool handle_clientmessage (saver_info *si, XEvent *e, Bool u) { return False; } int BadWindow_ehandler (Display *dpy, XErrorEvent *error) { exit(1); } +int write_init_file (saver_info *si) { return 0;} +Bool window_exists_p (Display *dpy, Window window) {return True;} const char *blurb(void) { return progname; } +Atom XA_SCREENSAVER, XA_DEMO, XA_PREFS; + void idle_timer (XtPointer closure, XtIntervalId *id) @@ -70,7 +77,7 @@ idle_timer (XtPointer closure, XtIntervalId *id) static char * -reformat_hack(const char *hack) +reformat_hack (const char *hack) { int i; const char *in = hack; @@ -97,9 +104,41 @@ reformat_hack(const char *hack) for (i = strlen(h2); i < indent; i++) /* indent */ *out++ = ' '; - while (*in) *out++ = *in++; /* copy rest of line */ + /* copy the rest of the line. */ + while (*in) + { + /* shrink all whitespace to one space, for the benefit of the "demo" + mode display. We only do this when we can easily tell that the + whitespace is not significant (no shell metachars). + */ + switch (*in) + { + case '\'': case '"': case '`': case '\\': + { + /* Metachars are scary. Copy the rest of the line unchanged. */ + while (*in) + *out++ = *in++; + } + break; + case ' ': case '\t': + { + while (*in == ' ' || *in == '\t') + in++; + *out++ = ' '; + } + break; + default: + *out++ = *in++; + break; + } + } *out = 0; + /* strip trailing whitespace. */ + out = out-1; + while (out > h2 && (*out == ' ' || *out == '\t' || *out == '\n')) + *out-- = 0; + return h2; } @@ -109,7 +148,8 @@ get_screenhacks (saver_info *si) { saver_preferences *p = &si->prefs; int i = 0; - int hacks_size = 60; + int start = 0; + int end = 0; int size; char *d; @@ -129,77 +169,62 @@ get_screenhacks (saver_info *si) d = get_string_resource ("programs", "Programs"); - size = d ? strlen (d) : 0; - p->screenhacks = (char **) malloc (sizeof (char *) * hacks_size); - p->screenhacks_count = 0; - - while (i < size) + if (p->screenhacks) { - int end, start = i; - if (d[i] == ' ' || d[i] == '\t' || d[i] == '\n' || d[i] == 0) - { - i++; - continue; - } - if (hacks_size <= p->screenhacks_count) - p->screenhacks = (char **) realloc (p->screenhacks, - (hacks_size = hacks_size * 2) * - sizeof (char *)); - p->screenhacks [p->screenhacks_count++] = d + i; - while (d[i] != 0 && d[i] != '\n') - i++; - end = i; - while (i > start && (d[i-1] == ' ' || d[i-1] == '\t')) - i--; - d[i] = 0; - i = end + 1; + for (i = 0; i < p->screenhacks_count; i++) + if (p->screenhacks[i]) + free (p->screenhacks[i]); + free(p->screenhacks); + p->screenhacks = 0; } - /* shrink all whitespace to one space, for the benefit of the "demo" - mode display. We only do this when we can easily tell that the - whitespace is not significant (no shell metachars). - */ - for (i = 0; i < p->screenhacks_count; i++) + if (!d || !*d) { - char *s = p->screenhacks [i]; - char *s2; - int L = strlen (s); - int j, k; - for (j = 0; j < L; j++) - { - switch (s[j]) - { - case '\'': case '"': case '`': case '\\': - goto DONE; - case '\t': - s[j] = ' '; - case ' ': - k = 0; - for (s2 = s+j+1; *s2 == ' ' || *s2 == '\t'; s2++) - k++; - if (k > 0) - { - for (s2 = s+j+1; s2[k]; s2++) - *s2 = s2[k]; - *s2 = 0; - } - break; - } - } - DONE: - p->screenhacks[i] = reformat_hack(s); /* mallocs */ + p->screenhacks_count = 0; + p->screenhacks = 0; + return; } - if (p->screenhacks_count) + size = strlen (d); + + + /* Count up the number of newlines (which will be equal to or larger than + the number of hacks.) + */ + i = 0; + for (i = 0; d[i]; i++) + if (d[i] == '\n') + i++; + i++; + + p->screenhacks = (char **) calloc (sizeof (char *), i+1); + + /* Iterate over the lines in `d' (the string with newlines) + and make new strings to stuff into the `screenhacks' array. + */ + p->screenhacks_count = 0; + while (start < size) { - /* Shrink down the screenhacks array to be only as big as it needs to. - This doesn't really matter at all. */ - p->screenhacks = (char **) - realloc (p->screenhacks, ((p->screenhacks_count + 1) * - sizeof(char *))); - p->screenhacks [p->screenhacks_count] = 0; + /* skip forward over whitespace. */ + while (d[start] == ' ' || d[start] == '\t' || d[start] == '\n') + start++; + + /* skip forward to newline or end of string. */ + end = start; + while (d[end] != 0 && d[end] != '\n') + end++; + + /* null terminate. */ + d[end] = 0; + + p->screenhacks[p->screenhacks_count++] = reformat_hack (d + start); + if (p->screenhacks_count >= i) + abort(); + + start = end+1; } - else + + if (p->screenhacks_count == 0) { free (p->screenhacks); p->screenhacks = 0; @@ -207,6 +232,12 @@ get_screenhacks (saver_info *si) } + +static char *fallback[] = { +#include "XScreenSaver_ad.h" + 0 +}; + int main (int argc, char **argv) { @@ -246,7 +277,8 @@ main (int argc, char **argv) progclass = "XScreenSaver"; toplevel_shell = XtAppInitialize (&si->app, progclass, 0, 0, - &argc, argv, 0, 0, 0); + &argc, argv, fallback, + 0, 0); si->dpy = XtDisplay (toplevel_shell); si->db = XtDatabase (si->dpy); @@ -263,16 +295,33 @@ main (int argc, char **argv) p->debug_p = True; p->verbose_p = True; + p->timestamp_p = True; p->lock_p = True; + + p->fade_p = get_boolean_resource ("fade", "Boolean"); + p->unfade_p = get_boolean_resource ("unfade", "Boolean"); + p->fade_seconds = 1000 * get_seconds_resource ("fadeSeconds", "Time"); + p->fade_ticks = get_integer_resource ("fadeTicks", "Integer"); + p->install_cmap_p = get_boolean_resource ("installColormap", "Boolean"); + p->nice_inferior = get_integer_resource ("nice", "Nice"); + + p->initial_delay = 1000 * get_seconds_resource ("initialDelay", "Time"); + p->splash_duration = 1000 * get_seconds_resource ("splashDuration", "Time"); + p->timeout = 1000 * get_minutes_resource ("timeout", "Time"); + p->lock_timeout = 1000 * get_minutes_resource ("lockTimeout", "Time"); + p->cycle = 1000 * get_minutes_resource ("cycle", "Time"); + p->passwd_timeout = 1000 * get_seconds_resource ("passwdTimeout", "Time"); p->passwd_timeout = 1000 * get_seconds_resource ("passwdTimeout", "Time"); + p->splash_duration = 1000 * get_seconds_resource ("splashDuration", "Time"); + p->shell = get_string_resource ("bourneShell", "BourneShell"); + p->help_url = get_string_resource("helpURL", "URL"); + p->load_url_command = get_string_resource("loadURL", "LoadURL"); get_screenhacks(si); - hack_uid_warn (si); - while (1) { -#if 0 +#if WHICH == 0 if (unlock_p (si)) fprintf (stderr, "%s: password correct\n", progname); else @@ -280,6 +329,22 @@ main (int argc, char **argv) XSync(si->dpy, False); sleep (3); +#elif WHICH == 1 + { + XEvent event; + make_splash_dialog (si); + XtAppAddTimeOut (si->app, p->splash_duration + 1000, + idle_timer, (XtPointer) si); + while (si->splash_dialog) + { + XtAppNextEvent (si->app, &event); + if (event.xany.window == si->splash_dialog) + handle_splash_event (si, &event); + XtDispatchEvent (&event); + } + XSync (si->dpy, False); + sleep (1); + } #else si->demo_mode_p = True; make_screenhack_dialog (si); diff --git a/driver/test-uid.c b/driver/test-uid.c index d0448f95..0a75fcf4 100644 --- a/driver/test-uid.c +++ b/driver/test-uid.c @@ -1,4 +1,4 @@ -/* uid-test.c --- playing with setuid. +/* test-uid.c --- playing with setuid. * xscreensaver, Copyright (c) 1998 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its @@ -14,6 +14,11 @@ # include "config.h" #endif +#include +#ifdef HAVE_UNISTD_H +# include +#endif + #include #include #include @@ -34,13 +39,13 @@ print(void) p = getpwuid (uid); g = getgrgid (gid); - fprintf(stderr, "real user/group: %ld/%ld (%s/%s)\n", uid, gid, + fprintf(stderr, "real user/group: %ld/%ld (%s/%s)\n", (long) uid, (long) gid, (p && p->pw_name ? p->pw_name : "???"), (g && g->gr_name ? g->gr_name : "???")); p = getpwuid (euid); g = getgrgid (egid); - fprintf(stderr, "eff. user/group: %ld/%ld (%s/%s)\n", euid, egid, + fprintf(stderr, "eff. user/group: %ld/%ld (%s/%s)\n", (long)euid, (long)egid, (p && p->pw_name ? p->pw_name : "???"), (g && g->gr_name ? g->gr_name : "???")); } @@ -69,6 +74,8 @@ main (int argc, char **argv) { char *user = argv[i]; char *group = strchr(user, '/'); + if (!group) + group = strchr(user, '.'); if (group) *group++ = 0; diff --git a/driver/test-xdpms.c b/driver/test-xdpms.c new file mode 100644 index 00000000..79b9f0c5 --- /dev/null +++ b/driver/test-xdpms.c @@ -0,0 +1,156 @@ +/* test-xdpms.c --- playing with the XDPMS extension. + * xscreensaver, Copyright (c) 1998 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +extern Bool DPMSQueryExtension (Display *dpy, int *event_ret, int *error_ret); +extern Bool DPMSCapable (Display *dpy); +extern Status DPMSForceLevel (Display *dpy, CARD16 level); +extern Status DPMSInfo (Display *dpy, CARD16 *power_level, BOOL *state); + +extern Status DPMSGetVersion (Display *dpy, int *major_ret, int *minor_ret); +extern Status DPMSSetTimeouts (Display *dpy, + CARD16 standby, CARD16 suspend, CARD16 off); +extern Bool DPMSGetTimeouts (Display *dpy, + CARD16 *standby, CARD16 *suspend, CARD16 *off); +extern Status DPMSEnable (Display *dpy); +extern Status DPMSDisable (Display *dpy); + + +char *progname = 0; +char *progclass = "XScreenSaver"; + +static const char * +blurb (void) +{ + static char buf[255]; + time_t now = time ((time_t *) 0); + char *ct = (char *) ctime (&now); + int n = strlen(progname); + if (n > 100) n = 99; + strncpy(buf, progname, n); + buf[n++] = ':'; + buf[n++] = ' '; + strncpy(buf+n, ct+11, 8); + strcpy(buf+n+9, ": "); + return buf; +} + + +int +main (int argc, char **argv) +{ + int delay = 10; + + int event_number, error_number; + int major, minor; + CARD16 standby, suspend, off; + CARD16 state; + BOOL onoff; + + XtAppContext app; + Widget toplevel_shell = XtAppInitialize (&app, progclass, 0, 0, + &argc, argv, 0, 0, 0); + Display *dpy = XtDisplay (toplevel_shell); + XtGetApplicationNameAndClass (dpy, &progname, &progclass); + + if (!DPMSQueryExtension(dpy, &event_number, &error_number)) + { + fprintf(stderr, "%s: DPMSQueryExtension(dpy, ...) ==> False\n", + blurb()); + fprintf(stderr, "%s: server does not support the XDPMS extension.\n", + blurb()); + exit(1); + } + else + fprintf(stderr, "%s: DPMSQueryExtension(dpy, ...) ==> %d, %d\n", blurb(), + event_number, error_number); + + if (!DPMSCapable(dpy)) + { + fprintf(stderr, "%s: DPMSCapable(dpy) ==> False\n", blurb()); + fprintf(stderr, "%s: server says hardware doesn't support DPMS.\n", + blurb()); + exit(1); + } + else + fprintf(stderr, "%s: DPMSCapable(dpy) ==> True\n", blurb()); + + if (!DPMSGetVersion(dpy, &major, &minor)) + { + fprintf(stderr, "%s: DPMSGetVersion(dpy, ...) ==> False\n", blurb()); + fprintf(stderr, "%s: server didn't report XDPMS version numbers?\n", + blurb()); + } + else + fprintf(stderr, "%s: DPMSGetVersion(dpy, ...) ==> %d, %d\n", blurb(), + major, minor); + + if (!DPMSGetTimeouts(dpy, &standby, &suspend, &off)) + { + fprintf(stderr, "%s: DPMSGetTimeouts(dpy, ...) ==> False\n", blurb()); + fprintf(stderr, "%s: server didn't report DPMS timeouts?\n", blurb()); + } + else + fprintf(stderr, + "%s: DPMSGetTimeouts(dpy, ...)\n" + "\t ==> standby = %d, suspend = %d, off = %d\n", + blurb(), standby, suspend, off); + + while (1) + { + if (!DPMSInfo(dpy, &state, &onoff)) + { + fprintf(stderr, "%s: DPMSInfo(dpy, ...) ==> False\n", blurb()); + fprintf(stderr, "%s: couldn't read DPMS state?\n", blurb()); + onoff = 0; + state = -1; + } + else + { + fprintf(stderr, "%s: DPMSInfo(dpy, ...) ==> %s, %s\n", blurb(), + (state == DPMSModeOn ? "DPMSModeOn" : + state == DPMSModeStandby ? "DPMSModeStandby" : + state == DPMSModeSuspend ? "DPMSModeSuspend" : + state == DPMSModeOff ? "DPMSModeOff" : "???"), + (onoff == 1 ? "On" : onoff == 0 ? "Off" : "???")); + } + + if (state == DPMSModeStandby || + state == DPMSModeSuspend || + state == DPMSModeOff) + { + Status st; + fprintf(stderr, "%s: monitor is off; turning it on.\n", blurb()); + st = DPMSForceLevel (dpy, DPMSModeOn); + fprintf (stderr, "%s: DPMSForceLevel (dpy, DPMSModeOn) ==> %s\n", + blurb(), (st ? "Ok" : "Error")); + } + + sleep (delay); + } +} diff --git a/driver/timers.c b/driver/timers.c index 77bc8c30..aba6d5a3 100644 --- a/driver/timers.c +++ b/driver/timers.c @@ -181,7 +181,7 @@ cycle_timer (XtPointer closure, XtIntervalId *id) saver_info *si = (saver_info *) closure; saver_preferences *p = &si->prefs; Time how_long = p->cycle; - if (si->dbox_up_p || si->question_up_p) + if (si->dbox_up_p) { if (p->verbose_p) fprintf (stderr, "%s: dialog box up; delaying hack change.\n", @@ -190,6 +190,7 @@ cycle_timer (XtPointer closure, XtIntervalId *id) } else { + maybe_reload_init_file (si); if (p->verbose_p) fprintf (stderr, "%s: changing graphics hacks.\n", blurb()); kill_screenhack (si); @@ -244,7 +245,7 @@ reset_timers (saver_info *si) XtRemoveTimeOut (si->timer_id); si->timer_id = XtAppAddTimeOut (si->app, p->timeout, idle_timer, (XtPointer) si); - if (si->cycle_id) abort (); + if (si->cycle_id) abort (); /* no cycle timer when inactive */ #ifdef DEBUG_TIMERS if (p->verbose_p) @@ -270,6 +271,7 @@ check_pointer_timer (XtPointer closure, XtIntervalId *id) if (p->use_xidle_extension || p->use_mit_saver_extension || p->use_sgi_saver_extension) + /* If an extension is in use, we should not be polling the mouse. */ abort (); si->check_pointer_timer_id = @@ -318,6 +320,20 @@ check_pointer_timer (XtPointer closure, XtIntervalId *id) } +static void +dispatch_event (saver_info *si, XEvent *event) +{ + /* If this is for the splash dialog, pass it along. + Note that the password dialog is handled with its own event loop, + so events for that window will never come through here. + */ + if (si->splash_dialog && event->xany.window == si->splash_dialog) + handle_splash_event (si, event); + + XtDispatchEvent (event); +} + + void sleep_until_idle (saver_info *si, Bool until_idle_p) { @@ -450,7 +466,7 @@ sleep_until_idle (saver_info *si, Bool until_idle_p) #endif /* DEBUG_TIMERS */ /* If any widgets want to handle this event, let them. */ - XtDispatchEvent (&event); + dispatch_event (si, &event); /* We got a user event */ if (!until_idle_p) @@ -546,7 +562,7 @@ sleep_until_idle (saver_info *si, Bool until_idle_p) else #endif /* HAVE_SGI_SAVER_EXTENSION */ - XtDispatchEvent (&event); + dispatch_event (si, &event); } } DONE: @@ -575,7 +591,7 @@ sleep_until_idle (saver_info *si, Bool until_idle_p) si->timer_id = 0; } - if (until_idle_p && si->cycle_id) + if (until_idle_p && si->cycle_id) /* no cycle timer when inactive */ abort (); return; diff --git a/driver/windows.c b/driver/windows.c index 4daa0607..2d975475 100644 --- a/driver/windows.c +++ b/driver/windows.c @@ -17,9 +17,6 @@ #ifdef VMS # include /* for getpid() */ # include "vms-gtod.h" /* for gettimeofday() */ -# if !defined(HAVE_UNAME) && (__VMS_VER >= 70000000) -# define HAVE_UNAME 1 -# endif /* !HAVE_UNAME */ #endif /* VMS */ # ifdef HAVE_UNAME @@ -62,6 +59,15 @@ #include "visual.h" #include "fade.h" + +#ifdef HAVE_VT_LOCKSWITCH +# include +# include +# include + static void lock_vt (saver_info *si, Bool lock_p); +#endif /* HAVE_VT_LOCKSWITCH */ + + extern int kill (pid_t, int); /* signal() is in sys/signal.h... */ Atom XA_VROOT, XA_XSETROOT_ID; @@ -592,6 +598,7 @@ saver_exit (saver_info *si, int status, const char *dump_core_reason) { saver_preferences *p = &si->prefs; static Bool exiting = False; + Bool bugp; Bool vrs; if (exiting) @@ -614,49 +621,40 @@ saver_exit (saver_info *si, int status, const char *dump_core_reason) else if (status == 1) status = -1; #endif + bugp = !!dump_core_reason; + if (si->prefs.debug_p && !dump_core_reason) dump_core_reason = "because of -debug"; if (dump_core_reason) { -#if 0 - if (si->locking_disabled_p && - si->nolock_reason && - *si->nolock_reason) - { - /* If locking is disabled, it's because xscreensaver was launched - by root, and has relinquished its user id (most likely we are - now running as "nobody".) This means we won't be able to dump - core, since "nobody" can't write files; so don't even try. - */ - fprintf(real_stderr, "%s: NOT dumping core (%s)\n", blurb(), - si->nolock_reason); - } - else -#endif - { - /* Note that the Linux man page for setuid() says If uid is - different from the old effective uid, the process will be - forbidden from leaving core dumps. - */ - - char cwd[4096]; /* should really be PATH_MAX, but who cares. */ - fprintf(real_stderr, "%s: dumping core (%s)\n", blurb(), - dump_core_reason); + /* Note that the Linux man page for setuid() says If uid is + different from the old effective uid, the process will be + forbidden from leaving core dumps. + */ + char cwd[4096]; /* should really be PATH_MAX, but who cares. */ + cwd[0] = 0; + fprintf(real_stderr, "%s: dumping core (%s)\n", blurb(), + dump_core_reason); + + if (bugp) + fprintf(real_stderr, + "%s: see http://www.jwz.org/xscreensaver/bugs.html\n" + "\t\tfor bug reporting information.\n\n", + blurb()); # if defined(HAVE_GETCWD) - getcwd (cwd, sizeof(cwd)); + if (!getcwd (cwd, sizeof(cwd))) # elif defined(HAVE_GETWD) - getwd (cwd); -# else - strcpy(cwd, "unknown."); + if (!getwd (cwd)) # endif - fprintf (real_stderr, "%s: current directory is %s\n", blurb(), cwd); - describe_uids (si, real_stderr); + strcpy(cwd, "unknown."); - /* Do this to drop a core file, so that we can get a stack trace. */ - abort(); - } + fprintf (real_stderr, "%s: current directory is %s\n", blurb(), cwd); + describe_uids (si, real_stderr); + + /* Do this to drop a core file, so that we can get a stack trace. */ + abort(); } exit (status); @@ -933,7 +931,7 @@ raise_window (saver_info *si, initialize_screensaver_window (si); reset_watchdog_timer (si, True); - if (p->fade_p && !inhibit_fade && !si->demo_mode_p) + if (p->fade_p && si->fading_possible_p && !inhibit_fade && !si->demo_mode_p) { Window *current_windows = (Window *) calloc(sizeof(Window), si->nscreens); @@ -972,7 +970,7 @@ raise_window (saver_info *si, /* Note! The server is grabbed, and this will take several seconds to complete! */ fade_screens (si->dpy, current_maps, current_windows, - p->fade_seconds, p->fade_ticks, True, !dont_clear); + p->fade_seconds/1000, p->fade_ticks, True, !dont_clear); free(current_maps); free(current_windows); @@ -1054,6 +1052,11 @@ blank_screen (saver_info *si) } #endif +#ifdef HAVE_VT_LOCKSWITCH + if (si->locked_p) + lock_vt (si, True); /* turn off C-Alt-Fn */ +#endif + si->screen_blanked_p = True; } @@ -1068,7 +1071,7 @@ unblank_screen (saver_info *si) store_activate_time (si, True); reset_watchdog_timer (si, False); - if (p->unfade_p && !si->demo_mode_p) + if (p->unfade_p && si->fading_possible_p && !si->demo_mode_p) { Window *current_windows = (Window *) calloc(sizeof(Window), si->nscreens); @@ -1103,7 +1106,7 @@ unblank_screen (saver_info *si) fade_screens (si->dpy, 0, current_windows, - p->fade_seconds, p->fade_ticks, + p->fade_seconds/1000, p->fade_ticks, False, False); free(current_windows); @@ -1169,6 +1172,10 @@ unblank_screen (saver_info *si) } #endif +#ifdef HAVE_VT_LOCKSWITCH + lock_vt (si, False); /* turn C-Alt-Fn back on */ +#endif + /* Unmap the windows a second time, dammit -- just to avoid a race with the screen-grabbing hacks. (I'm not sure if this is really necessary; I'm stabbing in the dark now.) @@ -1325,3 +1332,56 @@ select_visual (saver_screen_info *ssi, const char *visual_name) return got_it; } + + +/* VT locking */ + +#ifdef HAVE_VT_LOCKSWITCH +static void +lock_vt (saver_info *si, Bool lock_p) +{ + saver_preferences *p = &si->prefs; + static Bool locked_p = False; + const char *dev_console = "/dev/console"; + int fd; + + if (lock_p == locked_p) + return; + + if (lock_p && !p->lock_vt_p) + return; + + fd = open (dev_console, O_RDWR); + if (fd < 0) + { + char buf [255]; + sprintf (buf, "%s: couldn't %s VTs: %s", blurb(), + (lock_p ? "lock" : "unlock"), + dev_console); +#if 0 /* #### doesn't work yet, so don't bother complaining */ + perror (buf); +#endif + return; + } + + if (ioctl (fd, (lock_p ? VT_LOCKSWITCH : VT_UNLOCKSWITCH)) == 0) + { + locked_p = lock_p; + + if (p->verbose_p) + fprintf (stderr, "%s: %s VTs\n", blurb(), + (lock_p ? "locked" : "unlocked")); + } + else + { + char buf [255]; + sprintf (buf, "%s: couldn't %s VTs: ioctl", blurb(), + (lock_p ? "lock" : "unlock")); +#if 0 /* #### doesn't work yet, so don't bother complaining */ + perror (buf); +#endif + } + + close (fd); +} +#endif /* HAVE_VT_LOCKSWITCH */ diff --git a/driver/xscreensaver-command.c b/driver/xscreensaver-command.c index 4c7a0285..d5d3ba9c 100644 --- a/driver/xscreensaver-command.c +++ b/driver/xscreensaver-command.c @@ -18,6 +18,8 @@ #include #include +#include +#include #ifdef HAVE_UNISTD_H # include @@ -36,7 +38,8 @@ #ifdef STANDALONE static char *progname; static Atom XA_VROOT; - static Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_TIME; + static Atom XA_SCREENSAVER, XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_VERSION; + static Atom XA_SCREENSAVER_TIME, XA_SELECT; #else /* !STANDALONE */ # include "xscreensaver.h" #endif /* !STANDALONE */ @@ -46,6 +49,8 @@ ERROR! you must not include vroot.h in this file #endif + + static Window find_screensaver_window (Display *dpy, char **version) { @@ -86,15 +91,27 @@ find_screensaver_window (Display *dpy, char **version) } fprintf (stderr, "%s: no screensaver is running on display %s\n", progname, DisplayString (dpy)); - exit (1); + return 0; } -void -xscreensaver_command (Display *dpy, Atom command) +static int +send_xscreensaver_command (Display *dpy, Atom command, long argument, + Window *window_ret) { char *v = 0; Window window = find_screensaver_window (dpy, &v); + XWindowAttributes xgwa; + + if (window_ret) + *window_ret = window; + + if (!window) + return -1; + + /* Select for property change events, so that we can read the response. */ + XGetWindowAttributes (dpy, window, &xgwa); + XSelectInput (dpy, window, xgwa.your_event_mask | PropertyChangeMask); if (command == XA_SCREENSAVER_TIME || command == XA_SCREENSAVER_VERSION) @@ -105,7 +122,7 @@ xscreensaver_command (Display *dpy, Atom command) { fprintf (stderr, "%s: version property not set on window 0x%x?\n", progname, (unsigned int) window); - exit (1); + return -1; } XGetClassHint(dpy, window, &hint); @@ -113,7 +130,7 @@ xscreensaver_command (Display *dpy, Atom command) { fprintf (stderr, "%s: class hints not set on window 0x%x?\n", progname, (unsigned int) window); - exit (1); + return -1; } fprintf (stdout, "%s %s", hint.res_class, v); @@ -128,12 +145,8 @@ xscreensaver_command (Display *dpy, Atom command) int format; unsigned long nitems, bytesafter; unsigned char *data = 0; - XWindowAttributes xgwa; Bool active_p = False; - xgwa.map_state = IsViewable; - XGetWindowAttributes (dpy, window, &xgwa); - if (XGetWindowProperty (dpy, window, XA_VROOT, 0, 0, False, XA_WINDOW, &type, &format, &nitems, &bytesafter, @@ -173,30 +186,177 @@ xscreensaver_command (Display *dpy, Atom command) fprintf (stderr, "%s: no time on window 0x%x (%s %s).\n", progname, (unsigned int) window, hint.res_class, (v ? v : "???")); - exit (1); + return -1; } } + + /* No need to read a response for these commands. */ + return 1; } else { XEvent event; + long arg1 = (command == XA_SELECT ? argument : 0L); event.xany.type = ClientMessage; event.xclient.display = dpy; event.xclient.window = window; event.xclient.message_type = XA_SCREENSAVER; event.xclient.format = 32; + memset (&event.xclient.data, 0, sizeof(event.xclient.data)); event.xclient.data.l[0] = (long) command; + event.xclient.data.l[1] = arg1; if (! XSendEvent (dpy, window, False, 0L, &event)) { fprintf (stderr, "%s: XSendEvent(dpy, 0x%x ...) failed.\n", progname, (unsigned int) window); - exit (1); + return -1; } } XSync (dpy, 0); + return 0; +} + + +static XErrorHandler old_handler = 0; +static Bool got_badwindow = False; +static int +BadWindow_ehandler (Display *dpy, XErrorEvent *error) +{ + /* When we notice a window being created, we spawn a timer that waits + 30 seconds or so, and then selects events on that window. This error + handler is used so that we can cope with the fact that the window + may have been destroyed <30 seconds after it was created. + */ + if (error->error_code == BadWindow) + { + got_badwindow = True; + return 0; + } + else + { + fprintf (stderr, "%s: ", progname); + return (*old_handler) (dpy, error); + } +} + + +static int +xscreensaver_command_response (Display *dpy, Window window) +{ + int fd = ConnectionNumber (dpy); + int timeout = 10; + int status; + fd_set fds; + struct timeval tv; + + while (1) + { + FD_ZERO(&fds); + FD_SET(fd, &fds); + memset(&tv, 0, sizeof(tv)); + tv.tv_sec = timeout; + status = select (fd+1, &fds, 0, &fds, &tv); + + if (status < 0) + { + char buf[1024]; + sprintf (buf, "%s: waiting for reply", progname); + perror (buf); + return status; + } + else if (status == 0) + { + fprintf (stderr, "%s: no response to command.\n", progname); + return -1; + } + else + { + XEvent event; + XNextEvent (dpy, &event); + switch (event.xany.type) { + case PropertyNotify: + if (event.xproperty.state == PropertyNewValue && + event.xproperty.atom == XA_SCREENSAVER_RESPONSE) + { + Status st2; + Atom type; + int format; + unsigned long nitems, bytesafter; + char *msg = 0; + + old_handler = XSetErrorHandler (BadWindow_ehandler); + XSync (dpy, False); + + st2 = XGetWindowProperty (dpy, window, + XA_SCREENSAVER_RESPONSE, + 0, 1024, True, + AnyPropertyType, + &type, &format, &nitems, &bytesafter, + (unsigned char **) &msg); + + if (got_badwindow) + { + fprintf (stdout, + "%s: xscreensaver window has been deleted.\n", + progname); + return 0; + } + + if (st2 == Success && type != None) + { + if (type != XA_STRING || format != 8) + { + fprintf (stderr, + "%s: unrecognized response property.\n", + progname); + if (msg) XFree (msg); + return -1; + } + else if (!msg || (msg[0] != '+' && msg[0] != '-')) + { + fprintf (stderr, + "%s: unrecognized response message.\n", + progname); + if (msg) XFree (msg); + return -1; + } + else + { + int ret = (msg[0] == '+' ? 0 : -1); + fprintf ((ret < 0 ? stderr : stdout), + "%s: %s\n", + progname, + msg+1); + XFree (msg); + return ret; + } + } + } + break; + + default: + fprintf (stderr, "%s: got unexpected response event %d.\n", + progname, event.xany.type); + return -1; + break; + } + } + } } +int +xscreensaver_command (Display *dpy, Atom command, long argument) +{ + Window w = 0; + int status = send_xscreensaver_command (dpy, command, argument, &w); + if (status == 0) + status = xscreensaver_command_response (dpy, w); + fflush (stdout); + fflush (stderr); + return status; +} + #ifdef STANDALONE static Atom XA_ACTIVATE, XA_DEACTIVATE, XA_CYCLE, XA_NEXT, XA_PREV; @@ -239,6 +399,12 @@ usage: %s -