diff options
-rw-r--r-- | acinclude.m4 | 2 | ||||
-rw-r--r-- | configure.in | 40 | ||||
-rw-r--r-- | src/FbTk/App.cc | 9 | ||||
-rw-r--r-- | src/FbTk/FileUtil.cc | 11 | ||||
-rw-r--r-- | src/FbTk/I18n.cc | 8 | ||||
-rw-r--r-- | src/FbTk/SignalHandler.cc | 8 | ||||
-rw-r--r-- | src/FbTk/Timer.cc | 4 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/RootTheme.cc | 3 | ||||
-rw-r--r-- | src/fluxbox.cc | 2 | ||||
-rw-r--r-- | src/main.cc | 22 |
11 files changed, 69 insertions, 41 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index ca5a789..a233530 100644 --- a/acinclude.m4 +++ b/acinclude.m4 | |||
@@ -227,5 +227,5 @@ AC_DEFUN([AM_PATH_XFT], | |||
227 | 227 | ||
228 | CFLAGS="$CFLAGS $XFT_CFLAGS" | 228 | CFLAGS="$CFLAGS $XFT_CFLAGS" |
229 | CXXFLAGS="$CXXFLAGS $XFT_CFLAGS" | 229 | CXXFLAGS="$CXXFLAGS $XFT_CFLAGS" |
230 | LIBS="$LIBS $XFT_LIBS" | 230 | LIBS="$XFT_LIBS $LIBS" |
231 | ]) | 231 | ]) |
diff --git a/configure.in b/configure.in index 6e4a53c..71c86d1 100644 --- a/configure.in +++ b/configure.in | |||
@@ -60,10 +60,10 @@ AC_FUNC_REALLOC | |||
60 | AC_FUNC_SELECT_ARGTYPES | 60 | AC_FUNC_SELECT_ARGTYPES |
61 | AC_FUNC_STAT | 61 | AC_FUNC_STAT |
62 | 62 | ||
63 | AC_CHECK_FUNCS(basename, , AC_CHECK_LIB(gen, basename, LIBS="$LIBS -lgen")) | 63 | AC_CHECK_FUNCS(basename, , AC_CHECK_LIB(gen, basename, LIBS="-lgen $LIBS")) |
64 | AC_CHECK_FUNCS(catclose catgets catopen getpid gettimeofday memset mkdir \ | 64 | AC_CHECK_FUNCS(catclose catgets catopen getpid gettimeofday memset mkdir \ |
65 | nl_langinfo putenv regcomp select setenv setlocale sigaction snprintf \ | 65 | nl_langinfo putenv regcomp select setenv setlocale sigaction snprintf \ |
66 | sqrt strcasecmp strcasestr strchr strstr strtol strtoul vsnprintf) | 66 | sqrt strcasecmp strcasestr strchr strstr strtol strtoul sync vsnprintf) |
67 | 67 | ||
68 | dnl The autoconf test for strftime is broken now (due to gcc 3.3 bug?): | 68 | dnl The autoconf test for strftime is broken now (due to gcc 3.3 bug?): |
69 | dnl Gcc 3.3 testprog = ``extern "C" char strftime;'', build with g++ test.cc | 69 | dnl Gcc 3.3 testprog = ``extern "C" char strftime;'', build with g++ test.cc |
@@ -130,13 +130,13 @@ if test "x$ac_cv_header_iconv_h" = "xyes"; then | |||
130 | AC_CHECK_LIB([iconv], | 130 | AC_CHECK_LIB([iconv], |
131 | [iconv_open], | 131 | [iconv_open], |
132 | [ | 132 | [ |
133 | LIBS="$LIBS -liconv" | 133 | LIBS="-liconv $LIBS" |
134 | ], | 134 | ], |
135 | []) | 135 | []) |
136 | AC_CHECK_LIB([iconv], | 136 | AC_CHECK_LIB([iconv], |
137 | [libiconv_open], | 137 | [libiconv_open], |
138 | [ | 138 | [ |
139 | LIBS="$LIBS -liconv" | 139 | LIBS="-liconv $LIBS" |
140 | ], | 140 | ], |
141 | []) | 141 | []) |
142 | 142 | ||
@@ -163,8 +163,8 @@ dnl Check if iconv uses const in prototype declaration | |||
163 | fi | 163 | fi |
164 | fi | 164 | fi |
165 | 165 | ||
166 | AC_CHECK_LIB(nsl, t_open, LIBS="$LIBS -lnsl") | 166 | AC_CHECK_LIB(nsl, t_open, LIBS="-lnsl $LIBS") |
167 | AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket") | 167 | AC_CHECK_LIB(socket, socket, LIBS="-lsocket $LIBS") |
168 | 168 | ||
169 | dnl Check for X headers and libraries | 169 | dnl Check for X headers and libraries |
170 | AC_PATH_X | 170 | AC_PATH_X |
@@ -177,18 +177,18 @@ test x$x_libraries = "x" && x_libraries="/usr/lib" | |||
177 | 177 | ||
178 | CFLAGS="$CFLAGS $X_CFLAGS" | 178 | CFLAGS="$CFLAGS $X_CFLAGS" |
179 | CXXFLAGS="$CXXFLAGS $X_CFLAGS" | 179 | CXXFLAGS="$CXXFLAGS $X_CFLAGS" |
180 | LIBS="$LIBS $X_LIBS" | 180 | LIBS="$X_LIBS $LIBS" |
181 | LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS" | 181 | LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS" |
182 | 182 | ||
183 | 183 | ||
184 | dnl Check for required functions in -lX11 | 184 | dnl Check for required functions in -lX11 |
185 | AC_CHECK_LIB(X11, XOpenDisplay, | 185 | AC_CHECK_LIB(X11, XOpenDisplay, |
186 | LIBS="$LIBS -lX11", | 186 | LIBS="-lX11 $LIBS", |
187 | AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.]) | 187 | AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.]) |
188 | ) | 188 | ) |
189 | LIBS="$LIBS $X_EXTRA_LIBS" | 189 | LIBS="$X_EXTRA_LIBS $LIBS" |
190 | 190 | ||
191 | AC_CHECK_LIB(xpg4, setlocale, LIBS="$LIBS -lxpg4") | 191 | AC_CHECK_LIB(xpg4, setlocale, LIBS="-lxpg4 $LIBS") |
192 | 192 | ||
193 | AC_CHECK_PROGS(gencat_cmd, gencat) | 193 | AC_CHECK_PROGS(gencat_cmd, gencat) |
194 | if test x$gencat_cmd = "x"; then | 194 | if test x$gencat_cmd = "x"; then |
@@ -397,14 +397,14 @@ AC_ARG_ENABLE( | |||
397 | AC_MSG_RESULT([yes]) | 397 | AC_MSG_RESULT([yes]) |
398 | AC_CHECK_LIB(Xrender, XRenderCreatePicture, | 398 | AC_CHECK_LIB(Xrender, XRenderCreatePicture, |
399 | AC_DEFINE(HAVE_XRENDER, 1, "Xrender support") | 399 | AC_DEFINE(HAVE_XRENDER, 1, "Xrender support") |
400 | LIBS="$LIBS -lXrender") | 400 | LIBS="-lXrender $LIBS") |
401 | else | 401 | else |
402 | AC_MSG_RESULT([no]) | 402 | AC_MSG_RESULT([no]) |
403 | fi, | 403 | fi, |
404 | AC_MSG_RESULT([yes]) | 404 | AC_MSG_RESULT([yes]) |
405 | AC_CHECK_LIB(Xrender, XRenderCreatePicture, | 405 | AC_CHECK_LIB(Xrender, XRenderCreatePicture, |
406 | AC_DEFINE(HAVE_XRENDER, 1, "Xrender support") | 406 | AC_DEFINE(HAVE_XRENDER, 1, "Xrender support") |
407 | LIBS="$LIBS -lXrender") | 407 | LIBS="-lXrender $LIBS") |
408 | ) | 408 | ) |
409 | 409 | ||
410 | XPM=false | 410 | XPM=false |
@@ -417,7 +417,7 @@ AC_ARG_ENABLE( | |||
417 | AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, | 417 | AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, |
418 | AC_DEFINE(HAVE_XPM, 1, "Xpm support") | 418 | AC_DEFINE(HAVE_XPM, 1, "Xpm support") |
419 | XPM=true | 419 | XPM=true |
420 | LIBS="$LIBS -lXpm") | 420 | LIBS="-lXpm $LIBS") |
421 | else | 421 | else |
422 | AC_MSG_RESULT([no]) | 422 | AC_MSG_RESULT([no]) |
423 | fi, | 423 | fi, |
@@ -425,7 +425,7 @@ AC_ARG_ENABLE( | |||
425 | AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, | 425 | AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, |
426 | AC_DEFINE(HAVE_XPM, 1, "Xpm support") | 426 | AC_DEFINE(HAVE_XPM, 1, "Xpm support") |
427 | XPM=true | 427 | XPM=true |
428 | LIBS="$LIBS -lXpm") | 428 | LIBS="-lXpm $LIBS") |
429 | ) | 429 | ) |
430 | 430 | ||
431 | AM_CONDITIONAL(XPM, test x$XPM = xtrue) | 431 | AM_CONDITIONAL(XPM, test x$XPM = xtrue) |
@@ -445,7 +445,7 @@ if test x$enable_imlib2 = "xyes"; then | |||
445 | AC_DEFINE(HAVE_IMLIB2, [], [Imlib2 support]) | 445 | AC_DEFINE(HAVE_IMLIB2, [], [Imlib2 support]) |
446 | IMLIB2_LIBS=`imlib2-config --libs` | 446 | IMLIB2_LIBS=`imlib2-config --libs` |
447 | IMLIB2_CFLAGS=`imlib2-config --cflags` | 447 | IMLIB2_CFLAGS=`imlib2-config --cflags` |
448 | LIBS="$LIBS $IMLIB2_LIBS" | 448 | LIBS="$IMLIB2_LIBS $LIBS" |
449 | CXXFLAGS="$CXXFLAGS $IMLIB2_CFLAGS" | 449 | CXXFLAGS="$CXXFLAGS $IMLIB2_CFLAGS" |
450 | ], [ AC_MSG_RESULT(no)] | 450 | ], [ AC_MSG_RESULT(no)] |
451 | ) | 451 | ) |
@@ -494,7 +494,7 @@ if test "x$enableval" = "xyes"; then | |||
494 | , XineramaQueryScreens(0, 0), | 494 | , XineramaQueryScreens(0, 0), |
495 | AC_MSG_RESULT([yes]) | 495 | AC_MSG_RESULT([yes]) |
496 | AC_DEFINE(XINERAMA, [1], [Define to 1 if you have XINERAMA]) | 496 | AC_DEFINE(XINERAMA, [1], [Define to 1 if you have XINERAMA]) |
497 | LIBS="$LIBS -lXinerama", | 497 | LIBS="-lXinerama $LIBS", |
498 | AC_MSG_RESULT([no]))) | 498 | AC_MSG_RESULT([no]))) |
499 | else | 499 | else |
500 | AC_MSG_RESULT([no]) | 500 | AC_MSG_RESULT([no]) |
@@ -519,7 +519,7 @@ if test "x$enableval" = "xyes"; then | |||
519 | , long foo = ShapeSet, | 519 | , long foo = ShapeSet, |
520 | AC_MSG_RESULT([yes]) | 520 | AC_MSG_RESULT([yes]) |
521 | AC_DEFINE(SHAPE, [1], [Define to 1 if you have SHAPE]) | 521 | AC_DEFINE(SHAPE, [1], [Define to 1 if you have SHAPE]) |
522 | LIBS="$LIBS -lXext" | 522 | LIBS="-lXext $LIBS" |
523 | FEATURES="$FEATURES XShape", | 523 | FEATURES="$FEATURES XShape", |
524 | AC_MSG_RESULT([no]))) | 524 | AC_MSG_RESULT([no]))) |
525 | else | 525 | else |
@@ -547,7 +547,7 @@ if test "x$enableval" = "xyes"; then | |||
547 | , XRRQueryExtension(0, 0, 0), | 547 | , XRRQueryExtension(0, 0, 0), |
548 | AC_MSG_RESULT([yes]) | 548 | AC_MSG_RESULT([yes]) |
549 | AC_DEFINE(HAVE_RANDR, [1], [Define to 1 if you have RANDR]) | 549 | AC_DEFINE(HAVE_RANDR, [1], [Define to 1 if you have RANDR]) |
550 | LIBS="$LIBS -lXrandr", | 550 | LIBS="-lXrandr $LIBS", |
551 | AC_MSG_RESULT([no]))) | 551 | AC_MSG_RESULT([no]))) |
552 | else | 552 | else |
553 | AC_MSG_RESULT([no]) | 553 | AC_MSG_RESULT([no]) |
@@ -571,7 +571,7 @@ if test "x$enableval" = "xyes"; then | |||
571 | , XRRUpdateConfiguration(0), | 571 | , XRRUpdateConfiguration(0), |
572 | AC_MSG_RESULT([yes]) | 572 | AC_MSG_RESULT([yes]) |
573 | AC_DEFINE(HAVE_RANDR1_2, [1], [Define to 1 if you have RANDR 1.2]) | 573 | AC_DEFINE(HAVE_RANDR1_2, [1], [Define to 1 if you have RANDR 1.2]) |
574 | LIBS="$LIBS -lXrandr", | 574 | LIBS="-lXrandr $LIBS", |
575 | AC_MSG_RESULT([no]))) | 575 | AC_MSG_RESULT([no]))) |
576 | else | 576 | else |
577 | AC_MSG_RESULT([no]) | 577 | AC_MSG_RESULT([no]) |
@@ -613,7 +613,7 @@ if test "x$enableval" = "xyes"; then | |||
613 | , fribidi_version_info, | 613 | , fribidi_version_info, |
614 | AC_MSG_RESULT([yes]) | 614 | AC_MSG_RESULT([yes]) |
615 | AC_DEFINE(HAVE_FRIBIDI, [1], [Define to 1 if you have FRIBIDI]) | 615 | AC_DEFINE(HAVE_FRIBIDI, [1], [Define to 1 if you have FRIBIDI]) |
616 | LIBS="$LIBS -lfribidi", | 616 | LIBS="-lfribidi $LIBS", |
617 | AC_MSG_RESULT([no]))) | 617 | AC_MSG_RESULT([no]))) |
618 | else | 618 | else |
619 | AC_MSG_RESULT([no]) | 619 | AC_MSG_RESULT([no]) |
diff --git a/src/FbTk/App.cc b/src/FbTk/App.cc index 8157839..f494a0e 100644 --- a/src/FbTk/App.cc +++ b/src/FbTk/App.cc | |||
@@ -60,8 +60,13 @@ App::App(const char *displayname):m_done(false), m_display(0) { | |||
60 | if (displayname != 0 && displayname[0] == '\0') | 60 | if (displayname != 0 && displayname[0] == '\0') |
61 | displayname = 0; | 61 | displayname = 0; |
62 | m_display = XOpenDisplay(displayname); | 62 | m_display = XOpenDisplay(displayname); |
63 | if (!m_display) | 63 | if (!m_display) { |
64 | throw std::string("Couldn't connect to XServer"); | 64 | if (displayname) { |
65 | throw std::string("Couldn't connect to XServer") + displayname; | ||
66 | } else { | ||
67 | throw std::string("Couldn't connect to XServer passing null display"); | ||
68 | } | ||
69 | } | ||
65 | 70 | ||
66 | FbStringUtil::init(); | 71 | FbStringUtil::init(); |
67 | } | 72 | } |
diff --git a/src/FbTk/FileUtil.cc b/src/FbTk/FileUtil.cc index 5de560b..c92b336 100644 --- a/src/FbTk/FileUtil.cc +++ b/src/FbTk/FileUtil.cc | |||
@@ -63,9 +63,14 @@ bool FileUtil::isExecutable(const char* filename) { | |||
63 | if (!filename || stat(filename, &buf)) | 63 | if (!filename || stat(filename, &buf)) |
64 | return false; | 64 | return false; |
65 | 65 | ||
66 | return buf.st_mode & S_IXUSR || | 66 | return buf.st_mode & S_IXUSR |
67 | buf.st_mode & S_IXGRP || | 67 | #ifdef S_IXGRP |
68 | buf.st_mode & S_IXOTH; | 68 | || buf.st_mode & S_IXGRP |
69 | #endif | ||
70 | #ifdef S_IXOTH | ||
71 | || buf.st_mode & S_IXOTH | ||
72 | #endif | ||
73 | ; | ||
69 | } | 74 | } |
70 | 75 | ||
71 | bool FileUtil::copyFile(const char* from, const char* to) { | 76 | bool FileUtil::copyFile(const char* from, const char* to) { |
diff --git a/src/FbTk/I18n.cc b/src/FbTk/I18n.cc index 81ff078..3daa2e9 100644 --- a/src/FbTk/I18n.cc +++ b/src/FbTk/I18n.cc | |||
@@ -72,17 +72,17 @@ void NLSInit(const char *catalog) { | |||
72 | 72 | ||
73 | 73 | ||
74 | I18n::I18n():m_multibyte(false), m_utf8_translate(false), m_catalog_fd((nl_catd)(-1)) { | 74 | I18n::I18n():m_multibyte(false), m_utf8_translate(false), m_catalog_fd((nl_catd)(-1)) { |
75 | #ifdef HAVE_SETLOCALE | 75 | #if defined(HAVE_SETLOCALE) && defined(NLS) |
76 | //make sure we don't get 0 to m_locale string | 76 | //make sure we don't get 0 to m_locale string |
77 | char *temp = setlocale(LC_MESSAGES, ""); | 77 | char *temp = setlocale(LC_MESSAGES, ""); |
78 | m_locale = ( temp ? temp : ""); | 78 | m_locale = ( temp ? temp : ""); |
79 | if (m_locale.empty()) { | 79 | if (m_locale.empty()) { |
80 | cerr<<"Warning: Failed to set locale, reverting to \"C\""<<endl; | 80 | cerr<<"Warning: Failed to set locale, reverting to \"C\""<<endl; |
81 | #endif // HAVE_SETLOCALE | 81 | #endif // defined(HAVE_SETLOCALE) && defined(NLS) |
82 | 82 | ||
83 | m_locale = "C"; | 83 | m_locale = "C"; |
84 | 84 | ||
85 | #ifdef HAVE_SETLOCALE | 85 | #if defined(HAVE_SETLOCALE) && defined(NLS) |
86 | 86 | ||
87 | } else { | 87 | } else { |
88 | 88 | ||
@@ -102,7 +102,7 @@ I18n::I18n():m_multibyte(false), m_utf8_translate(false), m_catalog_fd((nl_catd) | |||
102 | if (index != string::npos) | 102 | if (index != string::npos) |
103 | m_locale.erase(0,index+1); //erase all characters starting up to index | 103 | m_locale.erase(0,index+1); //erase all characters starting up to index |
104 | } | 104 | } |
105 | #endif // HAVE_SETLOCALE | 105 | #endif // defined(HAVE_SETLOCALE) && defined(NLS) |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
diff --git a/src/FbTk/SignalHandler.cc b/src/FbTk/SignalHandler.cc index a0a4c4c..5f06210 100644 --- a/src/FbTk/SignalHandler.cc +++ b/src/FbTk/SignalHandler.cc | |||
@@ -46,6 +46,7 @@ bool SignalHandler::registerHandler(int signum, SignalEventHandler *eh, | |||
46 | if (oldhandler_ret != 0) | 46 | if (oldhandler_ret != 0) |
47 | *oldhandler_ret = s_signal_handler[signum]; | 47 | *oldhandler_ret = s_signal_handler[signum]; |
48 | 48 | ||
49 | #ifdef HAVE_SIGACTION | ||
49 | struct sigaction sa; | 50 | struct sigaction sa; |
50 | // set callback | 51 | // set callback |
51 | sa.sa_handler = SignalHandler::handleSignal; | 52 | sa.sa_handler = SignalHandler::handleSignal; |
@@ -54,7 +55,12 @@ bool SignalHandler::registerHandler(int signum, SignalEventHandler *eh, | |||
54 | 55 | ||
55 | if (sigaction(signum, &sa, 0) == -1) | 56 | if (sigaction(signum, &sa, 0) == -1) |
56 | return false; | 57 | return false; |
57 | 58 | #else | |
59 | // Fallback code for Windows and other platforms lacking sigaction. | ||
60 | if (signal(signum, &SignalHandler::handleSignal) == SIG_ERR) { | ||
61 | return false; | ||
62 | } | ||
63 | #endif | ||
58 | s_signal_handler[signum] = eh; | 64 | s_signal_handler[signum] = eh; |
59 | 65 | ||
60 | return true; | 66 | return true; |
diff --git a/src/FbTk/Timer.cc b/src/FbTk/Timer.cc index 9b3fe8c..4d9f54f 100644 --- a/src/FbTk/Timer.cc +++ b/src/FbTk/Timer.cc | |||
@@ -49,7 +49,9 @@ | |||
49 | # include <string.h> | 49 | # include <string.h> |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | #include <sys/select.h> | 52 | #ifdef HAVE_SYS_SELECT_H |
53 | # include <sys/select.h> | ||
54 | #endif | ||
53 | 55 | ||
54 | namespace FbTk { | 56 | namespace FbTk { |
55 | 57 | ||
diff --git a/src/Makefile.am b/src/Makefile.am index 8c204db..1a04e4e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -63,6 +63,7 @@ defaults.hh: Makefile | |||
63 | defaults.cc: force | 63 | defaults.cc: force |
64 | @( \ | 64 | @( \ |
65 | GITDIR=$(top_srcdir)/.git; \ | 65 | GITDIR=$(top_srcdir)/.git; \ |
66 | echo '// This file is generated from Makefile. Do not edit!'; \ | ||
66 | echo '#include "defaults.hh"'; \ | 67 | echo '#include "defaults.hh"'; \ |
67 | echo ''; \ | 68 | echo ''; \ |
68 | echo 'std::string realProgramName(const std::string& name) {'; \ | 69 | echo 'std::string realProgramName(const std::string& name) {'; \ |
diff --git a/src/RootTheme.cc b/src/RootTheme.cc index d303834..a2aa4a8 100644 --- a/src/RootTheme.cc +++ b/src/RootTheme.cc | |||
@@ -40,7 +40,10 @@ | |||
40 | #include <iostream> | 40 | #include <iostream> |
41 | 41 | ||
42 | #include <sys/types.h> | 42 | #include <sys/types.h> |
43 | #ifdef HAVE_SYS_WAIT_H | ||
43 | #include <sys/wait.h> | 44 | #include <sys/wait.h> |
45 | #endif | ||
46 | |||
44 | #ifdef HAVE_CSTRING | 47 | #ifdef HAVE_CSTRING |
45 | #include <cstring> | 48 | #include <cstring> |
46 | #else | 49 | #else |
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 2e5e373..ff44e9f 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -124,7 +124,9 @@ | |||
124 | #include <sys/stat.h> | 124 | #include <sys/stat.h> |
125 | #endif // HAVE_SYS_STAT_H | 125 | #endif // HAVE_SYS_STAT_H |
126 | 126 | ||
127 | #ifdef HAVE_SYS_WAIT_H | ||
127 | #include <sys/wait.h> | 128 | #include <sys/wait.h> |
129 | #endif // HAVE_SYS_WAIT_H | ||
128 | 130 | ||
129 | #include <iostream> | 131 | #include <iostream> |
130 | #include <memory> | 132 | #include <memory> |
diff --git a/src/main.cc b/src/main.cc index c47e1d8..7541a28 100644 --- a/src/main.cc +++ b/src/main.cc | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "FbTk/I18n.hh" | 34 | #include "FbTk/I18n.hh" |
35 | #include "FbTk/CommandParser.hh" | 35 | #include "FbTk/CommandParser.hh" |
36 | #include "FbTk/FileUtil.hh" | 36 | #include "FbTk/FileUtil.hh" |
37 | #include "FbTk/StringUtil.hh" | ||
37 | 38 | ||
38 | //use GNU extensions | 39 | //use GNU extensions |
39 | #ifndef _GNU_SOURCE | 40 | #ifndef _GNU_SOURCE |
@@ -114,22 +115,22 @@ static void showInfo(ostream &ostr) { | |||
114 | 115 | ||
115 | ostr <<_FB_CONSOLETEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)") | 116 | ostr <<_FB_CONSOLETEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)") |
116 | << ": " | 117 | << ": " |
117 | << DEFAULTMENU << endl; | 118 | << FbTk::StringUtil::expandFilename(DEFAULTMENU) << endl; |
118 | ostr << _FB_CONSOLETEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)") | 119 | ostr << _FB_CONSOLETEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)") |
119 | << ": " | 120 | << ": " |
120 | << DEFAULTSTYLE << endl; | 121 | << FbTk::StringUtil::expandFilename(DEFAULTSTYLE) << endl; |
121 | 122 | ||
122 | ostr << _FB_CONSOLETEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)") | 123 | ostr << _FB_CONSOLETEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)") |
123 | << ": " | 124 | << ": " |
124 | << DEFAULTKEYSFILE << endl; | 125 | << FbTk::StringUtil::expandFilename(DEFAULTKEYSFILE) << endl; |
125 | ostr << _FB_CONSOLETEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)") | 126 | ostr << _FB_CONSOLETEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)") |
126 | << ": " | 127 | << ": " |
127 | << DEFAULT_INITFILE << endl; | 128 | << FbTk::StringUtil::expandFilename(DEFAULT_INITFILE) << endl; |
128 | 129 | ||
129 | #ifdef NLS | 130 | #ifdef NLS |
130 | ostr << _FB_CONSOLETEXT(Common, DefaultLocalePath, " nls", "location for localization files (right aligned - make sure same width as other default values)") | 131 | ostr << _FB_CONSOLETEXT(Common, DefaultLocalePath, " nls", "location for localization files (right aligned - make sure same width as other default values)") |
131 | << ": " | 132 | << ": " |
132 | << LOCALEPATH << endl; | 133 | << FbTk::StringUtil::expandFilename(LOCALEPATH) << endl; |
133 | #endif | 134 | #endif |
134 | 135 | ||
135 | const char NOT[] = "-"; | 136 | const char NOT[] = "-"; |
@@ -220,12 +221,12 @@ struct Options { | |||
220 | const char* env; | 221 | const char* env; |
221 | 222 | ||
222 | env = getenv("DISPLAY"); | 223 | env = getenv("DISPLAY"); |
223 | if (env) { | 224 | if (env && strlen(env) > 0) { |
224 | session_display.assign(env); | 225 | session_display.assign(env); |
225 | } | 226 | } |
226 | 227 | ||
227 | env = getenv("HOME"); | 228 | env = getenv("HOME"); |
228 | if (env) { | 229 | if (env && strlen(env) > 0) { |
229 | rc_path.assign(std::string(env) + "/." + realProgramName("fluxbox")); | 230 | rc_path.assign(std::string(env) + "/." + realProgramName("fluxbox")); |
230 | rc_file = rc_path + "/init"; | 231 | rc_file = rc_path + "/init"; |
231 | } | 232 | } |
@@ -369,14 +370,15 @@ void setupConfigFiles(const std::string& dirname, const std::string& rc) { | |||
369 | // copy default files if needed | 370 | // copy default files if needed |
370 | for (size_t i = 0; i < nr_of_cfiles; ++i) { | 371 | for (size_t i = 0; i < nr_of_cfiles; ++i) { |
371 | if (cfiles[i].create_file) { | 372 | if (cfiles[i].create_file) { |
372 | FbTk::FileUtil::copyFile(cfiles[i].default_name, cfiles[i].filename.c_str()); | 373 | FbTk::FileUtil::copyFile(FbTk::StringUtil::expandFilename(cfiles[i].default_name).c_str(), cfiles[i].filename.c_str()); |
373 | sync_fs = true; | 374 | sync_fs = true; |
374 | } | 375 | } |
375 | } | 376 | } |
376 | 377 | #ifdef HAVE_SYNC | |
377 | if (sync_fs) { | 378 | if (sync_fs) { |
378 | sync(); | 379 | sync(); |
379 | } | 380 | } |
381 | #endif | ||
380 | } | 382 | } |
381 | 383 | ||
382 | 384 | ||
@@ -413,7 +415,9 @@ void updateConfigFilesIfNeeded(const std::string& rc_file) { | |||
413 | << commandargs | 415 | << commandargs |
414 | << "' failed." << endl; | 416 | << "' failed." << endl; |
415 | } | 417 | } |
418 | #ifdef HAVE_SYNC | ||
416 | sync(); | 419 | sync(); |
420 | #endif // HAVE_SYNC | ||
417 | } | 421 | } |
418 | } | 422 | } |
419 | 423 | ||