diff --git a/ChangeLog b/ChangeLog index 51713c0..235e71a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5215,6 +5215,33 @@ Thu Mar 11 11:55:45 2004 Michael Jennings (mej) Fix "make distcheck" ---------------------------------------------------------------------- +Mon Apr 5 17:12:06 2004 Michael Jennings (mej) + +Fixed bug in loading print_pipe attribute pointed out by Tom A. Cox +. +---------------------------------------------------------------------- +Tue Apr 20 13:44:22 2004 Michael Jennings (mej) + +As requested by Ben Armstrong , saving +theme settings will not preserve -e/--exec arguments unless a theme +was specifically named by the user. +---------------------------------------------------------------------- +Tue Apr 20 15:40:39 2004 Michael Jennings (mej) + +Enable title-reporting and iconname-reporting escape sequences only if +specifically requested by user at compile time. This exists solely to +protect the ignorant and careless from themselves. +---------------------------------------------------------------------- +Mon May 10 18:43:15 2004 Michael Jennings (mej) + +Revert change from February 29th. I never could reproduce it anyway. +---------------------------------------------------------------------- +Fri Jun 25 17:48:24 2004 Michael Jennings (mej) + +Chris Schoeneman pointed out that Eterm didn't get +keypresses if another app (like synergy) decided to listen for its +events. This should correct that behavior. +---------------------------------------------------------------------- Mon Jun 28 12:34:36 2004 Michael Jennings (mej) Cleaning up some warnings. @@ -5507,3 +5534,169 @@ Mon Dec 5 13:33:58 2005 Michael Jennings (mej) Merge and re-indent code. ---------------------------------------------------------------------- +Mon Dec 5 15:46:34 2005 Michael Jennings (mej) + +Prevent firewall bounces from trying for the same port. +---------------------------------------------------------------------- +Thu Dec 22 18:32:31 2005 Michael Jennings (mej) + +Cleanups and minor enhancements. +---------------------------------------------------------------------- +Wed Jan 4 03:44:04 2006 Michael Jennings (mej) + +X resource tracking/debugging support. +---------------------------------------------------------------------- +Wed Jan 4 04:14:14 2006 Michael Jennings (mej) + +Applied patches from Tres Melton for SSE2 +alignment and other shading-related issues. +---------------------------------------------------------------------- +Wed Jan 4 04:22:13 2006 Michael Jennings (mej) + +Update copyright dates. +---------------------------------------------------------------------- +Thu Jan 5 14:50:53 2006 Michael Jennings (mej) + +Fixed firewall bounce port checking from 2005-12-05. +---------------------------------------------------------------------- +Mon Feb 6 01:02:15 2006 Michael Jennings (mej) + +Fixed paste from clipboard. +---------------------------------------------------------------------- +Mon Feb 6 17:15:49 2006 Michael Jennings (mej) + +DragonFly BSD fixes from Joerg Sonnenberger . + +Also some type mismatch fixes. +---------------------------------------------------------------------- +Mon Feb 13 14:51:56 2006 Michael Jennings (mej) + +Update to libast 0.6+ API. +---------------------------------------------------------------------- +Fri Feb 24 16:58:43 2006 Michael Jennings (mej) + +Add fallback attempt to open display in case NEED_LINUX_HACK is set +and shouldn't be. +---------------------------------------------------------------------- +Wed May 17 15:42:28 2006 Michael Jennings (mej) + +Patch from Kim Woelders to optimize transparent +Eterms moved an even multiple of the desktop size (i.e., to another +desktop area). +---------------------------------------------------------------------- +Fri May 19 16:46:02 2006 Michael Jennings (mej) + +Fixed a problem that's been bugging me for ages: Instead of a +hard-coded delay, wait until we can connect to the ssh forwarding port +before starting the Escreen session via ssh. + +Add usleep() to system() wait so as to not peg the CPU while sitting +and spinning. +---------------------------------------------------------------------- +Sat Jun 17 23:06:03 2006 Michael Jennings (mej) + +Daniel Macks noticed that gdb.scr wasn't being +installed. Oops. Fixed now. +---------------------------------------------------------------------- +Fri Aug 18 13:41:14 2006 Michael Jennings (mej) + +Addressed licensing concerns. +---------------------------------------------------------------------- +Tue Aug 22 14:07:23 2006 Michael Jennings (mej) + +Forgot one. +---------------------------------------------------------------------- +Tue Aug 22 14:38:15 2006 Michael Jennings (mej) + +Eterm 0.9.4 is final. +---------------------------------------------------------------------- +Tue Sep 19 17:07:28 2006 Michael Jennings (mej) + +libscream.c is licensed just like Eterm. +---------------------------------------------------------------------- +Wed Oct 18 13:35:18 2006 Michael Jennings (mej) + +Fixed a typo and some logic errors in libscream located by Mike +Frysinger . +---------------------------------------------------------------------- +Mon Oct 30 16:11:47 2006 Michael Jennings (mej) + +Patch from Jason McCarver to support -S/--sticky +option for "sticky" (i.e., present on all desktops) startup. +---------------------------------------------------------------------- +Tue Jul 3 20:48:46 2007 Michael Jennings (mej) + +Remove some cruft from kEsetroot. +---------------------------------------------------------------------- +Wed May 14 12:42:51 2008 Michael Jennings (mej) + +Patch from Kim Woelders : + + There is a race problem with Eterm during startup related to the + shell LINES/COLUMNS env vars. + + If the WM changes the window size (e.g. due to saved settings) + before mapping the window, sometimes the shell will set LINES and + COLUMNS according to the old/incorrect size and sometimes to the + new/correct size, depending on wheter the call to tt_winsize() at + command.c line 2322 (by the shell child process) or the + tt_resize() (by the Eterm process) due to the ConfigureNotify + caused by the resize (or WM ICCCM ConfigureNotify) operation + happens first. + +The call in question was added by Azundris for Escreen. So far +Escreen seems to be behaving properly with this patch applied, but all +my Eterm windows (Escreen and otherwise) are pre-sized with -g anyway. +So I'm going to keep my eye on it for awhile. In case of trouble, +change the "#if 0" to "#ifdef ESCREEN" to revert to previous behavior +when in Escreen mode. Normal operation should not require the call in +question. +---------------------------------------------------------------------- +Wed May 14 14:54:16 2008 Michael Jennings (mej) + +Modified patch from hsim@gmx.li to allow setting of the "Urgent" hint +on beep. +---------------------------------------------------------------------- +Wed May 14 15:26:13 2008 Michael Jennings (mej) + +Patch from Emmanuel Anne to fix cut/paste +with KDE applications. +---------------------------------------------------------------------- +Wed May 14 16:09:04 2008 Michael Jennings (mej) + +(Correct) fix for CVE-2008-1692. Eterm no longer defaults to using +":0" for $DISPLAY due to the possibility that an attacker can create a +fake X server on a shared system, intercept the Eterm X connection, +and send fake keystrokes to the victim's Eterm to execute arbitrary +commands as that user. + +The previous fix, while it did indeed correct the vulnerability, broke +the --display option. The original fix from Bernhard Link was more +correct, albeit not quite on target. +---------------------------------------------------------------------- +Wed Jun 11 20:18:44 2008 Michael Jennings (mej) + +Eterm 0.9.5 release. +---------------------------------------------------------------------- +Tue Dec 16 22:03:54 2008 Michael Jennings (mej) + +Fix compile errors related to the removal of unnecessary typecasting +macros. +---------------------------------------------------------------------- +Mon Jan 5 23:50:28 2009 Michael Jennings (mej) + +Remove fontset fallbacks. I think this might help speed up the load +time slowness some people are seeing. Let's find out. +---------------------------------------------------------------------- +Tue Jan 6 01:03:35 2009 Michael Jennings (mej) + +Prevent blank Escreen buttonbar on startup. +---------------------------------------------------------------------- +Tue Jan 6 01:08:47 2009 Michael Jennings (mej) + +Update copyright dates and fix a bad license. +---------------------------------------------------------------------- +Sun Oct 25 11:35:50 2009 Michael Jennings (mej) + +Merge code from 0.9.5. 0.10 branch is now up-to-date. +---------------------------------------------------------------------- diff --git a/Eterm.spec b/Eterm.spec index f0ca571..1adc7ca 100644 --- a/Eterm.spec +++ b/Eterm.spec @@ -3,6 +3,9 @@ %endif %define __os_install_post /usr/lib/rpm/brp-compress +%if %{?optflags:1}0 +%define optflags ${RPM_OPT_FLAGS:--O0 -g3} +%endif Summary: Enlightened terminal emulator Name: Eterm @@ -11,13 +14,13 @@ Version: 0.10 Release: 0.%(date '+%Y%m%d') License: BSD Group: User Interface/X -Requires: imlib2, imlib2-loader_jpeg, imlib2-loader_png -#BuildSuggests: xorg-x11-devel -BuildRequires: libast imlib2-devel XFree86-devel -Source0: ftp://ftp.eterm.org/pub/Eterm/%{name}-%{version}.tar.%{compression} -Source1: ftp://ftp.eterm.org/pub/Eterm/%{name}-bg-%{version}.tar.%{compression} URL: http://www.eterm.org/ -BuildRoot: /var/tmp/%{name}-%{version}-root +Source0: http://www.eterm.org/download/%{name}-%{version}.tar.%{compression} +Source1: http://www.eterm.org/download/%{name}-bg-%{version}.tar.%{compression} +#BuildSuggests: xorg-x11-devel XFree86-devel xorg-x11-proto-devel libXext-devel libXt-devel freetype-devel +BuildRequires: libast imlib2-devel +Requires: imlib2, imlib2-loader_jpeg, imlib2-loader_png +BuildRoot: %{?_tmppath}%{!?_tmppath:/var/tmp}/%{name}-%{version}-root %description Eterm is a color vt102 terminal emulator with enhanced graphical @@ -32,8 +35,7 @@ have the Imlib2 library installed. %setup -a 1 %build -#CFLAGS="$RPM_OPT_FLAGS" -CFLAGS="-O0 -g3" +CFLAGS="%{optflags}" export CFLAGS # When using the configure macro, I also specify all the directory @@ -45,21 +47,21 @@ export CFLAGS %{__make} %{?mflags} %install -rm -rf $RPM_BUILD_ROOT +%{__rm} -rf $RPM_BUILD_ROOT # If the configure macro is used above (which it is), there # is NO reason to use the makeinstall macro here, so don't. %{__make} install DESTDIR=$RPM_BUILD_ROOT %{?mflags_install} ( cd $RPM_BUILD_ROOT - mv .%{_bindir}/%{name} .%{_bindir}/%{name}-%{version} + %{__mv} .%{_bindir}/%{name} .%{_bindir}/%{name}-%{version} cd $RPM_BUILD_ROOT%{_bindir} - ln -f -s %{name}-%{version} %{name} + %{__ln_s} -f %{name}-%{version} %{name} cd $RPM_BUILD_ROOT chmod +x .%{_libdir}/lib*so* ||: ) -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/X11/applnk/Utilities +%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/X11/applnk/Utilities cat > $RPM_BUILD_ROOT%{_sysconfdir}/X11/applnk/Utilities/Eterm.desktop < +#endif +#ifdef HAVE_X11_XLIB_H +# include +#endif + ]) +AC_CHECK_LIB(XRes, XResQueryExtension, + [ + GRLIBS="$GRLIBS -lXRes" + AC_DEFINE(HAVE_XRES_EXT, , [Define if we have the XResource extension.]) + ]) + AC_MSG_CHECKING(for Greek keyboard support) AC_ARG_ENABLE(greek, [ --enable-greek compile with support for Greek keyboards], [ diff --git a/debian/copyright b/debian/copyright index 5a72c45..ba88513 100644 --- a/debian/copyright +++ b/debian/copyright @@ -8,7 +8,7 @@ Upstream Author: Michael Jennings Copyright: - Copyright (C) 1997-2004, Michael Jennings + Copyright (C) 1997-2009, Michael Jennings Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to diff --git a/debian/rules b/debian/rules old mode 100644 new mode 100755 diff --git a/doc/Eterm.1.in b/doc/Eterm.1.in index 9c3ca42..f55f580 100644 --- a/doc/Eterm.1.in +++ b/doc/Eterm.1.in @@ -457,6 +457,9 @@ Display the scrollbar only when the Eterm window is focused. .BR "\-x", " \-\-borderless" This option forces Eterm to have no borders. .TP +.BR "\-S", " \-\-sticky" +Start Eterm as a sticky window (shows on all desktops) +.TP .BR "\-m", " \-\-map-alert" Un-iconify on beep. .TP @@ -1734,6 +1737,11 @@ If true (default), any colored text (that is, any text not rendered using the default foreground color) will not be given any other special treatment for bolding (e.g., bold font or bold overstrike). .RE + +.BI sticky " boolean" +.RS 5 +If true, Eterm will make its window sticky (shows on all desktops). +.RE .RE .TP diff --git a/doc/Eterm.tcap b/doc/Eterm.tcap deleted file mode 100644 index 821d708..0000000 --- a/doc/Eterm.tcap +++ /dev/null @@ -1,19 +0,0 @@ -Eterm|Eterm Terminal Emulator (X11 Window System):\ - :am:bw:eo:km:mi:ms:xn:xo:\ - :co#80:it#8:li#24:lm#0:pa#64:Co#8:AF=\E[3%dm:AB=\E[4%dm:op=\E[39m\E[49m:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\E[7~:K2=\EOu:K3=\E[5~:K4=\E[8~:K5=\E[6~:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:cd=\E[J:\ - :ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=\E[B:\ - :ec=\E[%dX:ei=\E[4l:ho=\E[H:i1=\E[?47l\E>\E[?1l:ic=\E[@:\ - :im=\E[4h:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l:\ - :k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\ - :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:kD=\E[3~:\ - :kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=^H:kd=\E[B:ke=:kh=\E[7~:\ - :kl=\E[D:kr=\E[C:ks=:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:\ - :me=\E[m\017:mr=\E[7m:nd=\E[C:rc=\E8:\ - :sc=\E7:se=\E[27m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:ue=\E[24m:up=\E[A:\ - :us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:\ - :ac=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~: diff --git a/pix/bar_horizontal_1.png b/pix/bar_horizontal_1.png index c607c80..af935d7 100644 Binary files a/pix/bar_horizontal_1.png and b/pix/bar_horizontal_1.png differ diff --git a/pix/bar_horizontal_2.png b/pix/bar_horizontal_2.png index a14618b..50a1cfa 100644 Binary files a/pix/bar_horizontal_2.png and b/pix/bar_horizontal_2.png differ diff --git a/pix/bar_horizontal_3.png b/pix/bar_horizontal_3.png index c03719d..1d0bd2d 100644 Binary files a/pix/bar_horizontal_3.png and b/pix/bar_horizontal_3.png differ diff --git a/pix/bar_vertical_1.png b/pix/bar_vertical_1.png index c2e67c5..76921e1 100644 Binary files a/pix/bar_vertical_1.png and b/pix/bar_vertical_1.png differ diff --git a/pix/bar_vertical_2.png b/pix/bar_vertical_2.png index fa8d29d..59b2236 100644 Binary files a/pix/bar_vertical_2.png and b/pix/bar_vertical_2.png differ diff --git a/pix/bar_vertical_3.png b/pix/bar_vertical_3.png index 142e315..c7cb668 100644 Binary files a/pix/bar_vertical_3.png and b/pix/bar_vertical_3.png differ diff --git a/pix/button_arrow_down_1.png b/pix/button_arrow_down_1.png index f463b87..59ac1ca 100644 Binary files a/pix/button_arrow_down_1.png and b/pix/button_arrow_down_1.png differ diff --git a/pix/button_arrow_down_2.png b/pix/button_arrow_down_2.png index 9cdf303..c72ba29 100644 Binary files a/pix/button_arrow_down_2.png and b/pix/button_arrow_down_2.png differ diff --git a/pix/button_arrow_down_3.png b/pix/button_arrow_down_3.png index e7fda96..8f1884b 100644 Binary files a/pix/button_arrow_down_3.png and b/pix/button_arrow_down_3.png differ diff --git a/pix/button_arrow_up_1.png b/pix/button_arrow_up_1.png index b9d76d6..5941840 100644 Binary files a/pix/button_arrow_up_1.png and b/pix/button_arrow_up_1.png differ diff --git a/pix/button_arrow_up_2.png b/pix/button_arrow_up_2.png index d76985f..ddba250 100644 Binary files a/pix/button_arrow_up_2.png and b/pix/button_arrow_up_2.png differ diff --git a/pix/button_arrow_up_3.png b/pix/button_arrow_up_3.png index 016e869..4972fcd 100644 Binary files a/pix/button_arrow_up_3.png and b/pix/button_arrow_up_3.png differ diff --git a/pix/exit.png b/pix/exit.png index 0baf109..f940171 100644 Binary files a/pix/exit.png and b/pix/exit.png differ diff --git a/pix/help.png b/pix/help.png index 512f8a4..d95dab4 100644 Binary files a/pix/help.png and b/pix/help.png differ diff --git a/pix/menu1.png b/pix/menu1.png index 3c75544..c7493f4 100644 Binary files a/pix/menu1.png and b/pix/menu1.png differ diff --git a/pix/menu2.png b/pix/menu2.png index d69251e..6c4152a 100644 Binary files a/pix/menu2.png and b/pix/menu2.png differ diff --git a/pix/menu3.png b/pix/menu3.png index d1a8bd0..85c8920 100644 Binary files a/pix/menu3.png and b/pix/menu3.png differ diff --git a/pix/thumb_1.png b/pix/thumb_1.png index e7d6674..570cead 100644 Binary files a/pix/thumb_1.png and b/pix/thumb_1.png differ diff --git a/pix/thumb_2.png b/pix/thumb_2.png index c20fdff..ba97eaf 100644 Binary files a/pix/thumb_2.png and b/pix/thumb_2.png differ diff --git a/reformat-code b/reformat-code index c18365e..8d908ed 100755 --- a/reformat-code +++ b/reformat-code @@ -9,8 +9,9 @@ done for i in *.c src/*.c utils/*.c ; do if test -f $i; then echo Reformatting $i - indent -bad -bap -bbo -br -brs -cdw -ce -ci4 -cli4 -cs -di1 -i4 -l132 \ - -lp -lps -nbc -nbfda -npcs -nprs -nsob -nss -nut -psl -saf -sai -saw $TYPENAMES $i + indent -bad -bap -bbo -bli0 -br -brs -cdw -ce -ci4 -cli4 -cs -di1 -i4 -l132 \ + -lp -lps -nbc -nbfda -npcs -nprs -nsob -nss -nut -psl -saf -sai -saw -sbi0 \ + $TYPENAMES $i fi done diff --git a/src/Makefile.am b/src/Makefile.am index 9063e07..0fdfacd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,14 +9,14 @@ MMX_OBJS = mmx_cmod.lo SSE2_SRCS = sse2_cmod.c SSE2_OBJS = sse2_cmod.lo -libEterm_la_SOURCES = actions.c actions.h buttons.c buttons.h command.c \ - command.h draw.c draw.h e.c e.h eterm_debug.h eterm_utmp.h \ - events.c events.h feature.h font.c font.h grkelot.c \ - grkelot.h icon.h menus.c menus.h misc.c misc.h netdisp.c \ - options.c options.h pixmap.c pixmap.h profile.h screen.c \ - screen.h script.c script.h scrollbar.c scrollbar.h \ - startup.c startup.h system.c system.h term.c term.h \ - timer.c timer.h utmp.c windows.c windows.h defaultfont.c \ +libEterm_la_SOURCES = actions.c actions.h buttons.c buttons.h command.c \ + command.h draw.c draw.h e.c e.h eterm_debug.h eterm_utmp.h \ + events.c events.h feature.h font.c font.h grkelot.c \ + grkelot.h icon.h menus.c menus.h misc.c misc.h \ + options.c options.h pixmap.c pixmap.h profile.h screen.c \ + screen.h script.c script.h scrollbar.c scrollbar.h \ + startup.c startup.h system.c system.h term.c term.h \ + timer.c timer.h utmp.c windows.c windows.h defaultfont.c \ defaultfont.h libscream.c scream.h screamcfg.h EXTRA_libEterm_la_SOURCES = $(MMX_SRCS) $(SSE2_SRCS) @@ -39,9 +39,9 @@ Eterm_DEPENDENCIES = libEterm.la Eterm_LDFLAGS = -rpath $(libdir):$(pkglibdir) Eterm_LDADD = libEterm.la -EXTRA_DIST = mmx_cmod.S sse2_cmod.c +EXTRA_DIST = gdb.scr mmx_cmod.S sse2_cmod.c MAINTAINERCLEANFILES=Makefile.in install-exec-hook: $(mkinstalldirs) $(DESTDIR)$(pkgdatadir) - test ! -z "$(GDB_CMD_FILE)" && $(INSTALL_DATA) gdb.scr $(DESTDIR)$(pkgdatadir)/ || : + test ! -z "$(GDB_CMD_FILE)" && $(INSTALL_DATA) $(srcdir)/gdb.scr $(DESTDIR)$(pkgdatadir)/ || : diff --git a/src/actions.c b/src/actions.c index c51019c..064dbe0 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/actions.h b/src/actions.h index 1522b23..c0fe422 100644 --- a/src/actions.h +++ b/src/actions.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/buttons.c b/src/buttons.c index 755d595..9c3bad1 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/buttons.h b/src/buttons.h index 8134514..6c3b3b4 100644 --- a/src/buttons.h +++ b/src/buttons.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/command.c b/src/command.c index 57d2bfc..ef4119b 100644 --- a/src/command.c +++ b/src/command.c @@ -1,38 +1,25 @@ -/*--------------------------------*-C-*---------------------------------* - * File: command.c +/* + * Copyright (C) 1997-2009, Michael Jennings + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies of the Software, its documentation and marketing & publicity + * materials, and acknowledgment shall be given in the documentation, materials + * and software packages that this Software was used. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* notes: */ -/*----------------------------------------------------------------------* - * Copyright 1992 John Bovey, University of Kent at Canterbury. - * - * You can do what you like with this source code as long as - * you don't try to make money out of it and you include an - * unaltered copy of this message (including the copyright). - * - * This module has been very heavily modified by R. Nation - * - * No additional restrictions are applied - * - * Additional modification by Garrett D'Amore to - * allow vt100 printing. No additional restrictions are applied. - * - * Integrated modifications by Steven Hirsch to - * properly support X11 mouse report mode and support for DEC - * "private mode" save/restore functions. - * - * Integrated key-related changes by Jakub Jelinek - * to handle Shift+function keys properly. - * Should be used with enclosed termcap / terminfo database. - * - * Extensive modifications by mj olesen - * No additional restrictions. - * - * Further modification and cleanups for Solaris 2.x and Linux 1.2.x - * by Raul Garcia Garcia . No additional restrictions. - * - * As usual, the author accepts no responsibility for anything, nor does - * he guarantee anything whatsoever. - *----------------------------------------------------------------------*/ static const char cvs_ident[] = "$Id$"; @@ -67,6 +54,9 @@ static const char cvs_ident[] = "$Id$"; #include #include #include +#ifdef HAVE_XRES_EXT +# include +#endif #ifdef PTY_GRP_NAME # include #endif @@ -147,6 +137,7 @@ TW_DECL_MAGIC(libscream_magic); static RETSIGTYPE handle_child_signal(int); static RETSIGTYPE handle_exit_signal(int); static RETSIGTYPE handle_crash(int); +static RETSIGTYPE x_resource_dump(int); /* local variables */ int my_ruid, my_euid, my_rgid, my_egid; @@ -999,13 +990,15 @@ void dump_stack_trace(void) { char cmd[256]; +#ifdef GDB struct stat st; +#endif #ifdef NO_STACK_TRACE return; #endif - print_error("Attempting to dump a stack trace....\n"); + libast_print_error("Attempting to dump a stack trace....\n"); signal(SIGTSTP, exit); /* Don't block on tty output, just die */ #ifdef HAVE_U_STACK_TRACE @@ -1027,7 +1020,7 @@ dump_stack_trace(void) snprintf(cmd, sizeof(cmd), "/bin/echo 'where\ndetach' | " DBX " %s %d", orig_argv0, getpid()); # endif #else - print_error("Your system does not support any of the methods Eterm uses. Exiting.\n"); + libast_print_error("Your system does not support any of the methods Eterm uses. Exiting.\n"); return; #endif signal(SIGALRM, (eterm_sighandler_t) hard_exit); @@ -1080,7 +1073,7 @@ static RETSIGTYPE handle_exit_signal(int sig) { - print_error("Received terminal signal %s (%d)\n", sig_to_str(sig), sig); + libast_print_error("Received terminal signal %s (%d)\n", sig_to_str(sig), sig); signal(sig, SIG_DFL); #ifdef UTMP_SUPPORT @@ -1099,7 +1092,7 @@ static RETSIGTYPE handle_crash(int sig) { - print_error("Received terminal signal %s (%d)\n", sig_to_str(sig), sig); + libast_print_error("Received terminal signal %s (%d)\n", sig_to_str(sig), sig); signal(sig, SIG_DFL); /* Let the OS handle recursive seg faults */ /* Lock down security so we don't write any core files as root. */ @@ -1114,6 +1107,116 @@ handle_crash(int sig) SIG_RETURN(0); } +#ifdef HAVE_XRES_EXT +static RETSIGTYPE +x_resource_dump(int sig) +{ + int event_base, error_base, count, i; + unsigned long bytes; + XResClient *clients = NULL; + XResType *types = NULL; + Atom pixmap_atom, gc_atom, font_atom; + pid_t my_pid; + char *title, *ptitle; + + USE_VAR(sig); + my_pid = getpid(); + + /* Create type atoms for future use. */ + pixmap_atom = XInternAtom(Xdisplay, "PIXMAP", False); + gc_atom = XInternAtom(Xdisplay, "GC", False); + font_atom = XInternAtom(Xdisplay, "FONT", False); + + /* Look at what *we* think our consumption is. */ +#if DEBUG >= DEBUG_MEM + if (DEBUG_LEVEL >= DEBUG_MEM) { + PIXMAP_DUMP(); + GC_DUMP(); + } +#endif + + /* Make sure we have the extension loaded. */ + if (!XResQueryExtension(Xdisplay, &event_base, &error_base)) { + fprintf(stderr, "XResource extension not available on current display.\n"); + return; + } + D_X11(("Got XResource extension values: %d (0x%08x) / %d (0x%08x)\n", + event_base, event_base, error_base, error_base)); + + /* Get a list of X clients and find our window ID in the list. */ + if (!XResQueryClients(Xdisplay, &count, &clients)) { + if (clients) { + XFree(clients); + } + D_X11((" -> Unable to query clients.\n")); + return; + } + D_X11((" -> Got %d clients.\n", count)); + + if (count == 0) { + D_X11((" -> Nothing to do!\n")); + return; + } + + for (i = 0; i < count; i++) { + Window win; + + win = clients[i].resource_base & (~clients[i].resource_mask); + D_X11(("Checking client: base %d, mask %d, window 0x%08x\n", clients[i].resource_base, + clients[i].resource_mask, win)); + if ((TermWin.parent & (~clients[i].resource_mask)) == win) { + break; + } + } + if (i == count) { + D_X11((" -> No client found with window 0x%08x (0x%08x\n", TermWin.parent, + (TermWin.parent & (~clients[i].resource_mask)))); + return; + } + + /* Request resource info for our client ID. */ + if (!XResQueryClientResources(Xdisplay, clients[i].resource_base, &count, &types) + || !XResQueryClientPixmapBytes(Xdisplay, clients[i].resource_base, &bytes)) { + if (types) { + XFree(types); + } + D_X11((" -> Unable to query resources.\n")); + return; + } + D_X11((" -> Got %d types.\n", count)); + + /* Get and sanitize window title for easier identification. */ + XFetchName(Xdisplay, TermWin.parent, &title); + if (title) { + for (ptitle = title; *ptitle; ptitle++) { + if (!isprint(*ptitle)) { + *ptitle = ' '; + } + } + } + + for (i = 0; i < count; i++) { + if (types[i].resource_type == pixmap_atom) { + fprintf(stderr, "Process %lu, window 0x%08x (%s): %d pixmaps (%lu bytes).\n", (unsigned long) my_pid, + (unsigned int) TermWin.parent, NONULL(title), types[i].count, bytes); + } else if (types[i].resource_type == gc_atom) { + fprintf(stderr, "Process %lu, window 0x%08x (%s): %d GC's (%d bytes).\n", (unsigned long) my_pid, + (unsigned int) TermWin.parent, NONULL(title), types[i].count, + types[i].count * (sizeof(XGCValues) + sizeof(GC))); + } else if (types[i].resource_type == font_atom) { + fprintf(stderr, "Process %lu, window 0x%08x (%s): %d fonts (%d bytes).\n", (unsigned long) my_pid, + (unsigned int) TermWin.parent, NONULL(title), types[i].count, + types[i].count * (sizeof(XFontStruct) + sizeof(Font))); + } + } + XFree(clients); + XFree(types); + if (title) { + XFree(title); + } +} +#endif + void install_handlers(void) { @@ -1133,6 +1236,11 @@ install_handlers(void) signal(SIGILL, handle_crash); signal(SIGSYS, handle_crash); signal(SIGPIPE, SIG_IGN); +#ifdef HAVE_XRES_EXT + signal(SIGUSR1, x_resource_dump); +#else + signal(SIGUSR1, SIG_IGN); +#endif } /* Exit gracefully, clearing the utmp entry and restoring tty attributes */ @@ -1151,15 +1259,16 @@ clean_exit(void) font_cache_clear(); eterm_font_list_clear(); # ifdef PIXMAP_SUPPORT - FOREACH_IMAGE(free_eterm_image(&(images[idx])); - ); + FOREACH_IMAGE({ + free_eterm_image(&(images[idx])); + }); # endif for (i = 0; i < NRS_COLORS; i++) { if (rs_color[i]) { FREE(rs_color[i]); } } - conf_free_subsystem(); + spifconf_free_subsystem(); # ifdef USE_XIM if (xim_input_context) { XUnsetICFocus(xim_input_context); @@ -1293,15 +1402,15 @@ svr_get_pty(void) return (-1); } else { if (grantpt(fd) != 0) { - print_error("grantpt(%d) failed: %s\n", fd, strerror(errno)); + libast_print_error("grantpt(%d) failed: %s\n", fd, strerror(errno)); return (-1); } else if (unlockpt(fd) != 0) { - print_error("unlockpt(%d) failed: %s\n", fd, strerror(errno)); + libast_print_error("unlockpt(%d) failed: %s\n", fd, strerror(errno)); return (-1); } else { ptydev = ttydev = ptsname(fd); if (ttydev == NULL) { - print_error("ptsname(%d) failed: %s\n", fd, strerror(errno)); + libast_print_error("ptsname(%d) failed: %s\n", fd, strerror(errno)); return (-1); } } @@ -1366,7 +1475,7 @@ get_pty(void) fcntl(fd, F_SETFL, O_NDELAY); return (fd); } else { - print_error("Can't open pseudo-tty -- %s\n", strerror(errno)); + libast_print_error("Can't open pseudo-tty -- %s\n", strerror(errno)); return (-1); } } @@ -1399,10 +1508,10 @@ get_tty(void) privileges(INVOKE); if (ttydev == NULL) { - print_error("Slave tty device name is NULL. Failed to open slave pty.\n"); + libast_print_error("Slave tty device name is NULL. Failed to open slave pty.\n"); exit(EXIT_FAILURE); } else if ((fd = open(ttydev, O_RDWR)) < 0) { - print_error("Can't open slave tty %s -- %s\n", ttydev, strerror(errno)); + libast_print_error("Can't open slave tty %s -- %s\n", ttydev, strerror(errno)); exit(EXIT_FAILURE); } else { D_TTY(("Opened slave tty %s\n", ttydev)); @@ -1746,33 +1855,34 @@ create_fontset(const char *font1, const char *font2) XFontSet fontset = 0; char *fontname, **ml, *ds; int mc; - const char fs_base[] = ",-misc-fixed-*-r-*-*-*-120-*-*-*-*-*-*,*"; + /*const char fs_base[] = ",-misc-fixed-*-r-*-*-*-120-*-*-*-*-*-*,*";*/ ASSERT_RVAL(font1 != NULL, (XFontSet) 0); if (font2) { - fontname = MALLOC(strlen(font1) + strlen(font2) + sizeof(fs_base) + 2); + fontname = MALLOC(strlen(font1) + strlen(font2) /*+ sizeof(fs_base)*/ + 2); if (fontname) { strcpy(fontname, font1); strcat(fontname, ","); strcat(fontname, font2); - strcat(fontname, fs_base); + /*strcat(fontname, fs_base);*/ } } else { - fontname = MALLOC(strlen(font1) + sizeof(fs_base) + 1); + fontname = MALLOC(strlen(font1) /*+ sizeof(fs_base)*/ + 1); if (fontname) { strcpy(fontname, font1); - strcat(fontname, fs_base); + /*strcat(fontname, fs_base);*/ } } if (fontname) { setlocale(LC_ALL, ""); - fontset = XCreateFontSet(Xdisplay, fontname, &ml, &mc, &ds); - D_FONT(("Created fontset from %s, %d missing charsets, default string \"%s\".\n", fontname, mc, NONULL(ds))); + fontset = XCreateFontSet(Xdisplay, fontname, &ml, &mc, NULL); + D_FONT(("Created fontset from %s, %d missing charsets (\"%s\").\n", fontname, mc, + ((mc > 0) ? (ml[0]) : ("N/A")))); FREE(fontname); if (mc) { XFreeStringList(ml); - fontset = 0; + /*fontset = 0;*/ } } return fontset; @@ -1797,7 +1907,7 @@ init_locale(void) XSetLocaleModifiers(""); TermWin.fontset = (XFontSet) 0; if ((locale == NULL) || (!XSupportsLocale())) { - print_warning("Locale not supported; defaulting to portable \"C\" locale.\n"); + libast_print_warning("Locale not supported; defaulting to portable \"C\" locale.\n"); locale = setlocale(LC_ALL, "C"); XSetLocaleModifiers(""); REQUIRE(locale); @@ -1968,13 +2078,13 @@ xim_real_init(void) destroy_cb.callback = xim_destroy_cb; destroy_cb.client_data = NULL; if (XSetIMValues(xim_input_method, XNDestroyCallback, &destroy_cb, NULL)) { - print_error("Could not set destroy callback to IM\n"); + libast_print_error("Could not set destroy callback to IM\n"); } } #endif if ((XGetIMValues(xim_input_method, XNQueryInputStyle, &xim_styles, NULL)) || (!xim_styles)) { - print_error("input method doesn't support any style\n"); + libast_print_error("input method doesn't support any style\n"); XCloseIM(xim_input_method); return -1; } @@ -2008,14 +2118,14 @@ xim_real_init(void) XFree(xim_styles); if (found == 0) { - print_error("input method doesn't support my preedit type\n"); + libast_print_error("input method doesn't support my preedit type\n"); XCloseIM(xim_input_method); return -1; } if ((xim_input_style != (XIMPreeditNothing | XIMStatusNothing)) && (xim_input_style != (XIMPreeditArea | XIMStatusArea)) && (xim_input_style != (XIMPreeditPosition | XIMStatusNothing))) { - print_error("This program does not support the preedit type\n"); + libast_print_error("This program does not support the preedit type\n"); XCloseIM(xim_input_method); return -1; } @@ -2046,7 +2156,7 @@ xim_real_init(void) XFree(status_attr); } if (xim_input_context == NULL) { - print_error("Failed to create input context\n"); + libast_print_error("Failed to create input context\n"); XCloseIM(xim_input_method); return -1; } @@ -2152,7 +2262,7 @@ run_command(char **argv) # if defined (__sun__) on_exit(clean_exit, NULL); /* non-ANSI exit handler */ # else - print_error("no atexit(), UTMP entries can't be cleaned\n"); + libast_print_error("no atexit(), UTMP entries can't be cleaned\n"); # endif #endif @@ -2180,7 +2290,7 @@ run_command(char **argv) cmd_pid = fork(); D_CMD(("After fork(), cmd_pid == %d\n", cmd_pid)); if (cmd_pid < 0) { - print_error("fork(): %s\n", strerror(errno)); + libast_print_error("fork(): %s\n", strerror(errno)); return (-1); } if (cmd_pid == 0) { @@ -2212,7 +2322,11 @@ run_command(char **argv) get_tty(); SET_TTYMODE(0, &tio); - tt_winsize(0); +#if 0 + if (TermWin.screen_mode != NS_MODE_NONE) { + tt_winsize(0); + } +#endif /* become virtual console, fail silently */ if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_CONSOLE)) { @@ -2257,7 +2371,7 @@ run_command(char **argv) #endif D_CMD(("[%d] About to spawn shell\n", getpid())); if (chdir(initial_dir)) { - print_warning("Unable to chdir to \"%s\" -- %s\n", initial_dir, strerror(errno)); + libast_print_warning("Unable to chdir to \"%s\" -- %s\n", initial_dir, strerror(errno)); } if (argv != NULL) { #if DEBUG >= DEBUG_CMD @@ -2271,7 +2385,7 @@ run_command(char **argv) #endif D_CMD(("[%d] execvp(\"%s\", %8p) is next. I'm outta here!\n", getpid(), NONULL(argv[0]), argv)); execvp(argv[0], argv); - print_error("execvp() failed, cannot execute \"%s\": %s\n", argv[0], strerror(errno)); + libast_print_error("execvp() failed, cannot execute \"%s\": %s\n", argv[0], strerror(errno)); } else { const char *argv0, *shell; @@ -2288,7 +2402,7 @@ run_command(char **argv) argv0 = p; } execlp(shell, argv0, NULL); - print_error("execlp() failed, cannot execute \"%s\": %s\n", shell, strerror(errno)); + libast_print_error("execlp() failed, cannot execute \"%s\": %s\n", shell, strerror(errno)); } sleep(3); /* Sleep to make sure fork() returns in the parent, and so user can read error message */ exit(EXIT_FAILURE); @@ -2576,11 +2690,16 @@ err_msg(void *xd, int err, char *msg) static int inp_text(void *xd, int id, char *txt) { - USE_VAR(xd); + int which = (int) xd; USE_VAR(id); - D_ESCREEN(("Writing \"%s\" to subprocess.\n", safe_print_string(txt, strlen(txt)))); - tt_write(txt, strlen(txt)); + if (which) { + D_ESCREEN(("Writing \"%s\" to screen.\n", safe_print_string(txt, strlen(txt)))); + cmd_write(txt, strlen(txt)); + } else { + D_ESCREEN(("Writing \"%s\" to subprocess.\n", safe_print_string(txt, strlen(txt)))); + tt_write(txt, strlen(txt)); + } return NS_SUCC; } @@ -2609,11 +2728,10 @@ exe_prg(void *xd, char **argv) /****** Azundris' playthings :-) ******/ -#ifdef ESCREEN_FX #define DIRECT_MASK (~(RS_Cursor|RS_Select|RS_fontMask)) #define COLOUR_MASK (RS_fgMask|RS_bgMask) #define DIRECT_SET_SCREEN(x,y,fg,bg) (screen.text[ys+y])[x]=fg; (screen.rend[ys+y])[x]=bg&DIRECT_MASK; -#define CLEAR (1<<16) +#define CLEAR (RS_None | bgColor) static void direct_write_screen(int x, int y, char *fg, rend_t bg) @@ -2630,6 +2748,7 @@ direct_write_screen(int x, int y, char *fg, rend_t bg) } } +#ifdef ESCREEN_FX static void bosconian(int n) { @@ -2783,8 +2902,9 @@ waitstate(void *xd, int ms) matrix(31); unbosconian(); } - bosconian(4); + bosconian(20); unbosconian(); + scr_refresh(SLOW_REFRESH); } direct_write_screen(0, y++, " **** COMMODORE 64 BASIC V2 ****", (0 << 8) | CLEAR); @@ -2794,12 +2914,30 @@ waitstate(void *xd, int ms) screen.row = y; screen.col = 0; - scr_refresh(FAST_REFRESH); + scr_refresh(SLOW_REFRESH); sleep(dur); return 0; } +#else +static int +waitstate(void *xd, int ms) +{ + USE_VAR(xd); + + direct_write_screen(TERM_WINDOW_GET_REPORTED_COLS() / 2 - 17, TERM_WINDOW_GET_ROWS() / 2, + "**** Initializing, please wait ****", (15 << 9) | CLEAR); + screen.row = 0; + screen.col = 0; + + scr_refresh(SLOW_REFRESH); + + sleep((time_t) (ms / 1000)); + + return 0; + +} #endif static _ns_efuns * @@ -2830,9 +2968,7 @@ escreen_reg_funcs(void) ns_register_inp(efuns, input_dialog); ns_register_tab(efuns, menu_tab); -#ifdef ESCREEN_FX ns_register_fun(efuns, waitstate); -#endif return efuns; } @@ -3031,7 +3167,7 @@ init_command(char **argv) AT_LEAST(num_fds, ((unsigned int) (pipe_fd + 1))); } if ((cmd_fd = command_func(argv)) < 0) { - print_error("Unable to run sub-command.\n"); + libast_print_error("Unable to run sub-command.\n"); paused = 1; rs_finished_text = "Hit a key to exit..."; } @@ -3318,12 +3454,12 @@ cmd_getc(void) if (retval < 0) { if (cmd_fd >= 0 && FD_ISSET(cmd_fd, &readfds)) { if (errno != EINTR) { /* may have rcvd SIGCHLD or so */ - print_error(" (%ld) Error reading from tty -- %s\n", getpid(), strerror(errno)); + libast_print_error(" (%ld) Error reading from tty -- %s\n", getpid(), strerror(errno)); cmd_fd = -1; } } if (pipe_fd >= 0 && FD_ISSET(pipe_fd, &readfds)) { - print_error("Error reading from pipe -- %s\n", strerror(errno)); + libast_print_error("Error reading from pipe -- %s\n", strerror(errno)); pipe_fd = -1; } if (pipe_fd < 0 && cmd_fd < 0 && !paused) { @@ -3540,8 +3676,8 @@ main_loop(void) set_multichar_encoding("utf8"); } handle = iconv_open("WCHAR_T", "UTF-8"); - if (handle == SPIF_CAST_C(iconv_t) - 1) { - print_error("Unable to decode UTF-8 locale %s to WCHAR_T. Defaulting to portable C locale.\n", + if (handle == (iconv_t) -1) { + libast_print_error("Unable to decode UTF-8 locale %s to WCHAR_T. Defaulting to portable C locale.\n", setlocale(LC_ALL, "")); setlocale(LC_ALL, "C"); scr_add_lines(str, nlines, (cmdbuf_ptr - str)); @@ -3554,45 +3690,45 @@ main_loop(void) pinbuff = (char *) str; bufflen = cmdbuf_ptr - str; outlen = bufflen * 6; - poutbuff = outbuff = SPIF_CAST_C(char *) MALLOC(outlen); + poutbuff = outbuff = (char *) MALLOC(outlen); errno = 0; D_VT(("Allocated output buffer of %lu chars at %010p against input buffer of %lu\n", bufflen * 6, outbuff, bufflen)); - print_warning("Moo: %s\n", safe_print_string(str, bufflen)); + libast_print_warning("Moo: %s\n", safe_print_string(str, bufflen)); retval = iconv(handle, &pinbuff, &bufflen, &poutbuff, &outlen); outlen = (size_t) (poutbuff - outbuff); if (retval != (size_t) - 1) { errno = 0; } if (errno == E2BIG) { - print_error("My UTF-8 decode buffer was too small by %lu bytes?!\n", bufflen); + libast_print_error("My UTF-8 decode buffer was too small by %lu bytes?!\n", bufflen); } else if (errno == EILSEQ) { - print_error("Illegal multibyte sequence encountered at \'%c\' (0x%02x); skipping.\n", *pinbuff, *pinbuff); + libast_print_error("Illegal multibyte sequence encountered at \'%c\' (0x%02x); skipping.\n", *pinbuff, *pinbuff); *pinbuff = ' '; pinbuff++; } else if (errno == EINVAL) { D_VT(("Incomplete multibyte sequence encountered.\n")); - print_warning("Converted %lu input chars to %lu output chars before incomplete sequence.\n", + libast_print_warning("Converted %lu input chars to %lu output chars before incomplete sequence.\n", (cmdbuf_ptr - str), outlen); } else { - print_warning("Converted %lu input chars to %lu output chars.\n", (cmdbuf_ptr - str), outlen); + libast_print_warning("Converted %lu input chars to %lu output chars.\n", (cmdbuf_ptr - str), outlen); } - print_warning("Moo2: %s\n", safe_print_string(outbuff, outlen)); + libast_print_warning("Moo2: %s\n", safe_print_string(outbuff, outlen)); MEMSET(outbuff + outlen, 0, sizeof(wchar_t)); - wcbuff = SPIF_CAST_C(wchar_t *) outbuff; + wcbuff = (wchar_t *) outbuff; MEMSET(&mbs, 0, sizeof(mbstate_t)); outlen = wcsrtombs(NULL, &wcbuff, 0, &mbs) + 1; if (outlen > 0) { - outbuff = SPIF_CAST_C(char *) MALLOC(outlen); + outbuff = (char *) MALLOC(outlen); outlen = wcsrtombs(outbuff, &wcbuff, outlen, &mbs); if ((long) outlen >= 0) { FREE(wcbuff); - print_error("I win!\n"); + libast_print_error("I win!\n"); } else { - print_error("wcsrtombs() returned %ld (errno is %d (%s))\n", (unsigned long) outlen, errno, + libast_print_error("wcsrtombs() returned %ld (errno is %d (%s))\n", (unsigned long) outlen, errno, strerror(errno)); } if (pinbuff > (char *) str) { @@ -3600,7 +3736,7 @@ main_loop(void) scr_add_lines(outbuff, nlines, outlen); } } else { - print_error("wcsrtombs(NULL, %10p, 0) returned %ld (errno is %d (%s))\n", wcbuff, (unsigned long) outlen, + libast_print_error("wcsrtombs(NULL, %10p, 0) returned %ld (errno is %d (%s))\n", wcbuff, (unsigned long) outlen, errno, strerror(errno)); } FREE(outbuff); @@ -3703,7 +3839,7 @@ v_writeBig(int f, char *d, int len) v_bufend = v_bufptr + len; } else { /* no memory: ignore entire write request */ - print_error("cannot allocate buffer space\n"); + libast_print_error("cannot allocate buffer space\n"); v_buffer = v_bufstr; /* restore clobbered pointer */ c = 0; } diff --git a/src/command.h b/src/command.h index bf03998..4b40713 100644 --- a/src/command.h +++ b/src/command.h @@ -1,22 +1,25 @@ -/*--------------------------------*-C-*---------------------------------* - * File: command.h +/* + * Copyright (C) 1997-2009, Michael Jennings * - * Copyright 1992 John Bovey, University of Kent at Canterbury. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * You can do what you like with this source code as long as you don't try - * to make money out of it and you include an unaltered copy of this - * message (including the copyright). + * The above copyright notice and this permission notice shall be included in + * all copies of the Software, its documentation and marketing & publicity + * materials, and acknowledgment shall be given in the documentation, materials + * and software packages that this Software was used. * - * This module has been heavily modified by R. Nation - * - * No additional restrictions are applied. - * - * Additional modifications by mj olesen - * No additional restrictions are applied. - * - * As usual, the author accepts no responsibility for anything, nor does - * he guarantee anything whatsoever. - *----------------------------------------------------------------------*/ + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ #ifndef _COMMAND_H_ # define _COMMAND_H_ # include @@ -386,9 +389,6 @@ extern void tt_printf(const unsigned char *, ...); extern void main_loop(void); extern int v_doPending(void); extern void v_writeBig(int, char *, int); -#ifdef DISPLAY_IS_IP -extern char *network_display(const char *); -#endif _XFUNCPROTOEND diff --git a/src/draw.c b/src/draw.c index 5bd2c30..355e246 100644 --- a/src/draw.c +++ b/src/draw.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/draw.h b/src/draw.h index 6bf6693..9cf327a 100644 --- a/src/draw.h +++ b/src/draw.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/e.c b/src/e.c index ab77d35..d6d73e0 100644 --- a/src/e.c +++ b/src/e.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -104,8 +104,8 @@ enl_ipc_get_win(void) } /* Make sure the version string is within the acceptable range. */ - if (SPIF_CMP_IS_LESS(spiftool_version_compare(SPIF_CAST(charptr) str, SPIF_CAST(charptr) "0.16.4")) - || SPIF_CMP_IS_GREATER(spiftool_version_compare(SPIF_CAST(charptr) str, SPIF_CAST(charptr) "0.16.999"))) { + if (SPIF_CMP_IS_LESS(spiftool_version_compare((spif_charptr_t) str, (spif_charptr_t) "0.16.4")) + || SPIF_CMP_IS_GREATER(spiftool_version_compare((spif_charptr_t) str, (spif_charptr_t) "0.16.999"))) { D_ENL((" -> IPC version string \"%s\" out of range. I'll have to ignore it.\n")); ipc_win = None; } diff --git a/src/e.h b/src/e.h index 6055ffe..d29a123 100644 --- a/src/e.h +++ b/src/e.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/encoding.c b/src/encoding.c index 3fac8db..7ec76cf 100644 --- a/src/encoding.c +++ b/src/encoding.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/encoding.h b/src/encoding.h index a7a8762..d96c89a 100644 --- a/src/encoding.h +++ b/src/encoding.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/eterm_debug.h b/src/eterm_debug.h index 897ba5e..912c9f0 100644 --- a/src/eterm_debug.h +++ b/src/eterm_debug.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/eterm_utmp.h b/src/eterm_utmp.h index 472f5d9..b2e7a72 100644 --- a/src/eterm_utmp.h +++ b/src/eterm_utmp.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -69,8 +69,9 @@ # ifdef HAVE_LASTLOG_H # include # endif -# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__) +# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__) || defined(__DragonFly__) # include +# define NEW_BSD_UTMP # endif # ifdef HAVE_LIBUTEMPTER diff --git a/src/events.c b/src/events.c index fce85dd..99ca7aa 100644 --- a/src/events.c +++ b/src/events.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -200,6 +200,7 @@ event_win_is_parent(register event_dispatcher_data_t *data, Window win) unsigned char handle_key_press(event_t *ev) { + XWMHints *wm_hints; #ifdef COUNT_X_EVENTS static unsigned long keypress_cnt = 0; #endif @@ -212,6 +213,12 @@ handle_key_press(event_t *ev) if (!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_NO_INPUT))) { lookup_key(ev); } + if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_URG_ALERT)) { + wm_hints = XGetWMHints(Xdisplay, TermWin.parent); + wm_hints->flags &= ~XUrgencyHint; + XSetWMHints(Xdisplay, TermWin.parent, wm_hints); + XFree(wm_hints); + } PROF_DONE(handle_key_press); PROF_TIME(handle_key_press); return 1; @@ -451,6 +458,7 @@ handle_leave_notify(event_t *ev) unsigned char handle_focus_in(event_t *ev) { + XWMHints *wm_hints; D_EVENTS(("handle_focus_in(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window)); @@ -486,6 +494,12 @@ handle_focus_in(event_t *ev) if (xim_input_context != NULL) XSetICFocus(xim_input_context); #endif + if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_URG_ALERT)) { + wm_hints = XGetWMHints(Xdisplay, TermWin.parent); + wm_hints->flags &= ~XUrgencyHint; + XSetWMHints(Xdisplay, TermWin.parent, wm_hints); + XFree(wm_hints); + } } return 1; } @@ -872,7 +886,7 @@ xerror_handler(Display * display, XErrorEvent * event) strcpy(err_string, ""); XGetErrorText(display, event->error_code, err_string, sizeof(err_string)); - print_error("XError in function %s, resource 0x%08x (request %d.%d): %s (error %d)\n", + libast_print_error("XError in function %s, resource 0x%08x (request %d.%d): %s (error %d)\n", request_code_to_name(event->request_code), (int) event->resourceid, event->request_code, event->minor_code, err_string, event->error_code); #if DEBUG > DEBUG_X11 @@ -880,6 +894,6 @@ xerror_handler(Display * display, XErrorEvent * event) dump_stack_trace(); } #endif - print_error("Attempting to continue...\n"); + libast_print_error("Attempting to continue...\n"); return 0; } diff --git a/src/events.h b/src/events.h index 6ba747b..8dc09d2 100644 --- a/src/events.h +++ b/src/events.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/feature.h b/src/feature.h index 798022a..59a5666 100644 --- a/src/feature.h +++ b/src/feature.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -54,7 +54,9 @@ # endif # ifdef __GNUC__ -# define _GNU_SOURCE +# ifndef _GNU_SOURCE +# define _GNU_SOURCE +# endif # else # define _XOPEN_SOURCE 600 # define _XOPEN_SOURCE_EXTENDED 1 @@ -95,7 +97,6 @@ # include # include -# define LIBAST_COMPAT_05_API 1 # include # include "eterm_debug.h" @@ -111,8 +112,9 @@ /* Disable the secondary screen ("\E[?47h" / "\E[?47l") */ /* #define NO_SECONDARY_SCREEN */ -/* The number of screenfuls between refreshes. */ -# define REFRESH_PERIOD 2 +/* The number of screenfuls between refreshes. Anything higher than 1 + * will cause gaps in the scrollback buffer. */ +# define REFRESH_PERIOD 1 /* This will force clearing of characters before writing new ones on top of * them. This is experimental - added in order to try and fix pixel dropping @@ -206,9 +208,6 @@ /********************* Miscellaneous options *********************/ -/* To have $DISPLAY and the "\E[7n" response be IP addresses rather than FQDN's */ -/* #define DISPLAY_IS_IP */ - /* To have "\E[7n" reply with the display name. This is a potential security risk, * so its use is discouraged and unsupported. */ /* #define ENABLE_DISPLAY_ANSWER */ @@ -300,6 +299,10 @@ inline void *memmove(void *, const void *, size_t); # define NO_DELETE_KEY /* These systems seem to be anal this way*/ #endif +#if !defined(HAVE_X11_EXTENSIONS_XRES_H) +# undef HAVE_XRES_EXT +#endif + #ifndef PATH_ENV # define PATH_ENV "ETERMPATH" #endif diff --git a/src/font.c b/src/font.c index 0fc68a9..17f8fd9 100644 --- a/src/font.c +++ b/src/font.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -417,9 +417,9 @@ load_font(const char *name, const char *fallback, unsigned char type) /* No match in the cache, so we'll have to add it. */ if (type == FONT_TYPE_X) { if ((xfont = XLoadQueryFont(Xdisplay, name)) == NULL) { - print_error("Unable to load font \"%s\". Falling back on \"%s\"\n", name, fallback); + libast_print_error("Unable to load font \"%s\". Falling back on \"%s\"\n", name, fallback); if ((xfont = XLoadQueryFont(Xdisplay, fallback)) == NULL) { - fatal_error("Couldn't load the fallback font either. Giving up.\n"); + libast_fatal_error("Couldn't load the fallback font either. Giving up.\n"); } else { font_cache_add(fallback, type, (void *) xfont); } @@ -740,7 +740,7 @@ parse_font_fx(char *line) ASSERT_RVAL(line != NULL, 0); - n = num_words(line); + n = spiftool_num_words(line); if (!BEG_STRCASECMP(line, "none")) { MEMSET(&fshadow, 0, sizeof(fontshadow_t)); @@ -748,7 +748,7 @@ parse_font_fx(char *line) if (n != 2) { return 0; } - color = get_word(2, line); + color = spiftool_get_word(2, line); p = get_color_by_name(color, "black"); FREE(color); for (which = 0; which < 4; which++) { @@ -757,10 +757,10 @@ parse_font_fx(char *line) } else if (!BEG_STRCASECMP(line, "shadow")) { if (n == 2) { which = SHADOW_BOTTOM_RIGHT; - color = get_word(2, line); + color = spiftool_get_word(2, line); } else if (n == 3) { - color = get_word(3, line); - corner = get_pword(2, line); + color = spiftool_get_word(3, line); + corner = spiftool_get_pword(2, line); which = get_corner(corner); if (which >= 4) { return 0; @@ -774,12 +774,12 @@ parse_font_fx(char *line) if (n != 3) { return 0; } - color = get_word(2, line); + color = spiftool_get_word(2, line); p = get_color_by_name(color, "black"); set_shadow_color_by_pixel(SHADOW_BOTTOM_RIGHT, p); FREE(color); - color = get_word(3, line); + color = spiftool_get_word(3, line); p = get_color_by_name(color, "white"); set_shadow_color_by_pixel(SHADOW_TOP_LEFT, p); FREE(color); @@ -787,12 +787,12 @@ parse_font_fx(char *line) if (n != 3) { return 0; } - color = get_word(2, line); + color = spiftool_get_word(2, line); p = get_color_by_name(color, "black"); set_shadow_color_by_pixel(SHADOW_TOP_LEFT, p); FREE(color); - color = get_word(3, line); + color = spiftool_get_word(3, line); p = get_color_by_name(color, "white"); set_shadow_color_by_pixel(SHADOW_BOTTOM_RIGHT, p); FREE(color); @@ -803,11 +803,11 @@ parse_font_fx(char *line) which = get_corner(line); if (which >= 4) { which = i; - color = get_word(1, line); - line = get_pword(2, line); + color = spiftool_get_word(1, line); + line = spiftool_get_pword(2, line); } else { - color = get_word(2, line); - line = get_pword(3, line); + color = spiftool_get_word(2, line); + line = spiftool_get_pword(3, line); } set_shadow_color_by_name(which, color); FREE(color); diff --git a/src/font.h b/src/font.h index 9be7980..6d6e865 100644 --- a/src/font.h +++ b/src/font.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/libscream.c b/src/libscream.c index b9afac9..c12a4c7 100644 --- a/src/libscream.c +++ b/src/libscream.c @@ -8,6 +8,7 @@ * and vice versa. several sessions can be open at once. * * Lesser GNU Public Licence applies. + * Distributed with Eterm under the same license terms as Eterm itself. * Thread-safe: untested * * 2002/04/19 Azundris incept @@ -39,6 +40,7 @@ #include /* PATH_MAX */ #include /* isspace() */ #include /* errno */ +#include #include "config.h" #include "feature.h" @@ -203,22 +205,35 @@ ns_new_hop(int lp, char *fw, int fp, int delay, _ns_sess * s) bzero(h, sizeof(_ns_hop)); if ((h->fw = STRDUP(fw))) { if (!lp) { - lp = NS_MIN_PORT; /* local port defaults to */ - if (ha) { /* NS_MIN_PORT. if that's */ - int f; /* taken, use next FREE port. */ + int tmp_sock; - do { /* FREE as in, not used by us. */ - _ns_hop *i = ha; + tmp_sock = socket(PF_INET, SOCK_STREAM, 6); + if (tmp_sock > 0) { + struct sockaddr_in addr; - f = 0; - while (i) - if (i->localport == lp) { - f = 1; - lp++; - i = NULL; - } else - i = i->next; - } while (f); + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + for (lp = NS_MIN_PORT; (lp > 0) && (lp < NS_MAX_PORT); lp++) { + addr.sin_port = htons(lp); + + if (bind(tmp_sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in))) { + D_ESCREEN(("Unable to bind socket %d to 127.0.0.1:%hd -- %s\n", tmp_sock, lp, strerror(errno))); + } else if (listen(tmp_sock, 1)) { + D_ESCREEN(("Unable to listen on port %hd -- %s\n", lp, strerror(errno))); + } else { + /* We can listen on this port. Use it! */ + /* FIXME: Minor race condition between port selection and ssh call. */ + D_ESCREEN(("Got available listening port %d.\n", lp)); + break; + } + } + if ((lp < 0) || (lp == NS_MAX_PORT)) { + /* We're going to fail anyway, so just throw something in. */ + lp = NS_MIN_PORT + (random() % (NS_MAX_PORT - NS_MIN_PORT)); + BOUND(lp, NS_MIN_PORT, NS_MAX_PORT); + D_ESCREEN(("Chose random listening port %d.\n", lp)); + } + close(tmp_sock); } } h->delay = (delay ? delay : NS_TUNNEL_DELAY); @@ -1066,6 +1081,42 @@ ns_attach_lcl(_ns_sess ** sp) } +static int +ns_wait_for_socket(int port) +{ + int tmp_sock, ret = -1; + time_t start_time; + + D_ESCREEN(("Waiting for forwarder to begin listening on port %d.\n", port)); + tmp_sock = socket(PF_INET, SOCK_STREAM, 6); + start_time = time(NULL); + if (tmp_sock >= 0) { + struct sockaddr_in addr; + char timeout = 0; + + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + addr.sin_port = htons(port); + + do { + usleep(100); + if ((time(NULL) - start_time) >= NS_TUNNEL_DELAY) { + timeout = 1; + break; + } + } while (connect(tmp_sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in))); + if (timeout) { + D_ESCREEN((" -> Unable to connect; timeout after %d seconds.\n", NS_TUNNEL_DELAY)); + sleep(1); + return -1; + } else { + ret = time(NULL) - start_time; + D_ESCREEN((" -> Connected after %d seconds.\n", ret)); + } + close(tmp_sock); + } + return ret; +} /* attach a remote session (using screen/scream via ssh) sp the session @@ -1101,22 +1152,36 @@ ns_attach_ssh(_ns_sess ** sp) if (sess->hop) { if (sess->hop->established == NS_HOP_DOWN) { /* the nightmare foe */ + _ns_efuns *efuns = NULL; + ret = snprintf(cmd, NS_MAXCMD, "%s %s -p %d -L %d:%s:%d %s@%s", NS_SSH_CALL, NS_SSH_TUNNEL_OPTS, sess->hop->fwport, sess->hop->localport, sess->host, sess->port, sess->user, sess->hop->fw); if (ret < 0 || ret > NS_MAXCMD) return NS_FAIL; + D_ESCREEN(("Spawning forwarder: %s\n", cmd)); ns_run(sess->efuns, cmd); - sleep(sess->hop->delay); + if (NS_EFUN_EXISTS(efuns, sess, NULL, inp_text)) { + char tmp_buff[] = "Waiting for forwarder..."; + + efuns->inp_text((void *) 1, sess->fd, tmp_buff); + } + if ((ns_wait_for_socket(sess->hop->localport) < 0) && efuns) { + char tmp_buff[] = "...timed out."; + + efuns->inp_text((void *) 1, sess->fd, tmp_buff); + } } ret = snprintf(cmd, NS_MAXCMD, "%s %s -p %d %s@localhost \"%s%s\"", NS_SSH_CALL, NS_SSH_OPTS, sess->hop->localport, sess->user, call, ((sess->backend == NS_MODE_SCREEN) || (sess->backend == NS_MODE_NEGOTIATE)) ? esc : ""); + D_ESCREEN(("Spawning screen session: %s\n", cmd)); } else { ret = snprintf(cmd, NS_MAXCMD, "%s %s -p %d %s@%s \"%s%s\"", NS_SSH_CALL, NS_SSH_OPTS, sess->port, sess->user, sess->host, call, ((sess->backend == NS_MODE_SCREEN) || (sess->backend == NS_MODE_NEGOTIATE)) ? esc : ""); + D_ESCREEN(("Spawning screen session: %s\n", cmd)); } ns_free(&call); @@ -1869,7 +1934,7 @@ int ns_ren_disp(_ns_sess * s, int d, char *name) { char *i = NULL, *n; - size_t l; + size_t l = 0; int ret = NS_FAIL; if (!s) { @@ -2142,16 +2207,20 @@ ns_scroll2y(_ns_sess * s, int y) int ns_upd_stat(_ns_sess * s) { + D_ESCREEN(("Forcing update of status line for session 0x%p.\n", s)); if (!s) { return NS_FAIL; } switch (s->backend) { + /* FIXME: Causes other problems. case NS_MODE_NEGOTIATE:*/ #ifdef NS_HAVE_SCREEN case NS_MODE_SCREEN: + D_ESCREEN(("Calling ns_screen_command(0x%p, %s)\n", s, NS_SCREEN_UPDATE)); return ns_screen_command(s, NS_SCREEN_UPDATE); #endif default: + D_ESCREEN(("Failed; backend set to %d\n", s->backend)); return NS_FAIL; } } @@ -2554,6 +2623,7 @@ ns_screen_command(_ns_sess * sess, char *cmd) char *c; int ret = NS_SUCC; + D_ESCREEN(("Sending command \"%s\"\n", NONULL(cmd))); if (!cmd || !*cmd) { return NS_FAIL; } @@ -2649,7 +2719,7 @@ ns_inp_tab(void *xd, char *b, size_t l, size_t m) "resize", "screen", "scrollback", "select", "sessionname", "setenv", "setsid", "shell", "shelltitle", "silence", "silencewait", "sleep", - "slowpast", "source", "sorendition", "split", "stuff", + "slowpast", "source", "sorendition", "spiftool_split", "stuff", "su", "suspend", "term", "termcap", "terminfo", "termcapinfo", "unsetenv", "utf8", "vbell", "vbell_msg", "vbellwait", "verbose", "version", @@ -3163,7 +3233,7 @@ ns_parse_screen(_ns_sess * screen, int force, int width, char *p) *p2 = 0; /* make darn sure it's NUL-terminated */ } - D_ESCREEN(("parse_screen: screen sends (%d) ::%s::\n", strlen(p), p)); + D_ESCREEN(("parse_screen: screen sends \"%s\" (%d)\n", p, strlen(p))); if (strlen(p) < 2) { /* special case: display 0 */ disp = screen->dsps; /* might not get a status-line in d0! */ @@ -3191,9 +3261,19 @@ ns_parse_screen(_ns_sess * screen, int force, int width, char *p) if (NS_EFUN_EXISTS(efuns, screen, NULL, waitstate)) { ret = efuns->waitstate(NULL, screen->delay * 1000); } - (void) ns_upd_stat(screen); + if (screen->where == NS_LCL) { + D_ESCREEN(("Sending update request.\n")); + ns_upd_stat(screen); + } else { + D_ESCREEN(("Not sending update request (%d).\n", screen->where)); + } } else { - (void) ns_screen_command(screen, NS_SCREEN_INIT); + if (screen->where == NS_LCL) { + D_ESCREEN(("Sending init request.\n")); + (void) ns_screen_command(screen, NS_SCREEN_INIT); + } else { + D_ESCREEN(("Not sending init request (%d).\n", screen->where)); + } screen->timestamp = 1; } } else if ((screen->timestamp > 1) && (time(NULL) >= screen->timestamp)) { diff --git a/src/main.c b/src/main.c index 536381b..524ac93 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/menus.c b/src/menus.c index b40b827..bd4a8a5 100644 --- a/src/menus.c +++ b/src/menus.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -1240,7 +1240,7 @@ menu_action(menuitem_t *item) menu_dialog(NULL, item->action.alert, 0, NULL, NULL); break; default: - fatal_error("Internal Program Error: Unknown menuitem type: %u\n", item->type); + libast_fatal_error("Internal Program Error: Unknown menuitem type: %u\n", item->type); break; } } diff --git a/src/menus.h b/src/menus.h index f6dcda9..e7a57c7 100644 --- a/src/menus.h +++ b/src/menus.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/misc.c b/src/misc.c index ffcb8d7..f793344 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -75,12 +75,12 @@ char * str_trim(char *str) { - register char *tmp = str; + register spif_charptr_t tmp = (spif_charptr_t) str; size_t n; if (str && *str) { - chomp(str); + spiftool_chomp(str); n = strlen(str); if (!n) { @@ -216,7 +216,7 @@ parse_escaped_string(char *str) #if DEBUG >= DEBUG_STRINGS if (DEBUG_LEVEL >= DEBUG_STRINGS) { D_STRINGS(("New value is:\n")); - hex_dump(str, (size_t) (pnew - str)); + spiftool_hex_dump(str, (size_t) (pnew - str)); } #endif @@ -234,7 +234,7 @@ escape_string(spif_charptr_t str, spif_char_t quote, spif_int32_t maxlen) } /* The escaped string will be at most twice the length of the original. */ - buff = SPIF_CAST(charptr) MALLOC(strlen(SPIF_CAST_PTR(char) str) * 2 + 1); + buff = (spif_charptr_t) MALLOC(strlen((char *) str) * 2 + 1); /* Copy and escape the string from str into buff. */ for (pbuff = buff; (*s); s++, pbuff++) { @@ -316,7 +316,7 @@ add_carriage_returns(unsigned char *buff, unsigned long cnt) register unsigned char *out, *outp, *in; register unsigned long i; - D_CMD(("buff == %8p \"%s\", cnt == %lu\n", buff, safe_print_string(buff, cnt), cnt)); + D_CMD(("buff == %8p \"%s\", cnt == %lu\n", buff, safe_print_string((spif_charptr_t) buff, cnt), cnt)); outp = out = (unsigned char *) MALLOC(cnt * 2); for (i = 0, in = buff; i < cnt; i++) { if (*in == '\n') { @@ -327,14 +327,14 @@ add_carriage_returns(unsigned char *buff, unsigned long cnt) i = (unsigned long) (out - outp); memcpy(buff, outp, i); FREE(outp); - D_CMD(("buff == %8p \"%s\", i == %lu\n", buff, safe_print_string(buff, i), i)); + D_CMD(("buff == %8p \"%s\", i == %lu\n", buff, safe_print_string((spif_charptr_t) buff, i), i)); return i; } unsigned char mkdirhier(const char *path) { - char *str, *pstr; + spif_charptr_t str, pstr; struct stat dst; D_CMD(("path == %s\n", path)); diff --git a/src/misc.h b/src/misc.h index 1b4b7cc..3e75f03 100644 --- a/src/misc.h +++ b/src/misc.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/mmx_cmod.S b/src/mmx_cmod.S index 557a58d..5f6af0f 100644 --- a/src/mmx_cmod.S +++ b/src/mmx_cmod.S @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/netdisp.c b/src/netdisp.c deleted file mode 100644 index f3ee7fa..0000000 --- a/src/netdisp.c +++ /dev/null @@ -1,127 +0,0 @@ -/*----------------------------------------------------------------------* - * support for resolving the actual IP number of the host for remote - * DISPLAYs. When the display is local (i.e. :0), we add support for - * sending the first non-loopback interface IP number as the DISPLAY - * instead of just sending the incorrect ":0". This way telnet/rlogin - * shells can actually get the correct information into DISPLAY for - * xclients. - * - * Copyright 1996 Chuck Blake - * -+ * Cleaned up somewhat by mj olesen -+ * - * You can do what you like with this source code as long as you don't try - * to make money out of it and you include an unaltered copy of this - * message (including the copyright). - * - * As usual, the author accepts no responsibility for anything, nor does - * he guarantee anything whatsoever. - *----------------------------------------------------------------------*/ - -static const char cvs_ident[] = "$Id$"; - -#include "config.h" -#include "feature.h" - -#ifdef DISPLAY_IS_IP - -#include -#include -#include -#include -#include -#ifdef HAVE_FCNTL_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif -#include -#include -#ifdef HAVE_SYS_SOCKIO_H -# include -#endif -#ifdef HAVE_SYS_BYTEORDER_H -# include -#endif -#ifdef TIME_WITH_SYS_TIME -# include -# include -#else -# ifdef HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif -#ifdef HAVE_SYS_IOCTL_H -# include -#endif -#include -#include -#include -#include - -#include "startup.h" - -/* return a pointer to a static buffer */ -char * -network_display(const char *display) -{ - - static char ipaddress[32] = ""; - char buffer[1024], *rval = NULL; - struct ifconf ifc; - struct ifreq *ifr; - int i, skfd; - - if (display[0] != ':' && strncmp(display, "unix:", 5)) - return display; /* nothing to do */ - - ifc.ifc_len = sizeof(buffer); /* Get names of all ifaces */ - ifc.ifc_buf = buffer; - - if ((skfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - perror("socket"); - return NULL; - } - if (ioctl(skfd, SIOCGIFCONF, &ifc) < 0) { - perror("SIOCGIFCONF"); - close(skfd); - return NULL; - } - for (i = 0, ifr = ifc.ifc_req; i < (ifc.ifc_len / sizeof(struct ifreq)); i++, ifr++) { - - struct ifreq ifr2; - - snprintf(ifr2.ifr_name, sizeof(ifr2.ifr_name), ifr->ifr_name); - if (ioctl(skfd, SIOCGIFADDR, &ifr2) >= 0) { - unsigned long addr; - struct sockaddr_in *p_addr; - - p_addr = (struct sockaddr_in *) &(ifr2.ifr_addr); - addr = htonl((unsigned long) p_addr->sin_addr.s_addr); - - /* - * not "0.0.0.0" or "127.0.0.1" - so format the address - */ - if (addr && addr != 0x7F000001) { - char *colon = strchr(display, ':'); - - if (colon == NULL) - colon = ":0.0"; - - sprintf(ipaddress, "%d.%d.%d.%d%s", (int) ((addr >> 030) & 0xFF), (int) ((addr >> 020) & 0xFF), - (int) ((addr >> 010) & 0xFF), (int) (addr & 0xFF), colon); - - rval = ipaddress; - break; - } - } - } - - close(skfd); - return rval; -} -#endif /* DISPLAY_IS_IP */ -/*----------------------- end-of-file (C source) -----------------------*/ diff --git a/src/options.c b/src/options.c index 38b67bb..1346136 100644 --- a/src/options.c +++ b/src/options.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -305,11 +305,13 @@ spifopt_t option_list[] = { SPIFOPT_BOOL_LONG("blink-brightens-background", "\"blink\" attribute brightens background color", vt_options, VT_OPTIONS_BLINK_BRIGHTENS_BACKGROUND), SPIFOPT_BOOL_LONG("colors-suppress-bold", "do not make ANSI colors 0-16 bold", vt_options, VT_OPTIONS_COLORS_SUPPRESS_BOLD), + SPIFOPT_BOOL('S', "sticky", "start window sticky", eterm_options, ETERM_OPTIONS_STICKY), #ifndef NO_MAPALERT # ifdef MAPALERT_OPTION SPIFOPT_BOOL('m', "map-alert", "uniconify on beep", vt_options, VT_OPTIONS_MAP_ALERT), # endif #endif + SPIFOPT_BOOL_LONG("urg-alert", "set urgent hint on beep", vt_options, VT_OPTIONS_URG_ALERT), #ifdef META8_OPTION SPIFOPT_BOOL('8', "meta-8", "Meta key toggles 8-bit", vt_options, VT_OPTIONS_META8), #endif @@ -374,13 +376,13 @@ static void usage(void) { printf("Eterm Enlightened Terminal Emulator for the X Window System\n"); - printf("Copyright (c) 1997-2004, " AUTHORS "\n\n"); + printf("Copyright (c) 1997-2009, " AUTHORS "\n\n"); printf("OPTION types:\n"); printf(" (bool) -- Boolean option ('1', 'on', 'yes', or 'true' to activate, '0', 'off', 'no', or 'false' to deactivate)\n"); printf(" (int) -- Integer option (any signed number of reasonable value, usually in decimal/octal/hex)\n"); printf(" (str) -- String option (be sure to quote strings if needed to avoid shell expansion)\n"); - printf(" (strs) -- Stringlist option (quoting strings will be split on whitespace)\n\n"); + printf(" (strs) -- Stringlist option (quoting strings will be spiftool_split on whitespace)\n\n"); printf("NOTE: Long options can be separated from their values by an equal sign ('='), or you can\n"); printf(" pass the value as the following argument on the command line (e.g., '--scrollbar 0'\n"); @@ -400,7 +402,7 @@ version(void) { printf("Eterm " VERSION "\n"); - printf("Copyright (c) 1997-2004, " AUTHORS "\n\n"); + printf("Copyright (c) 1997-2009, " AUTHORS "\n\n"); printf("Build info:\n"); printf(" Built on " BUILD_DATE "\n"); @@ -415,7 +417,6 @@ version(void) " " MAIN_IDENT "\n" " " MENUS_IDENT "\n" " " MISC_IDENT "\n" - " " NETDISP_IDENT "\n" " " OPTIONS_IDENT "\n" " " PIXMAP_IDENT "\n" " " SCREEN_IDENT "\n" @@ -662,11 +663,6 @@ version(void) #else printf(" -MULTI_CHARSET"); #endif -#ifdef DISPLAY_IS_IP - printf(" +DISPLAY_IS_IP"); -#else - printf(" -DISPLAY_IS_IP"); -#endif #ifdef ENABLE_DISPLAY_ANSWER printf(" +ENABLE_DISPLAY_ANSWER"); #else @@ -813,55 +809,55 @@ version(void) static void handle_attribute(char *val_ptr) { - conf_parse_line(NULL, val_ptr); + spifconf_parse_line(NULL, val_ptr); } /* The config file parsers. Each function handles a given context. */ static void * parse_color(char *buff, void *state) { - if ((*buff == CONF_BEGIN_CHAR) || (*buff == CONF_END_CHAR)) { + if ((*buff == SPIFCONF_BEGIN_CHAR) || (*buff == SPIFCONF_END_CHAR)) { return NULL; } if (!BEG_STRCASECMP(buff, "foreground ")) { - RESET_AND_ASSIGN(rs_color[fgColor], get_word(2, buff)); + RESET_AND_ASSIGN(rs_color[fgColor], spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "background ")) { - RESET_AND_ASSIGN(rs_color[bgColor], get_word(2, buff)); + RESET_AND_ASSIGN(rs_color[bgColor], spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "cursor ")) { #ifndef NO_CURSORCOLOR - RESET_AND_ASSIGN(rs_color[cursorColor], get_word(2, buff)); + RESET_AND_ASSIGN(rs_color[cursorColor], spiftool_get_word(2, buff)); #else - print_warning("Support for the cursor attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the cursor attribute was not compiled in, ignoring\n"); #endif } else if (!BEG_STRCASECMP(buff, "cursor_text ")) { #ifndef NO_CURSORCOLOR - RESET_AND_ASSIGN(rs_color[cursorColor2], get_word(2, buff)); + RESET_AND_ASSIGN(rs_color[cursorColor2], spiftool_get_word(2, buff)); #else - print_warning("Support for the cursor_text attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the cursor_text attribute was not compiled in, ignoring\n"); #endif } else if (!BEG_STRCASECMP(buff, "pointer ")) { - RESET_AND_ASSIGN(rs_color[pointerColor], get_word(2, buff)); + RESET_AND_ASSIGN(rs_color[pointerColor], spiftool_get_word(2, buff)); #ifdef ESCREEN } else if (!BEG_STRCASECMP(buff, "es_current ")) { - RESET_AND_ASSIGN(rs_color[ES_COLOR_CURRENT], get_word(2, buff)); + RESET_AND_ASSIGN(rs_color[ES_COLOR_CURRENT], spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "es_active ")) { - RESET_AND_ASSIGN(rs_color[ES_COLOR_ACTIVE], get_word(2, buff)); + RESET_AND_ASSIGN(rs_color[ES_COLOR_ACTIVE], spiftool_get_word(2, buff)); #endif } else if (!BEG_STRCASECMP(buff, "video ")) { - char *tmp = get_pword(2, buff); + char *tmp = spiftool_get_pword(2, buff); if (!BEG_STRCASECMP(tmp, "reverse")) { BITFIELD_SET(vt_options, VT_OPTIONS_REVERSE_VIDEO); } else if (BEG_STRCASECMP(tmp, "normal")) { - print_error("Parse error in file %s, line %lu: Invalid value \"%s\" for attribute video\n", + libast_print_error("Parse error in file %s, line %lu: Invalid value \"%s\" for attribute video\n", file_peek_path(), file_peek_line(), tmp); } } else if (!BEG_STRCASECMP(buff, "color ")) { @@ -869,14 +865,14 @@ parse_color(char *buff, void *state) char *tmp = 0, *r1, *g1, *b1; unsigned int n, r, g, b, index = 0; - n = num_words(buff); + n = spiftool_num_words(buff); if (n < 3) { - print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for \n" + libast_print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for \n" "attribute color", file_peek_path(), file_peek_line(), NONULL(tmp)); return NULL; } - tmp = get_pword(2, buff); - r1 = get_pword(3, buff); + tmp = spiftool_get_pword(2, buff); + r1 = spiftool_get_pword(3, buff); if (!isdigit(*r1)) { if (isdigit(*tmp)) { n = strtoul(tmp, (char **) NULL, 0); @@ -885,38 +881,38 @@ parse_color(char *buff, void *state) } else if (n >= 8 && n <= 15) { index = minBright + n - 8; } - RESET_AND_ASSIGN(rs_color[index], get_word(1, r1)); + RESET_AND_ASSIGN(rs_color[index], spiftool_get_word(1, r1)); return NULL; } else { if (!BEG_STRCASECMP(tmp, "bd ")) { #ifndef NO_BOLDUNDERLINE - RESET_AND_ASSIGN(rs_color[colorBD], get_word(1, r1)); + RESET_AND_ASSIGN(rs_color[colorBD], spiftool_get_word(1, r1)); #else - print_warning("Support for the color bd attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the color bd attribute was not compiled in, ignoring\n"); #endif return NULL; } else if (!BEG_STRCASECMP(tmp, "ul ")) { #ifndef NO_BOLDUNDERLINE - RESET_AND_ASSIGN(rs_color[colorUL], get_word(1, r1)); + RESET_AND_ASSIGN(rs_color[colorUL], spiftool_get_word(1, r1)); #else - print_warning("Support for the color ul attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the color ul attribute was not compiled in, ignoring\n"); #endif return NULL; } else { - tmp = get_word(1, tmp); - print_error("Parse error in file %s, line %lu: Invalid color index \"%s\"\n", + tmp = spiftool_get_word(1, tmp); + libast_print_error("Parse error in file %s, line %lu: Invalid color index \"%s\"\n", file_peek_path(), file_peek_line(), NONULL(tmp)); FREE(tmp); } } } if (n != 5) { - print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for \n" + libast_print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for \n" "attribute color", file_peek_path(), file_peek_line(), NONULL(tmp)); return NULL; } - g1 = get_pword(4, buff); - b1 = get_pword(5, buff); + g1 = spiftool_get_pword(4, buff); + b1 = spiftool_get_pword(5, buff); if (isdigit(*tmp)) { n = strtoul(tmp, (char **) NULL, 0); r = strtoul(r1, (char **) NULL, 0); @@ -931,7 +927,7 @@ parse_color(char *buff, void *state) RESET_AND_ASSIGN(rs_color[index], MALLOC(14)); sprintf(rs_color[index], "#%02x%02x%02x", r, g, b); } else { - print_error("Parse error in file %s, line %lu: Invalid color index %lu\n", file_peek_path(), file_peek_line(), n); + libast_print_error("Parse error in file %s, line %lu: Invalid color index %lu\n", file_peek_path(), file_peek_line(), n); } } else if (!BEG_STRCASECMP(tmp, "bd ")) { @@ -942,7 +938,7 @@ parse_color(char *buff, void *state) b = strtoul(b1, (char **) NULL, 0); sprintf(rs_color[colorBD], "#%02x%02x%02x", r, g, b); #else - print_warning("Support for the color bd attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the color bd attribute was not compiled in, ignoring\n"); #endif } else if (!BEG_STRCASECMP(tmp, "ul ")) { @@ -953,17 +949,17 @@ parse_color(char *buff, void *state) b = strtoul(b1, (char **) NULL, 0); sprintf(rs_color[colorUL], "#%02x%02x%02x", r, g, b); #else - print_warning("Support for the color ul attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the color ul attribute was not compiled in, ignoring\n"); #endif } else { - tmp = get_word(1, tmp); - print_error("Parse error in file %s, line %lu: Invalid color index \"%s\"\n", file_peek_path(), file_peek_line(), + tmp = spiftool_get_word(1, tmp); + libast_print_error("Parse error in file %s, line %lu: Invalid color index \"%s\"\n", file_peek_path(), file_peek_line(), NONULL(tmp)); FREE(tmp); } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context color\n", + libast_print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context color\n", file_peek_path(), file_peek_line(), buff); } return state; @@ -972,76 +968,76 @@ parse_color(char *buff, void *state) static void * parse_attributes(char *buff, void *state) { - if ((*buff == CONF_BEGIN_CHAR) || (*buff == CONF_END_CHAR)) { + if ((*buff == SPIFCONF_BEGIN_CHAR) || (*buff == SPIFCONF_END_CHAR)) { return NULL; } if (!BEG_STRCASECMP(buff, "geometry ")) { - RESET_AND_ASSIGN(rs_geometry, get_word(2, buff)); + RESET_AND_ASSIGN(rs_geometry, spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "title ")) { - RESET_AND_ASSIGN(rs_title, get_word(2, buff)); + RESET_AND_ASSIGN(rs_title, spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "name ")) { - RESET_AND_ASSIGN(rs_name, get_word(2, buff)); + RESET_AND_ASSIGN(rs_name, spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "iconname ")) { - RESET_AND_ASSIGN(rs_iconName, get_word(2, buff)); + RESET_AND_ASSIGN(rs_iconName, spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "desktop ")) { rs_desktop = (int) strtol(buff, (char **) NULL, 0); } else if (!BEG_STRCASECMP(buff, "scrollbar_type ")) { - RESET_AND_ASSIGN(rs_scrollbar_type, get_word(2, buff)); + RESET_AND_ASSIGN(rs_scrollbar_type, spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "scrollbar_width ")) { - rs_scrollbar_width = strtoul(get_pword(2, buff), (char **) NULL, 0); + rs_scrollbar_width = strtoul(spiftool_get_pword(2, buff), (char **) NULL, 0); } else if (!BEG_STRCASECMP(buff, "font ")) { - char *tmp = get_pword(2, buff); + char *tmp = spiftool_get_pword(2, buff); unsigned long n; if (!BEG_STRCASECMP(tmp, "fx ") || !BEG_STRCASECMP(tmp, "effect")) { - if (parse_font_fx(get_pword(2, tmp)) != 1) { - print_error("Parse error in file %s, line %lu: Syntax error in font effects specification\n", + if (parse_font_fx(spiftool_get_pword(2, tmp)) != 1) { + libast_print_error("Parse error in file %s, line %lu: Syntax error in font effects specification\n", file_peek_path(), file_peek_line()); } } else if (!BEG_STRCASECMP(tmp, "prop")) { - tmp = get_pword(2, tmp); + tmp = spiftool_get_pword(2, tmp); if (BOOL_OPT_ISTRUE(tmp)) { BITFIELD_SET(vt_options, VT_OPTIONS_PROPORTIONAL); } else if (BOOL_OPT_ISFALSE(tmp)) { BITFIELD_CLEAR(vt_options, VT_OPTIONS_PROPORTIONAL); } else { - print_error("Parse error in file %s, line %lu: Invalid/missing boolean value for attribute proportional\n", + libast_print_error("Parse error in file %s, line %lu: Invalid/missing boolean value for attribute proportional\n", file_peek_path(), file_peek_line()); } } else if (isdigit(*tmp)) { n = strtoul(tmp, (char **) NULL, 0); if (n <= 255) { - eterm_font_add(&etfonts, get_pword(2, tmp), n); + eterm_font_add(&etfonts, spiftool_get_pword(2, tmp), n); } else { - print_error("Parse error in file %s, line %lu: Invalid font index %d\n", file_peek_path(), file_peek_line(), n); + libast_print_error("Parse error in file %s, line %lu: Invalid font index %d\n", file_peek_path(), file_peek_line(), n); } } else if (!BEG_STRCASECMP(tmp, "bold ")) { #ifndef NO_BOLDFONT - RESET_AND_ASSIGN(rs_boldFont, get_word(2, tmp)); + RESET_AND_ASSIGN(rs_boldFont, spiftool_get_word(2, tmp)); #else - print_warning("Support for the bold font attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the bold font attribute was not compiled in, ignoring\n"); #endif } else if (!BEG_STRCASECMP(tmp, "default ")) { - def_font_idx = strtoul(get_pword(2, tmp), (char **) NULL, 0); + def_font_idx = strtoul(spiftool_get_pword(2, tmp), (char **) NULL, 0); } else { - tmp = get_word(1, tmp); - print_error("Parse error in file %s, line %lu: Invalid font index \"%s\"\n", file_peek_path(), file_peek_line(), + tmp = spiftool_get_word(1, tmp); + libast_print_error("Parse error in file %s, line %lu: Invalid font index \"%s\"\n", file_peek_path(), file_peek_line(), NONULL(tmp)); FREE(tmp); } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context attributes\n", + libast_print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context attributes\n", file_peek_path(), file_peek_line(), (buff ? buff : "")); } return state; @@ -1053,11 +1049,11 @@ parse_toggles(char *buff, void *state) char *tmp; unsigned char bool_val; - if ((*buff == CONF_BEGIN_CHAR) || (*buff == CONF_END_CHAR)) { + if ((*buff == SPIFCONF_BEGIN_CHAR) || (*buff == SPIFCONF_END_CHAR)) { return NULL; } - if (!(tmp = get_pword(2, buff))) { - print_error("Parse error in file %s, line %lu: Missing boolean value in context toggles\n", file_peek_path(), + if (!(tmp = spiftool_get_pword(2, buff))) { + libast_print_error("Parse error in file %s, line %lu: Missing boolean value in context toggles\n", file_peek_path(), file_peek_line()); return NULL; } @@ -1066,7 +1062,7 @@ parse_toggles(char *buff, void *state) } else if (BOOL_OPT_ISFALSE(tmp)) { bool_val = 0; } else { - print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" in context toggles\n", + libast_print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" in context toggles\n", file_peek_path(), file_peek_line(), tmp); return NULL; } @@ -1079,9 +1075,15 @@ parse_toggles(char *buff, void *state) BITFIELD_CLEAR(vt_options, VT_OPTIONS_MAP_ALERT); } #else - print_warning("Support for the map_alert attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the map_alert attribute was not compiled in, ignoring\n"); #endif + } else if (!BEG_STRCASECMP(buff, "urg_alert ")) { + if (bool_val) { + BITFIELD_SET(vt_options, VT_OPTIONS_URG_ALERT); + } else { + BITFIELD_CLEAR(vt_options, VT_OPTIONS_URG_ALERT); + } } else if (!BEG_STRCASECMP(buff, "visual_bell ")) { if (bool_val) { BITFIELD_SET(vt_options, VT_OPTIONS_VISUAL_BELL); @@ -1109,7 +1111,7 @@ parse_toggles(char *buff, void *state) BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_WRITE_UTMP); } #else - print_warning("Support for the utmp_logging attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the utmp_logging attribute was not compiled in, ignoring\n"); #endif } else if (!BEG_STRCASECMP(buff, "meta8 ")) { @@ -1120,7 +1122,7 @@ parse_toggles(char *buff, void *state) BITFIELD_CLEAR(vt_options, VT_OPTIONS_META8); } #else - print_warning("Support for the meta8 attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the meta8 attribute was not compiled in, ignoring\n"); #endif } else if (!BEG_STRCASECMP(buff, "iconic ")) { @@ -1285,8 +1287,15 @@ parse_toggles(char *buff, void *state) BITFIELD_CLEAR(vt_options, VT_OPTIONS_COLORS_SUPPRESS_BOLD); } + } else if (!BEG_STRCASECMP(buff, "sticky ")) { + if (bool_val) { + BITFIELD_SET(eterm_options, ETERM_OPTIONS_STICKY); + } else { + BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_STICKY); + } + } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context toggles\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context toggles\n", file_peek_path(), file_peek_line(), buff); } return state; @@ -1295,23 +1304,23 @@ parse_toggles(char *buff, void *state) static void * parse_keyboard(char *buff, void *state) { - if ((*buff == CONF_BEGIN_CHAR) || (*buff == CONF_END_CHAR)) { + if ((*buff == SPIFCONF_BEGIN_CHAR) || (*buff == SPIFCONF_END_CHAR)) { return NULL; } if (!BEG_STRCASECMP(buff, "smallfont_key ")) { #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) - RESET_AND_ASSIGN(rs_smallfont_key, get_word(2, buff)); + RESET_AND_ASSIGN(rs_smallfont_key, spiftool_get_word(2, buff)); TO_KEYSYM(&ks_smallfont, rs_smallfont_key); #else - print_warning("Support for the smallfont_key attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the smallfont_key attribute was not compiled in, ignoring\n"); #endif } else if (!BEG_STRCASECMP(buff, "bigfont_key ")) { #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) - RESET_AND_ASSIGN(rs_bigfont_key, get_word(2, buff)); + RESET_AND_ASSIGN(rs_bigfont_key, spiftool_get_word(2, buff)); TO_KEYSYM(&ks_bigfont, rs_bigfont_key); #else - print_warning("Support for the bigfont_key attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the bigfont_key attribute was not compiled in, ignoring\n"); #endif } else if (!BEG_STRCASECMP(buff, "keysym ")) { @@ -1326,15 +1335,15 @@ parse_keyboard(char *buff, void *state) if (sym >= 0xff00) sym -= 0xff00; if (sym < 0 || sym > 0xff) { - print_error("Parse error in file %s, line %lu: Keysym 0x%x out of range 0xff00-0xffff\n", + libast_print_error("Parse error in file %s, line %lu: Keysym 0x%x out of range 0xff00-0xffff\n", file_peek_path(), file_peek_line(), sym + 0xff00); return NULL; } - s = get_word(3, buff); + s = spiftool_get_word(3, buff); str = (char *) MALLOC(strlen(s) + 2); strcpy(str, s); FREE(s); - chomp(str); + spiftool_chomp(str); len = parse_escaped_string(str); if (len > 255) len = 255; /* We can only handle lengths that will fit in a char */ @@ -1348,34 +1357,34 @@ parse_keyboard(char *buff, void *state) } } #else - print_warning("Support for the keysym attributes was not compiled in, ignoring\n"); + libast_print_warning("Support for the keysym attributes was not compiled in, ignoring\n"); #endif } else if (!BEG_STRCASECMP(buff, "meta_mod ")) { - char *tmp = get_pword(2, buff); + char *tmp = spiftool_get_pword(2, buff); if (!tmp) { - print_error("Parse error in file %s, line %lu: Missing modifier value for attribute meta_mod\n", + libast_print_error("Parse error in file %s, line %lu: Missing modifier value for attribute meta_mod\n", file_peek_path(), file_peek_line()); return NULL; } rs_meta_mod = (unsigned int) strtoul(tmp, (char **) NULL, 0); } else if (!BEG_STRCASECMP(buff, "alt_mod ")) { - char *tmp = get_pword(2, buff); + char *tmp = spiftool_get_pword(2, buff); if (!tmp) { - print_error("Parse error in file %s, line %lu: Missing modifier value for attribute alt_mod\n", + libast_print_error("Parse error in file %s, line %lu: Missing modifier value for attribute alt_mod\n", file_peek_path(), file_peek_line()); return NULL; } rs_alt_mod = (unsigned int) strtoul(tmp, (char **) NULL, 0); } else if (!BEG_STRCASECMP(buff, "numlock_mod ")) { - char *tmp = get_pword(2, buff); + char *tmp = spiftool_get_pword(2, buff); if (!tmp) { - print_error("Parse error in file %s, line %lu: Missing modifier value for attribute numlock_mod\n", + libast_print_error("Parse error in file %s, line %lu: Missing modifier value for attribute numlock_mod\n", file_peek_path(), file_peek_line()); return NULL; } @@ -1384,40 +1393,40 @@ parse_keyboard(char *buff, void *state) } else if (!BEG_STRCASECMP(buff, "greek ")) { #ifdef GREEK_SUPPORT - char *tmp = get_pword(2, buff); + char *tmp = spiftool_get_pword(2, buff); if (!tmp) { - print_error("Parse error in file %s, line %lu: Missing boolean value for attribute greek\n", + libast_print_error("Parse error in file %s, line %lu: Missing boolean value for attribute greek\n", file_peek_path(), file_peek_line()); return NULL; } if (BOOL_OPT_ISTRUE(tmp)) { - RESET_AND_ASSIGN(rs_greek_keyboard, get_word(3, buff)); + RESET_AND_ASSIGN(rs_greek_keyboard, spiftool_get_word(3, buff)); if (BEG_STRCASECMP(rs_greek_keyboard, "iso")) { greek_setmode(GREEK_ELOT928); } else if (BEG_STRCASECMP(rs_greek_keyboard, "ibm")) { greek_setmode(GREEK_IBM437); } else { - print_error("Parse error in file %s, line %lu: Invalid greek keyboard mode \"%s\"\n", + libast_print_error("Parse error in file %s, line %lu: Invalid greek keyboard mode \"%s\"\n", file_peek_path(), file_peek_line(), (rs_greek_keyboard ? rs_greek_keyboard : "")); } } else if (BOOL_OPT_ISFALSE(tmp)) { /* This space intentionally left no longer blank =^) */ } else { - print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute %s\n", + libast_print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute %s\n", file_peek_path(), file_peek_line(), tmp, buff); return NULL; } #else - print_warning("Support for the greek attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the greek attribute was not compiled in, ignoring\n"); #endif } else if (!BEG_STRCASECMP(buff, "app_keypad ")) { - char *tmp = get_pword(2, buff); + char *tmp = spiftool_get_pword(2, buff); if (!tmp) { - print_error("Parse error in file %s, line %lu: Missing boolean value for attribute app_keypad\n", + libast_print_error("Parse error in file %s, line %lu: Missing boolean value for attribute app_keypad\n", file_peek_path(), file_peek_line()); return NULL; } @@ -1426,17 +1435,17 @@ parse_keyboard(char *buff, void *state) } else if (BOOL_OPT_ISFALSE(tmp)) { PrivateModes &= ~(PrivMode_aplKP); } else { - print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute app_keypad\n", + libast_print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute app_keypad\n", file_peek_path(), file_peek_line(), tmp); return NULL; } } else if (!BEG_STRCASECMP(buff, "app_cursor ")) { - char *tmp = get_pword(2, buff); + char *tmp = spiftool_get_pword(2, buff); if (!tmp) { - print_error("Parse error in file %s, line %lu: Missing boolean value for attribute app_cursor\n", + libast_print_error("Parse error in file %s, line %lu: Missing boolean value for attribute app_cursor\n", file_peek_path(), file_peek_line()); return NULL; } @@ -1445,13 +1454,13 @@ parse_keyboard(char *buff, void *state) } else if (BOOL_OPT_ISFALSE(tmp)) { PrivateModes &= ~(PrivMode_aplCUR); } else { - print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute app_cursor\n", + libast_print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute app_cursor\n", file_peek_path(), file_peek_line(), tmp); return NULL; } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context keyboard\n", + libast_print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context keyboard\n", file_peek_path(), file_peek_line(), buff); } return state; @@ -1460,70 +1469,69 @@ parse_keyboard(char *buff, void *state) static void * parse_misc(char *buff, void *state) { - if ((*buff == CONF_BEGIN_CHAR) || (*buff == CONF_END_CHAR)) { + if ((*buff == SPIFCONF_BEGIN_CHAR) || (*buff == SPIFCONF_END_CHAR)) { return NULL; } if (!BEG_STRCASECMP(buff, "print_pipe ")) { #ifdef PRINTPIPE - RESET_AND_ASSIGN(rs_print_pipe, STRDUP(get_pword(2, buff))); - chomp(rs_print_pipe); + RESET_AND_ASSIGN(rs_print_pipe, spiftool_get_word(2, buff)); #else - print_warning("Support for the print_pipe attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the print_pipe attribute was not compiled in, ignoring\n"); #endif } else if (!BEG_STRCASECMP(buff, "save_lines ")) { - rs_saveLines = strtol(get_pword(2, buff), (char **) NULL, 0); + rs_saveLines = strtol(spiftool_get_pword(2, buff), (char **) NULL, 0); } else if (!BEG_STRCASECMP(buff, "min_anchor_size ")) { - rs_min_anchor_size = strtol(get_pword(2, buff), (char **) NULL, 0); + rs_min_anchor_size = strtol(spiftool_get_pword(2, buff), (char **) NULL, 0); } else if (!BEG_STRCASECMP(buff, "border_width ")) { #ifdef BORDER_WIDTH_OPTION - TermWin.internalBorder = (short) strtol(get_pword(2, buff), (char **) NULL, 0); + TermWin.internalBorder = (short) strtol(spiftool_get_pword(2, buff), (char **) NULL, 0); #else - print_warning("Support for the border_width attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the border_width attribute was not compiled in, ignoring\n"); #endif } else if (!BEG_STRCASECMP(buff, "line_space ")) { - rs_line_space = strtol(get_pword(2, buff), (char **) NULL, 0); + rs_line_space = strtol(spiftool_get_pword(2, buff), (char **) NULL, 0); } else if (!BEG_STRCASECMP(buff, "finished_title ")) { - RESET_AND_ASSIGN(rs_finished_title, get_word(2, buff)); + RESET_AND_ASSIGN(rs_finished_title, spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "finished_text ")) { - RESET_AND_ASSIGN(rs_finished_text, get_word(2, buff)); + RESET_AND_ASSIGN(rs_finished_text, spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "term_name ")) { - RESET_AND_ASSIGN(rs_term_name, get_word(2, buff)); + RESET_AND_ASSIGN(rs_term_name, spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "beep_command ")) { - RESET_AND_ASSIGN(rs_beep_command, get_word(2, buff)); + RESET_AND_ASSIGN(rs_beep_command, spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "debug ")) { - DEBUG_LEVEL = (unsigned int) strtoul(get_pword(2, buff), (char **) NULL, 0); + DEBUG_LEVEL = (unsigned int) strtoul(spiftool_get_pword(2, buff), (char **) NULL, 0); } else if (!BEG_STRCASECMP(buff, "exec ")) { register unsigned short k, n; - RESET_AND_ASSIGN(rs_exec_args, (char **) MALLOC(sizeof(char *) * ((n = num_words(get_pword(2, buff))) + 1))); + RESET_AND_ASSIGN(rs_exec_args, (char **) MALLOC(sizeof(char *) * ((n = spiftool_num_words(spiftool_get_pword(2, buff))) + 1))); for (k = 0; k < n; k++) { - rs_exec_args[k] = get_word(k + 2, buff); + rs_exec_args[k] = spiftool_get_word(k + 2, buff); D_OPTIONS(("rs_exec_args[%d] == %s\n", k, rs_exec_args[k])); } rs_exec_args[n] = (char *) NULL; } else if (!BEG_STRCASECMP(buff, "cut_chars ")) { #ifdef CUTCHAR_OPTION - RESET_AND_ASSIGN(rs_cutchars, get_word(2, buff)); - chomp(rs_cutchars); + RESET_AND_ASSIGN(rs_cutchars, spiftool_get_word(2, buff)); + spiftool_chomp(rs_cutchars); #else - print_warning("Support for the cut_chars attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the cut_chars attribute was not compiled in, ignoring\n"); #endif } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context misc\n", + libast_print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context misc\n", file_peek_path(), file_peek_line(), buff); } return state; @@ -1532,43 +1540,43 @@ parse_misc(char *buff, void *state) static void * parse_imageclasses(char *buff, void *state) { - if ((*buff == CONF_BEGIN_CHAR) || (*buff == CONF_END_CHAR)) { + if ((*buff == SPIFCONF_BEGIN_CHAR) || (*buff == SPIFCONF_END_CHAR)) { return NULL; } if (!BEG_STRCASECMP(buff, "icon ")) { #ifdef PIXMAP_SUPPORT - RESET_AND_ASSIGN(rs_icon, get_word(2, buff)); + RESET_AND_ASSIGN(rs_icon, spiftool_get_word(2, buff)); #else - print_warning("Pixmap support was not compiled in, ignoring \"icon\" attribute\n"); + libast_print_warning("Pixmap support was not compiled in, ignoring \"icon\" attribute\n"); #endif } else if (!BEG_STRCASECMP(buff, "cache")) { #ifdef PIXMAP_SUPPORT - rs_cache_size = strtoul(get_pword(2, buff), (char **) NULL, 0); + rs_cache_size = strtoul(spiftool_get_pword(2, buff), (char **) NULL, 0); #else - print_warning("Pixmap support was not compiled in, ignoring \"cache\" attribute\n"); + libast_print_warning("Pixmap support was not compiled in, ignoring \"cache\" attribute\n"); #endif } else if (!BEG_STRCASECMP(buff, "path ")) { - RESET_AND_ASSIGN(rs_path, get_word(2, buff)); + RESET_AND_ASSIGN(rs_path, spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "anim ")) { #ifdef BACKGROUND_CYCLING_SUPPORT - char *tmp = get_pword(2, buff); + char *tmp = spiftool_get_pword(2, buff); if (tmp) { rs_anim_pixmap_list = STRDUP(tmp); } else { - print_error("Parse error in file %s, line %lu: Invalid parameter list \"\" for attribute anim\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Invalid parameter list \"\" for attribute anim\n", file_peek_path(), file_peek_line()); } #else - print_warning("Support for the anim attribute was not compiled in, ignoring\n"); + libast_print_warning("Support for the anim attribute was not compiled in, ignoring\n"); #endif } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context imageclasses\n", + libast_print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context imageclasses\n", file_peek_path(), file_peek_line(), buff); } return state; @@ -1579,7 +1587,7 @@ parse_image(char *buff, void *state) { int idx; - if (*buff == CONF_BEGIN_CHAR) { + if (*buff == SPIFCONF_BEGIN_CHAR) { int *tmp; tmp = (int *) MALLOC(sizeof(int)); @@ -1587,7 +1595,7 @@ parse_image(char *buff, void *state) return ((void *) tmp); } ASSERT_RVAL(state != NULL, (void *) (file_skip_to_end(), NULL)); - if (*buff == CONF_END_CHAR) { + if (*buff == SPIFCONF_END_CHAR) { int *tmp; tmp = (int *) state; @@ -1596,10 +1604,10 @@ parse_image(char *buff, void *state) } idx = *((int *) state); if (!BEG_STRCASECMP(buff, "type ")) { - char *type = get_pword(2, buff); + char *type = spiftool_get_pword(2, buff); if (!type) { - print_error("Parse error in file %s, line %lu: Missing image type\n", file_peek_path(), file_peek_line()); + libast_print_error("Parse error in file %s, line %lu: Missing image type\n", file_peek_path(), file_peek_line()); return NULL; } if (!strcasecmp(type, "background")) { @@ -1633,22 +1641,22 @@ parse_image(char *buff, void *state) } else if (!strcasecmp(type, "dialog_box")) { idx = image_dialog; } else { - print_error("Parse error in file %s, line %lu: Invalid image type \"%s\"\n", file_peek_path(), file_peek_line(), type); + libast_print_error("Parse error in file %s, line %lu: Invalid image type \"%s\"\n", file_peek_path(), file_peek_line(), type); return NULL; } *((int *) state) = idx; } else if (!BEG_STRCASECMP(buff, "mode ")) { - char *mode = get_pword(2, buff); - char *allow_list = get_pword(4, buff); + char *mode = spiftool_get_pword(2, buff); + char *allow_list = spiftool_get_pword(4, buff); if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"mode\" with no image type defined\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Encountered \"mode\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (!mode) { - print_error("Parse error in file %s, line %lu: Missing parameters for mode line\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Missing parameters for mode line\n", file_peek_path(), file_peek_line()); return NULL; } @@ -1663,7 +1671,7 @@ parse_image(char *buff, void *state) } else if (!BEG_STRCASECMP(mode, "solid")) { images[idx].mode = MODE_SOLID; } else { - print_error("Parse error in file %s, line %lu: Invalid mode \"%s\"\n", file_peek_path(), file_peek_line(), mode); + libast_print_error("Parse error in file %s, line %lu: Invalid mode \"%s\"\n", file_peek_path(), file_peek_line(), mode); } if (allow_list) { char *allow; @@ -1679,20 +1687,20 @@ parse_image(char *buff, void *state) images[idx].mode |= ALLOW_AUTO; } else if (!BEG_STRCASECMP(allow, "solid")) { } else { - print_error("Parse error in file %s, line %lu: Invalid mode \"%s\"\n", file_peek_path(), file_peek_line(), + libast_print_error("Parse error in file %s, line %lu: Invalid mode \"%s\"\n", file_peek_path(), file_peek_line(), allow); } } } } else if (!BEG_STRCASECMP(buff, "state ")) { - char *state = get_pword(2, buff), new = 0; + char *state = spiftool_get_pword(2, buff), new = 0; if (!state) { - print_error("Parse error in file %s, line %lu: Missing state\n", file_peek_path(), file_peek_line()); + libast_print_error("Parse error in file %s, line %lu: Missing state\n", file_peek_path(), file_peek_line()); return NULL; } if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"state\" with no image type defined\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Encountered \"state\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } @@ -1721,7 +1729,7 @@ parse_image(char *buff, void *state) } images[idx].current = images[idx].disabled; } else { - print_error("Parse error in file %s, line %lu: Invalid state \"%s\"\n", file_peek_path(), file_peek_line(), state); + libast_print_error("Parse error in file %s, line %lu: Invalid state \"%s\"\n", file_peek_path(), file_peek_line(), state); return NULL; } if (new) { @@ -1732,20 +1740,20 @@ parse_image(char *buff, void *state) MEMSET(images[idx].current->iml, 0, sizeof(imlib_t)); } } else if (!BEG_STRCASECMP(buff, "color ")) { - char *fg = get_word(2, buff), *bg = get_word(3, buff); + char *fg = spiftool_get_word(2, buff), *bg = spiftool_get_word(3, buff); if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"color\" with no image type defined\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Encountered \"color\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (images[idx].current == NULL) { - print_error("Parse error in file %s, line %lu: Encountered \"color\" with no image state defined\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Encountered \"color\" with no image state defined\n", file_peek_path(), file_peek_line()); return NULL; } if (!fg || !bg) { - print_error("Parse error in file %s, line %lu: Foreground and background colors must be specified with \"color\"\n", + libast_print_error("Parse error in file %s, line %lu: Foreground and background colors must be specified with \"color\"\n", file_peek_path(), file_peek_line()); return NULL; } @@ -1764,20 +1772,20 @@ parse_image(char *buff, void *state) } else if (!BEG_STRCASECMP(buff, "file ")) { #ifdef PIXMAP_SUPPORT - char *filename = get_pword(2, buff); + char *filename = spiftool_get_pword(2, buff); if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"file\" with no image type defined\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Encountered \"file\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (images[idx].current == NULL) { - print_error("Parse error in file %s, line %lu: Encountered \"file\" with no image state defined\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Encountered \"file\" with no image state defined\n", file_peek_path(), file_peek_line()); return NULL; } if (!filename) { - print_error("Parse error in file %s, line %lu: Missing filename\n", file_peek_path(), file_peek_line()); + libast_print_error("Parse error in file %s, line %lu: Missing filename\n", file_peek_path(), file_peek_line()); return NULL; } if (!load_image(filename, images[idx].current)) { @@ -1788,20 +1796,20 @@ parse_image(char *buff, void *state) } else if (!BEG_STRCASECMP(buff, "geom ")) { #ifdef PIXMAP_SUPPORT - char *geom = get_pword(2, buff); + char *geom = spiftool_get_pword(2, buff); if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"geom\" with no image type defined\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Encountered \"geom\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (images[idx].current == NULL) { - print_error("Parse error in file %s, line %lu: Encountered \"geom\" with no image state defined\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Encountered \"geom\" with no image state defined\n", file_peek_path(), file_peek_line()); return NULL; } if (!geom) { - print_error("Parse error in file %s, line %lu: Missing geometry string\n", file_peek_path(), file_peek_line()); + libast_print_error("Parse error in file %s, line %lu: Missing geometry string\n", file_peek_path(), file_peek_line()); return NULL; } set_pixmap_scale(geom, images[idx].current->pmap); @@ -1809,30 +1817,30 @@ parse_image(char *buff, void *state) } else if (!BEG_STRCASECMP(buff, "cmod ") || !BEG_STRCASECMP(buff, "colormod ")) { #ifdef PIXMAP_SUPPORT - char *color = get_pword(2, buff); - char *mods = get_pword(3, buff); + char *color = spiftool_get_pword(2, buff); + char *mods = spiftool_get_pword(3, buff); unsigned char n; imlib_t *iml = images[idx].current->iml; if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered color modifier with no image type defined\n", + libast_print_error("Parse error in file %s, line %lu: Encountered color modifier with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (images[idx].current == NULL) { - print_error("Parse error in file %s, line %lu: Encountered color modifier with no image state defined\n", + libast_print_error("Parse error in file %s, line %lu: Encountered color modifier with no image state defined\n", file_peek_path(), file_peek_line()); return NULL; } if (!color) { - print_error("Parse error in file %s, line %lu: Missing color name\n", file_peek_path(), file_peek_line()); + libast_print_error("Parse error in file %s, line %lu: Missing color name\n", file_peek_path(), file_peek_line()); return NULL; } if (!mods) { - print_error("Parse error in file %s, line %lu: Missing modifier(s)\n", file_peek_path(), file_peek_line()); + libast_print_error("Parse error in file %s, line %lu: Missing modifier(s)\n", file_peek_path(), file_peek_line()); return NULL; } - n = num_words(mods); + n = spiftool_num_words(mods); if (!BEG_STRCASECMP(color, "image ")) { if (iml->mod) { @@ -1841,10 +1849,10 @@ parse_image(char *buff, void *state) iml->mod = create_colormod(); iml->mod->brightness = (int) strtol(mods, (char **) NULL, 0); if (n > 1) { - iml->mod->contrast = (int) strtol(get_pword(2, mods), (char **) NULL, 0); + iml->mod->contrast = (int) strtol(spiftool_get_pword(2, mods), (char **) NULL, 0); } if (n > 2) { - iml->mod->gamma = (int) strtol(get_pword(3, mods), (char **) NULL, 0); + iml->mod->gamma = (int) strtol(spiftool_get_pword(3, mods), (char **) NULL, 0); } update_cmod(iml->mod); } else if (!BEG_STRCASECMP(color, "red ")) { @@ -1854,10 +1862,10 @@ parse_image(char *buff, void *state) iml->rmod = create_colormod(); iml->rmod->brightness = (int) strtol(mods, (char **) NULL, 0); if (n > 1) { - iml->rmod->contrast = (int) strtol(get_pword(2, mods), (char **) NULL, 0); + iml->rmod->contrast = (int) strtol(spiftool_get_pword(2, mods), (char **) NULL, 0); } if (n > 2) { - iml->rmod->gamma = (int) strtol(get_pword(3, mods), (char **) NULL, 0); + iml->rmod->gamma = (int) strtol(spiftool_get_pword(3, mods), (char **) NULL, 0); } update_cmod(iml->rmod); } else if (!BEG_STRCASECMP(color, "green ")) { @@ -1867,10 +1875,10 @@ parse_image(char *buff, void *state) iml->gmod = create_colormod(); iml->gmod->brightness = (int) strtol(mods, (char **) NULL, 0); if (n > 1) { - iml->gmod->contrast = (int) strtol(get_pword(2, mods), (char **) NULL, 0); + iml->gmod->contrast = (int) strtol(spiftool_get_pword(2, mods), (char **) NULL, 0); } if (n > 2) { - iml->gmod->gamma = (int) strtol(get_pword(3, mods), (char **) NULL, 0); + iml->gmod->gamma = (int) strtol(spiftool_get_pword(3, mods), (char **) NULL, 0); } update_cmod(iml->gmod); } else if (!BEG_STRCASECMP(color, "blue ")) { @@ -1880,14 +1888,14 @@ parse_image(char *buff, void *state) iml->bmod = create_colormod(); iml->bmod->brightness = (int) strtol(mods, (char **) NULL, 0); if (n > 1) { - iml->bmod->contrast = (int) strtol(get_pword(2, mods), (char **) NULL, 0); + iml->bmod->contrast = (int) strtol(spiftool_get_pword(2, mods), (char **) NULL, 0); } if (n > 2) { - iml->bmod->gamma = (int) strtol(get_pword(3, mods), (char **) NULL, 0); + iml->bmod->gamma = (int) strtol(spiftool_get_pword(3, mods), (char **) NULL, 0); } update_cmod(iml->bmod); } else { - print_error("Parse error in file %s, line %lu: Color must be either \"image\", \"red\", \"green\", or \"blue\"\n", + libast_print_error("Parse error in file %s, line %lu: Color must be either \"image\", \"red\", \"green\", or \"blue\"\n", file_peek_path(), file_peek_line()); return NULL; } @@ -1895,21 +1903,21 @@ parse_image(char *buff, void *state) } else if (!BEG_STRCASECMP(buff, "border ")) { if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"border\" with no image type defined\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Encountered \"border\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } - if (num_words(buff + 7) < 4) { - print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"border\"\n", file_peek_path(), + if (spiftool_num_words(buff + 7) < 4) { + libast_print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"border\"\n", file_peek_path(), file_peek_line()); return NULL; } RESET_AND_ASSIGN(images[idx].current->iml->border, (Imlib_Border *) MALLOC(sizeof(Imlib_Border))); - images[idx].current->iml->border->left = (unsigned short) strtoul(get_pword(2, buff), (char **) NULL, 0); - images[idx].current->iml->border->right = (unsigned short) strtoul(get_pword(3, buff), (char **) NULL, 0); - images[idx].current->iml->border->top = (unsigned short) strtoul(get_pword(4, buff), (char **) NULL, 0); - images[idx].current->iml->border->bottom = (unsigned short) strtoul(get_pword(5, buff), (char **) NULL, 0); + images[idx].current->iml->border->left = (unsigned short) strtoul(spiftool_get_pword(2, buff), (char **) NULL, 0); + images[idx].current->iml->border->right = (unsigned short) strtoul(spiftool_get_pword(3, buff), (char **) NULL, 0); + images[idx].current->iml->border->top = (unsigned short) strtoul(spiftool_get_pword(4, buff), (char **) NULL, 0); + images[idx].current->iml->border->bottom = (unsigned short) strtoul(spiftool_get_pword(5, buff), (char **) NULL, 0); if ((images[idx].current->iml->border->left == 0) && (images[idx].current->iml->border->right == 0) && (images[idx].current->iml->border->top == 0) && (images[idx].current->iml->border->bottom == 0)) { @@ -1918,17 +1926,17 @@ parse_image(char *buff, void *state) } } else if (!BEG_STRCASECMP(buff, "bevel ")) { if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"bevel\" with no image type defined\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Encountered \"bevel\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (images[idx].current == NULL) { - print_error("Parse error in file %s, line %lu: Encountered \"bevel\" with no image state defined\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Encountered \"bevel\" with no image state defined\n", file_peek_path(), file_peek_line()); return NULL; } - if (num_words(buff + 6) < 5) { - print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"bevel\"\n", file_peek_path(), + if (spiftool_num_words(buff + 6) < 5) { + libast_print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"bevel\"\n", file_peek_path(), file_peek_line()); return NULL; } @@ -1939,15 +1947,15 @@ parse_image(char *buff, void *state) images[idx].current->iml->bevel = (bevel_t *) MALLOC(sizeof(bevel_t)); images[idx].current->iml->bevel->edges = (Imlib_Border *) MALLOC(sizeof(Imlib_Border)); - if (!BEG_STRCASECMP(get_pword(2, buff), "down")) { + if (!BEG_STRCASECMP(spiftool_get_pword(2, buff), "down")) { images[idx].current->iml->bevel->up = 0; } else { images[idx].current->iml->bevel->up = 1; } - images[idx].current->iml->bevel->edges->left = (unsigned short) strtoul(get_pword(3, buff), (char **) NULL, 0); - images[idx].current->iml->bevel->edges->right = (unsigned short) strtoul(get_pword(4, buff), (char **) NULL, 0); - images[idx].current->iml->bevel->edges->top = (unsigned short) strtoul(get_pword(5, buff), (char **) NULL, 0); - images[idx].current->iml->bevel->edges->bottom = (unsigned short) strtoul(get_pword(6, buff), (char **) NULL, 0); + images[idx].current->iml->bevel->edges->left = (unsigned short) strtoul(spiftool_get_pword(3, buff), (char **) NULL, 0); + images[idx].current->iml->bevel->edges->right = (unsigned short) strtoul(spiftool_get_pword(4, buff), (char **) NULL, 0); + images[idx].current->iml->bevel->edges->top = (unsigned short) strtoul(spiftool_get_pword(5, buff), (char **) NULL, 0); + images[idx].current->iml->bevel->edges->bottom = (unsigned short) strtoul(spiftool_get_pword(6, buff), (char **) NULL, 0); if ((images[idx].current->iml->bevel->edges->left == 0) && (images[idx].current->iml->bevel->edges->right == 0) && (images[idx].current->iml->bevel->edges->top == 0) && (images[idx].current->iml->bevel->edges->bottom == 0)) { @@ -1958,26 +1966,26 @@ parse_image(char *buff, void *state) } } else if (!BEG_STRCASECMP(buff, "padding ")) { if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"padding\" with no image type defined\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Encountered \"padding\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (images[idx].current == NULL) { - print_error("Parse error in file %s, line %lu: Encountered \"padding\" with no image state defined\n", + libast_print_error("Parse error in file %s, line %lu: Encountered \"padding\" with no image state defined\n", file_peek_path(), file_peek_line()); return NULL; } - if (num_words(buff + 8) < 4) { - print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"padding\"\n", file_peek_path(), + if (spiftool_num_words(buff + 8) < 4) { + libast_print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"padding\"\n", file_peek_path(), file_peek_line()); return NULL; } RESET_AND_ASSIGN(images[idx].current->iml->pad, (Imlib_Border *) MALLOC(sizeof(Imlib_Border))); - images[idx].current->iml->pad->left = (unsigned short) strtoul(get_pword(2, buff), (char **) NULL, 0); - images[idx].current->iml->pad->right = (unsigned short) strtoul(get_pword(3, buff), (char **) NULL, 0); - images[idx].current->iml->pad->top = (unsigned short) strtoul(get_pword(4, buff), (char **) NULL, 0); - images[idx].current->iml->pad->bottom = (unsigned short) strtoul(get_pword(5, buff), (char **) NULL, 0); + images[idx].current->iml->pad->left = (unsigned short) strtoul(spiftool_get_pword(2, buff), (char **) NULL, 0); + images[idx].current->iml->pad->right = (unsigned short) strtoul(spiftool_get_pword(3, buff), (char **) NULL, 0); + images[idx].current->iml->pad->top = (unsigned short) strtoul(spiftool_get_pword(4, buff), (char **) NULL, 0); + images[idx].current->iml->pad->bottom = (unsigned short) strtoul(spiftool_get_pword(5, buff), (char **) NULL, 0); if ((images[idx].current->iml->pad->left == 0) && (images[idx].current->iml->pad->right == 0) && (images[idx].current->iml->pad->top == 0) && (images[idx].current->iml->pad->bottom == 0)) { @@ -1985,7 +1993,7 @@ parse_image(char *buff, void *state) images[idx].current->iml->pad = (Imlib_Border *) NULL; } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context image\n", + libast_print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context image\n", file_peek_path(), file_peek_line(), buff); } return ((void *) state); @@ -2001,12 +2009,12 @@ parse_actions(char *buff, void *state) char *str; unsigned short i; - if ((*buff == CONF_BEGIN_CHAR) || (*buff == CONF_END_CHAR)) { + if ((*buff == SPIFCONF_BEGIN_CHAR) || (*buff == SPIFCONF_END_CHAR)) { return NULL; } if (!BEG_STRCASECMP(buff, "bind ")) { - for (i = 2; (str = get_word(i, buff)) && strcasecmp(str, "to"); i++) { + for (i = 2; (str = spiftool_get_word(i, buff)) && strcasecmp(str, "to"); i++) { if (!BEG_STRCASECMP(str, "anymod")) { mod = ETERM_MOD_ANY; } else if (!BEG_STRCASECMP(str, "ctrl")) { @@ -2039,39 +2047,39 @@ parse_actions(char *buff, void *state) FREE(str); } if (!str) { - print_error("Parse error in file %s, line %lu: Syntax error (\"to\" not found)\n", file_peek_path(), file_peek_line()); + libast_print_error("Parse error in file %s, line %lu: Syntax error (\"to\" not found)\n", file_peek_path(), file_peek_line()); return NULL; } FREE(str); if ((button == ETERM_BUTTON_NONE) && (keysym == 0)) { - print_error("Parse error in file %s, line %lu: No valid button/keysym found for action\n", - file_peek_path(), file_peek_line()); + libast_print_error("Parse error in file %s, line %lu: No valid button/keysym found for action\n", file_peek_path(), + file_peek_line()); return NULL; } i++; - str = get_pword(i, buff); + str = spiftool_get_pword(i, buff); if (!BEG_STRCASECMP(str, "string")) { - str = get_word(i + 1, buff); + str = spiftool_get_word(i + 1, buff); new_action = spif_eterm_action_new_from_data(ETERM_ACTION_STRING, mod, button, keysym, SPIF_CAST(ptr) str); FREE(str); } else if (!BEG_STRCASECMP(str, "echo")) { - str = get_word(i + 1, buff); + str = spiftool_get_word(i + 1, buff); new_action = spif_eterm_action_new_from_data(ETERM_ACTION_ECHO, mod, button, keysym, SPIF_CAST(ptr) str); FREE(str); } else if (!BEG_STRCASECMP(str, "menu")) { /*menu_t *menu; */ - str = get_word(i + 1, buff); + str = spiftool_get_word(i + 1, buff); /*menu = find_menu_by_title(menu_list, str); */ new_action = spif_eterm_action_new_from_data(ETERM_ACTION_MENU, mod, button, keysym, SPIF_NULL_TYPE(ptr)); FREE(str); } else if (!BEG_STRCASECMP(str, "script")) { - str = get_word(i + 1, buff); + str = spiftool_get_word(i + 1, buff); new_action = spif_eterm_action_new_from_data(ETERM_ACTION_SCRIPT, mod, button, keysym, SPIF_CAST(ptr) str); FREE(str); } else { - print_error("Parse error in file %s, line %lu: No valid action type found. Valid types are " - "\"string,\" \"echo,\" \"menu,\" and \"script.\"\n", file_peek_path(), file_peek_line()); + libast_print_error("Parse error in file %s, line %lu: No valid action type found. Valid types are " + "\"string,\" \"echo,\" \"menu,\" and \"script.\"\n", file_peek_path(), file_peek_line()); return NULL; } @@ -2080,7 +2088,7 @@ parse_actions(char *buff, void *state) } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context action\n", + libast_print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context action\n", file_peek_path(), file_peek_line(), buff); } return state; @@ -2091,37 +2099,37 @@ parse_menu(char *buff, void *state) { menu_t *menu; - if (*buff == CONF_BEGIN_CHAR) { - char *title = get_pword(2, buff + 6); + if (*buff == SPIFCONF_BEGIN_CHAR) { + char *title = spiftool_get_pword(2, buff + 6); menu = menu_create(title); return ((void *) menu); } ASSERT_RVAL(state != NULL, (void *) (file_skip_to_end(), NULL)); menu = (menu_t *) state; - if (*buff == CONF_END_CHAR) { + if (*buff == SPIFCONF_END_CHAR) { if (!(*(menu->title))) { char tmp[20]; sprintf(tmp, "Eterm_Menu_%u", menu_list->nummenus); menu_set_title(menu, tmp); - print_error("Parse error in file %s, line %lu: Menu context ended without giving a title. Defaulted to \"%s\".\n", + libast_print_error("Parse error in file %s, line %lu: Menu context ended without giving a title. Defaulted to \"%s\".\n", file_peek_path(), file_peek_line(), tmp); } menu_list = menulist_add_menu(menu_list, menu); return NULL; } if (!BEG_STRCASECMP(buff, "title ")) { - char *title = get_word(2, buff); + char *title = spiftool_get_word(2, buff); menu_set_title(menu, title); FREE(title); } else if (!BEG_STRCASECMP(buff, "font ")) { - char *name = get_word(2, buff); + char *name = spiftool_get_word(2, buff); if (!name) { - print_error("Parse error in file %s, line %lu: Missing font name.\n", file_peek_path(), file_peek_line()); + libast_print_error("Parse error in file %s, line %lu: Missing font name.\n", file_peek_path(), file_peek_line()); return ((void *) menu); } menu_set_font(menu, name); @@ -2135,7 +2143,7 @@ parse_menu(char *buff, void *state) menuitem_set_action(item, MENUITEM_SEP, (char *) NULL); } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", file_peek_path(), file_peek_line(), buff); } return ((void *) menu); @@ -2148,16 +2156,16 @@ parse_menuitem(char *buff, void *state) menuitem_t *curitem; ASSERT_RVAL(state != NULL, (void *) (file_skip_to_end(), NULL)); - if (*buff == CONF_BEGIN_CHAR) { + if (*buff == SPIFCONF_BEGIN_CHAR) { menu = (menu_t *) state; curitem = menuitem_create(NULL); return ((void *) curitem); } curitem = (menuitem_t *) state; ASSERT_RVAL(menu != NULL, state); - if (*buff == CONF_END_CHAR) { + if (*buff == SPIFCONF_END_CHAR) { if (!(curitem->text)) { - print_error("Parse error in file %s, line %lu: Menuitem context ended with no text given. Discarding this entry.\n", + libast_print_error("Parse error in file %s, line %lu: Menuitem context ended with no text given. Discarding this entry.\n", file_peek_path(), file_peek_line()); FREE(curitem); } else { @@ -2166,20 +2174,20 @@ parse_menuitem(char *buff, void *state) return ((void *) menu); } if (!BEG_STRCASECMP(buff, "text ")) { - char *text = get_word(2, buff); + char *text = spiftool_get_word(2, buff); if (!text) { - print_error("Parse error in file %s, line %lu: Missing menuitem text.\n", file_peek_path(), file_peek_line()); + libast_print_error("Parse error in file %s, line %lu: Missing menuitem text.\n", file_peek_path(), file_peek_line()); return ((void *) curitem); } menuitem_set_text(curitem, text); FREE(text); } else if (!BEG_STRCASECMP(buff, "rtext ")) { - char *rtext = get_word(2, buff); + char *rtext = spiftool_get_word(2, buff); if (!rtext) { - print_error("Parse error in file %s, line %lu: Missing menuitem right-justified text.\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Missing menuitem right-justified text.\n", file_peek_path(), file_peek_line()); return ((void *) curitem); } @@ -2189,8 +2197,8 @@ parse_menuitem(char *buff, void *state) } else if (!BEG_STRCASECMP(buff, "icon ")) { } else if (!BEG_STRCASECMP(buff, "action ")) { - char *type = get_pword(2, buff); - char *action = get_word(3, buff); + char *type = spiftool_get_pword(2, buff); + char *action = spiftool_get_word(3, buff); if (!BEG_STRCASECMP(type, "submenu ")) { menuitem_set_action(curitem, MENUITEM_SUBMENU, action); @@ -2208,13 +2216,13 @@ parse_menuitem(char *buff, void *state) menuitem_set_action(curitem, MENUITEM_SEP, action); } else { - print_error("Parse error in file %s, line %lu: Invalid menu item action \"%s\"\n", file_peek_path(), file_peek_line(), + libast_print_error("Parse error in file %s, line %lu: Invalid menu item action \"%s\"\n", file_peek_path(), file_peek_line(), NONULL(type)); } FREE(action); } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", file_peek_path(), file_peek_line(), buff); } return ((void *) curitem); @@ -2225,27 +2233,27 @@ parse_bbar(char *buff, void *state) { buttonbar_t *bbar; - if (*buff == CONF_BEGIN_CHAR) { + if (*buff == SPIFCONF_BEGIN_CHAR) { bbar = bbar_create(); return ((void *) bbar); } ASSERT_RVAL(state != NULL, (void *) (file_skip_to_end(), NULL)); bbar = (buttonbar_t *) state; - if (*buff == CONF_END_CHAR) { + if (*buff == SPIFCONF_END_CHAR) { bbar_add(bbar); return NULL; } if (!BEG_STRCASECMP(buff, "font ")) { - char *font = get_word(2, buff); + char *font = spiftool_get_word(2, buff); bbar_set_font(bbar, font); FREE(font); } else if (!BEG_STRCASECMP(buff, "dock ")) { - char *where = get_pword(2, buff); + char *where = spiftool_get_pword(2, buff); if (!where) { - print_error("Parse error in file %s, line %lu: Attribute dock requires a parameter\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Attribute dock requires a parameter\n", file_peek_path(), file_peek_line()); } else if (!BEG_STRCASECMP(where, "top")) { bbar_set_docked(bbar, BBAR_DOCKED_TOP); @@ -2254,24 +2262,24 @@ parse_bbar(char *buff, void *state) } else if (!BEG_STRCASECMP(where, "no")) { /* "no" or "none" */ bbar_set_docked(bbar, BBAR_UNDOCKED); } else { - print_error("Parse error in file %s, line %lu: Invalid parameter \"%s\" to attribute dock\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Invalid parameter \"%s\" to attribute dock\n", file_peek_path(), file_peek_line(), where); } } else if (!BEG_STRCASECMP(buff, "visible ")) { - char *tmp = get_pword(2, buff); + char *tmp = spiftool_get_pword(2, buff); if (BOOL_OPT_ISTRUE(tmp)) { bbar_set_visible(bbar, 1); } else if (BOOL_OPT_ISFALSE(tmp)) { bbar_set_visible(bbar, 0); } else { - print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" in context button_bar\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" in context button_bar\n", file_peek_path(), file_peek_line(), tmp); } } else if (!BEG_STRCASECMP(buff, "button ") || !BEG_STRCASECMP(buff, "rbutton ")) { - char *text = get_pword(2, buff); + char *text = spiftool_get_pword(2, buff); char *icon = strcasestr(buff, "icon "); char *action = strcasestr(buff, "action "); button_t *button; @@ -2279,10 +2287,10 @@ parse_bbar(char *buff, void *state) if (text == icon) { text = NULL; } else { - text = get_word(2, buff); + text = spiftool_get_word(2, buff); } if (!text && !icon) { - print_error("Parse error in file %s, line %lu: Missing button specifications\n", file_peek_path(), file_peek_line()); + libast_print_error("Parse error in file %s, line %lu: Missing button specifications\n", file_peek_path(), file_peek_line()); return ((void *) bbar); } @@ -2290,7 +2298,7 @@ parse_bbar(char *buff, void *state) if (icon) { simage_t *simg; - icon = get_word(2, icon); + icon = spiftool_get_word(2, icon); simg = create_simage(); if (load_image(icon, simg)) { button_set_icon(button, simg); @@ -2300,9 +2308,9 @@ parse_bbar(char *buff, void *state) FREE(icon); } if (action) { - char *type = get_pword(2, action); + char *type = spiftool_get_pword(2, action); - action = get_word(2, type); + action = spiftool_get_word(2, type); if (!BEG_STRCASECMP(type, "menu ")) { button_set_action(button, ETERM_ACTION_MENU, action); } else if (!BEG_STRCASECMP(type, "string ")) { @@ -2312,7 +2320,7 @@ parse_bbar(char *buff, void *state) } else if (!BEG_STRCASECMP(type, "script ")) { button_set_action(button, ETERM_ACTION_SCRIPT, action); } else { - print_error("Parse error in file %s, line %lu: Invalid button action \"%s\"\n", file_peek_path(), file_peek_line(), + libast_print_error("Parse error in file %s, line %lu: Invalid button action \"%s\"\n", file_peek_path(), file_peek_line(), type); FREE(action); FREE(button); @@ -2320,7 +2328,7 @@ parse_bbar(char *buff, void *state) } FREE(action); } else { - print_error("Parse error in file %s, line %lu: Missing button action\n", file_peek_path(), file_peek_line()); + libast_print_error("Parse error in file %s, line %lu: Missing button action\n", file_peek_path(), file_peek_line()); FREE(button); return ((void *) bbar); } @@ -2330,7 +2338,7 @@ parse_bbar(char *buff, void *state) bbar_add_button(bbar, button); } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", + libast_print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", file_peek_path(), file_peek_line(), buff); } return ((void *) bbar); @@ -2340,19 +2348,19 @@ static void * parse_xim(char *buff, void *state) { #ifdef USE_XIM - if ((*buff == CONF_BEGIN_CHAR) || (*buff == CONF_END_CHAR)) { + if ((*buff == SPIFCONF_BEGIN_CHAR) || (*buff == SPIFCONF_END_CHAR)) { return NULL; } if (!BEG_STRCASECMP(buff, "input_method ")) { - RESET_AND_ASSIGN(rs_input_method, get_word(2, buff)); + RESET_AND_ASSIGN(rs_input_method, spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "preedit_type ")) { - RESET_AND_ASSIGN(rs_preedit_type, get_word(2, buff)); + RESET_AND_ASSIGN(rs_preedit_type, spiftool_get_word(2, buff)); } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context xim\n", + libast_print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context xim\n", file_peek_path(), file_peek_line(), buff); } #else - print_warning("XIM support was not compiled in, ignoring entire context\n"); + libast_print_warning("XIM support was not compiled in, ignoring entire context\n"); file_poke_skip(1); #endif return state; @@ -2363,11 +2371,11 @@ static void * parse_multichar(char *buff, void *state) { #ifdef MULTI_CHARSET - if ((*buff == CONF_BEGIN_CHAR) || (*buff == CONF_END_CHAR)) { + if ((*buff == SPIFCONF_BEGIN_CHAR) || (*buff == SPIFCONF_END_CHAR)) { return NULL; } if (!BEG_STRCASECMP(buff, "encoding ")) { - RESET_AND_ASSIGN(rs_multichar_encoding, get_word(2, buff)); + RESET_AND_ASSIGN(rs_multichar_encoding, spiftool_get_word(2, buff)); if (rs_multichar_encoding != NULL) { if (BEG_STRCASECMP(rs_multichar_encoding, "eucj") && BEG_STRCASECMP(rs_multichar_encoding, "sjis") @@ -2376,46 +2384,46 @@ parse_multichar(char *buff, void *state) && BEG_STRCASECMP(rs_multichar_encoding, "gb") && BEG_STRCASECMP(rs_multichar_encoding, "iso-10646") && BEG_STRCASECMP(rs_multichar_encoding, "none")) { - print_error("Parse error in file %s, line %lu: Invalid multichar encoding mode \"%s\"\n", + libast_print_error("Parse error in file %s, line %lu: Invalid multichar encoding mode \"%s\"\n", file_peek_path(), file_peek_line(), rs_multichar_encoding); FREE(rs_multichar_encoding); return NULL; } } else { - print_error("Parse error in file %s, line %lu: Invalid parameter list \"\" for attribute encoding\n", + libast_print_error("Parse error in file %s, line %lu: Invalid parameter list \"\" for attribute encoding\n", file_peek_path(), file_peek_line()); } } else if (!BEG_STRCASECMP(buff, "font ")) { - char *tmp = get_pword(2, buff); + char *tmp = spiftool_get_pword(2, buff); unsigned long n; - if (num_words(buff) != 3) { - print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for attribute font\n", + if (spiftool_num_words(buff) != 3) { + libast_print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for attribute font\n", file_peek_path(), file_peek_line(), NONULL(tmp)); return NULL; } if (isdigit(*tmp)) { n = strtoul(tmp, (char **) NULL, 0); if (n <= 255) { - eterm_font_add(&etmfonts, get_pword(2, tmp), n); + eterm_font_add(&etmfonts, spiftool_get_pword(2, tmp), n); } else { - print_error("Parse error in file %s, line %lu: Invalid font index %d\n", file_peek_path(), file_peek_line(), n); + libast_print_error("Parse error in file %s, line %lu: Invalid font index %d\n", file_peek_path(), file_peek_line(), n); } } else { - tmp = get_word(1, tmp); - print_error("Parse error in file %s, line %lu: Invalid font index \"%s\"\n", file_peek_path(), file_peek_line(), + tmp = spiftool_get_word(1, tmp); + libast_print_error("Parse error in file %s, line %lu: Invalid font index \"%s\"\n", file_peek_path(), file_peek_line(), NONULL(tmp)); FREE(tmp); } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context multichar\n", + libast_print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context multichar\n", file_peek_path(), file_peek_line(), buff); } #else - if (*buff == CONF_BEGIN_CHAR) { - print_warning("Multichar support was not compiled in, ignoring entire context\n"); + if (*buff == SPIFCONF_BEGIN_CHAR) { + libast_print_warning("Multichar support was not compiled in, ignoring entire context\n"); file_poke_skip(1); } #endif @@ -2427,22 +2435,22 @@ static void * parse_escreen(char *buff, void *state) { #ifdef ESCREEN - if ((*buff == CONF_BEGIN_CHAR) || (*buff == CONF_END_CHAR)) { + if ((*buff == SPIFCONF_BEGIN_CHAR) || (*buff == SPIFCONF_END_CHAR)) { return NULL; } if (!BEG_STRCASECMP(buff, "url ")) { - RESET_AND_ASSIGN(rs_url, get_word(2, buff)); + RESET_AND_ASSIGN(rs_url, spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "firewall ")) { - RESET_AND_ASSIGN(rs_hop, get_word(2, buff)); + RESET_AND_ASSIGN(rs_hop, spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "delay ")) { - rs_delay = strtol(get_pword(2, buff), (char **) NULL, 0); + rs_delay = strtol(spiftool_get_pword(2, buff), (char **) NULL, 0); } else if (!BEG_STRCASECMP(buff, "bbar_font ")) { - RESET_AND_ASSIGN(rs_es_font, get_word(2, buff)); + RESET_AND_ASSIGN(rs_es_font, spiftool_get_word(2, buff)); } else if (!BEG_STRCASECMP(buff, "bbar_dock ")) { - char *where = get_pword(2, buff); + char *where = spiftool_get_pword(2, buff); if (!where) { - print_error("Parse error in file %s, line %lu: Attribute bbar_dock requires a parameter\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Attribute bbar_dock requires a parameter\n", file_peek_path(), file_peek_line()); } else if (!BEG_STRCASECMP(where, "top")) { rs_es_dock = BBAR_DOCKED_TOP; @@ -2451,15 +2459,15 @@ parse_escreen(char *buff, void *state) } else if (!BEG_STRCASECMP(where, "no")) { /* "no" or "none" */ rs_es_dock = BBAR_UNDOCKED; } else { - print_error("Parse error in file %s, line %lu: Invalid parameter \"%s\" to attribute bbar_dock\n", file_peek_path(), + libast_print_error("Parse error in file %s, line %lu: Invalid parameter \"%s\" to attribute bbar_dock\n", file_peek_path(), file_peek_line(), where); } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context escreen\n", + libast_print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context escreen\n", file_peek_path(), file_peek_line(), buff); } #else - print_warning("Escreen support was not compiled in, ignoring entire context\n"); + libast_print_warning("Escreen support was not compiled in, ignoring entire context\n"); file_poke_skip(1); #endif return state; @@ -2467,7 +2475,7 @@ parse_escreen(char *buff, void *state) } char * -conf_parse_theme(char **theme, char *conf_name, unsigned char fallback) +spifconf_parse_theme(char **theme, char *spifconf_name, unsigned char fallback) { static char path[CONFIG_BUFF]; char *ret = NULL; @@ -2481,22 +2489,22 @@ conf_parse_theme(char **theme, char *conf_name, unsigned char fallback) } else { snprintf(path, sizeof(path), CONFIG_SEARCH_PATH); } - shell_expand(path); + spifconf_shell_expand(path); } if (fallback & PARSE_TRY_USER_THEME) { - if (theme && *theme && (ret = conf_parse(conf_name, *theme, path)) != NULL) { + if (theme && *theme && (ret = spifconf_parse(spifconf_name, *theme, path)) != NULL) { return ret; } } if (fallback & PARSE_TRY_DEFAULT_THEME) { RESET_AND_ASSIGN(*theme, STRDUP(PACKAGE)); - if ((ret = conf_parse(conf_name, *theme, path)) != NULL) { + if ((ret = spifconf_parse(spifconf_name, *theme, path)) != NULL) { return ret; } } if (fallback & PARSE_TRY_NO_THEME) { RESET_AND_ASSIGN(*theme, NULL); - return (conf_parse(conf_name, *theme, path)); + return (spifconf_parse(spifconf_name, *theme, path)); } return NULL; } @@ -2521,7 +2529,7 @@ init_defaults(void) #if DEBUG >= DEBUG_MEM if (DEBUG_LEVEL >= DEBUG_MEM) { - memrec_init(); + spifmem_init(); } #endif @@ -2574,23 +2582,23 @@ init_defaults(void) actions = SPIF_VECTOR_NEW(array); /* Initialize the parser */ - conf_init_subsystem(); + spifconf_init_subsystem(); /* Register Eterm's context parsers. */ - conf_register_context("color", SPIF_CAST_C(ctx_handler_t) parse_color); - conf_register_context("attributes", SPIF_CAST_C(ctx_handler_t) parse_attributes); - conf_register_context("toggles", SPIF_CAST_C(ctx_handler_t) parse_toggles); - conf_register_context("keyboard", SPIF_CAST_C(ctx_handler_t) parse_keyboard); - conf_register_context("misc", SPIF_CAST_C(ctx_handler_t) parse_misc); - conf_register_context("imageclasses", SPIF_CAST_C(ctx_handler_t) parse_imageclasses); - conf_register_context("image", SPIF_CAST_C(ctx_handler_t) parse_image); - conf_register_context("actions", SPIF_CAST_C(ctx_handler_t) parse_actions); - conf_register_context("menu", SPIF_CAST_C(ctx_handler_t) parse_menu); - conf_register_context("menuitem", SPIF_CAST_C(ctx_handler_t) parse_menuitem); - conf_register_context("button_bar", SPIF_CAST_C(ctx_handler_t) parse_bbar); - conf_register_context("xim", SPIF_CAST_C(ctx_handler_t) parse_xim); - conf_register_context("multichar", SPIF_CAST_C(ctx_handler_t) parse_multichar); - conf_register_context("escreen", SPIF_CAST_C(ctx_handler_t) parse_escreen); + spifconf_register_context("color", (ctx_handler_t) parse_color); + spifconf_register_context("attributes", (ctx_handler_t) parse_attributes); + spifconf_register_context("toggles", (ctx_handler_t) parse_toggles); + spifconf_register_context("keyboard", (ctx_handler_t) parse_keyboard); + spifconf_register_context("misc", (ctx_handler_t) parse_misc); + spifconf_register_context("imageclasses", (ctx_handler_t) parse_imageclasses); + spifconf_register_context("image", (ctx_handler_t) parse_image); + spifconf_register_context("actions", (ctx_handler_t) parse_actions); + spifconf_register_context("menu", (ctx_handler_t) parse_menu); + spifconf_register_context("menuitem", (ctx_handler_t) parse_menuitem); + spifconf_register_context("button_bar", (ctx_handler_t) parse_bbar); + spifconf_register_context("xim", (ctx_handler_t) parse_xim); + spifconf_register_context("multichar", (ctx_handler_t) parse_multichar); + spifconf_register_context("escreen", (ctx_handler_t) parse_escreen); } /* Sync up options with our internal data after parsing options and configs */ @@ -2601,7 +2609,7 @@ post_parse(void) #if DEBUG > 0 if (DEBUG_LEVEL > DEBUG) { - print_warning("Requested debug level of %d exceeds compile-time maximum of %d\n", DEBUG_LEVEL, DEBUG); + libast_print_warning("Requested debug level of %d exceeds compile-time maximum of %d\n", DEBUG_LEVEL, DEBUG); } else if (DEBUG_LEVEL > 0) { DPRINTF1(("Now running with debugging level of %d\n", DEBUG_LEVEL)); } @@ -2612,22 +2620,22 @@ post_parse(void) #ifdef XTERM_SCROLLBAR scrollbar_set_type(SCROLLBAR_XTERM); #else - print_error("Support for xterm scrollbars was not compiled in. Sorry.\n"); + libast_print_error("Support for xterm scrollbars was not compiled in. Sorry.\n"); #endif } else if (!strcasecmp(rs_scrollbar_type, "next")) { #ifdef NEXT_SCROLLBAR scrollbar_set_type(SCROLLBAR_NEXT); #else - print_error("Support for NeXT scrollbars was not compiled in. Sorry.\n"); + libast_print_error("Support for NeXT scrollbars was not compiled in. Sorry.\n"); #endif } else if (!strcasecmp(rs_scrollbar_type, "motif")) { #ifdef MOTIF_SCROLLBAR scrollbar_set_type(SCROLLBAR_MOTIF); #else - print_error("Support for motif scrollbars was not compiled in. Sorry.\n"); + libast_print_error("Support for motif scrollbars was not compiled in. Sorry.\n"); #endif } else { - print_error("Unrecognized scrollbar type \"%s\".\n", rs_scrollbar_type); + libast_print_error("Unrecognized scrollbar type \"%s\".\n", rs_scrollbar_type); } } if (rs_scrollbar_width) { @@ -2727,7 +2735,7 @@ post_parse(void) if (rs_font_effects) { if (parse_font_fx(rs_font_effects) != 1) { - print_error("Syntax error in the font effects specified on the command line.\n"); + libast_print_error("Syntax error in the font effects specified on the command line.\n"); } RESET_AND_ASSIGN(rs_font_effects, NULL); } @@ -2925,7 +2933,7 @@ post_parse(void) FREE(rs_tint); } if (rs_cmod_image) { - unsigned char n = num_words(rs_cmod_image); + unsigned char n = spiftool_num_words(rs_cmod_image); imlib_t *iml = images[image_bg].norm->iml; if (iml->mod) { @@ -2934,17 +2942,17 @@ post_parse(void) iml->mod = create_colormod(); iml->mod->brightness = (int) strtol(rs_cmod_image, (char **) NULL, 0); if (n > 1) { - iml->mod->contrast = (int) strtol(get_pword(2, rs_cmod_image), (char **) NULL, 0); + iml->mod->contrast = (int) strtol(spiftool_get_pword(2, rs_cmod_image), (char **) NULL, 0); } if (n > 2) { - iml->mod->gamma = (int) strtol(get_pword(3, rs_cmod_image), (char **) NULL, 0); + iml->mod->gamma = (int) strtol(spiftool_get_pword(3, rs_cmod_image), (char **) NULL, 0); } D_PIXMAP(("From image cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_image, iml->mod->brightness, iml->mod->contrast, iml->mod->gamma)); FREE(rs_cmod_image); } if (rs_cmod_red) { - unsigned char n = num_words(rs_cmod_red); + unsigned char n = spiftool_num_words(rs_cmod_red); imlib_t *iml = images[image_bg].norm->iml; if (iml->rmod) { @@ -2953,10 +2961,10 @@ post_parse(void) iml->rmod = create_colormod(); iml->rmod->brightness = (int) strtol(rs_cmod_red, (char **) NULL, 0); if (n > 1) { - iml->rmod->contrast = (int) strtol(get_pword(2, rs_cmod_red), (char **) NULL, 0); + iml->rmod->contrast = (int) strtol(spiftool_get_pword(2, rs_cmod_red), (char **) NULL, 0); } if (n > 2) { - iml->rmod->gamma = (int) strtol(get_pword(3, rs_cmod_red), (char **) NULL, 0); + iml->rmod->gamma = (int) strtol(spiftool_get_pword(3, rs_cmod_red), (char **) NULL, 0); } D_PIXMAP(("From red cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_red, iml->rmod->brightness, iml->rmod->contrast, iml->rmod->gamma)); @@ -2964,7 +2972,7 @@ post_parse(void) update_cmod(iml->rmod); } if (rs_cmod_green) { - unsigned char n = num_words(rs_cmod_green); + unsigned char n = spiftool_num_words(rs_cmod_green); imlib_t *iml = images[image_bg].norm->iml; if (iml->gmod) { @@ -2973,10 +2981,10 @@ post_parse(void) iml->gmod = create_colormod(); iml->gmod->brightness = (int) strtol(rs_cmod_green, (char **) NULL, 0); if (n > 1) { - iml->gmod->contrast = (int) strtol(get_pword(2, rs_cmod_green), (char **) NULL, 0); + iml->gmod->contrast = (int) strtol(spiftool_get_pword(2, rs_cmod_green), (char **) NULL, 0); } if (n > 2) { - iml->gmod->gamma = (int) strtol(get_pword(3, rs_cmod_green), (char **) NULL, 0); + iml->gmod->gamma = (int) strtol(spiftool_get_pword(3, rs_cmod_green), (char **) NULL, 0); } D_PIXMAP(("From green cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_green, iml->gmod->brightness, iml->gmod->contrast, iml->gmod->gamma)); @@ -2984,7 +2992,7 @@ post_parse(void) update_cmod(iml->gmod); } if (rs_cmod_blue) { - unsigned char n = num_words(rs_cmod_blue); + unsigned char n = spiftool_num_words(rs_cmod_blue); imlib_t *iml = images[image_bg].norm->iml; if (iml->bmod) { @@ -2993,10 +3001,10 @@ post_parse(void) iml->bmod = create_colormod(); iml->bmod->brightness = (int) strtol(rs_cmod_blue, (char **) NULL, 0); if (n > 1) { - iml->bmod->contrast = (int) strtol(get_pword(2, rs_cmod_blue), (char **) NULL, 0); + iml->bmod->contrast = (int) strtol(spiftool_get_pword(2, rs_cmod_blue), (char **) NULL, 0); } if (n > 2) { - iml->bmod->gamma = (int) strtol(get_pword(3, rs_cmod_blue), (char **) NULL, 0); + iml->bmod->gamma = (int) strtol(spiftool_get_pword(3, rs_cmod_blue), (char **) NULL, 0); } D_PIXMAP(("From blue cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_blue, iml->bmod->brightness, iml->bmod->contrast, iml->bmod->gamma)); @@ -3056,28 +3064,28 @@ post_parse(void) unsigned long w, h; int count; - count = num_words(rs_anim_pixmap_list) - 1; /* -1 for the delay */ + count = spiftool_num_words(rs_anim_pixmap_list) - 1; /* -1 for the delay */ rs_anim_pixmaps = (char **) MALLOC(sizeof(char *) * (count + 1)); for (i = 0; i < count; i++) { - temp = get_word(i + 2, rs_anim_pixmap_list); /* +2 rather than +1 to account for the delay */ + temp = spiftool_get_word(i + 2, rs_anim_pixmap_list); /* +2 rather than +1 to account for the delay */ if (temp == NULL) break; - if (num_words(temp) != 3) { - if (num_words(temp) == 1) { + if (spiftool_num_words(temp) != 3) { + if (spiftool_num_words(temp) == 1) { rs_anim_pixmaps[i] = temp; } } else { - w1 = get_pword(1, temp); - h1 = get_pword(2, temp); + w1 = spiftool_get_pword(1, temp); + h1 = spiftool_get_pword(2, temp); w = strtol(w1, (char **) NULL, 0); h = strtol(h1, (char **) NULL, 0); if (w || h) { - rs_anim_pixmaps[i] = get_word(3, temp); + rs_anim_pixmaps[i] = spiftool_get_word(3, temp); rs_anim_pixmaps[i] = (char *) REALLOC(rs_anim_pixmaps[i], strlen(rs_anim_pixmaps[i]) + 9); strcat(rs_anim_pixmaps[i], "@100x100"); } else { - rs_anim_pixmaps[i] = get_word(3, temp); + rs_anim_pixmaps[i] = spiftool_get_word(3, temp); rs_anim_pixmaps[i] = (char *) REALLOC(rs_anim_pixmaps[i], strlen(rs_anim_pixmaps[i]) + 5); strcat(rs_anim_pixmaps[i], "@0x0"); } @@ -3096,14 +3104,14 @@ post_parse(void) struct stat fst; if (lstat(rs_pipe_name, &fst) != 0) { - print_error("Unable to stat console pipe \"%s\" -- %s\n", rs_pipe_name, strerror(errno)); + libast_print_error("Unable to stat console pipe \"%s\" -- %s\n", rs_pipe_name, strerror(errno)); } else { if (S_ISREG(fst.st_mode) || S_ISDIR(fst.st_mode)) { - print_error("Directories and regular files are not valid console pipes. Sorry.\n"); + libast_print_error("Directories and regular files are not valid console pipes. Sorry.\n"); } else { pipe_fd = open(rs_pipe_name, O_RDONLY | O_NDELAY | O_NOCTTY); if (pipe_fd < 0) { - print_error("Unable to open console pipe -- %s\n", strerror(errno)); + libast_print_error("Unable to open console pipe -- %s\n", strerror(errno)); } } } @@ -3148,7 +3156,7 @@ save_config(char *path, unsigned char save_theme) *(--tmp) = '/'; } if (!mkdirhier(path) || (stat(path, &fst) && !CAN_WRITE(fst))) { - print_error("I couldn't write to \"%s\" or \"%s\". I give up.", + libast_print_error("I couldn't write to \"%s\" or \"%s\". I give up.", (theme_dir ? theme_dir : PKGDATADIR "/themes/Eterm\n"), path); return errno; } @@ -3178,7 +3186,7 @@ save_config(char *path, unsigned char save_theme) *(--tmp) = '/'; } if (!mkdirhier(path) || (stat(path, &fst) && !CAN_WRITE(fst))) { - print_error("I couldn't write to \"%s\" or \"%s\". I give up.", + libast_print_error("I couldn't write to \"%s\" or \"%s\". I give up.", (user_dir ? user_dir : PKGDATADIR "/themes/Eterm\n"), path); return errno; } @@ -3198,7 +3206,7 @@ save_config(char *path, unsigned char save_theme) unlink(path); } if ((fp = fopen(path, "w")) == NULL) { - print_error("Unable to save configuration to file \"%s\" -- %s\n", path, strerror(errno)); + libast_print_error("Unable to save configuration to file \"%s\" -- %s\n", path, strerror(errno)); return errno; } strftime(dt_stamp, 50, "%Y/%m/%d at %X", cur_tm); @@ -3820,6 +3828,7 @@ save_config(char *path, unsigned char save_theme) fprintf(fp, "begin toggles\n"); fprintf(fp, " map_alert %d\n", (BITFIELD_IS_SET(vt_options, VT_OPTIONS_MAP_ALERT) ? 1 : 0)); + fprintf(fp, " urg_alert %d\n", (BITFIELD_IS_SET(vt_options, VT_OPTIONS_URG_ALERT) ? 1 : 0)); fprintf(fp, " visual_bell %d\n", (BITFIELD_IS_SET(vt_options, VT_OPTIONS_VISUAL_BELL) ? 1 : 0)); fprintf(fp, " login_shell %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_LOGIN_SHELL) ? 1 : 0)); fprintf(fp, " scrollbar %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR) ? 1 : 0)); @@ -3843,6 +3852,7 @@ save_config(char *path, unsigned char save_theme) fprintf(fp, " itrans %d\n", (BITFIELD_IS_SET(image_options, IMAGE_OPTIONS_ITRANS) ? 1 : 0)); fprintf(fp, " buttonbar %d\n", ((buttonbar && bbar_is_visible(buttonbar)) ? 1 : 0)); fprintf(fp, " resize_gravity %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_RESIZE_GRAVITY) ? 1 : 0)); + fprintf(fp, " sticky %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_STICKY) ? 1 : 0)); fprintf(fp, "end toggles\n\n"); fprintf(fp, "begin keyboard\n"); @@ -3888,10 +3898,7 @@ save_config(char *path, unsigned char save_theme) fprintf(fp, " min_anchor_size %d\n", rs_min_anchor_size); fprintf(fp, " border_width %d\n", TermWin.internalBorder); fprintf(fp, " term_name %s\n", getenv("TERM")); - fprintf(fp, " beep_command \"%s\"\n", SPIF_CAST_PTR(char) ((rs_beep_command) - ? (SPIF_CAST_PTR(char) rs_beep_command) - : (SPIF_CAST_PTR(char) "") - )); + fprintf(fp, " beep_command \"%s\"\n", (char *) ((rs_beep_command) ? (rs_beep_command) : (""))); fprintf(fp, " debug %d\n", DEBUG_LEVEL); if (save_theme && rs_exec_args) { @@ -3905,7 +3912,7 @@ save_config(char *path, unsigned char save_theme) if (rs_cutchars) { spif_charptr_t cut_chars_escaped; - cut_chars_escaped = escape_string(SPIF_CAST(charptr) rs_cutchars, '\"', 0); + cut_chars_escaped = escape_string((spif_charptr_t) rs_cutchars, '\"', 0); fprintf(fp, " cut_chars \"%s\"\n", (char *) cut_chars_escaped); } #endif diff --git a/src/options.h b/src/options.h index 5957cf6..00c3fdf 100644 --- a/src/options.h +++ b/src/options.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -42,6 +42,7 @@ # define VT_OPTIONS_BOLD_BRIGHTENS_FOREGROUND (1LU << 11) # define VT_OPTIONS_BLINK_BRIGHTENS_BACKGROUND (1LU << 12) # define VT_OPTIONS_COLORS_SUPPRESS_BOLD (1LU << 13) +# define VT_OPTIONS_URG_ALERT (1LU << 14) # define ETERM_OPTIONS_LOGIN_SHELL (1LU << 0) # define ETERM_OPTIONS_ICONIC (1LU << 1) @@ -61,6 +62,7 @@ # define ETERM_OPTIONS_DOUBLE_BUFFER (1LU << 15) # define ETERM_OPTIONS_MBYTE_CURSOR (1LU << 16) # define ETERM_OPTIONS_RESIZE_GRAVITY (1LU << 17) +# define ETERM_OPTIONS_STICKY (1LU << 18) # define IMAGE_OPTIONS_TRANS (1U << 0) # define IMAGE_OPTIONS_ITRANS (1U << 1) @@ -152,7 +154,7 @@ extern KeySym ks_smallfont; /************ Function Prototypes ************/ _XFUNCPROTOBEGIN -extern char *conf_parse_theme(char **theme, char *conf_name, unsigned char fallback); +extern char *spifconf_parse_theme(char **theme, char *spifconf_name, unsigned char fallback); extern void init_libast(void); extern void init_defaults(void); extern void post_parse(void); diff --git a/src/pixmap.c b/src/pixmap.c index 7db6f26..064bf25 100644 --- a/src/pixmap.c +++ b/src/pixmap.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -625,7 +625,7 @@ check_image_ipc(unsigned char reset) snprintf(buff, sizeof(buff), "imageclass %s query", iclass); reply = enl_send_and_wait(buff); if (strstr(reply, "not")) { - print_error("ImageClass \"%s\" is not defined in Enlightenment. Disallowing \"auto\" mode for this image.\n", iclass); + libast_print_error("ImageClass \"%s\" is not defined in Enlightenment. Disallowing \"auto\" mode for this image.\n", iclass); image_mode_fallback(i); } else if (strstr(reply, "Error")) { /* *INDENT-OFF* */ @@ -642,7 +642,7 @@ check_image_ipc(unsigned char reset) } ); /* *INDENT-ON* */ - print_error("Looks like this version of Enlightenment doesn't support the IPC " + libast_print_error("Looks like this version of Enlightenment doesn't support the IPC " "commands I need. Disallowing \"auto\" mode for all images.\n"); FREE(reply); checked = 2; @@ -686,17 +686,11 @@ create_trans_pixmap(simage_t *simg, unsigned char which, Drawable d, int x, int D_PIXMAP(("Created p [0x%08x] as a %hux%hu pixmap at %d, %d relative to window 0x%08x\n", p, width, height, x, y, desktop_window)); if (p != None) { - if (pw < scr->width || ph < scr->height) { - D_PIXMAP(("Tiling %ux%u desktop pixmap 0x%08x onto p.\n", pw, ph, desktop_pixmap)); - XSetTile(Xdisplay, gc, desktop_pixmap); - XSetTSOrigin(Xdisplay, gc, pw - (x % pw), ph - (y % ph)); - XSetFillStyle(Xdisplay, gc, FillTiled); - XFillRectangle(Xdisplay, p, gc, 0, 0, width, height); - } else { - D_PIXMAP(("Copying %hux%hu rectangle at %d, %d from %ux%u desktop pixmap 0x%08x onto p.\n", width, height, x, y, pw, ph, - desktop_pixmap)); - XCopyArea(Xdisplay, desktop_pixmap, p, gc, x, y, width, height, 0, 0); - } + D_PIXMAP(("Tiling %ux%u desktop pixmap 0x%08x onto p.\n", pw, ph, desktop_pixmap)); + XSetTile(Xdisplay, gc, desktop_pixmap); + XSetTSOrigin(Xdisplay, gc, pw - (x % pw), ph - (y % ph)); + XSetFillStyle(Xdisplay, gc, FillTiled); + XFillRectangle(Xdisplay, p, gc, 0, 0, width, height); if ((which != image_bg || (BITFIELD_IS_SET(image_options, IMAGE_OPTIONS_ITRANS)) || images[image_bg].current != images[image_bg].norm) && need_colormod(simg->iml)) { @@ -759,7 +753,7 @@ create_viewport_pixmap(simage_t *simg, Drawable d, int x, int y, unsigned short imlib_render_pixmaps_for_whole_image(&viewport_pixmap, &mask); } if (viewport_pixmap == None) { - print_error("Delayed image load failure for \"%s\". Using solid color mode.\n", imlib_image_get_filename()); + libast_print_error("Delayed image load failure for \"%s\". Using solid color mode.\n", imlib_image_get_filename()); image_set_mode(image_bg, MODE_SOLID); reset_simage(simg, RESET_ALL_SIMG); return None; @@ -834,13 +828,13 @@ paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsign snprintf(buff, sizeof(buff), "imageclass %s apply_copy 0x%x %s %hd %hd", iclass, (int) d, state, w, h); reply = enl_send_and_wait(buff); if (strstr(reply, "Error")) { - print_error + libast_print_error ("Enlightenment didn't seem to like something about my syntax. Disallowing \"auto\" mode for this image.\n"); image_mode_fallback(which); FREE(reply); } else { pmap = (Pixmap) strtoul(reply, (char **) NULL, 0); - mask = (Pixmap) strtoul(get_pword(2, reply), (char **) NULL, 0); + mask = (Pixmap) strtoul(spiftool_get_pword(2, reply), (char **) NULL, 0); FREE(reply); enl_ipc_sync(); if (pmap) { @@ -853,7 +847,7 @@ paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsign LIBAST_X_FREE_GC(gc); return; } else { - print_error + libast_print_error ("Enlightenment returned a null pixmap, which I can't use. Disallowing \"auto\" mode for this image.\n"); FREE(reply); image_mode_fallback(which); @@ -906,7 +900,7 @@ paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsign imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, w, h); } if (pmap == None) { - print_error("Delayed image load failure for \"%s\".\n", NONULL(imlib_image_get_filename())); + libast_print_error("Delayed image load failure for \"%s\".\n", NONULL(imlib_image_get_filename())); reset_simage(simg, RESET_ALL_SIMG); return; } @@ -1064,7 +1058,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h height); reply = enl_send_and_wait(buff); if (strstr(reply, "Error")) { - print_error + libast_print_error ("Enlightenment didn't seem to like something about my syntax. Disallowing \"auto\" mode for this image.\n"); image_mode_fallback(which); FREE(reply); @@ -1072,7 +1066,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h Pixmap pmap, mask; pmap = (Pixmap) strtoul(reply, (char **) NULL, 0); - mask = (Pixmap) strtoul(get_pword(2, reply), (char **) NULL, 0); + mask = (Pixmap) strtoul(spiftool_get_pword(2, reply), (char **) NULL, 0); FREE(reply); enl_ipc_sync(); if (pmap) { @@ -1094,7 +1088,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h snprintf(buff, sizeof(buff), "imageclass %s free_pixmap 0x%08x", iclass, (int) pmap); enl_ipc_send(buff); } else { - print_error + libast_print_error ("Enlightenment returned a null pixmap, which I can't use. Disallowing \"auto\" mode for this image.\n"); FREE(reply); image_mode_fallback(which); @@ -1251,6 +1245,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h } else if (renderop & RENDER_FORCE_PIXMAP) { pixmap = simg->pmap->pixmap; simg->pmap->pixmap = LIBAST_X_CREATE_PIXMAP(width, height); + D_PIXMAP(("Replacing pixmap 0x%08x with new pixmap 0x%08x.\n", pixmap, simg->pmap->pixmap)); XCopyArea(Xdisplay, pixmap, simg->pmap->pixmap, gc, 0, 0, width, height, 0, 0); IMLIB_FREE_PIXMAP(pixmap); } else { @@ -1273,7 +1268,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h } } } else { - print_error("Delayed image load failure for \"%s\". Using solid color mode.\n", imlib_image_get_filename()); + libast_print_error("Delayed image load failure for \"%s\". Using solid color mode.\n", imlib_image_get_filename()); image_set_mode(which, MODE_SOLID); reset_simage(simg, RESET_ALL_SIMG); } @@ -1452,7 +1447,7 @@ load_image(const char *file, simage_t *simg) if (f != NULL) { im = imlib_load_image_with_error_return(f, &im_err); if (im == NULL) { - print_error("Unable to load image file \"%s\" -- %s\n", file, imlib_strerror(im_err)); + libast_print_error("Unable to load image file \"%s\" -- %s\n", file, imlib_strerror(im_err)); return 0; } else { reset_simage(simg, (RESET_IMLIB_IM | RESET_PMAP_PIXMAP | RESET_PMAP_MASK)); @@ -1461,7 +1456,7 @@ load_image(const char *file, simage_t *simg) D_PIXMAP(("Found image %8p.\n", im)); return 1; } else { - print_error("Unable to locate file \"%s\" in image path.\n"); + libast_print_error("Unable to locate file \"%s\" in image path.\n"); } } reset_simage(simg, RESET_ALL_SIMG); @@ -1748,14 +1743,7 @@ shade_ximage_24(void *data, int bpl, int w, int h, int rm, int gm, int bm) void colormod_trans(Pixmap p, imlib_t *iml, GC gc, unsigned short w, unsigned short h) { - -#ifdef HAVE_SSE2 - XImage * __attribute__ ((aligned(16))) ximg; -#elif defined HAVE_MMX - XImage * __attribute__ ((aligned(8))) ximg; -#else XImage *ximg; -#endif register unsigned long i; #if 0 @@ -1824,7 +1812,7 @@ colormod_trans(Pixmap p, imlib_t *iml, GC gc, unsigned short w, unsigned short h } ximg = XGetImage(Xdisplay, p, 0, 0, w, h, -1, ZPixmap); if (ximg == NULL) { - print_warning("XGetImage(Xdisplay, 0x%08x, 0, 0, %d, %d, -1, ZPixmap) returned NULL.\n", p, w, h); + libast_print_warning("XGetImage(Xdisplay, 0x%08x, 0, 0, %d, %d, -1, ZPixmap) returned NULL.\n", p, w, h); return; } D_PIXMAP(("XGetImage(Xdisplay, 0x%08x, 0, 0, %d, %d, -1, ZPixmap) returned %8p.\n", p, w, h, ximg)); @@ -1887,6 +1875,7 @@ colormod_trans(Pixmap p, imlib_t *iml, GC gc, unsigned short w, unsigned short h if (ximg->bits_per_pixel != 32) { D_PIXMAP(("Rendering 24 bit\n")); shade_ximage_24(ximg->data, ximg->bytes_per_line, w, h, rm, gm, bm); + break; } /* drop */ case 32: @@ -1902,7 +1891,7 @@ colormod_trans(Pixmap p, imlib_t *iml, GC gc, unsigned short w, unsigned short h #endif break; default: - print_warning("Bit depth of %d is unsupported for tinting/shading.\n", real_depth); + libast_print_warning("Bit depth of %d is unsupported for tinting/shading.\n", real_depth); return; } } @@ -1927,7 +1916,7 @@ update_desktop_info(int *w, int *h) get_desktop_window(); } if (desktop_window == None) { - print_error("Unable to locate desktop window. If you are running Enlightenment, please\n" + libast_print_error("Unable to locate desktop window. If you are running Enlightenment, please\n" "restart. If not, please set your background image with Esetroot, then try again."); return 0; } @@ -1945,7 +1934,7 @@ update_desktop_info(int *w, int *h) XGetGeometry(Xdisplay, desktop_pixmap, &dummy, &px, &py, &pw, &ph, &pb, &pd); } if ((pw <= 0) || (ph <= 0)) { - print_error("Value of desktop pixmap property is invalid. Please restart your \n" + libast_print_error("Value of desktop pixmap property is invalid. Please restart your \n" "window manager or use Esetroot to set a new one."); desktop_pixmap = None; return 0; @@ -2190,7 +2179,7 @@ set_icon_pixmap(char *filename, XWMHints * pwm_hints) temp_im = imlib_load_image_with_error_return(icon_path, &im_err); if (temp_im == NULL) { - print_error("Unable to load icon file \"%s\" -- %s\n", icon_path, imlib_strerror(im_err)); + libast_print_error("Unable to load icon file \"%s\" -- %s\n", icon_path, imlib_strerror(im_err)); } else { /* If we're going to render the image anyway, might as well be nice and give it to the WM in a size it likes. */ if (XGetIconSizes(Xdisplay, Xroot, &icon_sizes, &count)) { diff --git a/src/pixmap.h b/src/pixmap.h index f8bf31e..e3d6ded 100644 --- a/src/pixmap.h +++ b/src/pixmap.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/profile.h b/src/profile.h index 98c63da..9676406 100644 --- a/src/profile.h +++ b/src/profile.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/screamcfg.h b/src/screamcfg.h index b23606d..e3fb00c 100644 --- a/src/screamcfg.h +++ b/src/screamcfg.h @@ -54,7 +54,7 @@ #define NS_SCREEN_PRVS_REG "\x01:focus up\r" #define NS_DFLT_SSH_PORT 22 -#define NS_MIN_PORT 1025 +#define NS_MIN_PORT 47323 #define NS_MAX_PORT 65535 #define NS_MAX_DISPS 512 @@ -68,12 +68,12 @@ #define NS_SCREEN_ACT_T "Activity in window " /* should be 1s */ -#define NS_INIT_DELAY 1 +#define NS_INIT_DELAY 2 /* how many seconds to wait for an SSH-tunnel to build when using the -Z option (tunnel through firewall). 2 for very fast networks, much more for slow connections. */ -#define NS_TUNNEL_DELAY 3 +#define NS_TUNNEL_DELAY 30 /* what to call the menu entry for Escreen */ #define NS_MENU_TITLE "Escreen" diff --git a/src/screen.c b/src/screen.c index f5dfa59..1aac33c 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1552,6 +1552,14 @@ scr_page(int direction, int nlines) void scr_bell(void) { + XWMHints *wm_hints; + + if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_URG_ALERT)) { + wm_hints = XGetWMHints(Xdisplay, TermWin.parent); + wm_hints->flags |= XUrgencyHint; + XSetWMHints(Xdisplay, TermWin.parent, wm_hints); + XFree(wm_hints); + } #ifndef NO_MAPALERT #ifdef MAPALERT_OPTION if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_MAP_ALERT)) @@ -1562,7 +1570,7 @@ scr_bell(void) scr_rvideo_mode(!rvideo); scr_rvideo_mode(!rvideo); } else if (!SPIF_PTR_ISNULL(rs_beep_command) && (*rs_beep_command)) { - system_no_wait(SPIF_CAST_C(char *)rs_beep_command); + system_no_wait((char *) rs_beep_command); } else { XBell(Xdisplay, 0); } @@ -2473,8 +2481,8 @@ selection_fetch(Window win, unsigned prop, int delete) return; } nread += nitems; - D_SELECT(("Got selection info: Actual type %d (format %d), %lu items at 0x%08x, %lu bytes left over.\n", (int) actual_type, - actual_fmt, nitems, data, bytes_after)); + D_SELECT(("Got selection info: Actual type %d (format %d), %lu items at 0x%08x, %lu bytes left over.\n", + (int) actual_type, actual_fmt, nitems, data, bytes_after)); if (nitems == 0) { D_SELECT(("Retrieval of incremental selection complete.\n")); @@ -2523,14 +2531,15 @@ selection_fetch(Window win, unsigned prop, int delete) void selection_copy_string(Atom sel, char *str, size_t len) { + D_SELECT(("Copying %ul bytes from 0x%08x to selection %d\n", len, str, (int) sel)); if (str == NULL || len == 0) { return; } if (IS_SELECTION(sel)) { - D_SELECT(("Copying selection to selection %d\n", (int) sel)); + D_SELECT(("Changing ownership of selection %d to my window 0x%08x\n", (int) sel, (int) TermWin.vt)); XSetSelectionOwner(Xdisplay, sel, TermWin.vt, CurrentTime); if (XGetSelectionOwner(Xdisplay, sel) != TermWin.vt) { - print_error("Can't take ownership of selection\n"); + libast_print_error("Can't take ownership of selection\n"); } } else { D_SELECT(("Copying selection to cut buffer %d\n", (int) sel)); @@ -2549,30 +2558,25 @@ selection_copy(Atom sel) void selection_paste(Atom sel) { + D_SELECT(("Attempting to paste selection %d.\n", (int) sel)); if (selection.text != NULL) { /* If we have a selection of our own, paste it. */ D_SELECT(("Pasting my current selection of length %lu\n", selection.len)); selection_write(selection.text, selection.len); } else if (IS_SELECTION(sel)) { - if (XGetSelectionOwner(Xdisplay, sel) == None) { - /* If nobody owns the current selection, just try to paste it ourselves. */ - D_SELECT(("Current selection %d unowned. Attempting to paste the default cut buffer.\n", (int) sel)); - selection_fetch(Xroot, XA_CUT_BUFFER0, False); - } else { - /* If someone owns the current selection, send a request to that client to - convert the selection to the appropriate form (usually XA_STRING) and - save it for us in the VT_SELECTION property. We'll then get a SelectionNotify. */ - D_SELECT(("Requesting current selection (%d) -> VT_SELECTION (%d)\n", sel, props[PROP_SELECTION_DEST])); + /* Request the current selection be converted to the appropriate + form (usually XA_STRING) and save it for us in the VT_SELECTION + property. We'll then get a SelectionNotify. */ + D_SELECT(("Requesting current selection (%d) -> VT_SELECTION (%d)\n", sel, props[PROP_SELECTION_DEST])); #if defined(MULTI_CHARSET) && defined(HAVE_X11_XMU_ATOMS_H) - if (encoding_method != LATIN1) { - XConvertSelection(Xdisplay, sel, XA_COMPOUND_TEXT(Xdisplay), props[PROP_SELECTION_DEST], TermWin.vt, CurrentTime); - } else { - XConvertSelection(Xdisplay, sel, XA_STRING, props[PROP_SELECTION_DEST], TermWin.vt, CurrentTime); - } -#else + if (encoding_method != LATIN1) { + XConvertSelection(Xdisplay, sel, XA_COMPOUND_TEXT(Xdisplay), props[PROP_SELECTION_DEST], TermWin.vt, CurrentTime); + } else { XConvertSelection(Xdisplay, sel, XA_STRING, props[PROP_SELECTION_DEST], TermWin.vt, CurrentTime); -#endif } +#else + XConvertSelection(Xdisplay, sel, XA_STRING, props[PROP_SELECTION_DEST], TermWin.vt, CurrentTime); +#endif } else { D_SELECT(("Pasting cut buffer %d.\n", (int) sel)); selection_fetch(Xroot, sel, False); @@ -3287,13 +3291,6 @@ selection_rotate(int x, int y) selection_extend_colrow(col, row, 1, 0); } -/* - * On some systems, the Atom typedef is 64 bits wide. We need to have a type - * that is exactly 32 bits wide, because a format of 64 is not allowed by - * the X11 protocol. - */ -typedef CARD32 Atom32; - /* * Respond to a request for our current selection * EXT: SelectionRequest @@ -3302,7 +3299,7 @@ void selection_send(XSelectionRequestEvent * rq) { XEvent ev; - Atom32 target_list[2]; + long target_list[2]; ev.xselection.type = SelectionNotify; ev.xselection.property = None; @@ -3313,10 +3310,10 @@ selection_send(XSelectionRequestEvent * rq) ev.xselection.time = rq->time; if (rq->target == props[PROP_SELECTION_TARGETS]) { - target_list[0] = (Atom32) props[PROP_SELECTION_TARGETS]; - target_list[1] = (Atom32) XA_STRING; + target_list[0] = props[PROP_SELECTION_TARGETS]; + target_list[1] = XA_STRING; XChangeProperty(Xdisplay, rq->requestor, rq->property, rq->target, - (8 * sizeof(target_list[0])), PropModeReplace, (unsigned char *) target_list, + 32, PropModeReplace, (unsigned char *) target_list, (sizeof(target_list) / sizeof(target_list[0]))); ev.xselection.property = rq->property; #if defined(MULTI_CHARSET) && defined(HAVE_X11_XMU_ATOMS_H) @@ -3329,8 +3326,8 @@ selection_send(XSelectionRequestEvent * rq) xtextp.nitems = 0; if (XmbTextListToTextProperty(Xdisplay, l, 1, XCompoundTextStyle, &xtextp) == Success) { if (xtextp.nitems > 0 && xtextp.value != NULL) { - XChangeProperty(Xdisplay, rq->requestor, rq->property, XA_COMPOUND_TEXT(Xdisplay), 8, PropModeReplace, xtextp.value, - xtextp.nitems); + XChangeProperty(Xdisplay, rq->requestor, rq->property, XA_COMPOUND_TEXT(Xdisplay), + 8, PropModeReplace, xtextp.value, xtextp.nitems); ev.xselection.property = rq->property; } } diff --git a/src/script.c b/src/script.c index f46e78d..7b9c8ea 100644 --- a/src/script.c +++ b/src/script.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -103,13 +103,13 @@ eterm_handle_winop(char *action) int x, y, n; char *xx, *yy; - n = num_words(action); + n = spiftool_num_words(action); if (n == 3 || n == 4) { if (n == 3) { win = TermWin.parent; } - xx = get_pword(n - 1, action); - yy = get_pword(n, action); + xx = spiftool_get_pword(n - 1, action); + yy = spiftool_get_pword(n, action); x = (int) strtol(xx, (char **) NULL, 0); y = (int) strtol(yy, (char **) NULL, 0); XMoveWindow(Xdisplay, win, x, y); @@ -118,13 +118,13 @@ eterm_handle_winop(char *action) int w, h, n; char *ww, *hh; - n = num_words(action); + n = spiftool_num_words(action); if (n == 3 || n == 4) { if (n == 3) { win = TermWin.parent; } - ww = get_pword(n - 1, action); - hh = get_pword(n, action); + ww = spiftool_get_pword(n - 1, action); + hh = spiftool_get_pword(n, action); w = (int) strtol(ww, (char **) NULL, 0); h = (int) strtol(hh, (char **) NULL, 0); XResizeWindow(Xdisplay, win, w, h); @@ -134,7 +134,7 @@ eterm_handle_winop(char *action) } else if (!BEG_STRCASECMP(action, "iconify")) { XIconifyWindow(Xdisplay, win, Xscreen); } else { - print_error("IPC Error: Unrecognized window operation \"%s\"\n", action); + libast_print_error("IPC Error: Unrecognized window operation \"%s\"\n", action); } } #endif @@ -153,7 +153,7 @@ eterm_handle_winop(char *action) * the "primary" buffer (XA_PRIMARY in Xlib-speak). */ void -script_handler_copy(char **params) +script_handler_copy(spif_charptr_t *params) { unsigned char i; char *buffer_id; @@ -171,7 +171,7 @@ script_handler_copy(char **params) } else if (!BEG_STRCASECMP(buffer_id, "secondary")) { sel = XA_SECONDARY; } else { - print_error("Invalid parameter to copy(): \"%s\"\n", buffer_id); + libast_print_error("Invalid parameter to copy(): \"%s\"\n", buffer_id); } } } @@ -186,9 +186,9 @@ script_handler_copy(char **params) * is the string of characters to send to the pty. */ void -script_handler_echo(char **params) +script_handler_echo(spif_charptr_t *params) { - char **tmp; + spif_charptr_t *tmp; for (tmp = params; tmp && *tmp; tmp++) { tt_write(*tmp, strlen(*tmp)); @@ -205,7 +205,7 @@ script_handler_echo(char **params) * and no message. */ void -script_handler_exit(char **params) +script_handler_exit(spif_charptr_t *params) { unsigned char code = 0; char *tmp; @@ -214,7 +214,7 @@ script_handler_exit(char **params) if (isdigit(params[0][0]) || (params[0][0] == '-' && isdigit(params[0][1]))) { code = (unsigned char) atoi(params[0]); } else { - tmp = join(" ", params); + tmp = spiftool_join(" ", params); printf("Exiting: %s\n", tmp); FREE(tmp); } @@ -230,7 +230,7 @@ script_handler_exit(char **params) * specified, SIGTERM is the default. */ void -script_handler_kill(char **params) +script_handler_kill(spif_charptr_t *params) { int sig; @@ -254,7 +254,7 @@ script_handler_kill(char **params) * the "primary" buffer (XA_PRIMARY in Xlib-speak). */ void -script_handler_paste(char **params) +script_handler_paste(spif_charptr_t *params) { unsigned char i; char *buffer_id; @@ -272,7 +272,7 @@ script_handler_paste(char **params) } else if (!BEG_STRCASECMP(buffer_id, "secondary")) { sel = XA_SECONDARY; } else { - print_error("Invalid parameter to paste(): \"%s\"\n", buffer_id); + libast_print_error("Invalid parameter to paste(): \"%s\"\n", buffer_id); } } } @@ -291,7 +291,7 @@ script_handler_paste(char **params) * will be theme.cfg. */ void -script_handler_save(char **params) +script_handler_save(spif_charptr_t *params) { if (params && *params) { if (!strcasecmp(params[0], "theme")) { @@ -312,7 +312,7 @@ script_handler_save(char **params) * the specified file. */ void -script_handler_save_buff(char **params) +script_handler_save_buff(spif_charptr_t *params) { if (params && *params) { scr_dump_to_file(params[0]); @@ -334,7 +334,7 @@ script_handler_save_buff(char **params) * and the type may be passed as a second parameter if you wish. */ void -script_handler_scroll(char **params) +script_handler_scroll(spif_charptr_t *params) { char *type; double cnt_float; @@ -361,7 +361,7 @@ script_handler_scroll(char **params) } else if (str_leading_match("buffers", type)) { count = (long) (cnt_float * (TermWin.nrow + TermWin.saveLines)); } else { - print_error("Invalid modifier \"%s\" in scroll()\n", type); + libast_print_error("Invalid modifier \"%s\" in scroll()\n", type); return; } } else { @@ -384,7 +384,7 @@ script_handler_scroll(char **params) * search() will clear the previously-highlighted search term. */ void -script_handler_search(char **params) +script_handler_search(spif_charptr_t *params) { static char *search = NULL; @@ -406,12 +406,12 @@ script_handler_search(char **params) * If no command is specified, the default is to execute another Eterm. */ void -script_handler_spawn(char **params) +script_handler_spawn(spif_charptr_t *params) { char *tmp; if (params && *params) { - tmp = join(" ", params); + tmp = spiftool_join(" ", params); system_no_wait(tmp); FREE(tmp); } else { @@ -426,9 +426,9 @@ script_handler_spawn(char **params) * is the string of characters to send to the handler. */ void -script_handler_string(char **params) +script_handler_string(spif_charptr_t *params) { - char **tmp; + spif_charptr_t *tmp; for (tmp = params; tmp && *tmp; tmp++) { cmd_write(*tmp, strlen(*tmp)); @@ -442,13 +442,13 @@ script_handler_string(char **params) * is the command to be executed. */ void -script_handler_exec_dialog(char **params) +script_handler_exec_dialog(spif_charptr_t *params) { char *tmp; int ret; if (params && *params) { - tmp = join(" ", params); + tmp = spiftool_join(" ", params); } else { tmp = NULL; } @@ -469,12 +469,12 @@ script_handler_exec_dialog(char **params) * is the message to present. */ void -script_handler_msgbox(char **params) +script_handler_msgbox(spif_charptr_t *params) { char *tmp; if (params && *params) { - tmp = join(" ", params); + tmp = spiftool_join(" ", params); scr_refresh(DEFAULT_REFRESH); menu_dialog(NULL, tmp, 1, NULL, NULL); FREE(tmp); @@ -500,7 +500,7 @@ script_handler_msgbox(char **params) * scrollback - View the scrollback for a display */ void -script_handler_es_display(char **params) +script_handler_es_display(spif_charptr_t *params) { _ns_sess *sess = TermWin.screen; char *p, *a; @@ -511,7 +511,7 @@ script_handler_es_display(char **params) return; } - p = downcase_str(*params); + p = spiftool_downcase_str(*params); a = params[index++]; if (a && isdigit(*a)) { no = atoi(a); @@ -565,7 +565,7 @@ script_handler_es_display(char **params) D_ESCREEN(("View scrollback on display %d\n", no)); ns_sbb_disp(sess, no); } else { - print_error("Error in script: \"display\" has no sub-function \"%s\".\n", p); + libast_print_error("Error in script: \"display\" has no sub-function \"%s\".\n", p); } } @@ -588,7 +588,7 @@ script_handler_es_display(char **params) * scrollback - View the scrollback for a region */ void -script_handler_es_region(char **params) +script_handler_es_region(spif_charptr_t *params) { _ns_sess *sess = TermWin.screen; _ns_disp *disp; @@ -606,7 +606,7 @@ script_handler_es_region(char **params) return; } - p = downcase_str(*params); + p = spiftool_downcase_str(*params); a = params[index++]; if (a && isdigit(*a)) { no = atoi(a); @@ -626,7 +626,7 @@ script_handler_es_region(char **params) } else if (!strcmp(p, "toggle")) { D_ESCREEN(("Toggle region of display %8p\n", disp)); ns_tog_region(sess, disp); - } else if (!strcmp(p, "new") || !strcmp(p, "split")) { + } else if (!strcmp(p, "new") || !strcmp(p, "spiftool_split")) { if (!a || !*a || !strcasecmp(a, "ask")) { D_ESCREEN(("region new ask\n")); ns_add_region(sess, disp, no, NULL); @@ -660,7 +660,7 @@ script_handler_es_region(char **params) D_ESCREEN(("View scrollback for region %d of display %8p\n", no, disp)); ns_sbb_region(sess, disp, no); } else { - print_error("Error in script: \"region\" has no sub-function \"%s\".\n", p); + libast_print_error("Error in script: \"region\" has no sub-function \"%s\".\n", p); } } @@ -671,12 +671,12 @@ script_handler_es_region(char **params) * is the Escreen (screen) statement to execute. */ void -script_handler_es_statement(char **params) +script_handler_es_statement(spif_charptr_t *params) { char *tmp; if (params && *params) { - tmp = join(" ", params); + tmp = spiftool_join(" ", params); ns_statement(TermWin.screen, tmp); FREE(tmp); } else { @@ -689,7 +689,7 @@ script_handler_es_statement(char **params) * Syntax: es_reset() */ void -script_handler_es_reset(char **params) +script_handler_es_reset(spif_charptr_t *params) { USE_VAR(params); ns_reset(TermWin.screen, 0); @@ -703,7 +703,7 @@ script_handler_es_reset(char **params) * This function can be used to cancel undesired default behavior. */ void -script_handler_nop(char **params) +script_handler_nop(spif_charptr_t *params) { USE_VAR(params); } @@ -728,7 +728,7 @@ eterm_script_handler_t *script_find_handler(const char *name) void script_parse(char *s) { - char **token_list, **param_list; + spif_charptr_t *token_list, *param_list; register char *pstr; register unsigned long i; char *func_name, *params, *tmp; @@ -739,7 +739,7 @@ script_parse(char *s) D_SCRIPT(("Parsing: \"%s\"\n", s)); - token_list = split(";", s); + token_list = spiftool_split(";", s); if (token_list == NULL) { D_SCRIPT(("No tokens found; ignoring script.\n")); return; @@ -747,7 +747,7 @@ script_parse(char *s) for (i = 0; token_list[i]; i++) { pstr = token_list[i]; - chomp(pstr); + spiftool_chomp(pstr); if (!(*pstr)) { continue; } @@ -758,15 +758,15 @@ script_parse(char *s) strncpy(func_name, pstr, len); func_name[len] = 0; } else { - print_error("Error in script \"%s\": Missing function name before \"%s\".\n", s, params); - free_array((void **) token_list, 0); + libast_print_error("Error in script \"%s\": Missing function name before \"%s\".\n", s, params); + spiftool_free_array((void **) token_list, 0); return; } } else { func_name = STRDUP(pstr); } if (!func_name) { - free_array((void **) token_list, 0); + spiftool_free_array((void **) token_list, 0); return; } if (params) { @@ -774,11 +774,11 @@ script_parse(char *s) if ((tmp = strrchr(params, ')')) != NULL) { *tmp = 0; } else { - print_error("Error in script \"%s\": Missing closing parentheses for \"%s\".\n", s, token_list[i]); - free_array((void **) token_list, 0); + libast_print_error("Error in script \"%s\": Missing closing parentheses for \"%s\".\n", s, token_list[i]); + spiftool_free_array((void **) token_list, 0); return; } - param_list = split(", \t", params); + param_list = spiftool_split(", \t", params); } else { param_list = NULL; } @@ -786,12 +786,12 @@ script_parse(char *s) if ((func = script_find_handler(func_name)) != NULL) { (func->handler) (param_list); } else { - print_error("Error in script \"%s\": No such function \"%s\".\n", s, func_name); + libast_print_error("Error in script \"%s\": No such function \"%s\".\n", s, func_name); } } if (params) { - free_array((void **) param_list, 0); + spiftool_free_array((void **) param_list, 0); } - free_array((void **) token_list, 0); + spiftool_free_array((void **) token_list, 0); } diff --git a/src/script.h b/src/script.h index 1649e19..4588b24 100644 --- a/src/script.h +++ b/src/script.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -31,7 +31,7 @@ /************ Macros and Definitions ************/ /************ Structures ************/ -typedef void (*eterm_script_handler_function_t)(char **); +typedef void (*eterm_script_handler_function_t)(spif_charptr_t *); typedef struct { char *name; eterm_script_handler_function_t handler; @@ -43,26 +43,26 @@ typedef struct { _XFUNCPROTOBEGIN /* Handlers */ -extern void script_handler_copy(char **); -extern void script_handler_echo(char **); -extern void script_handler_exec_dialog(char **); -extern void script_handler_exit(char **); -extern void script_handler_kill(char **); -extern void script_handler_msgbox(char **); -extern void script_handler_paste(char **); -extern void script_handler_save(char **); -extern void script_handler_save_buff(char **); -extern void script_handler_scroll(char **); -extern void script_handler_search(char **); -extern void script_handler_spawn(char **); -extern void script_handler_string(char **); -extern void script_handler_nop(char **); +extern void script_handler_copy(spif_charptr_t *); +extern void script_handler_echo(spif_charptr_t *); +extern void script_handler_exec_dialog(spif_charptr_t *); +extern void script_handler_exit(spif_charptr_t *); +extern void script_handler_kill(spif_charptr_t *); +extern void script_handler_msgbox(spif_charptr_t *); +extern void script_handler_paste(spif_charptr_t *); +extern void script_handler_save(spif_charptr_t *); +extern void script_handler_save_buff(spif_charptr_t *); +extern void script_handler_scroll(spif_charptr_t *); +extern void script_handler_search(spif_charptr_t *); +extern void script_handler_spawn(spif_charptr_t *); +extern void script_handler_string(spif_charptr_t *); +extern void script_handler_nop(spif_charptr_t *); #ifdef ESCREEN -extern void script_handler_es_display(char **); -extern void script_handler_es_region(char **); -extern void script_handler_es_statement(char **); -extern void script_handler_es_reset(char **); +extern void script_handler_es_display(spif_charptr_t *); +extern void script_handler_es_region(spif_charptr_t *); +extern void script_handler_es_statement(spif_charptr_t *); +extern void script_handler_es_reset(spif_charptr_t *); #endif /* Engine */ diff --git a/src/scrollbar.c b/src/scrollbar.c index 65a062a..26229dc 100644 --- a/src/scrollbar.c +++ b/src/scrollbar.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -924,7 +924,7 @@ scrollbar_drawing_init(void) #ifdef XTERM_SCROLLBAR gcvalue.stipple = XCreateBitmapFromData(Xdisplay, scrollbar.win, (char *) xterm_sb_bits, 12, 2); if (!gcvalue.stipple) { - print_error("Unable to create xterm scrollbar bitmap.\n\n"); + libast_print_error("Unable to create xterm scrollbar bitmap.\n\n"); if (scrollbar_get_type() == SCROLLBAR_XTERM) { scrollbar_set_type(SCROLLBAR_MOTIF); } diff --git a/src/scrollbar.h b/src/scrollbar.h index f70bd4b..000968b 100644 --- a/src/scrollbar.h +++ b/src/scrollbar.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/sse2_cmod.c b/src/sse2_cmod.c index 48d6e94..f2a35de 100644 --- a/src/sse2_cmod.c +++ b/src/sse2_cmod.c @@ -1,12 +1,17 @@ -/* File: sse2_cmod.c - * Written and Copyright (C) 2005 by Tres Melton +/* + * Copyright (C) 1997-2009, Michael Jennings * - * Permission is hereby granted to Michael Jennings to license this code as - * he sees fit. I'd prefer the GPL but he will choose the BSD. The debate - * is moot as this is to become a part of the Eterm project, for which he is - * the primary author. For users of this code I ask that any modifications - * be released back into the community but with Michael Jennings chooses the - * BSD license then that request has no backing in law. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies of the Software, its documentation and marketing & publicity + * materials, and acknowledgment shall be given in the documentation, materials + * and software packages that this Software was used. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -15,8 +20,9 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * Ported from Willem Monsuwe's original x86/MMX assembly + * code by Tres Melton in 2005 and 2006. Anything copyrightable by me is + * assigned to the Eterm project and its founder/maintainer: Michael Jennings. * * Much inspiration was drawn from the original x86 MMX port written by * Willem Monsuwe in pure x86/MMX Assembly. The MMX @@ -25,6 +31,8 @@ * ensure they worked with various gcc options. Further the code was * extended to take advantage of the 128 bit xmm registers in SSE2. * + * The imlib2 code in Enlightenment also has a lot to teach on the subject. + * * Manuals used in this port: * The Gnu Assembler * http://www.gnu.org/software/binutils/manual/gas-2.9.1/html_mono/as.html @@ -65,21 +73,7 @@ * assembly code in C functions is the only way to ensure that this code will continue to * function through a (however unlikely) change. If pure assembly were to be used as the * original MMX author, Willem Monsuwe, did and the ABI changed then this code would cease - * to function properly. After examination of Willem's code I'm wondering if he - * wrote it for GNU/Linux originally. The ENTER and LEAVE macros put all of the - * parameters on the stack so that they can be accessed by references to the Base_Pointer - * the way that ANSI C is defined. If he originally wrote this for GNU/Linux then he most - * likely would have just used the registers instead of unwinding those optimizations - * manually by pushing them to the stack. And if he explicitly wanted to use the stack - * then there are parameters to gcc that would have performed those operations for him: - * -mregparm/-mmemparm. Other gcc options that can tweak with the stack and the number - * of registers available for function parameters are: -fcall-used/-fcall-saved, - * -fcaller-saves, -fstack-protector, -fPIC/-fpic, -mno-push-args, etc.. It might be - * advisable to check for these switches when using the original MMX code and emit a - * warning if any are enabled. I know that the PIC option trashes the BX register and - * that both Willem and I use that register. In other words If you do manage to get it - * to compile & run w/ -fpic it WILL break. On the plus side, you can keep the pieces! :-) - * On the other hand I could be wrong about everything + * to function properly. * * In Conclusion: * Using C functions and inline assembly code should alleviate all of the concerns as the @@ -94,268 +88,473 @@ #ifdef HAVE_SSE2 -void -shade_ximage_15_sse2(volatile void *data, volatile int bpl, volatile int w, volatile int h, volatile int rm, volatile int gm, - volatile int bm) +void shade_ximage_15_sse2( volatile void *data, volatile int bpl, volatile int w, volatile int h, volatile int rm, volatile int gm, volatile int bm ) { - __asm__ __volatile__(".align 16 \n\t" /* SIMD instructions should be aligned on 16 byte (128 bit) boundraries for performance reasons. */ - "leaq -14(%%rsi, %%rbx, 2), %%rsi\n\t" /* Load the stack index register with a pointer to data + ( width * bytes/pixel ) -6 */ - "negq %%rbx \n\t" /* Negate the width to that we can increment the counter */ - "jz 10f \n\t" /* Jump to end if the line count is zero */ - "movd %[red_mod], %%xmm5 \n\t" /* Load the color modifiers into mmx registers */ - "movd %[green_mod], %%xmm6 \n\t" /* " " */ - "movd %[blue_mod], %%xmm7 \n\t" /* " " */ - "punpcklwd %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low words. From A64_128bit_Media_Programming (p. 380) */ - "punpcklwd %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 16 bits into the next 16 bits (both operands are the same) */ - "punpcklwd %%xmm7, %%xmm7 \n\t" "punpckldq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low double words. From A64_128bit_Media_Programming (p. 376) */ - "punpckldq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 32 bits into the next 32 bits (both operands are the same) */ - "punpckldq %%xmm7, %%xmm7 \n\t" "punpcklqdq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low quad words. From A64_128bit_Media_Programming (p. 378) */ - "punpcklqdq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 64 bits into the next 64 bits (both operands are the same) */ - "punpcklqdq %%xmm7, %%xmm7 \n\t" "or %[red_mod], %[green_mod] \n\t" /* This, and the following 4 instructions, check to see if all three colormodifiers are */ - "or %[blue_mod], %[green_mod] \n\t" /* less than 256. If any of the modifiers are > 256 then they will have the 9th, or higher, */ - "sar $8, %[green_mod] \n\t" /* bit set. Then we shift off eight bits, leaving something set if a modifier > 256. */ - "movq %%rax, %[blue_mod] \n\t" /* Use the register named blue_mod to now store bytes_per_line. */ - "xor %[red_mod], %[red_mod] \n\t" /* zero red so we don't have to load an immediate value for the following compare. */ - "cmp %[red_mod], %[green_mod] \n\t" /* Compare the left over bits to zero */ - "jg 5f \n\t" /* If one of the colors (might) need saturated then jump to the secondary set of loops. */ - "1: \n\t" /* Start of the outer loop (lines). */ - "movq %%rbx, %%rcx \n\t" /* Move the width into the count register */ - "addq $7, %%rcx \n\t" "jns 3f \n\t" "2: \n\t" /* Start of the inner loop (pixels 8 at a time --> 8 * 16 = 128bits/xmm register ) */ - "movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t" /* Load the 16 bits of the pixel (5 bits for red, 6 bits for green, 5 bits for blue) */ - "movdqu %%xmm0, %%xmm1 \n\t" /* Create a copy of the pixel for the green color */ - "movdqu %%xmm0, %%xmm2 \n\t" /* Create a copy of the pixel for the blue color */ - "psrlw $5, %%xmm1 \n\t" /* Packed Shift Right Logical Words */ - /* From A64_128bit_Media_Programming (p. 347) */ - /* Shifts the blue off of the green color */ - "psrlw $10, %%xmm0 \n\t" /* Shifts the blue & green off of the red color */ - "psllw $11, %%xmm2 \n\t" /* Packed Shift Left Logical Words */ - /* From A64_128bit_Media_Programming (p. 330) */ - /* Shifts the red & green off of the blue color */ - "psllw $11, %%xmm1 \n\t" /* Shifts the red off of the green color */ - "psllw $8, %%xmm0 \n\t" /* Shifts the red color into position */ - "psrlw $3, %%xmm1 \n\t" /* Shifts the green color into position */ - "psrlw $3, %%xmm2 \n\t" /* Shifts the blue color into position */ - "pmulhw %%xmm5, %%xmm0 \n\t" /* color *= modifier */ - "pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" "psllw $10, %%xmm0 \n\t" /* Shift red back into its original position */ - "psllw $5, %%xmm1 \n\t" /* Shift green back into its original position */ - "por %%xmm2, %%xmm0 \n\t" /* Mesh the colors back together */ - "por %%xmm1, %%xmm0 \n\t" "movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t" /* Place the shaded 8 pixels back into the image map */ - "addq $8, %%rcx \n\t" "js 2b \n\t" "jmp 4f \n\t" "3: \n\t" /* Deal with pixels one at a time here. */ - "movw (%%rsi, %%rcx, 2), %%ax \n\t" "movd %%eax, %%xmm0 \n\t" "movq %%xmm0, %%xmm1 \n\t" "movq %%xmm0, %%xmm2 \n\t" "psrlw $5, %%xmm1 \n\t" "psrlw $10, %%xmm0 \n\t" "psllw $11, %%xmm2 \n\t" "psllw $11, %%xmm1 \n\t" "psllw $8, %%xmm0 \n\t" "psrlw $3, %%xmm1 \n\t" "psrlw $3, %%xmm2 \n\t" "pmulhw %%xmm5, %%xmm0 \n\t" "pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" "psllw $10, %%xmm0 \n\t" "psllw $5, %%xmm1 \n\t" "por %%xmm2, %%xmm0 \n\t" "por %%xmm1, %%xmm0 \n\t" "movd %%xmm0, %%eax \n\t" "movw %%ax, (%%rsi, %%rcx, 2) \n\t" "incq %%rcx \n\t" "4: \n\t" "cmpq $6, %%rcx \n\t" "jng 3b \n\t" "addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */ - "decq %%rdx \n\t" "jnz 1b \n\t" "jmp 10f \n\t" /* We're done! */ - "5: \n\t" /* Saturation is required */ - "pcmpeqw %%xmm3, %%xmm3 \n\t" /* Packed Compare Equal Words */ - /* From A64_128bit_Media_Programming (p. 276) */ - /* This sets xmm3 to 128 1's (since mm6 = mm6) */ - "psllw $5, %%xmm3 \n\t" /* xmm3 = 8 copies of 1111 1111 1110 0000 */ - "6: \n\t" "movq %%rbx, %%rcx \n\t" "addq $7, %%rcx \n\t" "jns 8f \n\t" "7: \n\t" "movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t" "movdqu %%xmm0, %%xmm1 \n\t" "movdqu %%xmm0, %%xmm2 \n\t" "psrlw $5, %%xmm1 \n\t" "psrlw $10, %%xmm0 \n\t" "psllw $11, %%xmm2 \n\t" "psllw $11, %%xmm1 \n\t" "psllw $8, %%xmm0 \n\t" "psrlw $3, %%xmm1 \n\t" "psrlw $3, %%xmm2 \n\t" "pmulhw %%xmm5, %%xmm0 \n\t" "pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" "paddusw %%xmm3, %%xmm0 \n\t" "paddusw %%xmm3, %%xmm1 \n\t" "paddusw %%xmm3, %%xmm2 \n\t" "psubw %%xmm3, %%xmm0 \n\t" /* FIXME: This line needs added to the original asm code */ - "psubw %%xmm3, %%xmm1 \n\t" "psubw %%xmm3, %%xmm2 \n\t" "psllw $10, %%xmm0 \n\t" "psllw $5, %%xmm1 \n\t" "por %%xmm2, %%xmm0 \n\t" "por %%xmm1, %%xmm0 \n\t" "movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t" "addq $8, %%rcx \n\t" "js 7b \n\t" "jmp 9f \n\t" "8: \n\t" "movw (%%rsi, %%rcx, 2), %%ax \n\t" "movd %%eax, %%xmm0 \n\t" "movq %%xmm0, %%xmm1 \n\t" "movq %%xmm0, %%xmm2 \n\t" "psrlw $5, %%xmm1 \n\t" "psrlw $10, %%xmm0 \n\t" "psllw $11, %%xmm2 \n\t" "psllw $11, %%xmm1 \n\t" "psllw $8, %%xmm0 \n\t" "psrlw $3, %%xmm1 \n\t" "psrlw $3, %%xmm2 \n\t" "pmulhw %%xmm5, %%xmm0 \n\t" "pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" "paddusw %%xmm3, %%xmm0 \n\t" "paddusw %%xmm3, %%xmm1 \n\t" "paddusw %%xmm3, %%xmm2 \n\t" "psubw %%xmm3, %%xmm0 \n\t" /* FIXME: This line needs added to the original asm code */ - "psubw %%xmm3, %%xmm1 \n\t" "psubw %%xmm3, %%xmm2 \n\t" "psllw $10, %%xmm0 \n\t" "psllw $5, %%xmm1 \n\t" "por %%xmm2, %%xmm0 \n\t" "por %%xmm1, %%xmm0 \n\t" "movd %%xmm0, %%eax \n\t" "movw %%ax, (%%rsi, %%rcx, 2) \n\t" "incq %%rcx \n\t" "9: \n\t" "cmpq $6, %%rcx \n\t" "jng 8b \n\t" "addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */ - "decq %%rdx \n\t" "jnz 6b \n\t" "10: \n\t" /* This is the end. Jump here if the line count is zero. */ - "emms \n\t" /* exit multi-media state (last asm instruction) */ - : /* outputs: none */ - /* inputs: (many operations cannot be performed with a mix of 32bit & 64bit operands directly) */ - /* (however the compiler/assembler can preload 32bit values into 64bit registers) */ - /* (that is why certain variables cannot be referenced by name -- use their register) */ - :[data] "S"(data), /* put the pointer data into the rsi register */ - [width] "b"(w), /* put the width in the %rbx register (cannot be referenced by name) */ - [height] "d"(h), /* put the heigth in the %rdx register (cannot be referenced by name) */ - [red_mod] "r"((unsigned long) (rm)), /* put the red_modifier in a register (referenced by name) */ - [green_mod] "r"((unsigned long) (gm)), /* put the green_modifier in a register (referenced by name) */ - [blue_mod] "r"((unsigned long) (bm)), /* put the blue_modifier in a register (referenced by name) Later store the bytes_line here */ - [bytes_line] "a"(bpl) /* put the bytes_per_line in the %rax register (cannot be referenced by name) */ - :"memory" /* clobbers: (memory includes all the registers) */ - ); /* End of Assembly */ + __asm__ __volatile__ ( + ".align 16 \n\t" /* SIMD instructions should be aligned on 16 byte (128 bit) boundraries for performance reasons.*/ + "leaq -14(%%rsi, %%rbx, 2), %%rsi\n\t" /* Load the stack index register with a pointer to data + ( width * bytes/pixel ) -6 */ + "negq %%rbx \n\t" /* Negate the width to that we can increment the counter */ + "jz 10f \n\t" /* Jump to end if the line count is zero */ + "movd %[red_mod], %%xmm5 \n\t" /* Load the color modifiers into mmx registers */ + "movd %[green_mod], %%xmm6 \n\t" /* " " */ + "movd %[blue_mod], %%xmm7 \n\t" /* " " */ + "punpcklwd %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low words. From A64_128bit_Media_Programming (p. 380) */ + "punpcklwd %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 16 bits into the next 16 bits (both operands are the same) */ + "punpcklwd %%xmm7, %%xmm7 \n\t" + "punpckldq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low double words. From A64_128bit_Media_Programming (p. 376) */ + "punpckldq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 32 bits into the next 32 bits (both operands are the same) */ + "punpckldq %%xmm7, %%xmm7 \n\t" + "punpcklqdq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low quad words. From A64_128bit_Media_Programming (p. 378) */ + "punpcklqdq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 64 bits into the next 64 bits (both operands are the same) */ + "punpcklqdq %%xmm7, %%xmm7 \n\t" + "or %[red_mod], %[green_mod] \n\t" /* This, and the following 4 instructions, check to see if all three colormodifiers are */ + "or %[blue_mod], %[green_mod] \n\t" /* less than 256. If any of the modifiers are > 256 then they will have the 9th, or higher, */ + "sar $8, %[green_mod] \n\t" /* bit set. Then we shift off eight bits, leaving something set if a modifier > 256. */ + "movq %%rax, %[blue_mod] \n\t" /* Use the register named blue_mod to now store bytes_per_line. */ + "xor %[red_mod], %[red_mod] \n\t" /* zero red so we don't have to load an immediate value for the following compare. */ + "cmp %[red_mod], %[green_mod] \n\t" /* Compare the left over bits to zero */ + "jg 5f \n\t" /* If one of the colors (might) need saturated then jump to the secondary set of loops. */ + "1: \n\t" /* Start of the outer loop (lines). */ + "movq %%rbx, %%rcx \n\t" /* Move the width into the count register */ + "addq $7, %%rcx \n\t" + "jns 3f \n\t" + "2: \n\t" /* Start of the inner loop (pixels 8 at a time --> 8 * 16 = 128bits/xmm register ) */ + "movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t" /* Load the 16 bits of the pixel (5 bits for red, 6 bits for green, 5 bits for blue) */ + "movdqa %%xmm0, %%xmm1 \n\t" /* Create a copy of the pixel for the green color */ + "movdqa %%xmm0, %%xmm2 \n\t" /* Create a copy of the pixel for the blue color */ + "psrlw $5, %%xmm1 \n\t" /* Packed Shift Right Logical Words */ + /* From A64_128bit_Media_Programming (p. 347) */ + /* Shifts the blue off of the green color */ + "psrlw $10, %%xmm0 \n\t" /* Shifts the blue & green off of the red color */ + "psllw $11, %%xmm2 \n\t" /* Packed Shift Left Logical Words */ + /* From A64_128bit_Media_Programming (p. 330) */ + /* Shifts the red & green off of the blue color */ + "psllw $11, %%xmm1 \n\t" /* Shifts the red off of the green color */ + "psllw $8, %%xmm0 \n\t" /* Shifts the red color into position */ + "psrlw $3, %%xmm1 \n\t" /* Shifts the green color into position */ + "psrlw $3, %%xmm2 \n\t" /* Shifts the blue color into position */ + "pmulhw %%xmm5, %%xmm0 \n\t" /* color *= modifier */ + "pmulhw %%xmm6, %%xmm1 \n\t" + "pmulhw %%xmm7, %%xmm2 \n\t" + "psllw $10, %%xmm0 \n\t" /* Shift red back into its original position */ + "psllw $5, %%xmm1 \n\t" /* Shift green back into its original position */ + "por %%xmm2, %%xmm0 \n\t" /* Mesh the colors back together */ + "por %%xmm1, %%xmm0 \n\t" + "movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t" /* Place the shaded 8 pixels back into the image map */ + "addq $8, %%rcx \n\t" + "js 2b \n\t" + "jmp 4f \n\t" + "3: \n\t" /* Deal with pixels one at a time here. */ + "movw (%%rsi, %%rcx, 2), %%ax \n\t" + "movd %%eax, %%xmm0 \n\t" + "movq %%xmm0, %%xmm1 \n\t" + "movq %%xmm0, %%xmm2 \n\t" + "psrlw $5, %%xmm1 \n\t" + "psrlw $10, %%xmm0 \n\t" + "psllw $11, %%xmm2 \n\t" + "psllw $11, %%xmm1 \n\t" + "psllw $8, %%xmm0 \n\t" + "psrlw $3, %%xmm1 \n\t" + "psrlw $3, %%xmm2 \n\t" + "pmulhw %%xmm5, %%xmm0 \n\t" + "pmulhw %%xmm6, %%xmm1 \n\t" + "pmulhw %%xmm7, %%xmm2 \n\t" + "psllw $10, %%xmm0 \n\t" + "psllw $5, %%xmm1 \n\t" + "por %%xmm2, %%xmm0 \n\t" + "por %%xmm1, %%xmm0 \n\t" + "movd %%xmm0, %%eax \n\t" + "movw %%ax, (%%rsi, %%rcx, 2) \n\t" + "incq %%rcx \n\t" + "4: \n\t" + "cmpq $6, %%rcx \n\t" + "jng 3b \n\t" + "addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */ + "decq %%rdx \n\t" + "jnz 1b \n\t" + "jmp 10f \n\t" /* We're done! */ + + "5: \n\t" /* Saturation is required */ + "pcmpeqw %%xmm3, %%xmm3 \n\t" /* Packed Compare Equal Words */ + /* From A64_128bit_Media_Programming (p. 276) */ + /* This sets xmm3 to 128 1's (since mm6 = mm6) */ + "psllw $5, %%xmm3 \n\t" /* xmm3 = 8 copies of 1111 1111 1110 0000 */ + "6: \n\t" + "movq %%rbx, %%rcx \n\t" + "addq $7, %%rcx \n\t" + "jns 8f \n\t" + "7: \n\t" + "movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t" + "movdqa %%xmm0, %%xmm1 \n\t" + "movdqa %%xmm0, %%xmm2 \n\t" + "psrlw $5, %%xmm1 \n\t" + "psrlw $10, %%xmm0 \n\t" + "psllw $11, %%xmm2 \n\t" + "psllw $11, %%xmm1 \n\t" + "psllw $8, %%xmm0 \n\t" + "psrlw $3, %%xmm1 \n\t" + "psrlw $3, %%xmm2 \n\t" + "pmulhw %%xmm5, %%xmm0 \n\t" + "pmulhw %%xmm6, %%xmm1 \n\t" + "pmulhw %%xmm7, %%xmm2 \n\t" + "paddusw %%xmm3, %%xmm0 \n\t" + "paddusw %%xmm3, %%xmm1 \n\t" + "paddusw %%xmm3, %%xmm2 \n\t" + "psubw %%xmm3, %%xmm0 \n\t" /* FIXME: This line needs added to the original asm code */ + "psubw %%xmm3, %%xmm1 \n\t" + "psubw %%xmm3, %%xmm2 \n\t" + "psllw $10, %%xmm0 \n\t" + "psllw $5, %%xmm1 \n\t" + "por %%xmm2, %%xmm0 \n\t" + "por %%xmm1, %%xmm0 \n\t" + "movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t" + "addq $8, %%rcx \n\t" + "js 7b \n\t" + "jmp 9f \n\t" + "8: \n\t" + "movw (%%rsi, %%rcx, 2), %%ax \n\t" + "movd %%eax, %%xmm0 \n\t" + "movq %%xmm0, %%xmm1 \n\t" + "movq %%xmm0, %%xmm2 \n\t" + "psrlw $5, %%xmm1 \n\t" + "psrlw $10, %%xmm0 \n\t" + "psllw $11, %%xmm2 \n\t" + "psllw $11, %%xmm1 \n\t" + "psllw $8, %%xmm0 \n\t" + "psrlw $3, %%xmm1 \n\t" + "psrlw $3, %%xmm2 \n\t" + "pmulhw %%xmm5, %%xmm0 \n\t" + "pmulhw %%xmm6, %%xmm1 \n\t" + "pmulhw %%xmm7, %%xmm2 \n\t" + "paddusw %%xmm3, %%xmm0 \n\t" + "paddusw %%xmm3, %%xmm1 \n\t" + "paddusw %%xmm3, %%xmm2 \n\t" + "psubw %%xmm3, %%xmm0 \n\t" /* FIXME: This line needs added to the original asm code */ + "psubw %%xmm3, %%xmm1 \n\t" + "psubw %%xmm3, %%xmm2 \n\t" + "psllw $10, %%xmm0 \n\t" + "psllw $5, %%xmm1 \n\t" + "por %%xmm2, %%xmm0 \n\t" + "por %%xmm1, %%xmm0 \n\t" + "movd %%xmm0, %%eax \n\t" + "movw %%ax, (%%rsi, %%rcx, 2) \n\t" + "incq %%rcx \n\t" + "9: \n\t" + "cmpq $6, %%rcx \n\t" + "jng 8b \n\t" + "addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */ + "decq %%rdx \n\t" + "jnz 6b \n\t" + "10: \n\t" /* This is the end. Jump here if the line count is zero. */ + "emms \n\t" /* exit multi-media state (last asm instruction) */ + : /* outputs: none */ + /* inputs: (many operations cannot be performed with a mix of 32bit & 64bit operands directly) */ + /* (however the compiler/assembler can preload 32bit values into 64bit registers) */ + /* (that is why certain variables cannot be referenced by name -- use their register) */ + : [data] "S" (data), /* put the pointer data into the rsi register */ + [width] "b" (w), /* put the width in the %rbx register (cannot be referenced by name) */ + [height] "d" (h), /* put the heigth in the %rdx register (cannot be referenced by name) */ + [red_mod] "r" ((unsigned long)(rm)),/* put the red_modifier in a register (referenced by name) */ + [green_mod] "r" ((unsigned long)(gm)),/* put the green_modifier in a register (referenced by name) */ + [blue_mod] "r" ((unsigned long)(bm)),/* put the blue_modifier in a register (referenced by name) Later store the bytes_line here */ + [bytes_line] "a" (bpl) /* put the bytes_per_line in the %rax register (cannot be referenced by name) */ + : "memory" /* clobbers: (memory includes all the registers) */ + ); /* End of Assembly */ } -void -shade_ximage_16_sse2(volatile void *data, volatile int bpl, volatile int w, volatile int h, volatile int rm, volatile int gm, - volatile int bm) +void shade_ximage_16_sse2( volatile void *data, volatile int bpl, volatile int w, volatile int h, volatile int rm, volatile int gm, volatile int bm ) { - __asm__ __volatile__(".align 16 \n\t" /* SIMD instructions should be aligned on 16 byte (128 bit) boundraries for performance reasons. */ - "leaq -14(%%rsi, %%rbx, 2), %%rsi\n\t" /* Load the stack index register with a pointer to data + ( width * bytes/pixel ) -6 */ - "negq %%rbx \n\t" /* Negate the width to that we can increment the counter */ - "jz 10f \n\t" /* Jump to end if the line count is zero */ - "movd %[red_mod], %%xmm5 \n\t" /* Load the color modifiers into mmx registers */ - "movd %[green_mod], %%xmm6 \n\t" /* " " */ - "movd %[blue_mod], %%xmm7 \n\t" /* " " */ - "punpcklwd %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low words. From A64_128bit_Media_Programming (p. 380) */ - "punpcklwd %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 16 bits into the next 16 bits (both operands are the same) */ - "punpcklwd %%xmm7, %%xmm7 \n\t" "punpckldq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low double words. From A64_128bit_Media_Programming (p. 376) */ - "punpckldq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 32 bits into the next 32 bits (both operands are the same) */ - "punpckldq %%xmm7, %%xmm7 \n\t" "punpcklqdq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low quad words. From A64_128bit_Media_Programming (p. 378) */ - "punpcklqdq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 64 bits into the next 64 bits (both operands are the same) */ - "punpcklqdq %%xmm7, %%xmm7 \n\t" "or %[red_mod], %[green_mod] \n\t" /* This, and the following 4 instructions, check to see if all three colormodifiers are */ - "or %[blue_mod], %[green_mod] \n\t" /* less than 256. If any of the modifiers are > 256 then they will have the 9th, or higher, */ - "sar $8, %[green_mod] \n\t" /* bit set. Then we shift off eight bits, leaving something set if a modifier > 256. */ - "movq %%rax, %[blue_mod] \n\t" /* Use the register named blue_mod to now store bytes_per_line. */ - "xor %[red_mod], %[red_mod] \n\t" /* zero red so we don't have to load an immediate value for the following compare. */ - "cmp %[red_mod], %[green_mod] \n\t" /* Compare the left over bits to zero */ - "jg 5f \n\t" /* If one of the colors (might) need saturated then jump to the secondary set of loops. */ - "1: \n\t" /* Start of the outer loop (lines). */ - "movq %%rbx, %%rcx \n\t" /* Move the width into the count register */ - "addq $7, %%rcx \n\t" "jns 3f \n\t" "2: \n\t" /* Start of the inner loop (pixels 8 at a time --> 8 * 16 = 128bits/xmm register ) */ - "movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t" /* Load the 16 bits of the pixel (5 bits for red, 6 bits for green, 5 bits for blue) */ - "movdqu %%xmm0, %%xmm1 \n\t" /* Create a copy of the pixel for the green color */ - "movdqu %%xmm0, %%xmm2 \n\t" /* Create a copy of the pixel for the blue color */ - "psrlw $5, %%xmm1 \n\t" /* Packed Shift Right Logical Words */ - /* From A64_128bit_Media_Programming (p. 347) */ - /* Shifts the blue off of the green color */ - "psrlw $11, %%xmm0 \n\t" /* Shifts the blue & green off of the red color */ - "psllw $11, %%xmm2 \n\t" /* Packed Shift Left Logical Words */ - /* From A64_128bit_Media_Programming (p. 330) */ - /* Shifts the red & green off of the blue color */ - "psllw $10, %%xmm1 \n\t" /* Shifts the red off of the green color */ - "psllw $8, %%xmm0 \n\t" /* Shifts the red color into position */ - "psrlw $2, %%xmm1 \n\t" /* Shifts the green color into position */ - "psrlw $3, %%xmm2 \n\t" /* Shifts the blue color into position */ - "pmulhw %%xmm5, %%xmm0 \n\t" /* color *= modifier */ - "pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" "psllw $11, %%xmm0 \n\t" /* Shift red back into its original position */ - "psllw $5, %%xmm1 \n\t" /* Shift green back into its original position */ - "por %%xmm2, %%xmm0 \n\t" /* Mesh the colors back together */ - "por %%xmm1, %%xmm0 \n\t" "movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t" /* Place the shaded 8 pixels back into the image map */ - "addq $8, %%rcx \n\t" "js 2b \n\t" "jmp 4f \n\t" "3: \n\t" /* Deal with pixels one at a time here. */ - "movw (%%rsi, %%rcx, 2), %%ax \n\t" "movd %%eax, %%xmm0 \n\t" "movq %%xmm0, %%xmm1 \n\t" "movq %%xmm0, %%xmm2 \n\t" "psrlw $5, %%xmm1 \n\t" "psrlw $11, %%xmm0 \n\t" "psllw $11, %%xmm2 \n\t" "psllw $10, %%xmm1 \n\t" "psllw $8, %%xmm0 \n\t" "psrlw $2, %%xmm1 \n\t" "psrlw $3, %%xmm2 \n\t" "pmulhw %%xmm5, %%xmm0 \n\t" "pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" "psllw $11, %%xmm0 \n\t" "psllw $5, %%xmm1 \n\t" "por %%xmm2, %%xmm0 \n\t" "por %%xmm1, %%xmm0 \n\t" "movd %%xmm0, %%eax \n\t" "movw %%ax, (%%rsi, %%rcx, 2) \n\t" "incq %%rcx \n\t" "4: \n\t" "cmpq $6, %%rcx \n\t" "jng 3b \n\t" "addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */ - "decq %%rdx \n\t" "jnz 1b \n\t" "jmp 10f \n\t" /* We're done! */ - "5: \n\t" /* Saturation is required */ - "pcmpeqw %%xmm3, %%xmm3 \n\t" /* Packed Compare Equal Words */ - /* From A64_128bit_Media_Programming (p. 276) */ - /* This sets xmm3 to 128 1's (since mm6 = mm6) */ - "movdqu %%xmm3, %%xmm4 \n\t" /* Make copy of 128 ones */ - "psllw $5, %%xmm3 \n\t" /* xmm3 = 8 copies of 1111 1111 1110 0000 */ - "psllw $6, %%xmm4 \n\t" /* xmm4 = 8 copies of 1111 1111 1100 0000 */ - "6: \n\t" "movq %%rbx, %%rcx \n\t" "addq $7, %%rcx \n\t" "jns 8f \n\t" "7: \n\t" "movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t" "movdqu %%xmm0, %%xmm1 \n\t" "movdqu %%xmm0, %%xmm2 \n\t" "psrlw $5, %%xmm1 \n\t" "psrlw $11, %%xmm0 \n\t" "psllw $11, %%xmm2 \n\t" "psllw $10, %%xmm1 \n\t" "psllw $8, %%xmm0 \n\t" "psrlw $2, %%xmm1 \n\t" "psrlw $3, %%xmm2 \n\t" "pmulhw %%xmm5, %%xmm0 \n\t" "pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" "paddusw %%xmm3, %%xmm0 \n\t" "paddusw %%xmm4, %%xmm1 \n\t" "paddusw %%xmm3, %%xmm2 \n\t" "psubw %%xmm4, %%xmm1 \n\t" "psubw %%xmm3, %%xmm2 \n\t" "psllw $11, %%xmm0 \n\t" "psllw $5, %%xmm1 \n\t" "por %%xmm2, %%xmm0 \n\t" "por %%xmm1, %%xmm0 \n\t" "movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t" "addq $8, %%rcx \n\t" "js 7b \n\t" "jmp 9f \n\t" "8: \n\t" "movw (%%rsi, %%rcx, 2), %%ax \n\t" "movd %%eax, %%xmm0 \n\t" "movq %%xmm0, %%xmm1 \n\t" "movq %%xmm0, %%xmm2 \n\t" "psrlw $5, %%xmm1 \n\t" "psrlw $11, %%xmm0 \n\t" "psllw $11, %%xmm2 \n\t" "psllw $10, %%xmm1 \n\t" "psllw $8, %%xmm0 \n\t" "psrlw $2, %%xmm1 \n\t" "psrlw $3, %%xmm2 \n\t" " \n\t" "pmulhw %%xmm5, %%xmm0 \n\t" "pmulhw %%xmm6, %%xmm1 \n\t" "pmulhw %%xmm7, %%xmm2 \n\t" " \n\t" "paddusw %%xmm3, %%xmm0 \n\t" "paddusw %%xmm4, %%xmm1 \n\t" "paddusw %%xmm3, %%xmm2 \n\t" " \n\t" "psubw %%xmm4, %%xmm1 \n\t" "psubw %%xmm3, %%xmm2 \n\t" " \n\t" "psllw $11, %%xmm0 \n\t" "psllw $5, %%xmm1 \n\t" "por %%xmm2, %%xmm0 \n\t" "por %%xmm1, %%xmm0 \n\t" "movd %%xmm0, %%eax \n\t" "movw %%ax, (%%rsi, %%rcx, 2) \n\t" "incq %%rcx \n\t" "9: \n\t" "cmpq $6, %%rcx \n\t" "jng 8b \n\t" "addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */ - "decq %%rdx \n\t" "jnz 6b \n\t" "10: \n\t" /* This is the end. Jump here if the line count is zero. */ - "emms \n\t" /* exit multi-media state (last asm instruction) */ - : /* outputs: none */ - /* inputs: (many operations cannot be performed with a mix of 32bit & 64bit operands directly) */ - /* (however the compiler/assembler can preload 32bit values into 64bit registers) */ - /* (that is why certain variables cannot be referenced by name -- use their register) */ - :[data] "S"(data), /* put the pointer data into the rsi register */ - [width] "b"(w), /* put the width in the %rbx register (cannot be referenced by name) */ - [height] "d"(h), /* put the heigth in the %rdx register (cannot be referenced by name) */ - [red_mod] "r"((unsigned long) (rm)), /* put the red_modifier in a register (referenced by name) */ - [green_mod] "r"((unsigned long) (gm)), /* put the green_modifier in a register (referenced by name) */ - [blue_mod] "r"((unsigned long) (bm)), /* put the blue_modifier in a register (referenced by name) Later store the bytes_line here */ - [bytes_line] "a"(bpl) /* put the bytes_per_line in the %rax register (cannot be referenced by name) */ - :"memory" /* clobbers: (memory includes all the registers) */ - ); /* End of Assembly */ + __asm__ __volatile__ ( + ".align 16 \n\t" /* SIMD instructions should be aligned on 16 byte (128 bit) boundraries for performance reasons.*/ + "leaq -14(%%rsi, %%rbx, 2), %%rsi\n\t" /* Load the stack index register with a pointer to data + ( width * bytes/pixel ) -6 */ + "negq %%rbx \n\t" /* Negate the width to that we can increment the counter */ + "jz 10f \n\t" /* Jump to end if the line count is zero */ + "movd %[red_mod], %%xmm5 \n\t" /* Load the color modifiers into mmx registers */ + "movd %[green_mod], %%xmm6 \n\t" /* " " */ + "movd %[blue_mod], %%xmm7 \n\t" /* " " */ + "punpcklwd %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low words. From A64_128bit_Media_Programming (p. 380) */ + "punpcklwd %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 16 bits into the next 16 bits (both operands are the same) */ + "punpcklwd %%xmm7, %%xmm7 \n\t" + "punpckldq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low double words. From A64_128bit_Media_Programming (p. 376) */ + "punpckldq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 32 bits into the next 32 bits (both operands are the same) */ + "punpckldq %%xmm7, %%xmm7 \n\t" + "punpcklqdq %%xmm5, %%xmm5 \n\t" /* Unpack and Interleave low quad words. From A64_128bit_Media_Programming (p. 378) */ + "punpcklqdq %%xmm6, %%xmm6 \n\t" /* Duplicate the bottom 64 bits into the next 64 bits (both operands are the same) */ + "punpcklqdq %%xmm7, %%xmm7 \n\t" + "or %[red_mod], %[green_mod] \n\t" /* This, and the following 4 instructions, check to see if all three colormodifiers are */ + "or %[blue_mod], %[green_mod] \n\t" /* less than 256. If any of the modifiers are > 256 then they will have the 9th, or higher, */ + "sar $8, %[green_mod] \n\t" /* bit set. Then we shift off eight bits, leaving something set if a modifier > 256. */ + "movq %%rax, %[blue_mod] \n\t" /* Use the register named blue_mod to now store bytes_per_line. */ + "xor %[red_mod], %[red_mod] \n\t" /* zero red so we don't have to load an immediate value for the following compare. */ + "cmp %[red_mod], %[green_mod] \n\t" /* Compare the left over bits to zero */ + "jg 5f \n\t" /* If one of the colors (might) need saturated then jump to the secondary set of loops. */ + "1: \n\t" /* Start of the outer loop (lines). */ + "movq %%rbx, %%rcx \n\t" /* Move the width into the count register */ + "addq $7, %%rcx \n\t" + "jns 3f \n\t" + "2: \n\t" /* Start of the inner loop (pixels 8 at a time --> 8 * 16 = 128bits/xmm register ) */ + "movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t" /* Load the 16 bits of the pixel (5 bits for red, 6 bits for green, 5 bits for blue) */ + "movdqa %%xmm0, %%xmm1 \n\t" /* Create a copy of the pixel for the green color */ + "movdqa %%xmm0, %%xmm2 \n\t" /* Create a copy of the pixel for the blue color */ + "psrlw $5, %%xmm1 \n\t" /* Packed Shift Right Logical Words */ + /* From A64_128bit_Media_Programming (p. 347) */ + /* Shifts the blue off of the green color */ + "psrlw $11, %%xmm0 \n\t" /* Shifts the blue & green off of the red color */ + "psllw $11, %%xmm2 \n\t" /* Packed Shift Left Logical Words */ + /* From A64_128bit_Media_Programming (p. 330) */ + /* Shifts the red & green off of the blue color */ + "psllw $10, %%xmm1 \n\t" /* Shifts the red off of the green color */ + "psllw $8, %%xmm0 \n\t" /* Shifts the red color into position */ + "psrlw $2, %%xmm1 \n\t" /* Shifts the green color into position */ + "psrlw $3, %%xmm2 \n\t" /* Shifts the blue color into position */ + "pmulhw %%xmm5, %%xmm0 \n\t" /* color *= modifier */ + "pmulhw %%xmm6, %%xmm1 \n\t" + "pmulhw %%xmm7, %%xmm2 \n\t" + "psllw $11, %%xmm0 \n\t" /* Shift red back into its original position */ + "psllw $5, %%xmm1 \n\t" /* Shift green back into its original position */ + "por %%xmm2, %%xmm0 \n\t" /* Mesh the colors back together */ + "por %%xmm1, %%xmm0 \n\t" + "movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t" /* Place the shaded 8 pixels back into the image map */ + "addq $8, %%rcx \n\t" + "js 2b \n\t" + "jmp 4f \n\t" + "3: \n\t" /* Deal with pixels one at a time here. */ + "movw (%%rsi, %%rcx, 2), %%ax \n\t" + "movd %%eax, %%xmm0 \n\t" + "movq %%xmm0, %%xmm1 \n\t" + "movq %%xmm0, %%xmm2 \n\t" + "psrlw $5, %%xmm1 \n\t" + "psrlw $11, %%xmm0 \n\t" + "psllw $11, %%xmm2 \n\t" + "psllw $10, %%xmm1 \n\t" + "psllw $8, %%xmm0 \n\t" + "psrlw $2, %%xmm1 \n\t" + "psrlw $3, %%xmm2 \n\t" + "pmulhw %%xmm5, %%xmm0 \n\t" + "pmulhw %%xmm6, %%xmm1 \n\t" + "pmulhw %%xmm7, %%xmm2 \n\t" + "psllw $11, %%xmm0 \n\t" + "psllw $5, %%xmm1 \n\t" + "por %%xmm2, %%xmm0 \n\t" + "por %%xmm1, %%xmm0 \n\t" + "movd %%xmm0, %%eax \n\t" + "movw %%ax, (%%rsi, %%rcx, 2) \n\t" + "incq %%rcx \n\t" + "4: \n\t" + "cmpq $6, %%rcx \n\t" + "jng 3b \n\t" + "addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */ + "decq %%rdx \n\t" + "jnz 1b \n\t" + "jmp 10f \n\t" /* We're done! */ + + "5: \n\t" /* Saturation is required */ + "pcmpeqw %%xmm3, %%xmm3 \n\t" /* Packed Compare Equal Words */ + /* From A64_128bit_Media_Programming (p. 276) */ + /* This sets xmm3 to 128 1's (since mm6 = mm6) */ + "movdqa %%xmm3, %%xmm4 \n\t" /* Make copy of 128 ones */ + "psllw $5, %%xmm3 \n\t" /* xmm3 = 8 copies of 1111 1111 1110 0000 */ + "psllw $6, %%xmm4 \n\t" /* xmm4 = 8 copies of 1111 1111 1100 0000 */ + "6: \n\t" + "movq %%rbx, %%rcx \n\t" + "addq $7, %%rcx \n\t" + "jns 8f \n\t" + "7: \n\t" + "movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t" + "movdqa %%xmm0, %%xmm1 \n\t" + "movdqa %%xmm0, %%xmm2 \n\t" + "psrlw $5, %%xmm1 \n\t" + "psrlw $11, %%xmm0 \n\t" + "psllw $11, %%xmm2 \n\t" + "psllw $10, %%xmm1 \n\t" + "psllw $8, %%xmm0 \n\t" + "psrlw $2, %%xmm1 \n\t" + "psrlw $3, %%xmm2 \n\t" + "pmulhw %%xmm5, %%xmm0 \n\t" + "pmulhw %%xmm6, %%xmm1 \n\t" + "pmulhw %%xmm7, %%xmm2 \n\t" + "paddusw %%xmm3, %%xmm0 \n\t" + "paddusw %%xmm4, %%xmm1 \n\t" + "paddusw %%xmm3, %%xmm2 \n\t" + "psubw %%xmm4, %%xmm1 \n\t" + "psubw %%xmm3, %%xmm2 \n\t" + "psllw $11, %%xmm0 \n\t" + "psllw $5, %%xmm1 \n\t" + "por %%xmm2, %%xmm0 \n\t" + "por %%xmm1, %%xmm0 \n\t" + "movdqu %%xmm0, (%%rsi, %%rcx, 2)\n\t" + "addq $8, %%rcx \n\t" + "js 7b \n\t" + "jmp 9f \n\t" + "8: \n\t" + "movw (%%rsi, %%rcx, 2), %%ax \n\t" + "movd %%eax, %%xmm0 \n\t" + "movq %%xmm0, %%xmm1 \n\t" + "movq %%xmm0, %%xmm2 \n\t" + "psrlw $5, %%xmm1 \n\t" + "psrlw $11, %%xmm0 \n\t" + "psllw $11, %%xmm2 \n\t" + "psllw $10, %%xmm1 \n\t" + "psllw $8, %%xmm0 \n\t" + "psrlw $2, %%xmm1 \n\t" + "psrlw $3, %%xmm2 \n\t" + " \n\t" + "pmulhw %%xmm5, %%xmm0 \n\t" + "pmulhw %%xmm6, %%xmm1 \n\t" + "pmulhw %%xmm7, %%xmm2 \n\t" + " \n\t" + "paddusw %%xmm3, %%xmm0 \n\t" + "paddusw %%xmm4, %%xmm1 \n\t" + "paddusw %%xmm3, %%xmm2 \n\t" + " \n\t" + "psubw %%xmm4, %%xmm1 \n\t" + "psubw %%xmm3, %%xmm2 \n\t" + " \n\t" + "psllw $11, %%xmm0 \n\t" + "psllw $5, %%xmm1 \n\t" + "por %%xmm2, %%xmm0 \n\t" + "por %%xmm1, %%xmm0 \n\t" + "movd %%xmm0, %%eax \n\t" + "movw %%ax, (%%rsi, %%rcx, 2) \n\t" + "incq %%rcx \n\t" + "9: \n\t" + "cmpq $6, %%rcx \n\t" + "jng 8b \n\t" + "addq %[blue_mod], %%rsi \n\t" /* Blue_mod is the name of a register that now contains bytes_per_line. */ + "decq %%rdx \n\t" + "jnz 6b \n\t" + "10: \n\t" /* This is the end. Jump here if the line count is zero. */ + "emms \n\t" /* exit multi-media state (last asm instruction) */ + : /* outputs: none */ + /* inputs: (many operations cannot be performed with a mix of 32bit & 64bit operands directly) */ + /* (however the compiler/assembler can preload 32bit values into 64bit registers) */ + /* (that is why certain variables cannot be referenced by name -- use their register) */ + : [data] "S" (data), /* put the pointer data into the rsi register */ + [width] "b" (w), /* put the width in the %rbx register (cannot be referenced by name) */ + [height] "d" (h), /* put the heigth in the %rdx register (cannot be referenced by name) */ + [red_mod] "r" ((unsigned long)(rm)),/* put the red_modifier in a register (referenced by name) */ + [green_mod] "r" ((unsigned long)(gm)),/* put the green_modifier in a register (referenced by name) */ + [blue_mod] "r" ((unsigned long)(bm)),/* put the blue_modifier in a register (referenced by name) Later store the bytes_line here */ + [bytes_line] "a" (bpl) /* put the bytes_per_line in the %rax register (cannot be referenced by name) */ + : "memory" /* clobbers: (memory includes all the registers) */ + ); /* End of Assembly */ } -void -shade_ximage_32_sse2(volatile void *data, volatile int bpl, volatile int w, volatile int h, volatile int rm, volatile int gm, - volatile int bm) +void shade_ximage_32_sse2( volatile void *data, volatile int bpl, volatile int w, volatile int h, volatile int rm, volatile int gm, volatile int bm ) { - __asm__ __volatile__(".align 16 \n\t" /* SIMD instructions should be aligned on 16 byte (128 bit) boundraries for performance reasons. */ - "leaq -4(%%rsi, %%rbx, 4), %%rsi\n\t" /* From A64_General_Purpose_and_System_Instructions (p. 182) */ - /* Intel syntax section:[base + index*scale + disp] (used by AMD manuals) */ - /* AT&T syntax section:disp(base, index, scale) (used by gas/gcc) */ - /* Load Effective Address of (rsi + (rbx * size)) into rsi */ - /* 32 bits per pixel means a multiplier of 4. */ - "negq %%rbx \n\t" /* two's compliment negation of ebx (width) and sets the Zero Flag based on the results */ - /* From A64_General_Purpose_and_System_Instructions (p. 212) */ - "jz 10f \n\t" /* Jump to label 3 forward on Zero */ - /* Basically if width = 0 blowout */ - /* I don't understand why the height isn't checked (shouldn't matter, zero loop iterations) */ - "movd %[red_mod], %%xmm4 \n\t" /* move red modifier into mm4 w/ zero extension to 128bits */ - /* RGB's are 8 bit values. regardless of them coming in in 32/64 bit they are zero extended */ - "psllq $16, %%xmm4 \n\t" /* Packed Shift Left Logical Quad words (left shift mm4 16bits twice, once for each 64bit value) */ - /* From A64_128bit_Media_Programming (p. 328) */ - "movd %[green_mod], %%xmm5 \n\t" /* move green modifier into mm5 w/ zero extension to 128bits */ - "por %%xmm5, %%xmm4 \n\t" /* Mesh green modifier into color modifier */ - "psllq $16, %%xmm4 \n\t" /* Packed Shift Left Logical Quad words (left shift mm4 16bits twice, once for each 64bit value) */ - "movd %[blue_mod], %%xmm5 \n\t" /* move blue modifier (32 bits) into mm4 w/ zero extension to 128bits */ - "por %%xmm5, %%xmm4 \n\t" /* Mesh blue modifier into color modifier */ - /* mm4 (color modifier) now contains 00 00 00 00 : 00 00 00 00 :: 00 00 00 rm : 00 gm 00 bm */ - "punpcklqdq %%xmm4, %%xmm4 \n\t" /* Unpack and Interleave low quad words. From A64_128bit_Media_Programming (p. 378) */ - /* Duplicate the bottom 64 bits into the next 64 bits (both operands are the same) */ - "pcmpeqw %%xmm6, %%xmm6 \n\t" /* Packed Compare Equal Words */ - /* From A64_128bit_Media_Programming (p. 276) */ - /* This sets mm6 to 128 1's (since mm6 = mm6) */ - "psllw $15, %%xmm6 \n\t" /* Packed Shift Left Logical Words */ - /* From A64_128bit_Media_Programming (p. 330) */ - /* This sets 8 16 bit values of 1000 0000 0000 0000 in the 128 bit word */ - "movdqu %%xmm6, %%xmm5 \n\t" /* Copy mm6 to mm5 (we need mm6 later) */ - "pmulhw %%xmm4, %%xmm5 \n\t" /* Packed Multiply High Signed Word */ - /* mm4 = ( mm4 * mm5 ) >> 16 (8 times, once for each 16bit value) */ - /* For each color_ modifier (cm) */ - /* (( cm * 80 00 ) >> 16 ) = (( cm << 15 ) >> 16 ) = cm >> 1 */ - "1: \n\t" /* The start of the outer loop (lines) */ - "movq %%rbx, %%rcx \n\t" /* Load the counting register (rcx) with the width of the window to shade */ - "incq %%rcx \n\t" "2: \n\t" /* The start of the inner loop (columns) */ - "movq (%%rsi, %%rcx, 4), %%xmm1 \n\t" /* sets mm1 to the 32bit color in the image map (data[ rcx ]) */ - /* 32 bit color is still 4 bytes so leave the multiplier alone it is zero extended to 128 bits */ - /* only move 32 bits with movd so we don't get two pixels worth of colors */ - "pxor %%xmm0, %%xmm0 \n\t" /* 128bit exclusive or (sets mm0 to 0) */ - "punpcklbw %%xmm1, %%xmm0 \n\t" /* Unpack and interleave low bytes */ - /* For each color of the pixel expand to 16 bits and shift left 8 bits */ - /* From A64_128bit_Media_Programming (p. 374) */ - /* discard high 64 bits and expand both mm0 and mm1 a byte at a time into mm0 (mm0 first) */ - "pxor %%xmm6, %%xmm0 \n\t" /* This flips the sign of the 16 bit red, green, and blue colors. (mm6 ~= 1000:0000 8 times) */ - "pmulhw %%xmm4, %%xmm0 \n\t" /* Package Multiply High Signed Word (an SSE2 instruction) 128bit mm0=color mm4=cm */ - /* Each 16 bit signed int in mm4 (8) is multiplied by the same in mm0 */ - /* and the high 16 bits of the result replace the 16 bits used from mm0 */ - /* For (( each 16 bit color * each 16 bit color modifier ) >> 16 ) */ - "psubw %%xmm5, %%xmm0 \n\t" /* Packed Subtract Words */ - /* From A64_128bit_Media_Programming (p. 364) */ - /* mm0=modified color mm5=corrected color modifier. mm0 = ( mm0 - mm5 ) */ - /* 16 bit corrected modified color = ( modified color - corrected color modifier ) */ - "packuswb %%xmm0, %%xmm0 \n\t" /* Pack with Saturation Signed Word to Unsigned Byte */ - /* From A64_128bit_Media_Programming (p. 246) */ - /* if mm0 > 255 then mm0=255 elsif mm0 < 0 mm0=0 else mm0=mm0 */ - /* The top 64 bits are now trashed. The remaining 64 bits are 2 pixels */ - "movq %%xmm0, (%%rsi, %%rcx, 4) \n\t" /* puts the new 32 bit color value back into the data (image map) */ - /* 32 bit color is still a double word so movd stays movd */ - "addq $2, %%rcx \n\t" /* Increment the count register (more pixels left) */ - "js 2b \n\t" /* Jump backwards to label 2 (restart inner loop) on negative (more pixels left) */ - "jmp 5f \n\t" /* Jump to single pixel section after pairs are exhausted */ - "4: \n\t" /* The start of the inner loop (columns) */ - "movd (%%rsi, %%rcx, 4), %%xmm1 \n\t" /* sets mm1 to the 32bit color in the image map (data[ rcx ]) */ - /* 32 bit color is still 4 bytes so leave the multiplier alone it is zero extended to 128 bits */ - /* only move 32 bits with movd so we don't get two pixels worth of colors */ - "pxor %%xmm0, %%xmm0 \n\t" /* 128bit exclusive or (sets mm0 to 0) */ - "punpcklbw %%xmm1, %%xmm0 \n\t" /* Unpack and interleave low bytes */ - /* For each color of the pixel expand to 16 bits and shift left 8 bits */ - /* From A64_128bit_Media_Programming (p. 374) */ - /* discard high 64 bits and expand both mm0 and mm1 a byte at a time into mm0 (mm0 first) */ - "pxor %%xmm6, %%xmm0 \n\t" /* This flips the sign of the 16 bit red, green, and blue colors. (mm6 ~= 1000:0000 8 times) */ - "pmulhw %%xmm4, %%xmm0 \n\t" /* Package Multiply High Signed Word (an SSE2 instruction) 128bit mm0=color mm4=cm */ - /* Each 16 bit signed int in mm4 (8) is multiplied by the same in mm0 */ - /* and the high 16 bits of the result replace the 16 bits used from mm0 */ - /* For (( each 16 bit color * each 16 bit color modifier ) >> 16 ) */ - "psubw %%xmm5, %%xmm0 \n\t" /* Packed Subtract Words */ - /* From A64_128bit_Media_Programming (p. 364) */ - /* mm0=modified color mm5=corrected color modifier. mm0 = ( mm0 - mm5 ) */ - /* 16 bit corrected modified color = ( modified color - corrected color modifier ) */ - "packuswb %%xmm0, %%xmm0 \n\t" /* Pack with Saturation Signed Word to Unsigned Byte */ - /* From A64_128bit_Media_Programming (p. 246) */ - /* if mm0 > 255 then mm0=255 elsif mm0 < 0 mm0=0 else mm0=mm0 */ - "movd %%xmm0, (%%rsi, %%rcx, 4) \n\t" /* puts the new 32 bit color value back into the data (image map) */ - /* 32 bit color is still a double word so movd stays movd */ - "incq %%rcx \n\t" /* Increment the count register (more pixels left) */ - "5: \n\t" /* Jump here after all pairs of pixels are exhausted */ - "cmpq $0, %%rcx \n\t" /* Increment the count register (more pixels left) */ - "jng 4b \n\t" /* Jump backwards to label 2 (restart inner loop) on NOT zero (more pixels left) */ - "addq %%rax, %%rsi \n\t" /* Add bytes per line to the data pointer (advance the pointer to the next line) */ - "decq %%rdx \n\t" /* Decrement the dx register (row count) */ - "jnz 1b \n\t" /* Jump backwards to label 1 (restart outer loop) if not zero (more rows left) */ - "10: \n\t" /* End of function (jump here to clean up and return to caller */ - "emms \n\t" /* exit multi-media state (last asm instruction) */ - : /* outputs: none */ - /* inputs: (many operations cannot be performed with a mix of 32bit & 64bit operands directly) */ - /* (however the compiler/assembler can preload 32bit values into 64bit registers) */ - /* (that is why certain variables cannot be referenced by name -- use their register) */ - :[data] "S"(data), /* put the pointer data into the rsi register */ - [width] "b"(w), /* put the width in the %rbx register (cannot be referenced by name) */ - [height] "d"(h), /* put the heigth in the %rdx register (cannot be referenced by name) */ - [red_mod] "r"(rm), /* put the red_modifier in a register (referenced by name) */ - [green_mod] "r"(gm), /* put the green_modifier in a register (referenced by name) */ - [blue_mod] "r"(bm), /* put the blue_modifier in a register (referenced by name) */ - [bytes_line] "a"(bpl) /* put the bytes_per_line in the %rax register (cannot be referenced by name) */ - :"memory" /* clobbers: (memory includes all the registers) */ - ); /* End of Assembly */ + __asm__ __volatile__ ( + ".align 16 \n\t" /* SIMD instructions should be aligned on 16 byte (128 bit) boundraries for performance reasons.*/ + "leaq -4(%%rsi, %%rbx, 4), %%rsi\n\t" /* From A64_General_Purpose_and_System_Instructions (p. 182) */ + /* Intel syntax section:[base + index*scale + disp] (used by AMD manuals) */ + /* AT&T syntax section:disp(base, index, scale) (used by gas/gcc) */ + /* Load Effective Address of (rsi + (rbx * size)) into rsi */ + /* 32 bits per pixel means a multiplier of 4. */ + "negq %%rbx \n\t" /* two's compliment negation of ebx (width) and sets the Zero Flag based on the results */ + /* From A64_General_Purpose_and_System_Instructions (p. 212) */ + "jz 10f \n\t" /* Jump to label 3 forward on Zero */ + /* Basically if width = 0 blowout */ + /* I don't understand why the height isn't checked (shouldn't matter, zero loop iterations) */ + "movd %[red_mod], %%xmm4 \n\t" /* move red modifier into mm4 w/ zero extension to 128bits */ + /* RGB's are 8 bit values. regardless of them coming in in 32/64 bit they are zero extended */ + "psllq $16, %%xmm4 \n\t" /* Packed Shift Left Logical Quad words (left shift mm4 16bits twice, once for each 64bit value)*/ + /* From A64_128bit_Media_Programming (p. 328) */ + "movd %[green_mod], %%xmm5 \n\t" /* move green modifier into mm5 w/ zero extension to 128bits */ + "por %%xmm5, %%xmm4 \n\t" /* Mesh green modifier into color modifier */ + "psllq $16, %%xmm4 \n\t" /* Packed Shift Left Logical Quad words (left shift mm4 16bits twice, once for each 64bit value)*/ + "movd %[blue_mod], %%xmm5 \n\t" /* move blue modifier (32 bits) into mm4 w/ zero extension to 128bits */ + "por %%xmm5, %%xmm4 \n\t" /* Mesh blue modifier into color modifier */ + /* mm4 (color modifier) now contains 00 00 00 00 : 00 00 00 00 :: 00 00 00 rm : 00 gm 00 bm */ + "punpcklqdq %%xmm4, %%xmm4 \n\t" /* Unpack and Interleave low quad words. From A64_128bit_Media_Programming (p. 378) */ + /* Duplicate the bottom 64 bits into the next 64 bits (both operands are the same) */ + "pcmpeqw %%xmm6, %%xmm6 \n\t" /* Packed Compare Equal Words */ + /* From A64_128bit_Media_Programming (p. 276) */ + /* This sets mm6 to 128 1's (since mm6 = mm6) */ + "psllw $15, %%xmm6 \n\t" /* Packed Shift Left Logical Words */ + /* From A64_128bit_Media_Programming (p. 330) */ + /* This sets 8 16 bit values of 1000 0000 0000 0000 in the 128 bit word */ + "movdqa %%xmm6, %%xmm5 \n\t" /* Copy mm6 to mm5 (we need mm6 later) */ + "pmulhw %%xmm4, %%xmm5 \n\t" /* Packed Multiply High Signed Word */ + /* mm4 = ( mm4 * mm5 ) >> 16 (8 times, once for each 16bit value) */ + /* For each color_ modifier (cm) */ + /* (( cm * 80 00 ) >> 16 ) = (( cm << 15 ) >> 16 ) = cm >> 1 */ + "1: \n\t" /* The start of the outer loop (lines) */ + "movq %%rbx, %%rcx \n\t" /* Load the counting register (rcx) with the width of the window to shade */ + "incq %%rcx \n\t" + "2: \n\t" /* The start of the inner loop (columns) */ + "movq (%%rsi, %%rcx, 4), %%xmm1 \n\t" /* sets mm1 to the 32bit color in the image map (data[ rcx ]) */ + /* 32 bit color is still 4 bytes so leave the multiplier alone it is zero extended to 128 bits */ + /* only move 32 bits with movd so we don't get two pixels worth of colors */ + "pxor %%xmm0, %%xmm0 \n\t" /* 128bit exclusive or (sets mm0 to 0) */ + "punpcklbw %%xmm1, %%xmm0 \n\t" /* Unpack and interleave low bytes */ + /* For each color of the pixel expand to 16 bits and shift left 8 bits */ + /* From A64_128bit_Media_Programming (p. 374) */ + /* discard high 64 bits and expand both mm0 and mm1 a byte at a time into mm0 (mm0 first) */ + "pxor %%xmm6, %%xmm0 \n\t" /* This flips the sign of the 16 bit red, green, and blue colors. (mm6 ~= 1000:0000 8 times) */ + "pmulhw %%xmm4, %%xmm0 \n\t" /* Package Multiply High Signed Word (an SSE2 instruction) 128bit mm0=color mm4=cm */ + /* Each 16 bit signed int in mm4 (8) is multiplied by the same in mm0 */ + /* and the high 16 bits of the result replace the 16 bits used from mm0 */ + /* For (( each 16 bit color * each 16 bit color modifier ) >> 16 ) */ + "psubw %%xmm5, %%xmm0 \n\t" /* Packed Subtract Words */ + /* From A64_128bit_Media_Programming (p. 364) */ + /* mm0=modified color mm5=corrected color modifier. mm0 = ( mm0 - mm5 ) */ + /* 16 bit corrected modified color = ( modified color - corrected color modifier ) */ + "packuswb %%xmm0, %%xmm0 \n\t" /* Pack with Saturation Signed Word to Unsigned Byte */ + /* From A64_128bit_Media_Programming (p. 246) */ + /* if mm0 > 255 then mm0=255 elsif mm0 < 0 mm0=0 else mm0=mm0 */ + /* The top 64 bits are now trashed. The remaining 64 bits are 2 pixels */ + "movq %%xmm0, (%%rsi, %%rcx, 4) \n\t" /* puts the new 32 bit color value back into the data (image map) */ + /* 32 bit color is still a double word so movd stays movd */ + "addq $2, %%rcx \n\t" /* Increment the count register (more pixels left) */ + "js 2b \n\t" /* Jump backwards to label 2 (restart inner loop) on negative (more pixels left) */ + "jmp 5f \n\t" /* Jump to single pixel section after pairs are exhausted */ + "4: \n\t" /* The start of the inner loop (columns) */ + "movd (%%rsi, %%rcx, 4), %%xmm1 \n\t" /* sets mm1 to the 32bit color in the image map (data[ rcx ]) */ + /* 32 bit color is still 4 bytes so leave the multiplier alone it is zero extended to 128 bits */ + /* only move 32 bits with movd so we don't get two pixels worth of colors */ + "pxor %%xmm0, %%xmm0 \n\t" /* 128bit exclusive or (sets mm0 to 0) */ + "punpcklbw %%xmm1, %%xmm0 \n\t" /* Unpack and interleave low bytes */ + /* For each color of the pixel expand to 16 bits and shift left 8 bits */ + /* From A64_128bit_Media_Programming (p. 374) */ + /* discard high 64 bits and expand both mm0 and mm1 a byte at a time into mm0 (mm0 first) */ + "pxor %%xmm6, %%xmm0 \n\t" /* This flips the sign of the 16 bit red, green, and blue colors. (mm6 ~= 1000:0000 8 times) */ + "pmulhw %%xmm4, %%xmm0 \n\t" /* Package Multiply High Signed Word (an SSE2 instruction) 128bit mm0=color mm4=cm */ + /* Each 16 bit signed int in mm4 (8) is multiplied by the same in mm0 */ + /* and the high 16 bits of the result replace the 16 bits used from mm0 */ + /* For (( each 16 bit color * each 16 bit color modifier ) >> 16 ) */ + "psubw %%xmm5, %%xmm0 \n\t" /* Packed Subtract Words */ + /* From A64_128bit_Media_Programming (p. 364) */ + /* mm0=modified color mm5=corrected color modifier. mm0 = ( mm0 - mm5 ) */ + /* 16 bit corrected modified color = ( modified color - corrected color modifier ) */ + "packuswb %%xmm0, %%xmm0 \n\t" /* Pack with Saturation Signed Word to Unsigned Byte */ + /* From A64_128bit_Media_Programming (p. 246) */ + /* if mm0 > 255 then mm0=255 elsif mm0 < 0 mm0=0 else mm0=mm0 */ + "movd %%xmm0, (%%rsi, %%rcx, 4) \n\t" /* puts the new 32 bit color value back into the data (image map) */ + /* 32 bit color is still a double word so movd stays movd */ + "incq %%rcx \n\t" /* Increment the count register (more pixels left) */ + "5: \n\t" /* Jump here after all pairs of pixels are exhausted */ + "cmpq $0, %%rcx \n\t" /* Increment the count register (more pixels left) */ + "jng 4b \n\t" /* Jump backwards to label 2 (restart inner loop) on NOT zero (more pixels left) */ + + "addq %%rax, %%rsi \n\t" /* Add bytes per line to the data pointer (advance the pointer to the next line) */ + "decq %%rdx \n\t" /* Decrement the dx register (row count) */ + "jnz 1b \n\t" /* Jump backwards to label 1 (restart outer loop) if not zero (more rows left) */ + "10: \n\t" /* End of function (jump here to clean up and return to caller */ + "emms \n\t" /* exit multi-media state (last asm instruction) */ + : /* outputs: none */ + /* inputs: (many operations cannot be performed with a mix of 32bit & 64bit operands directly) */ + /* (however the compiler/assembler can preload 32bit values into 64bit registers) */ + /* (that is why certain variables cannot be referenced by name -- use their register) */ + : [data] "S" (data), /* put the pointer data into the rsi register */ + [width] "b" (w), /* put the width in the %rbx register (cannot be referenced by name) */ + [height] "d" (h), /* put the heigth in the %rdx register (cannot be referenced by name) */ + [red_mod] "r" (rm), /* put the red_modifier in a register (referenced by name) */ + [green_mod] "r" (gm), /* put the green_modifier in a register (referenced by name) */ + [blue_mod] "r" (bm), /* put the blue_modifier in a register (referenced by name) */ + [bytes_line] "a" (bpl) /* put the bytes_per_line in the %rax register (cannot be referenced by name) */ + : "memory" /* clobbers: (memory includes all the registers) */ + ); /* End of Assembly */ } #endif diff --git a/src/startup.c b/src/startup.c index 62af365..b676a75 100644 --- a/src/startup.c +++ b/src/startup.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -73,7 +73,6 @@ Atom props[NUM_PROPS]; int eterm_bootstrap(int argc, char *argv[]) { - int i; char *val; @@ -81,7 +80,7 @@ eterm_bootstrap(int argc, char *argv[]) static char windowid_string[20], *display_string, *term_string; orig_argv0 = argv[0]; - + /* Security enhancements -- mej */ putenv("IFS= \t\n"); my_ruid = getuid(); @@ -96,9 +95,7 @@ eterm_bootstrap(int argc, char *argv[]) init_libast(); /* Open display, get options/resources and create the window */ - if (getenv("DISPLAY") == NULL) { - display_name = STRDUP(":0"); - } else { + if (getenv("DISPLAY") != NULL) { display_name = STRDUP(getenv("DISPLAY")); } @@ -116,8 +113,10 @@ eterm_bootstrap(int argc, char *argv[]) #ifdef NEED_LINUX_HACK privileges(REVERT); #endif - if (!Xdisplay) { - print_error("can't open display %s\n", display_name); + + if (!Xdisplay && !(Xdisplay = XOpenDisplay(display_name))) { + libast_print_error("Can't open display %s. Set $DISPLAY or use --display\n", + NONULL(display_name)); exit(EXIT_FAILURE); } XSetErrorHandler((XErrorHandler) xerror_handler); @@ -154,21 +153,23 @@ eterm_bootstrap(int argc, char *argv[]) props[PROP_EWMH_ICON] = XInternAtom(Xdisplay, "_NET_WM_ICON", False); props[PROP_EWMH_OPACITY] = XInternAtom(Xdisplay, "_NET_WM_WINDOW_OPACITY", True); props[PROP_EWMH_STARTUP_ID] = XInternAtom(Xdisplay, "_NET_STARTUP_ID", False); + props[PROP_EWMH_STATE] = XInternAtom(Xdisplay, "_NET_WM_STATE", False); + props[PROP_EWMH_STATE_STICKY] = XInternAtom(Xdisplay, "_NET_WM_STATE_STICKY", False); - if ((theme_dir = conf_parse_theme(&rs_theme, THEME_CFG, PARSE_TRY_ALL)) != NULL) { + if ((theme_dir = spifconf_parse_theme(&rs_theme, THEME_CFG, PARSE_TRY_ALL)) != NULL) { char *tmp; - D_OPTIONS(("conf_parse_theme() returned \"%s\"\n", theme_dir)); + D_OPTIONS(("spifconf_parse_theme() returned \"%s\"\n", theme_dir)); tmp = (char *) MALLOC(strlen(theme_dir) + sizeof("ETERM_THEME_ROOT=\0")); sprintf(tmp, "ETERM_THEME_ROOT=%s", theme_dir); putenv(tmp); } if ((user_dir = - conf_parse_theme(&rs_theme, (rs_config_file ? rs_config_file : USER_CFG), + spifconf_parse_theme(&rs_theme, (rs_config_file ? rs_config_file : USER_CFG), (PARSE_TRY_USER_THEME | PARSE_TRY_NO_THEME))) != NULL) { char *tmp; - D_OPTIONS(("conf_parse_theme() returned \"%s\"\n", user_dir)); + D_OPTIONS(("spifconf_parse_theme() returned \"%s\"\n", user_dir)); tmp = (char *) MALLOC(strlen(user_dir) + sizeof("ETERM_USER_ROOT=\0")); sprintf(tmp, "ETERM_USER_ROOT=%s", user_dir); putenv(tmp); @@ -262,24 +263,10 @@ eterm_bootstrap(int argc, char *argv[]) } #endif -#ifdef DISPLAY_IS_IP - /* Fixup display_name for export over pty to any interested terminal - * clients via "ESC[7n" (e.g. shells). Note we use the pure IP number - * (for the first non-loopback interface) that we get from - * network_display(). This is more "name-resolution-portable", if you - * will, and probably allows for faster x-client startup if your name - * server is beyond a slow link or overloaded at client startup. Of - * course that only helps the shell's child processes, not us. - * - * Giving out the display_name also affords a potential security hole - */ - - val = display_name = network_display(display_name); - if (val == NULL) -#endif /* DISPLAY_IS_IP */ - val = XDisplayString(Xdisplay); - if (display_name == NULL) - display_name = val; /* use broken `:0' value */ + val = XDisplayString(Xdisplay); + if (display_name == NULL) { + display_name = val; + } i = strlen(val); display_string = MALLOC(i + 9); diff --git a/src/startup.h b/src/startup.h index 03588a3..9c78bea 100644 --- a/src/startup.h +++ b/src/startup.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -106,6 +106,8 @@ enum { PROP_EWMH_ICON, PROP_EWMH_OPACITY, PROP_EWMH_STARTUP_ID, + PROP_EWMH_STATE, + PROP_EWMH_STATE_STICKY, NUM_PROPS }; diff --git a/src/system.c b/src/system.c index 1e37c46..d7b6698 100644 --- a/src/system.c +++ b/src/system.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -52,6 +52,7 @@ wait_for_chld(int system_pid) while (1) { do { errno = 0; + usleep(10); } while ((((pid = waitpid(system_pid, &status, WNOHANG)) == -1) && (errno == EINTR)) || !pid); /* If the child that exited is the command we spawned, or if the child exited before fork() returned in the parent, it must be @@ -79,32 +80,20 @@ wait_for_chld(int system_pid) } /* Replace the system() call with a fork-and-exec that unprivs the child process */ - int system_wait(char *command) { - pid_t pid; D_OPTIONS(("system_wait(%s) called.\n", command)); - if (!(pid = fork())) { - setreuid(my_ruid, my_ruid); - setregid(my_rgid, my_rgid); - execl("/bin/sh", "sh", "-c", command, (char *) NULL); - print_error("execl(%s) failed -- %s\n", command, strerror(errno)); - exit(EXIT_FAILURE); - } else { - D_OPTIONS(("%d: fork() returned %d\n", getpid(), pid)); - return (wait_for_chld(pid)); - } - ASSERT_NOTREACHED_RVAL(0); + pid = system_no_wait(command); + return (wait_for_chld(pid)); } -int +pid_t system_no_wait(char *command) { - pid_t pid; D_OPTIONS(("system_no_wait(%s) called.\n", command)); @@ -113,8 +102,9 @@ system_no_wait(char *command) setreuid(my_ruid, my_ruid); setregid(my_rgid, my_rgid); execl("/bin/sh", "sh", "-c", command, (char *) NULL); - print_error("execl(%s) failed -- %s\n", command, strerror(errno)); + libast_print_error("execl(%s) failed -- %s\n", command, strerror(errno)); exit(EXIT_FAILURE); } - return (0); + D_OPTIONS(("%d: fork() returned %d\n", getpid(), pid)); + return (pid); } diff --git a/src/system.h b/src/system.h index 2425dda..c4e6a24 100644 --- a/src/system.h +++ b/src/system.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -36,6 +36,6 @@ typedef RETSIGTYPE (*eterm_sighandler_t)(int); extern int wait_for_chld(int); extern int system_wait(char *); -extern int system_no_wait(char *); +extern pid_t system_no_wait(char *); #endif /* _SYSTEM_H_ */ diff --git a/src/term.c b/src/term.c index 9c5519f..1edb342 100644 --- a/src/term.c +++ b/src/term.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -1077,11 +1077,11 @@ popen_printer(void) FILE *stream; if (((my_ruid != my_euid) || (my_rgid != my_egid)) && (strcmp(rs_print_pipe, PRINTPIPE))) { - print_warning("Running setuid/setgid. Refusing to use custom printpipe.\n"); + libast_print_warning("Running setuid/setgid. Refusing to use custom printpipe.\n"); RESET_AND_ASSIGN(rs_print_pipe, STRDUP(PRINTPIPE)); } if ((stream = (FILE *) popen(rs_print_pipe, "w")) == NULL) { - print_error("Can't open printer pipe \"%s\" -- %s\n", rs_print_pipe, strerror(errno)); + libast_print_error("Can't open printer pipe \"%s\" -- %s\n", rs_print_pipe, strerror(errno)); } return stream; } @@ -2526,22 +2526,22 @@ xterm_seq(int op, const char *str) #ifdef XTERM_SCROLLBAR scrollbar_change_type(SCROLLBAR_XTERM); #else - print_error("Support for xterm scrollbars was not compiled in. Sorry.\n"); + libast_print_error("Support for xterm scrollbars was not compiled in. Sorry.\n"); #endif } else if (!strcasecmp(nstr, "next")) { #ifdef NEXT_SCROLLBAR scrollbar_change_type(SCROLLBAR_NEXT); #else - print_error("Support for NeXT scrollbars was not compiled in. Sorry.\n"); + libast_print_error("Support for NeXT scrollbars was not compiled in. Sorry.\n"); #endif } else if (!strcasecmp(nstr, "motif")) { #ifdef MOTIF_SCROLLBAR scrollbar_change_type(SCROLLBAR_MOTIF); #else - print_error("Support for motif scrollbars was not compiled in. Sorry.\n"); + libast_print_error("Support for motif scrollbars was not compiled in. Sorry.\n"); #endif } else { - print_error("Unrecognized scrollbar type \"%s\".\n", nstr); + libast_print_error("Unrecognized scrollbar type \"%s\".\n", nstr); } } nstr = (char *) strsep(&tnstr, ";"); @@ -2619,6 +2619,10 @@ xterm_seq(int op, const char *str) XSetWMHints(Xdisplay, TermWin.parent, wm_hints); XFree(wm_hints); break; + case 28: + nstr = (char *) strsep(&tnstr, ";"); + OPT_SET_OR_TOGGLE(nstr, vt_options, VT_OPTIONS_URG_ALERT); + break; case 40: nstr = (char *) strsep(&tnstr, ";"); if (nstr) { diff --git a/src/term.h b/src/term.h index 8068a5d..8ab8fab 100644 --- a/src/term.h +++ b/src/term.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/timer.c b/src/timer.c index 1e42540..58e75fc 100644 --- a/src/timer.c +++ b/src/timer.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/timer.h b/src/timer.h index 50fc214..6ab2b79 100644 --- a/src/timer.h +++ b/src/timer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/src/utmp.c b/src/utmp.c index 9cb8191..8136eb0 100644 --- a/src/utmp.c +++ b/src/utmp.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -38,7 +38,7 @@ static const char cvs_ident[] = "$Id$"; # endif /* don't go off end of ut_id & remember if an entry has been made */ -# if defined(USE_SYSV_UTMP) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) +# if defined(USE_SYSV_UTMP) || defined(NEW_BSD_UTMP) || defined(__OpenBSD__) static char ut_id[5]; /* remember if entry to utmp made */ # else static int utmp_pos; /* BSD position of utmp-stamp */ @@ -117,7 +117,7 @@ add_utmp_entry(const char *pty, const char *hostname, int fd) if (sscanf(pty, "pts/%d", &n) == 1) sprintf(ut_id, "vt%02x", n); /* sysv naming */ else { - print_error("can't parse tty name \"%s\"\n", pty); + libast_print_error("can't parse tty name \"%s\"\n", pty); ut_id[0] = '\0'; /* entry not made */ return; } @@ -222,7 +222,7 @@ remove_utmp_entry(void) # else /* USE_SYSV_UTMP */ /* BSD utmp support */ -# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__) +# ifdef NEW_BSD_UTMP /* used to hold the line we are using */ static char ut_line[32]; @@ -270,7 +270,7 @@ b_login(struct utmp *ut) } } -# else /* __FreeBSD__ || NetBSD || BSDI */ +# else /* NEW_BSD_UTMP */ static int utmp_pos = 0; /* position of utmp-stamp */ /*----------------------------------------------------------------------* @@ -328,7 +328,7 @@ write_utmp(struct utmp *putmp) return rval; } -# endif /* __FreeBSD__ || NetBSD || BSDI */ +# endif /* NEW_BSD_UTMP */ void add_utmp_entry(const char *pty, const char *hostname, int fd) @@ -343,12 +343,12 @@ add_utmp_entry(const char *pty, const char *hostname, int fd) if (!strncmp(pty, "pty", 3) || !strncmp(pty, "tty", 3)) strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */ else { - print_error("can't parse tty name \"%s\"\n", pty); + libast_print_error("can't parse tty name \"%s\"\n", pty); ut_id[0] = '\0'; /* entry not made */ return; } -# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__) +# ifdef NEW_BSD_UTMP strncpy(ut_line, pty, 31); strncpy(utmp.ut_line, pty, UT_LINESIZE); @@ -357,7 +357,7 @@ add_utmp_entry(const char *pty, const char *hostname, int fd) utmp.ut_time = time(NULL); b_login(&utmp); -# else /* __FreeBSD__ || NetBSD || BSDI */ +# else /* NEW_BSD_UTMP */ strncpy(utmp.ut_line, ut_id, sizeof(utmp.ut_line)); strncpy(utmp.ut_name, pwent->pw_name, sizeof(utmp.ut_name)); strncpy(utmp.ut_host, hostname, sizeof(utmp.ut_host)); @@ -376,10 +376,10 @@ add_utmp_entry(const char *pty, const char *hostname, int fd) void remove_utmp_entry(void) { -# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__) +# ifdef NEW_BSD_UTMP logout(ut_line); logwtmp(ut_line, "", ""); -# else /* __FreeBSD__ */ +# else /* NEW_BSD_UTMP */ FILE *fd; privileges(INVOKE); @@ -393,7 +393,7 @@ remove_utmp_entry(void) fclose(fd); } privileges(REVERT); -# endif /* __FreeBSD__ || NetBSD || BSDI */ +# endif /* NEW_BSD_UTMP */ } # endif /* USE_SYSV_UTMP */ diff --git a/src/windows.c b/src/windows.c index 0009148..3601ebb 100644 --- a/src/windows.c +++ b/src/windows.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -96,7 +96,7 @@ get_tint_by_color_name(const char *color) D_PIXMAP(("Tint string is \"%s\", white color is rgbi:%d/%d/%d\n", color, wcol.red, wcol.green, wcol.blue)); if (!XParseColor(Xdisplay, cmap, color, &xcol)) { - print_error("Unable to parse tint color \"%s\". Ignoring.\n", color); + libast_print_error("Unable to parse tint color \"%s\". Ignoring.\n", color); return 0xffffff; } @@ -144,7 +144,7 @@ get_bottom_shadow_color(Pixel norm_color, const char *type) xcol.blue /= 2; if (!XAllocColor(Xdisplay, cmap, &xcol)) { - print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red, + libast_print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red, xcol.green, xcol.blue); xcol.pixel = PixColors[minColor]; } @@ -177,7 +177,7 @@ get_top_shadow_color(Pixel norm_color, const char *type) xcol.blue = MIN(white.blue, (xcol.blue * 7) / 5); if (!XAllocColor(Xdisplay, cmap, &xcol)) { - print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red, + libast_print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red, xcol.green, xcol.blue); xcol.pixel = PixColors[WhiteColor]; } @@ -204,11 +204,11 @@ get_color_by_name(const char *name, const char *fallback) } } if (!XParseColor(Xdisplay, cmap, name, &xcol)) { - print_warning("Unable to resolve \"%s\" as a color name. Falling back on \"%s\".\n", name, NONULL(fallback)); + libast_print_warning("Unable to resolve \"%s\" as a color name. Falling back on \"%s\".\n", name, NONULL(fallback)); name = fallback; if (name) { if (!XParseColor(Xdisplay, cmap, name, &xcol)) { - print_warning + libast_print_warning ("Unable to resolve \"%s\" as a color name. This should never fail. Please repair/restore your RGB database.\n", name); return ((Pixel) - 1); @@ -218,12 +218,12 @@ get_color_by_name(const char *name, const char *fallback) } } if (!XAllocColor(Xdisplay, cmap, &xcol)) { - print_warning("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map. Falling back on \"%s\".\n", + libast_print_warning("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map. Falling back on \"%s\".\n", name, xcol.pixel, xcol.red, xcol.green, xcol.blue, NONULL(fallback)); name = fallback; if (name) { if (!XAllocColor(Xdisplay, cmap, &xcol)) { - print_warning("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", name, xcol.pixel, + libast_print_warning("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", name, xcol.pixel, xcol.red, xcol.green, xcol.blue); return ((Pixel) - 1); } @@ -241,19 +241,19 @@ get_color_by_pixel(Pixel pixel, Pixel fallback) xcol.pixel = pixel; if (!XQueryColor(Xdisplay, cmap, &xcol)) { - print_warning("Unable to convert pixel value 0x%08x to an XColor structure. Falling back on 0x%08x.\n", pixel, fallback); + libast_print_warning("Unable to convert pixel value 0x%08x to an XColor structure. Falling back on 0x%08x.\n", pixel, fallback); xcol.pixel = fallback; if (!XQueryColor(Xdisplay, cmap, &xcol)) { - print_warning("Unable to convert pixel value 0x%08x to an XColor structure.\n", xcol.pixel); + libast_print_warning("Unable to convert pixel value 0x%08x to an XColor structure.\n", xcol.pixel); return ((Pixel) 0); } } if (!XAllocColor(Xdisplay, cmap, &xcol)) { - print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map. Falling back on 0x%08x.\n", xcol.pixel, + libast_print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map. Falling back on 0x%08x.\n", xcol.pixel, xcol.red, xcol.green, xcol.blue, fallback); xcol.pixel = fallback; if (!XAllocColor(Xdisplay, cmap, &xcol)) { - print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map.\n", xcol.pixel, xcol.red, + libast_print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map.\n", xcol.pixel, xcol.red, xcol.green, xcol.blue); return ((Pixel) 0); } @@ -363,6 +363,48 @@ set_pointer_colors(const char *fg_name, const char *bg_name) XRecolorCursor(Xdisplay, TermWin_cursor, &fg, &bg); } +int +check_mwm_supported(void) +{ + Atom prop, mwm_prop, type_ret; + unsigned char *prop_ret; + unsigned long bytes_after, num_ret; + int format_ret, num, i, supported = 0; + + /* check whether wm support mwm hint */ + prop = XInternAtom(Xdisplay, "_NET_SUPPORTED", True); + mwm_prop = XInternAtom(Xdisplay, "_MOTIF_WM_HINTS", True); + + if ((prop != None) && (mwm_prop != None)) { + prop_ret = NULL; + if (XGetWindowProperty(Xdisplay, Xroot, prop, 0, 0x7fffffff, False, + XA_ATOM, &type_ret, &format_ret, &num_ret, + &bytes_after, &prop_ret) == Success) { + + if ((type_ret == XA_ATOM) && + (format_ret == 32) && + (num_ret && prop_ret)) { + for (i = 0; i < num_ret; i++) { + if (mwm_prop == ((unsigned long*)prop_ret)[i]) { + supported = 1; + break; + } + } + } + if (prop_ret) + XFree(prop_ret); + } + } + /* check whether wm is mwm */ + if (!supported) { + prop = XInternAtom(Xdisplay, "_MOTIF_WM_INFO", True); + if (prop != None) { + supported = 1; + } + } + return supported; +} + /* Create_Windows() - Open and map the window */ void Create_Windows(int argc, char *argv[]) @@ -378,14 +420,13 @@ Create_Windows(int argc, char *argv[]) MWMHints mwmhints; if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_BORDERLESS)) { - prop = XInternAtom(Xdisplay, "_MOTIF_WM_INFO", True); - if (prop == None) { - print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n"); - Attributes.override_redirect = TRUE; - mwmhints.flags = 0; - } else { + if (check_mwm_supported()) { mwmhints.flags = MWM_HINTS_DECORATIONS; mwmhints.decorations = 0; + } else { + libast_print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n"); + Attributes.override_redirect = TRUE; + mwmhints.flags = 0; } } else { mwmhints.flags = 0; @@ -498,10 +539,16 @@ Create_Windows(int argc, char *argv[]) XChangeProperty(Xdisplay, TermWin.parent, props[PROP_DESKTOP], XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &val, 1); } + /* Make window sticky if requested */ + if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_STICKY)) { + XChangeProperty(Xdisplay, TermWin.parent, props[PROP_EWMH_STATE], XA_ATOM, 32, PropModeReplace, + (unsigned char *) &props[PROP_EWMH_STATE_STICKY], 1); + } + /* Set startup ID property if given by the launching application. */ if (getenv("DESKTOP_STARTUP_ID")) { Atom atom; - unsigned char *tmp = SPIF_CAST_PTR(uchar) getenv("DESKTOP_STARTUP_ID"); + unsigned char *tmp = (spif_uchar_t *) getenv("DESKTOP_STARTUP_ID"); atom = XInternAtom(Xdisplay, "UTF8_STRING", False); XChangeProperty(Xdisplay, TermWin.parent, props[PROP_EWMH_STARTUP_ID], atom, 8, PropModeReplace, tmp, strlen(tmp) + 1); @@ -511,9 +558,9 @@ Create_Windows(int argc, char *argv[]) /* Set window opacity if needed. */ if ((props[PROP_EWMH_OPACITY] != None) && (rs_opacity != 0xff)) { XChangeProperty(Xdisplay, TermWin.parent, props[PROP_EWMH_OPACITY], - XA_CARDINAL, 32, PropModeReplace, SPIF_CAST_PTR(uchar) & rs_opacity, 1); + XA_CARDINAL, 32, PropModeReplace, (spif_uchar_t *) &rs_opacity, 1); XChangeProperty(Xdisplay, TermWin.vt, props[PROP_EWMH_OPACITY], - XA_CARDINAL, 32, PropModeReplace, SPIF_CAST_PTR(uchar) & rs_opacity, 1); + XA_CARDINAL, 32, PropModeReplace, (spif_uchar_t *) &rs_opacity, 1); } /* We're done creating our windows. Now let's initialize the event subsystem to handle them. */ @@ -691,11 +738,19 @@ handle_resize(unsigned int width, unsigned int height) void handle_move(int x, int y) { + int dx, dy; + if ((TermWin.x != x) || (TermWin.y != y)) { + dx = abs(TermWin.x - x); + dy = abs(TermWin.y - y); TermWin.x = x; TermWin.y = y; + /* If we've moved an even multiple of the screen size, there's no + need to redraw trans/viewport images; the images will line up. */ if (image_mode_any(MODE_TRANS | MODE_VIEWPORT)) { - redraw_images_by_mode(MODE_TRANS | MODE_VIEWPORT); + if ((dx % DisplayWidth(Xdisplay, Xscreen)) || (dy % DisplayHeight(Xdisplay, Xscreen))) { + redraw_images_by_mode(MODE_TRANS | MODE_VIEWPORT); + } } } } @@ -740,12 +795,12 @@ set_window_color(int idx, const char *color) } else if (i >= 0 && i <= 7) { /* normal colors */ PixColors[idx] = PixColors[minColor + i]; } else { - print_warning("Color index %d is invalid.\n", i); + libast_print_warning("Color index %d is invalid.\n", i); return; } } else if (XParseColor(Xdisplay, cmap, color, &xcol)) { if (!XAllocColor(Xdisplay, cmap, &xcol)) { - print_warning("Unable to allocate \"%s\" in the color map.\n", color); + libast_print_warning("Unable to allocate \"%s\" in the color map.\n", color); return; } if ((idx > maxBright) && (idx < 256) && (PixColors[idx])) { @@ -753,7 +808,7 @@ set_window_color(int idx, const char *color) } PixColors[idx] = xcol.pixel; } else { - print_warning("Unable to resolve \"%s\" as a color name.\n", color); + libast_print_warning("Unable to resolve \"%s\" as a color name.\n", color); return; } set_colorfgbg(); diff --git a/src/windows.h b/src/windows.h index 801e00f..edcbbb7 100644 --- a/src/windows.h +++ b/src/windows.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/stamp-h.in b/stamp-h.in deleted file mode 100644 index 9788f70..0000000 --- a/stamp-h.in +++ /dev/null @@ -1 +0,0 @@ -timestamp diff --git a/utils/Etbg.c b/utils/Etbg.c index a2de931..4a9bfc6 100644 --- a/utils/Etbg.c +++ b/utils/Etbg.c @@ -5,7 +5,7 @@ * This program is distributed under the GNU Public License (GPL) as * outlined in the COPYING file. * - * Copyright (C) 1997-2000, Brian McFee. + * Copyright (C) 1997-2009, Brian McFee. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/utils/Ettable.c b/utils/Ettable.c index e547104..1f98c2d 100644 --- a/utils/Ettable.c +++ b/utils/Ettable.c @@ -1,25 +1,25 @@ /* Ettable -- Eterm ASCII Table Display Utility - - * This file is original work by Michael Jennings . - * This program is distributed under the GNU Public License (GPL) as - * outlined in the COPYING file. * - * Copyright (C) 1997-2004, Michael Jennings + * Copyright (C) 1997-2009, Michael Jennings * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies of the Software, its documentation and marketing & publicity + * materials, and acknowledgment shall be given in the documentation, materials + * and software packages that this Software was used. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ static const char cvs_ident[] = "$Id$"; diff --git a/utils/kEsetroot.in b/utils/kEsetroot.in index 906d30e..d375994 100755 --- a/utils/kEsetroot.in +++ b/utils/kEsetroot.in @@ -56,7 +56,7 @@ while () { } close (in); -system("@BINDIR@/Esetroot $PixMapMode-display :0 $PixMap"); +system("@BINDIR@/Esetroot $PixMapMode $PixMap"); if (!-e "$HOME/Desktop/Autostart/kEsetroot.kdelnk") { print "Do you want to start kEsetroot when KDE starts? y/n [y] ";