Группа :: Графические оболочки/Прочее
Пакет: jwm
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: jwm-2.3.7-alt-config-file.patch
Скачать
Скачать
diff -ru jwm-2.3.7-orig/configure.ac jwm-2.3.7/configure.ac
--- jwm-2.3.7-orig/configure.ac 2017-07-22 03:02:42.008748944 +0300
+++ jwm-2.3.7/configure.ac 2017-10-11 22:15:15.306256550 +0300
@@ -555,9 +555,15 @@
DATADIR=`eval echo \""$datadir"\"`
DATADIR=`eval echo \""$DATADIR"\"`
-AC_DEFINE_UNQUOTED(SYSTEM_CONFIG, "$SYSCONF/system.jwmrc",
+AC_DEFINE_UNQUOTED(SYSTEM_CONFIG, "$SYSCONF/config",
[default system configuration path])
+AC_DEFINE_UNQUOTED(SYSTEM_DIR, "$SYSCONF",
+ [default system path])
+
+AC_DEFINE_UNQUOTED(USER_DIR, "\$HOME/.jwm",
+ [default user path])
+
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(VERSION, "$PACKAGE_VERSION")
diff -ru jwm-2.3.7-orig/src/main.c jwm-2.3.7/src/main.c
--- jwm-2.3.7-orig/src/main.c 2017-07-22 03:02:42.008748944 +0300
+++ jwm-2.3.7/src/main.c 2017-10-11 21:52:10.445097151 +0300
@@ -77,7 +77,7 @@
char haveRender;
#endif
-static const char CONFIG_FILE[] = "/.jwmrc";
+static const char CONFIG_FILE[] = "config";
static void Initialize(void);
static void Startup(void);
@@ -106,7 +106,6 @@
#ifndef UNIT_TEST
int main(int argc, char *argv[])
{
- char *temp;
int x;
enum {
ACTION_RUN,
@@ -119,16 +118,9 @@
StartDebug();
/* Get the name of the user's local configuration file. */
- temp = getenv("HOME");
- if(temp) {
- const size_t temp_len = strlen(temp);
- const size_t config_len = sizeof(CONFIG_FILE);
- configPath = Allocate(temp_len + config_len);
- memcpy(configPath, temp, temp_len);
- memcpy(&configPath[temp_len], CONFIG_FILE, config_len);
- } else {
- configPath = CopyString(CONFIG_FILE);
- }
+ configPath = Allocate(strlen(USER_DIR) + 1 + strlen(CONFIG_FILE) + 1);
+ sprintf(configPath, "%s/%s", USER_DIR, CONFIG_FILE);
+ ExpandPath(&configPath);
/* Parse command line options. */
action = ACTION_RUN;
diff -ru jwm-2.3.7-orig/src/parse.c jwm-2.3.7/src/parse.c
--- jwm-2.3.7-orig/src/parse.c 2017-07-22 03:02:42.008748944 +0300
+++ jwm-2.3.7/src/parse.c 2017-10-11 22:13:58.014051988 +0300
@@ -224,9 +224,9 @@
void ParseConfig(const char *fileName)
{
if(!ParseFile(fileName, 0)) {
+ ParseError(NULL, "could not open user config %s", fileName);
if(JUNLIKELY(!ParseFile(SYSTEM_CONFIG, 0))) {
- ParseError(NULL, _("could not open %s or %s"),
- fileName, SYSTEM_CONFIG);
+ ParseError(NULL, "could not open system config %s", SYSTEM_CONFIG);
}
}
ValidateTrayButtons();
@@ -1903,13 +1903,32 @@
TokenNode *TokenizeFile(const char *fileName)
{
struct stat sbuf;
- TokenNode *tokens;
- char *path;
+ TokenNode *tokens = NULL;
+ char *path, *dir;
char *buffer;
path = CopyString(fileName);
ExpandPath(&path);
+ if (path[0] != '/') {
+ /* Try relative path */
+
+ dir = Allocate(strlen(USER_DIR) + 1 + strlen(path) + 1);
+ sprintf(dir, "%s/%s", USER_DIR, path);
+ ExpandPath(&dir);
+
+ tokens=TokenizeFile(dir);
+ if (!tokens) {
+ dir = Reallocate(dir, strlen(SYSTEM_DIR) + 1 + strlen(path) + 1);
+ sprintf(dir, "%s/%s", SYSTEM_DIR, path);
+ tokens=TokenizeFile(dir);
+ }
+ Release(dir);
+ if (tokens) {
+ return tokens;
+ }
+ }
+
int fd = open(path, O_RDONLY);
Release(path);