Compare commits

...

71 Commits

Author SHA1 Message Date
Michael Jennings e8fb85b56d Eterm.spec: Fix typo in %{_rel} definition 2020-03-03 10:33:47 -07:00
Michael Jennings 8c9cdbb8e5 Eterm.spec: Remove forced manual deps on loaders 2020-02-28 17:21:20 -07:00
Michael Jennings 5d475d0105 src/*.c, Eterm.spec: Various build fixes
Several changes here to make it build on RHEL/CentOS 8:
 - Replace outdated MEMSET() macro with (g)libc memset()
 - Update Release field to use `git describe` just like LibAST
 - Fix `make distcheck` by adding an uninstall-hook for src/gdb.scr
 - At long last, remove the ancient RPM %changelog content
 - Fix incompatibility with my traditional choices for CFLAGS
   (-O0 -g3) and modern RHEL security/hardening goop which, due to
   being implemented in the GCC optimizer, is rendered non-functional
   by building with -O0!
 - Rename backgrounds tarball so that it doesn't have the Eterm
   version in its name since, shockingly, it never changes based on
   the version of Eterm!
2020-02-28 17:06:54 -07:00
Stéphane Aulery 37d7e09045 Typo in eterm-utils.1
Reviewers: raster

Subscribers: stefan_schmidt

Differential Revision: https://phab.enlightenment.org/D1715
2014-12-17 14:37:58 +09:00
Stéphane Aulery 898bd8e33a doc typos: "occurances", "seperators" and "suppliment"
Maniphest Tasks: T1737

Differential Revision: https://phab.enlightenment.org/D1668
2014-11-29 16:27:10 +09:00
Michael Jennings 557e0c7a1d Fix possible uninitialized variable usage caught by David Binderman <dcb314@hotmail.com>. 2014-10-24 17:59:17 -07:00
Michael Jennings e873c27bb3 Add some new stuff to ignore. Helpful on Cygwin. 2014-10-24 17:57:58 -07:00
Boris Faure 4b35c31087 fix infinite loop while closing file descriptor when too many available 2014-07-29 20:32:47 +02:00
Michael Jennings 31233f31d8 Patch from Pavel Sanda <ps@ucw.cz> to fix copy/paste behavior with
some Qt-based apps (e.g., LyX).
2014-03-26 09:00:45 -07:00
Cedric BAIL 747082e87b autotools: move to AC_CONFIG_HEADERS.
Patch by Doug Newgard <scimmia22@outlook.com>.


SVN revision: 82135
2013-01-04 00:55:00 +00:00
Mike Frysinger 4b79984674 eterm: add GNU stack markings to mmx asm code to avoid implicitly enabling executable stacks
https://bugs.gentoo.org/440618

SVN revision: 78911
2012-11-05 08:03:46 +00:00
Boris Faure c8cd7d1824 remove .cvsignore files
SVN revision: 60246
2011-06-12 21:38:37 +00:00
Michael Jennings dc38a845f8 Tue Mar 15 23:26:05 2011 Michael Jennings (mej)
Release Eterm 0.9.6.
----------------------------------------------------------------------


SVN revision: 59415
2011-05-15 21:41:39 +00:00
Michael Jennings 21375413fa Tue Mar 15 23:08:26 2011 Michael Jennings (mej)
Fix for CVE-2011-0768, an off-by-one error in handling large pixmap
filenames which resulted in an overflow of a single NUL character if
the filename exceeded PATH_MAX bytes.  This bug is NOT exploitable.
Again, thanks to Jonathan Brossard and the team at Toucan System for
responsibly disclosing this vulnerability and to CERT for assisting
with coordination and disclosure.
----------------------------------------------------------------------


SVN revision: 59414
2011-05-15 21:24:19 +00:00
Michael Jennings e096c4df0f Tue Mar 15 23:03:57 2011 mej
Fix for CVE-2011-0409 (CERT VU#285156), a use-after-free error in the
XIM code.  This only affects versions where XIM support is compiled in
(which it is by default).  There are no known exploits for this bug,
but it is theoretically exploitable.  Thanks to Jonathan Brossard and
the team at Toucan System for responsibly disclosing this
vulnerability and to CERT for assisting with coordination and
disclosure.
----------------------------------------------------------------------


SVN revision: 59413
2011-05-15 21:19:59 +00:00
Lucas De Marchi 369e95c1df Revert and re-apply badnull patch
Revert previous patch generated by badnull.cocci script, and apply the new one.
The main difference is that assert and assert-like functions are not touched
anymore.




SVN revision: 51650
2010-08-26 01:34:13 +00:00
Michael Jennings d3bb74d029 Revert coccinelle changes.
Using !! instead of != NULL results in significantly and unacceptably
less readable code, and I refuse to accept those changes.
Unfortunately, since they were all done at once, I have to revert the
whole thing.  Oh well. :(


SVN revision: 51583
2010-08-23 17:55:09 +00:00
Lucas De Marchi 3f375e63e2 Convert (hopefully) all comparisons to NULL
Apply badzero.cocci, badnull.coci and badnull2.cocci

This should convert all cases where there's a comparison to NULL to simpler
forms. This patch applies the following transformations:

code before patch               ||code after patch
===============================================================

return a == NULL;                 return !a;

return a != NULL;                 return !!a;

func(a == NULL);                  func(!a);

func(a != NULL);                  func(!!a);

b = a == NULL;                    b = !a;

b = a != NULL;                    b = !!a;

b = a == NULL ? c : d;            b = !a ? c : d;

b = a != NULL ? c : d;            b = a ? c : d;


other cases:

a == NULL                         !a
a != NULL                         a




SVN revision: 51487
2010-08-21 13:52:25 +00:00
Kim Woelders c81f5795de Eliminate use of Xmu.
This causes the following change:
In script.c and term.c XA_CLIPBOARD(Xdisplay) used to expand to
XA_PRIMARY, i.e. the identifier of the "PRIMARY" atom, now it will
be the identifier of the "CLIPBOARD" atom.

SVN revision: 50969
2010-08-10 18:08:44 +00:00
Michael Jennings 8f2dd859a6 Sun Aug 8 16:32:44 2010 Michael Jennings (mej)
Modified patch from Paolo Ferrario <skooks@tiscali.it> based on input
from Kim Woelders <kim@woelders.dk> to allow Eterm to respond to
selection requests in UTF-8, compound text, or string only.
Previously, exotic selection request types would receive a string
back, but it would claim to be whatever type was requested.  Now it
claims to be a string, which is probably more correct.  This should
also eliminate server round-trips when clients ask for UTF-8, get a
string, then ask for a string (Opera).
----------------------------------------------------------------------


SVN revision: 50916
2010-08-08 23:37:54 +00:00
Michael Jennings d9da90c06d Thu Nov 12 22:11:49 2009 Michael Jennings (mej)
Additional debugging and proper bracing.
----------------------------------------------------------------------


SVN revision: 43652
2009-11-13 06:11:52 +00:00
Michael Jennings 7415528f52 Thu Nov 12 16:23:46 2009 Michael Jennings (mej)
Gearing up for 0.9.6 release.
----------------------------------------------------------------------


SVN revision: 43650
2009-11-13 00:23:48 +00:00
Michael Jennings 10842b025d Sun Oct 25 14:07:07 2009 Michael Jennings (mej)
Fix off-by-one error that was causing crashes with visual bell.  Found
by d_willsc@cojobo.bonn.de.
----------------------------------------------------------------------


SVN revision: 43285
2009-10-25 21:07:43 +00:00
Michael Jennings 7dea24910a Sun Oct 25 14:02:14 2009 Michael Jennings (mej)
Revert bad change to borderless code.  We're now doing best effort
borderless with no override_redirect (which may come back some day as
a separate option if there's a need) based on advice from raster and
kwo.
----------------------------------------------------------------------


SVN revision: 43284
2009-10-25 21:03:18 +00:00
Michael Jennings f4494790e2 Sun Oct 25 13:52:40 2009 Michael Jennings (mej)
Support font effects in 8 directions.  Patch supplied by Joern
Bernhardt <Joern.Bernhardt@gmx.net>.
----------------------------------------------------------------------


SVN revision: 43283
2009-10-25 20:53:47 +00:00
Michael Jennings e59a5a4e95 Sun Oct 25 12:39:34 2009 Michael Jennings (mej)
Fix for scrolling limitations from Cliff Miller <cbm@whatexit.org>.
----------------------------------------------------------------------


SVN revision: 43282
2009-10-25 20:33:35 +00:00
Michael Jennings 42a135456a Sun Oct 25 12:36:01 2009 Michael Jennings (mej)
Patch for FreeBSD UNIX98 pty support from Ed Schouten <ed@80386.nl>.
----------------------------------------------------------------------


SVN revision: 43281
2009-10-25 20:30:06 +00:00
Michael Jennings c6ff25f5f1 Sun Oct 25 12:29:32 2009 Michael Jennings (mej)
Re-enable SIGPIPE after fork() for child processes who might not
re-enable it on their own.
----------------------------------------------------------------------


SVN revision: 43280
2009-10-25 20:23:24 +00:00
Michael Jennings c23b7ce6aa Sun Oct 25 12:08:16 2009 Michael Jennings (mej)
Fix some bad replacements.
----------------------------------------------------------------------


SVN revision: 43278
2009-10-25 20:01:27 +00:00
Hannes Janetzek abdb6c1591 break when property was found, fix formatting
SVN revision: 42897
2009-10-06 00:02:16 +00:00
Hannes Janetzek a26cde7b3d check wm supporting hints for mwm:
make borderless also work with window managers that do not pretend to be mwm


SVN revision: 42896
2009-10-05 23:54:53 +00:00
Kim Woelders 07e0c8b22b Yet another attempt to fix selection issues on 64 bit systems.
SVN revision: 41918
2009-08-21 16:50:52 +00:00
Mike Frysinger 05997662cd add patch from fedora to try and fix qt copy & paste problems on 64bit systems
SVN revision: 41896
2009-08-20 18:40:47 +00:00
Mike Frysinger 652f8f3a86 do not redefine _GNU_SOURCE if configure already set it up for us
SVN revision: 41895
2009-08-20 18:38:38 +00:00
Mike Frysinger 8ed6bd1597 drop NETDISP_IDENT since netdisp.c was dropped a while ago
SVN revision: 41894
2009-08-20 18:34:55 +00:00
Daniel Kolesa 9f865a7a39 Added debian/rules files with a new permissions set(755).
SVN revision: 38519
2009-01-09 16:33:51 +00:00
Daniel Kolesa 47196758eb prepare debian rules files for new chmod permissions.
SVN revision: 38518
2009-01-09 16:31:51 +00:00
Michael Jennings f5e3dbacf6 Tue Jan 6 01:08:47 2009 Michael Jennings (mej)
Update copyright dates and fix a bad license.
----------------------------------------------------------------------


SVN revision: 38480
2009-01-06 09:08:48 +00:00
Michael Jennings e53c4775f6 Tue Jan 6 01:03:35 2009 Michael Jennings (mej)
Prevent blank Escreen buttonbar on startup.
----------------------------------------------------------------------


SVN revision: 38479
2009-01-06 09:03:36 +00:00
Michael Jennings 0261bd001b 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.
----------------------------------------------------------------------


SVN revision: 38477
2009-01-06 07:51:15 +00:00
Michael Jennings 9a7cd3adac Tue Dec 16 22:03:54 2008 Michael Jennings (mej)
Fix compile errors related to the removal of unnecessary typecasting
macros.
----------------------------------------------------------------------


SVN revision: 38171
2008-12-17 06:04:15 +00:00
Peter Wehrfritz 331e221835 configure.in -> configure.ac
SVN revision: 36367
2008-09-30 23:54:31 +00:00
Carsten Haitzler f186940bf8 fix more binary files
SVN revision: 35522
2008-08-17 23:28:31 +00:00
Michael Jennings 69d5e8e482 Wed Jun 11 20:18:44 2008 Michael Jennings (mej)
Eterm 0.9.5 release.
----------------------------------------------------------------------


SVN revision: 34806
2008-06-12 03:18:49 +00:00
Michael Jennings 883b2660af 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.
----------------------------------------------------------------------


SVN revision: 34574
2008-05-14 23:16:54 +00:00
Michael Jennings 1b91d07318 Wed May 14 15:26:13 2008 Michael Jennings (mej)
Patch from Emmanuel Anne <emmanuel.anne@gmail.com> to fix cut/paste
with KDE applications.
----------------------------------------------------------------------


SVN revision: 34573
2008-05-14 22:26:36 +00:00
Michael Jennings c7a352b0c0 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.
----------------------------------------------------------------------


SVN revision: 34572
2008-05-14 21:54:45 +00:00
Michael Jennings 3df02b2205 Wed May 14 12:42:51 2008 Michael Jennings (mej)
Patch from Kim Woelders <kim@woelders.dk>:

    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.
----------------------------------------------------------------------


SVN revision: 34568
2008-05-14 19:49:22 +00:00
Mike Frysinger b9f3a99c56 fix from Nico Golde from Debian for deb bug #473127 and gentoo bug #216833
SVN revision: 34279
2008-04-16 03:23:27 +00:00
Michael Jennings c89592cf96 Tue Jul 3 20:48:46 2007 Michael Jennings (mej)
Remove some cruft from kEsetroot.
----------------------------------------------------------------------


SVN revision: 30586
2007-07-04 00:49:33 +00:00
Mike Frysinger 2c56b87f87 need AM_PROG_AS since we compile .S files
SVN revision: 28413
2007-02-21 02:36:24 +00:00
Michael Jennings 03ceed41a5 Mon Oct 30 16:11:47 2006 Michael Jennings (mej)
Patch from Jason McCarver <slam@parasite.cc> to support -S/--sticky
option for "sticky" (i.e., present on all desktops) startup.
----------------------------------------------------------------------


SVN revision: 26874
2006-10-30 21:12:12 +00:00
Michael Jennings 3ccf45d5af Wed Oct 18 13:35:18 2006 Michael Jennings (mej)
Fixed a typo and some logic errors in libscream located by Mike
Frysinger <vapier@gentoo.org>.
----------------------------------------------------------------------


SVN revision: 26691
2006-10-18 17:36:10 +00:00
Michael Jennings 517985c4a9 Tue Sep 19 17:07:28 2006 Michael Jennings (mej)
libscream.c is licensed just like Eterm.
----------------------------------------------------------------------


SVN revision: 25979
2006-09-19 21:07:40 +00:00
quan74 82489cd820 use macro for docdir
SVN revision: 25869
2006-09-16 04:51:52 +00:00
Michael Jennings 3ba5a5d9ab Tue Aug 22 14:38:15 2006 Michael Jennings (mej)
Eterm 0.9.4 is final.
----------------------------------------------------------------------


SVN revision: 25040
2006-08-22 18:38:24 +00:00
Michael Jennings a46cf0774d Tue Aug 22 14:07:23 2006 Michael Jennings (mej)
Forgot one.
----------------------------------------------------------------------


SVN revision: 25039
2006-08-22 18:07:32 +00:00
Michael Jennings edf3577888 Fri Aug 18 13:41:14 2006 Michael Jennings (mej)
Addressed licensing concerns.
----------------------------------------------------------------------


SVN revision: 24877
2006-08-18 17:41:19 +00:00
Michael Jennings ddd7611608 Sat Jun 17 23:06:03 2006 Michael Jennings (mej)
Daniel Macks <dmacks@netspace.org> noticed that gdb.scr wasn't being
installed.  Oops.  Fixed now.
----------------------------------------------------------------------


SVN revision: 23491
2006-06-18 03:06:27 +00:00
Michael Jennings 6c1e5b3b6c 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.
----------------------------------------------------------------------


SVN revision: 22752
2006-05-19 20:45:42 +00:00
Michael Jennings cc5392df86 Wed May 17 15:42:28 2006 Michael Jennings (mej)
Patch from Kim Woelders <kim@woelders.dk> to optimize transparent
Eterms moved an even multiple of the desktop size (i.e., to another
desktop area).
----------------------------------------------------------------------


SVN revision: 22674
2006-05-17 19:42:39 +00:00
Michael Jennings e7117e77bf 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.
----------------------------------------------------------------------


SVN revision: 20766
2006-02-24 21:58:58 +00:00
Michael Jennings 7537403997 Mon Feb 13 14:51:56 2006 Michael Jennings (mej)
Update to libast 0.6+ API.
----------------------------------------------------------------------


SVN revision: 20440
2006-02-13 19:52:45 +00:00
Michael Jennings fccdc9bb52 Mon Feb 6 17:15:49 2006 Michael Jennings (mej)
DragonFly BSD fixes from Joerg Sonnenberger <joerg@britannica.bec.de>.

Also some type mismatch fixes.
----------------------------------------------------------------------


SVN revision: 20313
2006-02-06 22:16:50 +00:00
Michael Jennings f7397a0611 Mon Feb 6 01:02:15 2006 Michael Jennings (mej)
Fixed paste from clipboard.
----------------------------------------------------------------------


SVN revision: 20304
2006-02-06 06:00:19 +00:00
Michael Jennings 0ae1a05f4b Thu Jan 5 14:50:53 2006 Michael Jennings (mej)
Fixed firewall bounce port checking from 2005-12-05.
----------------------------------------------------------------------


SVN revision: 19542
2006-01-05 19:49:32 +00:00
Michael Jennings b8cf59b892 Wed Jan 4 04:22:13 2006 Michael Jennings (mej)
Update copyright dates.
----------------------------------------------------------------------


SVN revision: 19522
2006-01-04 09:22:41 +00:00
Michael Jennings 9c737f4aa1 Wed Jan 4 04:14:14 2006 Michael Jennings (mej)
Applied patches from Tres Melton <tres@mindspring.com> for SSE2
alignment and other shading-related issues.
----------------------------------------------------------------------


SVN revision: 19521
2006-01-04 09:15:17 +00:00
Michael Jennings e39e3f1ce9 Wed Jan 4 03:44:04 2006 Michael Jennings (mej)
X resource tracking/debugging support.
----------------------------------------------------------------------


SVN revision: 19520
2006-01-04 08:44:14 +00:00
Michael Jennings 7af5d208eb Thu Dec 22 18:32:31 2005 Michael Jennings (mej)
Cleanups and minor enhancements.
----------------------------------------------------------------------


SVN revision: 19251
2005-12-22 23:31:33 +00:00
Michael Jennings a4e4d0359b Mon Dec 5 15:46:34 2005 Michael Jennings (mej)
Prevent firewall bounces from trying for the same port.
----------------------------------------------------------------------


SVN revision: 18847
2005-12-05 20:45:58 +00:00
105 changed files with 1853 additions and 1496 deletions

View File

@ -1,27 +0,0 @@
*.log
config.sub
config.cache
config.guess
configure
ltconfig
ltmain.sh
Makefile
Makefile.in
aclocal.m4
config.status
config.h
libtool
stamp-h*
move-themes
*.spec
config.h.in
missing
mkinstalldirs
install-sh
Eterm*.tar.gz
*.sddf
autom4te*
depcomp
build.mezz
iconv_test*
utf8*

47
.gitignore vendored Normal file
View File

@ -0,0 +1,47 @@
*.log
config.sub
config.cache
config.guess
configure
ltconfig
ltmain.sh
Makefile
Makefile.in
aclocal.m4
libtool.m4
lt*.m4
config.status
config.h
libtool
stamp-h*
libast.spec
config.h.in
missing
mkinstalldirs
install-sh
Eterm*.tar.gz
*.sddf
Makefile
Makefile.in
.deps
.libs
lib*.la
*.da
*.lo
*.o
autom4te*
depcomp
*.orig
*.rej
*~
bg/*/*.jpg
bg/*/*.png
doc/Eterm.1
doc/Eterm.1.html
doc/Eterm.tcap
src/Eterm*
themes/*/theme.cfg
utils/Esetroot*
utils/Etbg*
utils/Ettable*
utils/kEsetroot*

