Fri Aug 22 00:09:04 2003 Michael Jennings (mej)

Had I done it right the first time, this would not have happened. >:I


SVN revision: 7363
This commit is contained in:
Michael Jennings 2003-08-22 04:09:40 +00:00
parent 0784d8336b
commit 4e5e3617be
7 changed files with 93 additions and 89 deletions

View File

@ -5089,3 +5089,7 @@ Thu Aug 21 23:51:12 2003 Michael Jennings (mej)
Oops, that wasn't *quite* what I had in mind....
----------------------------------------------------------------------
Fri Aug 22 00:09:04 2003 Michael Jennings (mej)
Had I done it right the first time, this would not have happened. >:I
----------------------------------------------------------------------

View File

@ -28,58 +28,58 @@
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_eterm_options 1
# define D_eterm_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_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_SCRIPT 2
# define D_SCRIPT(x) DPRINTF2(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_SCRIPT 2
# define D_SCRIPT(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_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_ESCREEN 4
# define D_ESCREEN(x) DPRINTF4(x)
# define DEBUG_ACTIONS 4
# define D_ACTIONS(x) DPRINTF4(x)
# define DEBUG_ESCREEN 4
# define D_ESCREEN(x) DPRINTF4(x)
# define DEBUG_PROFILE 5
# define D_PROFILE(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_VT 6
# define D_VT(x) DPRINTF6(x)
# define DEBUG_X 9
# define DEBUG_X 9
#endif /* _ETERM_DEBUG_H */

View File

