summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Jennings <mej@kainx.org>2000-08-31 05:41:44 +0000
committerMichael Jennings <mej@kainx.org>2000-08-31 05:41:44 +0000
commit9a6507f4583517330210c7fcdaa3a8db7cd26741 (patch)
tree2e68d8ddd7360a5b993738dd3118969b4bdd1cc2 /src
parenteb4400feea761a3a0155effbbd6fc514cb93c345 (diff)
downloadeterm-9a6507f4583517330210c7fcdaa3a8db7cd26741.tar.gz
Wed Aug 30 22:58:18 PDT 2000 Michael Jennings <mej@eterm.org>
Massive reorganization/rewrite to libmej. It should now be 100% independent of Eterm. There still may be some gremlins in the memory debugging code, so don't use too high a number with --debug.... SVN revision: 3282
Diffstat (limited to 'src')
-rw-r--r--src/actions.c7
-rw-r--r--src/buttons.c5
-rw-r--r--src/command.c45
-rw-r--r--src/debug.h239
-rw-r--r--src/draw.c4
-rw-r--r--src/e.c38
-rw-r--r--src/encoding.c4
-rw-r--r--src/eterm_debug.h84
-rw-r--r--src/events.c11
-rw-r--r--src/events.h2
-rw-r--r--src/feature.h3
-rw-r--r--src/font.c40
-rw-r--r--src/menus.c21
-rw-r--r--src/misc.c55
-rw-r--r--src/misc.h3
-rw-r--r--src/options.c709
-rw-r--r--src/options.h13
-rw-r--r--src/pixmap.c23
-rw-r--r--src/pixmap.h6
-rw-r--r--src/screen.c8
-rw-r--r--src/scrollbar.c5
-rw-r--r--src/startup.c9
-rw-r--r--src/system.c8
-rw-r--r--src/system.h2
-rw-r--r--src/term.c30
-rw-r--r--src/timer.c4
-rw-r--r--src/utmp.c26
-rw-r--r--src/windows.c34
28 files changed, 584 insertions, 854 deletions
diff --git a/src/actions.c b/src/actions.c
index 525010e..87f006e 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -26,17 +26,10 @@ static const char cvs_ident[] = "$Id$";
#include "config.h"
#include "feature.h"
-#include <stdlib.h>
#include <unistd.h>
-#include <errno.h>
#include <limits.h>
-#include "../libmej/debug.h"
-#include "../libmej/strings.h"
-#include "debug.h"
#include "startup.h"
-#include "mem.h"
-#include "strings.h"
#include "actions.h"
#include "command.h"
#include "e.h"
diff --git a/src/buttons.c b/src/buttons.c
index ea979a0..7e810ac 100644
--- a/src/buttons.c
+++ b/src/buttons.c
@@ -28,9 +28,6 @@ static const char cvs_ident[] = "$Id$";
#include <X11/cursorfont.h>
-#include "../libmej/debug.h"
-#include "../libmej/mem.h"
-#include "../libmej/strings.h"
#include "buttons.h"
#include "command.h"
#include "draw.h"
@@ -580,7 +577,7 @@ button_create(char *text)
MEMSET(button, 0, sizeof(button_t));
if (text) {
- button->text = StrDup(text);
+ button->text = STRDUP(text);
button->len = strlen(text);
} else {
button->text = "";
diff --git a/src/command.c b/src/command.c
index 13408a0..90a9c09 100644
--- a/src/command.c
+++ b/src/command.c
@@ -111,10 +111,6 @@ static const char cvs_ident[] = "$Id$";
/* Eterm-specific Headers */
#include "command.h"
#include "startup.h"
-#include "../libmej/debug.h"
-#include "debug.h"
-#include "../libmej/mem.h"
-#include "../libmej/strings.h"
#include "events.h"
#include "font.h"
#include "grkelot.h"
@@ -1017,7 +1013,7 @@ dump_stack_trace(void)
print_error("Your system does not support any of the methods Eterm uses. Exiting.\n");
return;
#endif
- signal(SIGALRM, (sighandler_t) hard_exit);
+ signal(SIGALRM, (eterm_sighandler_t) hard_exit);
alarm(10);
system(cmd);
}
@@ -1063,7 +1059,7 @@ static RETSIGTYPE
handle_exit_signal(int sig)
{
- print_error("Received terminal signal %s (%d)", sig_to_str(sig), sig);
+ print_error("Received terminal signal %s (%d)\n", sig_to_str(sig), sig);
signal(sig, SIG_DFL);
#ifdef UTMP_SUPPORT
@@ -1082,7 +1078,7 @@ static RETSIGTYPE
handle_crash(int sig)
{
- print_error("Received terminal signal %s (%d)", sig_to_str(sig), sig);
+ 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. */
@@ -1140,6 +1136,7 @@ clean_exit(void)
remove_utmp_entry();
#endif
privileges(REVERT);
+ memrec_dump();
PABLO_STOP_TRACING();
DPRINTF1(("Cleanup done. I am outta here!\n"));
}
@@ -1307,7 +1304,7 @@ get_pty(void)
fcntl(fd, F_SETFL, O_NDELAY);
return (fd);
} else {
- print_error("Can't open pseudo-tty -- %s", strerror(errno));
+ print_error("Can't open pseudo-tty -- %s\n", strerror(errno));
return (-1);
}
}
@@ -1343,7 +1340,7 @@ get_tty(void)
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", ttydev, strerror(errno));
+ 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));
@@ -1727,7 +1724,7 @@ init_locale(void)
locale = setlocale(LC_ALL, "");
TermWin.fontset = (XFontSet) -1;
if (locale == NULL) {
- print_error("Setting locale failed.");
+ print_error("Setting locale failed.\n");
} else {
#ifdef MULTI_CHARSET
TermWin.fontset = create_fontset(etfonts[def_font_idx], etmfonts[def_font_idx]);
@@ -1896,13 +1893,13 @@ xim_real_init(void)
destroy_cb.callback = xim_destroy_cb;
destroy_cb.client_data = NULL;
if (XSetIMValues(xim, XNDestroyCallback, &destroy_cb, NULL)) {
- print_error("Could not set destroy callback to IM");
+ print_error("Could not set destroy callback to IM\n");
}
}
#endif
if ((XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL)) || (!xim_styles)) {
- print_error("input method doesn't support any style");
+ print_error("input method doesn't support any style\n");
XCloseIM(xim);
return -1;
}
@@ -1936,14 +1933,14 @@ xim_real_init(void)
XFree(xim_styles);
if (found == 0) {
- print_error("input method doesn't support my preedit type");
+ print_error("input method doesn't support my preedit type\n");
XCloseIM(xim);
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");
+ print_error("This program does not support the preedit type\n");
XCloseIM(xim);
return -1;
}
@@ -1969,7 +1966,7 @@ xim_real_init(void)
XFree(status_attr);
}
if (xim_input_context == NULL) {
- print_error("Failed to create input context");
+ print_error("Failed to create input context\n");
XCloseIM(xim);
return -1;
}
@@ -2065,7 +2062,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");
+ print_error("no atexit(), UTMP entries can't be cleaned\n");
# endif
#endif
@@ -2083,7 +2080,7 @@ run_command(char *argv[])
SavedModes |= PrivMode_scrollbar;
}
#if DEBUG >= DEBUG_TTYMODE && defined(HAVE_TERMIOS_H)
- if (debug_level >= DEBUG_TTYMODE) {
+ if (DEBUG_LEVEL >= DEBUG_TTYMODE) {
debug_ttymode(&tio);
}
#endif
@@ -2092,7 +2089,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", strerror(errno));
+ print_error("fork(): %s\n", strerror(errno));
return (-1);
}
if (cmd_pid == 0) {
@@ -2166,7 +2163,7 @@ run_command(char *argv[])
}
if (argv != NULL) {
#if DEBUG >= DEBUG_CMD
- if (debug_level >= DEBUG_CMD) {
+ if (DEBUG_LEVEL >= DEBUG_CMD) {
int i;
for (i = 0; argv[i]; i++) {
@@ -2175,7 +2172,7 @@ run_command(char *argv[])
}
#endif
execvp(argv[0], argv);
- print_error("execvp() failed, cannot execute \"%s\": %s", argv[0], strerror(errno));
+ print_error("execvp() failed, cannot execute \"%s\": %s\n", argv[0], strerror(errno));
} else {
const char *argv0, *shell;
@@ -2192,7 +2189,7 @@ run_command(char *argv[])
argv0 = p;
}
execlp(shell, argv0, NULL);
- print_error("execlp() failed, cannot execute \"%s\": %s", shell, strerror(errno));
+ 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);
@@ -2249,7 +2246,7 @@ init_command(char *argv[])
cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
if ((cmd_fd = run_command(argv)) < 0) {
- print_error("aborting");
+ print_error("aborting\n");
exit(EXIT_FAILURE);
}
}
@@ -2621,7 +2618,7 @@ main_loop(void)
ch = *cmdbuf_ptr++;
#if DEBUG >= DEBUG_VT
- if (debug_level >= DEBUG_VT) {
+ if (DEBUG_LEVEL >= DEBUG_VT) {
if (ch < 32) {
D_VT(("\'%s\' (%d 0x%02x %03o)\n", get_ctrl_char_name(ch), ch, ch, ch));
} else {
@@ -2730,7 +2727,7 @@ v_writeBig(int f, char *d, int len)
}
if (v_bufend < v_bufptr + len) {
/* still won't fit: get more space */
- /* Don't use XtRealloc because an error is not fatal. */
+ /* Don't use Xtlibmej_realloc because an error is not fatal. */
int size = v_bufptr - v_buffer; /* save across realloc */
v_buffer = REALLOC(v_buffer, size + len);
diff --git a/src/debug.h b/src/debug.h
deleted file mode 100644
index 4d26c2c..0000000
--- a/src/debug.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright (C) 1997-2000, 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.
- */
-
-#ifndef _DEBUG_H
-# define _DEBUG_H
-
-#include <stdlib.h>
-#include <time.h>
-
-#if defined(__GNUC__) && !defined(inline)
-# define inline __inline__
-#endif
-
-extern unsigned int debug_level;
-
-/* A NOP. Does nothing. */
-# define NOP ((void)0)
-
-/* A macro and an #undef to FIXME-ize individual calls or entire code blocks. */
-# define FIXME_NOP(x)
-# undef FIXME_BLOCK
-
-/* The basic debugging output leader. */
-#if defined(__FILE__) && defined(__LINE__)
-# ifdef __GNUC__
-# define __DEBUG() fprintf(stderr, "[%lu] %12s | %4d: %s(): ", (unsigned long) time(NULL), __FILE__, __LINE__, __FUNCTION__)
-# else
-# define __DEBUG() fprintf(stderr, "[%lu] %12s | %4d: ", (unsigned long) time(NULL), __FILE__, __LINE__)
-# endif
-#else
-# define __DEBUG() NOP
-#endif
-
-/* A quick and dirty macro to say, "Hi! I got here without crashing!" */
-# define MOO() do { __DEBUG(); fprintf(stderr, "Moo.\n"); fflush(stderr); } while (0)
-
-/* Assertion/abort macros which are quite a bit more useful than assert() and abort(). */
-#if defined(__FILE__) && defined(__LINE__)
-# ifdef __GNUC__
-# define ASSERT(x) do {if (!(x)) {if (debug_level>=1) {fatal_error("ASSERT failed in %s() at %s:%d: %s", __FUNCTION__, __FILE__, __LINE__, #x);} \
- else {print_warning("ASSERT failed in %s() at %s:%d: %s", __FUNCTION__, __FILE__, __LINE__, #x);}}} while (0)
-# define ASSERT_RVAL(x, val) do {if (!(x)) {if (debug_level>=1) {fatal_error("ASSERT failed in %s() at %s:%d: %s", __FUNCTION__, __FILE__, __LINE__, #x);} \
- else {print_warning("ASSERT failed in %s() at %s:%d: %s", __FUNCTION__, __FILE__, __LINE__, #x);} \
- return (val);}} while (0)
-# define ASSERT_NOTREACHED() do {if (debug_level>=1) {fatal_error("ASSERT failed in %s() at %s:%d: This code should not be reached.", __FUNCTION__, __FILE__, __LINE__);} \
- else {print_warning("ASSERT failed in %s() at %s:%d: This code should not be reached.", __FUNCTION__, __FILE__, __LINE__);} \
- } while (0)
-# define ASSERT_NOTREACHED_RVAL(val) do {if (debug_level>=1) {fatal_error("ASSERT failed in %s() at %s:%d: This code should not be reached.", __FUNCTION__, __FILE__, __LINE__);} \
- else {print_warning("ASSERT failed in %s() at %s:%d: This code should not be reached.", __FUNCTION__, __FILE__, __LINE__);} \
- return (val);} while (0)
-# define ABORT() fatal_error("Aborting in %s() at %s:%d.", __FUNCTION__, __FILE__, __LINE__)
-# else
-# define ASSERT(x) do {if (!(x)) {if (debug_level>=1) {fatal_error("ASSERT failed at %s:%d: %s", __FILE__, __LINE__, #x);} \
- else {print_warning("ASSERT failed at %s:%d: %s", __FILE__, __LINE__, #x);}}} while (0)
-# define ASSERT_RVAL(x, val) do {if (!(x)) {if (debug_level>=1) {fatal_error("ASSERT failed at %s:%d: %s", __FILE__, __LINE__, #x);} \
- else {print_warning("ASSERT failed at %s:%d: %s", __FILE__, __LINE__, #x);} \
- return (val);}} while (0)
-# define ASSERT_NOTREACHED() do {if (debug_level>=1) {fatal_error("ASSERT failed at %s:%d: This code should not be reached.", __FILE__, __LINE__);} \
- else {print_warning("ASSERT failed at %s:%d: This code should not be reached.", __FILE__, __LINE__);} \
- } while (0)
-# define ASSERT_NOTREACHED_RVAL(val) do {if (debug_level>=1) {fatal_error("ASSERT failed at %s:%d: This code should not be reached.", __FILE__, __LINE__);} \
- else {print_warning("ASSERT failed at %s:%d: This code should not be reached.", __FILE__, __LINE__);} \
- return (val);} while (0)
-# define ABORT() fatal_error("Aborting at %s:%d.", __FILE__, __LINE__)
-# endif
-#else
-# define ASSERT(x) do {if (!(x)) {if (debug_level>=1) {fatal_error("ASSERT failed: %s", #x);} \
- else {print_warning("ASSERT failed: %s", #x);}}} while (0)
-# define ASSERT_RVAL(x, val) do {if (!(x)) {if (debug_level>=1) {fatal_error("ASSERT failed: %s", #x);} \
- else {print_warning("ASSERT failed: %s", #x);} return (val);}} while (0)
-# define ASSERT_NOTREACHED() return
-# define ASSERT_NOTREACHED_RVAL(x) return (x)
-# define ABORT() fatal_error("Aborting.")
-#endif
-
-#define REQUIRE(x) do {if (!(x)) {if (debug_level>=1) {__DEBUG(); real_dprintf("REQUIRE failed: %s\n", #x);} return;}} while (0)
-#define REQUIRE_RVAL(x, v) do {if (!(x)) {if (debug_level>=1) {__DEBUG(); real_dprintf("REQUIRE failed: %s\n", #x);} return (v);}} while (0)
-#define NONULL(x) ((x) ? (x) : ("<null>"))
-
-/* Macros for printing debugging messages */
-# if DEBUG >= 1
-# ifndef DPRINTF
-# define DPRINTF(x) do { __DEBUG(); real_dprintf x; } while (0)
-# endif
-# define DPRINTF1(x) do { if (debug_level >= 1) {__DEBUG(); real_dprintf x;} } while (0)
-# define DPRINTF2(x) do { if (debug_level >= 2) {__DEBUG(); real_dprintf x;} } while (0)
-# define DPRINTF3(x) do { if (debug_level >= 3) {__DEBUG(); real_dprintf x;} } while (0)
-# define DPRINTF4(x) do { if (debug_level >= 4) {__DEBUG(); real_dprintf x;} } while (0)
-# define DPRINTF5(x) do { if (debug_level >= 5) {__DEBUG(); real_dprintf x;} } while (0)
-# define DPRINTF6(x) do { if (debug_level >= 6) {__DEBUG(); real_dprintf x;} } while (0)
-# define DPRINTF7(x) do { if (debug_level >= 7) {__DEBUG(); real_dprintf x;} } while (0)
-# define DPRINTF8(x) do { if (debug_level >= 8) {__DEBUG(); real_dprintf x;} } while (0)
-# define DPRINTF9(x) do { if (debug_level >= 9) {__DEBUG(); real_dprintf x;} } while (0)
-# else
-# ifndef DPRINTF
-# define DPRINTF(x) NOP
-# endif
-# define DPRINTF1(x) NOP
-# define DPRINTF2(x) NOP
-# define DPRINTF3(x) NOP
-# define DPRINTF4(x) NOP
-# define DPRINTF5(x) NOP
-# define DPRINTF6(x) NOP
-# define DPRINTF7(x) NOP
-# define DPRINTF8(x) NOP
-# define DPRINTF9(x) NOP
-# endif
-
-/* Use this for stuff that you only want turned on in dire situations */
-# define D_NEVER(x) NOP
-
-/* Debugging macros/defines which set the debugging levels for each output type.
- To change the debugging level at which something appears, change the number in
- both the DEBUG_ definition and the D_ macro (if there is one). -- mej */
-
-# define DEBUG_SCREEN 1
-# define D_SCREEN(x) DPRINTF1(x)
-# define DEBUG_CMD 1
-# define D_CMD(x) DPRINTF1(x)
-# define DEBUG_TTY 1
-# define D_TTY(x) DPRINTF1(x)
-# define DEBUG_SELECTION 1
-# define D_SELECT(x) DPRINTF1(x)
-# define DEBUG_UTMP 1
-# define D_UTMP(x) DPRINTF1(x)
-# define DEBUG_OPTIONS 1
-# define D_OPTIONS(x) DPRINTF1(x)
-# define DEBUG_IMLIB 1
-# define D_IMLIB(x) DPRINTF1(x)
-# define DEBUG_PIXMAP 1
-# define D_PIXMAP(x) DPRINTF1(x)
-# define DEBUG_EVENTS 1
-# define D_EVENTS(x) DPRINTF1(x)
-
-# define DEBUG_X11 2
-# define D_X11(x) DPRINTF2(x)
-# define DEBUG_ENL 2
-# define D_ENL(x) DPRINTF2(x)
-# define DEBUG_SCROLLBAR 2
-# define D_SCROLLBAR(x) DPRINTF2(x)
-# define DEBUG_BBAR 2
-# define D_BBAR(x) DPRINTF2(x)
-# define DEBUG_TIMER 2
-# define D_TIMER(x) DPRINTF2(x)
-
-# define DEBUG_MENU 3
-# define D_MENU(x) DPRINTF3(x)
-# define DEBUG_FONT 3
-# define D_FONT(x) DPRINTF3(x)
-# define DEBUG_TTYMODE 3
-# define D_TTYMODE(x) DPRINTF3(x)
-# define DEBUG_COLORS 3
-# define D_COLORS(x) DPRINTF3(x)
-
-# define DEBUG_ACTIONS 4
-# define D_ACTIONS(x) DPRINTF4(x)
-
-# define DEBUG_MALLOC 5
-# define D_MALLOC(x) DPRINTF5(x)
-# define DEBUG_PROFILE 5
-# define D_PROFILE(x) DPRINTF5(x)
-
-# define DEBUG_VT 6
-# define D_VT(x) DPRINTF6(x)
-
-# define DEBUG_X 9
-
-# define DEBUG_PARSE 9999
-# define D_PARSE(x) D_NEVER(x)
-# define DEBUG_STRINGS 9999
-# define D_STRINGS(x) D_NEVER(x)
-
-#if (SIZEOF_LONG == 8)
-# define MEMSET_LONG() l |= l<<32
-#else
-# define MEMSET_LONG() ((void)0)
-#endif
-
-#define MEMSET(s, c, count) do { \
- char *end = (char *)(s) + (count); \
- long l; \
- long *l_dest = (long *)(s); \
- char *c_dest; \
- \
- /* areas of less than 4 * sizeof(long) are set in 1-byte chunks. */ \
- if (((unsigned long) count) >= 4 * sizeof(long)) { \
- /* fill l with c. */ \
- l = (c) | (c)<<8; \
- l |= l<<16; \
- MEMSET_LONG(); \
- \
- /* fill in 1-byte chunks until boundary of long is reached. */ \
- if ((unsigned long)l_dest & (unsigned long)(sizeof(long) -1)) { \
- c_dest = (char *)l_dest; \
- while ((unsigned long)c_dest & (unsigned long)(sizeof(long) -1)) { \
- *(c_dest++) = (c); \
- } \
- l_dest = (long *)c_dest; \
- } \
- \
- /* fill in long-size chunks as long as possible. */ \
- while (((unsigned long) (end - (char *)l_dest)) >= sizeof(long)) { \
- *(l_dest++) = l; \
- } \
- } \
- \
- /* fill the tail in 1-byte chunks. */ \
- if ((char *)l_dest < end) { \
- c_dest = (char *)l_dest; \
- *(c_dest++) = (c); \
- while (c_dest < end) { \
- *(c_dest++) = (c); \
- } \
- } \
- } while (0)
-
-#include "profile.h"
-
-#endif /* _DEBUG_H */
diff --git a/src/draw.c b/src/draw.c
index db2f4be..fd0f83e 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -26,10 +26,6 @@ static const char cvs_ident[] = "$Id$";
#include "config.h"
#include "feature.h"
-#include "../libmej/debug.h"
-#include "../libmej/mem.h"
-#include "../libmej/strings.h"
-#include "debug.h"
#include "draw.h"
#include "misc.h"
#include "pixmap.h"
diff --git a/src/e.c b/src/e.c
index 2832c64..a94b982 100644
--- a/src/e.c
+++ b/src/e.c
@@ -33,10 +33,6 @@ static const char cvs_ident[] = "$Id$";
#include <X11/cursorfont.h>
#include <signal.h>
-#include "../libmej/debug.h"
-#include "../libmej/mem.h"
-#include "../libmej/strings.h"
-#include "debug.h"
#include "e.h"
#include "command.h"
#include "startup.h"
@@ -140,7 +136,7 @@ enl_ipc_send(char *str)
if (last_msg != NULL) {
FREE(last_msg);
}
- last_msg = StrDup(str);
+ last_msg = STRDUP(str);
D_ENL(("Sending \"%s\" to Enlightenment.\n", str));
}
@@ -249,7 +245,7 @@ enl_send_and_wait(char *msg)
{
char *reply = IPC_TIMEOUT;
- sighandler_t old_alrm;
+ eterm_sighandler_t old_alrm;
if (ipc_win == None) {
/* The IPC window is missing. Wait for it to return or Eterm to be killed. */
@@ -257,7 +253,7 @@ enl_send_and_wait(char *msg)
sleep(1);
}
}
- old_alrm = (sighandler_t) signal(SIGALRM, (sighandler_t) enl_ipc_timeout);
+ old_alrm = (eterm_sighandler_t) signal(SIGALRM, (eterm_sighandler_t) enl_ipc_timeout);
for (; reply == IPC_TIMEOUT;) {
timeout = 0;
enl_ipc_send(msg);
@@ -290,43 +286,43 @@ eterm_ipc_parse(char *str)
if (params) {
tt_write((unsigned char *) params, strlen(params));
} else {
- print_error("IPC Error: Invalid syntax in command \"%s\"", str);
+ print_error("IPC Error: Invalid syntax in command \"%s\"\n", str);
}
} else if (!strcasecmp(str, "parse")) {
if (params) {
cmd_write((unsigned char *) params, strlen(params));
} else {
- print_error("IPC Error: Invalid syntax in command \"%s\"", str);
+ print_error("IPC Error: Invalid syntax in command \"%s\"\n", str);
}
} else if (!strcasecmp(str, "enl_send")) {
if (params) {
enl_ipc_send(params);
} else {
- print_error("IPC Error: Invalid syntax in command \"%s\"", str);
+ print_error("IPC Error: Invalid syntax in command \"%s\"\n", str);
}
} else if (!strcasecmp(str, "enl_query")) {
if (params) {
char *reply, header[512];
reply = enl_send_and_wait(params);
- snprintf(header, sizeof(header), "Enlightenment IPC Reply to \"%s\":\n\n", params);
+ snprintf(header, sizeof(header), "Enlightenment IPC Reply to \"%s\":\n", params);
tt_write((unsigned char *) header, strlen(header));
tt_write((unsigned char *) reply, strlen(reply));
tt_write((unsigned char *) "\n", 1);
FREE(reply);
} else {
- print_error("IPC Error: Invalid syntax in command \"%s\"", str);
+ print_error("IPC Error: Invalid syntax in command \"%s\"\n", str);
}
} else if (!strcasecmp(str, "winop")) {
if (params) {
eterm_handle_winop(params);
} else {
- print_error("IPC Error: Invalid syntax in command \"%s\"", str);
+ print_error("IPC Error: Invalid syntax in command \"%s\"\n", str);
}
} else if (!strcasecmp(str, "exit")) {
exit(0);
} else {
- print_error("IPC Error: Unrecognized command \"%s\"", str);
+ print_error("IPC Error: Unrecognized command \"%s\"\n", str);
}
}
@@ -373,13 +369,13 @@ eterm_handle_winop(char *action)
int x, y, n;
char *xx, *yy;
- n = NumWords(action);
+ n = num_words(action);
if (n == 3 || n == 4) {
if (n == 3) {
win = TermWin.parent;
}
- xx = PWord(n - 1, action);
- yy = PWord(n, action);
+ xx = get_pword(n - 1, action);
+ yy = get_pword(n, action);
x = (int) strtol(xx, (char **) NULL, 0);
y = (int) strtol(yy, (char **) NULL, 0);
XMoveWindow(Xdisplay, win, x, y);
@@ -388,13 +384,13 @@ eterm_handle_winop(char *action)
int w, h, n;
char *ww, *hh;
- n = NumWords(action);
+ n = num_words(action);
if (n == 3 || n == 4) {
if (n == 3) {
win = TermWin.parent;
}
- ww = PWord(n - 1, action);
- hh = PWord(n, action);
+ ww = get_pword(n - 1, action);
+ hh = get_pword(n, action);
w = (int) strtol(ww, (char **) NULL, 0);
h = (int) strtol(hh, (char **) NULL, 0);
XResizeWindow(Xdisplay, win, w, h);
@@ -404,6 +400,6 @@ eterm_handle_winop(char *action)
} else if (!BEG_STRCASECMP(action, "iconify")) {
XIconifyWindow(Xdisplay, win, Xscreen);
} else {
- print_error("IPC Error: Unrecognized window operation \"%s\"", action);
+ print_error("IPC Error: Unrecognized window operation \"%s\"\n", action);
}
}
diff --git a/src/encoding.c b/src/encoding.c
index 707df9e..e688e56 100644
--- a/src/encoding.c
+++ b/src/encoding.c
@@ -186,7 +186,7 @@ enc_create_context(const char *id)
tmp = (enc_context_t *) MALLOC(sizeof(enc_context_t));
MEMSET(tmp, 0, sizeof(enc_context_t));
- tmp->id = StrDup(id);
+ tmp->id = STRDUP(id);
return tmp;
}
@@ -207,7 +207,7 @@ enc_create_state(const char *id, unsigned char lifetime)
tmp = (enc_state_t *) MALLOC(sizeof(enc_state_t));
MEMSET(tmp, 0, sizeof(enc_state_t));
- tmp->id = StrDup(id);
+ tmp->id = STRDUP(id);
tmp->lifetime = lifetime;
return tmp;
}
diff --git a/src/eterm_debug.h b/src/eterm_debug.h
new file mode 100644
index 0000000..496cda5
--- /dev/null
+++ b/src/eterm_debug.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 1997-2000, 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.
+ */
+
+#ifndef _ETERM_DEBUG_H
+# define _ETERM_DEBUG_H
+
+/* Debugging macros/defines which set the debugging levels for each output type.
+ To change the debugging level at which something appears, change the number in
+ both the DEBUG_ definition and the D_ macro (if there is one). -- mej */
+
+# define DEBUG_SCREEN 1
+# define D_SCREEN(x) DPRINTF1(x)
+# define DEBUG_CMD 1
+# define D_CMD(x) DPRINTF1(x)
+# define DEBUG_TTY 1
+# define D_TTY(x) DPRINTF1(x)
+# define DEBUG_SELECTION 1
+# define D_SELECT(x) DPRINTF1(x)
+# define DEBUG_UTMP 1
+# define D_UTMP(x) DPRINTF1(x)
+# define DEBUG_OPTIONS 1
+# define D_OPTIONS(x) DPRINTF1(x)
+# define DEBUG_IMLIB 1
+# define D_IMLIB(x) DPRINTF1(x)
+# define DEBUG_PIXMAP 1
+# define D_PIXMAP(x) DPRINTF1(x)
+# define DEBUG_EVENTS 1
+# define D_EVENTS(x) DPRINTF1(x)
+
+# define DEBUG_X11 2
+# define D_X11(x) DPRINTF2(x)
+# define DEBUG_ENL 2
+# define D_ENL(x) DPRINTF2(x)
+# define DEBUG_SCROLLBAR 2
+# define D_SCROLLBAR(x) DPRINTF2(x)
+# define DEBUG_BBAR 2
+# define D_BBAR(x) DPRINTF2(x)
+# define DEBUG_TIMER 2
+# define D_TIMER(x) DPRINTF2(x)
+
+# define DEBUG_MENU 3
+# define D_MENU(x) DPRINTF3(x)
+# define DEBUG_FONT 3
+# define D_FONT(x) DPRINTF3(x)
+# define DEBUG_TTYMODE 3
+# define D_TTYMODE(x) DPRINTF3(x)
+# define DEBUG_COLORS 3
+# define D_COLORS(x) DPRINTF3(x)
+
+# define DEBUG_ACTIONS 4
+# define D_ACTIONS(x) DPRINTF4(x)
+
+# define DEBUG_PROFILE 5
+# define D_PROFILE(x) DPRINTF5(x)
+
+# define DEBUG_VT 6
+# define D_VT(x) DPRINTF6(x)
+
+# define DEBUG_X 9
+
+# define DEBUG_PARSE 9999
+# define D_PARSE(x) D_NEVER(x)
+
+#endif /* _ETERM_DEBUG_H */
diff --git a/src/events.c b/src/events.c
index 314a094..2df0126 100644
--- a/src/events.c
+++ b/src/events.c
@@ -31,12 +31,7 @@ static const char cvs_ident[] = "$Id$";
#include <errno.h>
#include <limits.h>
-#include "../libmej/debug.h"
-#include "../libmej/strings.h"
-#include "debug.h"
#include "startup.h"
-#include "mem.h"
-#include "strings.h"
#include "actions.h"
#include "buttons.h"
#include "command.h"
@@ -783,13 +778,13 @@ 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)", request_code_to_name(event->request_code),
+ 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
- if (debug_level >= DEBUG_X11) {
+ if (DEBUG_LEVEL >= DEBUG_X11) {
dump_stack_trace();
}
#endif
- print_error("Attempting to continue...");
+ print_error("Attempting to continue...\n");
return 0;
}
diff --git a/src/events.h b/src/events.h
index 10ee5ec..38ab697 100644
--- a/src/events.h
+++ b/src/events.h
@@ -50,7 +50,7 @@
# define COUNT_EVENT(x) NOP
#endif
#ifdef PROFILE_X_EVENTS
-# define P_EVENT_TIME(type, start, stop) real_dprintf(type ": %ld microseconds\n", P_CMPTIMEVALS_USEC((start), (stop)))
+# define P_EVENT_TIME(type, start, stop) libmej_dprintf(type ": %ld microseconds\n", P_CMPTIMEVALS_USEC((start), (stop)))
#else
# define P_EVENT_TIME(type, start, stop) NOP
#endif
diff --git a/src/feature.h b/src/feature.h
index b2faf2e..cb3474a 100644
--- a/src/feature.h
+++ b/src/feature.h
@@ -89,7 +89,8 @@
# include <stdio.h>
# include <stdlib.h>
-# include "debug.h"
+# include <libmej.h>
+# include "eterm_debug.h"
/********************* Color, screen, and image stuff *********************/
diff --git a/src/font.c b/src/font.c
index 2f2b496..9ffc298 100644
--- a/src/font.c
+++ b/src/font.c
@@ -32,10 +32,6 @@ static const char cvs_ident[] = "$Id$";
#include <limits.h>
#include <math.h>
-#include "../libmej/debug.h"
-#include "../libmej/mem.h"
-#include "../libmej/strings.h"
-#include "debug.h"
#include "command.h"
#include "font.h"
#include "startup.h"
@@ -78,9 +74,9 @@ eterm_font_add(char ***plist, const char *fontname, unsigned char idx) {
etfonts = (char **) REALLOC(etfonts, new_size);
#ifdef MULTI_CHARSET
etmfonts = (char **) REALLOC(etmfonts, new_size);
- D_FONT((" -> Reallocating fonts lists to a size of %u bytes gives %8p/%8p\n", new_size, etfonts, etmfonts));
+ D_FONT((" -> libmej_reallocating fonts lists to a size of %u bytes gives %8p/%8p\n", new_size, etfonts, etmfonts));
#else
- D_FONT((" -> Reallocating fonts list to a size of %u bytes gives %8p\n", new_size, etfonts));
+ D_FONT((" -> libmej_reallocating fonts list to a size of %u bytes gives %8p\n", new_size, etfonts));
#endif
} else {
etfonts = (char **) MALLOC(new_size);
@@ -109,7 +105,7 @@ eterm_font_add(char ***plist, const char *fontname, unsigned char idx) {
FREE(flist[idx]);
}
}
- flist[idx] = StrDup(fontname);
+ flist[idx] = STRDUP(fontname);
DUMP_FONTS();
}
@@ -132,7 +128,7 @@ font_cache_add(const char *name, unsigned char type, void *info) {
D_FONT(("font_cache_add(%s, %d, %8p) called.\n", NONULL(name), type, info));
font = (cachefont_t *) MALLOC(sizeof(cachefont_t));
- font->name = StrDup(name);
+ font->name = STRDUP(name);
font->type = type;
font->ref_cnt = 1;
switch (type) {
@@ -295,7 +291,7 @@ load_font(const char *name, const char *fallback, unsigned char type)
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.");
+ fatal_error("Couldn't load the fallback font either. Giving up.\n");
} else {
font_cache_add(fallback, type, (void *) xfont);
}
@@ -579,7 +575,7 @@ parse_font_fx(const char *line)
ASSERT(line != NULL);
- n = NumWords(line);
+ n = num_words(line);
if (!BEG_STRCASECMP(line, "none")) {
MEMSET(&fshadow, 0, sizeof(fontshadow_t));
@@ -587,7 +583,7 @@ parse_font_fx(const char *line)
if (n != 2) {
return 0;
}
- color = Word(2, line);
+ color = get_word(2, line);
p = get_color_by_name(color, "black");
FREE(color);
for (which = 0; which < 4; which++) {
@@ -596,10 +592,10 @@ parse_font_fx(const char *line)
} else if (!BEG_STRCASECMP(line, "shadow")) {
if (n == 2) {
which = SHADOW_BOTTOM_RIGHT;
- color = Word(2, line);
+ color = get_word(2, line);
} else if (n == 3) {
- color = Word(3, line);
- corner = PWord(2, line);
+ color = get_word(3, line);
+ corner = get_pword(2, line);
which = get_corner(corner);
if (which >= 4) {
return 0;
@@ -613,12 +609,12 @@ parse_font_fx(const char *line)
if (n != 3) {
return 0;
}
- color = Word(2, line);
+ color = get_word(2, line);
p = get_color_by_name(color, "black");
set_shadow_color_by_pixel(SHADOW_BOTTOM_RIGHT, p);
FREE(color);
- color = Word(3, line);
+ color = get_word(3, line);
p = get_color_by_name(color, "white");
set_shadow_color_by_pixel(SHADOW_TOP_LEFT, p);
FREE(color);
@@ -626,12 +622,12 @@ parse_font_fx(const char *line)
if (n != 3) {
return 0;
}
- color = Word(2, line);
+ color = get_word(2, line);
p = get_color_by_name(color, "black");
set_shadow_color_by_pixel(SHADOW_TOP_LEFT, p);
FREE(color);
- color = Word(3, line);
+ color = get_word(3, line);
p = get_color_by_name(color, "white");
set_shadow_color_by_pixel(SHADOW_BOTTOM_RIGHT, p);
FREE(color);
@@ -642,11 +638,11 @@ parse_font_fx(const char *line)
which = get_corner(line);
if (which >= 4) {
which = i;
- color = Word(1, line);
- line = PWord(2, line);
+ color = get_word(1, line);
+ line = get_pword(2, line);
} else {
- color = Word(2, line);
- line = PWord(3, line);
+ color = get_word(2, line);
+ line = get_pword(3, line);
}
set_shadow_color_by_name(which, color);
FREE(color);
diff --git a/src/menus.c b/src/menus.c
index 08100c8..ee03aa4 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -28,9 +28,6 @@ static const char cvs_ident[] = "$Id$";
#include <X11/cursorfont.h>
-#include "../libmej/debug.h"
-#include "../libmej/mem.h"
-#include "../libmej/strings.h"
#include "command.h"
#include "draw.h"
#include "e.h"
@@ -442,7 +439,7 @@ menu_create(char *title)
}
menu = (menu_t *) MALLOC(sizeof(menu_t));
MEMSET(menu, 0, sizeof(menu_t));
- menu->title = StrDup(title ? title : "");
+ menu->title = STRDUP(title ? title : "");
menu->win = XCreateWindow(Xdisplay, Xroot, 0, 0, 1, 1, 0, Xdepth, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBackingStore | CWBorderPixel | CWColormap, &xattr);
@@ -466,7 +463,7 @@ menu_set_title(menu_t *menu, const char *title)
REQUIRE_RVAL(title != NULL, 0);
FREE(menu->title);
- menu->title = StrDup(title);
+ menu->title = STRDUP(title);
XStoreName(Xdisplay, menu->win, menu->title);
return 1;
}
@@ -656,7 +653,7 @@ menuitem_create(char *text)
MEMSET(menuitem, 0, sizeof(menuitem_t));
if (text) {
- menuitem->text = StrDup(text);
+ menuitem->text = STRDUP(text);
menuitem->len = strlen(text);
}
return menuitem;
@@ -671,7 +668,7 @@ menuitem_set_text(menuitem_t * item, const char *text)
if (item->text) {
FREE(item->text);
}
- item->text = StrDup(text);
+ item->text = STRDUP(text);
item->len = strlen(text);
return 1;
}
@@ -717,7 +714,7 @@ menuitem_set_rtext(menuitem_t * item, char *rtext)
ASSERT_RVAL(item != NULL, 0);
ASSERT_RVAL(rtext != NULL, 0);
- item->rtext = StrDup(rtext);
+ item->rtext = STRDUP(rtext);
item->rlen = strlen(rtext);
return 1;
}
@@ -1043,14 +1040,14 @@ menu_draw(menu_t * menu)
break;
#if 0
case MENUITEM_STRING:
- safeaction = StrDup(item->action.string);
- SafeStr(safeaction, strlen(safeaction));
+ safeaction = STRDUP(item->action.string);
+ safe_str(safeaction, strlen(safeaction));
D_MENU((" Item %hu: %s (string %s)\n", i, item->text, safeaction));
FREE(safeaction);
break;
case MENUITEM_ECHO:
- safeaction = StrDup(item->action.string);
- SafeStr(safeaction, strlen(safeaction));
+ safeaction = STRDUP(item->action.string);
+ safe_str(safeaction, strlen(safeaction));
D_MENU((" Item %hu: %s (echo %s)\n", i, item->text, safeaction));
FREE(safeaction);
break;
diff --git a/src/misc.c b/src/misc.c
index 0bfc0e7..f266eb5 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -36,10 +36,6 @@ static const char cvs_ident[] = "$Id$";
#include <unistd.h>
#include <errno.h>
-#include "../libmej/debug.h"
-#include "debug.h"
-#include "../libmej/mem.h"
-#include "../libmej/strings.h"
#include "command.h"
#include "startup.h"
#include "misc.h"
@@ -55,49 +51,6 @@ my_basename(const char *str)
}
-/* Print a non-terminal error message */
-void
-print_error(const char *fmt,...)
-{
-
- va_list arg_ptr;
-
- va_start(arg_ptr, fmt);
- fprintf(stderr, APL_NAME ": ");
- vfprintf(stderr, fmt, arg_ptr);
- fprintf(stderr, "\n");
- va_end(arg_ptr);
-}
-
-/* Print a simple warning. */
-void
-print_warning(const char *fmt,...)
-{
-
- va_list arg_ptr;
-
- va_start(arg_ptr, fmt);
- fprintf(stderr, APL_NAME ": warning: ");
- vfprintf(stderr, fmt, arg_ptr);
- fprintf(stderr, "\n");
- va_end(arg_ptr);
-}
-
-/* Print a fatal error message and terminate */
-void
-fatal_error(const char *fmt,...)
-{
-
- va_list arg_ptr;
-
- va_start(arg_ptr, fmt);
- fprintf(stderr, APL_NAME ": FATAL: ");
- vfprintf(stderr, fmt, arg_ptr);
- fprintf(stderr, "\n");
- va_end(arg_ptr);
- exit(-1);
-}
-
/*
* Compares the first n characters of s1 and s2, where n is strlen(s2)
* Returns strlen(s2) if they match, 0 if not.
@@ -264,9 +217,9 @@ parse_escaped_string(char *str)
*pnew = 0;
#if DEBUG >= DEBUG_STRINGS
- if (debug_level >= DEBUG_STRINGS) {
- D_STRINGS(("New value is:\n\n"));
- HexDump(str, (size_t) (pnew - str));
+ if (DEBUG_LEVEL >= DEBUG_STRINGS) {
+ D_STRINGS(("New value is:\n"));
+ hex_dump(str, (size_t) (pnew - str));
}
#endif
@@ -360,7 +313,7 @@ mkdirhier(const char *path)
struct stat dst;
D_CMD(("path == %s\n", path));
- str = StrDup(path); /* We need to modify it. */
+ str = STRDUP(path); /* We need to modify it. */
pstr = str;
if (*pstr == '/') {
pstr++;
diff --git a/src/misc.h b/src/misc.h
index 502a0b6..cefddc6 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -37,9 +37,6 @@
_XFUNCPROTOBEGIN
extern const char *my_basename(const char *str);
-extern void print_error(const char *fmt,...);
-extern void print_warning(const char *fmt,...);
-extern void fatal_error(const char *fmt,...);
extern unsigned long str_leading_match(register const char *, register const char *);
extern char *str_trim(char *str);
extern int parse_escaped_string(char *str);
diff --git a/src/options.c b/src/options.c
index 7164c0d..4571eb2 100644
--- a/src/options.c
+++ b/src/options.c
@@ -39,10 +39,6 @@ static const char cvs_ident[] = "$Id$";
#include <signal.h>
#include <X11/keysym.h>
-#include "../libmej/debug.h"
-#include "../libmej/mem.h"
-#include "../libmej/strings.h"
-#include "debug.h"
#include "actions.h"
#include "buttons.h"
#include "command.h"
@@ -184,17 +180,17 @@ static const struct {
OPT_STR('X', "config-file", "choose an alternate config file", &rs_config_file),
OPT_STR('d', "display", "X server to connect to", &display_name),
#if DEBUG <= 0
- OPT_ILONG("debug", "level of debugging information to show (support not compiled in)", &debug_level),
+ OPT_ILONG("debug", "level of debugging information to show (support not compiled in)", &DEBUG_LEVEL),
#elif DEBUG == 1
- OPT_ILONG("debug", "level of debugging information to show (0-1)", &debug_level),
+ OPT_ILONG("debug", "level of debugging information to show (0-1)", &DEBUG_LEVEL),
#elif DEBUG == 2
- OPT_ILONG("debug", "level of debugging information to show (0-2)", &debug_level),
+ OPT_ILONG("debug", "level of debugging information to show (0-2)", &DEBUG_LEVEL),
#elif DEBUG == 3
- OPT_ILONG("debug", "level of debugging information to show (0-3)", &debug_level),
+ OPT_ILONG("debug", "level of debugging information to show (0-3)", &DEBUG_LEVEL),
#elif DEBUG == 4
- OPT_ILONG("debug", "level of debugging information to show (0-4)", &debug_level),
+ OPT_ILONG("debug", "level of debugging information to show (0-4)", &DEBUG_LEVEL),
#else
- OPT_ILONG("debug", "level of debugging information to show (0-5)", &debug_level),
+ OPT_ILONG("debug", "level of debugging information to show (0-5)", &DEBUG_LEVEL),
#endif
OPT_BLONG("install", "install a private colormap", &Options, Opt_install),
@@ -448,8 +444,8 @@ version(void)
#if DEBUG >= DEBUG_EVENTS
printf(" +DEBUG_EVENTS");
#endif
-#if DEBUG >= DEBUG_MALLOC
- printf(" +DEBUG_MALLOC");
+#if DEBUG >= DEBUG_MEM
+ printf(" +DEBUG_MEM");
#endif
#if DEBUG >= DEBUG_X11
printf(" +DEBUG_X11");
@@ -826,7 +822,7 @@ get_options(int argc, char *argv[])
D_OPTIONS(("argv[%d] == \"%s\"\n", i, argv[i]));
if (*opt != '-') {
- print_error("unexpected argument %s -- expected option", opt);
+ print_error("unexpected argument %s -- expected option\n", opt);
CHECK_BAD();
continue;
}
@@ -844,14 +840,14 @@ get_options(int argc, char *argv[])
}
}
if (j == optList_numoptions()) {
- print_error("unrecognized long option --%s", opt);
+ print_error("unrecognized long option --%s\n", opt);
CHECK_BAD();
continue;
}
/* Put option-specific warnings here -- mej */
#if 0 /* No longer needed, since it works :) */
if (optList[j].short_opt == 'w') {
- print_error("warning: Use of the -w / --border-width option is discouraged and unsupported.");
+ print_error("warning: Use of the -w / --border-width option is discouraged and unsupported.\n");
}
#endif
@@ -861,7 +857,7 @@ get_options(int argc, char *argv[])
hasequal = 1;
} else {
if (argv[i + 1]) {
- if (*argv[i + 1] != '-' || StrCaseStr(optList[j].long_opt, "font") || StrCaseStr(optList[j].long_opt, "geometry")) {
+ if (*argv[i + 1] != '-' || strcasestr(optList[j].long_opt, "font") || strcasestr(optList[j].long_opt, "geometry")) {
val_ptr = argv[++i];
}
}
@@ -871,7 +867,7 @@ get_options(int argc, char *argv[])
continue;
}
if (!(optList[j].flag & OPT_BOOLEAN) && (val_ptr == NULL)) {
- print_error("long option --%s requires a%s value", opt,
+ print_error("long option --%s requires a%s value\n", opt,
(optList[j].flag & OPT_INTEGER ? "n integer" : " string"));
CHECK_BAD();
continue;
@@ -885,7 +881,7 @@ get_options(int argc, char *argv[])
rs_execArgs = (char **) MALLOC(sizeof(char *) * (argc - i + 1));
for (k = 0; k < len; k++) {
- rs_execArgs[k] = StrDup(argv[k + i]);
+ rs_execArgs[k] = STRDUP(argv[k + i]);
D_OPTIONS(("rs_execArgs[%d] == %s\n", k, rs_execArgs[k]));
}
rs_execArgs[k] = (char *) NULL;
@@ -894,11 +890,11 @@ get_options(int argc, char *argv[])
register unsigned short k;
- rs_execArgs = (char **) MALLOC(sizeof(char *) * (NumWords(val_ptr) + 1));
+ rs_execArgs = (char **) MALLOC(sizeof(char *) * (num_words(val_ptr) + 1));
for (k = 0; val_ptr; k++) {
- rs_execArgs[k] = Word(1, val_ptr);
- val_ptr = PWord(2, val_ptr);
+ rs_execArgs[k] = get_word(1, val_ptr);
+ val_ptr = get_pword(2, val_ptr);
D_OPTIONS(("rs_execArgs[%d] == %s\n", k, rs_execArgs[k]));
}
rs_execArgs[k] = (char *) NULL;
@@ -922,7 +918,7 @@ get_options(int argc, char *argv[])
*(optList[j].maskvar) &= ~(optList[j].mask);
}
} else {
- print_error("unrecognized boolean value \"%s\" for option --%s",
+ print_error("unrecognized boolean value \"%s\" for option --%s\n",
val_ptr, optList[j].long_opt);
CHECK_BAD();
}
@@ -938,7 +934,7 @@ get_options(int argc, char *argv[])
} else { /* String value */
D_OPTIONS(("String option detected\n"));
if (val_ptr && optList[j].pval) {
- *((const char **) optList[j].pval) = StrDup(val_ptr);
+ *((const char **) optList[j].pval) = STRDUP(val_ptr);
}
}
}
@@ -955,14 +951,14 @@ get_options(int argc, char *argv[])
}
}
if (j == optList_numoptions()) {
- print_error("unrecognized option -%c", opt[pos]);
+ print_error("unrecognized option -%c\n", opt[pos]);
CHECK_BAD();
continue;
}
/* Put option-specific warnings here -- mej */
#if 0 /* No longer needed, since it works :) */
if (optList[j].short_opt == 'w') {
- print_error("warning: Use of the -w / --border-width option is discouraged and unsupported.");
+ print_error("warning: Use of the -w / --border-width option is discouraged and unsupported.\n");
}
#endif
@@ -978,7 +974,7 @@ get_options(int argc, char *argv[])
continue;
}
if ((val_ptr == NULL) || ((*val_ptr == '-') && (optList[j].short_opt != 'F') && (optList[j].short_opt != 'g'))) {
- print_error("option -%c requires a%s value", opt[pos],
+ print_error("option -%c requires a%s value\n", opt[pos],
(optList[j].flag & OPT_INTEGER ? "n integer" : " string"));
CHECK_BAD();
if (val_ptr) { /* If the "arg" was actually an option, don't skip it */
@@ -1004,15 +1000,15 @@ get_options(int argc, char *argv[])
rs_execArgs = (char **) MALLOC(sizeof(char *) * len);
if (k == i) {
- rs_execArgs[0] = StrDup((char *) (val_ptr));
+ rs_execArgs[0] = STRDUP((char *) (val_ptr));
D_OPTIONS(("rs_execArgs[0] == %s\n", rs_execArgs[0]));
k++;
} else {
- rs_execArgs[0] = StrDup(argv[k - 1]);
+ rs_execArgs[0] = STRDUP(argv[k - 1]);
D_OPTIONS(("rs_execArgs[0] == %s\n", rs_execArgs[0]));
}
for (; k < argc; k++) {
- rs_execArgs[k - i] = StrDup(argv[k]);
+ rs_execArgs[k - i] = STRDUP(argv[k]);
D_OPTIONS(("rs_execArgs[%d] == %s\n", k - i, rs_execArgs[k - i]));
}
rs_execArgs[len - 1] = (char *) NULL;
@@ -1033,7 +1029,7 @@ get_options(int argc, char *argv[])
} else { /* String value */
D_OPTIONS(("String option detected\n"));
if (optList[j].pval) {
- *((const char **) optList[j].pval) = StrDup(val_ptr);
+ *((const char **) optList[j].pval) = STRDUP(val_ptr);
}
} /* End if value type */
} /* End if option type */
@@ -1093,7 +1089,7 @@ get_initial_options(int argc, char *argv[])
}
D_OPTIONS(("hasequal == %d val_ptr == %10.8p \"%s\"\n", hasequal, val_ptr, val_ptr));
if (val_ptr == NULL && j != 4) {
- print_error("long option --%s requires a%s value", opt, (j == 3 ? "n integer" : " string"));
+ print_error("long option --%s requires a%s value", opt, (j == 3 ? "n integer" : " string\n"));
continue;
}
if (j == 3) {
@@ -1121,7 +1117,7 @@ get_initial_options(int argc, char *argv[])
} else {
D_OPTIONS(("String option detected\n"));
if (val_ptr && optList[j].pval) {
- *((const char **) optList[j].pval) = StrDup(val_ptr);
+ *((const char **) optList[j].pval) = STRDUP(val_ptr);
}
}
} else { /* It's a POSIX option */
@@ -1149,7 +1145,7 @@ get_initial_options(int argc, char *argv[])
}
D_OPTIONS(("val_ptr == %s done == %d\n", val_ptr, done));
if ((val_ptr == NULL) || (*val_ptr == '-')) {
- print_error("option -%c requires a string value", opt[pos]);
+ print_error("option -%c requires a string value\n", opt[pos]);
if (val_ptr) { /* If the "arg" was actually an option, don't skip it */
i--;
}
@@ -1157,7 +1153,7 @@ get_initial_options(int argc, char *argv[])
}
D_OPTIONS(("String option detected\n"));
if (optList[j].pval) {
- *((const char **) optList[j].pval) = StrDup(val_ptr);
+ *((const char **) optList[j].pval) = STRDUP(val_ptr);
}
} /* End for loop */
} /* End if (islong) */
@@ -1230,7 +1226,7 @@ conf_register_context(char *name, ctx_handler_t handler) {
ctx_cnt *= 2;
context = (ctx_t *) REALLOC(context, sizeof(ctx_t) * ctx_cnt);
}
- context[ctx_idx].name = StrDup(name);
+ context[ctx_idx].name = STRDUP(name);
context[ctx_idx].handler = handler;
D_OPTIONS(("conf_register_context(): Added context \"%s\" with ID %d and handler 0x%08x\n",
context[ctx_idx].name, ctx_idx, context[ctx_idx].handler));
@@ -1257,7 +1253,7 @@ conf_register_fstate(FILE *fp, char *path, char *outfile, unsigned long line, un
unsigned char
conf_register_builtin(char *name, eterm_func_ptr_t ptr) {
- builtins[builtin_idx].name = StrDup(name);
+ builtins[builtin_idx].name = STRDUP(name);
builtins[builtin_idx].ptr = ptr;
if (++builtin_idx == builtin_cnt) {
builtin_cnt *= 2;
@@ -1379,11 +1375,11 @@ builtin_random(char *param)
rseed = (unsigned int) (getpid() * time(NULL) % ((unsigned int) -1));
srand(rseed);
}
- n = NumWords(param);
+ n = num_words(param);
index = (int) (n * ((float) rand()) / (RAND_MAX + 1.0)) + 1;
D_PARSE(("random index == %lu\n", index));
- return (Word(index, param));
+ return (get_word(index, param));
}
static char *
@@ -1399,7 +1395,7 @@ builtin_exec(char *param)
Command = (char *) MALLOC(CONFIG_BUFF);
OutFile = tmpnam(NULL);
if (strlen(param) + strlen(OutFile) + 8 > CONFIG_BUFF) {
- print_error("Parse error in file %s, line %lu: Cannot execute command, line too long",
+ print_error("Parse error in file %s, line %lu: Cannot execute command, line too long\n",
file_peek_path(), file_peek_line());
return ((char *) NULL);
}
@@ -1417,12 +1413,12 @@ builtin_exec(char *param)
Output[fsize] = 0;
fclose(fp);
remove(OutFile);
- Output = CondenseWhitespace(Output);
+ Output = condense_whitespace(Output);
} else {
- print_warning("Command at line %lu of file %s returned no output.", file_peek_line(), file_peek_path());
+ print_warning("Command at line %lu of file %s returned no output.\n", file_peek_line(), file_peek_path());
}
} else {
- print_warning("Output file %s could not be created. (line %lu of file %s)", NONULL(OutFile),
+ print_warning("Output file %s could not be created. (line %lu of file %s)\n", NONULL(OutFile),
file_peek_line(), file_peek_path());
}
FREE(Command);
@@ -1436,15 +1432,15 @@ builtin_get(char *param)
char *s, *f, *v;
unsigned short n;
- if (!param || ((n = NumWords(param)) > 2)) {
- print_error("Parse error in file %s, line %lu: Invalid syntax for %get(). Syntax is: %get(variable)", file_peek_path(), file_peek_line());
+ if (!param || ((n = num_words(param)) > 2)) {
+ print_error("Parse error in file %s, line %lu: Invalid syntax for %get(). Syntax is: %get(variable)\n", file_peek_path(), file_peek_line());
return NULL;
}
D_PARSE(("builtin_get(%s) called\n", param));
- s = Word(1, param);
+ s = get_word(1, param);
if (n == 2) {
- f = Word(2, param);
+ f = get_word(2, param);
} else {
f = NULL;
}
@@ -1454,7 +1450,7 @@ builtin_get(char *param)
if (f) {
FREE(f);
}
- return (StrDup(v));
+ return (STRDUP(v));
} else if (f) {
return f;
} else {
@@ -1467,14 +1463,14 @@ builtin_put(char *param)
{
char *var, *val;
- if (!param || (NumWords(param) != 2)) {
- print_error("Parse error in file %s, line %lu: Invalid syntax for %put(). Syntax is: %put(variable value)", file_peek_path(), file_peek_line());
+ if (!param || (num_words(param) != 2)) {
+ print_error("Parse error in file %s, line %lu: Invalid syntax for %put(). Syntax is: %put(variable value)\n", file_peek_path(), file_peek_line());
return NULL;
}
D_PARSE(("builtin_put(%s) called\n", param));
- var = Word(1, param);
- val = Word(2, param);
+ var = get_word(1, param);
+ val = get_word(2, param);
conf_put_var(var, val);
return NULL;
}
@@ -1489,12 +1485,12 @@ builtin_dirscan(char *param)
struct stat filestat;
char *dir, *buff;
- if (!param || (NumWords(param) != 1)) {
- print_error("Parse error in file %s, line %lu: Invalid syntax for %dirscan(). Syntax is: %dirscan(directory)", file_peek_path(), file_peek_line());
+ if (!param || (num_words(param) != 1)) {
+ print_error("Parse error in file %s, line %lu: Invalid syntax for %dirscan(). Syntax is: %dirscan(directory)\n", file_peek_path(), file_peek_line());
return NULL;
}
D_PARSE(("builtin_dirscan(%s)\n", param));
- dir = Word(1, param);
+ dir = get_word(1, param);
dirp = opendir(dir);
if (!dirp) {
return NULL;
@@ -1537,7 +1533,7 @@ builtin_version(char *param)
D_PARSE(("builtin_version(%s) called\n", param));
}
- return (StrDup(VERSION));
+ return (STRDUP(VERSION));
}
static char *
@@ -1548,7 +1544,7 @@ builtin_appname(char *param)
D_PARSE(("builtin_appname(%s) called\n", param));
}
- return (StrDup(APL_NAME "-" VERSION));
+ return (STRDUP(APL_NAME "-" VERSION));
}
/* chomp() removes leading and trailing whitespace/quotes from a string */
@@ -1677,7 +1673,7 @@ shell_expand(char *s)
}
*(--tmp1) = 0;
if (l) {
- print_error("parse error in file %s, line %lu: Mismatched parentheses",
+ print_error("parse error in file %s, line %lu: Mismatched parentheses\n",
file_peek_path(), file_peek_line());
return ((char *) NULL);
}
@@ -1731,7 +1727,7 @@ shell_expand(char *s)
new[j] = *pbuff;
}
#else
- print_warning("Backquote execution support not compiled in, ignoring");
+ print_warning("Backquote execution support not compiled in, ignoring\n");
new[j] = *pbuff;
#endif
break;
@@ -1820,51 +1816,51 @@ parse_color(char *buff, void *state)
return NULL;
}
if (!BEG_STRCASECMP(buff, "foreground ")) {
- RESET_AND_ASSIGN(rs_color[fgColor], Word(2, buff));
+ RESET_AND_ASSIGN(rs_color[fgColor], get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "background ")) {
- RESET_AND_ASSIGN(rs_color[bgColor], Word(2, buff));
+ RESET_AND_ASSIGN(rs_color[bgColor], get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "cursor ")) {
#ifndef NO_CURSORCOLOR
- RESET_AND_ASSIGN(rs_color[cursorColor], Word(2, buff));
+ RESET_AND_ASSIGN(rs_color[cursorColor], get_word(2, buff));
#else
- print_warning("Support for the cursor attribute was not compiled in, ignoring");
+ print_warning("Support for the cursor attribute was not compiled in, ignoring\n");
#endif
} else if (!BEG_STRCASECMP(buff, "cursor_text ")) {
#ifndef NO_CURSORCOLOR
- RESET_AND_ASSIGN(rs_color[cursorColor2], Word(2, buff));
+ RESET_AND_ASSIGN(rs_color[cursorColor2], get_word(2, buff));
#else
- print_warning("Support for the cursor_text attribute was not compiled in, ignoring");
+ print_warning("Support for the cursor_text attribute was not compiled in, ignoring\n");
#endif
} else if (!BEG_STRCASECMP(buff, "menu ")) {
- RESET_AND_ASSIGN(rs_color[menuColor], Word(2, buff));
+ RESET_AND_ASSIGN(rs_color[menuColor], get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "menu_text ")) {
- RESET_AND_ASSIGN(rs_color[menuTextColor], Word(2, buff));
+ RESET_AND_ASSIGN(rs_color[menuTextColor], get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "scrollbar ")) {
- RESET_AND_ASSIGN(rs_color[scrollColor], Word(2, buff));
+ RESET_AND_ASSIGN(rs_color[scrollColor], get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "unfocused_menu ")) {
- RESET_AND_ASSIGN(rs_color[unfocusedMenuColor], Word(2, buff));
+ RESET_AND_ASSIGN(rs_color[unfocusedMenuColor], get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "unfocused_scrollbar ")) {
- RESET_AND_ASSIGN(rs_color[unfocusedScrollColor], Word(2, buff));
+ RESET_AND_ASSIGN(rs_color[unfocusedScrollColor], get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "pointer ")) {
- RESET_AND_ASSIGN(rs_color[pointerColor], Word(2, buff));
+ RESET_AND_ASSIGN(rs_color[pointerColor], get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "video ")) {
- char *tmp = PWord(2, buff);
+ char *tmp = get_pword(2, buff);
if (!BEG_STRCASECMP(tmp, "reverse")) {
Options |= Opt_reverseVideo;
} else if (BEG_STRCASECMP(tmp, "normal")) {
- print_error("Parse error in file %s, line %lu: Invalid value \"%s\" for attribute video",
+ print_error("Parse error in file %s, line %lu: Invalid value \"%s\" for attribute video\n",
file_peek_path(), file_peek_line(), tmp);
}
} else if (!BEG_STRCASECMP(buff, "color ")) {
@@ -1872,14 +1868,14 @@ parse_color(char *buff, void *state)
char *tmp = 0, *r1, *g1, *b1;
unsigned int n, r, g, b, index = 0;
- n = NumWords(buff);
+ n = num_words(buff);
if (n < 3) {
- print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for "
+ print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for \n"
"attribute color", file_peek_path(), file_peek_line(), NONULL(tmp));
return NULL;
}
- tmp = PWord(2, buff);
- r1 = PWord(3, buff);
+ tmp = get_pword(2, buff);
+ r1 = get_pword(3, buff);
if (!isdigit(*r1)) {
if (isdigit(*tmp)) {
n = strtoul(tmp, (char **) NULL, 0);
@@ -1888,38 +1884,38 @@ parse_color(char *buff, void *state)
} else if (n >= 8 && n <= 15) {
index = minBright + n - 8;
}
- RESET_AND_ASSIGN(rs_color[index], Word(1, r1));
+ RESET_AND_ASSIGN(rs_color[index], get_word(1, r1));
return NULL;
} else {
if (!BEG_STRCASECMP(tmp, "bd ")) {
#ifndef NO_BOLDUNDERLINE
- RESET_AND_ASSIGN(rs_color[colorBD], Word(1, r1));
+ RESET_AND_ASSIGN(rs_color[colorBD], get_word(1, r1));
#else
- print_warning("Support for the color bd attribute was not compiled in, ignoring");
+ print_warning("Support for the color bd attribute was not compiled in, ignoring\n");
#endif
return NULL;
} else if (!BEG_STRCASECMP(tmp, "ul ")) {
#ifndef NO_BOLDUNDERLINE
- RESET_AND_ASSIGN(rs_color[colorUL], Word(1, r1));
+ RESET_AND_ASSIGN(rs_color[colorUL], get_word(1, r1));
#else
- print_warning("Support for the color ul attribute was not compiled in, ignoring");
+ print_warning("Support for the color ul attribute was not compiled in, ignoring\n");
#endif
return NULL;
} else {
- tmp = Word(1, tmp);
- print_error("Parse error in file %s, line %lu: Invalid color index \"%s\"",
+ tmp = get_word(1, tmp);
+ print_error("Parse error in file %s, line %lu: Invalid color index \"%s\"\n",
file_peek_path(), file_peek_line(), NONULL(tmp));
FREE(tmp);
}
}
}
if (n != 5) {
- print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for "
+ print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for \n"
"attribute color", file_peek_path(), file_peek_line(), NONULL(tmp));
return NULL;
}
- g1 = PWord(4, buff);
- b1 = PWord(5, buff);
+ g1 = get_pword(4, buff);
+ b1 = get_pword(5, buff);
if (isdigit(*tmp)) {
n = strtoul(tmp, (char **) NULL, 0);
r = strtoul(r1, (char **) NULL, 0);
@@ -1934,7 +1930,7 @@ parse_color(char *buff, void *state)
RESET_AND_ASSIGN(rs_color[index], MALLOC(14));
sprintf(rs_color[index], "#%02x%02x%02x", r, g, b);
} else {
- print_error("Parse error in file %s, line %lu: Invalid color index %lu",
+ print_error("Parse error in file %s, line %lu: Invalid color index %lu\n",
file_peek_path(), file_peek_line(), n);
}
@@ -1946,7 +1942,7 @@ parse_color(char *buff, void *state)
b = strtoul(b1, (char **) NULL, 0);
sprintf(rs_color[colorBD], "#%02x%02x%02x", r, g, b);
#else
- print_warning("Support for the color bd attribute was not compiled in, ignoring");
+ print_warning("Support for the color bd attribute was not compiled in, ignoring\n");
#endif
} else if (!BEG_STRCASECMP(tmp, "ul ")) {
@@ -1957,17 +1953,17 @@ parse_color(char *buff, void *state)
b = strtoul(b1, (char **) NULL, 0);
sprintf(rs_color[colorUL], "#%02x%02x%02x", r, g, b);
#else
- print_warning("Support for the color ul attribute was not compiled in, ignoring");
+ print_warning("Support for the color ul attribute was not compiled in, ignoring\n");
#endif
} else {
- tmp = Word(1, tmp);
- print_error("Parse error in file %s, line %lu: Invalid color index \"%s\"",
+ tmp = get_word(1, tmp);
+ print_error("Parse error in file %s, line %lu: Invalid color index \"%s\"\n",
file_peek_path(), file_peek_line(), NONULL(tmp));
FREE(tmp);
}
} else {
- print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid "
+ print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n"
"within context color", file_peek_path(), file_peek_line(), buff);
}
return state;
@@ -1980,67 +1976,67 @@ parse_attributes(char *buff, void *state)
return NULL;
}
if (!BEG_STRCASECMP(buff, "geometry ")) {
- RESET_AND_ASSIGN(rs_geometry, Word(2, buff));
+ RESET_AND_ASSIGN(rs_geometry, get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "title ")) {
- RESET_AND_ASSIGN(rs_title, Word(2, buff));
+ RESET_AND_ASSIGN(rs_title, get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "name ")) {
- RESET_AND_ASSIGN(rs_name, Word(2, buff));
+ RESET_AND_ASSIGN(rs_name, get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "iconname ")) {
- RESET_AND_ASSIGN(rs_iconName, Word(2, buff));
+ RESET_AND_ASSIGN(rs_iconName, get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "desktop ")) {
rs_desktop = (int) strtol(buff, (char **) NULL, 0);
} else if (!BEG_STRCASECMP(buff, "scrollbar_type ")) {
- RESET_AND_ASSIGN(rs_scrollbar_type, Word(2, buff));
+ RESET_AND_ASSIGN(rs_scrollbar_type, get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "scrollbar_width ")) {
- rs_scrollbar_width = strtoul(PWord(2, buff), (char **) NULL, 0);
+ rs_scrollbar_width = strtoul(get_pword(2, buff), (char **) NULL, 0);
} else if (!BEG_STRCASECMP(buff, "font ")) {
- char *tmp = PWord(2, buff);
+ char *tmp = get_pword(2, buff);
unsigned char n;
if (!BEG_STRCASECMP(tmp, "fx ") || !BEG_STRCASECMP(tmp, "effect")) {
- if (parse_font_fx(PWord(2, tmp)) != 1) {
- print_error("Parse error in file %s, line %lu: Syntax error in font effects specification",
+ if (parse_font_fx(get_pword(2, tmp)) != 1) {
+ print_error("Parse error in file %s, line %lu: Syntax error in font effects specification\n",
file_peek_path(), file_peek_line());
}
- } else if (NumWords(buff) != 3) {
- print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for "
+ } else if (num_words(buff) != 3) {
+ print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for \n"
"attribute font", file_peek_path(), file_peek_line(), NONULL(tmp));
return NULL;
} else if (isdigit(*tmp)) {
n = (unsigned char) strtoul(tmp, (char **) NULL, 0);
if (n <= 255) {
- eterm_font_add(&etfonts, PWord(2, tmp), n);
+ eterm_font_add(&etfonts, get_pword(2, tmp), n);
} else {
- print_error("Parse error in file %s, line %lu: Invalid font index %d",
+ print_error("Parse error in file %s, line %lu: Invalid font index %d\n",
file_peek_path(), file_peek_line(), n);
}
} else if (!BEG_STRCASECMP(tmp, "bold ")) {
#ifndef NO_BOLDFONT
- RESET_AND_ASSIGN(rs_boldFont, Word(2, tmp));
+ RESET_AND_ASSIGN(rs_boldFont, get_word(2, tmp));
#else
- print_warning("Support for the bold font attribute was not compiled in, ignoring");
+ print_warning("Support for the bold font attribute was not compiled in, ignoring\n");
#endif
} else if (!BEG_STRCASECMP(tmp, "default ")) {
- def_font_idx = strtoul(PWord(2, tmp), (char **) NULL, 0);
+ def_font_idx = strtoul(get_pword(2, tmp), (char **) NULL, 0);
} else {
- tmp = Word(1, tmp);
- print_error("Parse error in file %s, line %lu: Invalid font index \"%s\"",
+ tmp = get_word(1, tmp);
+ print_error("Parse error in file %s, line %lu: Invalid font index \"%s\"\n",
file_peek_path(), file_peek_line(), NONULL(tmp));
FREE(tmp);
}
} else {
- print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid "
+ print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n"
"within context attributes", file_peek_path(), file_peek_line(), (buff ? buff : ""));
}
return state;
@@ -2055,8 +2051,8 @@ parse_toggles(char *buff, void *state)
if ((*buff == CONF_BEGIN_CHAR) || (*buff == CONF_END_CHAR)) {
return NULL;
}
- if (!(tmp = PWord(2, buff))) {
- print_error("Parse error in file %s, line %lu: Missing boolean value in context toggles", file_peek_path(), file_peek_line());
+ if (!(tmp = get_pword(2, buff))) {
+ print_error("Parse error in file %s, line %lu: Missing boolean value in context toggles\n", file_peek_path(), file_peek_line());
return NULL;
}
if (BOOL_OPT_ISTRUE(tmp)) {
@@ -2064,7 +2060,7 @@ parse_toggles(char *buff, void *state)
} else if (BOOL_OPT_ISFALSE(tmp)) {
bool_val = 0;
} else {
- print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" in context toggles",
+ print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" in context toggles\n",
file_peek_path(), file_peek_line(), tmp);
return NULL;
}
@@ -2077,7 +2073,7 @@ parse_toggles(char *buff, void *state)
Options &= ~(Opt_mapAlert);
}
#else
- print_warning("Support for the map_alert attribute was not compiled in, ignoring");
+ print_warning("Support for the map_alert attribute was not compiled in, ignoring\n");
#endif
} else if (!BEG_STRCASECMP(buff, "visual_bell ")) {
@@ -2107,7 +2103,7 @@ parse_toggles(char *buff, void *state)
Options &= ~(Opt_utmpLogging);
}
#else
- print_warning("Support for the utmp_logging attribute was not compiled in, ignoring");
+ print_warning("Support for the utmp_logging attribute was not compiled in, ignoring\n");
#endif
} else if (!BEG_STRCASECMP(buff, "meta8 ")) {
@@ -2118,7 +2114,7 @@ parse_toggles(char *buff, void *state)
Options &= ~(Opt_meta8);
}
#else
- print_warning("Support for the meta8 attribute was not compiled in, ignoring");
+ print_warning("Support for the meta8 attribute was not compiled in, ignoring\n");
#endif
} else if (!BEG_STRCASECMP(buff, "iconic ")) {
@@ -2238,7 +2234,7 @@ parse_toggles(char *buff, void *state)
}
} else {
- print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context toggles", file_peek_path(), file_peek_line(), buff);
+ print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context toggles\n", file_peek_path(), file_peek_line(), buff);
}
return state;
}
@@ -2251,18 +2247,18 @@ parse_keyboard(char *buff, void *state)
}
if (!BEG_STRCASECMP(buff, "smallfont_key ")) {
#if defined (HOTKEY_CTRL) || defined (HOTKEY_META)
- RESET_AND_ASSIGN(rs_smallfont_key, Word(2, buff));
+ RESET_AND_ASSIGN(rs_smallfont_key, get_word(2, buff));
to_keysym(&ks_smallfont, rs_smallfont_key);
#else
- print_warning("Support for the smallfont_key attribute was not compiled in, ignoring");
+ print_warning("Support for the smallfont_key attribute was not compiled in, ignoring\n");
#endif
} else if (!BEG_STRCASECMP(buff, "bigfont_key ")) {
#if defined (HOTKEY_CTRL) || defined (HOTKEY_META)
- RESET_AND_ASSIGN(rs_bigfont_key, Word(2, buff));
+ RESET_AND_ASSIGN(rs_bigfont_key, get_word(2, buff));
to_keysym(&ks_bigfont, rs_bigfont_key);
#else
- print_warning("Support for the bigfont_key attribute was not compiled in, ignoring");
+ print_warning("Support for the bigfont_key attribute was not compiled in, ignoring\n");
#endif
} else if (!BEG_STRCASECMP(buff, "keysym ")) {
@@ -2277,11 +2273,11 @@ parse_keyboard(char *buff, void *state)
if (sym >= 0xff00)
sym -= 0xff00;
if (sym < 0 || sym > 0xff) {
- print_error("Parse error in file %s, line %lu: Keysym 0x%x out of range 0xff00-0xffff",
+ print_error("Parse error in file %s, line %lu: Keysym 0x%x out of range 0xff00-0xffff\n",
file_peek_path(), file_peek_line(), sym + 0xff00);
return NULL;
}
- s = Word(3, buff);
+ s = get_word(3, buff);
str = (char *) MALLOC(strlen(s) + 2);
strcpy(str, s);
FREE(s);
@@ -2299,34 +2295,34 @@ parse_keyboard(char *buff, void *state)
}
}
#else
- print_warning("Support for the keysym attributes was not compiled in, ignoring");
+ print_warning("Support for the keysym attributes was not compiled in, ignoring\n");
#endif
} else if (!BEG_STRCASECMP(buff, "meta_mod ")) {
- char *tmp = PWord(2, buff);
+ char *tmp = get_pword(2, buff);
if (!tmp) {
- print_error("Parse error in file %s, line %lu: Missing modifier value for attribute meta_mod",
+ print_error("Parse error in file %s, line %lu: Missing modifier value for attribute meta_mod\n",
file_peek_path(), file_peek_line());
return NULL;
}
rs_meta_mod = (unsigned int) strtoul(tmp, (char **) NULL, 0);
} else if (!BEG_STRCASECMP(buff, "alt_mod ")) {
- char *tmp = PWord(2, buff);
+ char *tmp = get_pword(2, buff);
if (!tmp) {
- print_error("Parse error in file %s, line %lu: Missing modifier value for attribute alt_mod",
+ print_error("Parse error in file %s, line %lu: Missing modifier value for attribute alt_mod\n",
file_peek_path(), file_peek_line());
return NULL;
}
rs_alt_mod = (unsigned int) strtoul(tmp, (char **) NULL, 0);
} else if (!BEG_STRCASECMP(buff, "numlock_mod ")) {
- char *tmp = PWord(2, buff);
+ char *tmp = get_pword(2, buff);
if (!tmp) {
- print_error("Parse error in file %s, line %lu: Missing modifier value for attribute numlock_mod",
+ print_error("Parse error in file %s, line %lu: Missing modifier value for attribute numlock_mod\n",
file_peek_path(), file_peek_line());
return NULL;
}
@@ -2335,40 +2331,40 @@ parse_keyboard(char *buff, void *state)
} else if (!BEG_STRCASECMP(buff, "greek ")) {
#ifdef GREEK_SUPPORT
- char *tmp = PWord(2, buff);
+ char *tmp = get_pword(2, buff);
if (!tmp) {
- print_error("Parse error in file %s, line %lu: Missing boolean value for attribute greek",
+ print_error("Parse error in file %s, line %lu: Missing boolean value for attribute greek\n",
file_peek_path(), file_peek_line());
return NULL;
}
if (BOOL_OPT_ISTRUE(tmp)) {
- RESET_AND_ASSIGN(rs_greek_keyboard, Word(3, buff));
+ RESET_AND_ASSIGN(rs_greek_keyboard, get_word(3, buff));
if (BEG_STRCASECMP(rs_greek_keyboard, "iso")) {
greek_setmode(GREEK_ELOT928);
} else if (BEG_STRCASECMP(rs_greek_keyboard, "ibm")) {
greek_setmode(GREEK_IBM437);
} else {
- print_error("Parse error in file %s, line %lu: Invalid greek keyboard mode \"%s\"",
+ print_error("Parse error in file %s, line %lu: Invalid greek keyboard mode \"%s\"\n",
file_peek_path(), file_peek_line(), (rs_greek_keyboard ? rs_greek_keyboard : ""));
}
} else if (BOOL_OPT_ISFALSE(tmp)) {
/* This space intentionally left no longer blank =^) */
} else {
- print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute %s",
+ print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute %s\n",
file_peek_path(), file_peek_line(), tmp, buff);
return NULL;
}
#else
- print_warning("Support for the greek attribute was not compiled in, ignoring");
+ print_warning("Support for the greek attribute was not compiled in, ignoring\n");
#endif
} else if (!BEG_STRCASECMP(buff, "app_keypad ")) {
- char *tmp = PWord(2, buff);
+ char *tmp = get_pword(2, buff);
if (!tmp) {
- print_error("Parse error in file %s, line %lu: Missing boolean value for attribute app_keypad",
+ print_error("Parse error in file %s, line %lu: Missing boolean value for attribute app_keypad\n",
file_peek_path(), file_peek_line());
return NULL;
}
@@ -2377,17 +2373,17 @@ parse_keyboard(char *buff, void *state)
} else if (BOOL_OPT_ISFALSE(tmp)) {
PrivateModes &= ~(PrivMode_aplKP);
} else {
- print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for "
+ print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for \n"
"attribute app_keypad", file_peek_path(), file_peek_line(), tmp);
return NULL;
}
} else if (!BEG_STRCASECMP(buff, "app_cursor ")) {
- char *tmp = PWord(2, buff);
+ char *tmp = get_pword(2, buff);
if (!tmp) {
- print_error("Parse error in file %s, line %lu: Missing boolean value for attribute app_cursor",
+ print_error("Parse error in file %s, line %lu: Missing boolean value for attribute app_cursor\n",
file_peek_path(), file_peek_line());
return NULL;
}
@@ -2396,13 +2392,13 @@ parse_keyboard(char *buff, void *state)
} else if (BOOL_OPT_ISFALSE(tmp)) {
PrivateModes &= ~(PrivMode_aplCUR);
} else {
- print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for "
+ print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for \n"
"attribute app_cursor", file_peek_path(), file_peek_line(), tmp);
return NULL;
}
} else {
- print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid "
+ print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n"
"within context keyboard", file_peek_path(), file_peek_line(), buff);
}
return state;
@@ -2416,62 +2412,62 @@ parse_misc(char *buff, void *state)
}
if (!BEG_STRCASECMP(buff, "print_pipe ")) {
#ifdef PRINTPIPE
- RESET_AND_ASSIGN(rs_print_pipe, StrDup(PWord(2, buff)));
+ RESET_AND_ASSIGN(rs_print_pipe, STRDUP(get_pword(2, buff)));
chomp(rs_print_pipe);
#else
- print_warning("Support for the print_pipe attribute was not compiled in, ignoring");
+ print_warning("Support for the print_pipe attribute was not compiled in, ignoring\n");
#endif
} else if (!BEG_STRCASECMP(buff, "save_lines ")) {
- rs_saveLines = strtol(PWord(2, buff), (char **) NULL, 0);
+ rs_saveLines = strtol(get_pword(2, buff), (char **) NULL, 0);
} else if (!BEG_STRCASECMP(buff, "min_anchor_size ")) {
- rs_min_anchor_size = strtol(PWord(2, buff), (char **) NULL, 0);
+ rs_min_anchor_size = strtol(get_pword(2, buff), (char **) NULL, 0);
} else if (!BEG_STRCASECMP(buff, "border_width ")) {
#ifdef BORDER_WIDTH_OPTION
- TermWin.internalBorder = (short) strtol(PWord(2, buff), (char **) NULL, 0);
+ TermWin.internalBorder = (short) strtol(get_pword(2, buff), (char **) NULL, 0);
#else
- print_warning("Support for the border_width attribute was not compiled in, ignoring");
+ print_warning("Support for the border_width attribute was not compiled in, ignoring\n");
#endif
} else if (!BEG_STRCASECMP(buff, "line_space ")) {
- rs_line_space = strtol(PWord(2, buff), (char **) NULL, 0);
+ rs_line_space = strtol(get_pword(2, buff), (char **) NULL, 0);
} else if (!BEG_STRCASECMP(buff, "finished_title ")) {
- RESET_AND_ASSIGN(rs_finished_title, Word(2, buff));
+ RESET_AND_ASSIGN(rs_finished_title, get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "finished_text ")) {
- RESET_AND_ASSIGN(rs_finished_text, Word(2, buff));
+ RESET_AND_ASSIGN(rs_finished_text, get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "term_name ")) {
- RESET_AND_ASSIGN(rs_term_name, Word(2, buff));
+ RESET_AND_ASSIGN(rs_term_name, get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "debug ")) {
- debug_level = (unsigned int) strtoul(PWord(2, buff), (char **) NULL, 0);
+ DEBUG_LEVEL = (unsigned int) strtoul(get_pword(2, buff), (char **) NULL, 0);
} else if (!BEG_STRCASECMP(buff, "exec ")) {
register unsigned short k, n;
- RESET_AND_ASSIGN(rs_execArgs, (char **) MALLOC(sizeof(char *) * ((n = NumWords(PWord(2, buff))) + 1)));
+ RESET_AND_ASSIGN(rs_execArgs, (char **) MALLOC(sizeof(char *) * ((n = num_words(get_pword(2, buff))) + 1)));
for (k = 0; k < n; k++) {
- rs_execArgs[k] = Word(k + 2, buff);
+ rs_execArgs[k] = get_word(k + 2, buff);
D_OPTIONS(("rs_execArgs[%d] == %s\n", k, rs_execArgs[k]));
}
rs_execArgs[n] = (char *) NULL;
} else if (!BEG_STRCASECMP(buff, "cut_chars ")) {
#ifdef CUTCHAR_OPTION
- RESET_AND_ASSIGN(rs_cutchars, Word(2, buff));
+ RESET_AND_ASSIGN(rs_cutchars, get_word(2, buff));
chomp(rs_cutchars);
#else
- print_warning("Support for the cut_chars attribute was not compiled in, ignoring");
+ print_warning("Support for the cut_chars attribute was not compiled in, ignoring\n");
#endif
} else {
- print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid "
+ print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n"
"within context misc", file_peek_path(), file_peek_line(), buff);
}
return state;
@@ -2486,36 +2482,36 @@ parse_imageclasses(char *buff, void *state)
if (!BEG_STRCASECMP(buff, "icon ")) {
#ifdef PIXMAP_SUPPORT
- RESET_AND_ASSIGN(rs_icon, Word(2, buff));
+ RESET_AND_ASSIGN(rs_icon, get_word(2, buff));
#else
- print_warning("Pixmap support was not compiled in, ignoring \"icon\" attribute");
+ print_warning("Pixmap support was not compiled in, ignoring \"icon\" attribute\n");
#endif
} else if (!BEG_STRCASECMP(buff, "cache")) {
#ifdef PIXMAP_SUPPORT
- rs_cache_size = strtoul(PWord(2, buff), (char **) NULL, 0);
+ rs_cache_size = strtoul(get_pword(2, buff), (char **) NULL, 0);
#else
- print_warning("Pixmap support was not compiled in, ignoring \"cache\" attribute");
+ print_warning("Pixmap support was not compiled in, ignoring \"cache\" attribute\n");
#endif
} else if (!BEG_STRCASECMP(buff, "path ")) {
- RESET_AND_ASSIGN(rs_path, Word(2, buff));
+ RESET_AND_ASSIGN(rs_path, get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "anim ")) {
#ifdef BACKGROUND_CYCLING_SUPPORT
- char *tmp = PWord(2, buff);
+ char *tmp = get_pword(2, buff);
if (tmp) {
- rs_anim_pixmap_list = StrDup(tmp);
+ rs_anim_pixmap_list = STRDUP(tmp);
} else {
- print_error("Parse error in file %s, line %lu: Invalid parameter list \"\" for attribute anim", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Invalid parameter list \"\" for attribute anim\n", file_peek_path(), file_peek_line());
}
#else
- print_warning("Support for the anim attribute was not compiled in, ignoring");
+ print_warning("Support for the anim attribute was not compiled in, ignoring\n");
#endif
} else {
- print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid "
+ print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n"
"within context imageclasses", file_peek_path(), file_peek_line(), buff);
}
return state;
@@ -2530,6 +2526,7 @@ parse_image(char *buff, void *state)
int *tmp;
tmp = (int *) MALLOC(sizeof(int));
+ *tmp = -1;
return ((void *) tmp);
}
ASSERT_RVAL(state != NULL, (void *)(file_skip_to_end(), NULL));
@@ -2542,10 +2539,10 @@ parse_image(char *buff, void *state)
}
idx = *((int *) state);
if (!BEG_STRCASECMP(buff, "type ")) {
- char *type = PWord(2, buff);
+ char *type = get_pword(2, buff);
if (!type) {
- print_error("Parse error in file %s, line %lu: Missing image type", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Missing image type\n", file_peek_path(), file_peek_line());
return NULL;
}
if (!strcasecmp(type, "background")) {
@@ -2579,21 +2576,21 @@ parse_image(char *buff, void *state)
} else if (!strcasecmp(type, "dialog_box")) {
idx = image_dialog;
} else {
- print_error("Parse error in file %s, line %lu: Invalid image type \"%s\"", file_peek_path(), file_peek_line(), type);
+ print_error("Parse error in file %s, line %lu: Invalid image type \"%s\"\n", file_peek_path(), file_peek_line(), type);
return NULL;
}
*((int *) state) = idx;
} else if (!BEG_STRCASECMP(buff, "mode ")) {
- char *mode = PWord(2, buff);
- char *allow_list = PWord(4, buff);
+ char *mode = get_pword(2, buff);
+ char *allow_list = get_pword(4, buff);
- if (idx < 0) {
- print_error("Parse error in file %s, line %lu: Encountered \"mode\" with no image type defined", file_peek_path(), file_peek_line());
+ if (!CHECK_VALID_INDEX(idx)) {
+ print_error("Parse error in file %s, line %lu: Encountered \"mode\" with no image type defined\n", file_peek_path(), file_peek_line());
return NULL;
}
if (!mode) {
- print_error("Parse error in file %s, line %lu: Missing parameters for mode line", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Missing parameters for mode line\n", file_peek_path(), file_peek_line());
return NULL;
}
if (!BEG_STRCASECMP(mode, "image")) {
@@ -2607,7 +2604,7 @@ parse_image(char *buff, void *state)
} else if (!BEG_STRCASECMP(mode, "solid")) {
images[idx].mode = MODE_SOLID;
} else {
- print_error("Parse error in file %s, line %lu: Invalid mode \"%s\"", file_peek_path(), file_peek_line(), mode);
+ print_error("Parse error in file %s, line %lu: Invalid mode \"%s\"\n", file_peek_path(), file_peek_line(), mode);
}
if (allow_list) {
char *allow;
@@ -2623,19 +2620,19 @@ parse_image(char *buff, void *state)
images[idx].mode |= ALLOW_AUTO;
} else if (!BEG_STRCASECMP("solid", allow)) {
} else {
- print_error("Parse error in file %s, line %lu: Invalid mode \"%s\"", file_peek_path(), file_peek_line(), allow);
+ print_error("Parse error in file %s, line %lu: Invalid mode \"%s\"\n", file_peek_path(), file_peek_line(), allow);
}
}
}
} else if (!BEG_STRCASECMP(buff, "state ")) {
- char *state = PWord(2, buff), new = 0;
+ char *state = get_pword(2, buff), new = 0;
if (!state) {
- print_error("Parse error in file %s, line %lu: Missing state", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Missing state\n", file_peek_path(), file_peek_line());
return NULL;
}
- if (idx < 0) {
- print_error("Parse error in file %s, line %lu: Encountered \"state\" with no image type defined", file_peek_path(), file_peek_line());
+ if (!CHECK_VALID_INDEX(idx)) {
+ print_error("Parse error in file %s, line %lu: Encountered \"state\" with no image type defined\n", file_peek_path(), file_peek_line());
return NULL;
}
if (!strcasecmp(state, "normal")) {
@@ -2663,7 +2660,7 @@ parse_image(char *buff, void *state)
}
images[idx].current = images[idx].disabled;
} else {
- print_error("Parse error in file %s, line %lu: Invalid state \"%s\"", file_peek_path(), file_peek_line(), state);
+ print_error("Parse error in file %s, line %lu: Invalid state \"%s\"\n", file_peek_path(), file_peek_line(), state);
return NULL;
}
if (new) {
@@ -2674,18 +2671,18 @@ parse_image(char *buff, void *state)
MEMSET(images[idx].current->iml, 0, sizeof(imlib_t));
}
} else if (!BEG_STRCASECMP(buff, "color ")) {
- char *fg = Word(2, buff), *bg = Word(3, buff);
+ char *fg = get_word(2, buff), *bg = get_word(3, buff);
- if (idx < 0) {
- print_error("Parse error in file %s, line %lu: Encountered \"color\" with no image type defined", file_peek_path(), file_peek_line());
+ if (!CHECK_VALID_INDEX(idx)) {
+ print_error("Parse error in file %s, line %lu: Encountered \"color\" with no image type defined\n", file_peek_path(), file_peek_line());
return NULL;
}
if (images[idx].current == NULL) {
- print_error("Parse error in file %s, line %lu: Encountered \"color\" with no image state defined", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Encountered \"color\" with no image state defined\n", file_peek_path(), file_peek_line());
return NULL;
}
if (!fg || !bg) {
- print_error("Parse error in file %s, line %lu: Foreground and background colors must be specified with \"color\"", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Foreground and background colors must be specified with \"color\"\n", file_peek_path(), file_peek_line());
return NULL;
}
if (!BEG_STRCASECMP(fg, "0x")) {
@@ -2703,66 +2700,66 @@ parse_image(char *buff, void *state)
#ifdef PIXMAP_SUPPORT
} else if (!BEG_STRCASECMP(buff, "file ")) {
- char *filename = PWord(2, buff);
+ char *filename = get_pword(2, buff);
- if (idx < 0) {
- print_error("Parse error in file %s, line %lu: Encountered \"file\" with no image type defined", file_peek_path(), file_peek_line());
+ if (!CHECK_VALID_INDEX(idx)) {
+ print_error("Parse error in file %s, line %lu: Encountered \"file\" with no image type defined\n", file_peek_path(), file_peek_line());
return NULL;
}
if (images[idx].current == NULL) {
- print_error("Parse error in file %s, line %lu: Encountered \"file\" with no image state defined", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Encountered \"file\" with no image state defined\n", file_peek_path(), file_peek_line());
return NULL;
}
if (!filename) {
- print_error("Parse error in file %s, line %lu: Missing filename", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Missing filename\n", file_peek_path(), file_peek_line());
return NULL;
}
if (!load_image(filename, images[idx].current)) {
- print_error("Unable to locate image \"%s\" in the image path.", NONULL(filename));
+ print_error("Unable to locate image \"%s\" in the image path.\n", NONULL(filename));
images[idx].mode &= ~(MODE_IMAGE | ALLOW_IMAGE);
D_PIXMAP(("New image mode is 0x%02x, iml->im is 0x%08x\n", images[idx].mode, images[idx].current->iml->im));
}
} else if (!BEG_STRCASECMP(buff, "geom ")) {
- char *geom = PWord(2, buff);
+ char *geom = get_pword(2, buff);
- if (idx < 0) {
- print_error("Parse error in file %s, line %lu: Encountered \"geom\" with no image type defined", file_peek_path(), file_peek_line());
+ if (!CHECK_VALID_INDEX(idx)) {
+ print_error("Parse error in file %s, line %lu: Encountered \"geom\" with no image type defined\n", file_peek_path(), file_peek_line());
return NULL;
}
if (images[idx].current == NULL) {
- print_error("Parse error in file %s, line %lu: Encountered \"geom\" with no image state defined", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Encountered \"geom\" with no image state defined\n", file_peek_path(), file_peek_line());
return NULL;
}
if (!geom) {
- print_error("Parse error in file %s, line %lu: Missing geometry string", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Missing geometry string\n", file_peek_path(), file_peek_line());
return NULL;
}
set_pixmap_scale(geom, images[idx].current->pmap);
} else if (!BEG_STRCASECMP(buff, "cmod ") || !BEG_STRCASECMP(buff, "colormod ")) {
- char *color = PWord(2, buff);
- char *mods = PWord(3, buff);
+ char *color = get_pword(2, buff);
+ char *mods = get_pword(3, buff);
unsigned char n;
imlib_t *iml = images[idx].current->iml;
- if (idx < 0) {
- print_error("Parse error in file %s, line %lu: Encountered color modifier with no image type defined", file_peek_path(), file_peek_line());
+ if (!CHECK_VALID_INDEX(idx)) {
+ print_error("Parse error in file %s, line %lu: Encountered color modifier with no image type defined\n", file_peek_path(), file_peek_line());
return NULL;
}
if (images[idx].current == NULL) {
- print_error("Parse error in file %s, line %lu: Encountered color modifier with no image state defined", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Encountered color modifier with no image state defined\n", file_peek_path(), file_peek_line());
return NULL;
}
if (!color) {
- print_error("Parse error in file %s, line %lu: Missing color name", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Missing color name\n", file_peek_path(), file_peek_line());
return NULL;
}
if (!mods) {
- print_error("Parse error in file %s, line %lu: Missing modifier(s)", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Missing modifier(s)\n", file_peek_path(), file_peek_line());
return NULL;
}
- n = NumWords(mods);
+ n = num_words(mods);
if (!BEG_STRCASECMP(color, "image ")) {
if (iml->mod) {
@@ -2771,10 +2768,10 @@ parse_image(char *buff, void *state)
iml->mod = create_colormod();
iml->mod->brightness = (int) strtol(mods, (char **) NULL, 0);
if (n > 1) {
- iml->mod->contrast = (int) strtol(PWord(2, mods), (char **) NULL, 0);
+ iml->mod->contrast = (int) strtol(get_pword(2, mods), (char **) NULL, 0);
}
if (n > 2) {
- iml->mod->gamma = (int) strtol(PWord(3, mods), (char **) NULL, 0);
+ iml->mod->gamma = (int) strtol(get_pword(3, mods), (char **) NULL, 0);
}
update_cmod(iml->mod);
} else if (!BEG_STRCASECMP(color, "red ")) {
@@ -2784,10 +2781,10 @@ parse_image(char *buff, void *state)
iml->rmod = create_colormod();
iml->rmod->brightness = (int) strtol(mods, (char **) NULL, 0);
if (n > 1) {
- iml->rmod->contrast = (int) strtol(PWord(2, mods), (char **) NULL, 0);
+ iml->rmod->contrast = (int) strtol(get_pword(2, mods), (char **) NULL, 0);
}
if (n > 2) {
- iml->rmod->gamma = (int) strtol(PWord(3, mods), (char **) NULL, 0);
+ iml->rmod->gamma = (int) strtol(get_pword(3, mods), (char **) NULL, 0);
}
update_cmod(iml->rmod);
} else if (!BEG_STRCASECMP(color, "green ")) {
@@ -2797,10 +2794,10 @@ parse_image(char *buff, void *state)
iml->gmod = create_colormod();
iml->gmod->brightness = (int) strtol(mods, (char **) NULL, 0);
if (n > 1) {
- iml->gmod->contrast = (int) strtol(PWord(2, mods), (char **) NULL, 0);
+ iml->gmod->contrast = (int) strtol(get_pword(2, mods), (char **) NULL, 0);
}
if (n > 2) {
- iml->gmod->gamma = (int) strtol(PWord(3, mods), (char **) NULL, 0);
+ iml->gmod->gamma = (int) strtol(get_pword(3, mods), (char **) NULL, 0);
}
update_cmod(iml->gmod);
} else if (!BEG_STRCASECMP(color, "blue ")) {
@@ -2810,33 +2807,33 @@ parse_image(char *buff, void *state)
iml->bmod = create_colormod();
iml->bmod->brightness = (int) strtol(mods, (char **) NULL, 0);
if (n > 1) {
- iml->bmod->contrast = (int) strtol(PWord(2, mods), (char **) NULL, 0);
+ iml->bmod->contrast = (int) strtol(get_pword(2, mods), (char **) NULL, 0);
}
if (n > 2) {
- iml->bmod->gamma = (int) strtol(PWord(3, mods), (char **) NULL, 0);
+ iml->bmod->gamma = (int) strtol(get_pword(3, mods), (char **) NULL, 0);
}
update_cmod(iml->bmod);
} else {
- print_error("Parse error in file %s, line %lu: Color must be either \"image\", \"red\", \"green\", or \"blue\"", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Color must be either \"image\", \"red\", \"green\", or \"blue\"\n", file_peek_path(), file_peek_line());
return NULL;
}
#endif
} else if (!BEG_STRCASECMP(buff, "border ")) {
- if (idx < 0) {
- print_error("Parse error in file %s, line %lu: Encountered \"border\" with no image type defined", file_peek_path(), file_peek_line());
+ if (!CHECK_VALID_INDEX(idx)) {
+ print_error("Parse error in file %s, line %lu: Encountered \"border\" with no image type defined\n", file_peek_path(), file_peek_line());
return NULL;
}
- if (NumWords(buff + 7) < 4) {
- print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"border\"", file_peek_path(), file_peek_line());
+ if (num_words(buff + 7) < 4) {
+ print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"border\"\n", file_peek_path(), file_peek_line());
return NULL;
}
RESET_AND_ASSIGN(images[idx].current->iml->border, (Imlib_Border *) MALLOC(sizeof(Imlib_Border)));
- images[idx].current->iml->border->left = (unsigned short) strtoul(PWord(2, buff), (char **) NULL, 0);
- images[idx].current->iml->border->right = (unsigned short) strtoul(PWord(3, buff), (char **) NULL, 0);
- images[idx].current->iml->border->top = (unsigned short) strtoul(PWord(4, buff), (char **) NULL, 0);
- images[idx].current->iml->border->bottom = (unsigned short) strtoul(PWord(5, buff), (char **) NULL, 0);
+ images[idx].current->iml->border->left = (unsigned short) strtoul(get_pword(2, buff), (char **) NULL, 0);
+ images[idx].current->iml->border->right = (unsigned short) strtoul(get_pword(3, buff), (char **) NULL, 0);
+ images[idx].current->iml->border->top = (unsigned short) strtoul(get_pword(4, buff), (char **) NULL, 0);
+ images[idx].current->iml->border->bottom = (unsigned short) strtoul(get_pword(5, buff), (char **) NULL, 0);
if ((images[idx].current->iml->border->left == 0) && (images[idx].current->iml->border->right == 0)
&& (images[idx].current->iml->border->top == 0) && (images[idx].current->iml->border->bottom == 0)) {
@@ -2844,16 +2841,16 @@ parse_image(char *buff, void *state)
images[idx].current->iml->border = (Imlib_Border *) NULL; /* No sense in wasting CPU time and memory if there are no borders */
}
} else if (!BEG_STRCASECMP(buff, "bevel ")) {
- if (idx < 0) {
- print_error("Parse error in file %s, line %lu: Encountered \"bevel\" with no image type defined", file_peek_path(), file_peek_line());
+ if (!CHECK_VALID_INDEX(idx)) {
+ print_error("Parse error in file %s, line %lu: Encountered \"bevel\" with no image type defined\n", file_peek_path(), file_peek_line());
return NULL;
}
if (images[idx].current == NULL) {
- print_error("Parse error in file %s, line %lu: Encountered \"bevel\" with no image state defined", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Encountered \"bevel\" with no image state defined\n", file_peek_path(), file_peek_line());
return NULL;
}
- if (NumWords(buff + 6) < 5) {
- print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"bevel\"", file_peek_path(), file_peek_line());
+ if (num_words(buff + 6) < 5) {
+ print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"bevel\"\n", file_peek_path(), file_peek_line());
return NULL;
}
if (images[idx].current->iml->bevel != NULL) {
@@ -2863,15 +2860,15 @@ parse_image(char *buff, void *state)
images[idx].current->iml->bevel = (bevel_t *) MALLOC(sizeof(bevel_t));
images[idx].current->iml->bevel->edges = (Imlib_Border *) MALLOC(sizeof(Imlib_Border));
- if (!BEG_STRCASECMP(PWord(2, buff), "down")) {
+ if (!BEG_STRCASECMP(get_pword(2, buff), "down")) {
images[idx].current->iml->bevel->up = 0;
} else {
images[idx].current->iml->bevel->up = 1;
}
- images[idx].current->iml->bevel->edges->left = (unsigned short) strtoul(PWord(3, buff), (char **) NULL, 0);
- images[idx].current->iml->bevel->edges->right = (unsigned short) strtoul(PWord(4, buff), (char **) NULL, 0);
- images[idx].current->iml->bevel->edges->top = (unsigned short) strtoul(PWord(5, buff), (char **) NULL, 0);
- images[idx].current->iml->bevel->edges->bottom = (unsigned short) strtoul(PWord(6, buff), (char **) NULL, 0);
+ images[idx].current->iml->bevel->edges->left = (unsigned short) strtoul(get_pword(3, buff), (char **) NULL, 0);
+ images[idx].current->iml->bevel->edges->right = (unsigned short) strtoul(get_pword(4, buff), (char **) NULL, 0);
+ images[idx].current->iml->bevel->edges->top = (unsigned short) strtoul(get_pword(5, buff), (char **) NULL, 0);
+ images[idx].current->iml->bevel->edges->bottom = (unsigned short) strtoul(get_pword(6, buff), (char **) NULL, 0);
if ((images[idx].current->iml->bevel->edges->left == 0) && (images[idx].current->iml->bevel->edges->right == 0)
&& (images[idx].current->iml->bevel->edges->top == 0) && (images[idx].current->iml->bevel->edges->bottom == 0)) {
@@ -2881,24 +2878,24 @@ parse_image(char *buff, void *state)
images[idx].current->iml->bevel = (bevel_t *) NULL;
}
} else if (!BEG_STRCASECMP(buff, "padding ")) {
- if (idx < 0) {
- print_error("Parse error in file %s, line %lu: Encountered \"padding\" with no image type defined", file_peek_path(), file_peek_line());
+ if (!CHECK_VALID_INDEX(idx)) {
+ print_error("Parse error in file %s, line %lu: Encountered \"padding\" with no image type defined\n", file_peek_path(), file_peek_line());
return NULL;
}
if (images[idx].current == NULL) {
- print_error("Parse error in file %s, line %lu: Encountered \"padding\" with no image state defined", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Encountered \"padding\" with no image state defined\n", file_peek_path(), file_peek_line());
return NULL;
}
- if (NumWords(buff + 8) < 4) {
- print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"padding\"", file_peek_path(), file_peek_line());
+ if (num_words(buff + 8) < 4) {
+ print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"padding\"\n", file_peek_path(), file_peek_line());
return NULL;
}
RESET_AND_ASSIGN(images[idx].current->iml->pad, (Imlib_Border *) MALLOC(sizeof(Imlib_Border)));
- images[idx].current->iml->pad->left = (unsigned short) strtoul(PWord(2, buff), (char **) NULL, 0);
- images[idx].current->iml->pad->right = (unsigned short) strtoul(PWord(3, buff), (char **) NULL, 0);
- images[idx].current->iml->pad->top = (unsigned short) strtoul(PWord(4, buff), (char **) NULL, 0);
- images[idx].current->iml->pad->bottom = (unsigned short) strtoul(PWord(5, buff), (char **) NULL, 0);
+ images[idx].current->iml->pad->left = (unsigned short) strtoul(get_pword(2, buff), (char **) NULL, 0);
+ images[idx].current->iml->pad->right = (unsigned short) strtoul(get_pword(3, buff), (char **) NULL, 0);
+ images[idx].current->iml->pad->top = (unsigned short) strtoul(get_pword(4, buff), (char **) NULL, 0);
+ images[idx].current->iml->pad->bottom = (unsigned short) strtoul(get_pword(5, buff), (char **) NULL, 0);
if ((images[idx].current->iml->pad->left == 0) && (images[idx].current->iml->pad->right == 0)
&& (images[idx].current->iml->pad->top == 0) && (images[idx].current->iml->pad->bottom == 0)) {
@@ -2906,7 +2903,7 @@ parse_image(char *buff, void *state)
images[idx].current->iml->pad = (Imlib_Border *) NULL;
}
} else {
- print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid "
+ print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n"
"within context image", file_peek_path(), file_peek_line(), buff);
}
return ((void *) state);
@@ -2926,7 +2923,7 @@ parse_actions(char *buff, void *state)
}
if (!BEG_STRCASECMP(buff, "bind ")) {
- for (i = 2; (str = Word(i, buff)) && strcasecmp(str, "to"); i++) {
+ for (i = 2; (str = get_word(i, buff)) && strcasecmp(str, "to"); i++) {
if (!BEG_STRCASECMP(str, "anymod")) {
mod = MOD_ANY;
} else if (!BEG_STRCASECMP(str, "ctrl")) {
@@ -2959,38 +2956,38 @@ parse_actions(char *buff, void *state)
FREE(str);
}
if (!str) {
- print_error("Parse error in file %s, line %lu: Syntax error (\"to\" not found)", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Syntax error (\"to\" not found)\n", file_peek_path(), file_peek_line());
return NULL;
}
FREE(str);
if ((button == BUTTON_NONE) && (keysym == 0)) {
- print_error("Parse error in file %s, line %lu: No valid button/keysym found for action", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: No valid button/keysym found for action\n", file_peek_path(), file_peek_line());
return NULL;
}
i++;
- str = PWord(i, buff);
+ str = get_pword(i, buff);
if (!BEG_STRCASECMP(str, "string")) {
- str = Word(i+1, buff);
+ str = get_word(i+1, buff);
action_add(mod, button, keysym, ACTION_STRING, (void *) str);
FREE(str);
} else if (!BEG_STRCASECMP(str, "echo")) {
- str = Word(i+1, buff);
+ str = get_word(i+1, buff);
action_add(mod, button, keysym, ACTION_ECHO, (void *) str);
FREE(str);
} else if (!BEG_STRCASECMP(str, "menu")) {
menu_t *menu;
- str = Word(i+1, buff);
+ str = get_word(i+1, buff);
menu = find_menu_by_title(menu_list, str);
action_add(mod, button, keysym, ACTION_MENU, (void *) menu);
FREE(str);
} else {
- print_error("Parse error in file %s, line %lu: Syntax error (\"to\" not found)", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Syntax error (\"to\" not found)\n", file_peek_path(), file_peek_line());
return NULL;
}
} else {
- print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid "
+ print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n"
"within context action", file_peek_path(), file_peek_line(), buff);
}
return state;
@@ -3002,7 +2999,7 @@ parse_menu(char *buff, void *state)
menu_t *menu;
if (*buff == CONF_BEGIN_CHAR) {
- char *title = PWord(2, buff + 6);
+ char *title = get_pword(2, buff + 6);
menu = menu_create(title);
return ((void *) menu);
@@ -3015,22 +3012,22 @@ parse_menu(char *buff, void *state)
sprintf(tmp, "Eterm_Menu_%u", menu_list->nummenus);
menu_set_title(menu, tmp);
- print_error("Parse error in file %s, line %lu: Menu context ended without giving a title. Defaulted to \"%s\".", file_peek_path(), file_peek_line(), tmp);
+ print_error("Parse error in file %s, line %lu: Menu context ended without giving a title. Defaulted to \"%s\".\n", file_peek_path(), file_peek_line(), tmp);
}
menu_list = menulist_add_menu(menu_list, menu);
return NULL;
}
if (!BEG_STRCASECMP(buff, "title ")) {
- char *title = Word(2, buff);
+ char *title = get_word(2, buff);
menu_set_title(menu, title);
FREE(title);
} else if (!BEG_STRCASECMP(buff, "font ")) {
- char *name = Word(2, buff);
+ char *name = get_word(2, buff);
if (!name) {
- print_error("Parse error in file %s, line %lu: Missing font name.", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Missing font name.\n", file_peek_path(), file_peek_line());
return ((void *) menu);
}
menu_set_font(menu, name);
@@ -3044,7 +3041,7 @@ parse_menu(char *buff, void *state)
menuitem_set_action(item, MENUITEM_SEP, (char *) NULL);
} else {
- print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu", file_peek_path(), file_peek_line(), buff);
+ print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", file_peek_path(), file_peek_line(), buff);
}
return ((void *) menu);
}
@@ -3065,7 +3062,7 @@ parse_menuitem(char *buff, void *state)
ASSERT_RVAL(menu != NULL, state);
if (*buff == CONF_END_CHAR) {
if (!(curitem->text)) {
- print_error("Parse error in file %s, line %lu: Menuitem context ended with no text given. Discarding this entry.", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Menuitem context ended with no text given. Discarding this entry.\n", file_peek_path(), file_peek_line());
FREE(curitem);
} else {
menu_add_item(menu, curitem);
@@ -3073,20 +3070,20 @@ parse_menuitem(char *buff, void *state)
return ((void *) menu);
}
if (!BEG_STRCASECMP(buff, "text ")) {
- char *text = Word(2, buff);
+ char *text = get_word(2, buff);
if (!text) {
- print_error("Parse error in file %s, line %lu: Missing menuitem text.", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Missing menuitem text.\n", file_peek_path(), file_peek_line());
return ((void *) curitem);
}
menuitem_set_text(curitem, text);
FREE(text);
} else if (!BEG_STRCASECMP(buff, "rtext ")) {
- char *rtext = Word(2, buff);
+ char *rtext = get_word(2, buff);
if (!rtext) {
- print_error("Parse error in file %s, line %lu: Missing menuitem right-justified text.", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Missing menuitem right-justified text.\n", file_peek_path(), file_peek_line());
return ((void *) curitem);
}
menuitem_set_rtext(curitem, rtext);
@@ -3095,8 +3092,8 @@ parse_menuitem(char *buff, void *state)
} else if (!BEG_STRCASECMP(buff, "icon ")) {
} else if (!BEG_STRCASECMP(buff, "action ")) {
- char *type = PWord(2, buff);
- char *action = Word(3, buff);
+ char *type = get_pword(2, buff);
+ char *action = get_word(3, buff);
if (!BEG_STRCASECMP(type, "submenu ")) {
menuitem_set_action(curitem, MENUITEM_SUBMENU, action);
@@ -3111,12 +3108,12 @@ parse_menuitem(char *buff, void *state)
menuitem_set_action(curitem, MENUITEM_SEP, action);
} else {
- print_error("Parse error in file %s, line %lu: Invalid menu item action \"%s\"", file_peek_path(), file_peek_line(), NONULL(type));
+ print_error("Parse error in file %s, line %lu: Invalid menu item action \"%s\"\n", file_peek_path(), file_peek_line(), NONULL(type));
}
FREE(action);
} else {
- print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu", file_peek_path(), file_peek_line(), buff);
+ print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", file_peek_path(), file_peek_line(), buff);
}
return ((void *) curitem);
}
@@ -3137,16 +3134,16 @@ parse_bbar(char *buff, void *state)
return NULL;
}
if (!BEG_STRCASECMP(buff, "font ")) {
- char *font = Word(2, buff);
+ char *font = get_word(2, buff);
bbar_set_font(bbar, font);
FREE(font);
} else if (!BEG_STRCASECMP(buff, "dock ")) {
- char *where = PWord(2, buff);
+ char *where = get_pword(2, buff);
if (!where) {
- print_error("Parse error in file %s, line %lu: Attribute dock requires a parameter", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Attribute dock requires a parameter\n", file_peek_path(), file_peek_line());
} else if (!BEG_STRCASECMP(where, "top")) {
bbar_set_docked(bbar, BBAR_DOCKED_TOP);
} else if (!BEG_STRCASECMP(where, "bot")) { /* "bot" or "bottom" */
@@ -3154,33 +3151,33 @@ parse_bbar(char *buff, void *state)
} else if (!BEG_STRCASECMP(where, "no")) { /* "no" or "none" */
bbar_set_docked(bbar, BBAR_UNDOCKED);
} else {
- print_error("Parse error in file %s, line %lu: Invalid parameter \"%s\" to attribute dock", file_peek_path(), file_peek_line(), where);
+ print_error("Parse error in file %s, line %lu: Invalid parameter \"%s\" to attribute dock\n", file_peek_path(), file_peek_line(), where);
}
} else if (!BEG_STRCASECMP(buff, "visible ")) {
- char *tmp = PWord(2, buff);
+ char *tmp = get_pword(2, buff);
if (BOOL_OPT_ISTRUE(tmp)) {
bbar_set_visible(bbar, 1);
} else if (BOOL_OPT_ISFALSE(tmp)) {
bbar_set_visible(bbar, 0);
} else {
- print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" in context button_bar", file_peek_path(), file_peek_line(), tmp);
+ print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" in context button_bar\n", file_peek_path(), file_peek_line(), tmp);
}
} else if (!BEG_STRCASECMP(buff, "button ") || !BEG_STRCASECMP(buff, "rbutton ")) {
- char *text = PWord(2, buff);
- char *icon = StrCaseStr(buff, "icon ");
- char *action = StrCaseStr(buff, "action ");
+ char *text = get_pword(2, buff);
+ char *icon = strcasestr(buff, "icon ");
+ char *action = strcasestr(buff, "action ");
button_t *button;
if (text == icon) {
text = NULL;
} else {
- text = Word(1, text);
+ text = get_word(1, text);
}
if (!text && !icon) {
- print_error("Parse error in file %s, line %lu: Missing button specifications", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Missing button specifications\n", file_peek_path(), file_peek_line());
return ((void *) bbar);
}
@@ -3188,7 +3185,7 @@ parse_bbar(char *buff, void *state)
if (icon) {
simage_t *simg;
- icon = Word(2, icon);
+ icon = get_word(2, icon);
simg = create_simage();
if (load_image(icon, simg)) {
button_set_icon(button, simg);
@@ -3198,9 +3195,9 @@ parse_bbar(char *buff, void *state)
FREE(icon);
}
if (action) {
- char *type = PWord(2, action);
+ char *type = get_pword(2, action);
- action = Word(2, type);
+ action = get_word(2, type);
if (!BEG_STRCASECMP(type, "menu ")) {
button_set_action(button, ACTION_MENU, action);
} else if (!BEG_STRCASECMP(type, "string ")) {
@@ -3208,14 +3205,14 @@ parse_bbar(char *buff, void *state)
} else if (!BEG_STRCASECMP(type, "echo ")) {
button_set_action(button, ACTION_ECHO, action);
} else {
- print_error("Parse error in file %s, line %lu: Invalid button action \"%s\"", file_peek_path(), file_peek_line(), type);
+ print_error("Parse error in file %s, line %lu: Invalid button action \"%s\"\n", file_peek_path(), file_peek_line(), type);
FREE(action);
FREE(button);
return ((void *) bbar);
}
FREE(action);
} else {
- print_error("Parse error in file %s, line %lu: Missing button action", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: Missing button action\n", file_peek_path(), file_peek_line());
FREE(button);
return ((void *) bbar);
}
@@ -3225,7 +3222,7 @@ parse_bbar(char *buff, void *state)
bbar_add_button(bbar, button);
}
} else {
- print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid "
+ print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n"
"within context menu", file_peek_path(), file_peek_line(), buff);
}
return ((void *) bbar);
@@ -3239,15 +3236,15 @@ parse_xim(char *buff, void *state)
return NULL;
}
if (!BEG_STRCASECMP(buff, "input_method ")) {
- RESET_AND_ASSIGN(rs_input_method, Word(2, buff));
+ RESET_AND_ASSIGN(rs_input_method, get_word(2, buff));
} else if (!BEG_STRCASECMP(buff, "preedit_type ")) {
- RESET_AND_ASSIGN(rs_preedit_type, Word(2, buff));
+ RESET_AND_ASSIGN(rs_preedit_type, get_word(2, buff));
} else {
- print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context xim",
+ print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context xim\n",
file_peek_path(), file_peek_line(), buff);
}
#else
- print_warning("XIM support was not compiled in, ignoring entire context");
+ print_warning("XIM support was not compiled in, ignoring entire context\n");
file_poke_skip(1);
#endif
return state;
@@ -3262,50 +3259,50 @@ parse_multichar(char *buff, void *state)
return NULL;
}
if (!BEG_STRCASECMP(buff, "encoding ")) {
- RESET_AND_ASSIGN(rs_multichar_encoding, Word(2, buff));
+ RESET_AND_ASSIGN(rs_multichar_encoding, get_word(2, buff));
if (rs_multichar_encoding != NULL) {
if (BEG_STRCASECMP(rs_multichar_encoding, "eucj")
&& BEG_STRCASECMP(rs_multichar_encoding, "sjis")
&& BEG_STRCASECMP(rs_multichar_encoding, "euckr")) {
- print_error("Parse error in file %s, line %lu: Invalid multichar encoding mode \"%s\"",
+ print_error("Parse error in file %s, line %lu: Invalid multichar encoding mode \"%s\"\n",
file_peek_path(), file_peek_line(), rs_multichar_encoding);
return NULL;
}
set_multichar_encoding(rs_multichar_encoding);
} else {
- print_error("Parse error in file %s, line %lu: Invalid parameter list \"\" for attribute encoding",
+ print_error("Parse error in file %s, line %lu: Invalid parameter list \"\" for attribute encoding\n",
file_peek_path(), file_peek_line());
}
} else if (!BEG_STRCASECMP(buff, "font ")) {
- char *tmp = PWord(2, buff);
+ char *tmp = get_pword(2, buff);
unsigned char n;
- if (NumWords(buff) != 3) {
- print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for "
+ if (num_words(buff) != 3) {
+ print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for \n"
"attribute font", file_peek_path(), file_peek_line(), NONULL(tmp));
return NULL;
}
if (isdigit(*tmp)) {
n = (unsigned char) strtoul(tmp, (char **) NULL, 0);
if (n <= 255) {
- eterm_font_add(&etmfonts, PWord(2, tmp), n);
+ eterm_font_add(&etmfonts, get_pword(2, tmp), n);
} else {
- print_error("Parse error in file %s, line %lu: Invalid font index %d",
+ print_error("Parse error in file %s, line %lu: Invalid font index %d\n",
file_peek_path(), file_peek_line(), n);
}
} else {
- tmp = Word(1, tmp);
- print_error("Parse error in file %s, line %lu: Invalid font index \"%s\"",
+ tmp = get_word(1, tmp);
+ print_error("Parse error in file %s, line %lu: Invalid font index \"%s\"\n",
file_peek_path(), file_peek_line(), NONULL(tmp));
FREE(tmp);
}
} else {
- print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context multichar",
+ print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context multichar\n",
file_peek_path(), file_peek_line(), buff);
}
#else
- print_warning("Multichar support was not compiled in, ignoring entire context");
+ print_warning("Multichar support was not compiled in, ignoring entire context\n");
file_poke_skip(1);
#endif
return state;
@@ -3405,7 +3402,7 @@ open_config_file(char *name)
*end_ptr = 0;
}
if ((ver = BEG_STRCASECMP(begin_ptr, VERSION)) > 0) {
- print_warning("Config file is designed for a newer version of " PACKAGE);
+ print_warning("Config file is designed for a newer version of \n" PACKAGE);
}
}
}
@@ -3448,7 +3445,7 @@ conf_parse(char *conf_name, const char *dir, const char *path) {
for (; fgets(buff, CONFIG_BUFF, file_peek_fp());) {
file_inc_line();
if (!strchr(buff, '\n')) {
- print_error("Parse error in file %s, line %lu: line too long", file_peek_path(), file_peek_line());
+ print_error("Parse error in file %s, line %lu: line too long\n", file_peek_path(), file_peek_line());
for (; fgets(buff, CONFIG_BUFF, file_peek_fp()) && !strrchr(buff, '\n'););
continue;
}
@@ -3462,19 +3459,19 @@ conf_parse(char *conf_name, const char *dir, const char *path) {
break;
case '%':
D_OPTIONS(("read_config(): Parsing line #%lu of file %s\n", file_peek_line(), file_peek_path()));
- if (!BEG_STRCASECMP(PWord(1, buff + 1), "include ")) {
+ if (!BEG_STRCASECMP(get_pword(1, buff + 1), "include ")) {
char *path;
FILE *fp;
shell_expand(buff);
- path = Word(2, buff + 1);
+ path = get_word(2, buff + 1);
if ((fp = open_config_file(path)) == NULL) {
- print_error("Error in file %s, line %lu: Unable to locate %%included config file %s (%s), continuing", file_peek_path(), file_peek_line(),
+ print_error("Error in file %s, line %lu: Unable to locate %%included config file %s (%s), continuing\n", file_peek_path(), file_peek_line(),
path, strerror(errno));
} else {
file_push(fp, path, NULL, 1, 0);
}
- } else if (!BEG_STRCASECMP(PWord(1, buff + 1), "preproc ")) {
+ } else if (!BEG_STRCASECMP(get_pword(1, buff + 1), "preproc ")) {
char cmd[PATH_MAX];
FILE *fp;
@@ -3482,7 +3479,7 @@ conf_parse(char *conf_name, const char *dir, const char *path) {
continue;
}
outfile = tmpnam(NULL);
- snprintf(cmd, PATH_MAX, "%s < %s > %s", PWord(2, buff), file_peek_path(), outfile);
+ snprintf(cmd, PATH_MAX, "%s < %s > %s", get_pword(2, buff), file_peek_path(), outfile);
system(cmd);
fp = fopen(outfile, "rt");
if (fp != NULL) {
@@ -3505,7 +3502,7 @@ conf_parse(char *conf_name, const char *dir, const char *path) {
continue;
}
if (!BEG_STRCASECMP(buff, "begin ")) {
- name = PWord(2, buff);
+ name = get_pword(2, buff);
ctx_name_to_id(id, name, i);
ctx_push(id);
*buff = CONF_BEGIN_CHAR;
@@ -3552,7 +3549,7 @@ conf_parse(char *conf_name, const char *dir, const char *path) {
chdir(orig_dir);
}
D_OPTIONS(("Returning \"%s\"\n", p));
- return (StrDup(p));
+ return (STRDUP(p));
}
char *
@@ -3579,7 +3576,7 @@ conf_parse_theme(char **theme, char *conf_name, unsigned char fallback)
}
}
if (fallback & PARSE_TRY_DEFAULT_THEME) {
- RESET_AND_ASSIGN(*theme, StrDup(PACKAGE));
+ RESET_AND_ASSIGN(*theme, STRDUP(PACKAGE));
if ((ret = conf_parse(conf_name, *theme, path)) != NULL) {
return ret;
}
@@ -3599,7 +3596,7 @@ parse_null(char *buff, void *state) {
} else if (*buff == CONF_END_CHAR) {
return (NULL);
} else {
- print_error("Parse error in file %s, line %lu: Not allowed in \"null\" context: \"%s\"", file_peek_path(), file_peek_line(), buff);
+ print_error("Parse error in file %s, line %lu: Not allowed in \"null\" context: \"%s\"\n", file_peek_path(), file_peek_line(), buff);
return (state);
}
}
@@ -3610,13 +3607,13 @@ init_defaults(void)
{
unsigned char i;
-#if DEBUG >= DEBUG_MALLOC
- if (debug_level >= DEBUG_MALLOC) {
+#if DEBUG >= DEBUG_MEM
+ if (DEBUG_LEVEL >= DEBUG_MEM) {
memrec_init();
}
#endif
- rs_name = StrDup(APL_NAME " " VERSION);
+ rs_name = STRDUP(APL_NAME " " VERSION);
Options = (Opt_scrollbar | Opt_select_trailing_spaces);
Xdisplay = NULL;
rs_term_name = NULL;
@@ -3647,7 +3644,7 @@ init_defaults(void)
#endif
}
#ifdef MULTI_CHARSET
- rs_multichar_encoding = StrDup(MULTICHAR_ENCODING);
+ rs_multichar_encoding = STRDUP(MULTICHAR_ENCODING);
#endif
TermWin.internalBorder = DEFAULT_BORDER_WIDTH;
}
@@ -3664,22 +3661,22 @@ post_parse(void)
#ifdef XTERM_SCROLLBAR
scrollbar_set_type(SCROLLBAR_XTERM);
#else
- print_error("Support for xterm scrollbars was not compiled in. Sorry.");
+ print_error("Support for xterm scrollbars was not compiled in. Sorry.\n");
#endif
} else if (!strcasecmp(rs_scrollbar_type, "next")) {
#ifdef NEXT_SCROLLBAR
scrollbar_set_type(SCROLLBAR_NEXT);
#else
- print_error("Support for NeXT scrollbars was not compiled in. Sorry.");
+ print_error("Support for NeXT scrollbars was not compiled in. Sorry.\n");
#endif
} else if (!strcasecmp(rs_scrollbar_type, "motif")) {
#ifdef MOTIF_SCROLLBAR
scrollbar_set_type(SCROLLBAR_MOTIF);
#else
- print_error("Support for motif scrollbars was not compiled in. Sorry.");
+ print_error("Support for motif scrollbars was not compiled in. Sorry.\n");
#endif
} else {
- print_error("Unrecognized scrollbar type \"%s\".", rs_scrollbar_type);
+ print_error("Unrecognized scrollbar type \"%s\".\n", rs_scrollbar_type);
}
}
if (rs_scrollbar_width) {
@@ -3700,11 +3697,11 @@ post_parse(void)
#ifdef PRINTPIPE
if (!rs_print_pipe)
- rs_print_pipe = StrDup(PRINTPIPE);
+ rs_print_pipe = STRDUP(PRINTPIPE);
#endif
#ifdef CUTCHAR_OPTION
if (!rs_cutchars)
- rs_cutchars = StrDup(CUTCHARS);
+ rs_cutchars = STRDUP(CUTCHARS);
#endif
#ifndef NO_BOLDFONT
@@ -3737,7 +3734,7 @@ post_parse(void)
}
if (rs_font_effects) {
if (parse_font_fx(rs_font_effects) != 1) {
- print_error("Syntax error in the font effects specified on the command line.");
+ print_error("Syntax error in the font effects specified on the command line.\n");
}
RESET_AND_ASSIGN(rs_font_effects, NULL);
}
@@ -3774,7 +3771,7 @@ post_parse(void)
if (rs_pixmaps[i]) {
reset_simage(images[i].norm, RESET_ALL_SIMG);
load_image(rs_pixmaps[i], images[i].norm);
- FREE(rs_pixmaps[i]); /* These are created by StrDup() */
+ FREE(rs_pixmaps[i]); /* These are created by STRDUP() */
}
#else
/* Right now, solid mode is the only thing we can do without pixmap support. */
@@ -3892,7 +3889,7 @@ post_parse(void)
char buff[10];
sprintf(buff, "0x%03x", ((100 - rs_shade) << 8) / 100);
- rs_cmod_image = StrDup(buff);
+ rs_cmod_image = STRDUP(buff);
}
if (rs_tint) {
char buff[10];
@@ -3908,23 +3905,23 @@ post_parse(void)
r = (t & 0xff0000) >> 16;
if (r != 0xff) {
sprintf(buff, "0x%03lx", r);
- rs_cmod_red = StrDup(buff);
+ rs_cmod_red = STRDUP(buff);
}
g = (t & 0xff00) >> 8;
if (g != 0xff) {
sprintf(buff, "0x%03lx", g);
- rs_cmod_green = StrDup(buff);
+ rs_cmod_green = STRDUP(buff);
}
b = t & 0xff;
if (b != 0xff) {
sprintf(buff, "0x%03lx", b);
- rs_cmod_blue = StrDup(buff);
+ rs_cmod_blue = STRDUP(buff);
}
}
FREE(rs_tint);
}
if (rs_cmod_image) {
- unsigned char n = NumWords(rs_cmod_image);
+ unsigned char n = num_words(rs_cmod_image);
imlib_t *iml = images[image_bg].norm->iml;
if (iml->mod) {
@@ -3933,15 +3930,15 @@ post_parse(void)
iml->mod = create_colormod();
iml->mod->brightness = (int) strtol(rs_cmod_image, (char **) NULL, 0);
if (n > 1) {
- iml->mod->contrast = (int) strtol(PWord(2, rs_cmod_image), (char **) NULL, 0);
+ iml->mod->contrast = (int) strtol(get_pword(2, rs_cmod_image), (char **) NULL, 0);
}
if (n > 2) {
- iml->mod->gamma = (int) strtol(PWord(3, rs_cmod_image), (char **) NULL, 0);
+ iml->mod->gamma = (int) strtol(get_pword(3, rs_cmod_image), (char **) NULL, 0);
}
FREE(rs_cmod_image);
}
if (rs_cmod_red) {
- unsigned char n = NumWords(rs_cmod_red);
+ unsigned char n = num_words(rs_cmod_red);
imlib_t *iml = images[image_bg].norm->iml;
if (iml->rmod) {
@@ -3950,15 +3947,15 @@ post_parse(void)
iml->rmod = create_colormod();
iml->rmod->brightness = (int) strtol(rs_cmod_red, (char **) NULL, 0);
if (n > 1) {
- iml->rmod->contrast = (int) strtol(PWord(2, rs_cmod_red), (char **) NULL, 0);
+ iml->rmod->contrast = (int) strtol(get_pword(2, rs_cmod_red), (char **) NULL, 0);
}
if (n > 2) {
- iml->rmod->gamma = (int) strtol(PWord(3, rs_cmod_red), (char **) NULL, 0);
+ iml->rmod->gamma = (int) strtol(get_pword(3, rs_cmod_red), (char **) NULL, 0);
}
FREE(rs_cmod_red);
}
if (rs_cmod_green) {
- unsigned char n = NumWords(rs_cmod_green);
+ unsigned char n = num_words(rs_cmod_green);
imlib_t *iml = images[image_bg].norm->iml;
if (iml->gmod) {
@@ -3967,15 +3964,15 @@ post_parse(void)
iml->gmod = create_colormod();
iml->gmod->brightness = (int) strtol(rs_cmod_green, (char **) NULL, 0);
if (n > 1) {
- iml->gmod->contrast = (int) strtol(PWord(2, rs_cmod_green), (char **) NULL, 0);
+ iml->gmod->contrast = (int) strtol(get_pword(2, rs_cmod_green), (char **) NULL, 0);
}
if (n > 2) {
- iml->gmod->gamma = (int) strtol(PWord(3, rs_cmod_green), (char **) NULL, 0);
+ iml->gmod->gamma = (int) strtol(get_pword(3, rs_cmod_green), (char **) NULL, 0);
}
FREE(rs_cmod_green);
}
if (rs_cmod_blue) {
- unsigned char n = NumWords(rs_cmod_blue);
+ unsigned char n = num_words(rs_cmod_blue);
imlib_t *iml = images[image_bg].norm->iml;
if (iml->bmod) {
@@ -3984,10 +3981,10 @@ post_parse(void)
iml->bmod = create_colormod();
iml->bmod->brightness = (int) strtol(rs_cmod_blue, (char **) NULL, 0);
if (n > 1) {
- iml->bmod->contrast = (int) strtol(PWord(2, rs_cmod_blue), (char **) NULL, 0);
+ iml->bmod->contrast = (int) strtol(get_pword(2, rs_cmod_blue), (char **) NULL, 0);
}
if (n > 2) {
- iml->bmod->gamma = (int) strtol(PWord(3, rs_cmod_blue), (char **) NULL, 0);
+ iml->bmod->gamma = (int) strtol(get_pword(3, rs_cmod_blue), (char **) NULL, 0);
}
FREE(rs_cmod_blue);
}
@@ -4032,28 +4029,28 @@ post_parse(void)
char *w1, *h1, *temp;
unsigned long w, h;
- count = NumWords(rs_anim_pixmap_list) - 1; /* -1 for the delay */
+ count = num_words(rs_anim_pixmap_list) - 1; /* -1 for the delay */
rs_anim_pixmaps = (char **) MALLOC(sizeof(char *) * (count + 1));
for (i = 0; i < count; i++) {
- temp = Word(i + 2, rs_anim_pixmap_list); /* +2 rather than +1 to account for the delay */
+ temp = get_word(i + 2, rs_anim_pixmap_list); /* +2 rather than +1 to account for the delay */
if (temp == NULL)
break;
- if (NumWords(temp) != 3) {
- if (NumWords(temp) == 1) {
+ if (num_words(temp) != 3) {
+ if (num_words(temp) == 1) {
rs_anim_pixmaps[i] = temp;
}
} else {
- w1 = PWord(1, temp);
- h1 = PWord(2, temp);
+ w1 = get_pword(1, temp);
+ h1 = get_pword(2, temp);
w = strtol(w1, (char **) NULL, 0);
h = strtol(h1, (char **) NULL, 0);
if (w || h) {
- rs_anim_pixmaps[i] = Word(3, temp);
+ rs_anim_pixmaps[i] = get_word(3, temp);
rs_anim_pixmaps[i] = (char *) REALLOC(rs_anim_pixmaps[i], strlen(rs_anim_pixmaps[i]) + 9);
strcat(rs_anim_pixmaps[i], "@100x100");
} else {
- rs_anim_pixmaps[i] = Word(3, temp);
+ rs_anim_pixmaps[i] = get_word(3, temp);
rs_anim_pixmaps[i] = (char *) REALLOC(rs_anim_pixmaps[i], strlen(rs_anim_pixmaps[i]) + 5);
strcat(rs_anim_pixmaps[i], "@0x0");
}
@@ -4078,14 +4075,14 @@ post_parse(void)
struct stat fst;
if (lstat(rs_pipe_name, &fst) != 0) {
- print_error("Unable to stat console pipe \"%s\" -- %s", rs_pipe_name, strerror(errno));
+ print_error("Unable to stat console pipe \"%s\" -- %s\n", rs_pipe_name, strerror(errno));
} else {
if (S_ISREG(fst.st_mode) || S_ISDIR(fst.st_mode)) {
- print_error("Directories and regular files are not valid console pipes. Sorry.");
+ print_error("Directories and regular files are not valid console pipes. Sorry.\n");
} else {
pipe_fd = open(rs_pipe_name, O_RDONLY | O_NDELAY | O_NOCTTY);
if (pipe_fd < 0) {
- print_error("Unable to open console pipe -- %s", strerror(errno));
+ print_error("Unable to open console pipe -- %s\n", strerror(errno));
}
}
}
@@ -4129,7 +4126,7 @@ save_config(char *path, unsigned char save_theme)
*(--tmp) = '/';
}
if (!mkdirhier(path) || (stat(path, &fst) && !CAN_WRITE(fst))) {
- print_error("I couldn't write to \"%s\" or \"%s\". I give up.", (theme_dir ? theme_dir : PKGDATADIR "/themes/Eterm"), path);
+ print_error("I couldn't write to \"%s\" or \"%s\". I give up.", (theme_dir ? theme_dir : PKGDATADIR "/themes/Eterm\n"), path);
return errno;
}
}
@@ -4158,7 +4155,7 @@ save_config(char *path, unsigned char save_theme)
*(--tmp) = '/';
}
if (!mkdirhier(path) || (stat(path, &fst) && !CAN_WRITE(fst))) {
- print_error("I couldn't write to \"%s\" or \"%s\". I give up.", (user_dir ? user_dir : PKGDATADIR "/themes/Eterm"), path);
+ print_error("I couldn't write to \"%s\" or \"%s\". I give up.", (user_dir ? user_dir : PKGDATADIR "/themes/Eterm\n"), path);
return errno;
}
}
@@ -4725,7 +4722,7 @@ save_config(char *path, unsigned char save_theme)
fprintf(fp, " min_anchor_size %d\n", rs_min_anchor_size);
fprintf(fp, " border_width %d\n", TermWin.internalBorder);
fprintf(fp, " term_name %s\n", getenv("TERM"));
- fprintf(fp, " debug %d\n", debug_level);
+ fprintf(fp, " debug %d\n", DEBUG_LEVEL);
if (save_theme && rs_execArgs) {
fprintf(fp, " exec ");
for (i = 0; rs_execArgs[i]; i++) {
diff --git a/src/options.h b/src/options.h
index 6f0aa67..067144f 100644
--- a/src/options.h
+++ b/src/options.h
@@ -102,10 +102,10 @@
#define BAD_THRESHOLD 3
#define CHECK_BAD() do { \
if (++bad_opts >= BAD_THRESHOLD) { \
- print_error("Error threshold exceeded, giving up."); \
+ print_error("Error threshold exceeded, giving up.\n"); \
usage(); \
} else { \
- print_error("Attempting to continue, but strange things may happen."); \
+ print_error("Attempting to continue, but strange things may happen.\n"); \
} \
} while(0)
@@ -157,9 +157,10 @@
#define file_inc_line() (fstate[fstate_idx].line++)
-#define to_keysym(p,s) do { KeySym sym; \
- if (s && ((sym = XStringToKeysym(s)) != 0)) *p = sym; \
- } while (0)
+#define to_keysym(p,s) do { KeySym sym; \
+ if (s && ((sym = XStringToKeysym(s)) != 0)) *p = sym; \
+ } 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)
@@ -251,7 +252,7 @@ extern KeySym ks_smallfont;
/************ Function Prototypes ************/
_XFUNCPROTOBEGIN
-unsigned long NumWords(const char *str);
+unsigned long num_words(const char *str);
extern void get_initial_options(int, char **);
extern void get_options(int, char **);
extern void conf_init_subsystem(void);
diff --git a/src/pixmap.c b/src/pixmap.c
index 611599d..9317321 100644
--- a/src/pixmap.c
+++ b/src/pixmap.c
@@ -38,9 +38,6 @@ static const char cvs_ident[] = "$Id$";
# include <X11/extensions/shape.h>
#endif
-#include "../libmej/debug.h"
-#include "../libmej/mem.h"
-#include "../libmej/strings.h"
#include "draw.h"
#include "e.h"
#include "icon.h"
@@ -591,7 +588,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.", imlib_image_get_filename());
+ 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;
@@ -667,7 +664,7 @@ paste_simage(simage_t *simg, unsigned char which, Drawable d, unsigned short x,
FREE(reply);
} else {
pmap = (Pixmap) strtoul(reply, (char **) NULL, 0);
- mask = (Pixmap) strtoul(PWord(2, reply), (char **) NULL, 0);
+ mask = (Pixmap) strtoul(get_pword(2, reply), (char **) NULL, 0);
FREE(reply);
enl_ipc_sync();
if (pmap) {
@@ -729,7 +726,7 @@ paste_simage(simage_t *simg, unsigned char which, Drawable d, unsigned short x,
imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, w, h);
}
if (pmap == None) {
- print_error("Delayed image load failure for \"%s\".", NONULL(imlib_image_get_filename()));
+ print_error("Delayed image load failure for \"%s\".\n", NONULL(imlib_image_get_filename()));
reset_simage(simg, RESET_ALL_SIMG);
return;
}
@@ -892,7 +889,7 @@ render_simage(simage_t * simg, Window win, unsigned short width, unsigned short
Pixmap pmap, mask;
pmap = (Pixmap) strtoul(reply, (char **) NULL, 0);
- mask = (Pixmap) strtoul(PWord(2, reply), (char **) NULL, 0);
+ mask = (Pixmap) strtoul(get_pword(2, reply), (char **) NULL, 0);
FREE(reply);
enl_ipc_sync();
if (pmap) {
@@ -1073,7 +1070,7 @@ render_simage(simage_t * simg, Window win, unsigned short width, unsigned short
XSetWindowBackgroundPixmap(Xdisplay, win, simg->pmap->pixmap);
}
} else {
- print_error("Delayed image load failure for \"%s\". Using solid color mode.", imlib_image_get_filename());
+ 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);
}
@@ -1253,7 +1250,7 @@ load_image(const char *file, simage_t *simg)
if (f != NULL) {
im = imlib_load_image_immediately(f);
if (im == NULL) {
- print_error("Unable to load image file \"%s\"", file);
+ print_error("Unable to load image file \"%s\"\n", file);
return 0;
} else {
reset_simage(simg, (RESET_IMLIB_IM | RESET_PMAP_PIXMAP | RESET_PMAP_MASK));
@@ -1640,12 +1637,12 @@ colormod_trans(Pixmap p, imlib_t *iml, GC gc, unsigned short w, unsigned short h
}
ximg = XGetImage(Xdisplay, p, 0, 0, w, h, -1, ZPixmap);
if (ximg == NULL) {
- print_warning("XGetImage(Xdisplay, 0x%08x, 0, 0, %d, %d, -1, ZPixmap) returned NULL.", p, w, h);
+ 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));
if (Xdepth <= 8) {
-#ifdef FIXME_BLOCK
+#if FIXME_BLOCK
D_PIXMAP(("Rendering low-depth image, depth == %d\n", (int) Xdepth));
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) {
@@ -1700,7 +1697,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.", real_depth);
+ print_warning("Bit depth of %d is unsupported for tinting/shading.\n", real_depth);
return;
}
}
@@ -1743,7 +1740,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 "
+ 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;
diff --git a/src/pixmap.h b/src/pixmap.h
index c1650d4..8f2f7f1 100644
--- a/src/pixmap.h
+++ b/src/pixmap.h
@@ -54,7 +54,7 @@ typedef void *Imlib_Color_Modifier;
# define CONVERT_TINT_RED(t) (((t) & 0xff0000) >> 16)
# define CONVERT_TINT_GREEN(t) (((t) & 0x00ff00) >> 8)
# define CONVERT_TINT_BLUE(t) ((t) & 0x0000ff)
-# define IMLIB_FREE_PIXMAP(p) do {D_PIXMAP(("Freeing pixmap: imlib_free_pixmap_and_mask(0x%08x)\n", (p))); imlib_free_pixmap_and_mask(p);} while (0)
+# define IMLIB_FREE_PIXMAP(p) do {D_PIXMAP(("libmej_freeing pixmap: imlib_free_pixmap_and_mask(0x%08x)\n", (p))); imlib_free_pixmap_and_mask(p);} while (0)
#else
# define background_is_image() (0)
# define background_is_trans() (0)
@@ -75,8 +75,8 @@ typedef void *Imlib_Color_Modifier;
# define X_CREATE_PIXMAP(w, h) (XCreatePixmap(Xdisplay, TermWin.parent, (w), (h), Xdepth))
# define X_CREATE_GC(flags, gcv) (XCreateGC(Xdisplay, TermWin.parent, (flags), (gcv)))
#endif
-#define X_FREE_PIXMAP(p) do {D_PIXMAP(("Freeing pixmap: XFreePixmap(Xdisplay, 0x%08x)\n", (p))); XFreePixmap(Xdisplay, (p));} while (0)
-#define X_FREE_GC(gc) do {D_PIXMAP(("Freeing GC: XFreeGC(Xdisplay, 0x%08x)\n", (gc))); XFreeGC(Xdisplay, (gc));} while (0)
+#define X_FREE_PIXMAP(p) do {D_PIXMAP(("libmej_freeing pixmap: XFreePixmap(Xdisplay, 0x%08x)\n", (p))); XFreePixmap(Xdisplay, (p));} while (0)
+#define X_FREE_GC(gc) do {D_PIXMAP(("libmej_freeing GC: XFreeGC(Xdisplay, 0x%08x)\n", (gc))); XFreeGC(Xdisplay, (gc));} while (0)
#define PIXMAP_EXT NULL
#define GEOM_LEN 19
diff --git a/src/screen.c b/src/screen.c
index a97d54b..d352993 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -30,12 +30,8 @@ static const char cvs_ident[] = "$Id$";
# include <X11/Xmu/Atoms.h>
#endif
-#include "../libmej/debug.h"
-#include "../libmej/mem.h"
-#include "../libmej/strings.h"
#include "buttons.h"
#include "command.h"
-#include "debug.h"
#include "font.h"
#include "startup.h"
#include "screen.h"
@@ -2157,7 +2153,7 @@ scr_search_scrollback(char *str)
return;
}
} else {
- last_str = StrDup(str);
+ last_str = STRDUP(str);
}
lrow = rows = TermWin.nrow + TermWin.saveLines;
cols = TermWin.ncol;
@@ -2670,7 +2666,7 @@ selection_make(Time tm)
XSetSelectionOwner(Xdisplay, XA_PRIMARY, TermWin.vt, tm);
if (XGetSelectionOwner(Xdisplay, XA_PRIMARY) != TermWin.vt)
- print_error("can't get primary selection");
+ print_error("can't get primary selection\n");
XChangeProperty(Xdisplay, Xroot, XA_CUT_BUFFER0, XA_STRING, 8,
PropModeReplace, selection.text, selection.len);
D_SELECT(("selection.len=%d\n", selection.len));
diff --git a/src/scrollbar.c b/src/scrollbar.c
index c497804..b50cd76 100644
--- a/src/scrollbar.c
+++ b/src/scrollbar.c
@@ -28,9 +28,6 @@ static const char cvs_ident[] = "$Id$";
#include <X11/cursorfont.h>
-#include "../libmej/debug.h"
-#include "../libmej/mem.h"
-#include "debug.h"
#include "buttons.h"
#include "command.h"
#include "draw.h"
@@ -880,7 +877,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.");
+ print_error("Unable to create xterm scrollbar bitmap.\n\n");
if (scrollbar_get_type() == SCROLLBAR_XTERM) {
scrollbar_set_type(SCROLLBAR_MOTIF);
}
diff --git a/src/startup.c b/src/startup.c
index 3cf3792..7c1a4d0 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -40,10 +40,6 @@ static const char cvs_ident[] = "$Id$";
#include <X11/Xatom.h>
#include <X11/Xos.h>
-#include "../libmej/debug.h" /* from libmej */
-#include "../libmej/mem.h"
-#include "../libmej/strings.h"
-#include "debug.h"
#include "startup.h"
#include "actions.h"
#include "buttons.h"
@@ -68,7 +64,6 @@ short bg_needs_update = 1;
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;
@@ -110,7 +105,7 @@ eterm_bootstrap(int argc, char *argv[])
privileges(REVERT);
#endif
if (!Xdisplay) {
- print_error("can't open display %s", display_name);
+ print_error("can't open display %s\n", display_name);
exit(EXIT_FAILURE);
}
XSetErrorHandler((XErrorHandler) xerror_handler);
@@ -217,7 +212,7 @@ eterm_bootstrap(int argc, char *argv[])
}
#if DEBUG >= DEBUG_X
- if (debug_level >= DEBUG_X) {
+ if (DEBUG_LEVEL >= DEBUG_X) {
XSync(Xdisplay, False);
XSynchronize(Xdisplay, True);
}
diff --git a/src/system.c b/src/system.c
index c3eedc6..24718b3 100644
--- a/src/system.c
+++ b/src/system.c
@@ -36,13 +36,11 @@ static const char cvs_ident[] = "$Id$";
# include <sys/wait.h>
#endif
-#include "../libmej/debug.h"
-#include "debug.h"
#include "command.h"
#include "misc.h"
#include "system.h"
-/*static sighandler_t old_handler = (sighandler_t) NULL;*/
+/*static eterm_sighandler_t old_handler = (eterm_sighandler_t) NULL;*/
int
wait_for_chld(int system_pid)
@@ -94,7 +92,7 @@ system_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", command, strerror(errno));
+ print_error("execl(%s) failed -- %s\n", command, strerror(errno));
exit(EXIT_FAILURE);
} else {
D_OPTIONS(("%d: fork() returned %d\n", getpid(), pid));
@@ -114,7 +112,7 @@ 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", command, strerror(errno));
+ print_error("execl(%s) failed -- %s\n", command, strerror(errno));
exit(EXIT_FAILURE);
}
return (0);
diff --git a/src/system.h b/src/system.h
index 88390ef..24e99f6 100644
--- a/src/system.h
+++ b/src/system.h
@@ -32,7 +32,7 @@
# define system(c) system_no_wait((c))
#endif
-typedef RETSIGTYPE (*sighandler_t)(int);
+typedef RETSIGTYPE (*eterm_sighandler_t)(int);
extern int wait_for_chld(int);
extern int system_wait(char *);
diff --git a/src/term.c b/src/term.c
index 50fa009..d43e92e 100644
--- a/src/term.c
+++ b/src/term.c
@@ -31,10 +31,6 @@ static const char cvs_ident[] = "$Id$";
#include <errno.h>
#include <limits.h>
-#include "../libmej/debug.h"
-#include "../libmej/mem.h"
-#include "../libmej/strings.h"
-#include "debug.h"
#include "actions.h"
#include "buttons.h"
#include "command.h"
@@ -181,7 +177,7 @@ get_modifiers(void)
}
}
-/* To handle buffer overflows properly, we must malloc a buffer. Free it when done. */
+/* To handle buffer overflows properly, we must malloc a buffer. libmej_free it when done. */
#ifdef USE_XIM
# define LK_RET() do {if (kbuf_alloced) FREE(kbuf); return;} while (0)
#else
@@ -359,7 +355,7 @@ lookup_key(XEvent * ev)
switch (keysym) {
case XK_Print: /* Print the screen contents out to the print pipe */
#if DEBUG >= DEBUG_SELECTION
- if (debug_level >= DEBUG_SELECTION) {
+ if (DEBUG_LEVEL >= DEBUG_SELECTION) {
debug_selection();
}
#endif
@@ -770,11 +766,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.");
- RESET_AND_ASSIGN(rs_print_pipe, StrDup(PRINTPIPE));
+ 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", rs_print_pipe, strerror(errno));
+ print_error("Can't open printer pipe \"%s\" -- %s\n", rs_print_pipe, strerror(errno));
}
return stream;
}
@@ -1646,7 +1642,7 @@ set_title(const char *str)
}
D_X11(("Setting window title to \"%s\"\n", str));
XStoreName(Xdisplay, TermWin.parent, str);
- name = StrDup(str);
+ name = STRDUP(str);
}
}
@@ -1662,7 +1658,7 @@ set_icon_name(const char *str)
}
D_X11(("Setting window icon name to \"%s\"\n", str));
XSetIconName(Xdisplay, TermWin.parent, str);
- name = StrDup(str);
+ name = STRDUP(str);
}
}
@@ -1733,7 +1729,7 @@ xterm_seq(int op, const char *str)
return;
#ifdef PIXMAP_SUPPORT
- orig_tnstr = tnstr = StrDup(str);
+ orig_tnstr = tnstr = STRDUP(str);
#endif
switch (op) {
@@ -2104,22 +2100,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.");
+ 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.");
+ 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.");
+ print_error("Support for motif scrollbars was not compiled in. Sorry.\n");
#endif
} else {
- print_error("Unrecognized scrollbar type \"%s\".", nstr);
+ print_error("Unrecognized scrollbar type \"%s\".\n", nstr);
}
}
nstr = (char *) strsep(&tnstr, ";");
@@ -2267,7 +2263,7 @@ xterm_seq(int op, const char *str)
/* Set debugging level */
nstr = (char *) strsep(&tnstr, ";");
if (nstr && *nstr) {
- debug_level = (unsigned int) strtoul(nstr, (char **) NULL, 0);
+ DEBUG_LEVEL = (unsigned int) strtoul(nstr, (char **) NULL, 0);
}
break;
diff --git a/src/timer.c b/src/timer.c
index 5bf73da..60823a1 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -31,11 +31,7 @@ static const char cvs_ident[] = "$Id$";
#include <errno.h>
#include <limits.h>
-#include "../libmej/debug.h"
-#include "../libmej/strings.h"
-#include "debug.h"
#include "startup.h"
-#include "mem.h"
#include "command.h"
#include "events.h"
#include "options.h"
diff --git a/src/utmp.c b/src/utmp.c
index 2c6a454..422fac4 100644
--- a/src/utmp.c
+++ b/src/utmp.c
@@ -68,13 +68,11 @@ static const char cvs_ident[] = "$Id$";
# ifdef HAVE_LASTLOG_H
# include <lastlog.h>
# endif
-# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
+# if defined(__libmej_freeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
# include <ttyent.h>
# endif
# include "eterm_utmp.h"
-# include "debug.h"
-# include "../libmej/debug.h"
# include "command.h"
# include "screen.h"
@@ -85,7 +83,7 @@ static const char cvs_ident[] = "$Id$";
/* don't go off end of ut_id & remember if an entry has been made */
# ifndef HAVE_UTEMPTER
-# if defined(USE_SYSV_UTMP) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
+# if defined(USE_SYSV_UTMP) || defined(__libmej_freeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
static char ut_id[5]; /* remember if entry to utmp made */
# else
static int utmp_pos; /* BSD position of utmp-stamp */
@@ -170,7 +168,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\"", pty);
+ print_error("can't parse tty name \"%s\"\n", pty);
ut_id[0] = '\0'; /* entry not made */
return;
}
@@ -276,7 +274,7 @@ remove_utmp_entry(void)
# else /* USE_SYSV_UTMP */
/* BSD utmp support */
-# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
+# if defined(__libmej_freeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
/* used to hold the line we are using */
static char ut_line[32];
@@ -324,7 +322,7 @@ b_login(struct utmp *ut)
}
}
-# else /* __FreeBSD__ || NetBSD || BSDI */
+# else /* __libmej_freeBSD__ || NetBSD || BSDI */
static int utmp_pos = 0; /* position of utmp-stamp */
/*----------------------------------------------------------------------*
@@ -382,7 +380,7 @@ write_utmp(struct utmp *putmp)
return rval;
}
-# endif /* __FreeBSD__ || NetBSD || BSDI */
+# endif /* __libmej_freeBSD__ || NetBSD || BSDI */
void
add_utmp_entry(const char *pty, const char *hostname, int fd)
@@ -397,12 +395,12 @@ add_utmp_entry(const char *pty, const char *hostname, int fd)
if (!strncmp(pty, "pty", 3) || !strncmp(pty, "tty", 3))
strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */
else {
- print_error("can't parse tty name \"%s\"", pty);
+ 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__)
+# if defined(__libmej_freeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
strncpy(ut_line, pty, 31);
strncpy(utmp.ut_line, pty, UT_LINESIZE);
@@ -411,7 +409,7 @@ add_utmp_entry(const char *pty, const char *hostname, int fd)
utmp.ut_time = time(NULL);
b_login(&utmp);
-# else /* __FreeBSD__ || NetBSD || BSDI */
+# else /* __libmej_freeBSD__ || NetBSD || BSDI */
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));
@@ -430,10 +428,10 @@ add_utmp_entry(const char *pty, const char *hostname, int fd)
void
remove_utmp_entry(void)
{
-# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
+# if defined(__libmej_freeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
logout(ut_line);
logwtmp(ut_line, "", "");
-# else /* __FreeBSD__ */
+# else /* __libmej_freeBSD__ */
FILE *fd;
privileges(INVOKE);
@@ -447,7 +445,7 @@ remove_utmp_entry(void)
fclose(fd);
}
privileges(REVERT);
-# endif /* __FreeBSD__ || NetBSD || BSDI */
+# endif /* __libmej_freeBSD__ || NetBSD || BSDI */
}
# endif /* USE_SYSV_UTMP */
diff --git a/src/windows.c b/src/windows.c
index a96a982..d480cfa 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -32,10 +32,6 @@ static const char cvs_ident[] = "$Id$";
#include <limits.h>
#include <X11/cursorfont.h>
-#include "../libmej/debug.h"
-#include "../libmej/mem.h"
-#include "../libmej/strings.h"
-#include "debug.h"
#include "buttons.h"
#include "command.h"
#include "e.h"
@@ -101,7 +97,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, Xcmap, color, &xcol)) {
- print_error("Unable to parse tint color \"%s\". Ignoring.", color);
+ print_error("Unable to parse tint color \"%s\". Ignoring.\n", color);
return 0xffffff;
}
@@ -146,7 +142,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.", type, xcol.pixel, xcol.red, xcol.green, xcol.blue);
+ 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];
}
return (xcol.pixel);
@@ -178,7 +174,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.", type, xcol.pixel, xcol.red, xcol.green, xcol.blue);
+ 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];
}
return (xcol.pixel);
@@ -197,11 +193,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\".", name, NONULL(fallback));
+ 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("Unable to resolve \"%s\" as a color name. This should never fail. Please repair/restore your RGB database.", name);
+ 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);
}
} else {
@@ -209,12 +205,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\".",
+ 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.", name, xcol.pixel, xcol.red, xcol.green, xcol.blue);
+ 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);
}
} else {
@@ -231,18 +227,18 @@ 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.", pixel, fallback);
+ 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.", xcol.pixel);
+ 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.", xcol.pixel, xcol.red, xcol.green, xcol.blue, fallback);
+ 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.", xcol.pixel, xcol.red, xcol.green, xcol.blue);
+ 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);
}
}
@@ -323,7 +319,7 @@ Create_Windows(int argc, char *argv[])
if (Options & Opt_borderless) {
prop = XInternAtom(Xdisplay, "_MOTIF_WM_HINTS", True);
if (prop == None) {
- print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.");
+ 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 {
@@ -663,17 +659,17 @@ set_window_color(int idx, const char *color)
if (i >= 0 && i <= 7) { /* normal colors */
PixColors[idx] = PixColors[minColor + i];
} else {
- print_warning("Color index %d is invalid.", i);
+ 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.", color);
+ print_warning("Unable to allocate \"%s\" in the color map.\n", color);
return;
}
PixColors[idx] = xcol.pixel;
} else {
- print_warning("Unable to resolve \"%s\" as a color name.", color);
+ print_warning("Unable to resolve \"%s\" as a color name.\n", color);
return;
}
redraw_image(image_bg);