[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog configure.ac doc/C/usermanual/u...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog configure.ac doc/C/usermanual/u... |
Date: |
Mon, 20 Aug 2007 17:48:10 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/08/20 17:48:09
Modified files:
. : ChangeLog configure.ac
doc/C/usermanual/usage: gnashrc.xml
libbase : rc.cpp rc.h
Log message:
Tilde expansion (patch #6158) by Benjamin Wolsey <address@hidden>:
* configure.ac: look for the pwd.h header
* doc/C/usermanual/usage/gnashrc.xml: add info about tilde expansion.
* libbase/rc.{cpp,h}: add support for tilde expansion in debugLog
value.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4046&r2=1.4047
http://cvs.savannah.gnu.org/viewcvs/gnash/configure.ac?cvsroot=gnash&r1=1.401&r2=1.402
http://cvs.savannah.gnu.org/viewcvs/gnash/doc/C/usermanual/usage/gnashrc.xml?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.cpp?cvsroot=gnash&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.h?cvsroot=gnash&r1=1.22&r2=1.23
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4046
retrieving revision 1.4047
diff -u -b -r1.4046 -r1.4047
--- ChangeLog 20 Aug 2007 16:21:03 -0000 1.4046
+++ ChangeLog 20 Aug 2007 17:48:09 -0000 1.4047
@@ -1,3 +1,10 @@
+2007-08-20 Benjamin Wolsey <address@hidden>
+
+ * configure.ac: look for the pwd.h header
+ * doc/C/usermanual/usage/gnashrc.xml: add info about tilde expansion.
+ * libbase/rc.{cpp,h}: add support for tilde expansion in debugLog
+ value.
+
2007-08-20 Sandro Santilli <address@hidden>
* libbase/log.{cpp,h}: print an error on stderr of the debug log file
Index: configure.ac
===================================================================
RCS file: /sources/gnash/gnash/configure.ac,v
retrieving revision 1.401
retrieving revision 1.402
diff -u -b -r1.401 -r1.402
--- configure.ac 18 Aug 2007 12:24:40 -0000 1.401
+++ configure.ac 20 Aug 2007 17:48:09 -0000 1.402
@@ -15,7 +15,7 @@
dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
dnl
-dnl $Id: configure.ac,v 1.401 2007/08/18 12:24:40 strk Exp $
+dnl $Id: configure.ac,v 1.402 2007/08/20 17:48:09 strk Exp $
AC_PREREQ(2.50)
AC_INIT(gnash, cvs)
@@ -773,6 +773,7 @@
AC_CHECK_HEADERS(malloc.h)
AC_CHECK_HEADERS(getopt.h)
AC_CHECK_HEADERS(libgen.h)
+AC_CHECK_HEADERS(pwd.h)
AC_CHECK_LIB(m, sqrt)
dnl don't look for X11 when using a raw framebuffer for the GUI
Index: doc/C/usermanual/usage/gnashrc.xml
===================================================================
RCS file: /sources/gnash/gnash/doc/C/usermanual/usage/gnashrc.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- doc/C/usermanual/usage/gnashrc.xml 19 Aug 2007 20:01:12 -0000 1.7
+++ doc/C/usermanual/usage/gnashrc.xml 20 Aug 2007 17:48:09 -0000 1.8
@@ -97,7 +97,9 @@
<entry>debuglog</entry>
<entry>Absolute path</entry>
<entry>This is the full path and name of debug logfile as
- produced by &app;.</entry>
+ produced by &app;. On systems with a UNIX-type shell,
+ a tilde prefix (~) will be expanded as by Posix shell requirements
+ (see
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_01).</entry>
</row>
<row>
<entry>writelog</entry>
Index: libbase/rc.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/rc.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- libbase/rc.cpp 19 Aug 2007 20:01:13 -0000 1.28
+++ libbase/rc.cpp 20 Aug 2007 17:48:09 -0000 1.29
@@ -22,6 +22,10 @@
# include "config.h"
#endif
+#ifdef HAVE_PWD_H
+# include <pwd.h>
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
@@ -144,6 +148,65 @@
return *num;
}
+string
+RcInitFile::expandTilde (std::string& unixpath)
+
+{
+string _expanded;
+
+ //Only if path starts with "~"
+ if (unixpath.substr(0,1) == "~") {
+ const char *home = getenv("HOME");
+ if (unixpath.substr(1,2) == "/") {
+ // Initial "~" followed by "/"
+ if (home) {
+ // if HOME set in env, replace ~ with HOME
+ _expanded = unixpath.replace(0,1,home);
+ }
+ //HOME not set in env: try using pwd
+ else {
+ struct passwd *password = getpwuid(getuid());
+ const char *pwdhome = password->pw_dir;
+ if (home) { _expanded =
unixpath.replace(0,1,pwdhome); }
+ //If all that fails, leave path alone
+ else _expanded = unixpath;
+ }
+ }
+
+ //Initial "~" is not followed by "/"
+ else {
+ const char *userhome = NULL;
+ string::size_type first_slash =
unixpath.find_first_of("/");
+ string user;
+ if (first_slash != string::npos) {
+ // everything between initial ~ and /
+ user = unixpath.substr(1, first_slash - 1 );
+ }
+
+ //find user using pwd
+ struct passwd *password = getpwnam(user.c_str());
+ if (password) {
+ //User found
+ userhome = password->pw_dir;
+ }
+ if (userhome) {
+ string foundhome(userhome);
+ _expanded =
unixpath.replace(0,first_slash,foundhome);
+ }
+ else {
+ //User not found and/or pwd doesn't return
homedir:
+ //Leave path alone.
+ _expanded = unixpath;
+ }
+ }
+ }
+ //Path doesn't start with ~, leave it alone.
+ else {
+ _expanded = unixpath;
+ }
+ return _expanded;
+}
+
// Parse the config file and set the variables.
bool
RcInitFile::parseFile(const std::string& filespec)
@@ -211,7 +274,14 @@
}
if (variable == "debuglog") {
+
+#ifdef HAVE_PWD_H
+ _log = expandTilde (value);
+#else
+//For non-UNIX systems
_log = value;
+#endif
+
}
if (variable == "documentroot") {
Index: libbase/rc.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/rc.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- libbase/rc.h 19 Aug 2007 20:01:13 -0000 1.22
+++ libbase/rc.h 20 Aug 2007 17:48:09 -0000 1.23
@@ -102,6 +102,8 @@
static int extractNumber(int *num, const char *pattern, std::string
&variable,
std::string &value);
+ static std::string expandTilde(std::string& unixpath);
+
const std::vector<std::string>& getWhiteList() const { return _whitelist; }
const std::vector<std::string>& getBlackList() const { return _blacklist; }
- [Gnash-commit] gnash ChangeLog configure.ac doc/C/usermanual/u...,
Sandro Santilli <=