From dd84c6ababafc584371af657ac47fa6493b1e4d4 Mon Sep 17 00:00:00 2001 From: Michael Jennings Date: Thu, 7 Oct 1999 22:18:14 +0000 Subject: [PATCH] Thu Oct 7 18:48:31 PDT 1999 Michael Jennings Shaved off around 100 KB of memory usage per Eterm by moving more code into the shared library, removing lots of unneeded variables, and fixing some small leaks here and there. SVN revision: 710 --- ChangeLog | 7 + src/Makefile.am | 6 +- src/actions.c | 2 +- src/command.c | 2 +- src/e.c | 4 +- src/e.h | 2 +- src/eterm_utmp.h | 2 +- src/events.c | 4 +- src/events.h | 2 +- src/feature.h | 2 +- src/font.c | 4 +- src/font.h | 2 +- src/graphics.c | 2 +- src/main.c | 299 +--------------------------------- src/menus.c | 8 +- src/menus.h | 2 +- src/misc.c | 4 +- src/misc.h | 2 +- src/netdisp.c | 2 +- src/options.c | 214 +++++++------------------ src/options.h | 14 +- src/pixmap.c | 4 +- src/pixmap.h | 2 +- src/screen.c | 2 +- src/screen.h | 2 +- src/scrollbar.c | 4 +- src/scrollbar.h | 2 +- src/startup.c | 327 ++++++++++++++++++++++++++++++++++++++ src/{main.h => startup.h} | 10 +- src/term.c | 4 +- src/term.h | 2 +- src/threads.c | 2 +- src/timer.c | 2 +- src/windows.c | 4 +- src/windows.h | 2 +- 35 files changed, 447 insertions(+), 508 deletions(-) create mode 100644 src/startup.c rename src/{main.h => startup.h} (96%) diff --git a/ChangeLog b/ChangeLog index 37263c6..7f87866 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2549,3 +2549,10 @@ Thu Oct 7 16:39:48 PDT 1999 Michael Jennings wasn't working. It is now. :-) ------------------------------------------------------------------------------- +Thu Oct 7 18:48:31 PDT 1999 Michael Jennings + + Shaved off around 100 KB of memory usage per Eterm by moving more + code into the shared library, removing lots of unneeded variables, and + fixing some small leaks here and there. + +------------------------------------------------------------------------------- diff --git a/src/Makefile.am b/src/Makefile.am index 4448e42..c115997 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,7 +3,7 @@ lib_LTLIBRARIES = libEterm.la libEterm_la_SOURCES = actions.c command.c e.c events.c font.c graphics.c grkelot.c menus.c misc.c netdisp.c \ - options.c pixmap.c screen.c scrollbar.c system.c term.c threads.c timer.c utmp.c windows.c + options.c pixmap.c screen.c scrollbar.c startup.c system.c term.c threads.c timer.c utmp.c windows.c libEterm_la_DEPENDENCIES = $(top_builddir)/libmej/libmej.la feature.h libEterm_la_LDFLAGS = -version-info 9:0:9 @@ -15,6 +15,6 @@ Eterm_LDFLAGS = -rpath $(libdir):$(pkglibdir) INCLUDES = -I. -I$(top_srcdir) -I$(top_srcdir)/libmej -I.. -I$(includedir) -I$(prefix)/include $(X_CFLAGS) LDADD = libEterm.la $(top_builddir)/libmej/libmej.la -L$(libdir) -L$(prefix)/lib $(LIBS) $(GRLIBS) $(X_LIBS) -EXTRA_DIST = actions.h command.h debug.h e.h eterm_utmp.h events.h feature.h font.h graphics.h grkelot.h grx.h main.h menus.h misc.h \ - options.h pixmap.h profile.h screen.h scrollbar.h system.h term.h threads.h timer.h windows.h graphics/Makefile.am \ +EXTRA_DIST = actions.h command.h debug.h e.h eterm_utmp.h events.h feature.h font.h graphics.h grkelot.h grx.h menus.h misc.h options.h \ + pixmap.h profile.h screen.h scrollbar.h startup.h system.h term.h threads.h timer.h windows.h graphics/Makefile.am \ graphics/Makefile.in graphics/README graphics/data graphics/grxlib.c graphics/grxlib.h graphics/qplot.c Eterm.xpm diff --git a/src/actions.c b/src/actions.c index 091142c..37ace18 100644 --- a/src/actions.c +++ b/src/actions.c @@ -37,7 +37,7 @@ static const char cvs_ident[] = "$Id$"; #include "../libmej/debug.h" #include "../libmej/strings.h" #include "debug.h" -#include "main.h" +#include "startup.h" #include "mem.h" #include "strings.h" #include "actions.h" diff --git a/src/command.c b/src/command.c index 4c4a996..8bb523e 100644 --- a/src/command.c +++ b/src/command.c @@ -115,7 +115,7 @@ static const char cvs_ident[] = "$Id$"; /* Eterm-specific Headers */ #include "command.h" -#include "main.h" +#include "startup.h" #include "../libmej/debug.h" #include "debug.h" #include "../libmej/mem.h" diff --git a/src/e.c b/src/e.c index 448cfd6..29637c6 100644 --- a/src/e.c +++ b/src/e.c @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ static const char cvs_ident[] = "$Id$"; #include "debug.h" #include "e.h" #include "command.h" -#include "main.h" +#include "startup.h" #include "options.h" #include "pixmap.h" #include "system.h" diff --git a/src/e.h b/src/e.h index eaac427..5e0310c 100644 --- a/src/e.h +++ b/src/e.h @@ -6,7 +6,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/eterm_utmp.h b/src/eterm_utmp.h index dc0ddc5..9545560 100644 --- a/src/eterm_utmp.h +++ b/src/eterm_utmp.h @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/events.c b/src/events.c index 46c90f6..ed8ecb2 100644 --- a/src/events.c +++ b/src/events.c @@ -6,7 +6,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ static const char cvs_ident[] = "$Id$"; #include "../libmej/debug.h" #include "../libmej/strings.h" #include "debug.h" -#include "main.h" +#include "startup.h" #include "mem.h" #include "strings.h" #include "actions.h" diff --git a/src/events.h b/src/events.h index 793d8da..b2184f5 100644 --- a/src/events.h +++ b/src/events.h @@ -6,7 +6,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/feature.h b/src/feature.h index 06db65b..5bfed92 100644 --- a/src/feature.h +++ b/src/feature.h @@ -6,7 +6,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/font.c b/src/font.c index fbb485d..11118ef 100644 --- a/src/font.c +++ b/src/font.c @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ static const char cvs_ident[] = "$Id$"; #include "debug.h" #include "command.h" #include "font.h" -#include "main.h" +#include "startup.h" #include "options.h" #include "screen.h" #include "term.h" diff --git a/src/font.h b/src/font.h index 39b6c60..cb56ee6 100644 --- a/src/font.h +++ b/src/font.h @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/graphics.c b/src/graphics.c index 113a7bf..d4ca33c 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -21,7 +21,7 @@ static const char cvs_ident[] = "$Id$"; #include "command.h" /* for tt_printf() */ #include "debug.h" #include "graphics.h" -#include "main.h" +#include "startup.h" #include "screen.h" /* commands: diff --git a/src/main.c b/src/main.c index 9173fe5..ebe849a 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,303 +26,10 @@ static const char cvs_ident[] = "$Id$"; -#include "config.h" -#include "feature.h" +extern int eterm_bootstrap(int argc, char *argv[]); -#include -#include -#include -#ifdef HAVE_UNISTD_H -# include -#endif -#include -#include -#include -#include -#include -#include -#include - -#include "../libmej/debug.h" /* from libmej */ -#include "debug.h" -#include "../libmej/mem.h" -#include "../libmej/strings.h" -#include "main.h" -#include "actions.h" -#include "command.h" -#include "eterm_utmp.h" -#include "events.h" -#include "graphics.h" -#include "options.h" -#include "pixmap.h" -#include "screen.h" -#include "scrollbar.h" -#include "term.h" -#ifdef USE_POSIX_THREADS -# include "threads.h" -#endif -#include "windows.h" - -char *orig_argv0; - -#ifdef PIXMAP_SUPPORT -/* Set to one in case there is no WM, or a lousy one - that doesn't send the right events (*cough* - Window Maker *cough*) -- mej */ -short bg_needs_update = 1; -#endif -#ifdef USE_POSIX_THREADS -static void **retval; -static int join_value; -static pthread_t main_loop_thr; -static pthread_attr_t main_loop_attr; -# ifdef MUTEX_SYNCH -pthread_mutex_t mutex; -# endif -#endif -TermWin_t TermWin; -Display *Xdisplay; /* display */ -Colormap cmap; -unsigned int debug_level = 0; /* Level of debugging information to display */ -const char *display_name = NULL; -unsigned int colorfgbg; - -/* main() */ int main(int argc, char *argv[]) { - - int i; - char *val; - static char windowid_string[20], *display_string, *term_string; /* "WINDOWID=\0" = 10 chars, UINT_MAX = 10 chars */ - ImlibInitParams params; - - orig_argv0 = argv[0]; - -#ifdef USE_POSIX_THREADS -# ifdef MUTEX_SYNCH - pthread_atfork((void *) &prepare, (void *) &parent, (void *) &child); -# endif -#endif - - /* Security enhancements -- mej */ - putenv("IFS= \t\n"); - my_ruid = getuid(); - my_euid = geteuid(); - my_rgid = getgid(); - my_egid = getegid(); - privileges(REVERT); - getcwd(initial_dir, PATH_MAX); - - init_defaults(); - - /* Open display, get options/resources and create the window */ - if ((display_name = getenv("DISPLAY")) == NULL) - display_name = ":0"; - - /* This MUST be called before any other Xlib functions */ - -#ifdef USE_POSIX_THREADS - if (XInitThreads()) { - D_THREADS(("XInitThreads() succesful\n")); - } else { - D_THREADS(("XInitThreads() failed, I'm outta here\n")); - } -#endif - - get_initial_options(argc, argv); -#ifdef NEED_LINUX_HACK - privileges(INVOKE); /* xdm in new Linux versions requires ruid != root to open the display -- mej */ -#endif - Xdisplay = XOpenDisplay(display_name); -#ifdef NEED_LINUX_HACK - privileges(REVERT); -#endif - if (!Xdisplay) { - print_error("can't open display %s", display_name); - exit(EXIT_FAILURE); - } -#if DEBUG >= DEBUG_X - if (debug_level >= DEBUG_X) { - XSetErrorHandler((XErrorHandler) abort); - } else { - XSetErrorHandler((XErrorHandler) xerror_handler); - } -#else - XSetErrorHandler((XErrorHandler) xerror_handler); -#endif - - if (Options & Opt_install) { - cmap = XCreateColormap(Xdisplay, Xroot, Xvisual, AllocNone); - XInstallColormap(Xdisplay, cmap); -#ifdef PIXMAP_SUPPORT - params.cmap = cmap; - params.flags = PARAMS_COLORMAP; -#endif - } else { - cmap = Xcmap; -#ifdef PIXMAP_SUPPORT - params.flags = 0; -#endif - } - - /* Since we always use Imlib now, let's initialize it here. */ -#ifdef PIXMAP_SUPPORT - if (params.flags) { - imlib_id = Imlib_init_with_params(Xdisplay, ¶ms); - } else { - imlib_id = Imlib_init(Xdisplay); - } - if (!imlib_id) { - fatal_error("Unable to initialize Imlib. Aborting."); - } -#endif - - read_config(THEME_CFG); - read_config((rs_config_file ? rs_config_file : USER_CFG)); - -#if defined(PIXMAP_SUPPORT) - if (rs_path || theme_dir || user_dir) { - register unsigned long len; - register char *tmp; - - len = strlen(initial_dir); - if (rs_path) { - len += strlen(rs_path) + 1; /* +1 for the colon */ - } - if (theme_dir) { - len += strlen(theme_dir) + 1; - } - if (user_dir) { - len += strlen(user_dir) + 1; - } - tmp = MALLOC(len + 1); /* +1 here for the NUL */ - snprintf(tmp, len + 1, "%s%s%s%s%s%s%s", (rs_path ? rs_path : ""), (rs_path ? ":" : ""), initial_dir, - (theme_dir ? ":" : ""), (theme_dir ? theme_dir : ""), (user_dir ? ":" : ""), (user_dir ? user_dir : "")); - tmp[len] = '\0'; - FREE(rs_path); - rs_path = tmp; - D_OPTIONS(("New rs_path set to \"%s\"\n", rs_path)); - } -#endif - get_options(argc, argv); - D_UTMP(("Saved real uid/gid = [ %d, %d ] effective uid/gid = [ %d, %d ]\n", my_ruid, my_rgid, my_euid, my_egid)); - D_UTMP(("Now running with real uid/gid = [ %d, %d ] effective uid/gid = [ %d, %d ]\n", getuid(), getgid(), geteuid(), - getegid())); - - post_parse(); - -#ifdef PREFER_24BIT - cmap = DefaultColormap(Xdisplay, Xscreen); - - /* - * If depth is not 24, look for a 24bit visual. - */ - if (Xdepth != 24) { - XVisualInfo vinfo; - - if (XMatchVisualInfo(Xdisplay, Xscreen, 24, TrueColor, &vinfo)) { - Xdepth = 24; - Xvisual = vinfo.visual; - cmap = XCreateColormap(Xdisplay, RootWindow(Xdisplay, Xscreen), - Xvisual, AllocNone); - } - } -#endif - - Create_Windows(argc, argv); - scr_reset(); /* initialize screen */ - Gr_reset(); /* reset graphics */ - - /* add scrollBar, do it directly to avoid resize() */ - scrollbar_mapping(Options & Opt_scrollBar); - -#if DEBUG >= DEBUG_X - if (debug_level >= DEBUG_X) { - XSynchronize(Xdisplay, True); - } -#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 */ - - i = strlen(val); - display_string = MALLOC((i + 9)); - - sprintf(display_string, "DISPLAY=%s", val); - sprintf(windowid_string, "WINDOWID=%u", (unsigned int) TermWin.parent); - - /* add entries to the environment: - * DISPLAY: X display name - * WINDOWID: X windowid of the window - * COLORTERM: Terminal supports color - * COLORTERM_BCE: Terminal supports BCE - * TERM: Terminal type for termcap/terminfo - */ - putenv(display_string); - putenv(windowid_string); - if (Xdepth <= 2) { - putenv("COLORTERM=" COLORTERMENV "-mono"); - putenv("COLORTERM_BCE=" COLORTERMENV "-mono"); - putenv("TERM=" TERMENV); - } else { - if (rs_term_name != NULL) { - i = strlen(rs_term_name); - term_string = MALLOC((i + 6) * sizeof(char)); - - sprintf(term_string, "TERM=%s", rs_term_name); - putenv(term_string); - } else { -#ifdef DEFINE_XTERM_COLOR - if (Xdepth <= 2) - putenv("TERM=" TERMENV); - else - putenv("TERM=" TERMENV "-color"); -#else - putenv("TERM=" TERMENV); -#endif - } - putenv("COLORTERM=" COLORTERMENV); - putenv("COLORTERM_BCE=" COLORTERMENV); - } - putenv("ETERM_VERSION=" VERSION); - - D_CMD(("init_command()\n")); - init_command(rs_execArgs); -#ifndef USE_POSIX_THREADS - if (Options & Opt_borderless) { - resize_window(); - } -#endif - -#ifdef USE_POSIX_THREADS - D_THREADS(("main_thread:")); - pthread_attr_init(&main_loop_attr); - pthread_create(&main_loop_thr, &main_loop_attr, - (void *) &main_thread, NULL); - D_THREADS(("done? :)\n")); - while (1); - /* main_loop(); */ -#else - main_loop(); /* main processing loop */ -#endif - - return (EXIT_SUCCESS); + return (eterm_bootstrap(argc, argv)); } -/* EOF */ diff --git a/src/menus.c b/src/menus.c index 0e47c0b..81f5b46 100644 --- a/src/menus.c +++ b/src/menus.c @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ static const char cvs_ident[] = "$Id$"; #include "e.h" #include "events.h" #include "font.h" -#include "main.h" +#include "startup.h" #include "menus.h" #include "misc.h" #include "options.h" @@ -615,8 +615,8 @@ menuitem_create(char *text) menuitem_t *menuitem; - menuitem = (menuitem_t *) MALLOC(sizeof(menu_t)); - MEMSET(menuitem, 0, sizeof(menu_t)); + menuitem = (menuitem_t *) MALLOC(sizeof(menuitem_t)); + MEMSET(menuitem, 0, sizeof(menuitem_t)); if (text) { menuitem->text = StrDup(text); diff --git a/src/menus.h b/src/menus.h index b275ec9..9dcd315 100644 --- a/src/menus.h +++ b/src/menus.h @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/misc.c b/src/misc.c index 8b24956..e2e6e82 100644 --- a/src/misc.c +++ b/src/misc.c @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ static const char cvs_ident[] = "$Id$"; #include "../libmej/mem.h" #include "../libmej/strings.h" #include "command.h" -#include "main.h" +#include "startup.h" #include "misc.h" #include "options.h" diff --git a/src/misc.h b/src/misc.h index bd4e1c7..45a5091 100644 --- a/src/misc.h +++ b/src/misc.h @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/netdisp.c b/src/netdisp.c index a23971c..20b2e63 100644 --- a/src/netdisp.c +++ b/src/netdisp.c @@ -62,7 +62,7 @@ static const char cvs_ident[] = "$Id$"; #include #include -#include "main.h" +#include "startup.h" /* return a pointer to a static buffer */ char * diff --git a/src/options.c b/src/options.c index aa24c78..26dead7 100644 --- a/src/options.c +++ b/src/options.c @@ -6,7 +6,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ static const char cvs_ident[] = "$Id$"; #include "events.h" #include "font.h" #include "grkelot.h" -#include "main.h" +#include "startup.h" #include "menus.h" #include "options.h" #include "pixmap.h" @@ -210,24 +210,6 @@ char *rs_mfont[NFONTS]; char *rs_print_pipe = NULL; #endif char *rs_cutchars = NULL; -const char *rs_loginShell = NULL; -const char *rs_utmpLogging = NULL; -const char *rs_scrollBar = NULL; -const char *rs_install = NULL; -const char *rs_app_keypad = NULL; -const char *rs_app_cursor = NULL; -const char *rs_homeOnEcho = NULL; -const char *rs_homeOnInput = NULL; -const char *rs_homeOnRefresh = NULL; -const char *rs_scrollBar_right = NULL; -const char *rs_scrollBar_floating = NULL; -const char *rs_scrollbar_popup = NULL; -const char *rs_borderless = NULL; -const char *rs_pause = NULL; -const char *rs_xterm_select = NULL; -const char *rs_select_whole_line = NULL; -const char *rs_select_trailing_spaces = NULL; -const char *rs_report_as_keysyms = NULL; unsigned short rs_min_anchor_size = 0; char *rs_scrollbar_type = NULL; unsigned long rs_scrollbar_width = 0; @@ -236,16 +218,6 @@ char *rs_term_name = NULL; static char *rs_bigfont_key = NULL; static char *rs_smallfont_key = NULL; #endif -#ifndef NO_MAPALERT -# ifdef MAPALERT_OPTION -static const char *rs_mapAlert = NULL; -# endif -#endif -static const char *rs_visualBell = NULL; -static const char *rs_reverseVideo = NULL; -#ifdef META8_OPTION -static const char *rs_meta8 = NULL; -#endif #ifdef MULTI_CHARSET static char *rs_multchar_encoding = NULL; #endif @@ -267,7 +239,6 @@ time_t rs_anim_delay = 0; # endif static char *rs_pixmaps[image_max]; #endif -char *rs_noCursor = NULL; char *rs_theme = NULL; char *rs_config_file = NULL; unsigned int rs_line_space = 0; @@ -307,13 +278,13 @@ static const struct { #else OPT_ILONG("debug", "level of debugging information to show (0-5)", &debug_level), #endif - OPT_BLONG("install", "install a private colormap", &rs_install, &Options, Opt_install), + OPT_BLONG("install", "install a private colormap", &Options, Opt_install), - OPT_BOOL('h', "help", "display usage information", NULL, NULL, 0), - OPT_BLONG("version", "display version and configuration information", NULL, NULL, 0), + OPT_BOOL('h', "help", "display usage information", NULL, 0), + OPT_BLONG("version", "display version and configuration information", NULL, 0), /* =======[ Color options ]======= */ - OPT_BOOL('r', "reverse-video", "reverse video", &rs_reverseVideo, &Options, Opt_reverseVideo), + OPT_BOOL('r', "reverse-video", "reverse video", &Options, Opt_reverseVideo), OPT_STR('b', "background-color", "background color", &rs_color[bgColor]), OPT_STR('f', "foreground-color", "foreground color", &rs_color[fgColor]), OPT_LONG("color0", "color 0", &rs_color[minColor]), @@ -351,7 +322,7 @@ static const struct { /* =======[ X11 options ]======= */ OPT_STR('g', "geometry", "WxH+X+Y = size and position", &rs_geometry), - OPT_BOOL('i', "iconic", "start iconified", NULL, &Options, Opt_iconic), + OPT_BOOL('i', "iconic", "start iconified", &Options, Opt_iconic), OPT_STR('n', "name", "client instance, icon, and title strings", &rs_name), OPT_STR('T', "title", "title string", &rs_title), OPT_LONG("icon-name", "icon name", &rs_iconName), @@ -377,8 +348,8 @@ static const struct { OPT_LONG("trough-pixmap", "scrollbar background (trough) pixmap [scaling optional]", &rs_pixmaps[image_sb]), OPT_LONG("anchor-pixmap", "scrollbar anchor pixmap [scaling optional]", &rs_pixmaps[image_sa]), OPT_LONG("menu-pixmap", "menu pixmap [scaling optional]", &rs_pixmaps[image_menu]), - OPT_BOOL('O', "trans", "creates a pseudo-transparent Eterm", NULL, &image_toggles, IMOPT_TRANS), - OPT_BLONG("viewport-mode", "use viewport mode for the background image", NULL, &image_toggles, IMOPT_VIEWPORT), + OPT_BOOL('O', "trans", "creates a pseudo-transparent Eterm", &image_toggles, IMOPT_TRANS), + OPT_BLONG("viewport-mode", "use viewport mode for the background image", &image_toggles, IMOPT_VIEWPORT), OPT_LONG("cmod", "image color modifier (\"brightness contrast gamma\")", &rs_cmod_image), OPT_LONG("cmod-red", "red-only color modifier (\"brightness contrast gamma\")", &rs_cmod_red), OPT_LONG("cmod-green", "green-only color modifier (\"brightness contrast gamma\")", &rs_cmod_green), @@ -405,32 +376,32 @@ static const struct { #endif /* =======[ Toggles ]======= */ - OPT_BOOL('l', "login-shell", "login shell, prepend - to shell name", &rs_loginShell, &Options, Opt_loginShell), - OPT_BOOL('s', "scrollbar", "display scrollbar", &rs_scrollBar, &Options, Opt_scrollBar), - OPT_BOOL('u', "utmp-logging", "make a utmp entry", &rs_utmpLogging, &Options, Opt_utmpLogging), - OPT_BOOL('v', "visual-bell", "visual bell", &rs_visualBell, &Options, Opt_visualBell), - OPT_BOOL('H', "home-on-echo", "jump to bottom on output", &rs_homeOnEcho, &Options, Opt_homeOnEcho), - OPT_BLONG("home-on-input", "jump to bottom on input", &rs_homeOnInput, &Options, Opt_homeOnInput), - OPT_BOOL('E', "home-on-refresh", "jump to bottom on refresh (^L)", &rs_homeOnRefresh, &Options, Opt_homeOnRefresh), - OPT_BLONG("scrollbar-right", "display the scrollbar on the right", &rs_scrollBar_right, &Options, Opt_scrollBar_right), - OPT_BLONG("scrollbar-floating", "display the scrollbar with no trough", &rs_scrollBar_floating, &Options, Opt_scrollBar_floating), - OPT_BLONG("scrollbar-popup", "popup the scrollbar only when focused", &rs_scrollbar_popup, &Options, Opt_scrollbar_popup), - OPT_BOOL('x', "borderless", "force Eterm to have no borders", &rs_borderless, &Options, Opt_borderless), + OPT_BOOL('l', "login-shell", "login shell, prepend - to shell name", &Options, Opt_loginShell), + OPT_BOOL('s', "scrollbar", "display scrollbar", &Options, Opt_scrollBar), + OPT_BOOL('u', "utmp-logging", "make a utmp entry", &Options, Opt_utmpLogging), + OPT_BOOL('v', "visual-bell", "visual bell", &Options, Opt_visualBell), + OPT_BOOL('H', "home-on-echo", "jump to bottom on output", &Options, Opt_homeOnEcho), + OPT_BLONG("home-on-input", "jump to bottom on input", &Options, Opt_homeOnInput), + OPT_BOOL('E', "home-on-refresh", "jump to bottom on refresh (^L)", &Options, Opt_homeOnRefresh), + OPT_BLONG("scrollbar-right", "display the scrollbar on the right", &Options, Opt_scrollBar_right), + OPT_BLONG("scrollbar-floating", "display the scrollbar with no trough", &Options, Opt_scrollBar_floating), + OPT_BLONG("scrollbar-popup", "popup the scrollbar only when focused", &Options, Opt_scrollbar_popup), + OPT_BOOL('x', "borderless", "force Eterm to have no borders", &Options, Opt_borderless), #ifndef NO_MAPALERT # ifdef MAPALERT_OPTION - OPT_BOOL('m', "map-alert", "uniconify on beep", &rs_mapAlert, &Options, Opt_mapAlert), + OPT_BOOL('m', "map-alert", "uniconify on beep", &Options, Opt_mapAlert), # endif #endif #ifdef META8_OPTION - OPT_BOOL('8', "meta-8", "Meta key toggles 8-bit", &rs_meta8, &Options, Opt_meta8), + OPT_BOOL('8', "meta-8", "Meta key toggles 8-bit", &Options, Opt_meta8), #endif - OPT_BLONG("backing-store", "use backing store", &rs_backing_store, &Options, Opt_backing_store), - OPT_BLONG("no-cursor", "disable the text cursor", &rs_noCursor, &Options, Opt_noCursor), - OPT_BLONG("pause", "pause for a keypress after the child process exits", &rs_pause, &Options, Opt_pause), - OPT_BLONG("xterm-select", "duplicate xterm's broken selection behavior", &rs_xterm_select, &Options, Opt_xterm_select), - OPT_BLONG("select-line", "triple-click selects whole line", &rs_select_whole_line, &Options, Opt_select_whole_line), - OPT_BLONG("select-trailing-spaces", "do not skip trailing spaces when selecting", &rs_select_trailing_spaces, &Options, Opt_select_trailing_spaces), - OPT_BLONG("report-as-keysyms", "report special keys as keysyms", &rs_report_as_keysyms, &Options, Opt_report_as_keysyms), + OPT_BLONG("backing-store", "use backing store", &Options, Opt_backing_store), + OPT_BLONG("no-cursor", "disable the text cursor", &Options, Opt_noCursor), + OPT_BLONG("pause", "pause for a keypress after the child process exits", &Options, Opt_pause), + OPT_BLONG("xterm-select", "duplicate xterm's broken selection behavior", &Options, Opt_xterm_select), + OPT_BLONG("select-line", "triple-click selects whole line", &Options, Opt_select_whole_line), + OPT_BLONG("select-trailing-spaces", "do not skip trailing spaces when selecting", &Options, Opt_select_trailing_spaces), + OPT_BLONG("report-as-keysyms", "report special keys as keysyms", &Options, Opt_report_as_keysyms), /* =======[ Keyboard options ]======= */ #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) @@ -440,8 +411,8 @@ static const struct { #ifdef GREEK_SUPPORT OPT_LONG("greek-keyboard", "greek keyboard mapping (iso or ibm)", &rs_greek_keyboard), #endif - OPT_BLONG("app-keypad", "application keypad mode", &rs_app_keypad, &PrivateModes, PrivMode_aplKP), - OPT_BLONG("app-cursor", "application cursor key mode", &rs_app_cursor, &PrivateModes, PrivMode_aplCUR), + OPT_BLONG("app-keypad", "application keypad mode", &PrivateModes, PrivMode_aplKP), + OPT_BLONG("app-cursor", "application cursor key mode", &PrivateModes, PrivMode_aplCUR), /* =======[ Misc options ]======= */ OPT_INT('L', "save-lines", "lines to save in scrollback buffer", &rs_saveLines), @@ -456,7 +427,7 @@ static const struct { OPT_LONG("cut-chars", "seperators for double-click selection", &rs_cutchars), #endif /* CUTCHAR_OPTION */ OPT_LONG("term-name", "value to use for setting $TERM", &rs_term_name), - OPT_BOOL('C', "console", "grab console messages", NULL, &Options, Opt_console), + OPT_BOOL('C', "console", "grab console messages", &Options, Opt_console), OPT_ARGS('e', "exec", "execute a command rather than a shell", &rs_execArgs) }; @@ -1052,17 +1023,11 @@ get_options(int argc, char *argv[]) if (optList[j].maskvar) { *(optList[j].maskvar) |= optList[j].mask; } - if (optList[j].pval) { - *((const char **) optList[j].pval) = *true_vals; - } } else if (BOOL_OPT_ISFALSE(val_ptr)) { D_OPTIONS(("\"%s\" == FALSE\n", val_ptr)); if (optList[j].maskvar) { *(optList[j].maskvar) &= ~(optList[j].mask); } - if (optList[j].pval) { - *((const char **) optList[j].pval) = *false_vals; - } } else { print_error("unrecognized boolean value \"%s\" for option --%s", val_ptr, optList[j].long_opt); @@ -1073,9 +1038,6 @@ get_options(int argc, char *argv[]) if (optList[j].maskvar) { *(optList[j].maskvar) |= optList[j].mask; } - if (optList[j].pval) { - *((const char **) optList[j].pval) = *true_vals; - } } } else if (optList[j].flag & OPT_INTEGER) { /* Integer value */ D_OPTIONS(("Integer option detected\n")); @@ -1172,9 +1134,6 @@ get_options(int argc, char *argv[]) if (optList[j].maskvar) { *(optList[j].maskvar) |= optList[j].mask; } - if (optList[j].pval) { - *((const char **) optList[j].pval) = *true_vals; - } } else if (optList[j].flag & OPT_INTEGER) { /* Integer value */ D_OPTIONS(("Integer option detected\n")); *((int *) optList[j].pval) = strtol(val_ptr, (char **) NULL, 0); @@ -1253,26 +1212,17 @@ get_initial_options(int argc, char *argv[]) if (optList[j].maskvar) { *(optList[j].maskvar) |= optList[j].mask; } - if (optList[j].pval) { - *((const char **) optList[j].pval) = *true_vals; - } } else if (BOOL_OPT_ISFALSE(val_ptr)) { D_OPTIONS(("\"%s\" == FALSE\n", val_ptr)); if (optList[j].maskvar) { *(optList[j].maskvar) &= ~(optList[j].mask); } - if (optList[j].pval) { - *((const char **) optList[j].pval) = *false_vals; - } } } else { /* No value, so force it on */ D_OPTIONS(("Forcing option --%s to TRUE\n", opt)); if (optList[j].maskvar) { *(optList[j].maskvar) |= optList[j].mask; } - if (optList[j].pval) { - *((const char **) optList[j].pval) = *true_vals; - } } } else { D_OPTIONS(("String option detected\n")); @@ -1354,7 +1304,7 @@ builtin_version(char *param) D_PARSE(("builtin_version(%s) called\n", param)); - return (Word(1, VERSION)); + return (StrDup(VERSION)); } char * @@ -1363,7 +1313,7 @@ builtin_appname(char *param) D_PARSE(("builtin_appname(%s) called\n", param)); - return (Word(1, APL_NAME "-" VERSION)); + return (StrDup(APL_NAME "-" VERSION)); } /* chomp() removes leading and trailing whitespace/quotes from a string */ @@ -1690,42 +1640,42 @@ parse_color(char *buff) ASSERT(buff != NULL); if (!BEG_STRCASECMP(buff, "foreground ")) { - rs_color[fgColor] = Word(2, buff); + RESET_AND_ASSIGN(rs_color[fgColor], Word(2, buff)); } else if (!BEG_STRCASECMP(buff, "background ")) { - rs_color[bgColor] = Word(2, buff); + RESET_AND_ASSIGN(rs_color[bgColor], Word(2, buff)); } else if (!BEG_STRCASECMP(buff, "cursor ")) { #ifndef NO_CURSORCOLOR - rs_color[cursorColor] = Word(2, buff); + RESET_AND_ASSIGN(rs_color[cursorColor], Word(2, buff)); #else print_warning("Support for the cursor attribute was not compiled in, ignoring"); #endif } else if (!BEG_STRCASECMP(buff, "cursor_text ")) { #ifndef NO_CURSORCOLOR - rs_color[cursorColor2] = Word(2, buff); + RESET_AND_ASSIGN(rs_color[cursorColor2], Word(2, buff)); #else print_warning("Support for the cursor_text attribute was not compiled in, ignoring"); #endif } else if (!BEG_STRCASECMP(buff, "menu ")) { - rs_color[menuColor] = Word(2, buff); + RESET_AND_ASSIGN(rs_color[menuColor], Word(2, buff)); } else if (!BEG_STRCASECMP(buff, "menu_text ")) { - rs_color[menuTextColor] = Word(2, buff); + RESET_AND_ASSIGN(rs_color[menuTextColor], Word(2, buff)); } else if (!BEG_STRCASECMP(buff, "scrollbar ")) { - rs_color[scrollColor] = Word(2, buff); + RESET_AND_ASSIGN(rs_color[scrollColor], Word(2, buff)); } else if (!BEG_STRCASECMP(buff, "unfocusedmenu ")) { - rs_color[unfocusedMenuColor] = Word(2, buff); + RESET_AND_ASSIGN(rs_color[unfocusedMenuColor], Word(2, buff)); } else if (!BEG_STRCASECMP(buff, "unfocusedscrollbar ")) { - rs_color[unfocusedScrollColor] = Word(2, buff); + RESET_AND_ASSIGN(rs_color[unfocusedScrollColor], Word(2, buff)); } else if (!BEG_STRCASECMP(buff, "pointer ")) { - rs_color[pointerColor] = Word(2, buff); + RESET_AND_ASSIGN(rs_color[pointerColor], Word(2, buff)); } else if (!BEG_STRCASECMP(buff, "video ")) { @@ -1733,7 +1683,6 @@ parse_color(char *buff) if (!BEG_STRCASECMP(tmp, "reverse")) { Options |= Opt_reverseVideo; - rs_reverseVideo = *true_vals; } else if (BEG_STRCASECMP(tmp, "normal")) { print_error("Parse error in file %s, line %lu: Invalid value \"%s\" for attribute video", file_peek_path(), file_peek_line(), tmp); @@ -1759,19 +1708,19 @@ parse_color(char *buff) } else if (n >= 8 && n <= 15) { index = minBright + n - 8; } - rs_color[index] = Word(1, r1); + RESET_AND_ASSIGN(rs_color[index], Word(1, r1)); return; } else { if (!BEG_STRCASECMP(tmp, "bd ")) { #ifndef NO_BOLDUNDERLINE - rs_color[colorBD] = Word(1, r1); + RESET_AND_ASSIGN(rs_color[colorBD], Word(1, r1)); #else print_warning("Support for the color bd attribute was not compiled in, ignoring"); #endif return; } else if (!BEG_STRCASECMP(tmp, "ul ")) { #ifndef NO_BOLDUNDERLINE - rs_color[colorUL] = Word(1, r1); + RESET_AND_ASSIGN(rs_color[colorUL], Word(1, r1)); #else print_warning("Support for the color ul attribute was not compiled in, ignoring"); #endif @@ -1798,11 +1747,11 @@ parse_color(char *buff) b = strtoul(b1, (char **) NULL, 0); if (n <= 7) { index = minColor + n; - rs_color[index] = MALLOC(14); + RESET_AND_ASSIGN(rs_color[index], MALLOC(14)); sprintf(rs_color[index], "#%02x%02x%02x", r, g, b); } else if (n >= 8 && n <= 15) { index = minBright + n - 8; - rs_color[index] = MALLOC(14); + RESET_AND_ASSIGN(rs_color[index], MALLOC(14)); sprintf(rs_color[index], "#%02x%02x%02x", r, g, b); } else { print_error("Parse error in file %s, line %lu: Invalid color index %lu", @@ -1811,7 +1760,7 @@ parse_color(char *buff) } else if (!BEG_STRCASECMP(tmp, "bd ")) { #ifndef NO_BOLDUNDERLINE - rs_color[colorBD] = MALLOC(14); + RESET_AND_ASSIGN(rs_color[colorBD], MALLOC(14)); r = strtoul(r1, (char **) NULL, 0); g = strtoul(g1, (char **) NULL, 0); b = strtoul(b1, (char **) NULL, 0); @@ -1822,7 +1771,7 @@ parse_color(char *buff) } else if (!BEG_STRCASECMP(tmp, "ul ")) { #ifndef NO_BOLDUNDERLINE - rs_color[colorUL] = MALLOC(14); + RESET_AND_ASSIGN(rs_color[colorUL], MALLOC(14)); r = strtoul(r1, (char **) NULL, 0); g = strtoul(g1, (char **) NULL, 0); b = strtoul(b1, (char **) NULL, 0); @@ -1883,14 +1832,14 @@ parse_attributes(char *buff) if (isdigit(*tmp)) { n = (unsigned char) strtoul(tmp, (char **) NULL, 0); if (n <= 4) { - rs_font[n] = Word(2, tmp); + RESET_AND_ASSIGN(rs_font[n], Word(2, tmp)); } else { print_error("Parse error in file %s, line %lu: Invalid font index %d", file_peek_path(), file_peek_line(), n); } } else if (!BEG_STRCASECMP(tmp, "bold ")) { #ifndef NO_BOLDFONT - rs_boldFont = Word(2, tmp); + RESET_AND_ASSIGN(rs_boldFont, Word(2, tmp)); #else print_warning("Support for the bold font attribute was not compiled in, ignoring"); #endif @@ -1935,10 +1884,8 @@ parse_toggles(char *buff) #if !defined(NO_MAPALERT) && defined(MAPALERT_OPTION) if (bool_val) { Options |= Opt_mapAlert; - rs_mapAlert = *true_vals; } else { Options &= ~(Opt_mapAlert); - rs_mapAlert = *false_vals; } #else print_warning("Support for the map_alert attribute was not compiled in, ignoring"); @@ -1947,36 +1894,28 @@ parse_toggles(char *buff) } else if (!BEG_STRCASECMP(buff, "visual_bell ")) { if (bool_val) { Options |= Opt_visualBell; - rs_visualBell = *true_vals; } else { Options &= ~(Opt_visualBell); - rs_visualBell = *false_vals; } } else if (!BEG_STRCASECMP(buff, "login_shell ")) { if (bool_val) { Options |= Opt_loginShell; - rs_loginShell = *true_vals; } else { Options &= ~(Opt_loginShell); - rs_loginShell = *false_vals; } } else if (!BEG_STRCASECMP(buff, "scrollbar ")) { if (bool_val) { Options |= Opt_scrollBar; - rs_scrollBar = *true_vals; } else { Options &= ~(Opt_scrollBar); - rs_scrollBar = *false_vals; } } else if (!BEG_STRCASECMP(buff, "utmp_logging ")) { #ifdef UTMP_SUPPORT if (bool_val) { Options |= Opt_utmpLogging; - rs_utmpLogging = *true_vals; } else { Options &= ~(Opt_utmpLogging); - rs_utmpLogging = *false_vals; } #else print_warning("Support for the utmp_logging attribute was not compiled in, ignoring"); @@ -1986,10 +1925,8 @@ parse_toggles(char *buff) #ifdef META8_OPTION if (bool_val) { Options |= Opt_meta8; - rs_meta8 = *true_vals; } else { Options &= ~(Opt_meta8); - rs_meta8 = *false_vals; } #else print_warning("Support for the meta8 attribute was not compiled in, ignoring"); @@ -2005,124 +1942,96 @@ parse_toggles(char *buff) } else if (!BEG_STRCASECMP(buff, "home_on_echo ")) { if (bool_val) { Options |= Opt_homeOnEcho; - rs_homeOnEcho = *true_vals; } else { Options &= ~(Opt_homeOnEcho); - rs_homeOnEcho = *false_vals; } } else if (!BEG_STRCASECMP(buff, "home_on_input ")) { if (bool_val) { Options |= Opt_homeOnInput; - rs_homeOnInput = *true_vals; } else { Options &= ~(Opt_homeOnInput); - rs_homeOnInput = *false_vals; } } else if (!BEG_STRCASECMP(buff, "home_on_refresh ")) { if (bool_val) { Options |= Opt_homeOnRefresh; - rs_homeOnRefresh = *true_vals; } else { Options &= ~(Opt_homeOnRefresh); - rs_homeOnRefresh = *false_vals; } } else if (!BEG_STRCASECMP(buff, "scrollbar_floating ")) { if (bool_val) { Options |= Opt_scrollBar_floating; - rs_scrollBar_floating = *true_vals; } else { Options &= ~(Opt_scrollBar_floating); - rs_scrollBar_floating = *false_vals; } } else if (!BEG_STRCASECMP(buff, "scrollbar_right ")) { if (bool_val) { Options |= Opt_scrollBar_right; - rs_scrollBar_right = *true_vals; } else { Options &= ~(Opt_scrollBar_right); - rs_scrollBar_right = *false_vals; } } else if (!BEG_STRCASECMP(buff, "scrollbar_popup ")) { if (bool_val) { Options |= Opt_scrollbar_popup; - rs_scrollbar_popup = *true_vals; } else { Options &= ~(Opt_scrollbar_popup); - rs_scrollbar_popup = *false_vals; } } else if (!BEG_STRCASECMP(buff, "borderless ")) { if (bool_val) { Options |= Opt_borderless; - rs_borderless = *true_vals; } else { Options &= ~(Opt_borderless); - rs_borderless = *false_vals; } } else if (!BEG_STRCASECMP(buff, "backing_store ")) { if (bool_val) { Options |= Opt_backing_store; - rs_backing_store = *true_vals; } else { Options &= ~(Opt_backing_store); - rs_backing_store = *false_vals; } } else if (!BEG_STRCASECMP(buff, "no_cursor ")) { if (bool_val) { Options |= Opt_noCursor; - rs_noCursor = (char *) true_vals; } else { Options &= ~(Opt_noCursor); - rs_noCursor = (char *) false_vals; } } else if (!BEG_STRCASECMP(buff, "pause ")) { if (bool_val) { Options |= Opt_pause; - rs_pause = (char *) true_vals; } else { Options &= ~(Opt_pause); - rs_pause = (char *) false_vals; } } else if (!BEG_STRCASECMP(buff, "xterm_select ")) { if (bool_val) { Options |= Opt_xterm_select; - rs_xterm_select = (char *) true_vals; } else { Options &= ~(Opt_xterm_select); - rs_xterm_select = (char *) false_vals; } } else if (!BEG_STRCASECMP(buff, "select_line ")) { if (bool_val) { Options |= Opt_select_whole_line; - rs_select_whole_line = (char *) true_vals; } else { Options &= ~(Opt_select_whole_line); - rs_select_whole_line = (char *) false_vals; } } else if (!BEG_STRCASECMP(buff, "select_trailing_spaces ")) { if (bool_val) { Options |= Opt_select_trailing_spaces; - rs_select_trailing_spaces = (char *) true_vals; } else { Options &= ~(Opt_select_trailing_spaces); - rs_select_trailing_spaces = (char *) false_vals; } } else if (!BEG_STRCASECMP(buff, "report_as_keysyms ")) { if (bool_val) { Options |= Opt_report_as_keysyms; - rs_report_as_keysyms = (char *) true_vals; } else { Options &= ~(Opt_report_as_keysyms); - rs_report_as_keysyms = (char *) false_vals; } } else { @@ -2231,10 +2140,8 @@ parse_keyboard(char *buff) } if (BOOL_OPT_ISTRUE(tmp)) { PrivateModes |= PrivMode_aplKP; - rs_app_keypad = (char *) true_vals; } else if (BOOL_OPT_ISFALSE(tmp)) { PrivateModes &= ~(PrivMode_aplKP); - rs_app_keypad = (char *) false_vals; } else { print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for " "attribute app_keypad", file_peek_path(), file_peek_line(), tmp); @@ -2252,10 +2159,8 @@ parse_keyboard(char *buff) } if (BOOL_OPT_ISTRUE(tmp)) { PrivateModes |= PrivMode_aplCUR; - rs_app_cursor = (char *) true_vals; } else if (BOOL_OPT_ISFALSE(tmp)) { PrivateModes &= ~(PrivMode_aplCUR); - rs_app_cursor = (char *) false_vals; } else { print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for " "attribute app_cursor", file_peek_path(), file_peek_line(), tmp); @@ -2713,7 +2618,6 @@ parse_actions(char *buff) } if (!str) { print_error("Parse error in file %s, line %lu: Syntax error (\"to\" not found)", file_peek_path(), file_peek_line()); - FREE(str); return; } FREE(str); @@ -2774,6 +2678,7 @@ parse_menu(char *buff) return; } menu_set_font(curmenu, name); + FREE(name); } else if (!BEG_STRCASECMP(buff, "sep") || !BEG_STRCASECMP(buff, "-")) { menuitem_t *item; @@ -2846,9 +2751,9 @@ parse_xim(char *buff) #ifdef USE_XIM if (!BEG_STRCASECMP(buff, "input_method ")) { - rs_inputMethod = Word(2, buff); + RESET_AND_ASSIGN(rs_inputMethod, Word(2, buff)); } else if (!BEG_STRCASECMP(buff, "preedit_type ")) { - rs_preeditType = Word(2, buff); + RESET_AND_ASSIGN(rs_preeditType, Word(2, buff)); } else { print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context xim", file_peek_path(), file_peek_line(), buff); @@ -2867,7 +2772,8 @@ parse_multichar(char *buff) #ifdef MULTI_CHARSET if (!BEG_STRCASECMP(buff, "encoding ")) { - if ((rs_multchar_encoding = Word(2, buff)) != NULL) { + RESET_AND_ASSIGN(rs_multchar_encoding, Word(2, buff)); + if (rs_multchar_encoding != NULL) { if (BEG_STRCASECMP(rs_multchar_encoding, "eucj") && BEG_STRCASECMP(rs_multchar_encoding, "sjis") && BEG_STRCASECMP(rs_multchar_encoding, "euckr")) { @@ -2893,7 +2799,7 @@ parse_multichar(char *buff) if (isdigit(*tmp)) { n = (unsigned char) strtoul(tmp, (char **) NULL, 0); if (n <= 4) { - rs_mfont[n] = Word(2, tmp); + RESET_AND_ASSIGN(rs_mfont[n], Word(2, tmp)); } else { print_error("Parse error in file %s, line %lu: Invalid font index %d", file_peek_path(), file_peek_line(), n); @@ -2901,7 +2807,7 @@ parse_multichar(char *buff) } else { tmp = Word(1, tmp); print_error("Parse error in file %s, line %lu: Invalid font index \"%s\"", - file_peek_path(), file_peek_line(), (tmp ? tmp : "")); + file_peek_path(), file_peek_line(), NONULL(tmp)); FREE(tmp); } } else { diff --git a/src/options.h b/src/options.h index 4f55486..f324601 100644 --- a/src/options.h +++ b/src/options.h @@ -6,7 +6,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,10 +38,10 @@ #define OPT_STR(s, l, d, p) { s, l, "(str) " d, OPT_STRING, (const char **) p, 0, 0 } #define OPT_INT(s, l, d, p) { s, l, "(int) " d, OPT_INTEGER, (const int *) p, 0, 0 } -#define OPT_BOOL(s, l, d, p, v, m) { s, l, "(bool) " d, OPT_BOOLEAN, (const int *) p, v, m } +#define OPT_BOOL(s, l, d, v, m) { s, l, "(bool) " d, OPT_BOOLEAN, NULL, v, m } #define OPT_LONG(l, d, p) { 0, l, "(str) " d, OPT_STRING, (const char **) p, 0, 0 } #define OPT_ARGS(s, l, d, p) { s, l, "(str) " d, OPT_ARGUMENT, (const char ***) p, 0, 0 } -#define OPT_BLONG(l, d, p, v, m) { 0, l, "(bool) " d, OPT_BOOLEAN, (const int *) p, v, m } +#define OPT_BLONG(l, d, v, m) { 0, l, "(bool) " d, OPT_BOOLEAN, NULL, v, m } #define OPT_ILONG(l, d, p) { 0, l, "(int) " d, OPT_INTEGER, (const int *) p, 0, 0 } #define optList_numoptions() (sizeof(optList)/sizeof(optList[0])) @@ -214,15 +214,9 @@ extern char *rs_geometry; /* Geometry string */ extern int rs_desktop; /* Startup desktop */ extern int rs_saveLines; /* Lines in the scrollback buffer */ extern unsigned short rs_min_anchor_size; /* Minimum size, in pixels, of the scrollbar anchor */ -extern const char *rs_scrollBar_right; -extern const char *rs_scrollBar_floating; -extern const char *rs_scrollbar_popup; -extern char *rs_viewport_mode; extern char *rs_term_name; extern const char *rs_menubar; extern const char *rs_menu; -extern const char *rs_menubar_move; -extern const char *rs_pause; extern char *rs_icon; extern char *rs_scrollbar_type; extern unsigned long rs_scrollbar_width; @@ -231,14 +225,12 @@ extern char *rs_anim_pixmap_list; extern char **rs_anim_pixmaps; extern time_t rs_anim_delay; extern char *rs_path; -extern const char *rs_saveUnder; extern char *rs_noCursor; #ifdef USE_XIM extern char *rs_inputMethod; extern char *rs_preeditType; #endif extern char *rs_name; -extern char *rs_pixmapScale; extern char *rs_config_file; extern unsigned int rs_line_space; #ifndef NO_BOLDFONT diff --git a/src/pixmap.c b/src/pixmap.c index 29239ea..ca85cd9 100644 --- a/src/pixmap.c +++ b/src/pixmap.c @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ static const char cvs_ident[] = "$Id$"; #include "../libmej/mem.h" #include "../libmej/strings.h" #include "e.h" -#include "main.h" +#include "startup.h" #include "menus.h" #include "options.h" #include "pixmap.h" diff --git a/src/pixmap.h b/src/pixmap.h index edab167..6a73983 100644 --- a/src/pixmap.h +++ b/src/pixmap.h @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/screen.c b/src/screen.c index c0f2b20..66b06e7 100644 --- a/src/screen.c +++ b/src/screen.c @@ -25,7 +25,7 @@ static const char cvs_ident[] = "$Id$"; #include "../libmej/debug.h" #include "command.h" #include "debug.h" -#include "main.h" +#include "startup.h" #include "mem.h" #include "graphics.h" #include "screen.h" diff --git a/src/screen.h b/src/screen.h index 6424ff8..387e616 100644 --- a/src/screen.h +++ b/src/screen.h @@ -14,7 +14,7 @@ #define _SCREEN_H #include -#include "main.h" +#include "startup.h" /************ Macros and Definitions ************/ #define WRAP_CHAR (MAX_COLS + 1) diff --git a/src/scrollbar.c b/src/scrollbar.c index 88adf6c..74a3166 100644 --- a/src/scrollbar.c +++ b/src/scrollbar.c @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +35,7 @@ static const char cvs_ident[] = "$Id$"; #include "command.h" #include "e.h" #include "events.h" -#include "main.h" +#include "startup.h" #include "options.h" #ifdef PIXMAP_SCROLLBAR # include "pixmap.h" diff --git a/src/scrollbar.h b/src/scrollbar.h index 99e92fc..3421eba 100644 --- a/src/scrollbar.h +++ b/src/scrollbar.h @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/startup.c b/src/startup.c new file mode 100644 index 0000000..2b93836 --- /dev/null +++ b/src/startup.c @@ -0,0 +1,327 @@ +/* startup.c -- Eterm startup code + * -- 7 October 1999, mej + * + * This file is original work by Michael Jennings and + * Tuomo Venalainen . This file, and any other file + * bearing this same message or a similar one, is distributed under + * the GNU Public License (GPL) as outlined in the COPYING file. + * + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +static const char cvs_ident[] = "$Id$"; + +#include "config.h" +#include "feature.h" + +#include +#include +#include +#ifdef HAVE_UNISTD_H +# include +#endif +#include +#include +#include +#include +#include +#include +#include + +#include "../libmej/debug.h" /* from libmej */ +#include "debug.h" +#include "../libmej/mem.h" +#include "../libmej/strings.h" +#include "startup.h" +#include "actions.h" +#include "command.h" +#include "eterm_utmp.h" +#include "events.h" +#include "graphics.h" +#include "options.h" +#include "pixmap.h" +#include "screen.h" +#include "scrollbar.h" +#include "term.h" +#ifdef USE_POSIX_THREADS +# include "threads.h" +#endif +#include "windows.h" + +char *orig_argv0; + +#ifdef PIXMAP_SUPPORT +/* Set to one in case there is no WM, or a lousy one + that doesn't send the right events (*cough* + Window Maker *cough*) -- mej */ +short bg_needs_update = 1; +#endif +#ifdef USE_POSIX_THREADS +static void **retval; +static int join_value; +static pthread_t main_loop_thr; +static pthread_attr_t main_loop_attr; +# ifdef MUTEX_SYNCH +pthread_mutex_t mutex; +# endif +#endif +TermWin_t TermWin; +Display *Xdisplay; /* display */ +Colormap cmap; +unsigned int debug_level = 0; /* Level of debugging information to display */ +const char *display_name = NULL; +unsigned int colorfgbg; + +int +eterm_bootstrap(int argc, char *argv[]) +{ + + int i; + char *val; + static char windowid_string[20], *display_string, *term_string; /* "WINDOWID=\0" = 10 chars, UINT_MAX = 10 chars */ + ImlibInitParams params; + + orig_argv0 = argv[0]; + +#ifdef USE_POSIX_THREADS +# ifdef MUTEX_SYNCH + pthread_atfork((void *) &prepare, (void *) &parent, (void *) &child); +# endif +#endif + + /* Security enhancements -- mej */ + putenv("IFS= \t\n"); + my_ruid = getuid(); + my_euid = geteuid(); + my_rgid = getgid(); + my_egid = getegid(); + privileges(REVERT); + getcwd(initial_dir, PATH_MAX); + + init_defaults(); + + /* Open display, get options/resources and create the window */ + if ((display_name = getenv("DISPLAY")) == NULL) + display_name = ":0"; + + /* This MUST be called before any other Xlib functions */ + +#ifdef USE_POSIX_THREADS + if (XInitThreads()) { + D_THREADS(("XInitThreads() succesful\n")); + } else { + D_THREADS(("XInitThreads() failed, I'm outta here\n")); + } +#endif + + get_initial_options(argc, argv); +#ifdef NEED_LINUX_HACK + privileges(INVOKE); /* xdm in new Linux versions requires ruid != root to open the display -- mej */ +#endif + Xdisplay = XOpenDisplay(display_name); +#ifdef NEED_LINUX_HACK + privileges(REVERT); +#endif + if (!Xdisplay) { + print_error("can't open display %s", display_name); + exit(EXIT_FAILURE); + } +#if DEBUG >= DEBUG_X + if (debug_level >= DEBUG_X) { + XSetErrorHandler((XErrorHandler) abort); + } else { + XSetErrorHandler((XErrorHandler) xerror_handler); + } +#else + XSetErrorHandler((XErrorHandler) xerror_handler); +#endif + + if (Options & Opt_install) { + cmap = XCreateColormap(Xdisplay, Xroot, Xvisual, AllocNone); + XInstallColormap(Xdisplay, cmap); +#ifdef PIXMAP_SUPPORT + params.cmap = cmap; + params.flags = PARAMS_COLORMAP; +#endif + } else { + cmap = Xcmap; +#ifdef PIXMAP_SUPPORT + params.flags = 0; +#endif + } + + /* Since we always use Imlib now, let's initialize it here. */ +#ifdef PIXMAP_SUPPORT + if (params.flags) { + imlib_id = Imlib_init_with_params(Xdisplay, ¶ms); + } else { + imlib_id = Imlib_init(Xdisplay); + } + if (!imlib_id) { + fatal_error("Unable to initialize Imlib. Aborting."); + } +#endif + + read_config(THEME_CFG); + read_config((rs_config_file ? rs_config_file : USER_CFG)); + +#if defined(PIXMAP_SUPPORT) + if (rs_path || theme_dir || user_dir) { + register unsigned long len; + register char *tmp; + + len = strlen(initial_dir); + if (rs_path) { + len += strlen(rs_path) + 1; /* +1 for the colon */ + } + if (theme_dir) { + len += strlen(theme_dir) + 1; + } + if (user_dir) { + len += strlen(user_dir) + 1; + } + tmp = MALLOC(len + 1); /* +1 here for the NUL */ + snprintf(tmp, len + 1, "%s%s%s%s%s%s%s", (rs_path ? rs_path : ""), (rs_path ? ":" : ""), initial_dir, + (theme_dir ? ":" : ""), (theme_dir ? theme_dir : ""), (user_dir ? ":" : ""), (user_dir ? user_dir : "")); + tmp[len] = '\0'; + FREE(rs_path); + rs_path = tmp; + D_OPTIONS(("New rs_path set to \"%s\"\n", rs_path)); + } +#endif + get_options(argc, argv); + D_UTMP(("Saved real uid/gid = [ %d, %d ] effective uid/gid = [ %d, %d ]\n", my_ruid, my_rgid, my_euid, my_egid)); + D_UTMP(("Now running with real uid/gid = [ %d, %d ] effective uid/gid = [ %d, %d ]\n", getuid(), getgid(), geteuid(), + getegid())); + + post_parse(); + +#ifdef PREFER_24BIT + cmap = DefaultColormap(Xdisplay, Xscreen); + + /* + * If depth is not 24, look for a 24bit visual. + */ + if (Xdepth != 24) { + XVisualInfo vinfo; + + if (XMatchVisualInfo(Xdisplay, Xscreen, 24, TrueColor, &vinfo)) { + Xdepth = 24; + Xvisual = vinfo.visual; + cmap = XCreateColormap(Xdisplay, RootWindow(Xdisplay, Xscreen), + Xvisual, AllocNone); + } + } +#endif + + Create_Windows(argc, argv); + scr_reset(); /* initialize screen */ + Gr_reset(); /* reset graphics */ + + /* add scrollBar, do it directly to avoid resize() */ + scrollbar_mapping(Options & Opt_scrollBar); + +#if DEBUG >= DEBUG_X + if (debug_level >= DEBUG_X) { + XSynchronize(Xdisplay, True); + } +#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 */ + + i = strlen(val); + display_string = MALLOC((i + 9)); + + sprintf(display_string, "DISPLAY=%s", val); + sprintf(windowid_string, "WINDOWID=%u", (unsigned int) TermWin.parent); + + /* add entries to the environment: + * DISPLAY: X display name + * WINDOWID: X windowid of the window + * COLORTERM: Terminal supports color + * COLORTERM_BCE: Terminal supports BCE + * TERM: Terminal type for termcap/terminfo + */ + putenv(display_string); + putenv(windowid_string); + if (Xdepth <= 2) { + putenv("COLORTERM=" COLORTERMENV "-mono"); + putenv("COLORTERM_BCE=" COLORTERMENV "-mono"); + putenv("TERM=" TERMENV); + } else { + if (rs_term_name != NULL) { + i = strlen(rs_term_name); + term_string = MALLOC((i + 6) * sizeof(char)); + + sprintf(term_string, "TERM=%s", rs_term_name); + putenv(term_string); + } else { +#ifdef DEFINE_XTERM_COLOR + if (Xdepth <= 2) + putenv("TERM=" TERMENV); + else + putenv("TERM=" TERMENV "-color"); +#else + putenv("TERM=" TERMENV); +#endif + } + putenv("COLORTERM=" COLORTERMENV); + putenv("COLORTERM_BCE=" COLORTERMENV); + } + putenv("ETERM_VERSION=" VERSION); + + D_CMD(("init_command()\n")); + init_command(rs_execArgs); +#ifndef USE_POSIX_THREADS + if (Options & Opt_borderless) { + resize_window(); + } +#endif + +#ifdef USE_POSIX_THREADS + D_THREADS(("main_thread:")); + pthread_attr_init(&main_loop_attr); + pthread_create(&main_loop_thr, &main_loop_attr, + (void *) &main_thread, NULL); + D_THREADS(("done? :)\n")); + while (1); + /* main_loop(); */ +#else + main_loop(); /* main processing loop */ +#endif + + return (EXIT_SUCCESS); +} +/* EOF */ diff --git a/src/main.h b/src/startup.h similarity index 96% rename from src/main.h rename to src/startup.h index 3a86379..f821d24 100644 --- a/src/main.h +++ b/src/startup.h @@ -1,11 +1,11 @@ -/* main.h -- Eterm main program header file +/* startup.h -- Eterm main program header file * * This file is original work by Michael Jennings and * Tuomo Venalainen . This file, and any other file * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ * */ -#ifndef _MAIN_H -# define _MAIN_H +#ifndef _STARTUP_H +# define _STARTUP_H # include # include /* Xlib, Xutil, Xresource, Xfuncproto */ # include @@ -126,4 +126,4 @@ extern short bg_needs_update; #endif extern const char *display_name; -#endif /* whole file */ +#endif diff --git a/src/term.c b/src/term.c index a30edf2..b273c26 100644 --- a/src/term.c +++ b/src/term.c @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,7 +42,7 @@ static const char cvs_ident[] = "$Id$"; #include "e.h" #include "events.h" #include "font.h" -#include "main.h" +#include "startup.h" #include "options.h" #include "pixmap.h" #include "screen.h" diff --git a/src/term.h b/src/term.h index 4bf725c..620c9d8 100644 --- a/src/term.h +++ b/src/term.h @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/threads.c b/src/threads.c index 65eacff..907ac21 100644 --- a/src/threads.c +++ b/src/threads.c @@ -10,7 +10,7 @@ static const char cvs_ident[] = "$Id$"; #include #ifdef USE_POSIX_THREADS -# include "main.h" +# include "startup.h" # include "debug.h" # include "screen.h" diff --git a/src/timer.c b/src/timer.c index e4eaa86..0ce70b2 100644 --- a/src/timer.c +++ b/src/timer.c @@ -37,7 +37,7 @@ static const char cvs_ident[] = "$Id$"; #include "../libmej/debug.h" #include "../libmej/strings.h" #include "debug.h" -#include "main.h" +#include "startup.h" #include "mem.h" #include "command.h" #include "events.h" diff --git a/src/windows.c b/src/windows.c index 32deb99..1202501 100644 --- a/src/windows.c +++ b/src/windows.c @@ -5,7 +5,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,7 +42,7 @@ static const char cvs_ident[] = "$Id$"; #include "e.h" #include "events.h" #include "font.h" -#include "main.h" +#include "startup.h" #include "menus.h" #include "options.h" #include "pixmap.h" diff --git a/src/windows.h b/src/windows.h index 281b65b..cf85d5b 100644 --- a/src/windows.h +++ b/src/windows.h @@ -6,7 +6,7 @@ * bearing this same message or a similar one, is distributed under * the GNU Public License (GPL) as outlined in the COPYING file. * - * Copyright (C) 1997, Michael Jennings and Tuomo Venalainen + * Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by