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.... 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 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 */ both the DEBUG_ definition and the D_ macro (if there is one). -- mej */
# define DEBUG_SCREEN 1 # define DEBUG_SCREEN 1
# define D_SCREEN(x) DPRINTF1(x) # define D_SCREEN(x) DPRINTF1(x)
# define DEBUG_CMD 1 # define DEBUG_CMD 1
# define D_CMD(x) DPRINTF1(x) # define D_CMD(x) DPRINTF1(x)
# define DEBUG_TTY 1 # define DEBUG_TTY 1
# define D_TTY(x) DPRINTF1(x) # define D_TTY(x) DPRINTF1(x)
# define DEBUG_SELECTION 1 # define DEBUG_SELECTION 1
# define D_SELECT(x) DPRINTF1(x) # define D_SELECT(x) DPRINTF1(x)
# define DEBUG_UTMP 1 # define DEBUG_UTMP 1
# define D_UTMP(x) DPRINTF1(x) # define D_UTMP(x) DPRINTF1(x)
# define DEBUG_eterm_options 1 # define DEBUG_OPTIONS 1
# define D_eterm_options(x) DPRINTF1(x) # define D_OPTIONS(x) DPRINTF1(x)
# define DEBUG_IMLIB 1 # define DEBUG_IMLIB 1
# define D_IMLIB(x) DPRINTF1(x) # define D_IMLIB(x) DPRINTF1(x)
# define DEBUG_PIXMAP 1 # define DEBUG_PIXMAP 1
# define D_PIXMAP(x) DPRINTF1(x) # define D_PIXMAP(x) DPRINTF1(x)
# define DEBUG_EVENTS 1 # define DEBUG_EVENTS 1
# define D_EVENTS(x) DPRINTF1(x) # define D_EVENTS(x) DPRINTF1(x)
# define DEBUG_X11 2 # define DEBUG_X11 2
# define D_X11(x) DPRINTF2(x) # define D_X11(x) DPRINTF2(x)
# define DEBUG_ENL 2 # define DEBUG_ENL 2
# define D_ENL(x) DPRINTF2(x) # define D_ENL(x) DPRINTF2(x)
# define DEBUG_SCROLLBAR 2 # define DEBUG_SCROLLBAR 2
# define D_SCROLLBAR(x) DPRINTF2(x) # define D_SCROLLBAR(x) DPRINTF2(x)
# define DEBUG_BBAR 2 # define DEBUG_BBAR 2
# define D_BBAR(x) DPRINTF2(x) # define D_BBAR(x) DPRINTF2(x)
# define DEBUG_TIMER 2 # define DEBUG_TIMER 2
# define D_TIMER(x) DPRINTF2(x) # define D_TIMER(x) DPRINTF2(x)
# define DEBUG_SCRIPT 2 # define DEBUG_SCRIPT 2
# define D_SCRIPT(x) DPRINTF2(x) # define D_SCRIPT(x) DPRINTF2(x)
# define DEBUG_MENU 3 # define DEBUG_MENU 3
# define D_MENU(x) DPRINTF3(x) # define D_MENU(x) DPRINTF3(x)
# define DEBUG_FONT 3 # define DEBUG_FONT 3
# define D_FONT(x) DPRINTF3(x) # define D_FONT(x) DPRINTF3(x)
# define DEBUG_TTYMODE 3 # define DEBUG_TTYMODE 3
# define D_TTYMODE(x) DPRINTF3(x) # define D_TTYMODE(x) DPRINTF3(x)
# define DEBUG_COLORS 3 # define DEBUG_COLORS 3
# define D_COLORS(x) DPRINTF3(x) # define D_COLORS(x) DPRINTF3(x)
# define DEBUG_ACTIONS 4 # define DEBUG_ACTIONS 4
# define D_ACTIONS(x) DPRINTF4(x) # define D_ACTIONS(x) DPRINTF4(x)
# define DEBUG_ESCREEN 4 # define DEBUG_ESCREEN 4
# define D_ESCREEN(x) DPRINTF4(x) # define D_ESCREEN(x) DPRINTF4(x)
# define DEBUG_PROFILE 5 # define DEBUG_PROFILE 5
# define D_PROFILE(x) DPRINTF5(x) # define D_PROFILE(x) DPRINTF5(x)
# define DEBUG_VT 6 # define DEBUG_VT 6
# define D_VT(x) DPRINTF6(x) # define D_VT(x) DPRINTF6(x)
# define DEBUG_X 9 # define DEBUG_X 9
#endif /* _ETERM_DEBUG_H */ #endif /* _ETERM_DEBUG_H */

