diff options
author | Denys Dmytriyenko <denis@denix.org> | 2009-03-17 14:32:59 -0400 |
---|---|---|
committer | Denys Dmytriyenko <denis@denix.org> | 2009-03-17 14:32:59 -0400 |
commit | 709c4d66e0b107ca606941b988bad717c0b45d9b (patch) | |
tree | 37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/nxcl/files/deletelogfiles.patch | |
parent | fa6cd5a3b993f16c27de4ff82b42684516d433ba (diff) |
rename packages/ to recipes/ per earlier agreement
See links below for more details:
http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326
http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816
Signed-off-by: Denys Dmytriyenko <denis@denix.org>
Acked-by: Mike Westerhof <mwester@dls.net>
Acked-by: Philip Balister <philip@balister.org>
Acked-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Marcin Juszkiewicz <hrw@openembedded.org>
Acked-by: Koen Kooi <koen@openembedded.org>
Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/nxcl/files/deletelogfiles.patch')
-rw-r--r-- | recipes/nxcl/files/deletelogfiles.patch | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/recipes/nxcl/files/deletelogfiles.patch b/recipes/nxcl/files/deletelogfiles.patch new file mode 100644 index 0000000000..9e5b10dcca --- /dev/null +++ b/recipes/nxcl/files/deletelogfiles.patch @@ -0,0 +1,136 @@ +Index: nxcl-0.9/lib/nxclientlib.cpp +=================================================================== +--- nxcl-0.9.orig/lib/nxclientlib.cpp 2008-10-15 15:09:17.000000000 +0200 ++++ nxcl-0.9/lib/nxclientlib.cpp 2008-10-15 15:30:33.000000000 +0200 +@@ -27,6 +27,8 @@ + #include "../config.h" + + #include <fstream> ++#include <iostream> ++#include <string> + + extern "C" { + #include <errno.h> +@@ -966,4 +968,68 @@ + free (buf); + return path; + } ++ ++int NXClientLib::fmatch(const struct dirent *direntry) ++{ ++ if (strncmp(direntry->d_name, "S", 1) == 0){ ++ return 1; ++ } ++ return 0; ++} ++ ++ ++bool NXClientLib::deleteAllSessionfiles() ++{ ++ struct dirent **filelist; ++ DIR *Directory; ++ int filescount = 0; ++ int i; ++ ifstream sessionfile; ++ string line, rmsesdir; ++ ++ char * home; ++ stringstream ss; ++ string nxdir; ++ ++ home = getenv ("HOME"); ++ ++ ss << home; ++ ++ nxdir = ss.str() + "/.nx"; ++ ++ Directory = opendir(nxdir.c_str()); ++ ++ if( Directory ) ++ { ++ filescount = scandir(nxdir.c_str(), &filelist, fmatch, alphasort); ++ ++ for (i=0; i < filescount; i++) ++ { ++ rmsesdir = nxdir + "/" + string(filelist[i]->d_name) + "/"; ++ sessionfile.open((rmsesdir + "session").c_str()); ++ ++ if ( sessionfile.is_open() ) ++ { ++ while( !sessionfile.eof() ) ++ { ++ getline(sessionfile,line); ++ if ( (line.find("Session terminated") != string::npos) || ++ (line.find("Exiting keeper") != string::npos) ) ++ { ++ // lazy deletion but it works ++ remove( (rmsesdir + "errors").c_str() ); ++ remove( (rmsesdir + "options").c_str() ); ++ remove( (rmsesdir + "session").c_str() ); ++ remove( (rmsesdir + "stats").c_str() ); ++ remove(rmsesdir.c_str()); ++ break; ++ } ++ } ++ } ++ } ++ return true; ++ } ++ return false; ++} ++ + //@} +Index: nxcl-0.9/lib/nxclientlib.h +=================================================================== +--- nxcl-0.9.orig/lib/nxclientlib.h 2008-10-15 15:09:17.000000000 +0200 ++++ nxcl-0.9/lib/nxclientlib.h 2008-10-15 15:09:17.000000000 +0200 +@@ -25,10 +25,14 @@ + #define _NXCLIENTLIB_H_ + + #include <iostream> +-#include "nxsession.h" + #include <list> ++ ++#include "nxsession.h" + #include "notQt.h" + ++extern "C" { ++ #include <dirent.h> ++} + + using namespace std; + +@@ -375,6 +379,11 @@ + { + return this->sessionRunning; + } ++ ++ // static function so we do not need an explicit object ++ // for deleting the session files ++ static bool deleteAllSessionfiles(void); ++ + //@} + + private: +@@ -493,6 +502,7 @@ + */ + int httpProxyPort; + ++ static int fmatch(const struct dirent *direntry); + }; + + } // namespace +Index: nxcl-0.9/lib/nxdata.h +=================================================================== +--- nxcl-0.9.orig/lib/nxdata.h 2008-10-15 15:09:17.000000000 +0200 ++++ nxcl-0.9/lib/nxdata.h 2008-10-15 15:09:17.000000000 +0200 +@@ -77,6 +77,9 @@ + bool proxyAuthenticated; + string proxyUser; + string proxyPass; ++ // small hack for storing this ++ // easier than workaround in the client ++ bool delSessionfiles; + }; + + struct NXSessionData { |