wmanager (0.2.1-9) 03-wmanager.cc.patch

Summary

 src/WManager.cc |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

    
download this patch

Patch contents

Description: Even more fixes for the C++ build.
 Use the "std" namespace and iostream to fix the C++ build (#116402).
 Include <sys/types.h> and <unistd.h> for getuid().
 Look for a default config file in /etc/X11/wmanagerrc.
 Pass a C character string, not a C++ string, to fl_alert().
 Constify the arguments to WManager::_CutString().
 Include <cstdlib> for exit() (#417758)
 .
 This patch has been forwarded to Meik Tessmer via private e-mail;
 he responded that he will probably integrate it into a new release.
Forwarded: yes
Author: James Troup <james@nocrew.org>,
	Martin Michlmayr <tbm@cyrius.com>,
	Tommi Virtanen <tv@debian.org>,
	Peter Pentchev <roam@ringlet.net>
Last-Update: 2009-09-08

diff -urNad wmanager-0.2.1~/src/WManager.cc wmanager-0.2.1/src/WManager.cc
--- wmanager-0.2.1~/src/WManager.cc	2007-12-17 13:40:19.000000000 +0200
+++ wmanager-0.2.1/src/WManager.cc	2007-12-17 16:01:12.000000000 +0200
@@ -24,8 +24,12 @@
 // SYSTEM INCLUDES /////////////////////////////////
 #include <string>                                 // standard string class
 #include <fstream>                                // file streams
+#include <cstdlib>                                // 'exit'
 #include <cstring>                                // only for 'strtok'
+#include <iostream>
 #include <pwd.h>                                  // for home directory
+#include <unistd.h>				  //
+#include <sys/types.h>          		  // these two for getuid 
 
 
 // PROJECT INCLUDES ////////////////////////////////
@@ -36,6 +40,7 @@
 // LOCAL INCLUDES //////////////////////////////////
 #include <FL/fl_message.H>                        // message window
 
+using namespace std;
 
 // constructor
 WManager::WManager()
@@ -75,6 +80,10 @@
   configuration_filename += my_passwd->pw_dir;
   configuration_filename += "/.wmanagerrc";
 
+  if (access (configuration_filename.c_str(), R_OK) != 0
+      && access ("/etc/X11/wmanagerrc", R_OK) == 0)
+    configuration_filename = "/etc/X11/wmanagerrc";
+
   _ConfigurationFilename = new string(configuration_filename.c_str());
 
   _Interface = new Interface();
@@ -302,7 +311,7 @@
     } else {
       fl_alert("Error near %s while parsing configuration file %s!"
 	       "Try to read on...",
-	       name->c_str(), _ConfigurationFilename);
+	       name->c_str(), _ConfigurationFilename->c_str());
     } // end if
   } // end if
 }
@@ -310,7 +319,7 @@
 
 // cut rest from the beginning of str
 char*
-WManager::_CutString(char* str, char* rest)
+WManager::_CutString(const char* str, const char* rest)
 {
   int   i          = 0;
   int   n          = 0;