244
ChangeLog
View File

@ -5437,3 +5437,247 @@ Fixed an incredibly-difficult-to-track-down missing "break" statement
which caused the "New..." and Ctrl-T functionality to fail to prompt
for a tab name.
----------------------------------------------------------------------
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 <tres@mindspring.com> 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 <joerg@britannica.bec.de>.
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 <kim@woelders.dk> 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 <dmacks@netspace.org> 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 <vapier@gentoo.org>.
----------------------------------------------------------------------
Mon Oct 30 16:11:47 2006 Michael Jennings (mej)
Patch from Jason McCarver <slam@parasite.cc> 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 <kim@woelders.dk>:
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 <emmanuel.anne@gmail.com> 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 12:08:16 2009 Michael Jennings (mej)
Fix some bad replacements.
----------------------------------------------------------------------
Sun Oct 25 12:29:32 2009 Michael Jennings (mej)
Re-enable SIGPIPE after fork() for child processes who might not
re-enable it on their own. Pointed out by Sylvain Martin
<sylvain.martin@ulg.ac.be>.
----------------------------------------------------------------------
Sun Oct 25 12:36:01 2009 Michael Jennings (mej)
Patch for FreeBSD UNIX98 pty support from Ed Schouten <ed@80386.nl>.
----------------------------------------------------------------------
Sun Oct 25 12:39:34 2009 Michael Jennings (mej)
Fix for scrolling limitations from Cliff Miller <cbm@whatexit.org>.
----------------------------------------------------------------------
Sun Oct 25 13:52:40 2009 Michael Jennings (mej)
Support font effects in 8 directions. Patch supplied by Joern
Bernhardt <Joern.Bernhardt@gmx.net>.
----------------------------------------------------------------------
Sun Oct 25 14:02:14 2009 Michael Jennings (mej)
Revert bad change to borderless code. We're now doing best effort
borderless with no override_redirect (which may come back some day as
a separate option if there's a need) based on advice from raster and
kwo.
----------------------------------------------------------------------
Sun Oct 25 14:07:07 2009 Michael Jennings (mej)
Fix off-by-one error that was causing crashes with visual bell. Found
by d_willsc@cojobo.bonn.de.
----------------------------------------------------------------------
Thu Nov 12 16:23:46 2009 Michael Jennings (mej)
Gearing up for 0.9.6 release.
----------------------------------------------------------------------
Thu Nov 12 22:11:49 2009 Michael Jennings (mej)
Additional debugging and proper bracing.
----------------------------------------------------------------------
Sun Aug 8 16:32:44 2010 Michael Jennings (mej)
Modified patch from Paolo Ferrario <skooks@tiscali.it> based on input
from Kim Woelders <kim@woelders.dk> to allow Eterm to respond to
selection requests in UTF-8, compound text, or string only.
Previously, exotic selection request types would receive a string
back, but it would claim to be whatever type was requested. Now it
claims to be a string, which is probably more correct. This should
also eliminate server round-trips when clients ask for UTF-8, get a
string, then ask for a string (Opera).
----------------------------------------------------------------------
Tue Mar 15 23:03:57 2011 Michael Jennings (mej)
Fix for CVE-2011-0409 (CERT VU#285156), a use-after-free error in the
XIM code. This only affects versions where XIM support is compiled in
(which it is by default). There are no known exploits for this bug,
but it is theoretically exploitable. Thanks to Jonathan Brossard and
the team at Toucan System for responsibly disclosing this
vulnerability and to CERT for assisting with coordination and
disclosure.
----------------------------------------------------------------------
Tue Mar 15 23:08:26 2011 Michael Jennings (mej)
Fix for CVE-2011-0768, an off-by-one error in handling large pixmap
filenames which resulted in an overflow of a single NUL character if
the filename exceeded PATH_MAX bytes. This bug is NOT exploitable.
Again, thanks to Jonathan Brossard and the team at Toucan System for
responsibly disclosing this vulnerability and to CERT for assisting
with coordination and disclosure.
----------------------------------------------------------------------
Tue Mar 15 23:26:05 2011 Michael Jennings (mej)
Release Eterm 0.9.6.
----------------------------------------------------------------------
Wed Mar 26 08:59:13 2014 Michael Jennings (mej)
Patch from Pavel Sanda <ps@ucw.cz> to fix copy/paste behavior with
some Qt-based apps (e.g., LyX).
----------------------------------------------------------------------

View File

@ -1,23 +1,27 @@
%{!?_rel:%{expand:%%global _rel 0.%(git describe --abbrev=4 --always --tags --long --dirty=1 | cut -d- -f 2- | tr '-' '.')}}
%if %{!?compression:1}0
%define compression gz
%endif
%define __os_install_post /usr/lib/rpm/brp-compress
%if %{?optflags:1}0
%{expand:%%define optflags %{!?el8:${RPM_OPT_FLAGS:--O0 -g3}}%{?el8:-O2 -ggdb3 -fPIC}}
%endif
Summary: Enlightened terminal emulator
Name: Eterm
Version: 0.9.4
#Release: 1
Release: 0.%(date '+%Y%m%d')
Version: 0.9.7
Release: %{_rel}%{?dist}
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}-backgrounds.tar.%{compression}
#BuildSuggests: xorg-x11-devel, XFree86-devel, xorg-x11-proto-devel, libXext-devel, libXt-devel, freetype-devel
BuildRequires: libast, imlib2-devel
Requires: imlib2
BuildRoot: %{?_tmppath}%{!?_tmppath:/var/tmp}/%{name}-%{version}-%{release}-root
%description
Eterm is a color vt102 terminal emulator with enhanced graphical
@ -28,12 +32,13 @@ various themes and is very configurable, in keeping with the
philosophy of Enlightenment. If you install Eterm, you'll also need to
have the Imlib2 library installed.
%prep
%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
@ -44,22 +49,23 @@ export CFLAGS
--with-debugging=9 %{?acflags}
%{__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 <<EOF
[Desktop Entry]
Name=Eterm
@ -72,123 +78,32 @@ Type=Application
EOF
chmod 0644 $RPM_BUILD_ROOT%{_sysconfdir}/X11/applnk/Utilities/Eterm.desktop
%post
/sbin/ldconfig || :
if [ -d /usr/share/terminfo -a ! -f /usr/share/terminfo/E/Eterm ]; then
tic -o/usr/share/terminfo $RPM_DOC_DIR/%{name}-%{version}/%{name}.ti || :
tic -o/usr/share/terminfo %{_docdir}/%{name}-%{version}/%{name}.ti || :
fi
%postun
/sbin/ldconfig || :
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-, root, root)
%doc doc/Eterm_reference.html doc/Eterm.1.html doc/Eterm.tcap doc/Eterm.ti doc/README.Escreen
%doc README ReleaseNotes ReleaseNotes.1 ChangeLog
%doc LICENSE README ReleaseNotes ReleaseNotes.1 ChangeLog
%config %{_sysconfdir}/X11/applnk/Utilities/Eterm.desktop
%{_bindir}/*
%{_libdir}/*
%{_mandir}/man1/*
%{_datadir}/%{name}/*
%changelog
* Tue Feb 20 2001 Tim Powers <timp@redhat.com>
- builds on Alpha now. No need to excludearch (bug 28472)
* Wed Feb 14 2001 Tim Powers <timp@redhat.com>
- removed images which are from Digital Blasphemy from the extra
images tarball, had to delete those images because they are not
allowed to be redistributed on CD, or in compressed format
* Tue Jan 9 2001 Tim Powers <timp@redhat.com>
- fixed a bunch of pre and post in/uninstall brokenness by dropping
split backgrounds package, backgrounds now included in Eterm
proper. This also makes the spec file a lot cleaner :)
* Sat Aug 19 2000 Tim Powers <timp@redhat.com>
- fix bug #15687
* Tue Aug 8 2000 Tim Powers <timp@redhat.com>
- fixed bug #15687 using Hans' patch
* Wed Aug 2 2000 Tim Powers <timp@redhat.com>
- rebuilt against libpng-1.0.8
* Mon Jul 24 2000 Prospector <prospector@redhat.com>
- rebuilt
* Sat Jul 22 2000 Tim Powers <timp@redhat.com>
- fix spec file problem with configure picking up egcs and running with it,
fixes linking bugs
* Mon Jul 10 2000 Tim Powers <timp@redhat.com>
- rebuilt
* Fri Jun 2 2000 Tim Powers <timp@redhat.com>
- no more wmconfig :) converted to applnk
- fix man page location. Now FHS compliant
- use macros wherever possible
- removed redundant defines at the top of the spec
* Mon Apr 10 2000 Tim Powers <timp@redhat.com>
- rebuilt for 7.0
* Thu Feb 03 2000 Tim Powers <timp@redhat.com>
- strip debug from libraries
* Wed Feb 02 2000 Tim Powers <timp@redhat.com>
- fixed problems when upgrading and error messages due to a faulty script in
the post section for the Eterm package
* Tue Feb 01 2000 Tim Powers <timp@redhat.com>
- applied patch from Hans de Goede <hans@highrise.nl> to fix some del, home
and end issues
* Fri Jan 29 2000 Tim Powers <timp@redhat.com>
- rebuilt for 6.2 powertools
- bzipped source to conserve space
- using percent configure so that libtoolize is run, needed for some of the
newer alphas instead of ./configure --prefix=
- stripping binaries again
* Fri Dec 10 1999 Michael Jennings <mej@eterm.org>
- Added Tim's spec file to CVS as Eterm.spec.in for 0.9
* Wed Dec 8 1999 Tim Powers <timp@redhat.com>
- using unified patch for utempter and themes from Michael Jennings
* Tue Dec 7 1999 Tim Powers <timp@redhat.com>
- added wmconfig entry
- split up into 2 packages, Eterm proper, and Eterm-backgrounds
- thanks to ewt, we no longer have to make Eterm suid root, uses utempter
instead
* Mon Dec 6 1999 Tim Powers <timp@redhat.com>
- updated to 0.8.10
- patched so that Eterm finds pix/themes in the right place
- new version fixes problems with utmp, conforms to Eterm docs.
- added RedHat.Eterm_suid which includes instructions on how to run Eterm in
order to have it seen by "w" and "who" as a regular user
* Fri Aug 20 1999 Tim Powers <timp@redhat.com>
- fixed roblem with removing all files when uninstalling Eterm.
* Tue Jul 27 1999 Tim Powers <timp@redhat.com>
- updated version to 0.8.9
- cleaned up spec
- updated patch
- includes new backgrounds
- built for 6.1
* Mon Apr 05 1999 Michael Maher <mike@redhat.com>
- update to 0.8.8
* Fri Oct 23 1998 Jeff Johnson <jbj@redhat.com>
- update to 0.8.7.
* Fri Oct 08 1998 Michael Maher <mike@redhat.com>
- built eterm

23
LICENSE Normal file
View File

@ -0,0 +1,23 @@
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.

View File

@ -4,6 +4,6 @@ AUTOMAKE_OPTIONS = foreign
SUBDIRS = src themes utils doc bg pix
EXTRA_DIST = README ReleaseNotes ReleaseNotes.1 CVS-README ChangeLog autogen.sh Eterm.spec
EXTRA_DIST = LICENSE README ReleaseNotes ReleaseNotes.1 CVS-README ChangeLog autogen.sh Eterm.spec
MAINTAINERCLEANFILES = Makefile.in *~ aclocal.m4 config.guess config.sub configure depcomp \
install-sh ltconfig ltmain.sh missing mkinstalldirs stamp-h* *.log config.h.in

View File

@ -1,3 +0,0 @@
Makefile
Makefile.in
pixmaps.list

View File

@ -1,4 +0,0 @@
*.jpg
*.png
*.gif
*.list

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -1,4 +0,0 @@
*.jpg
*.png
*.gif
*.list

View File

@ -22,7 +22,7 @@ SAVE_AUTOHEADER="$AUTOHEADER"
SAVE_AUTOMAKE="$AUTOMAKE"
AC_INIT(src/feature.h)
AM_INIT_AUTOMAKE(Eterm, 0.9.4)
AM_INIT_AUTOMAKE(Eterm, 0.9.7)
dnl# Set some basic variables
DATE="`date '+%d %B %Y'`"
@ -62,7 +62,6 @@ AC_DEFINE_UNQUOTED(GRKELOT_IDENT, "`grep '$''Id:' $srcdir/src/grkelot.c | sed 's
AC_DEFINE_UNQUOTED(MAIN_IDENT, "`grep '$''Id:' $srcdir/src/main.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [main.c RCS ID])
AC_DEFINE_UNQUOTED(MENUS_IDENT, "`grep '$''Id:' $srcdir/src/menus.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [menus.c RCS ID])
AC_DEFINE_UNQUOTED(MISC_IDENT, "`grep '$''Id:' $srcdir/src/misc.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [misc.c RCS ID])
AC_DEFINE_UNQUOTED(NETDISP_IDENT, "`grep '$''Id:' $srcdir/src/netdisp.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [netdisp.c RCS ID])
AC_DEFINE_UNQUOTED(OPTIONS_IDENT, "`grep '$''Id:' $srcdir/src/options.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [options.c RCS ID])
AC_DEFINE_UNQUOTED(PIXMAP_IDENT, "`grep '$''Id:' $srcdir/src/pixmap.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [pixmap.c RCS ID])
AC_DEFINE_UNQUOTED(SCREEN_IDENT, "`grep '$''Id:' $srcdir/src/screen.c | sed 's/^.*\$''Id: //;s/ \$.*$//;s/.v / /;s/ Exp//'`", [screen.c RCS ID])
@ -111,6 +110,7 @@ fi
AC_PROG_CC
AC_PROG_CPP
AM_PROG_AS
dnl# These must be run after AC_PROG_CC but before any other macros that use
dnl# the C compiler
@ -204,8 +204,9 @@ AC_CHECK_HEADERS(fcntl.h termios.h \
sys/ioctl.h sys/select.h sys/time.h \
sys/sockio.h sys/byteorder.h malloc.h \
utmpx.h unistd.h bsd/signal.h regex.h \
regexp.h stdarg.h X11/Xmu/Atoms.h \
X11/Sunkeysym.h X11/Xlocale.h)
regexp.h stdarg.h X11/X.h X11/Xlib.h \
X11/Sunkeysym.h X11/Xlocale.h \
)
AC_HEADER_TIME
dnl# Missing typedefs and replacements
@ -219,7 +220,8 @@ AC_TYPE_SIGNAL
AC_CHECK_FUNCS(atexit _exit unsetenv setutent \
seteuid memmove putenv strsep setresuid setresgid \
memmem usleep snprintf strcasestr strcasechr \
strcasepbrk strrev nl_langinfo)
strcasepbrk strrev nl_langinfo \
)
# NOTE: The following line is NOT NOT NOT NOT NOT a typo!
# If you are having problems with it, libast.m4 is not installed
@ -255,6 +257,9 @@ AC_ARG_WITH(debugging, [ --with-debugging[=num] enable debugging output, num i
AC_DEFINE_UNQUOTED(DEBUG, 4, [Debugging level to compile in.])
])
AC_CHECK_FUNC(posix_openpt,
HAVE_POSIX_OPENPT=yes
)
AC_CHECK_FUNC(ptsname,
HAVE_PTSNAME=yes
)
@ -267,6 +272,10 @@ AC_CHECK_FUNC(unlockpt,
dnl# Check for the appropriate pty mechanism
AC_MSG_CHECKING(for pty mechanism)
PTY_MECH=""
if test ! -z "$HAVE_POSIX_OPENPT" -a ! -z "$HAVE_PTSNAME" -a ! -z "$HAVE_GRANTPT" -a ! -z "$HAVE_UNLOCKPT"; then
AC_DEFINE(HAVE_POSIX_OPENPT, , [Define for posix_openpt() support.])
PTY_MECH="POSIX $PTY_MECH"
fi
if test -c /dev/ptc ; then
AC_DEFINE(HAVE_DEV_PTC, , [Define for /dev/ptc support.])
PTY_MECH="AIX $PTY_MECH"
@ -862,16 +871,30 @@ AC_ARG_ENABLE(xim,
XIM="TRUE"
])
# For multibyte selection handling
#if test "$MULTICHAR_ENCODING" != "none"; then
AC_CHECK_LIB(Xmu, XmuInternAtom)
#fi
# check X11R6 for XIM
if test "$XIM" = "TRUE"; then
AC_CHECK_LIB(X11, XRegisterIMInstantiateCallback, AC_DEFINE(USE_X11R6_XIM, , [Define if we have X11R6 XIM.]))
fi
# Check for XResource extension
AC_CHECK_HEADER([X11/extensions/XRes.h],
[
AC_DEFINE([HAVE_X11_EXTENSIONS_XRES_H], [], [Define if we have X11/extensions/XRes.h])
], [],
[
#ifdef HAVE_X11_X_H
# include <X11/X.h>
#endif
#ifdef HAVE_X11_XLIB_H
# include <X11/Xlib.h>
#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], [
@ -1029,7 +1052,7 @@ AC_SUBST(THREADLIBS)
basedir=.
AM_CONFIG_HEADER(config.h)
AC_CONFIG_HEADERS(config.h)
AC_OUTPUT([Makefile bg/Makefile doc/Makefile utils/Makefile pix/Makefile
src/Makefile themes/Makefile])

2
debian/copyright vendored
View File

@ -8,7 +8,7 @@ Upstream Author: Michael Jennings <mej@eterm.org>
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

View File

@ -36,7 +36,7 @@ display the current font character set
display a table of the current color map
.br
.B Etsearch
search the scroll back buffer, it's secksie
search the scroll back buffer, it's sexy
.br
.B Etbg_update_list
update pixmap lists for the menus

0
debian/rules vendored Normal file → Executable file
View File

View File

@ -1,4 +0,0 @@
Eterm.1
Eterm.1.html
Makefile
Makefile.in

View File

@ -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
@ -691,7 +694,7 @@ By convention and default, Eterm themes should be stored under
~/.Eterm/themes/<theme_name>/ or @THEMEDIR@/<theme_name>.
Eterm now supports the existence of a user configuration file as a
suppliment to the theme configuration file. The default name for this
supplement to the theme configuration file. The default name for this
file is user.cfg, and it follows the exact same syntax as any other
configuration file. It is searched for using the same algorithm used
for the theme.cfg file, and any settings in the user.cfg will override
@ -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
@ -2247,7 +2255,7 @@ to scroll down half a page. The default unit if not specified is
Presents a dialog box into which the user may enter a search term.
The default value is set to
.IR str .
All occurances of the specified search string are highlighted in the
All occurrences of the specified search string are highlighted in the
scrollback buffer, and Eterm jumps back to the most recent one.
Searching again with the same keyword will clear the previous
highlighting.

View File

@ -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{{||}}~~:

View File

@ -50,7 +50,7 @@ Portions of this document were taken from the XTerm documentation.</P>
</TR>
<TR>
<TD>{ ... | ... }</TD>
<TD>Items inclosed in braces and separated by pipes indicate that exactly one
<TD>Items enclosed in braces and separated by pipes indicate that exactly one
of the items should be chosen.</TD>
</TR>
</TABLE>
@ -185,7 +185,7 @@ Portions of this document were taken from the XTerm documentation.</P>
</TR>
<TR>
<TD><TT>ESC <B>Z</B></TT></TD>
<TD>Obselete form of Send Device Attributes (DA), which is <TT>ESC <B>[ c</B></TT></TD>
<TD>Obsolete form of Send Device Attributes (DA), which is <TT>ESC <B>[ c</B></TT></TD>
</TR>
<TR>
<TD><TT>ESC <B>[</B> [ <I>n</I> ] <B>@</B></TT></TD>
@ -1278,7 +1278,7 @@ are: <TT><B>1</B></TT>, <TT><B>on</B></TT>, <TT><B>yes</B></TT>, or (of course)
</TR>
<TR>
<TD><TT>ESC <B>] 6 ; 72</B> [ ;</B> <I>string</I> ] BEL</TT></TD>
<TD>Search for and highlight any occurances of <I>string</I> in the
<TD>Search for and highlight any occurrences of <I>string</I> in the
scrollback buffer.
</TD>
</TR>

View File

@ -1,2 +0,0 @@
Makefile
Makefile.in

Binary file not shown.

Before

Width:  |  Height:  |  Size: 722 B

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 B

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 715 B

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 817 B

After

Width:  |  Height:  |  Size: 818 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 812 B

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 811 B

After

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 746 B

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 722 B

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 B

After

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 708 B

After

Width:  |  Height:  |  Size: 709 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 696 B

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 703 B

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 210 B

View File

@ -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

View File

@ -1,10 +0,0 @@
Makefile
Makefile.in
.deps
.libs
Eterm
libEterm.la
feature.h
VERSION.h
*.lo
*.da

View File

@ -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,14 @@ 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
DISTCLEANFILES = Makefile
install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
test ! -z "$(GDB_CMD_FILE)" && $(INSTALL_DATA) gdb.scr $(DESTDIR)$(pkgdatadir)/ || :
MAINTAINERCLEANFILES=Makefile.in
-test ! -z "$(GDB_CMD_FILE)" && $(INSTALL_DATA) $(srcdir)/gdb.scr $(DESTDIR)$(pkgdatadir)/
uninstall-hook:
$(RM) $(DESTDIR)$(pkgdatadir)/gdb.scr

View File

@ -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
@ -228,7 +228,7 @@ action_add(unsigned short mod, unsigned char button, KeySym keysym, action_type_
action_t *action;
if (!action_list || (action = action_find_match(mod, button, keysym)) == NULL) {
if (!action_list || !(action = action_find_match(mod, button, keysym))) {
action = (action_t *) MALLOC(sizeof(action_t));
action->next = action_list;
action_list = action;

View File

@ -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

View File

@ -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
@ -84,7 +84,7 @@ buttonbar_t *bbar_create(void)
XSetWindowAttributes xattr;
bbar = (buttonbar_t *) MALLOC(sizeof(buttonbar_t));
MEMSET(bbar, 0, sizeof(buttonbar_t));
memset(bbar, 0, sizeof(buttonbar_t));
xattr.border_pixel = BlackPixel(Xdisplay, Xscreen);
xattr.save_under = FALSE;
@ -193,7 +193,7 @@ bbar_handle_enter_notify(event_t *ev)
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
if ((bbar = find_bbar_by_window(ev->xany.window)) == NULL) {
if (!(bbar = find_bbar_by_window(ev->xany.window))) {
return 0;
}
bbar_draw(bbar, IMAGE_STATE_SELECTED, 0);
@ -215,7 +215,7 @@ bbar_handle_leave_notify(event_t *ev)
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
if ((bbar = find_bbar_by_window(ev->xany.window)) == NULL) {
if (!(bbar = find_bbar_by_window(ev->xany.window))) {
return 0;
}
bbar_draw(bbar, IMAGE_STATE_NORMAL, 0);
@ -234,7 +234,7 @@ bbar_handle_button_press(event_t *ev)
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
if ((bbar = find_bbar_by_window(ev->xany.window)) == NULL) {
if (!(bbar = find_bbar_by_window(ev->xany.window))) {
D_EVENTS((" -> No buttonbar found for this window.\n"));
return 0;
}
@ -326,7 +326,7 @@ bbar_handle_button_release(event_t *ev)
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
if ((bbar = find_bbar_by_window(ev->xany.window)) == NULL) {
if (!(bbar = find_bbar_by_window(ev->xany.window))) {
D_EVENTS((" -> No buttonbar found for this window.\n"));
return 0;
}
@ -364,7 +364,7 @@ bbar_handle_motion_notify(event_t *ev)
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
if ((bbar = find_bbar_by_window(ev->xany.window)) == NULL) {
if (!(bbar = find_bbar_by_window(ev->xany.window))) {
return 0;
}
while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, MotionNotify, ev));
@ -392,7 +392,7 @@ bbar_handle_motion_notify(event_t *ev)
unsigned char
bbar_dispatch_event(event_t *ev)
{
if (buttonbar->event_data.handlers[ev->type] != NULL) {
if (buttonbar->event_data.handlers[ev->type]) {
return ((buttonbar->event_data.handlers[ev->type]) (ev));
}
return (0);
@ -721,7 +721,7 @@ button_t *find_button_by_index(buttonbar_t *bbar, long idx)
} else {
b = bbar->buttons;
}
for (i = 0; (b != NULL) && (i < idx); b = b->next, i++);
for (i = 0; (b) && (i < idx); b = b->next, i++);
return ((i == idx) ? (b) : (NULL));
}
@ -749,7 +749,7 @@ button_t *button_create(char *text)
button_t *button;
button = (button_t *) MALLOC(sizeof(button_t));
MEMSET(button, 0, sizeof(button_t));
memset(button, 0, sizeof(button_t));
if (text) {
button->text = STRDUP(text);
@ -816,19 +816,19 @@ button_set_action(button_t *button, action_type_t type, char *action)
switch (type) {
case ACTION_MENU:
button->action.menu = find_menu_by_title(menu_list, action);
return ((button->action.menu == NULL) ? (0) : (1));
return ((!button->action.menu) ? (0) : (1));
break;
case ACTION_STRING:
case ACTION_ECHO:
button->action.string = (char *) MALLOC(strlen(action) + 2);
strcpy(button->action.string, action);
parse_escaped_string(button->action.string);
return ((button->action.string == NULL) ? (0) : (1));
return ((!button->action.string) ? (0) : (1));
break;
case ACTION_SCRIPT:
button->action.script = (char *) MALLOC(strlen(action) + 2);
strcpy(button->action.script, action);
return ((button->action.script == NULL) ? (0) : (1));
return ((!button->action.script) ? (0) : (1));
break;
default:
break;

View File

@ -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

View File

@ -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
* <nation@rocket.sanders.lockheed.com>
* No additional restrictions are applied
*
* Additional modification by Garrett D'Amore <garrett@netcom.com> to
* allow vt100 printing. No additional restrictions are applied.
*
* Integrated modifications by Steven Hirsch <hirsch@emba.uvm.edu> to
* properly support X11 mouse report mode and support for DEC
* "private mode" save/restore functions.
*
* Integrated key-related changes by Jakub Jelinek <jj@gnu.ai.mit.edu>
* to handle Shift+function keys properly.
* Should be used with enclosed termcap / terminfo database.
*
* Extensive modifications by mj olesen <olesen@me.QueensU.CA>
* No additional restrictions.
*
* Further modification and cleanups for Solaris 2.x and Linux 1.2.x
* by Raul Garcia Garcia <rgg@tid.es>. 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 <X11/Xos.h>
#include <X11/Xproto.h>
#include <X11/IntrinsicP.h>
#ifdef HAVE_XRES_EXT
# include <X11/extensions/XRes.h>
#endif
#ifdef PTY_GRP_NAME
# include <grp.h>
#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 */
@ -1158,7 +1266,7 @@ clean_exit(void)
FREE(rs_color[i]);
}
}
conf_free_subsystem();
spifconf_free_subsystem();
# ifdef USE_XIM
if (xim_input_context) {
XUnsetICFocus(xim_input_context);
@ -1166,6 +1274,7 @@ clean_exit(void)
}
if (xim_input_method) {
XCloseIM(xim_input_method);
xim_input_method = NULL;
}
# endif
XCloseDisplay(Xdisplay);
@ -1222,7 +1331,7 @@ sgi_get_pty(void)
privileges(INVOKE);
ptydev = ttydev = _getpty(&fd, O_RDWR | O_NDELAY, 0620, 0);
privileges(REVERT);
return (ptydev == NULL ? -1 : fd);
return (!ptydev ? -1 : fd);
}
#endif
@ -1278,29 +1387,33 @@ sco_get_pty(void)
}
#endif
#ifdef HAVE_DEV_PTMX
inline int svr_get_pty(void);
#if defined(HAVE_POSIX_OPENPT) || defined(HAVE_DEV_PTMX)
inline int posix_get_pty(void);
inline int
svr_get_pty(void)
posix_get_pty(void)
{
int fd = -1;
/* open the STREAMS, clone device /dev/ptmx (master pty) */
#if defined(HAVE_POSIX_OPENPT)
if ((fd = posix_openpt(O_RDWR|O_NOCTTY)) < 0) {
#else
if ((fd = open("/dev/ptmx", O_RDWR)) < 0) {
#endif
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));
if (!ttydev) {
libast_print_error("ptsname(%d) failed: %s\n", fd, strerror(errno));
return (-1);
}
}
@ -1347,12 +1460,12 @@ get_pty(void)
int fd = -1;
#if defined(__sgi)
#if defined(HAVE_POSIX_OPENPT) || defined(HAVE_DEV_PTMX)
fd = posix_get_pty();
#elif defined(__sgi)
fd = sgi_get_pty();
#elif defined(HAVE_DEV_PTC)
fd = aix_get_pty();
#elif defined(HAVE_DEV_PTMX)
fd = svr_get_pty();
#elif defined(HAVE_SCO_PTYS)
fd = sco_get_pty();
#endif
@ -1365,7 +1478,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);
}
}
@ -1397,11 +1510,11 @@ get_tty(void)
#endif /* ultrix */
privileges(INVOKE);
if (ttydev == NULL) {
print_error("Slave tty device name is NULL. Failed to open slave pty.\n");
if (!ttydev) {
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));
@ -1448,8 +1561,8 @@ get_tty(void)
* child processes remain alive upon deletion of the window.
*/
{
unsigned short i;
unsigned long max_fds;
long i;
long max_fds;
/* get number of available file descriptors */
#ifdef _POSIX_VERSION
@ -1745,33 +1858,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;
@ -1795,8 +1909,8 @@ init_locale(void)
locale = setlocale(LC_ALL, "");
XSetLocaleModifiers("");
TermWin.fontset = (XFontSet) 0;
if ((locale == NULL) || (!XSupportsLocale())) {
print_warning("Locale not supported; defaulting to portable \"C\" locale.\n");
if ((!locale) || (!XSupportsLocale())) {
libast_print_warning("Locale not supported; defaulting to portable \"C\" locale.\n");
locale = setlocale(LC_ALL, "C");
XSetLocaleModifiers("");
REQUIRE(locale);
@ -1843,7 +1957,7 @@ xim_send_spot(void)
static XPoint oldSpot = { -1, -1 };
XVaNestedList preedit_attr;
if (xim_input_context == NULL) {
if (!xim_input_context) {
return;
}
@ -1932,8 +2046,8 @@ xim_real_init(void)
*(end + 1) = '\0';
if (*s) {
snprintf(buf, sizeof(buf), "@im=%s", s);
if (((p = XSetLocaleModifiers(buf)) != NULL) && (*p)
&& ((xim_input_method = XOpenIM(Xdisplay, NULL, NULL, NULL)) != NULL)) {
if (((p = XSetLocaleModifiers(buf))) && (*p)
&& ((xim_input_method = XOpenIM(Xdisplay, NULL, NULL, NULL)))) {
break;
}
}
@ -1944,20 +2058,20 @@ xim_real_init(void)
}
/* try with XMODIFIERS env. var. */
if (xim_input_method == NULL && getenv("XMODIFIERS") && (p = XSetLocaleModifiers("")) != NULL && *p) {
if (!xim_input_method && getenv("XMODIFIERS") && (p = XSetLocaleModifiers("")) && *p) {
xim_input_method = XOpenIM(Xdisplay, NULL, NULL, NULL);
}
/* try with no modifiers base */
if (xim_input_method == NULL && (p = XSetLocaleModifiers("@im=none")) != NULL && *p) {
if (!xim_input_method && (p = XSetLocaleModifiers("@im=none")) && *p) {
xim_input_method = XOpenIM(Xdisplay, NULL, NULL, NULL);
}
if (xim_input_method == NULL) {
if (!xim_input_method) {
xim_input_method = XOpenIM(Xdisplay, NULL, NULL, NULL);
}
if (xim_input_method == NULL) {
if (!xim_input_method) {
return -1;
}
#ifdef USE_X11R6_XIM
@ -1967,14 +2081,15 @@ 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);
xim_input_method = NULL;
return -1;
}
strncpy(tmp, (rs_preedit_type ? rs_preedit_type : "OverTheSpot,OffTheSpot,Root"), sizeof(tmp) - 1);
@ -1986,7 +2101,8 @@ xim_real_init(void)
break;
}
for (end = s; (*end && (*end != ',')); end++);
for (next_s = end--; ((end >= s) && isspace(*end)); end--);
next_s = ((*end) ? (end) : (end + 1));
for (end--; ((end >= s) && isspace(*end)); end--);
*(end + 1) = '\0';
if (!strcmp(s, "OverTheSpot")) {
@ -2007,15 +2123,17 @@ 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);
xim_input_method = NULL;
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);
xim_input_method = NULL;
return -1;
}
if (xim_input_style & XIMPreeditPosition) {
@ -2044,9 +2162,10 @@ xim_real_init(void)
if (status_attr) {
XFree(status_attr);
}
if (xim_input_context == NULL) {
print_error("Failed to create input context\n");
if (!xim_input_context) {
libast_print_error("Failed to create input context\n");
XCloseIM(xim_input_method);
xim_input_method = NULL;
return -1;
}
if (xim_input_style & XIMPreeditArea)
@ -2151,7 +2270,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
@ -2179,7 +2298,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) {
@ -2195,6 +2314,7 @@ run_command(char **argv)
signal(SIGILL, SIG_DFL);
signal(SIGSYS, SIG_DFL);
signal(SIGALRM, SIG_DFL);
signal(SIGPIPE, SIG_DFL);
#ifdef SIGTSTP
signal(SIGTSTP, SIG_IGN);
signal(SIGTTIN, SIG_IGN);
@ -2211,7 +2331,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)) {
@ -2256,9 +2380,9 @@ 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 (argv) {
#if DEBUG >= DEBUG_CMD
if (DEBUG_LEVEL >= DEBUG_CMD) {
int i;
@ -2270,12 +2394,12 @@ 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;
if ((shell = getenv("SHELL")) == NULL || *shell == '\0')
if (!(shell = getenv("SHELL")) || *shell == '\0')
shell = "/bin/sh";
argv0 = my_basename(shell);
@ -2287,7 +2411,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);
@ -2575,11 +2699,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;
}
@ -2608,11 +2737,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)
@ -2629,6 +2757,7 @@ direct_write_screen(int x, int y, char *fg, rend_t bg)
}
}
#ifdef ESCREEN_FX
static void
bosconian(int n)
{
@ -2702,7 +2831,7 @@ matrix(int n)
return;
}
MEMSET(s, 0, TERM_WINDOW_GET_COLS());
memset(s, 0, TERM_WINDOW_GET_COLS());
#define MATRIX_HI CLEAR
#define MATRIX_LO ((4<<8)|CLEAR)
@ -2782,8 +2911,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);
@ -2793,12 +2923,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 *
@ -2829,9 +2977,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;
}
@ -2949,14 +3095,14 @@ escreen_init(char **argv)
efuns = escreen_reg_funcs();
/* Create buttonbar for Escreen's use. */
if ((bbar = bbar_create()) == NULL) {
if (buttonbar != NULL) {
if (!(bbar = bbar_create())) {
if (buttonbar) {
bbar = buttonbar;
} else {
return -1;
}
} else {
if (buttonbar == NULL) {
if (!buttonbar) {
buttonbar = bbar;
}
bbar_set_font(bbar, ((rs_es_font) ? (rs_es_font) : ("-*-helvetica-medium-r-normal--10-*-*-*-p-*-iso8859-1")));
@ -2965,7 +3111,7 @@ escreen_init(char **argv)
}
BITFIELD_SET(eterm_options, ETERM_OPTIONS_PAUSE);
if ((TermWin.screen = ns_attach_by_URL(rs_url, rs_hop, &efuns, &ns_err, bbar)) == NULL) {
if (!(TermWin.screen = ns_attach_by_URL(rs_url, rs_hop, &efuns, &ns_err, bbar))) {
D_CMD(("ns_attach_by_URL(%s,%s) failed\n", rs_url, rs_hop));
return -1;
}
@ -3030,7 +3176,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...";
}
@ -3049,7 +3195,7 @@ tt_winsize(int fd)
if (fd < 0)
return;
MEMSET(&ws, 0, sizeof(struct winsize));
memset(&ws, 0, sizeof(struct winsize));
ws.ws_row = (unsigned short) TERM_WINDOW_GET_REPORTED_ROWS();
ws.ws_col = (unsigned short) TERM_WINDOW_GET_REPORTED_COLS();
@ -3144,7 +3290,7 @@ check_pixmap_change(int sig)
last_update = now;
old_handler = signal(SIGALRM, check_pixmap_change);
alarm(rs_anim_delay);
if (rs_anim_pixmaps[image_idx] == NULL) {
if (!rs_anim_pixmaps[image_idx]) {
image_idx = 0;
}
}
@ -3250,7 +3396,7 @@ cmd_getc(void)
XNextEvent(Xdisplay, &ev);
#ifdef USE_XIM
if (xim_input_context != NULL) {
if (xim_input_context) {
if (!XFilterEvent(&ev, ev.xkey.window)) {
event_dispatch(&ev);
}
@ -3317,12 +3463,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) {
@ -3539,8 +3685,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));
@ -3553,45 +3699,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));
MEMSET(outbuff + outlen, 0, sizeof(wchar_t));
wcbuff = SPIF_CAST_C(wchar_t *) outbuff;
MEMSET(&mbs, 0, sizeof(mbstate_t));
libast_print_warning("Moo2: %s\n", safe_print_string(outbuff, outlen));
memset(outbuff + outlen, 0, sizeof(wchar_t));
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) {
@ -3599,7 +3745,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);
@ -3663,7 +3809,7 @@ v_writeBig(int f, char *d, int len)
int written;
int c = len;
if (v_bufstr == NULL && len > 0) {
if (!v_bufstr && len > 0) {
v_buffer = MALLOC(len);
v_bufstr = v_buffer;
@ -3702,7 +3848,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;
}

View File

@ -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
* <nation@rocket.sanders.lockheed.com>
* No additional restrictions are applied.
*
* Additional modifications by mj olesen <olesen@me.QueensU.CA>
* 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 <signal.h>
@ -266,7 +269,7 @@ if (test) PrivateModes |= (bit); else PrivateModes &= ~(bit);} while (0)
#define CHARS_READ() (cmdbuf_ptr < cmdbuf_endp)
#define CHARS_BUFFERED() (count != CMD_BUF_SIZE)
#define RETURN_CHAR() do { \
char c = *cmdbuf_ptr++; \
unsigned char c = *cmdbuf_ptr++; \
refreshed = 0; \
if (c < 32) D_VT(("RETURN_CHAR(): \'%s\' (%d 0x%02x %03o)\n", get_ctrl_char_name(c), c, c, c)); \
else D_VT(("RETURN_CHAR(): \'%c\' (%d 0x%02x %03o)\n", c, c, c, c)); \
@ -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