@ -158,7 +158,7 @@ KeySym ks_bigfont = XK_greater;
KeySym ks_smallfont = XK_less;
#endif
/* eterm_options structure */
/* Eterm options structure */
spifopt_t option_list[] = {
SPIFOPT_STR_PP('t', "theme", "select a theme", rs_theme),
SPIFOPT_STR_PP('X', "config-file", "choose an alternate config file", rs_config_file),
@ -422,8 +422,8 @@ version(void)
#if DEBUG >= DEBUG_UTMP
printf(" +DEBUG_UTMP");
#endif
#if DEBUG >= DEBUG_eterm_options
printf(" +DEBUG_eterm_options");
#if DEBUG >= DEBUG_OPTIONS
printf(" +DEBUG_OPTIONS");
#endif
#if DEBUG >= DEBUG_IMLIB
printf(" +DEBUG_IMLIB");
@ -1459,7 +1459,7 @@ parse_misc(char *buff, void *state)
for (k = 0; k < n; k++) {
rs_exec_args[k] = get_word(k + 2, buff);
D_eterm_options(("rs_exec_args[%d] == %s\n", k, rs_exec_args[k]));
D_OPTIONS(("rs_exec_args[%d] == %s\n", k, rs_exec_args[k]));
}
rs_exec_args[n] = (char *) NULL;
@ -3043,7 +3043,7 @@ save_config(char *path, unsigned char save_theme)
action_t *action;
buttonbar_t *bbar;
D_eterm_options(("Saving %s config to \"%s\"\n", (save_theme ? "theme" : "user"), NONULL(path)));
D_OPTIONS(("Saving %s config to \"%s\"\n", (save_theme ? "theme" : "user"), NONULL(path)));
cur_tm = localtime(&cur_time);
@ -3055,7 +3055,7 @@ save_config(char *path, unsigned char save_theme)
if (stat(path, &fst) || !S_ISDIR(fst.st_mode) || !CAN_WRITE(fst)) {
char *tmp = NULL;
D_eterm_options(("Problem with \"%s\". S_ISDIR == %d, CAN_WRITE == %d\n", path, S_ISDIR(fst.st_mode), CAN_WRITE(fst)));
D_OPTIONS(("Problem with \"%s\". S_ISDIR == %d, CAN_WRITE == %d\n", path, S_ISDIR(fst.st_mode), CAN_WRITE(fst)));
if (theme_dir) {
tmp = strrchr(theme_dir, '/');
if (tmp) {
@ -3063,7 +3063,7 @@ save_config(char *path, unsigned char save_theme)
}
}
snprintf(path, PATH_MAX, "%s/.Eterm/themes/%s", getenv("HOME"), (tmp ? tmp : "Eterm"));
D_eterm_options(("Trying \"%s\" instead, tmp == \"%s\"\n", path, tmp));
D_OPTIONS(("Trying \"%s\" instead, tmp == \"%s\"\n", path, tmp));
if (tmp) {
*(--tmp) = '/';
}
@ -3074,7 +3074,7 @@ save_config(char *path, unsigned char save_theme)
}
}
strcat(path, "/" THEME_CFG);
D_eterm_options(("Final path is \"%s\"\n", path));
D_OPTIONS(("Final path is \"%s\"\n", path));
path[PATH_MAX] = 0;
}
} else {
@ -3085,7 +3085,7 @@ save_config(char *path, unsigned char save_theme)
if (stat(path, &fst) || !S_ISDIR(fst.st_mode) || !CAN_WRITE(fst)) {
char *tmp = NULL;
D_eterm_options(("Problem with \"%s\". S_ISDIR == %d, CAN_WRITE == %d\n", path, S_ISDIR(fst.st_mode), CAN_WRITE(fst)));
D_OPTIONS(("Problem with \"%s\". S_ISDIR == %d, CAN_WRITE == %d\n", path, S_ISDIR(fst.st_mode), CAN_WRITE(fst)));
if (user_dir) {
tmp = strrchr(user_dir, '/');
if (tmp) {
@ -3093,7 +3093,7 @@ save_config(char *path, unsigned char save_theme)
}
}
snprintf(path, PATH_MAX, "%s/.Eterm/themes/%s", getenv("HOME"), (tmp ? tmp : "Eterm"));
D_eterm_options(("Trying \"%s\" instead, tmp == \"%s\"\n", path, tmp));
D_OPTIONS(("Trying \"%s\" instead, tmp == \"%s\"\n", path, tmp));
if (tmp) {
*(--tmp) = '/';
}
@ -3104,7 +3104,7 @@ save_config(char *path, unsigned char save_theme)
}
}
strcat(path, "/" USER_CFG);
D_eterm_options(("Final path is \"%s\"\n", path));
D_OPTIONS(("Final path is \"%s\"\n", path));
path[PATH_MAX] = 0;
}
}
@ -3809,7 +3809,7 @@ save_config(char *path, unsigned char save_theme)
}
fprintf(fp, "\n");
}
#ifdef CUTCHAR_eterm_options
#ifdef CUTCHAR_OPTION
if (rs_cutchars) {
fprintf(fp, " cut_chars '%s'\n", rs_cutchars);
}

View File

@ -21,8 +21,8 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _eterm_options_H_
#define _eterm_options_H_
#ifndef _OPTIONS_H_
#define _OPTIONS_H_
#include <X11/Xfuncproto.h>
#include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */
@ -150,4 +150,4 @@ unsigned char save_config(char *, unsigned char);
_XFUNCPROTOEND
#endif /* _eterm_options_H_ */
#endif /* _OPTIONS_H_ */

View File

