summaryrefslogtreecommitdiffstats
path: root/kxsldbg/kxsldbgpart/libxsldbg/options_unix.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite9ae80694875f869892f13f4fcaf1170a00dea41 (patch)
treeaa2f8d8a217e2d376224c8d46b7397b68d35de2d /kxsldbg/kxsldbgpart/libxsldbg/options_unix.cpp
downloadtdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.tar.gz
tdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kxsldbg/kxsldbgpart/libxsldbg/options_unix.cpp')
-rw-r--r--kxsldbg/kxsldbgpart/libxsldbg/options_unix.cpp118
1 files changed, 118 insertions, 0 deletions
diff --git a/kxsldbg/kxsldbgpart/libxsldbg/options_unix.cpp b/kxsldbg/kxsldbgpart/libxsldbg/options_unix.cpp
new file mode 100644
index 00000000..27c7d2f1
--- /dev/null
+++ b/kxsldbg/kxsldbgpart/libxsldbg/options_unix.cpp
@@ -0,0 +1,118 @@
+
+/***************************************************************************
+ options_unix.c - *nix specific option functions
+ -------------------
+ begin : Tue Jan 29 2002
+ copyright : (C) 2001 by Keith Isdale
+ email : k_isdale@tpg.com.au
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <libxml/parser.h>
+#include <stdlib.h>
+#include <string.h>
+#include "xsldbg.h"
+#include "options.h"
+
+ /**
+ * optionsPlatformInit:
+ *
+ * Intialize the platform specific options module
+ *
+ * This is a platform specific interface
+ *
+ * Returns 1 if sucessful
+ * 0 otherwise
+ */
+int
+optionsPlatformInit(void)
+{
+ return 1;
+}
+
+
+ /**
+ * optionsPlatformFree:
+ *
+ * Free memory used by the platform specific options module
+ *
+ * This is a platform specific interface
+ *
+ */
+void
+optionsPlatformFree(void)
+{
+ /* empty */
+}
+
+ /**
+ * optionsConfigFileName:
+ *
+ * Returns A copy of the file name that will be used to load xsldbgs
+ * configuration from,
+ * NULL otherwise
+ */
+xmlChar *
+optionsConfigFileName(void)
+{
+ xmlChar *result = NULL;
+ const char *homeDir = getenv("HOME");
+ const char *configName = "xsldbg.rc";
+ int bufferSize = 0;
+
+ if (homeDir) {
+ /* give ourselves a bit of room to move */
+ bufferSize = strlen(homeDir) + strlen(configName) + 10;
+ result = (xmlChar *) xmlMalloc(bufferSize);
+ snprintf((char *) result, bufferSize, "%s/%s", homeDir,
+ configName);
+ }
+ return result;
+}
+
+
+ /**
+ * optionsLoad:
+ *
+ * Load options from configuration file/registry
+ *
+ * This is a platform specific interface
+ *
+ * Returns 1 if able to load options
+ * 0 otherwise
+ */
+int
+optionsLoad(void)
+{
+ int result = 0;
+ xmlDocPtr doc = xmlParseFile((char *) optionsConfigFileName());
+
+ if (doc)
+ result = optionsReadDoc(doc);
+ return 0;
+}
+
+
+ /**
+ * optionsSave:
+ *
+ * Save options to configuration file/registry
+ *
+ * This is a platform specific interface
+ *
+ * Returns 1 if able to save options
+ * 0 otherwise
+ */
+int
+optionsSave(void)
+{
+ return optionsSavetoFile(optionsConfigFileName());
+}