summaryrefslogtreecommitdiff
path: root/otk/util.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-03-21 18:42:39 +0000
committerDana Jansens <danakj@orodu.net>2003-03-21 18:42:39 +0000
commita52a6d96d701c993896f276e4198003317632aaf (patch)
treebe2f51e6a433d1fdf9a7c8248b343cb3f6297212 /otk/util.cc
parenta36c7543d4eedaa9e10bfd9f4d9b81279b1bb7e6 (diff)
rm the old code including the .pys and the c++ shit
Diffstat (limited to 'otk/util.cc')
-rw-r--r--otk/util.cc97
1 files changed, 0 insertions, 97 deletions
diff --git a/otk/util.cc b/otk/util.cc
deleted file mode 100644
index 03df393e..00000000
--- a/otk/util.cc
+++ /dev/null
@@ -1,97 +0,0 @@
-// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
-
-#include "config.h"
-
-extern "C" {
-#include <X11/Xatom.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif // HAVE_UNISTD_H
-
-// this is not checked in configure anymore!!
-//#if defined(HAVE_PROCESS_H) && defined(__EMX__)
-//# include <process.h>
-//#endif // HAVE_PROCESS_H __EMX__
-
-#include "../src/gettext.h"
-#define _(str) gettext(str)
-
-}
-
-#include <algorithm>
-#include <cassert>
-#include <cstdio>
-#include <cstring>
-#include <cstdlib>
-
-#include "util.hh"
-
-using std::string;
-
-namespace otk {
-
-string expandTilde(const string& s) {
- if (s[0] != '~') return s;
-
- const char* const home = getenv("HOME");
- if (home == NULL) return s;
-
- return string(home + s.substr(s.find('/')));
-}
-
-
-void bexec(const string& command, const string& displaystring) {
-//#ifndef __EMX__
- if (! fork()) {
- setsid();
- putenv(displaystring);
- int ret = execl("/bin/sh", "/bin/sh", "-c", command.c_str(), NULL);
- exit(ret);
- }
-//#else // __EMX__
-// spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", command.c_str(), NULL);
-//#endif // !__EMX__
-}
-
-
-string itostring(unsigned long i) {
- if (i == 0)
- return string("0");
-
- string tmp;
- for (; i > 0; i /= 10)
- tmp.insert(tmp.begin(), "0123456789"[i%10]);
- return tmp;
-}
-
-
-string itostring(long i) {
- std::string tmp = itostring( (unsigned long) std::abs(i));
- if (i < 0)
- tmp.insert(tmp.begin(), '-');
- return tmp;
-}
-
-void putenv(const std::string &data)
-{
- char *c = new char[data.size() + 1];
- std::string::size_type i, max;
- for (i = 0, max = data.size(); i < max; ++i)
- c[i] = data[i];
- c[i] = 0;
- if (::putenv(c)) {
- printf(_("warning: couldn't set environment variable\n"));
- perror("putenv()");
- }
-}
-
-string basename (const string& path) {
- string::size_type slash = path.rfind('/');
- if (slash == string::npos)
- return path;
- return path.substr(slash+1);
-}
-
-}
-