@ -1296,25 +1296,25 @@ search_path(const char *pathlist, const char *file)
}
getcwd(name, PATH_MAX);
len = strlen(name);
D_eterm_options(("search_path(\"%s\", \"%s\") called from \"%s\".\n", pathlist, file, name));
D_OPTIONS(("search_path(\"%s\", \"%s\") called from \"%s\".\n", pathlist, file, name));
if (len < PATH_MAX - 1) {
strcat(name, "/");
strncat(name, file, PATH_MAX - len - 1);
}
D_eterm_options(("Checking for file \"%s\"\n", name));
D_OPTIONS(("Checking for file \"%s\"\n", name));
if (!access(name, R_OK)) {
if (stat(name, &fst)) {
D_eterm_options(("Unable to stat %s -- %s\n", name, strerror(errno)));
D_OPTIONS(("Unable to stat %s -- %s\n", name, strerror(errno)));
} else {
D_eterm_options(("Stat returned mode 0x%08o, S_ISDIR() == %d\n", fst.st_mode, S_ISDIR(fst.st_mode)));
D_OPTIONS(("Stat returned mode 0x%08o, S_ISDIR() == %d\n", fst.st_mode, S_ISDIR(fst.st_mode)));
}
if (!S_ISDIR(fst.st_mode)) {
return name;
} else {
D_eterm_options(("%s is a directory.\n", name));
D_OPTIONS(("%s is a directory.\n", name));
}
} else {
D_eterm_options(("Unable to access %s -- %s\n", name, strerror(errno)));
D_OPTIONS(("Unable to access %s -- %s\n", name, strerror(errno)));
}
if ((p = strchr(file, '@')) == NULL)
@ -1327,20 +1327,20 @@ search_path(const char *pathlist, const char *file)
/* check if we can find it now */
strncpy(name, file, len);
name[len] = '\0';
D_eterm_options(("Checking for file \"%s\"\n", name));
D_OPTIONS(("Checking for file \"%s\"\n", name));
if (!access(name, R_OK)) {
if (stat(name, &fst)) {
D_eterm_options(("Unable to stat %s -- %s\n", name, strerror(errno)));
D_OPTIONS(("Unable to stat %s -- %s\n", name, strerror(errno)));
} else {
D_eterm_options(("Stat returned mode 0x%08o, S_ISDIR() == %d\n", fst.st_mode, S_ISDIR(fst.st_mode)));
D_OPTIONS(("Stat returned mode 0x%08o, S_ISDIR() == %d\n", fst.st_mode, S_ISDIR(fst.st_mode)));
}
if (!S_ISDIR(fst.st_mode)) {
return name;
} else {
D_eterm_options(("%s is a directory.\n", name));
D_OPTIONS(("%s is a directory.\n", name));
}
} else {
D_eterm_options(("Unable to access %s -- %s\n", name, strerror(errno)));
D_OPTIONS(("Unable to access %s -- %s\n", name, strerror(errno)));
}
for (path = pathlist; path != NULL && *path != '\0'; path = p) {
int n;
@ -1372,24 +1372,24 @@ search_path(const char *pathlist, const char *file)
name[n++] = '/';
name[n] = '\0';
strncat(name, file, len);
D_eterm_options(("Checking for file \"%s\"\n", name));
D_OPTIONS(("Checking for file \"%s\"\n", name));
if (!access(name, R_OK)) {
if (stat(name, &fst)) {
D_eterm_options(("Unable to stat %s -- %s\n", name, strerror(errno)));
D_OPTIONS(("Unable to stat %s -- %s\n", name, strerror(errno)));
} else {
D_eterm_options(("Stat returned mode 0x%08o, S_ISDIR() == %d\n", fst.st_mode, S_ISDIR(fst.st_mode)));
D_OPTIONS(("Stat returned mode 0x%08o, S_ISDIR() == %d\n", fst.st_mode, S_ISDIR(fst.st_mode)));
}
if (!S_ISDIR(fst.st_mode)) {
return name;
} else {
D_eterm_options(("%s is a directory.\n", name));
D_OPTIONS(("%s is a directory.\n", name));
}
} else {
D_eterm_options(("Unable to access %s -- %s\n", name, strerror(errno)));
D_OPTIONS(("Unable to access %s -- %s\n", name, strerror(errno)));
}
}
}
D_eterm_options(("File \"%s\" not found in path.\n", file));
D_OPTIONS(("File \"%s\" not found in path.\n", file));
return ((const char *) NULL);
}

View File

