2000-03-08 19:38:31 -08:00
|
|
|
/*
|
2009-01-06 01:08:48 -08:00
|
|
|
* Copyright (C) 1997-2009, Michael Jennings
|
1999-08-17 16:01:18 -07:00
|
|
|
*
|
2000-03-08 19:38:31 -08:00
|
|
|
* 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:
|
1999-08-17 16:01:18 -07:00
|
|
|
*
|
2000-03-08 19:38:31 -08:00
|
|
|
* 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.
|
1999-08-17 18:12:47 -07:00
|
|
|
*/
|
1999-08-17 16:01:18 -07:00
|
|
|
|
|
|
|
static const char cvs_ident[] = "$Id$";
|
|
|
|
|
1999-08-17 18:12:47 -07:00
|
|
|
#include "config.h"
|
|
|
|
#include "feature.h"
|
|
|
|
|
1999-08-17 16:01:18 -07:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <string.h>
|
Wed Apr 5 21:48:39 PDT 2000 Michael Jennings <mej@eterm.org>
There are now two different sets of settings you can save. You can
save user settings, which are the things that one would generally
consider to be user-specific (toggles, text colors, etc.). You can
also save theme settings, which saves *everything*, including the
stuff that user settings don't include (like imageclasses, menus,
etc.). Settings are saved to user.cfg and theme.cfg, respectively.
Also, Eterm will now detect if it cannot write to the location from
which it got the theme (i.e., a system-wide directory), and will fall
back on ~/.Eterm/themes/<theme>. It WILL create this directory tree
if it does not already exist.
Hopefully this will make more people happy. :-)
SVN revision: 2440
2000-04-05 21:52:52 -07:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <fcntl.h>
|
1999-08-17 16:01:18 -07:00
|
|
|
#include <unistd.h>
|
Wed Apr 5 21:48:39 PDT 2000 Michael Jennings <mej@eterm.org>
There are now two different sets of settings you can save. You can
save user settings, which are the things that one would generally
consider to be user-specific (toggles, text colors, etc.). You can
also save theme settings, which saves *everything*, including the
stuff that user settings don't include (like imageclasses, menus,
etc.). Settings are saved to user.cfg and theme.cfg, respectively.
Also, Eterm will now detect if it cannot write to the location from
which it got the theme (i.e., a system-wide directory), and will fall
back on ~/.Eterm/themes/<theme>. It WILL create this directory tree
if it does not already exist.
Hopefully this will make more people happy. :-)
SVN revision: 2440
2000-04-05 21:52:52 -07:00
|
|
|
#include <errno.h>
|
1999-08-17 16:01:18 -07:00
|
|
|
|
|
|
|
#include "command.h"
|
1999-10-07 15:18:14 -07:00
|
|
|
#include "startup.h"
|
1999-08-17 16:01:18 -07:00
|
|
|
#include "misc.h"
|
|
|
|
#include "options.h"
|
|
|
|
|
|
|
|
const char *
|
|
|
|
my_basename(const char *str)
|
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
const char *base = strrchr(str, '/');
|
1999-08-17 16:01:18 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
return (base ? base + 1 : str);
|
1999-08-17 16:01:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Compares the first n characters of s1 and s2, where n is strlen(s2)
|
|
|
|
* Returns strlen(s2) if they match, 0 if not.
|
|
|
|
*/
|
|
|
|
unsigned long
|
|
|
|
str_leading_match(register const char *s1, register const char *s2)
|
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
register unsigned long n;
|
1999-08-17 16:01:18 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
if (!s1 || !s2) {
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
for (n = 0; *s2; n++, s1++, s2++) {
|
|
|
|
if (*s1 != *s2) {
|
|
|
|
return 0;
|
|
|
|
}
|
1999-08-17 16:01:18 -07:00
|
|
|
}
|
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
return n;
|
1999-08-17 16:01:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Strip leading and trailing whitespace and quotes from a string */
|
|
|
|
char *
|
|
|
|
str_trim(char *str)
|
|
|
|
{
|
|
|
|
|
2008-12-16 22:04:15 -08:00
|
|
|
register spif_charptr_t tmp = (spif_charptr_t) str;
|
2002-05-04 07:25:30 -07:00
|
|
|
size_t n;
|
1999-08-17 16:01:18 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
if (str && *str) {
|
1999-08-17 16:01:18 -07:00
|
|
|
|
2006-02-13 11:52:45 -08:00
|
|
|
spiftool_chomp(str);
|
2002-05-04 07:25:30 -07:00
|
|
|
n = strlen(str);
|
1999-08-17 16:01:18 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
if (!n) {
|
|
|
|
*str = 0;
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
/* strip leading/trailing quotes */
|
|
|
|
if (*tmp == '"') {
|
|
|
|
tmp++;
|
|
|
|
n--;
|
|
|
|
if (!n) {
|
|
|
|
*str = 0;
|
|
|
|
return str;
|
|
|
|
} else if (tmp[n - 1] == '"') {
|
|
|
|
tmp[--n] = '\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tmp != str) {
|
|
|
|
memmove(str, tmp, (strlen(tmp)) + 1);
|
|
|
|
}
|
1999-08-17 16:01:18 -07:00
|
|
|
}
|
2002-05-04 07:25:30 -07:00
|
|
|
return str;
|
1999-08-17 16:01:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* in-place interpretation of string:
|
|
|
|
*
|
|
|
|
* backslash-escaped: "\a\b\E\e\n\r\t", "\octal"
|
|
|
|
* Ctrl chars: ^@ .. ^_, ^?
|
|
|
|
*
|
|
|
|
* Emacs-style: "M-" prefix
|
|
|
|
*
|
|
|
|
* Also,
|
|
|
|
* "M-x" prefixed strings, append "\r" if needed
|
|
|
|
* "\E]" prefixed strings (XTerm escape sequence) append "\a" if needed
|
|
|
|
*
|
|
|
|
* returns the converted string length
|
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
|
|
|
parse_escaped_string(char *str)
|
|
|
|
{
|
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
register char *pold = str, *pnew;
|
|
|
|
unsigned char i;
|
1999-08-17 16:01:18 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
D_STRINGS(("parse_escaped_string(\"%s\")\n", str));
|
1999-08-17 16:01:18 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
if (!BEG_STRCASECMP(pold, "m-")) {
|
|
|
|
*pold = '\\';
|
|
|
|
*(pold + 1) = 'e';
|
1999-08-17 16:01:18 -07:00
|
|
|
}
|
2002-05-04 07:25:30 -07:00
|
|
|
for (pold = pnew = str; *pold; pold++, pnew++) {
|
|
|
|
D_STRINGS(("Looking at \"%s\"\n", pold));
|
|
|
|
if (!BEG_STRCASECMP(pold, "m-") && (isspace(*(pold - 1)) || !isprint(*(pold - 1)))) {
|
|
|
|
*pold = '\\';
|
|
|
|
*(pold + 1) = 'e';
|
|
|
|
} else if (!BEG_STRCASECMP(pold, "c-")) {
|
|
|
|
*(++pold) = '^';
|
|
|
|
}
|
|
|
|
D_STRINGS(("Operating on \'%c\'\n", *pold));
|
|
|
|
switch (*pold) {
|
2005-04-18 18:57:24 -07:00
|
|
|
case '\\':
|
|
|
|
D_STRINGS(("Backslash + %c\n", *(pold + 1)));
|
|
|
|
switch (tolower(*(++pold))) {
|
|
|
|
case '0':
|
|
|
|
case '1':
|
|
|
|
case '2':
|
|
|
|
case '3':
|
|
|
|
case '4':
|
|
|
|
case '5':
|
|
|
|
case '6':
|
|
|
|
case '7':
|
|
|
|
for (i = 0; *pold >= '0' && *pold <= '7'; pold++) {
|
|
|
|
i = (i * 8) + (*pold - '0');
|
|
|
|
}
|
|
|
|
pold--;
|
|
|
|
D_STRINGS(("Octal number evaluates to %d\n", i));
|
|
|
|
*pnew = i;
|
|
|
|
break;
|
|
|
|
case 'n':
|
|
|
|
*pnew = '\n';
|
|
|
|
break;
|
|
|
|
case 'r':
|
|
|
|
*pnew = '\r';
|
|
|
|
break;
|
|
|
|
case 't':
|
|
|
|
*pnew = '\t';
|
|
|
|
break;
|
|
|
|
case 'b':
|
|
|
|
*pnew = '\b';
|
|
|
|
break;
|
|
|
|
case 'f':
|
|
|
|
*pnew = '\f';
|
|
|
|
break;
|
|
|
|
case 'a':
|
|
|
|
*pnew = '\a';
|
|
|
|
break;
|
|
|
|
case 'v':
|
|
|
|
*pnew = '\v';
|
|
|
|
break;
|
|
|
|
case 'e':
|
|
|
|
*pnew = '\033';
|
|
|
|
break;
|
|
|
|
case 'c':
|
|
|
|
pold++;
|
|
|
|
*pnew = MAKE_CTRL_CHAR(*pold);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*pnew = *pold;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case '^':
|
|
|
|
D_STRINGS(("Caret + %c\n", *(pold + 1)));
|
|
|
|
pold++;
|
|
|
|
*pnew = MAKE_CTRL_CHAR(*pold);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*pnew = *pold;
|
2002-05-04 07:25:30 -07:00
|
|
|
}
|
1999-08-17 16:01:18 -07:00
|
|
|
}
|
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
if (!BEG_STRCASECMP(str, "\033x") && *(pnew - 1) != '\r') {
|
|
|
|
D_STRINGS(("Adding carriage return\n"));
|
|
|
|
*(pnew++) = '\r';
|
|
|
|
} else if (!BEG_STRCASECMP(str, "\033]") && *(pnew - 1) != '\a') {
|
|
|
|
D_STRINGS(("Adding bell character\n"));
|
|
|
|
*(pnew++) = '\a';
|
|
|
|
}
|
|
|
|
*pnew = 0;
|
1999-08-17 16:01:18 -07:00
|
|
|
|
1999-08-17 18:12:47 -07:00
|
|
|
#if DEBUG >= DEBUG_STRINGS
|
2002-05-04 07:25:30 -07:00
|
|
|
if (DEBUG_LEVEL >= DEBUG_STRINGS) {
|
|
|
|
D_STRINGS(("New value is:\n"));
|
2006-02-13 11:52:45 -08:00
|
|
|
spiftool_hex_dump(str, (size_t) (pnew - str));
|
2002-05-04 07:25:30 -07:00
|
|
|
}
|
1999-08-17 16:01:18 -07:00
|
|
|
#endif
|
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
return (pnew - str);
|
1999-08-17 16:01:18 -07:00
|
|
|
}
|
|
|
|
|
2005-03-15 13:48:14 -08:00
|
|
|
spif_charptr_t
|
|
|
|
escape_string(spif_charptr_t str, spif_char_t quote, spif_int32_t maxlen)
|
|
|
|
{
|
|
|
|
spif_charptr_t buff, s = str, pbuff;
|
|
|
|
|
|
|
|
D_STRINGS(("escape_string(%s %c %ld)\n", (char *) str, quote, maxlen));
|
2005-04-18 18:57:24 -07:00
|
|
|
if (!quote) {
|
2005-03-15 13:48:14 -08:00
|
|
|
quote = '\"';
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The escaped string will be at most twice the length of the original. */
|
2008-12-16 22:04:15 -08:00
|
|
|
buff = (spif_charptr_t) MALLOC(strlen((char *) str) * 2 + 1);
|
2005-03-15 13:48:14 -08:00
|
|
|
|
|
|
|
/* Copy and escape the string from str into buff. */
|
|
|
|
for (pbuff = buff; (*s); s++, pbuff++) {
|
|
|
|
if (*s == quote) {
|
|
|
|
D_STRINGS(("Double-escaping \'%c\' at position %d\n", *s, s - str));
|
|
|
|
*pbuff = '\\';
|
|
|
|
pbuff++;
|
|
|
|
*pbuff = '\\';
|
|
|
|
pbuff++;
|
|
|
|
} else {
|
|
|
|
if (quote == '\"') {
|
|
|
|
if ((*s == '\\') || (*s == '`')) {
|
|
|
|
D_STRINGS(("Escaping \'%c\' at position %d\n", *s, s - str));
|
|
|
|
*pbuff = '\\';
|
|
|
|
pbuff++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
D_STRINGS(("Copying \'%c\' at position %d\n", *s, s - str));
|
|
|
|
*pbuff = *s;
|
|
|
|
}
|
|
|
|
*pbuff = 0;
|
|
|
|
|
|
|
|
if (maxlen) {
|
|
|
|
/* Given maxlen, we know "str" can hold at least "maxlen" chars. */
|
|
|
|
if (!spiftool_safe_strncpy(str, buff, maxlen)) {
|
|
|
|
str[maxlen] = 0;
|
|
|
|
}
|
|
|
|
FREE(buff);
|
|
|
|
return str;
|
|
|
|
} else {
|
|
|
|
return buff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-03-08 19:38:31 -08:00
|
|
|
char *
|
Sun Mar 2 23:40:39 2003 Michael Jennings (mej)
Fixed a bug with foreground/background color change pointed out by
Thomas <arnognul@tiscali.se>.
Also added support for all the other OSC color change sequences (at
least those for the colors that Eterm uses). The sequences are of
the form "\e];n;color[;color[...]]\a", where n is between 10 and 19.
You can specify up to (20 - n) semicolon-separated colors representing
the following attributes in order: foreground, background, cursor,
mouse pointer, mouse pointer background (*), Tek foreground (*), Tek
background (*), highlight color (*), bold color, and underline color.
Attributes marked with a (*) are ignored by Eterm and may be left
empty, but their trailing semicolons must be present for xterm
compatibility.
For example, to set a white foreground, black background, yellow text
cursor, green mouse cursor, #ffaa00 for bold, and cyan for underline,
you could use either of the following:
echo -e "\e]10;white;black;yellow;green;;;;;#ffaa00;cyan\007"
or
echo -e "\e]10;white\007"
echo -e "\e]11;black\007"
echo -e "\e]12;yellow\007"
echo -e "\e]13;green\007"
echo -e "\e]18;#ffaa00\007"
echo -e "\e]19;cyan\007"
Note that the setting of bold and underline colors using 18 and 19 are
Eterm extensions.
SVN revision: 6739
2003-03-02 20:53:35 -08:00
|
|
|
safe_print_string(const char *str, unsigned long len)
|
2000-03-08 19:38:31 -08:00
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
static char *ret_buff = NULL;
|
|
|
|
static unsigned long rb_size = 0;
|
|
|
|
char *p;
|
|
|
|
unsigned long n = 0, i;
|
2000-03-08 19:38:31 -08:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
if (len == ((unsigned long) -1)) {
|
|
|
|
len = strlen(str);
|
|
|
|
} else if (len == ((unsigned long) -2)) {
|
|
|
|
FREE(ret_buff);
|
|
|
|
rb_size = 0;
|
|
|
|
return ((char *) NULL);
|
|
|
|
}
|
2010-08-25 18:34:13 -07:00
|
|
|
if (!ret_buff) {
|
2002-05-04 07:25:30 -07:00
|
|
|
rb_size = len;
|
|
|
|
ret_buff = (char *) MALLOC(rb_size + 1);
|
|
|
|
} else if (len > rb_size) {
|
|
|
|
rb_size = len;
|
|
|
|
ret_buff = (char *) REALLOC(ret_buff, rb_size + 1);
|
2000-03-08 19:38:31 -08:00
|
|
|
}
|
2002-05-04 07:25:30 -07:00
|
|
|
for (i = 0, p = ret_buff; i < len; i++, str++, n++) {
|
|
|
|
if (n + 2 >= rb_size) {
|
|
|
|
rb_size *= 2;
|
|
|
|
ret_buff = (char *) REALLOC(ret_buff, rb_size + 1);
|
|
|
|
p = ret_buff + n;
|
|
|
|
}
|
|
|
|
if ((unsigned char) *str < ' ') {
|
|
|
|
*p++ = '^';
|
|
|
|
*p++ = *str + '@';
|
|
|
|
n++;
|
|
|
|
} else {
|
|
|
|
*p++ = *str;
|
|
|
|
}
|
2000-03-08 19:38:31 -08:00
|
|
|
}
|
2002-05-04 07:25:30 -07:00
|
|
|
*p = 0;
|
|
|
|
return ret_buff;
|
2000-03-08 19:38:31 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned long
|
|
|
|
add_carriage_returns(unsigned char *buff, unsigned long cnt)
|
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
register unsigned char *out, *outp, *in;
|
|
|
|
register unsigned long i;
|
2000-03-08 19:38:31 -08:00
|
|
|
|
2008-12-16 22:04:15 -08:00
|
|
|
D_CMD(("buff == %8p \"%s\", cnt == %lu\n", buff, safe_print_string((spif_charptr_t) buff, cnt), cnt));
|
2002-05-04 07:25:30 -07:00
|
|
|
outp = out = (unsigned char *) MALLOC(cnt * 2);
|
|
|
|
for (i = 0, in = buff; i < cnt; i++) {
|
|
|
|
if (*in == '\n') {
|
|
|
|
*out++ = '\r';
|
|
|
|
}
|
|
|
|
*out++ = *in++;
|
2000-03-08 19:38:31 -08:00
|
|
|
}
|
2002-05-04 07:25:30 -07:00
|
|
|
i = (unsigned long) (out - outp);
|
|
|
|
memcpy(buff, outp, i);
|
|
|
|
FREE(outp);
|
2008-12-16 22:04:15 -08:00
|
|
|
D_CMD(("buff == %8p \"%s\", i == %lu\n", buff, safe_print_string((spif_charptr_t) buff, i), i));
|
2002-05-04 07:25:30 -07:00
|
|
|
return i;
|
2000-03-08 19:38:31 -08:00
|
|
|
}
|
Wed Apr 5 21:48:39 PDT 2000 Michael Jennings <mej@eterm.org>
There are now two different sets of settings you can save. You can
save user settings, which are the things that one would generally
consider to be user-specific (toggles, text colors, etc.). You can
also save theme settings, which saves *everything*, including the
stuff that user settings don't include (like imageclasses, menus,
etc.). Settings are saved to user.cfg and theme.cfg, respectively.
Also, Eterm will now detect if it cannot write to the location from
which it got the theme (i.e., a system-wide directory), and will fall
back on ~/.Eterm/themes/<theme>. It WILL create this directory tree
if it does not already exist.
Hopefully this will make more people happy. :-)
SVN revision: 2440
2000-04-05 21:52:52 -07:00
|
|
|
|
|
|
|
unsigned char
|
|
|
|
mkdirhier(const char *path)
|
|
|
|
{
|
2008-12-16 22:04:15 -08:00
|
|
|
spif_charptr_t str, pstr;
|
2002-05-04 07:25:30 -07:00
|
|
|
struct stat dst;
|
Wed Apr 5 21:48:39 PDT 2000 Michael Jennings <mej@eterm.org>
There are now two different sets of settings you can save. You can
save user settings, which are the things that one would generally
consider to be user-specific (toggles, text colors, etc.). You can
also save theme settings, which saves *everything*, including the
stuff that user settings don't include (like imageclasses, menus,
etc.). Settings are saved to user.cfg and theme.cfg, respectively.
Also, Eterm will now detect if it cannot write to the location from
which it got the theme (i.e., a system-wide directory), and will fall
back on ~/.Eterm/themes/<theme>. It WILL create this directory tree
if it does not already exist.
Hopefully this will make more people happy. :-)
SVN revision: 2440
2000-04-05 21:52:52 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
D_CMD(("path == %s\n", path));
|
|
|
|
str = STRDUP(path); /* We need to modify it. */
|
|
|
|
pstr = str;
|
|
|
|
if (*pstr == '/') {
|
|
|
|
pstr++;
|
|
|
|
}
|
|
|
|
for (; (pstr = strchr(pstr, '/'));) {
|
|
|
|
*pstr = 0;
|
|
|
|
D_CMD(("Looking at \"%s\"\n", str));
|
|
|
|
if (stat(str, &dst)) {
|
|
|
|
/* It's not there. Create it. */
|
|
|
|
D_CMD(("stat() failed. Attempting to create it.\n"));
|
|
|
|
if (mkdir(str, 0755)) {
|
|
|
|
/* Couldn't create it. Return failure. */
|
|
|
|
D_CMD(("mkdir(%s, 0755) failed -- %s\n", str, strerror(errno)));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
} else if (!S_ISDIR(dst.st_mode)) {
|
|
|
|
/* It's there, but it's not a directory. Fail. */
|
|
|
|
D_CMD(("\"%s\" exists, but it's not a directory.\n", str));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
*pstr++ = '/';
|
|
|
|
}
|
Wed Apr 5 21:48:39 PDT 2000 Michael Jennings <mej@eterm.org>
There are now two different sets of settings you can save. You can
save user settings, which are the things that one would generally
consider to be user-specific (toggles, text colors, etc.). You can
also save theme settings, which saves *everything*, including the
stuff that user settings don't include (like imageclasses, menus,
etc.). Settings are saved to user.cfg and theme.cfg, respectively.
Also, Eterm will now detect if it cannot write to the location from
which it got the theme (i.e., a system-wide directory), and will fall
back on ~/.Eterm/themes/<theme>. It WILL create this directory tree
if it does not already exist.
Hopefully this will make more people happy. :-)
SVN revision: 2440
2000-04-05 21:52:52 -07:00
|
|
|
D_CMD(("Looking at \"%s\"\n", str));
|
|
|
|
if (stat(str, &dst)) {
|
2002-05-04 07:25:30 -07:00
|
|
|
/* It's not there. Create it. */
|
|
|
|
D_CMD(("stat() failed. Attempting to create it.\n"));
|
|
|
|
if (mkdir(str, 0755)) {
|
|
|
|
/* Couldn't create it. Return failure. */
|
|
|
|
D_CMD(("mkdir(%s, 0755) failed -- %s\n", str, strerror(errno)));
|
|
|
|
return 0;
|
|
|
|
}
|
Wed Apr 5 21:48:39 PDT 2000 Michael Jennings <mej@eterm.org>
There are now two different sets of settings you can save. You can
save user settings, which are the things that one would generally
consider to be user-specific (toggles, text colors, etc.). You can
also save theme settings, which saves *everything*, including the
stuff that user settings don't include (like imageclasses, menus,
etc.). Settings are saved to user.cfg and theme.cfg, respectively.
Also, Eterm will now detect if it cannot write to the location from
which it got the theme (i.e., a system-wide directory), and will fall
back on ~/.Eterm/themes/<theme>. It WILL create this directory tree
if it does not already exist.
Hopefully this will make more people happy. :-)
SVN revision: 2440
2000-04-05 21:52:52 -07:00
|
|
|
} else if (!S_ISDIR(dst.st_mode)) {
|
2002-05-04 07:25:30 -07:00
|
|
|
/* It's there, but it's not a directory. Fail. */
|
|
|
|
D_CMD(("\"%s\" exists, but it's not a directory.\n", str));
|
|
|
|
return 0;
|
Wed Apr 5 21:48:39 PDT 2000 Michael Jennings <mej@eterm.org>
There are now two different sets of settings you can save. You can
save user settings, which are the things that one would generally
consider to be user-specific (toggles, text colors, etc.). You can
also save theme settings, which saves *everything*, including the
stuff that user settings don't include (like imageclasses, menus,
etc.). Settings are saved to user.cfg and theme.cfg, respectively.
Also, Eterm will now detect if it cannot write to the location from
which it got the theme (i.e., a system-wide directory), and will fall
back on ~/.Eterm/themes/<theme>. It WILL create this directory tree
if it does not already exist.
Hopefully this will make more people happy. :-)
SVN revision: 2440
2000-04-05 21:52:52 -07:00
|
|
|
}
|
2002-05-04 07:25:30 -07:00
|
|
|
D_CMD(("Done!\n"));
|
|
|
|
return 1;
|
Wed Apr 5 21:48:39 PDT 2000 Michael Jennings <mej@eterm.org>
There are now two different sets of settings you can save. You can
save user settings, which are the things that one would generally
consider to be user-specific (toggles, text colors, etc.). You can
also save theme settings, which saves *everything*, including the
stuff that user settings don't include (like imageclasses, menus,
etc.). Settings are saved to user.cfg and theme.cfg, respectively.
Also, Eterm will now detect if it cannot write to the location from
which it got the theme (i.e., a system-wide directory), and will fall
back on ~/.Eterm/themes/<theme>. It WILL create this directory tree
if it does not already exist.
Hopefully this will make more people happy. :-)
SVN revision: 2440
2000-04-05 21:52:52 -07:00
|
|
|
}
|