diff --git a/ChangeLog b/ChangeLog index 22da86c..bc9ed2c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4025,3 +4025,15 @@ Fri Dec 29 14:39:09 PST 2000 Michael Jennings with some other FreeBSD-related patches from Mr. Wu. ------------------------------------------------------------------------------- +Tue Jan 2 18:28:57 PST 2001 Michael Jennings + + Applied a couple patches I'd overlooked in my inbox. Sebastian + Dransfeld added a config file option to + duplicate the behavior of the --buttonbar command-line option. He + also updated the man page, something I usually put off until just + before I do a release. :-) + + I also went back and redid the way Eterm does backquote execution to + avoid a potential race condition. + +------------------------------------------------------------------------------- diff --git a/doc/Eterm.1.in b/doc/Eterm.1.in index bf85b62..fc4f809 100644 --- a/doc/Eterm.1.in +++ b/doc/Eterm.1.in @@ -427,6 +427,9 @@ Reports certain keystrokes as keysyms and modifiers rather than escape sequences This option is intended for use only with programs that support this special Eterm mode. Do not enable it unless you are executing a program which uses this mode. .TP +.BR \-\-buttonbar +Toggle the display of all buttonbars. +.TP .BI \-\-big-font-key " keysym" Specify a keysym to increase the font size. Default is Shift and the + key on the keypad. Ctrl-> or Meta-> may also work (if you #define one @@ -1355,6 +1358,11 @@ This option is intended for use only with programs that support this special Ete mode. Do not enable it unless you are executing a program which uses this mode. .RE +.BI buttonbar " boolean" +.RS 5 +Toggle the display of all buttonbars. +.RE + .RE .TP diff --git a/src/options.c b/src/options.c index d1f418e..3e8bd89 100644 --- a/src/options.c +++ b/src/options.c @@ -1425,15 +1425,21 @@ builtin_random(char *param) static char * builtin_exec(char *param) { - unsigned long fsize; - char *Command, *Output = NULL, *OutFile; + char *Command, *Output = NULL; + char OutFile[256]; FILE *fp; + int fd; D_PARSE(("builtin_exec(%s) called\n", param)); Command = (char *) MALLOC(CONFIG_BUFF); - OutFile = tmpnam(NULL); + strcat(OutFile, "Eterm-exec-"); + fd = libast_temp_file(OutFile, sizeof(OutFile)); + if ((fd < 0) || fchown(fd, my_ruid, my_rgid)) { + print_error("Unable to create unique temporary file for \"%s\" -- %s\n", param, strerror(errno)); + return ((char *) NULL); + } if (strlen(param) + strlen(OutFile) + 8 > CONFIG_BUFF) { print_error("Parse error in file %s, line %lu: Cannot execute command, line too long\n", file_peek_path(), file_peek_line()); @@ -1443,7 +1449,7 @@ builtin_exec(char *param) strcat(Command, " >"); strcat(Command, OutFile); system(Command); - if ((fp = fopen(OutFile, "rb")) != NULL) { + if ((fp = fdopen(fd, "rb")) != NULL) { fseek(fp, 0, SEEK_END); fsize = ftell(fp); rewind(fp); @@ -2265,6 +2271,14 @@ parse_toggles(char *buff, void *state) image_toggles &= ~IMOPT_ITRANS; } + } else if (!BEG_STRCASECMP(buff, "buttonbar")) { + if (bool_val) { + FOREACH_BUTTONBAR(bbar_set_visible(bbar, 1);); + rs_buttonbars = 1; /* Reset for future use. */ + } else { + FOREACH_BUTTONBAR(bbar_set_visible(bbar, 0);); + rs_buttonbars = 1; /* Reset for future use. */ + } } else { 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); } @@ -3506,16 +3520,18 @@ conf_parse(char *conf_name, const char *dir, const char *path) { file_push(fp, path, NULL, 1, 0); } } else if (!BEG_STRCASECMP(get_pword(1, buff + 1), "preproc ")) { - char cmd[PATH_MAX]; + char cmd[PATH_MAX], fname[PATH_MAX]; + int fd; FILE *fp; if (file_peek_preproc()) { continue; } - outfile = tmpnam(NULL); - snprintf(cmd, PATH_MAX, "%s < %s > %s", get_pword(2, buff), file_peek_path(), outfile); + strcpy(fname, "Eterm-preproc-"); + fd = libast_temp_file(fname, PATH_MAX); + snprintf(cmd, PATH_MAX, "%s < %s > %s", get_pword(2, buff), file_peek_path(), fname); system(cmd); - fp = fopen(outfile, "rt"); + fp = fdopen(fd, "rt"); if (fp != NULL) { fclose(file_peek_fp()); file_poke_fp(fp);