View File

@ -178,10 +178,10 @@ eterm_default_font_locale(char ***fonts, char ***mfonts, char **mencoding, int *
int j, k;
locale = setlocale(LC_CTYPE, "");
if (locale == NULL)
if ((locale = getenv("LC_ALL")) == NULL)
if ((locale = getenv("LC_CTYPE")) == NULL)
if ((locale = getenv("LANG")) == NULL)
if (!locale)
if (!(locale = getenv("LC_ALL")))
if (!(locale = getenv("LC_CTYPE")))
if (!(locale = getenv("LANG")))
locale = "C"; /* failsafe */
/* Obtain a "normalized" name of current encoding.

View File

@ -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
@ -168,7 +168,7 @@ bevel_pixmap(Pixmap p, int w, int h, Imlib_Border * bord, unsigned char up)
real_depth = Xdepth;
}
ximg = XGetImage(Xdisplay, p, 0, 0, w, h, -1, ZPixmap);
if (ximg == NULL) {
if (!ximg) {
return;
}
/* Determine bitshift and bitmask values */

View File

@ -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

12
src/e.c
View File

@ -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;
}
@ -156,12 +156,12 @@ enl_ipc_send(char *str)
unsigned short len;
XEvent ev;
if (str == NULL) {
if (!str) {
ASSERT(last_msg != NULL);
str = last_msg;
D_ENL(("Resending last message \"%s\" to Enlightenment.\n", str));
} else {
if (last_msg != NULL) {
if (last_msg) {
FREE(last_msg);
}
last_msg = STRDUP(str);
@ -246,7 +246,7 @@ enl_ipc_get(const char *msg_data)
}
buff[12] = 0;
blen = strlen(buff);
if (message != NULL) {
if (message) {
len += blen;
message = (char *) REALLOC(message, len + 1);
strcat(message, buff);

View File

@ -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

View File

@ -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
@ -184,7 +184,7 @@ static enc_context_t *enc_create_context(const char *id)
enc_context_t *tmp;
tmp = (enc_context_t *) MALLOC(sizeof(enc_context_t));
MEMSET(tmp, 0, sizeof(enc_context_t));
memset(tmp, 0, sizeof(enc_context_t));
tmp->id = STRDUP(id);
return tmp;
}
@ -204,7 +204,7 @@ static enc_state_t *enc_create_state(const char *id, unsigned char lifetime)
enc_state_t *tmp;
tmp = (enc_state_t *) MALLOC(sizeof(enc_state_t));
MEMSET(tmp, 0, sizeof(enc_state_t));
memset(tmp, 0, sizeof(enc_state_t));
tmp->id = STRDUP(id);
tmp->lifetime = lifetime;
return tmp;

View File

@ -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

View File

@ -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

View File

@ -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 <lastlog.h>
# endif
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__) || defined(__DragonFly__)
# include <ttyent.h>
# define NEW_BSD_UTMP
# endif
# ifdef HAVE_LIBUTEMPTER

View File

@ -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
@ -133,7 +133,7 @@ void
event_init_primary_dispatcher(void)
{
MEMSET(&primary_data, 0, sizeof(event_dispatcher_data_t));
memset(&primary_data, 0, sizeof(event_dispatcher_data_t));
EVENT_DATA_ADD_HANDLER(primary_data, KeyPress, handle_key_press);
EVENT_DATA_ADD_HANDLER(primary_data, PropertyNotify, handle_property_notify);
@ -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
@ -214,6 +215,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;
@ -346,7 +353,7 @@ handle_client_message(event_t *ev)
XGetWindowProperty(Xdisplay, Xroot, props[PROP_DND_SELECTION], 0L, 1000000L, False, AnyPropertyType, &ActualType,
&ActualFormat, &Size, &RemainingBytes, &data);
if (data != NULL) {
if (data) {
XChangeProperty(Xdisplay, Xroot, XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, data, strlen(data));
selection_paste(XA_CUT_BUFFER0);
XSetInputFocus(Xdisplay, Xroot, RevertToNone, CurrentTime);
@ -453,6 +460,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));
@ -485,9 +493,15 @@ handle_focus_in(event_t *ev)
}
bbar_draw_all(IMAGE_STATE_NORMAL, MODE_SOLID);
#ifdef USE_XIM
if (xim_input_context != NULL)
if (xim_input_context)
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;
}
@ -513,7 +527,7 @@ handle_focus_out(event_t *ev)
}
bbar_draw_all(IMAGE_STATE_DISABLED, MODE_SOLID);
#ifdef USE_XIM
if (xim_input_context != NULL)
if (xim_input_context)
XUnsetICFocus(xim_input_context);
#endif
}
@ -860,7 +874,7 @@ process_x_event(event_t *ev)
#if 0
D_EVENTS(("process_x_event(ev [%8p] %s on window 0x%08x)\n", ev, event_type_to_name(ev->xany.type), ev->xany.window));
#endif
if (primary_data.handlers[ev->type] != NULL) {
if (primary_data.handlers[ev->type]) {
return ((primary_data.handlers[ev->type]) (ev));
}
return (0);
@ -874,7 +888,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
@ -882,6 +896,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;
}