@ -150,7 +150,7 @@ eterm_bootstrap(int argc, char *argv[])
if ((theme_dir = conf_parse_theme(&rs_theme, THEME_CFG, PARSE_TRY_ALL)) != NULL) {
char *tmp;
D_eterm_options(("conf_parse_theme() returned \"%s\"\n", theme_dir));
D_OPTIONS(("conf_parse_theme() returned \"%s\"\n", theme_dir));
tmp = (char *) MALLOC(strlen(theme_dir) + sizeof("ETERM_THEME_ROOT=\0"));
sprintf(tmp, "ETERM_THEME_ROOT=%s", theme_dir);
putenv(tmp);
@ -158,7 +158,7 @@ eterm_bootstrap(int argc, char *argv[])
if ((user_dir = conf_parse_theme(&rs_theme, (rs_config_file ? rs_config_file : USER_CFG), (PARSE_TRY_USER_THEME | PARSE_TRY_NO_THEME))) != NULL) {
char *tmp;
D_eterm_options(("conf_parse_theme() returned \"%s\"\n", user_dir));
D_OPTIONS(("conf_parse_theme() returned \"%s\"\n", user_dir));
tmp = (char *) MALLOC(strlen(user_dir) + sizeof("ETERM_USER_ROOT=\0"));
sprintf(tmp, "ETERM_USER_ROOT=%s", user_dir);
putenv(tmp);
@ -184,7 +184,7 @@ eterm_bootstrap(int argc, char *argv[])
tmp[len] = '\0';
FREE(rs_path);
rs_path = tmp;
D_eterm_options(("New rs_path set to \"%s\"\n", rs_path));
D_OPTIONS(("New rs_path set to \"%s\"\n", rs_path));
}
#endif
spifopt_parse(argc, argv);

View File

@ -47,7 +47,7 @@ wait_for_chld(int system_pid)
{
int pid, status = 0, save_errno = errno, code;
D_eterm_options(("wait_for_chld(%ld) called.\n", system_pid));
D_OPTIONS(("wait_for_chld(%ld) called.\n", system_pid));
while (1) {
do {
@ -60,14 +60,14 @@ wait_for_chld(int system_pid)
errno = save_errno;
break;
}
D_eterm_options(("%ld exited.\n", pid));
D_OPTIONS(("%ld exited.\n", pid));
if (pid == system_pid || system_pid == -1) {
if (WIFEXITED(status)) {
code = WEXITSTATUS(status);
D_eterm_options(("Child process exited with return code %lu\n", code));
D_OPTIONS(("Child process exited with return code %lu\n", code));
} else if (WIFSIGNALED(status)) {
code = WTERMSIG(status);
D_eterm_options(("Child process was terminated by unhandled signal %lu\n", code));
D_OPTIONS(("Child process was terminated by unhandled signal %lu\n", code));
} else {
code = 0;
}
@ -86,7 +86,7 @@ system_wait(char *command)
pid_t pid;
D_eterm_options(("system_wait(%s) called.\n", command));
D_OPTIONS(("system_wait(%s) called.\n", command));
if (!(pid = fork())) {
setreuid(my_ruid, my_ruid);
@ -95,7 +95,7 @@ system_wait(char *command)
print_error("execl(%s) failed -- %s\n", command, strerror(errno));
exit(EXIT_FAILURE);
} else {
D_eterm_options(("%d: fork() returned %d\n", getpid(), pid));
D_OPTIONS(("%d: fork() returned %d\n", getpid(), pid));
return (wait_for_chld(pid));
}
ASSERT_NOTREACHED_RVAL(0);
@ -107,7 +107,7 @@ system_no_wait(char *command)
pid_t pid;
D_eterm_options(("system_no_wait(%s) called.\n", command));
D_OPTIONS(("system_no_wait(%s) called.\n", command));
if (!(pid = fork())) {
setreuid(my_ruid, my_ruid);