Index: libbase/rc.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/rc.cpp,v
retrieving revision 1.28
diff -p -4 -u -r1.28 rc.cpp
--- libbase/rc.cpp	19 Aug 2007 20:01:13 -0000	1.28
+++ libbase/rc.cpp	20 Aug 2007 17:15:27 -0000
@@ -21,8 +21,12 @@
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
+#ifdef HAVE_PWD_H
+# include <pwd.h>
+#endif
+
 #include <sys/types.h>
 #include <sys/stat.h>
 
 #include <cctype>  // for toupper
@@ -143,8 +147,67 @@ RcInitFile::extractNumber(int *num, cons
     }
     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)
 {
@@ -210,9 +273,16 @@ RcInitFile::parseFile(const std::string&
                     _flashVersionString = value;
                 }
 
                 if (variable == "debuglog") {
-                    _log = value;
+
+#ifdef HAVE_PWD_H
+	             _log = expandTilde (value);
+#else
+//For non-UNIX systems
+                     _log = value;
+#endif
+
                 }
 
                 if (variable == "documentroot") {
                     _wwwroot = value;
Index: libbase/rc.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/rc.h,v
retrieving revision 1.22
diff -p -4 -u -r1.22 rc.h
--- libbase/rc.h	19 Aug 2007 20:01:13 -0000	1.22
+++ libbase/rc.h	20 Aug 2007 17:15:27 -0000
@@ -101,8 +101,10 @@ public:
     
     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; }
 
     const std::string& getFlashVersionString() const { return _flashVersionString; }
Index: configure.ac
===================================================================
RCS file: /sources/gnash/gnash/configure.ac,v
retrieving revision 1.401
diff -p -4 -u -r1.401 configure.ac
--- configure.ac	18 Aug 2007 12:24:40 -0000	1.401
+++ configure.ac	20 Aug 2007 17:15:27 -0000
@@ -772,8 +772,9 @@ esac
 
 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
 if test x$build_gtk = xyes -o x$build_kde = xyes -o x$build_fltk = xyes -o x$build_sdl = xyes; then
Index: doc/C/usermanual/usage/gnashrc.xml
===================================================================
RCS file: /sources/gnash/gnash/doc/C/usermanual/usage/gnashrc.xml,v
retrieving revision 1.7
diff -p -4 -u -r1.7 gnashrc.xml
--- 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:15:27 -0000
@@ -96,9 +96,10 @@ The variables in the <filename>.gnashrc<
 <row>
 <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,
+        ~ will be expanded in the normal way.</entry>
 </row>
 <row>
 <entry>writelog</entry>
 <entry>on/off</entry>
