summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBastian Wissler2008-07-10 19:14:08 +0200
committerBastian Wissler2008-07-10 19:14:08 +0200
commit8a797db8ffa08b5cf1a0e1e2e88bc57abbda0b6d (patch)
tree2ca4d84eb365db95ce66b24e07d32913f2dcdae9
parentchanges to vmchooser: (diff)
downloadvmchooser-8a797db8ffa08b5cf1a0e1e2e88bc57abbda0b6d.tar.gz
vmchooser-8a797db8ffa08b5cf1a0e1e2e88bc57abbda0b6d.tar.xz
vmchooser-8a797db8ffa08b5cf1a0e1e2e88bc57abbda0b6d.zip
vmchooser changes:
* some std::string gets used instead of char* - caused problems in vmware-run calls (propably) git-svn-id: http://svn.openslx.org/svn/openslx/openslx-src-tools/trunk/os-plugins/plugins/vmchooser@1920 95ad53e4-c205-0410-b2fa-d234c58c8868
-rw-r--r--vmchooser/SWindow.cxx28
-rw-r--r--vmchooser/inc/functions.h4
-rw-r--r--vmchooser/runImage.cxx40
3 files changed, 36 insertions, 36 deletions
diff --git a/vmchooser/SWindow.cxx b/vmchooser/SWindow.cxx
index bf1c669..57be64f 100644
--- a/vmchooser/SWindow.cxx
+++ b/vmchooser/SWindow.cxx
@@ -3,12 +3,12 @@
#include <iostream>
-#include <img/gnome_48.xpm>
-#include <img/kde_48.xpm>
-#include <img/linux_48.xpm>
-#include <img/xp_48.xpm>
-#include <img/xp_locked_48.xpm>
-#include <img/xfce_48.xpm>
+#include <img/gnome_32.xpm>
+#include <img/kde_32.xpm>
+#include <img/linux_32.xpm>
+#include <img/xp_32.xpm>
+#include <img/xp_locked_32.xpm>
+#include <img/xfce_32.xpm>
using namespace fltk;
@@ -146,25 +146,25 @@ void SWindow::unfold_entries() {
char** SWindow::get_symbol(DataEntry* dat) {
if(dat->imgtype == VMWARE) {
if(dat->locked) {
- return xp_locked_48_xpm;
+ return xp_locked_32_xpm;
}
else {
- return xp_48_xpm;
+ return xp_32_xpm;
}
}
if(dat->imgtype == LINUX) {
if(dat->short_description.find("KDE")!= string::npos) {
- return kde_48_xpm;
+ return kde_32_xpm;
}
if(dat->short_description.find("GNOME")!= string::npos) {
- return gnome_48_xpm;
+ return gnome_32_xpm;
}
- if(dat->short_description.find("xfce")!= string::npos) {
- return xfce_48_xpm;
+ if(dat->short_description.find("Xfce")!= string::npos) {
+ return xfce_32_xpm;
}
- return linux_48_xpm;
+ return linux_32_xpm;
}
- return xp_48_xpm;
+ return xp_32_xpm;
}
diff --git a/vmchooser/inc/functions.h b/vmchooser/inc/functions.h
index aa9104e..238a70a 100644
--- a/vmchooser/inc/functions.h
+++ b/vmchooser/inc/functions.h
@@ -15,7 +15,7 @@ DataEntry** readLinSess(char* path);
void runImage(fltk::Widget* , void* p);
/* building & executing command for different Virtualizer */
-string runImage(DataEntry&, char* confxml);
+string runImage(DataEntry&, string confxml);
/* Globs for a specific filetype (2. argument) */
glob_t* globber(char* path, char* filetype);
@@ -29,7 +29,7 @@ bool addPrinters(xmlNode* node, char* script);
bool addScanners(xmlNode* node, char* script);
/* Write configuration xml */
-const char* writeConfXml(DataEntry& dat);
+string writeConfXml(DataEntry& dat);
#endif /* _FUNCTIONS_H_ */
diff --git a/vmchooser/runImage.cxx b/vmchooser/runImage.cxx
index 17aa0f4..95bb99f 100644
--- a/vmchooser/runImage.cxx
+++ b/vmchooser/runImage.cxx
@@ -4,6 +4,8 @@
#include "inc/SWindow.h"
#include "inc/functions.h"
+#include <sstream>
+
#include <errno.h>
#include <sys/wait.h>
#include <iostream>
@@ -17,7 +19,7 @@
***************************************************************/
void runImage(fltk::Widget*, void* p)
{
- char* confxml = 0;
+ string confxml;
/* printf("runImage called\n"); */
if ( p == NULL ) {
@@ -27,7 +29,7 @@ void runImage(fltk::Widget*, void* p)
DataEntry& dat = *((DataEntry*) p);
if(dat.imgtype == VMWARE) {
- confxml = (char*) writeConfXml(dat);
+ confxml = writeConfXml(dat);
}
pid_t pid;
@@ -55,16 +57,13 @@ void runImage(fltk::Widget*, void* p)
* Helper-function for runImage(Widget, void)
* - runs the chosen virtualizer image
**/
-string runImage(DataEntry& dat, char* confxml)
+string runImage(DataEntry& dat, string confxml)
{
//cout << dat.imgtype << endl << VMWARE << endl;
if (dat.imgtype == VMWARE) {
//cout << confxml << endl;
char* arg[] = { "/var/X11R6/bin/run-vmware.sh",
- confxml,
- (char*) dat.imgname.insert(0, "/var/lib/vmware/" ).c_str(),
- (char*) dat.os.c_str(),
- (char*)dat.network.c_str(),
+ (char*)confxml.c_str(),
NULL };
//cout << arg << endl; //"run-vmware.sh imagename os (Window-Title) network"
@@ -109,17 +108,14 @@ char* getFolderName() {
}
-const char* writeConfXml(DataEntry& dat) {
-
- const int MAX_LENGTH = 300;
+string writeConfXml(DataEntry& dat) {
//char* pname = getFolderName();
- char pname[MAX_LENGTH];
- strcpy(pname,"/var/lib/vmware/runscripts");
+ string pname = string().append("/var/lib/vmware/runscripts");
xmlNodePtr cur = 0;
xmlNodePtr root = 0;
- strncat(pname, "/printer.sh", MAX_LENGTH);
+ string pskript = pname +"/printer.sh";
cur = xmlDocGetRootElement(dat.xml);
if(cur == NULL) {
@@ -138,19 +134,23 @@ const char* writeConfXml(DataEntry& dat) {
}
// add "printers" and "scanners" - XML-Nodes
- addPrinters(root, pname);
+ addPrinters(root, (char*)pskript.c_str());
//char* pname = getFolderName();
- strcpy(pname,"/var/lib/vmware/runscripts");
- strncat(pname, "/scanner.sh", MAX_LENGTH);
- addScanners(root, pname);
+ pskript = pname + "/scanners.sh";
+ addScanners(root, (char*)pskript.c_str());
//xmlSaveFile("-", dat.xml);
srand(time(NULL));
- char xmlfile[50];
- sprintf( xmlfile, "/tmp/run%d.xml", rand() );
+ string xmlfile;
+ ostringstream i;
+ i << "/tmp/run" << rand() << ".xml";
+ xmlfile = i.str();
+
+ //ofstream file("/tmp/debug", ios_base::app);
+ //file << xmlfile << rand()<< endl;
- xmlSaveFile( xmlfile, dat.xml);
+ xmlSaveFile( (char*) xmlfile.c_str(), dat.xml);
return xmlfile;
}