summaryrefslogtreecommitdiffstats
path: root/kdesu/kdesud
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:33:34 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:33:34 +0000
commitc663b6440964f6ac48027143ac9e63298991f9d0 (patch)
tree6d8b0c5a5f9db1ee16acf98b1397cea9126b281d /kdesu/kdesud
parenta061f7191beebb0e4a3b0c0a7c534ec5f22f2dc7 (diff)
downloadtdebase-c663b6440964f6ac48027143ac9e63298991f9d0.tar.gz
tdebase-c663b6440964f6ac48027143ac9e63298991f9d0.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdesu/kdesud')
-rw-r--r--kdesu/kdesud/handler.cpp26
-rw-r--r--kdesu/kdesud/handler.h10
-rw-r--r--kdesu/kdesud/kdesud.cpp16
-rw-r--r--kdesu/kdesud/lexer.cpp6
-rw-r--r--kdesu/kdesud/lexer.h8
-rw-r--r--kdesu/kdesud/repo.cpp30
-rw-r--r--kdesu/kdesud/repo.h28
7 files changed, 62 insertions, 62 deletions
diff --git a/kdesu/kdesud/handler.cpp b/kdesu/kdesud/handler.cpp
index f18a874da..1d52a58ac 100644
--- a/kdesu/kdesud/handler.cpp
+++ b/kdesu/kdesud/handler.cpp
@@ -18,7 +18,7 @@
#include <sys/socket.h>
#include <sys/types.h>
-#include <qcstring.h>
+#include <tqcstring.h>
#include <kdebug.h>
#include <kdesu/su.h>
@@ -86,7 +86,7 @@ int ConnectionHandler::handle()
// Do we have a complete command yet?
int n;
- QCString newbuf;
+ TQCString newbuf;
while ((n = m_Buf.find('\n')) != -1)
{
newbuf = m_Buf.left(n+1);
@@ -100,10 +100,10 @@ int ConnectionHandler::handle()
return 0;
}
-QCString ConnectionHandler::makeKey(int _namespace, QCString s1,
- QCString s2, QCString s3)
+TQCString ConnectionHandler::makeKey(int _namespace, TQCString s1,
+ TQCString s2, TQCString s3)
{
- QCString res;
+ TQCString res;
res.setNum(_namespace);
res += "*";
res += s1 + "*" + s2 + "*" + s3;
@@ -114,7 +114,7 @@ void ConnectionHandler::sendExitCode()
{
if (!m_needExitCode)
return;
- QCString buf;
+ TQCString buf;
buf.setNum(m_exitCode);
buf.prepend("OK ");
buf.append("\n");
@@ -122,9 +122,9 @@ void ConnectionHandler::sendExitCode()
send(m_Fd, buf.data(), buf.length(), 0);
}
-void ConnectionHandler::respond(int ok, QCString s)
+void ConnectionHandler::respond(int ok, TQCString s)
{
- QCString buf;
+ TQCString buf;
switch (ok) {
case Res_OK:
@@ -152,7 +152,7 @@ void ConnectionHandler::respond(int ok, QCString s)
* close the socket in the main accept loop.
*/
-int ConnectionHandler::doCommand(QCString buf)
+int ConnectionHandler::doCommand(TQCString buf)
{
if ((uid_t) peerUid() != getuid())
{
@@ -161,7 +161,7 @@ int ConnectionHandler::doCommand(QCString buf)
return -1;
}
- QCString key, command, pass, name, user, value, env_check;
+ TQCString key, command, pass, name, user, value, env_check;
Data_entry data;
Lexer *l = new Lexer(buf);
@@ -221,7 +221,7 @@ int ConnectionHandler::doCommand(QCString buf)
case Lexer::Tok_exec: // "EXEC command:string user:string [options:string (env:string)*]\n"
{
- QCString options;
+ TQCString options;
QCStringList env;
tok = l->lex();
if (tok != Lexer::Tok_str)
@@ -242,7 +242,7 @@ int ConnectionHandler::doCommand(QCString buf)
{
if (tok != Lexer::Tok_str)
goto parse_error;
- QCString env_str = l->lval();
+ TQCString env_str = l->lval();
env.append(env_str);
if (strncmp(env_str, "DESKTOP_STARTUP_ID=", strlen("DESKTOP_STARTUP_ID=")) != 0)
env_check += "*"+env_str;
@@ -250,7 +250,7 @@ int ConnectionHandler::doCommand(QCString buf)
}
}
- QCString auth_user;
+ TQCString auth_user;
if ((m_Scheduler != SuProcess::SchedNormal) || (m_Priority > 50))
auth_user = "root";
else
diff --git a/kdesu/kdesud/handler.h b/kdesu/kdesud/handler.h
index acfada51b..785d1179f 100644
--- a/kdesu/kdesud/handler.h
+++ b/kdesu/kdesud/handler.h
@@ -9,7 +9,7 @@
#include <sys/types.h>
-#include <qcstring.h>
+#include <tqcstring.h>
#include "secure.h"
/**
@@ -35,13 +35,13 @@ public:
private:
enum Results { Res_OK, Res_NO };
- int doCommand(QCString buf);
- void respond(int ok, QCString s=0);
- QCString makeKey(int namspace, QCString s1, QCString s2=0, QCString s3=0);
+ int doCommand(TQCString buf);
+ void respond(int ok, TQCString s=0);
+ TQCString makeKey(int namspace, TQCString s1, TQCString s2=0, TQCString s3=0);
int m_Fd, m_Timeout;
int m_Priority, m_Scheduler;
- QCString m_Buf, m_Pass, m_Host;
+ TQCString m_Buf, m_Pass, m_Host;
public:
int m_exitCode;
bool m_hasExitCode;
diff --git a/kdesu/kdesud/kdesud.cpp b/kdesu/kdesud/kdesud.cpp
index d81b6a0c9..3e9462698 100644
--- a/kdesu/kdesud/kdesud.cpp
+++ b/kdesu/kdesud/kdesud.cpp
@@ -56,9 +56,9 @@
#include <sys/select.h> // Needed on some systems.
#endif
-#include <qptrvector.h>
-#include <qfile.h>
-#include <qregexp.h>
+#include <tqptrvector.h>
+#include <tqfile.h>
+#include <tqregexp.h>
#include <kinstance.h>
#include <kdebug.h>
@@ -87,7 +87,7 @@
Repository *repo;
const char *Version = "1.01";
-QCString sock;
+TQCString sock;
Display *x11Display;
int pipeOfDeath[2];
@@ -157,7 +157,7 @@ int create_socket()
ksocklen_t addrlen;
struct stat s;
- QCString display(getenv("DISPLAY"));
+ TQCString display(getenv("DISPLAY"));
if (display.isEmpty())
{
kdWarning(1205) << "$DISPLAY is not set\n";
@@ -165,9 +165,9 @@ int create_socket()
}
// strip the screen number from the display
- display.replace(QRegExp("\\.[0-9]+$"), "");
+ display.replace(TQRegExp("\\.[0-9]+$"), "");
- sock = QFile::encodeName(locateLocal("socket", QString("kdesud_%1").arg(display)));
+ sock = TQFile::encodeName(locateLocal("socket", TQString("kdesud_%1").arg(display)));
int stat_err=lstat(sock, &s);
if(!stat_err && S_ISLNK(s.st_mode)) {
kdWarning(1205) << "Someone is running a symlink attack on you\n";
@@ -294,7 +294,7 @@ int main(int argc, char *argv[])
maxfd = QMAX(maxfd, x11Fd);
repo = new Repository;
- QPtrVector<ConnectionHandler> handler;
+ TQPtrVector<ConnectionHandler> handler;
handler.setAutoDelete(true);
pipe(pipeOfDeath);
diff --git a/kdesu/kdesud/lexer.cpp b/kdesu/kdesud/lexer.cpp
index a05251a58..d9fbf4639 100644
--- a/kdesu/kdesud/lexer.cpp
+++ b/kdesu/kdesud/lexer.cpp
@@ -8,11 +8,11 @@
*/
#include <ctype.h>
-#include <qcstring.h>
+#include <tqcstring.h>
#include "lexer.h"
-Lexer::Lexer(const QCString &input)
+Lexer::Lexer(const TQCString &input)
{
m_Input = input;
in = 0;
@@ -25,7 +25,7 @@ Lexer::~Lexer()
m_Output.fill('x');
}
-QCString &Lexer::lval()
+TQCString &Lexer::lval()
{
return m_Output;
}
diff --git a/kdesu/kdesud/lexer.h b/kdesu/kdesud/lexer.h
index e678d746e..835cc375b 100644
--- a/kdesu/kdesud/lexer.h
+++ b/kdesu/kdesud/lexer.h
@@ -15,14 +15,14 @@ class QCString;
class Lexer {
public:
- Lexer(const QCString &input);
+ Lexer(const TQCString &input);
~Lexer();
/** Read next token. */
int lex();
/** Return the token's value. */
- QCString &lval();
+ TQCString &lval();
enum Tokens {
Tok_none, Tok_exec=256, Tok_pass, Tok_delCmd,
@@ -33,8 +33,8 @@ public:
};
private:
- QCString m_Input;
- QCString m_Output;
+ TQCString m_Input;
+ TQCString m_Output;
int in;
};
diff --git a/kdesu/kdesud/repo.cpp b/kdesu/kdesud/repo.cpp
index 783a9baca..cdbbcaed1 100644
--- a/kdesu/kdesud/repo.cpp
+++ b/kdesu/kdesud/repo.cpp
@@ -7,9 +7,9 @@
#include <time.h>
#include <assert.h>
-#include <qcstring.h>
-#include <qmap.h>
-#include <qvaluestack.h>
+#include <tqcstring.h>
+#include <tqmap.h>
+#include <tqvaluestack.h>
#include <kdebug.h>
#include "repo.h"
@@ -25,7 +25,7 @@ Repository::~Repository()
{}
-void Repository::add(const QCString &key, Data_entry &data)
+void Repository::add(const TQCString &key, Data_entry &data)
{
RepoIterator it = repo.find(key);
if (it != repo.end())
@@ -38,7 +38,7 @@ void Repository::add(const QCString &key, Data_entry &data)
repo.insert(key, data);
}
-int Repository::remove(const QCString &key)
+int Repository::remove(const TQCString &key)
{
if( key.isEmpty() )
return -1;
@@ -52,12 +52,12 @@ int Repository::remove(const QCString &key)
return 0;
}
-int Repository::removeSpecialKey(const QCString &key)
+int Repository::removeSpecialKey(const TQCString &key)
{
int found = -1;
if ( !key.isEmpty() )
{
- QValueStack<QCString> rm_keys;
+ TQValueStack<TQCString> rm_keys;
for (RepoCIterator it=repo.begin(); it!=repo.end(); ++it)
{
if ( key.find( it.data().group ) == 0 &&
@@ -76,12 +76,12 @@ int Repository::removeSpecialKey(const QCString &key)
return found;
}
-int Repository::removeGroup(const QCString &group)
+int Repository::removeGroup(const TQCString &group)
{
int found = -1;
if ( !group.isEmpty() )
{
- QValueStack<QCString> rm_keys;
+ TQValueStack<TQCString> rm_keys;
for (RepoCIterator it=repo.begin(); it!=repo.end(); ++it)
{
if (it.data().group == group)
@@ -99,7 +99,7 @@ int Repository::removeGroup(const QCString &group)
return found;
}
-int Repository::hasGroup(const QCString &group) const
+int Repository::hasGroup(const TQCString &group) const
{
if ( !group.isEmpty() )
{
@@ -113,14 +113,14 @@ int Repository::hasGroup(const QCString &group) const
return -1;
}
-QCString Repository::findKeys(const QCString &group, const char *sep ) const
+TQCString Repository::findKeys(const TQCString &group, const char *sep ) const
{
- QCString list="";
+ TQCString list="";
if( !group.isEmpty() )
{
kdDebug(1205) << "Looking for matching key with group key: " << group << endl;
int pos;
- QCString key;
+ TQCString key;
RepoCIterator it;
for (it=repo.begin(); it!=repo.end(); ++it)
{
@@ -149,7 +149,7 @@ QCString Repository::findKeys(const QCString &group, const char *sep ) const
return list;
}
-QCString Repository::find(const QCString &key) const
+TQCString Repository::find(const TQCString &key) const
{
if( key.isEmpty() )
return 0;
@@ -168,7 +168,7 @@ int Repository::expire()
return 0;
unsigned t;
- QValueStack<QCString> keys;
+ TQValueStack<TQCString> keys;
head_time = (unsigned) -1;
RepoIterator it;
for (it=repo.begin(); it!=repo.end(); ++it)
diff --git a/kdesu/kdesud/repo.h b/kdesu/kdesud/repo.h
index fde8cd250..24c156a34 100644
--- a/kdesu/kdesud/repo.h
+++ b/kdesu/kdesud/repo.h
@@ -8,8 +8,8 @@
#define __Repo_h_included__
-#include <qmap.h>
-#include <qcstring.h>
+#include <tqmap.h>
+#include <tqcstring.h>
/**
@@ -17,8 +17,8 @@
*/
struct Data_entry
{
- QCString value;
- QCString group;
+ TQCString value;
+ TQCString group;
unsigned int timeout;
};
@@ -37,31 +37,31 @@ public:
int expire();
/** Add a data element */
- void add(const QCString& key, Data_entry& data);
+ void add(const TQCString& key, Data_entry& data);
/** Delete a data element. */
- int remove(const QCString& key);
+ int remove(const TQCString& key);
/** Delete all data entries having the given group. */
- int removeGroup(const QCString& group);
+ int removeGroup(const TQCString& group);
/** Delete all data entries based on key. */
- int removeSpecialKey(const QCString& key );
+ int removeSpecialKey(const TQCString& key );
/** Checks for the existence of the specified group. */
- int hasGroup(const QCString &group) const;
+ int hasGroup(const TQCString &group) const;
/** Return a data value. */
- QCString find(const QCString& key) const;
+ TQCString find(const TQCString& key) const;
/** Returns the key values for the given group. */
- QCString findKeys(const QCString& group, const char *sep= "-") const;
+ TQCString findKeys(const TQCString& group, const char *sep= "-") const;
private:
- QMap<QCString,Data_entry> repo;
- typedef QMap<QCString,Data_entry>::Iterator RepoIterator;
- typedef QMap<QCString,Data_entry>::ConstIterator RepoCIterator;
+ TQMap<TQCString,Data_entry> repo;
+ typedef TQMap<TQCString,Data_entry>::Iterator RepoIterator;
+ typedef TQMap<TQCString,Data_entry>::ConstIterator RepoCIterator;
unsigned head_time;
};