View File

@ -158,7 +158,7 @@ KeySym ks_bigfont = XK_greater;
KeySym ks_smallfont = XK_less; KeySym ks_smallfont = XK_less;
#endif #endif
/* eterm_options structure */ /* Eterm options structure */
spifopt_t option_list[] = { spifopt_t option_list[] = {
SPIFOPT_STR_PP('t', "theme", "select a theme", rs_theme), SPIFOPT_STR_PP('t', "theme", "select a theme", rs_theme),
SPIFOPT_STR_PP('X', "config-file", "choose an alternate config file", rs_config_file), SPIFOPT_STR_PP('X', "config-file", "choose an alternate config file", rs_config_file),
@ -422,8 +422,8 @@ version(void)
#if DEBUG >= DEBUG_UTMP #if DEBUG >= DEBUG_UTMP
printf(" +DEBUG_UTMP"); printf(" +DEBUG_UTMP");
#endif #endif
#if DEBUG >= DEBUG_eterm_options #if DEBUG >= DEBUG_OPTIONS
printf(" +DEBUG_eterm_options"); printf(" +DEBUG_OPTIONS");
#endif #endif
#if DEBUG >= DEBUG_IMLIB #if DEBUG >= DEBUG_IMLIB
printf(" +DEBUG_IMLIB"); printf(" +DEBUG_IMLIB");
@ -1459,7 +1459,7 @@ parse_misc(char *buff, void *state)
for (k = 0; k < n; k++) { for (k = 0; k < n; k++) {
rs_exec_args[k] = get_word(k + 2, buff); 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; rs_exec_args[n] = (char *) NULL;
@ -3043,7 +3043,7 @@ save_config(char *path, unsigned char save_theme)
action_t *action; action_t *action;
buttonbar_t *bbar; 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); 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)) { if (stat(path, &fst) || !S_ISDIR(fst.st_mode) || !CAN_WRITE(fst)) {
char *tmp = NULL; 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) { if (theme_dir) {
tmp = strrchr(theme_dir, '/'); tmp = strrchr(theme_dir, '/');
if (tmp) { 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")); 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) { if (tmp) {
*(--tmp) = '/'; *(--tmp) = '/';
} }
@ -3074,7 +3074,7 @@ save_config(char *path, unsigned char save_theme)
} }
} }
strcat(path, "/" THEME_CFG); 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; path[PATH_MAX] = 0;
} }
} else { } 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)) { if (stat(path, &fst) || !S_ISDIR(fst.st_mode) || !CAN_WRITE(fst)) {
char *tmp = NULL; 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) { if (user_dir) {
tmp = strrchr(user_dir, '/'); tmp = strrchr(user_dir, '/');
if (tmp) { 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")); 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) { if (tmp) {
*(--tmp) = '/'; *(--tmp) = '/';
} }
@ -3104,7 +3104,7 @@ save_config(char *path, unsigned char save_theme)
} }
} }
strcat(path, "/" USER_CFG); 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; path[PATH_MAX] = 0;
} }
} }
@ -3809,7 +3809,7 @@ save_config(char *path, unsigned char save_theme)
} }
fprintf(fp, "\n"); fprintf(fp, "\n");
} }
#ifdef CUTCHAR_eterm_options #ifdef CUTCHAR_OPTION
if (rs_cutchars) { if (rs_cutchars) {
fprintf(fp, " cut_chars '%s'\n", 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _eterm_options_H_ #ifndef _OPTIONS_H_
#define _eterm_options_H_ #define _OPTIONS_H_
#include <X11/Xfuncproto.h> #include <X11/Xfuncproto.h>
#include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */ #include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */
@ -150,4 +150,4 @@ unsigned char save_config(char *, unsigned char);
_XFUNCPROTOEND _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); getcwd(name, PATH_MAX);
len = strlen(name); 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) { if (len < PATH_MAX - 1) {
strcat(name, "/"); strcat(name, "/");
strncat(name, file, PATH_MAX - len - 1); 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 (!access(name, R_OK)) {
if (stat(name, &fst)) { 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 { } 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)) { if (!S_ISDIR(fst.st_mode)) {
return name; return name;
} else { } else {
D_eterm_options(("%s is a directory.\n", name)); D_OPTIONS(("%s is a directory.\n", name));
} }
} else { } 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) if ((p = strchr(file, '@')) == NULL)
@ -1327,20 +1327,20 @@ search_path(const char *pathlist, const char *file)
/* check if we can find it now */ /* check if we can find it now */
strncpy(name, file, len); strncpy(name, file, len);
name[len] = '\0'; 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 (!access(name, R_OK)) {
if (stat(name, &fst)) { 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 { } 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)) { if (!S_ISDIR(fst.st_mode)) {
return name; return name;
} else { } else {
D_eterm_options(("%s is a directory.\n", name)); D_OPTIONS(("%s is a directory.\n", name));
} }
} else { } 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) { for (path = pathlist; path != NULL && *path != '\0'; path = p) {
int n; int n;
@ -1372,24 +1372,24 @@ search_path(const char *pathlist, const char *file)
name[n++] = '/'; name[n++] = '/';
name[n] = '\0'; name[n] = '\0';
strncat(name, file, len); 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 (!access(name, R_OK)) {
if (stat(name, &fst)) { 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 { } 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)) { if (!S_ISDIR(fst.st_mode)) {
return name; return name;
} else { } else {
D_eterm_options(("%s is a directory.\n", name)); D_OPTIONS(("%s is a directory.\n", name));
} }
} else { } 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); 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) { if ((theme_dir = conf_parse_theme(&rs_theme, THEME_CFG, PARSE_TRY_ALL)) != NULL) {
char *tmp; 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")); tmp = (char *) MALLOC(strlen(theme_dir) + sizeof("ETERM_THEME_ROOT=\0"));
sprintf(tmp, "ETERM_THEME_ROOT=%s", theme_dir); sprintf(tmp, "ETERM_THEME_ROOT=%s", theme_dir);
putenv(tmp); 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) { 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; 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")); tmp = (char *) MALLOC(strlen(user_dir) + sizeof("ETERM_USER_ROOT=\0"));
sprintf(tmp, "ETERM_USER_ROOT=%s", user_dir); sprintf(tmp, "ETERM_USER_ROOT=%s", user_dir);
putenv(tmp); putenv(tmp);
@ -184,7 +184,7 @@ eterm_bootstrap(int argc, char *argv[])
tmp[len] = '\0'; tmp[len] = '\0';
FREE(rs_path); FREE(rs_path);
rs_path = tmp; 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 #endif
spifopt_parse(argc, argv); spifopt_parse(argc, argv);

View File

@ -47,7 +47,7 @@ wait_for_chld(int system_pid)
{ {
int pid, status = 0, save_errno = errno, code; 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) { while (1) {
do { do {
@ -60,14 +60,14 @@ wait_for_chld(int system_pid)
errno = save_errno; errno = save_errno;
break; break;
} }
D_eterm_options(("%ld exited.\n", pid)); D_OPTIONS(("%ld exited.\n", pid));
if (pid == system_pid || system_pid == -1) { if (pid == system_pid || system_pid == -1) {
if (WIFEXITED(status)) { if (WIFEXITED(status)) {
code = WEXITSTATUS(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)) { } else if (WIFSIGNALED(status)) {
code = WTERMSIG(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 { } else {
code = 0; code = 0;
} }
@ -86,7 +86,7 @@ system_wait(char *command)
pid_t pid; pid_t pid;
D_eterm_options(("system_wait(%s) called.\n", command)); D_OPTIONS(("system_wait(%s) called.\n", command));
if (!(pid = fork())) { if (!(pid = fork())) {
setreuid(my_ruid, my_ruid); setreuid(my_ruid, my_ruid);
@ -95,7 +95,7 @@ system_wait(char *command)
print_error("execl(%s) failed -- %s\n", command, strerror(errno)); print_error("execl(%s) failed -- %s\n", command, strerror(errno));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} else { } 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)); return (wait_for_chld(pid));
} }
ASSERT_NOTREACHED_RVAL(0); ASSERT_NOTREACHED_RVAL(0);
@ -107,7 +107,7 @@ system_no_wait(char *command)
pid_t pid; 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())) { if (!(pid = fork())) {
setreuid(my_ruid, my_ruid); setreuid(my_ruid, my_ruid);