View File

@ -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

View File

@ -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 <stdio.h>
# include <stdlib.h>
# define LIBAST_COMPAT_05_API 1
# include <libast.h>
# 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

View File

@ -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,7 +52,7 @@ const char *def_mfontName[] = { MFONT0, MFONT1, MFONT2, MFONT3, MFONT4 };
#endif
const char *def_fontName[] = { FONT0, FONT1, FONT2, FONT3, FONT4 };
unsigned char font_chg = 0;
fontshadow_t fshadow = { {0, 0, 0, 0}, {0, 0, 0, 1}, 1 };
fontshadow_t fshadow = { {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 1}, 1 };
static cachefont_t *font_cache = NULL, *cur_font = NULL;
static void font_cache_add(const char *name, unsigned char type, void *info);
@ -79,23 +79,23 @@ eterm_font_add(char ***plist, const char *fontname, unsigned char idx)
/* The below looks messy with all the cpp stuff, but it really just malloc's/realloc's
both etfonts and etmfonts at the same time to the same size, zeros all the new
memory space using MEMSET(), and then prints some goop. */
memory space using memset(), and then prints some goop. */
if (etfonts) {
etfonts = (char **) REALLOC(etfonts, new_size);
MEMSET(etfonts + font_cnt, 0, sizeof(char *) * (idx - font_cnt + 1));
memset(etfonts + font_cnt, 0, sizeof(char *) * (idx - font_cnt + 1));
#ifdef MULTI_CHARSET
etmfonts = (char **) REALLOC(etmfonts, new_size);
MEMSET(etmfonts + font_cnt, 0, sizeof(char *) * (idx - font_cnt + 1));
memset(etmfonts + font_cnt, 0, sizeof(char *) * (idx - font_cnt + 1));
D_FONT((" -> Reallocated font lists: %u bytes at %8p/%8p\n", new_size, etfonts, etmfonts));
#else
D_FONT((" -> Reallocated font list: %u bytes at %8p\n", new_size, etfonts));
#endif
} else {
etfonts = (char **) MALLOC(new_size);
MEMSET(etfonts, 0, new_size);
memset(etfonts, 0, new_size);
#ifdef MULTI_CHARSET
etmfonts = (char **) MALLOC(new_size);
MEMSET(etmfonts, 0, new_size);
memset(etmfonts, 0, new_size);
D_FONT((" -> Allocated font lists: %u bytes at %8p/%8p\n", new_size, etfonts, etmfonts));
#else
D_FONT((" -> Allocating font list: %u bytes at %8p\n", new_size, etfonts));
@ -179,7 +179,7 @@ font_cache_add(const char *name, unsigned char type, void *info)
D_FONT((" -> Created new cachefont_t struct at %p: \"%s\", %d, %p\n", font, font->name, font->type, font->fontinfo.xfontinfo));
/* Actually add the struct to the end of our cache linked list. */
if (font_cache == NULL) {
if (!font_cache) {
font_cache = cur_font = font;
font->next = NULL;
D_FONT((" -> Stored as first font in cache. font_cache == cur_font == font == %p\n", font_cache));
@ -202,7 +202,7 @@ font_cache_del(const void *info)
D_FONT(("font_cache_del(%8p) called.\n", info));
if (font_cache == NULL) {
if (!font_cache) {
return; /* No fonts in the cache. Theoretically this should never happen, but... */
}
@ -376,7 +376,7 @@ load_font(const char *name, const char *fallback, unsigned char type)
}
/* Specify some sane fallbacks */
if (name == NULL) {
if (!name) {
if (fallback) {
name = fallback;
fallback = "fixed";
@ -388,14 +388,14 @@ load_font(const char *name, const char *fallback, unsigned char type)
fallback = "-misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1";
#endif
}
} else if (fallback == NULL) {
} else if (!fallback) {
fallback = "fixed";
}
D_FONT((" -> Using name == \"%s\" and fallback == \"%s\"\n", name, fallback));
/* Look for the font name in the cache. If it's there, add one to the
reference count and return the existing fontinfo pointer to the caller. */
if ((font = font_cache_find(name, type)) != NULL) {
if ((font = font_cache_find(name, type))) {
font_cache_add_ref(font);
D_FONT((" -> Font found in cache. Incrementing reference count to %d and returning existing data.\n", font->ref_cnt));
switch (type) {
@ -416,10 +416,10 @@ 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);
if ((xfont = XLoadQueryFont(Xdisplay, fallback)) == NULL) {
fatal_error("Couldn't load the fallback font either. Giving up.\n");
if (!(xfont = XLoadQueryFont(Xdisplay, name))) {
libast_print_error("Unable to load font \"%s\". Falling back on \"%s\"\n", name, fallback);
if (!(xfont = XLoadQueryFont(Xdisplay, fallback))) {
libast_fatal_error("Couldn't load the fallback font either. Giving up.\n");
} else {
font_cache_add(fallback, type, (void *) xfont);
}
@ -461,7 +461,7 @@ change_font(int init, const char *fontname)
if (init) {
ASSERT(etfonts != NULL);
if ((def_font_idx >= font_cnt) || (etfonts[def_font_idx] == NULL)) {
if ((def_font_idx >= font_cnt) || (!etfonts[def_font_idx])) {
def_font_idx = font_idx;
} else {
font_idx = def_font_idx;
@ -518,7 +518,7 @@ change_font(int init, const char *fontname)
}
/* If we get here with a non-NULL fontname, we have to load a new font. Rats. */
if (fontname != NULL) {
if (fontname) {
eterm_font_add(&etfonts, fontname, font_idx);
} else if (font_idx == old_idx) {
/* Sigh. What a waste of time, changing to the same font. */
@ -539,7 +539,7 @@ change_font(int init, const char *fontname)
}
#ifndef NO_BOLDFONT
if (init && rs_boldFont != NULL) {
if (init && rs_boldFont) {
/* If we're initializing, load the bold font too. */
boldFont = load_font(rs_boldFont, "-misc-fixed-bold-r-semicondensed--13-120-75-75-c-60-iso8859-1", FONT_TYPE_X);
}
@ -636,7 +636,7 @@ change_font(int init, const char *fontname)
/* Check the bold font size and make sure it matches the normal font */
#ifndef NO_BOLDFONT
TermWin.boldFont = NULL; /* FIXME: Memory leak? Not that anyone uses bold fonts.... */
if (boldFont != NULL) {
if (boldFont) {
fw = boldFont->min_bounds.width;
fh = boldFont->ascent + boldFont->descent + rs_line_space;
@ -689,10 +689,18 @@ get_corner(const char *corner)
{
if (!BEG_STRCASECMP(corner, "tl ") || !BEG_STRCASECMP(corner, "top_left")) {
return SHADOW_TOP_LEFT;
} else if (!BEG_STRCASECMP(corner, "t ") || !BEG_STRCASECMP(corner, "top")) {
return SHADOW_TOP;
} else if (!BEG_STRCASECMP(corner, "tr ") || !BEG_STRCASECMP(corner, "top_right")) {
return SHADOW_TOP_RIGHT;
} else if (!BEG_STRCASECMP(corner, "l ") || !BEG_STRCASECMP(corner, "left")) {
return SHADOW_LEFT;
} else if (!BEG_STRCASECMP(corner, "r ") || !BEG_STRCASECMP(corner, "right")) {
return SHADOW_RIGHT;
} else if (!BEG_STRCASECMP(corner, "bl ") || !BEG_STRCASECMP(corner, "bottom_left")) {
return SHADOW_BOTTOM_LEFT;
} else if (!BEG_STRCASECMP(corner, "b ") || !BEG_STRCASECMP(corner, "bottom")) {
return SHADOW_BOTTOM;
} else if (!BEG_STRCASECMP(corner, "br ") || !BEG_STRCASECMP(corner, "bottom_right")) {
return SHADOW_BOTTOM_RIGHT;
} else {
@ -705,7 +713,7 @@ set_shadow_color_by_name(unsigned char which, const char *color_name)
{
Pixel p;
ASSERT(which <= 4);
ASSERT(which <= 7); // which = 0-7 [SHADOW_TOP_LEFT - SHADOW_BOTTOM_RIGHT]
p = get_color_by_name(color_name, "#000000");
fshadow.color[which] = p;
@ -715,7 +723,7 @@ set_shadow_color_by_name(unsigned char which, const char *color_name)
void
set_shadow_color_by_pixel(unsigned char which, Pixel p)
{
ASSERT(which <= 4);
ASSERT(which <= 7); // which = 0-7 [SHADOW_TOP_LEFT - SHADOW_BOTTOM_RIGHT]
fshadow.color[which] = p;
fshadow.shadow[which] = fshadow.do_shadow = 1;
@ -740,30 +748,32 @@ 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));
memset(&fshadow, 0, sizeof(fontshadow_t));
} else if (!BEG_STRCASECMP(line, "outline")) {
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++) {
for (which = 0; which < 8; which++) {
set_shadow_color_by_pixel(which, p);
}
} 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) {
if (which >= 8) {
return 0;
} else if (which != SHADOW_BOTTOM_RIGHT) {
fshadow.shadow[SHADOW_BOTTOM_RIGHT] = 0;
}
} else {
return 0;
@ -774,26 +784,30 @@ 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, p);
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);
set_shadow_color_by_pixel(SHADOW_TOP, p);
FREE(color);
} else if (!BEG_STRCASECMP(line, "carved")) {
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);
set_shadow_color_by_pixel(SHADOW_TOP, 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, p);
set_shadow_color_by_pixel(SHADOW_BOTTOM_RIGHT, p);
FREE(color);
} else {
@ -803,15 +817,15 @@ 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);
if (line == NULL) {
if (!line) {
break;
}
}

View File

@ -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,9 +42,13 @@
/* These are subscripts for the arrays in a fontshadow_t */
#define SHADOW_TOP_LEFT 0
#define SHADOW_TOP_RIGHT 1
#define SHADOW_BOTTOM_LEFT 2
#define SHADOW_BOTTOM_RIGHT 3
#define SHADOW_TOP 1
#define SHADOW_TOP_RIGHT 2
#define SHADOW_LEFT 3
#define SHADOW_RIGHT 4
#define SHADOW_BOTTOM_LEFT 5
#define SHADOW_BOTTOM 6
#define SHADOW_BOTTOM_RIGHT 7
/* The macros are used to advance to the next/previous font as with Ctrl-> and Ctrl-< */
#define NEXT_FONT(i) do { if (font_idx + ((i)?(i):1) >= font_cnt) {font_idx = font_cnt - 1;} else {font_idx += ((i)?(i):1);} \
@ -67,8 +71,8 @@ typedef struct cachefont_struct {
} cachefont_t;
typedef struct fontshadow_struct {
Pixel color[4];
unsigned char shadow[4];
Pixel color[8];
unsigned char shadow[8];
unsigned char do_shadow;
} fontshadow_t;

View File

@ -250,7 +250,7 @@ kstate_add_xlat(char *str)
char *sval;
int i;
if (str == NULL)
if (!str)
return;
/* add a new xlat table in state */
if (pStateNow->num_xlat == 0) {
@ -263,11 +263,11 @@ kstate_add_xlat(char *str)
xlat->last = (u_int) atoi(strtok(NULL, ":"));
i = 0;
pval_tmp = CALLOC(MAX_VAL, sizeof(K_XLAT));
while ((sval = strtok(NULL, ",")) != NULL) {
while ((sval = strtok(NULL, ","))) {
pval_tmp[i++] = (u_int) (atoi(sval));
}
xlat->pval = CALLOC(i, sizeof(K_XLAT));
if (xlat->pval != NULL)
if (xlat->pval)
memcpy(xlat->pval, pval_tmp, i * sizeof(u_int));
FREE(pval_tmp);
pStateNow->num_xlat++;
@ -281,7 +281,7 @@ kstate_add_switcher(char *str)
{
K_SWITCH *switcher;
if (str == NULL)
if (!str)
return;
if (pStateNow->num_switcher >= MAX_SWITCHER)
return;

View File

@ -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 <limits.h> /* PATH_MAX */
#include <ctype.h> /* isspace() */
#include <errno.h> /* errno */
#include <sys/socket.h>
#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);
@ -1424,6 +1489,7 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
#warning compiling in libscream
#ifdef NS_HAVE_SCREEN
if (!strcmp(sess->proto, "screen")) {
D_ESCREEN(("Using session protocol \"%s\"\n", sess->proto));
sess->backend = NS_MODE_SCREEN;
} else
#warning compiling in support for GNU screen
@ -1433,6 +1499,7 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
if (!strcmp(sess->proto, "twin")) {
char *twd = getenv("TWDISPLAY");
D_ESCREEN(("Using session protocol \"%s\"\n", sess->proto));
sess->backend = NS_MODE_TWIN;
/* fall back on TWDISPLAY env var only if host not set yet */
@ -1459,6 +1526,7 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
} else
#endif
if (!strcmp(sess->proto, "scream")) {
D_ESCREEN(("Using session protocol \"%s\"\n", sess->proto));
sess->backend = NS_MODE_SCREAM;
} else {
*err = NS_UNKNOWN_PROTO;
@ -1466,6 +1534,8 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
fprintf(stderr, "protocol \"%s\" not known...\n", sess->proto);
goto fail;
}
} else {
D_ESCREEN(("No session protocol specified.\n"));
}
if ((sess->disp < 0) || (sess->disp > NS_MAX_PORT))
@ -1868,7 +1938,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) {
@ -2141,16 +2211,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 +2628,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;
}
@ -3060,9 +3135,10 @@ ns_parse_screen_msg(_ns_sess * screen, char *p)
} else if (!strcmp(p, "New screen...") ||
!strncmp(p, "msgwait", strlen("msgwait")) ||
!strncmp(p, "msgminwait", strlen("msgminwait")) ||
!strcmp(p, "Press ^@ to destroy or ^@ to resurrect window") || !strcmp(p, "Aborted because of window size change."))
!strcmp(p, "Press ^@ to destroy or ^@ to resurrect window")
|| !strcmp(p, "Aborted because of window size change.")) {
p = NULL;
else if ((screen->flags & NS_SESS_NO_MON_MSG) &&
} else if ((screen->flags & NS_SESS_NO_MON_MSG) &&
((sscanf(p, "Window %d (%s) is now being monitored for all activity.", &n, win) == 2) ||
(sscanf(p, "Window %d (%s) is no longer being monitored for activity.", &n, win) == 2))) {
D_ESCREEN(("activity toggled quietly for window %d-%s\n", n, win));
@ -3093,16 +3169,17 @@ ns_parse_screen_msg(_ns_sess * screen, char *p)
p = NULL;
D_ESCREEN(("ns_parse_screen_msg: scre%s %d.%2d.%2d %s a/o %s -> mode %d\n", vtype, ma, mi, mu, vrem, vdate,
screen->backend));
} else if (!strcmp(p, NS_SCREEN_NO_DEBUG))
} else if (!strcmp(p, NS_SCREEN_NO_DEBUG)) {
p = "debug info was not compiled into \"screen\"...";
else if (!strncmp(p, NS_SCREEN_DK_CMD_T, strlen(NS_SCREEN_DK_CMD_T))) {
} else if (!strncmp(p, NS_SCREEN_DK_CMD_T, strlen(NS_SCREEN_DK_CMD_T))) {
p[strlen(p) - 1] = '\0';
p2 = &p[strlen(NS_SCREEN_DK_CMD_T)];
p = "unknown screen statement ignored";
}
if (p) { /* status. send to status-line or dialog or whatever */
if (NS_EFUN_EXISTS(efuns, screen, NULL, err_msg))
if (NS_EFUN_EXISTS(efuns, screen, NULL, err_msg)) {
ret = efuns->err_msg(NULL, type, p);
}
}
return ret;
}
@ -3150,6 +3227,8 @@ ns_parse_screen(_ns_sess * screen, int force, int width, char *p)
if (!force && screen->timestamp)
return NS_SUCC;
D_ESCREEN(("ns_parse_screen(0x%08x, %d, %d, \"%s\")\n", screen, force, width,
safe_print_string(p, width)));
if ((p = STRDUP(p))) {
_ns_parse pd[NS_MAX_DISPS];
@ -3163,7 +3242,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 +3270,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)) {

View File

@ -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

View File

@ -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
@ -301,7 +301,7 @@ menu_handle_button_release(event_t *ev)
if (button_press_time && (ev->xbutton.time - button_press_time > MENU_CLICK_TIME)) {
/* Take action here based on the current menu item */
if ((item = menuitem_get_current(current_menu)) != NULL) {
if ((item = menuitem_get_current(current_menu))) {
if (item->type == MENUITEM_SUBMENU) {
menu_display_submenu(current_menu, item);
} else {
@ -326,7 +326,7 @@ menu_handle_button_release(event_t *ev)
if (current_menu && (ev->xbutton.x >= 0) && (ev->xbutton.y >= 0) && (ev->xbutton.x < current_menu->w)
&& (ev->xbutton.y < current_menu->h)) {
/* Click inside the menu window. Activate the current item. */
if ((item = menuitem_get_current(current_menu)) != NULL) {
if ((item = menuitem_get_current(current_menu))) {
if (item->type == MENUITEM_SUBMENU) {
menu_display_submenu(current_menu, item);
} else {
@ -415,7 +415,7 @@ menu_handle_motion_notify(event_t *ev)
unsigned char
menu_dispatch_event(event_t *ev)
{
if (menu_event_data.handlers[ev->type] != NULL) {
if (menu_event_data.handlers[ev->type]) {
return ((menu_event_data.handlers[ev->type]) (ev));
}
return (0);
@ -471,7 +471,7 @@ menu_t *menu_create(char *title)
| Button1MotionMask | Button2MotionMask | Button3MotionMask;
}
menu = (menu_t *) MALLOC(sizeof(menu_t));
MEMSET(menu, 0, sizeof(menu_t));
memset(menu, 0, sizeof(menu_t));
menu->title = STRDUP(title ? title : "");
menu->win =
@ -599,7 +599,7 @@ menu_is_child(menu_t *menu, menu_t *submenu)
for (i = 0; i < menu->numitems; i++) {
item = menu->items[i];
if (item->type == MENUITEM_SUBMENU && item->action.submenu != NULL) {
if (item->type == MENUITEM_SUBMENU && item->action.submenu) {
if (item->action.submenu == submenu) {
return 1;
} else if (menu_is_child(item->action.submenu, submenu)) {
@ -686,8 +686,8 @@ menuitem_change_current(menuitem_t *item)
menuitem_deselect(current_menu);
/* If we're changing from one submenu to another and neither is a child of the other, or if we're changing from a submenu to
no current item at all, reset the tree for the current submenu */
if (current->type == MENUITEM_SUBMENU && current->action.submenu != NULL) {
if ((item && item->type == MENUITEM_SUBMENU && item->action.submenu != NULL
if (current->type == MENUITEM_SUBMENU && current->action.submenu) {
if ((item && item->type == MENUITEM_SUBMENU && item->action.submenu
&& !menu_is_child(current->action.submenu, item->action.submenu)
&& !menu_is_child(item->action.submenu, current->action.submenu))
|| (!item)) {
@ -715,7 +715,7 @@ menuitem_t *menuitem_create(char *text)
menuitem_t *menuitem;
menuitem = (menuitem_t *) MALLOC(sizeof(menuitem_t));
MEMSET(menuitem, 0, sizeof(menuitem_t));
memset(menuitem, 0, sizeof(menuitem_t));
if (text) {
menuitem->text = STRDUP(text);
@ -839,7 +839,7 @@ menu_reset_all(menulist_t *list)
return;
D_MENU(("menu_reset_all(%8p) called\n", list));
if (current_menu && menuitem_get_current(current_menu) != NULL) {
if (current_menu && menuitem_get_current(current_menu)) {
menuitem_deselect(current_menu);
}
for (i = 0; i < list->nummenus; i++) {
@ -862,7 +862,7 @@ menu_reset_tree(menu_t *menu)
}
for (i = 0; i < menu->numitems; i++) {
item = menu->items[i];
if (item->type == MENUITEM_SUBMENU && item->action.submenu != NULL) {
if (item->type == MENUITEM_SUBMENU && item->action.submenu) {
menu_reset_tree(item->action.submenu);
}
}
@ -880,7 +880,7 @@ menu_reset_submenus(menu_t *menu)
D_MENU(("menu_reset_submenus(menu %8p \"%s\"), window 0x%08x\n", menu, menu->title, menu->win));
for (i = 0; i < menu->numitems; i++) {
item = menu->items[i];
if (item->type == MENUITEM_SUBMENU && item->action.submenu != NULL) {
if (item->type == MENUITEM_SUBMENU && item->action.submenu) {
menu_reset_tree(item->action.submenu);
}
}
@ -1239,7 +1239,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;
}
}
@ -1247,7 +1247,7 @@ menu_action(menuitem_t *item)
void
menu_invoke(int x, int y, Window win, menu_t *menu, Time timestamp)
{
int root_x, root_y;
int root_x = x, root_y = y;
Window unused;
REQUIRE(menu != NULL);
@ -1344,11 +1344,11 @@ menu_dialog(void *xd, char *prompt, int maxlen, char **retstr, int (*inp_tab) (v
inp_tab = NULL;
maxlen = 0;
retstr = NULL;
if ((b = STRDUP("Press \"Return\" to continue...")) == NULL) {
if (!(b = STRDUP("Press \"Return\" to continue..."))) {
return ret;
}
} else {
if (((b = MALLOC(maxlen + 1)) == NULL)) {
if ((!(b = MALLOC(maxlen + 1)))) {
return ret;
} else if (*retstr) {
strncpy(b, *retstr, maxlen);

View File

@ -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

View File

@ -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++) {
@ -285,7 +285,7 @@ safe_print_string(const char *str, unsigned long len)
rb_size = 0;
return ((char *) NULL);
}
if (ret_buff == NULL) {
if (!ret_buff) {
rb_size = len;
ret_buff = (char *) MALLOC(rb_size + 1);
} else if (len > rb_size) {
@ -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));

View File

@ -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

View File

@ -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
@ -485,4 +485,8 @@ shade_ximage_32_mmx:
3:
LEAVE
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif
#endif /* HAVE_MMX */

View File

@ -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 <cblake@BBN.COM>
*
+ * Cleaned up somewhat by mj olesen <olesen@me.queensu.ca>
+ *
* 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#ifdef HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
#endif
#ifdef HAVE_SYS_BYTEORDER_H
# include <sys/byteorder.h>
#endif
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#include <netinet/in.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <net/if_arp.h>
#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) -----------------------*/

File diff suppressed because it is too large Load Diff

View File

@ -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)
@ -81,7 +83,7 @@
} while (0)
#define CHECK_VALID_INDEX(i) (((i) >= image_bg) && ((i) < image_max))
#define RESET_AND_ASSIGN(var, val) do {if ((var) != NULL) FREE(var); (var) = (val);} while (0)
#define RESET_AND_ASSIGN(var, val) do {if ((var)) FREE(var); (var) = (val);} while (0)
#define BITFIELD_SET(var, field) ((var) |= (field))
#define BITFIELD_CLEAR(var, field) ((var) &= ~(field))
@ -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);

View File

@ -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
@ -263,7 +263,7 @@ set_pixmap_scale(const char *geom, pixmap_t *pmap)
char *p, *opstr;
int n;
if (geom == NULL)
if (!geom)
return 0;
D_PIXMAP(("scale_pixmap(\"%s\")\n", geom));
@ -272,13 +272,13 @@ set_pixmap_scale(const char *geom, pixmap_t *pmap)
xterm_seq(ESCSEQ_XTERM_TITLE, str);
return 0;
}
if ((opstr = strchr(geom, ':')) != NULL) {
if ((opstr = strchr(geom, ':'))) {
*opstr++ = '\0';
op = parse_pixmap_ops(opstr);
} else {
op = pmap->op;
}
if ((p = strchr(geom, ';')) == NULL)
if (!(p = strchr(geom, ';')))
p = strchr(geom, '\0');
n = (p - geom);
if (n > GEOM_LEN - 1)
@ -357,7 +357,7 @@ image_t *create_eterm_image(void)
image_t *i;
i = (image_t *) MALLOC(sizeof(image_t));
MEMSET(i, 0, sizeof(image_t));
memset(i, 0, sizeof(image_t));
return (i);
}
@ -431,11 +431,11 @@ simage_t *create_simage(void)
simage_t *s;
s = (simage_t *) MALLOC(sizeof(simage_t));
MEMSET(s, 0, sizeof(simage_t));
memset(s, 0, sizeof(simage_t));
s->pmap = (pixmap_t *) MALLOC(sizeof(pixmap_t));
s->iml = (imlib_t *) MALLOC(sizeof(imlib_t));
MEMSET(s->pmap, 0, sizeof(pixmap_t));
MEMSET(s->iml, 0, sizeof(imlib_t));
memset(s->pmap, 0, sizeof(pixmap_t));
memset(s->iml, 0, sizeof(imlib_t));
return s;
}
@ -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,23 +686,17 @@ 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)) {
colormod_trans(p, simg->iml, gc, width, height);
}
if (simg->iml->bevel != NULL) {
if (simg->iml->bevel) {
D_PIXMAP(("Beveling pixmap 0x%08x with edges %d, %d, %d, %d\n", p, simg->iml->bevel->edges->left,
simg->iml->bevel->edges->top, simg->iml->bevel->edges->right, simg->iml->bevel->edges->bottom));
bevel_pixmap(p, width, height, simg->iml->bevel->edges, simg->iml->bevel->up);
@ -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);
@ -878,7 +872,7 @@ paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsign
gc = LIBAST_X_CREATE_GC(0, NULL);
p = create_viewport_pixmap(simg, win, x, y, w, h);
if (simg->iml->bevel != NULL) {
if (simg->iml->bevel) {
bevel_pixmap(p, w, h, simg->iml->bevel->edges, simg->iml->bevel->up);
}
XCopyArea(Xdisplay, p, d, gc, 0, 0, w, h, x, y);
@ -888,7 +882,7 @@ paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsign
}
if (((which == image_max) || (image_mode_is(which, MODE_IMAGE) && image_mode_is(which, ALLOW_IMAGE)))
&& (simg->iml != NULL)) {
&& (simg->iml)) {
imlib_context_set_image(simg->iml->im);
imlib_context_set_drawable(d);
imlib_context_set_anti_alias(1);
@ -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,12 +1245,13 @@ 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 {
shaped_window_apply_mask(win, simg->pmap->mask);
}
if (simg->iml->bevel != NULL) {
if (simg->iml->bevel) {
bevel_pixmap(simg->pmap->pixmap, width, height, simg->iml->bevel->edges, simg->iml->bevel->up);
}
D_PIXMAP(("Setting background of window 0x%08x to 0x%08x\n", win, simg->pmap->pixmap));
@ -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);
}
@ -1290,14 +1285,14 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
copy_buffer_pixmap(MODE_SOLID, (unsigned long) PixColors[bgColor], width, height);
XSetWindowBackgroundPixmap(Xdisplay, win, buffer_pixmap);
} else {
if ((renderop & RENDER_FORCE_PIXMAP) || (simg->iml->bevel != NULL)) {
if ((renderop & RENDER_FORCE_PIXMAP) || (simg->iml->bevel)) {
if (simg->pmap->pixmap != None) {
LIBAST_X_FREE_PIXMAP(simg->pmap->pixmap);
}
simg->pmap->pixmap = LIBAST_X_CREATE_PIXMAP(width, height);
XSetForeground(Xdisplay, gc, ((which == image_bg) ? (PixColors[bgColor]) : (simg->bg)));
XFillRectangle(Xdisplay, simg->pmap->pixmap, gc, 0, 0, width, height);
if (simg->iml->bevel != NULL && simg->iml->bevel->edges != NULL) {
if (simg->iml->bevel && simg->iml->bevel->edges) {
DRAW_SOLID_BEVEL(simg->pmap->pixmap, width, height, simg->bg, simg->iml->bevel->up,
simg->iml->bevel->edges->left);
}
@ -1332,7 +1327,7 @@ search_path(const char *pathlist, const char *file)
D_OPTIONS(("search_path(\"%s\", \"%s\") called from \"%s\".\n", pathlist, file, name));
if (len < PATH_MAX - 1) {
strcat(name, "/");
strncat(name, file, PATH_MAX - len - 1);
strncat(name, file, PATH_MAX - len - 2);
}
D_OPTIONS(("Checking for file \"%s\"\n", name));
if (!access(name, R_OK)) {
@ -1350,7 +1345,7 @@ search_path(const char *pathlist, const char *file)
D_OPTIONS(("Unable to access %s -- %s\n", name, strerror(errno)));
}
if ((p = strchr(file, '@')) == NULL)
if (!(p = strchr(file, '@')))
p = strchr(file, '\0');
len = (p - file);
/* leave room for an extra '/' and trailing '\0' */
@ -1375,11 +1370,11 @@ search_path(const char *pathlist, const char *file)
} else {
D_OPTIONS(("Unable to access %s -- %s\n", name, strerror(errno)));
}
for (path = pathlist; path != NULL && *path != '\0'; path = p) {
for (path = pathlist; path && *path != '\0'; path = p) {
int n;
/* colon delimited */
if ((p = strchr(path, ':')) == NULL)
if (!(p = strchr(path, ':')))
p = strchr(path, '\0');
n = (p - path);
if (*p != '\0')
@ -1438,21 +1433,21 @@ load_image(const char *file, simage_t *simg)
ASSERT_RVAL(simg != NULL, 0);
D_PIXMAP(("load_image(%s, %8p)\n", file, simg));
if (*file != '\0') {
if ((geom = strchr(file, '@')) != NULL) {
if ((geom = strchr(file, '@'))) {
*geom++ = 0;
} else if ((geom = strchr(file, ';')) != NULL) {
} else if ((geom = strchr(file, ';'))) {
*geom++ = 0;
}
if (geom != NULL) {
if (geom) {
set_pixmap_scale(geom, simg->pmap);
}
if ((f = search_path(rs_path, file)) == NULL) {
if (!(f = search_path(rs_path, file))) {
f = search_path(getenv(PATH_ENV), file);
}
if (f != NULL) {
if (f) {
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));
if (!im) {
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);
@ -1747,14 +1742,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
@ -1822,8 +1810,8 @@ colormod_trans(Pixmap p, imlib_t *iml, GC gc, unsigned short w, unsigned short h
real_depth = Xdepth;
}
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);
if (!ximg) {
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));
@ -1886,6 +1874,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:
@ -1901,7 +1890,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;
}
}
@ -1926,7 +1915,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;
}
@ -1944,7 +1933,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;
@ -2181,15 +2170,15 @@ set_icon_pixmap(char *filename, XWMHints * pwm_hints)
imlib_context_set_color_modifier(tmp_cmod);
imlib_reset_color_modifier();
if (filename && *filename) {
if ((icon_path = search_path(rs_path, filename)) == NULL)
if (!(icon_path = search_path(rs_path, filename)))
icon_path = search_path(getenv(PATH_ENV), filename);
if (icon_path != NULL) {
if (icon_path) {
XIconSize *icon_sizes;
int count, i;
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));
if (!temp_im) {
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)) {
@ -2216,7 +2205,7 @@ set_icon_pixmap(char *filename, XWMHints * pwm_hints)
}
}
if (temp_im == NULL) {
if (!temp_im) {
w = h = 48;
temp_im = imlib_create_image_using_data(48, 48, (DATA32 *) (icon_data + 2));
imlib_context_set_image(temp_im);

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -26,9 +26,6 @@ static const char cvs_ident[] = "$Id$";
#include <errno.h>
#include <X11/Xatom.h>
#include <X11/Xmd.h> /* CARD32 */
#ifdef HAVE_X11_XMU_ATOMS_H
# include <X11/Xmu/Atoms.h>
#endif
#include "buttons.h"
#include "command.h"
@ -112,7 +109,7 @@ blank_line(text_t *et, rend_t *er, int width, rend_t efs)
register unsigned int i = width;
rend_t *r = er, fs = efs;
MEMSET(et, ' ', i);
memset(et, ' ', i);
for (; i--;)
*r++ = fs;
}
@ -125,11 +122,11 @@ blank_screen_mem(text_t **tp, rend_t **rp, int row, rend_t efs)
register unsigned int i = TERM_WINDOW_GET_REPORTED_COLS();
rend_t *r, fs = efs;
if (tp[row] == NULL) {
if (!tp[row]) {
tp[row] = MALLOC(sizeof(text_t) * (TERM_WINDOW_GET_REPORTED_COLS() + 1));
rp[row] = MALLOC(sizeof(rend_t) * TERM_WINDOW_GET_REPORTED_COLS());
}
MEMSET(tp[row], ' ', i);
memset(tp[row], ' ', i);
tp[row][i] = 0;
for (r = rp[row]; i--;)
*r++ = fs;
@ -267,7 +264,7 @@ scr_reset(void)
screen.row += k;
TermWin.nscrolled -= k;
for (i = TermWin.saveLines - TermWin.nscrolled; k--; i--) {
if (screen.text[i] == NULL) {
if (!screen.text[i]) {
blank_screen_mem(screen.text, screen.rend, i, DEFAULT_RSTYLE);
}
}
@ -358,7 +355,7 @@ scr_poweron(void)
D_SCREEN(("scr_poweron()\n"));
/* Reset all character sets to Latin1 */
MEMSET(charsets, 'B', sizeof(charsets));
memset(charsets, 'B', sizeof(charsets));
rvideo = 0;
/* Reset the rendering style to the default colors/style */
scr_rendition(0, ~RS_None);
@ -389,7 +386,7 @@ scr_poweron(void)
/*
* Save and Restore cursor
* XTERM_SEQ: Save cursor : ESC 7
* XTERM_SEQ: Save cursor : ESC 7
* XTERM_SEQ: Restore cursor: ESC 8
*/
void
@ -458,7 +455,7 @@ scr_change_screen(int scrn)
if (current_screen == PRIMARY) {
scroll_text(0, (TERM_WINDOW_GET_REPORTED_ROWS() - 1), TERM_WINDOW_GET_REPORTED_ROWS(), 0);
for (i = TermWin.saveLines; i < TERM_WINDOW_GET_REPORTED_ROWS() + TermWin.saveLines; i++)
if (screen.text[i] == NULL) {
if (!screen.text[i]) {
blank_screen_mem(screen.text, screen.rend, i, DEFAULT_RSTYLE);
}
}
@ -637,7 +634,7 @@ scroll_text(int row1, int row2, int count, int spec)
for (i = 0, j = row1; i < count; i++, j++) {
buf_text[i] = screen.text[j];
buf_rend[i] = screen.rend[j];
if (buf_text[i] == NULL) {
if (!buf_text[i]) {
/* A new ALLOC is done with size ncol and
blankline with size prev_ncol -- Sebastien van K */
buf_text[i] = MALLOC(sizeof(text_t) * (prev_ncol + 1));
@ -664,7 +661,7 @@ scroll_text(int row1, int row2, int count, int spec)
for (i = 0, j = row2; i < count; i++, j--) {
buf_text[i] = screen.text[j];
buf_rend[i] = screen.rend[j];
if (buf_text[i] == NULL) {
if (!buf_text[i]) {
/* A new ALLOC is done with size ncol and
blankline with size prev_ncol -- Sebastien van K */
buf_text[i] = MALLOC(sizeof(text_t) * (prev_ncol + 1));
@ -731,7 +728,7 @@ scr_add_lines(const unsigned char *str, int nlines, int len)
BOUND(screen.row, -TermWin.nscrolled, TERM_WINDOW_GET_REPORTED_ROWS() - 1);
row = screen.row + TermWin.saveLines;
if (screen.text[row] == NULL) {
if (!screen.text[row]) {
blank_screen_mem(screen.text, screen.rend, row, DEFAULT_RSTYLE);
} /* avoid segfault -- added by Sebastien van K */
beg.row = screen.row;
@ -1307,7 +1304,7 @@ void
scr_set_tab(int mode)
{
if (mode < 0)
MEMSET(tabs, 0, (unsigned int) TERM_WINDOW_GET_REPORTED_COLS());
memset(tabs, 0, (unsigned int) TERM_WINDOW_GET_REPORTED_COLS());
else if (screen.col < TERM_WINDOW_GET_REPORTED_COLS())
tabs[screen.col] = (mode ? 1 : 0);
@ -1329,7 +1326,7 @@ scr_rvideo_mode(int mode)
maxlines = TermWin.saveLines + TERM_WINDOW_GET_REPORTED_ROWS();
for (i = TermWin.saveLines; i < maxlines; i++)
for (j = 0; j < TERM_WINDOW_GET_REPORTED_COLS() + 1; j++)
for (j = 0; j < TERM_WINDOW_GET_REPORTED_COLS(); j++)
screen.rend[i][j] ^= RS_RVid;
scr_refresh(SLOW_REFRESH);
}
@ -1513,7 +1510,7 @@ scr_expose(int x, int y, int width, int height)
rect_end.col, rect_end.row));
for (i = rect_beg.row; i <= rect_end.row; i++) {
MEMSET(&(drawn_text[i][rect_beg.col]), 0, rect_end.col - rect_beg.col + 1);
memset(&(drawn_text[i][rect_beg.col]), 0, rect_end.col - rect_beg.col + 1);
}
}
@ -1543,7 +1540,7 @@ scr_page(int direction, int nlines)
D_SCREEN(("scr_page(%s, %d) view_start:%d\n", ((direction == UP) ? "UP" : "DN"), nlines, TermWin.view_start));
start = TermWin.view_start;
BOUND(nlines, 1, TERM_WINDOW_GET_REPORTED_ROWS());
BOUND(nlines, 1, TermWin.nscrolled);
TermWin.view_start += ((direction == UP) ? nlines : (-nlines));
BOUND(TermWin.view_start, 0, TermWin.nscrolled);
return (TermWin.view_start - start);
@ -1552,6 +1549,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 +1567,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);
}
@ -1576,7 +1581,7 @@ scr_printscreen(int fullhist)
text_t *t;
FILE *fd;
if ((fd = popen_printer()) == NULL)
if (!(fd = popen_printer()))
return;
nrows = TERM_WINDOW_GET_REPORTED_ROWS();
if (fullhist) {
@ -1940,7 +1945,7 @@ scr_refresh(int type)
XChangeGC(Xdisplay, TermWin.gc, gcmask, &gcvalue);
}
#ifndef NO_BOLDFONT
if (!wbyte && MONO_BOLD(rend) && TermWin.boldFont != NULL) {
if (!wbyte && MONO_BOLD(rend) && TermWin.boldFont) {
XSetFont(Xdisplay, TermWin.gc, TermWin.boldFont->fid);
bfont = 1;
} else if (bfont) {
@ -2006,11 +2011,11 @@ scr_refresh(int type)
ww = Width2Pixel(wlen);
hh = Height2Pixel(1);
CLEAR_CHARS(xpixel, ypixel - ascent, len);
if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_TOP_RIGHT]) {
if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_TOP] || fshadow.shadow[SHADOW_TOP_RIGHT]) {
yy--;
hh++;
}
if (fshadow.shadow[SHADOW_BOTTOM_LEFT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT]) {
if (fshadow.shadow[SHADOW_BOTTOM_LEFT] || fshadow.shadow[SHADOW_BOTTOM] || fshadow.shadow[SHADOW_BOTTOM_RIGHT]) {
hh++;
if (row < nrows - 1) {
int ii;
@ -2027,6 +2032,13 @@ scr_refresh(int type)
dtp[col - 1] = 0;
}
}
if (fshadow.shadow[SHADOW_TOP]) {
XSetForeground(Xdisplay, TermWin.gc, fshadow.color[SHADOW_TOP]);
DRAW_STRING(draw_string, xpixel, ypixel - 1, buffer, wlen);
if (col) {
dtp[col] = 0;
}
}
if (fshadow.shadow[SHADOW_TOP_RIGHT]) {
XSetForeground(Xdisplay, TermWin.gc, fshadow.color[SHADOW_TOP_RIGHT]);
DRAW_STRING(draw_string, xpixel + 1, ypixel - 1, buffer, wlen);
@ -2034,6 +2046,20 @@ scr_refresh(int type)
dtp[col + 1] = 0;
}
}
if (fshadow.shadow[SHADOW_LEFT]) {
XSetForeground(Xdisplay, TermWin.gc, fshadow.color[SHADOW_LEFT]);
DRAW_STRING(draw_string, xpixel - 1, ypixel, buffer, wlen);
if (col) {
dtp[col - 1] = 0;
}
}
if (fshadow.shadow[SHADOW_RIGHT]) {
XSetForeground(Xdisplay, TermWin.gc, fshadow.color[SHADOW_RIGHT]);
DRAW_STRING(draw_string, xpixel + 1, ypixel, buffer, wlen);
if (col < ncols - 1) {
dtp[col + 1] = 0;
}
}
if (fshadow.shadow[SHADOW_BOTTOM_LEFT]) {
XSetForeground(Xdisplay, TermWin.gc, fshadow.color[SHADOW_BOTTOM_LEFT]);
DRAW_STRING(draw_string, xpixel - 1, ypixel + 1, buffer, wlen);
@ -2041,6 +2067,13 @@ scr_refresh(int type)
dtp[col - 1] = 0;
}
}
if (fshadow.shadow[SHADOW_BOTTOM]) {
XSetForeground(Xdisplay, TermWin.gc, fshadow.color[SHADOW_BOTTOM]);
DRAW_STRING(draw_string, xpixel, ypixel + 1, buffer, wlen);
if (col) {
dtp[col] = 0;
}
}
if (fshadow.shadow[SHADOW_BOTTOM_RIGHT]) {
XSetForeground(Xdisplay, TermWin.gc, fshadow.color[SHADOW_BOTTOM_RIGHT]);
DRAW_STRING(draw_string, xpixel + 1, ypixel + 1, buffer, wlen);
@ -2155,37 +2188,37 @@ scr_refresh(int type)
D_SCREEN(("Update box dimensions: from (%d, %d) to (%d, %d). Dimensions %dx%d\n", low_x, low_y, high_x, high_y,
high_x - low_x + 1, high_y - low_y + 1));
XClearArea(Xdisplay, TermWin.vt, low_x, low_y, high_x - low_x + 1, high_y - low_y + 1, False);
if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_BOTTOM_LEFT]) {
if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_LEFT] || fshadow.shadow[SHADOW_BOTTOM_LEFT]) {
XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, TermWin.internalBorder - 1, 0, 1, TermWin_TotalHeight() - 1,
TermWin.internalBorder - 1, 0);
XClearArea(Xdisplay, TermWin.vt, TermWin.internalBorder - 1, 0, 1, TermWin_TotalHeight() - 1, False);
}
if (fshadow.shadow[SHADOW_TOP_RIGHT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT] || boldlast) {
if (fshadow.shadow[SHADOW_TOP_RIGHT] || fshadow.shadow[SHADOW_RIGHT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT] || boldlast) {
XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, TermWin_TotalWidth() - 2, 0, 1, TermWin_TotalHeight() - 1,
TermWin_TotalWidth() - 2, 0);
XClearArea(Xdisplay, TermWin.vt, TermWin_TotalWidth() - 2, 0, 1, TermWin_TotalHeight() - 1, False);
}
if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_TOP_RIGHT]) {
if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_TOP] || fshadow.shadow[SHADOW_TOP_RIGHT]) {
XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, 0, TermWin.internalBorder - 1, TermWin_TotalWidth() - 1, 1, 0,
TermWin.internalBorder - 1);
XClearArea(Xdisplay, TermWin.vt, 0, TermWin.internalBorder - 1, TermWin_TotalWidth() - 1, 1, False);
}
if (fshadow.shadow[SHADOW_BOTTOM_LEFT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT]) {
if (fshadow.shadow[SHADOW_BOTTOM_LEFT] || fshadow.shadow[SHADOW_BOTTOM] || fshadow.shadow[SHADOW_BOTTOM_RIGHT]) {
XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, 0, TermWin_TotalHeight() - TermWin.internalBorder,
TermWin_TotalWidth() - 1, 1, 0, TermWin_TotalHeight() - TermWin.internalBorder);
XClearArea(Xdisplay, TermWin.vt, 0, TermWin_TotalHeight() - TermWin.internalBorder, TermWin_TotalWidth() - 1, 1, False);
}
} else {
if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_BOTTOM_LEFT]) {
if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_LEFT] || fshadow.shadow[SHADOW_BOTTOM_LEFT]) {
XClearArea(Xdisplay, TermWin.vt, TermWin.internalBorder - 1, 0, 1, TermWin_TotalHeight() - 1, False);
}
if ((fshadow.shadow[SHADOW_TOP_RIGHT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT] || boldlast) && TermWin.internalBorder) {
if ((fshadow.shadow[SHADOW_TOP_RIGHT] || fshadow.shadow[SHADOW_RIGHT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT] || boldlast) && TermWin.internalBorder) {
XClearArea(Xdisplay, TermWin.vt, TermWin_TotalWidth() - 2, 0, 1, TermWin_TotalHeight() - 1, False);
}
if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_TOP_RIGHT]) {
if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_TOP] || fshadow.shadow[SHADOW_TOP_RIGHT]) {
XClearArea(Xdisplay, TermWin.vt, 0, TermWin.internalBorder - 1, TermWin_TotalWidth() - 1, 1, False);
}
if (fshadow.shadow[SHADOW_BOTTOM_LEFT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT]) {
if (fshadow.shadow[SHADOW_BOTTOM_LEFT] || fshadow.shadow[SHADOW_BOTTOM] || fshadow.shadow[SHADOW_BOTTOM_RIGHT]) {
XClearArea(Xdisplay, TermWin.vt, 0, TermWin_TotalHeight() - TermWin.internalBorder, TermWin_TotalWidth() - 1, 1, False);
}
}
@ -2223,8 +2256,8 @@ scr_search_scrollback(char *str)
unsigned int *i;
unsigned long row, lrow, col, rows, cols, len, k;
if (str == NULL) {
if ((str = last_str) == NULL) {
if (!str) {
if (!(str = last_str)) {
return;
}
} else {
@ -2465,16 +2498,16 @@ selection_fetch(Window win, unsigned prop, int delete)
if ((XGetWindowProperty
(Xdisplay, win, prop, (nread / 4), PROP_SIZE, delete, AnyPropertyType, &actual_type, &actual_fmt, &nitems,
&bytes_after, &data) != Success)
|| (actual_type == None) || (data == NULL)) {
|| (actual_type == None) || (!data)) {
D_SELECT(("Unable to fetch the value of property %d from window 0x%08x\n", (int) prop, (int) win));
if (data != NULL) {
if (data) {
XFree(data);
}
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,15 +2556,17 @@ selection_fetch(Window win, unsigned prop, int delete)
void
selection_copy_string(Atom sel, char *str, size_t len)
{
if (str == NULL || len == 0) {
D_SELECT(("Copying %ul bytes from 0x%08x to selection %d\n", len, str, (int) sel));
if (!str || 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");
}
XFlush(Xdisplay);
} else {
D_SELECT(("Copying selection to cut buffer %d\n", (int) sel));
XChangeProperty(Xdisplay, Xroot, sel, XA_STRING, 8, PropModeReplace, str, len);
@ -2549,30 +2584,25 @@ selection_copy(Atom sel)
void
selection_paste(Atom sel)
{
if (selection.text != NULL) {
D_SELECT(("Attempting to paste selection %d.\n", (int) sel));
if (selection.text) {
/* 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);
/* 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)
if (encoding_method != LATIN1) {
XConvertSelection(Xdisplay, sel, props[PROP_COMPOUND_TEXT], props[PROP_SELECTION_DEST], TermWin.vt, CurrentTime);
} 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]));
#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
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);
@ -2700,7 +2730,7 @@ selection_start_colrow(int col, int row)
selection.mark.row = row;
}
/*
/*
* Copy a selection into the cut buffer
* EXT: button 1 or 3 release
*/
@ -2828,9 +2858,9 @@ selection_click(int clicks, int x, int y)
/* what do we want: spaces/tabs are delimiters or cutchars or non-cutchars */
#ifdef CUTCHAR_OPTION
# define DELIMIT_TEXT(x) (strchr((rs_cutchars?rs_cutchars:CUTCHARS), (x)) != NULL)
# define DELIMIT_TEXT(x) (strchr((rs_cutchars ? rs_cutchars : CUTCHARS), (x)))
#else
# define DELIMIT_TEXT(x) (strchr(CUTCHARS, (x)) != NULL)
# define DELIMIT_TEXT(x) (strchr(CUTCHARS, (x)))
#endif
#ifdef MULTI_CHARSET
#define DELIMIT_REND(x) (((x) & RS_multiMask) ? 1 : 0)
@ -3238,7 +3268,7 @@ selection_extend_colrow(int col, int row, int flag, int cont)
D_SELECT(("(c:%d,r:%d)-(c:%d,r:%d) old (c:%d,r:%d)-(c:%d,r:%d)\n", selection.beg.col, selection.beg.row,
selection.end.col, selection.end.row, old_beg.col, old_beg.row, old_end.col, old_end.row));
/*
/*
* B1: clear anything before the current selection
*/
if ((old_beg.row < selection.beg.row) || (old_beg.row == selection.beg.row && old_beg.col < selection.beg.col)) {
@ -3251,7 +3281,7 @@ selection_extend_colrow(int col, int row, int flag, int cont)
}
selection_setclr(0, old_beg.row, old_beg.col, row, col);
}
/*
/*
* B2: clear anything after the current selection
*/
if ((old_end.row > selection.end.row) || (old_end.row == selection.end.row && old_end.col > selection.end.col)) {
@ -3264,7 +3294,7 @@ selection_extend_colrow(int col, int row, int flag, int cont)
}
selection_setclr(0, row, col, old_end.row, old_end.col);
}
/*
/*
* B3: set everything
*/
/* TODO: optimise this */
@ -3287,13 +3317,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 +3325,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,14 +3336,31 @@ 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)
} else if (rq->target == XA_TEXT(Xdisplay) || rq->target == XA_COMPOUND_TEXT(Xdisplay)) {
#ifdef MULTI_CHARSET
# ifdef X_HAVE_UTF8_STRING
} else if (rq->target == props[PROP_UTF8_STRING]) {
XTextProperty xtextp;
char *l[1];
*l = selection.text;
xtextp.value = NULL;
xtextp.nitems = 0;
if (XmbTextListToTextProperty(Xdisplay, l, 1, XUTF8StringStyle, &xtextp) == Success) {
if (xtextp.nitems > 0 && xtextp.value) {
XChangeProperty(Xdisplay, rq->requestor, rq->property,
rq->target, 8, PropModeReplace, xtextp.value, xtextp.nitems);
ev.xselection.property = rq->property;
XFree(xtextp.value);
}
}
# endif /* X_HAVE_UTF8_STRING */
} else if (rq->target == props[PROP_TEXT] || rq->target == props[PROP_COMPOUND_TEXT]) {
XTextProperty xtextp;
char *l[1];
@ -3328,15 +3368,16 @@ selection_send(XSelectionRequestEvent * rq)
xtextp.value = NULL;
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);
if (xtextp.nitems > 0 && xtextp.value) {
XChangeProperty(Xdisplay, rq->requestor, rq->property, props[PROP_COMPOUND_TEXT],
8, PropModeReplace, xtextp.value, xtextp.nitems);
ev.xselection.property = rq->property;
XFree(xtextp.value);
}
}
#endif
} else if (rq->target == XA_STRING) {
XChangeProperty(Xdisplay, rq->requestor, rq->property, rq->target, 8, PropModeReplace, selection.text, selection.len);
#endif /* MULTI_CHARSET */
} else {
XChangeProperty(Xdisplay, rq->requestor, rq->property, XA_STRING, 8, PropModeReplace, selection.text, selection.len);
ev.xselection.property = rq->property;
}
XSendEvent(Xdisplay, rq->requestor, False, 0, &ev);

View File

@ -16,16 +16,12 @@
#include <X11/Xfuncproto.h>
#include "startup.h"
#ifndef XA_CLIPBOARD
# define XA_CLIPBOARD(d) XA_PRIMARY
#endif
/************ Macros and Definitions ************/
#define WRAP_CHAR (0xff)
#define PROP_SIZE 4096
#define TABSIZE 8 /* default tab size */
#define IS_SELECTION(a) (((a) == XA_PRIMARY) || ((a) == XA_SECONDARY) || ((a) == XA_CLIPBOARD(Xdisplay)))
#define IS_SELECTION(a) (((a) == XA_PRIMARY) || ((a) == XA_SECONDARY) || ((a) == props[PROP_CLIPBOARD]))
#define IS_CUT_BUFFER(a) (((a) >= XA_CUT_BUFFER0) && ((a) <= XA_CUT_BUFFER7))
#define ZERO_SCROLLBACK do { \

View File

@ -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,25 +153,25 @@ 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;
Atom sel = XA_PRIMARY;
if (params) {
for (i = 0; (buffer_id = params[i]) != NULL; i++) {
for (i = 0; (buffer_id = params[i]); i++) {
if (*buffer_id) {
if (*buffer_id >= '0' && *buffer_id <= '7') {
sel = (Atom) ((int) XA_CUT_BUFFER0 + (int) (*buffer_id - '0'));
} else if (!BEG_STRCASECMP(buffer_id, "clipboard")) {
sel = XA_CLIPBOARD(Xdisplay);
sel = props[PROP_CLIPBOARD];
} else if (!BEG_STRCASECMP(buffer_id, "primary")) {
sel = XA_PRIMARY;
} 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)
* <string> 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,25 +254,25 @@ 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;
Atom sel = XA_PRIMARY;
if (params) {
for (i = 0; (buffer_id = params[i]) != NULL; i++) {
for (i = 0; (buffer_id = params[i]); i++) {
if (*buffer_id) {
if (*buffer_id >= '0' && *buffer_id <= '7') {
sel = (Atom) ((int) XA_CUT_BUFFER0 + (int) (*buffer_id - '0'));
} else if (!BEG_STRCASECMP(buffer_id, "clipboard")) {
sel = XA_CLIPBOARD(Xdisplay);
sel = props[PROP_CLIPBOARD];
} else if (!BEG_STRCASECMP(buffer_id, "primary")) {
sel = XA_PRIMARY;
} 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,12 +384,12 @@ 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;
if (params && *params) {
if (search != NULL) {
if (search) {
FREE(search);
}
search = STRDUP(*params);
@ -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)
* <string> 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)
* <command> 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)
* <message> 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)
* <statement> 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,59 +739,59 @@ script_parse(char *s)
D_SCRIPT(("Parsing: \"%s\"\n", s));
token_list = split(";", s);
if (token_list == NULL) {
token_list = spiftool_split(";", s);
if (!token_list) {
D_SCRIPT(("No tokens found; ignoring script.\n"));
return;
}
for (i = 0; token_list[i]; i++) {
pstr = token_list[i];
chomp(pstr);
spiftool_chomp(pstr);
if (!(*pstr)) {
continue;
}
if ((params = strchr(pstr, '(')) != NULL) {
if ((params = strchr(pstr, '('))) {
if (params != pstr) {
len = params - pstr;
func_name = (char *) MALLOC(len + 1);
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) {
params++;
if ((tmp = strrchr(params, ')')) != NULL) {
if ((tmp = strrchr(params, ')'))) {
*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;
}
D_SCRIPT(("Calling function %s with parameters: %s\n", func_name, NONULL(params)));
if ((func = script_find_handler(func_name)) != NULL) {
if ((func = script_find_handler(func_name))) {
(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);
}

View File

@ -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 */

View File

@ -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,7 @@ void
scrollbar_event_init_dispatcher(void)
{
MEMSET(&scrollbar_event_data, 0, sizeof(event_dispatcher_data_t));
memset(&scrollbar_event_data, 0, sizeof(event_dispatcher_data_t));
EVENT_DATA_ADD_HANDLER(scrollbar_event_data, EnterNotify, sb_handle_enter_notify);
EVENT_DATA_ADD_HANDLER(scrollbar_event_data, LeaveNotify, sb_handle_leave_notify);
@ -357,7 +357,7 @@ sb_handle_motion_notify(event_t *ev)
unsigned char
scrollbar_dispatch_event(event_t *ev)
{
if (scrollbar_event_data.handlers[ev->type] != NULL) {
if (scrollbar_event_data.handlers[ev->type]) {
return ((scrollbar_event_data.handlers[ev->type]) (ev));
}
return (0);
@ -923,7 +923,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);
}

View File

@ -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

View File

@ -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@stack.nl> 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 <willem@stack.nl> 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
@ -126,8 +120,8 @@ void shade_ximage_15_sse2( volatile void *data, volatile int bpl, volatile int w
"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 */
"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 */
@ -191,8 +185,8 @@ void shade_ximage_15_sse2( volatile void *data, volatile int bpl, volatile int w
"jns 8f \n\t"
"7: \n\t"
"movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t"
"movdqu %%xmm0, %%xmm1 \n\t"
"movdqu %%xmm0, %%xmm2 \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"
@ -301,8 +295,8 @@ void shade_ximage_16_sse2( volatile void *data, volatile int bpl, volatile int w
"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 */
"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 */
@ -359,7 +353,7 @@ void shade_ximage_16_sse2( volatile void *data, volatile int bpl, volatile int w
"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 */
"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"
@ -368,8 +362,8 @@ void shade_ximage_16_sse2( volatile void *data, volatile int bpl, volatile int w
"jns 8f \n\t"
"7: \n\t"
"movdqu (%%rsi, %%rcx, 2), %%xmm0\n\t"
"movdqu %%xmm0, %%xmm1 \n\t"
"movdqu %%xmm0, %%xmm2 \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"
@ -480,7 +474,7 @@ void shade_ximage_32_sse2( volatile void *data, volatile int bpl, volatile int w
"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) */
"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) */

View File

@ -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")) {
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);
@ -138,7 +137,11 @@ eterm_bootstrap(int argc, char *argv[])
get_modifiers(); /* Set up modifier masks before parsing config files. */
/* Get all our properties set up. */
MEMSET(props, 0, sizeof(props));
memset(props, 0, sizeof(props));
props[PROP_TEXT] = XInternAtom(Xdisplay, "TEXT", False);
props[PROP_COMPOUND_TEXT] = XInternAtom(Xdisplay, "COMPOUND_TEXT", False);
props[PROP_UTF8_STRING] = XInternAtom(Xdisplay, "UTF8_STRING", False);
props[PROP_CLIPBOARD] = XInternAtom(Xdisplay, "CLIPBOARD", False);
props[PROP_DESKTOP] = XInternAtom(Xdisplay, "_NET_WM_DESKTOP", False);
props[PROP_TRANS_PIXMAP] = XInternAtom(Xdisplay, "_XROOTPMAP_ID", False);
props[PROP_TRANS_COLOR] = XInternAtom(Xdisplay, "_XROOTCOLOR_PIXEL", False);
@ -154,21 +157,21 @@ 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))) {
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),
(PARSE_TRY_USER_THEME | PARSE_TRY_NO_THEME))) != NULL) {
if ((user_dir = spifconf_parse_theme(&rs_theme, (rs_config_file ? rs_config_file : USER_CFG), (PARSE_TRY_USER_THEME | PARSE_TRY_NO_THEME)))) {
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 +265,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) {
display_name = val;
}
i = strlen(val);
display_string = MALLOC(i + 9);
@ -301,7 +290,7 @@ eterm_bootstrap(int argc, char *argv[])
putenv("COLORTERM_BCE=" COLORTERMENV "-mono");
putenv("TERM=" TERMENV);
} else {
if (rs_term_name != NULL) {
if (rs_term_name) {
i = strlen(rs_term_name);
term_string = MALLOC(i + 6);

View File

@ -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
@ -91,6 +91,10 @@
#endif
enum {
PROP_TEXT,
PROP_COMPOUND_TEXT,
PROP_UTF8_STRING,
PROP_CLIPBOARD,
PROP_DESKTOP,
PROP_TRANS_PIXMAP,
PROP_TRANS_COLOR,
@ -106,6 +110,8 @@ enum {
PROP_EWMH_ICON,
PROP_EWMH_OPACITY,
PROP_EWMH_STARTUP_ID,
PROP_EWMH_STATE,
PROP_EWMH_STATE_STICKY,
NUM_PROPS
};

View File

@ -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);
}

View File

@ -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_ */

View File

@ -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
@ -473,7 +473,7 @@ lookup_key(XEvent * ev)
PrivMode((!numlock_state), PrivMode_aplKP);
}
#ifdef USE_XIM
if (xim_input_context != NULL) {
if (xim_input_context) {
Status status_return;
kbuf[0] = '\0';
@ -561,15 +561,15 @@ lookup_key(XEvent * ev)
}
#endif
#if defined(HAVE_X11_SUNKEYSYM_H) && defined(HAVE_X11_XMU_ATOMS_H)
#if defined(HAVE_X11_SUNKEYSYM_H)
switch (keysym) {
case SunXK_Copy:
case SunXK_Cut:
selection_copy(XA_CLIPBOARD(Xdisplay));
selection_copy(props[PROP_CLIPBOARD]);
LK_RET();
break;
case SunXK_Paste:
selection_paste(XA_CLIPBOARD(Xdisplay));
selection_paste(props[PROP_CLIPBOARD]);
LK_RET();
break;
case SunXK_Front:
@ -680,7 +680,7 @@ lookup_key(XEvent * ev)
if (keysym >= 0xff00 && keysym <= 0xffff) {
#ifdef KEYSYM_ATTRIBUTE
/* The "keysym" attribute in the config file gets handled here. */
if (!(shft | ctrl) && KeySym_map[keysym - 0xff00] != NULL) {
if (!(shft | ctrl) && KeySym_map[keysym - 0xff00]) {
const unsigned char *tmpbuf;
unsigned int len;
@ -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));
if (!(stream = (FILE *)popen(rs_print_pipe, "w"))) {
libast_print_error("Can't open printer pipe \"%s\" -- %s\n", rs_print_pipe, strerror(errno));
}
return stream;
}
@ -1102,7 +1102,7 @@ process_print_pipe(void)
int index;
FILE *fd;
if ((fd = popen_printer()) != NULL) {
if ((fd = popen_printer())) {
for (index = 0; index < 4; /* nil */ ) {
unsigned char ch = cmd_getc();
@ -2081,7 +2081,7 @@ append_to_title(const char *str)
REQUIRE(str != NULL);
XFetchName(Xdisplay, TermWin.parent, &name);
if (name != NULL) {
if (name) {
buff = (char *) MALLOC(strlen(name) + strlen(str) + 1);
strcpy(buff, name);
strcat(buff, str);
@ -2098,7 +2098,7 @@ append_to_icon_name(const char *str)
REQUIRE(str != NULL);
XGetIconName(Xdisplay, TermWin.parent, &name);
if (name != NULL) {
if (name) {
buff = (char *) MALLOC(strlen(name) + strlen(str) + 1);
strcpy(buff, name);
strcat(buff, str);
@ -2158,19 +2158,19 @@ xterm_seq(int op, const char *str)
set_title(str);
break;
case ESCSEQ_XTERM_PROP: /* 3 */
if ((nstr = (char *) strsep(&tnstr, ";")) == NULL) {
if (!(nstr = (char *)strsep(&tnstr, ";"))) {
break;
}
if ((valptr = strchr(nstr, '=')) != NULL) {
if ((valptr = strchr(nstr, '='))) {
*(valptr++) = 0;
}
set_text_property(TermWin.parent, nstr, valptr);
break;
case ESCSEQ_XTERM_CHANGE_COLOR: /* Changing existing colors 256 */
while ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
while ((nstr = (char *)strsep(&tnstr, ";"))) {
i = (unsigned int) strtoul(nstr, (char **) NULL, 0);
nstr = (char *) strsep(&tnstr, ";");
if ((i < 256) && (nstr != NULL)) {
if ((i < 256) && (nstr)) {
D_COLORS(("Changing color : [%d] -> %s\n", i, nstr));
set_window_color(i, nstr);
}
@ -2256,7 +2256,7 @@ xterm_seq(int op, const char *str)
case 1:
changed = 0;
for (; 1;) {
if ((color = (char *) strsep(&tnstr, ";")) == NULL) {
if (!(color = (char *)strsep(&tnstr, ";"))) {
break;
}
which = image_max;
@ -2264,13 +2264,13 @@ xterm_seq(int op, const char *str)
which = idx; break;}
);
if (which != image_max) {
if ((color = (char *) strsep(&tnstr, ";")) == NULL) {
if (!(color = (char *)strsep(&tnstr, ";"))) {
break;
}
} else {
which = image_bg;
}
if ((mod = (char *) strsep(&tnstr, ";")) == NULL) {
if (!(mod = (char *)strsep(&tnstr, ";"))) {
break;
}
if (!strcasecmp(mod, "clear")) {
@ -2297,7 +2297,7 @@ xterm_seq(int op, const char *str)
changed = 1;
continue;
}
if ((valptr = (char *) strsep(&tnstr, ";")) == NULL) {
if (!(valptr = (char *)strsep(&tnstr, ";"))) {
break;
}
D_CMD(("Modifying the %s attribute of the %s color modifier of the %s image to be %s\n",
@ -2314,7 +2314,7 @@ xterm_seq(int op, const char *str)
if (!strcasecmp(color, "image")) {
imlib_t *iml = images[which].current->iml;
if (iml->mod == NULL) {
if (!iml->mod) {
iml->mod = create_colormod();
}
if (!BEG_STRCASECMP(mod, "brightness")) {
@ -2331,7 +2331,7 @@ xterm_seq(int op, const char *str)
} else if (!strcasecmp(color, "red")) {
imlib_t *iml = images[which].current->iml;
if (iml->rmod == NULL) {
if (!iml->rmod) {
iml->rmod = create_colormod();
}
if (!BEG_STRCASECMP(mod, "brightness")) {
@ -2348,7 +2348,7 @@ xterm_seq(int op, const char *str)
} else if (!strcasecmp(color, "green")) {
imlib_t *iml = images[which].current->iml;
if (iml->gmod == NULL) {
if (!iml->gmod) {
iml->gmod = create_colormod();
}
if (!BEG_STRCASECMP(mod, "brightness")) {
@ -2365,7 +2365,7 @@ xterm_seq(int op, const char *str)
} else if (!strcasecmp(color, "blue")) {
imlib_t *iml = images[which].current->iml;
if (iml->bmod == NULL) {
if (!iml->bmod) {
iml->bmod = create_colormod();
}
if (!BEG_STRCASECMP(mod, "bright")) {
@ -2387,14 +2387,14 @@ xterm_seq(int op, const char *str)
case 2:
changed = 0;
which = image_max;
if ((nstr = (char *) strsep(&tnstr, ";")) == NULL || (valptr = (char *) strsep(&tnstr, ";")) == NULL) {
if (!(nstr = (char *)strsep(&tnstr, ";")) || !(valptr = (char *)strsep(&tnstr, ";"))) {
break;
}
FOREACH_IMAGE(if (!strcasecmp(valptr, (get_image_type(idx) + 6))) {
which = idx; break;}
);
if (which != image_max) {
if ((valptr = (char *) strsep(&tnstr, ";")) == NULL) {
if (!(valptr = (char *)strsep(&tnstr, ";"))) {
break;
}
} else {
@ -2408,7 +2408,7 @@ xterm_seq(int op, const char *str)
s = (int) strtol(valptr, (char **) NULL, 0);
s = ((100 - s) << 8) / 100;
if (s == 0x100) {
if (iml->mod != NULL) {
if (iml->mod) {
if (iml->mod->brightness != 0x100) {
iml->mod->brightness = 0x100;
changed = 1;
@ -2418,7 +2418,7 @@ xterm_seq(int op, const char *str)
}
}
} else {
if (iml->mod == NULL) {
if (!iml->mod) {
iml->mod = create_colormod();
}
if (iml->mod->brightness != s) {
@ -2438,7 +2438,7 @@ xterm_seq(int op, const char *str)
}
r = (t & 0xff0000) >> 16;
if (r == 0xff) {
if (iml->rmod != NULL) {
if (iml->rmod) {
if (iml->rmod->brightness != 0x100) {
iml->rmod->brightness = 0x100;
changed = 1;
@ -2448,7 +2448,7 @@ xterm_seq(int op, const char *str)
}
}
} else {
if (iml->rmod == NULL) {
if (!iml->rmod) {
iml->rmod = create_colormod();
}
if (iml->rmod->brightness != (int) r) {
@ -2458,7 +2458,7 @@ xterm_seq(int op, const char *str)
}
g = (t & 0xff00) >> 8;
if (g == 0xff) {
if (iml->gmod != NULL) {
if (iml->gmod) {
if (iml->gmod->brightness != 0x100) {
iml->gmod->brightness = 0x100;
changed = 1;
@ -2468,7 +2468,7 @@ xterm_seq(int op, const char *str)
}
}
} else {
if (iml->gmod == NULL) {
if (!iml->gmod) {
iml->gmod = create_colormod();
}
if (iml->gmod->brightness != (int) g) {
@ -2478,7 +2478,7 @@ xterm_seq(int op, const char *str)
}
b = t & 0xff;
if (b == 0xff) {
if (iml->bmod != NULL) {
if (iml->bmod) {
if (iml->bmod->brightness != 0x100) {
iml->bmod->brightness = 0x100;
changed = 1;
@ -2488,7 +2488,7 @@ xterm_seq(int op, const char *str)
}
}
} else {
if (iml->bmod == NULL) {
if (!iml->bmod) {
iml->bmod = create_colormod();
iml->bmod->contrast = iml->bmod->gamma = 0x100;
}
@ -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) {
@ -2705,54 +2709,54 @@ xterm_seq(int op, const char *str)
#ifdef XTERM_COLOR_CHANGE
case ESCSEQ_XTERM_FGCOLOR: /* 10 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
if ((nstr = (char *)strsep(&tnstr, ";"))) {
set_window_color(fgColor, nstr);
}
/* drop */
case ESCSEQ_XTERM_BGCOLOR: /* 11 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
if ((nstr = (char *)strsep(&tnstr, ";"))) {
set_window_color(bgColor, nstr);
}
/* drop */
case ESCSEQ_XTERM_CURSOR_COLOR: /* 12 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
if ((nstr = (char *)strsep(&tnstr, ";"))) {
# ifndef NO_CURSORCOLOR
set_window_color(cursorColor, nstr);
# endif
}
/* drop */
case ESCSEQ_XTERM_PTR_FGCOLOR: /* 13 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
if ((nstr = (char *)strsep(&tnstr, ";"))) {
set_pointer_colors(nstr, NULL);
}
/* drop */
case ESCSEQ_XTERM_PTR_BGCOLOR: /* 14 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
if ((nstr = (char *)strsep(&tnstr, ";"))) {
/* UNSUPPORTED */
}
/* drop */
case ESCSEQ_XTERM_TEK_FGCOLOR: /* 15 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
if ((nstr = (char *)strsep(&tnstr, ";"))) {
/* UNSUPPORTED */
}
/* drop */
case ESCSEQ_XTERM_TEK_BGCOLOR: /* 16 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
if ((nstr = (char *)strsep(&tnstr, ";"))) {
/* UNSUPPORTED */
}
/* drop */
case ESCSEQ_XTERM_HILIGHT_COLOR: /* 17 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
if ((nstr = (char *)strsep(&tnstr, ";"))) {
/* UNSUPPORTED */
}
/* drop */
case ESCSEQ_XTERM_BOLD_COLOR: /* 18 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
if ((nstr = (char *)strsep(&tnstr, ";"))) {
set_window_color(colorBD, nstr);
}
/* drop */
case ESCSEQ_XTERM_ULINE_COLOR: /* 19 */
if ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
if ((nstr = (char *)strsep(&tnstr, ";"))) {
set_window_color(colorUL, nstr);
}
#endif

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,9 +38,9 @@ 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(__OpenBSD__)
static char ut_id[5]; /* remember if entry to utmp made */
# else
# elif !defined(NEW_BSD_UTMP)
static int utmp_pos; /* BSD position of utmp-stamp */
# endif
@ -97,10 +97,10 @@ add_utmp_entry(const char *pty, const char *hostname, int fd)
# ifdef HAVE_UTMPX_H
struct utmpx utmp;
struct utmp utmp2;
MEMSET(&utmp, 0, sizeof(struct utmpx));
memset(&utmp, 0, sizeof(struct utmpx));
# else
struct utmp utmp;
MEMSET(&utmp, 0, sizeof(struct utmp));
memset(&utmp, 0, sizeof(struct utmp));
# endif
# ifdef WITH_DMALLOC
@ -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;
}
@ -181,7 +181,7 @@ remove_utmp_entry(void)
setutent();
strncpy(utmp.ut_id, ut_id, sizeof(utmp.ut_id));
utmp.ut_type = USER_PROCESS;
if (getutid(&utmp) == NULL) {
if (!getutid(&utmp)) {
return;
}
utmp.ut_type = DEAD_PROCESS;
@ -204,7 +204,7 @@ remove_utmp_entry(void)
* The following code waw copied from the poeigl-1.20 login/init package.
* Special thanks to poe for the code examples.
*/
while ((putmp = getutent()) != NULL) {
while ((putmp = getutent())) {
if (putmp->ut_pid == pid) {
putmp->ut_type = DEAD_PROCESS;
putmp->ut_pid = 0;
@ -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 */
/*----------------------------------------------------------------------*
@ -286,10 +286,10 @@ get_tslot(const char *ttyname)
char buf[256], name[256];
FILE *fd;
if ((fd = fopen(UTMP_FILENAME, "r")) != NULL) {
if ((fd = fopen(UTMP_FILENAME, "r"))) {
int i;
for (i = 1; fgets(buf, sizeof(buf), fd) != NULL; i++) {
for (i = 1; fgets(buf, sizeof(buf), fd); i++) {
if (*buf == '#' || sscanf(buf, "%s", name) != 1)
continue;
if (!strcmp(ttyname, name)) {
@ -313,7 +313,7 @@ write_utmp(struct utmp *putmp)
fprintf(stderr, "Utmp file is %s\n", UTMP_FILENAME);
privileges(INVOKE);
if ((fd = fopen(UTMP_FILENAME, "r+")) != NULL) {
if ((fd = fopen(UTMP_FILENAME, "r+"))) {
utmp_pos = get_tslot(putmp->ut_line) * sizeof(struct utmp);
if (utmp_pos >= 0) {
@ -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)
@ -336,19 +336,12 @@ add_utmp_entry(const char *pty, const char *hostname, int fd)
struct passwd *pwent = getpwuid(my_ruid);
struct utmp utmp;
MEMSET(&utmp, 0, sizeof(struct utmp));
memset(&utmp, 0, sizeof(struct utmp));
if (!strncmp(pty, "/dev/", 5))
pty += 5; /* skip /dev/ prefix */
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);
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 +350,15 @@ 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 */
if (!strncmp(pty, "pty", 3) || !strncmp(pty, "tty", 3))
strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */
else {
libast_print_error("can't parse tty name \"%s\"\n", pty);
ut_id[0] = '\0'; /* entry not made */
return;
}
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,16 +377,16 @@ 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);
if (!ut_id[0] && (fd = fopen(UTMP_FILENAME, "r+")) != NULL) {
if (!ut_id[0] && (fd = fopen(UTMP_FILENAME, "r+"))) {
struct utmp utmp;
MEMSET(&utmp, 0, sizeof(struct utmp));
memset(&utmp, 0, sizeof(struct utmp));
fseek(fd, utmp_pos, 0);
fwrite(&utmp, sizeof(struct utmp), 1, fd);
@ -393,7 +394,7 @@ remove_utmp_entry(void)
fclose(fd);
}
privileges(REVERT);
# endif /* __FreeBSD__ || NetBSD || BSDI */
# endif /* NEW_BSD_UTMP */
}
# endif /* USE_SYSV_UTMP */

View File

@ -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,7 +69,7 @@ set_text_property(Window win, char *propname, char *value)
ASSERT(propname != NULL);
if (value == NULL) {
if (!value) {
atom = XInternAtom(Xdisplay, propname, True);
if (atom == None) {
return;
@ -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];
}
@ -189,8 +189,8 @@ get_color_by_name(const char *name, const char *fallback)
{
XColor xcol;
if (name == NULL) {
if (fallback == NULL) {
if (!name) {
if (!fallback) {
return ((Pixel) - 1);
} else {
name = fallback;
@ -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);
}
@ -348,13 +348,13 @@ set_pointer_colors(const char *fg_name, const char *bg_name)
{
XColor fg, bg;
if (fg_name != NULL) {
if (fg_name) {
fg.pixel = get_color_by_name(fg_name, COLOR_NAME(pointerColor));
} else {
fg.pixel = PixColors[pointerColor];
}
XQueryColor(Xdisplay, cmap, &fg);
if (bg_name != NULL) {
if (bg_name) {
bg.pixel = get_color_by_name(bg_name, COLOR_NAME(bgColor));
} else {
bg.pixel = PixColors[bgColor];
@ -378,15 +378,8 @@ 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 {
mwmhints.flags = MWM_HINTS_DECORATIONS;
mwmhints.decorations = 0;
}
mwmhints.flags = MWM_HINTS_DECORATIONS;
mwmhints.decorations = 0;
} else {
mwmhints.flags = 0;
}
@ -498,10 +491,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 +510,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 +690,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);
}
}
}
}
@ -728,7 +735,7 @@ set_window_color(int idx, const char *color)
D_X11(("idx == %d, color == \"%s\"\n", idx, NONULL(color)));
if (color == NULL || *color == '\0')
if (!color || *color == '\0')
return;
/* handle color aliases */
@ -740,12 +747,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 +760,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();

View File

@ -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

View File

@ -1 +0,0 @@
timestamp

View File

@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@ -1 +0,0 @@
theme.cfg

View File

@ -1 +0,0 @@
theme.cfg

View File

@ -1 +0,0 @@
theme.cfg

View File

@ -1 +0,0 @@
theme.cfg

Some files were not shown because too many files have changed in this diff Show More