aboutsummaryrefslogtreecommitdiffstats
path: root/lib/psiprocess.cc
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>2002-03-18 05:01:40 +0000
committerFritz Elfert <felfert@to.com>2002-03-18 05:01:40 +0000
commit23f25b04b95f08f5fc3aeaf9ea745326246dec9f (patch)
treedbd68bb6a5e228efa95dbfb18fa69c563925163c /lib/psiprocess.cc
parent38fc74f68c90aff4909660b89a9c233eac16f626 (diff)
downloadplptools-23f25b04b95f08f5fc3aeaf9ea745326246dec9f.tar.gz
plptools-23f25b04b95f08f5fc3aeaf9ea745326246dec9f.tar.bz2
plptools-23f25b04b95f08f5fc3aeaf9ea745326246dec9f.zip
- made kpsion SIBO-aware
- Added SIBO-related stuff in PsiTime - Added new class PsiProcess, renamed rpcs:queryDrive to queryPrograms and changed it accordingly - Adapted kspion, plpbackup, plpnfsd and plpftp to use queryPrograms - Several cleanups in rfsv16
Diffstat (limited to 'lib/psiprocess.cc')
-rw-r--r--lib/psiprocess.cc102
1 files changed, 102 insertions, 0 deletions
diff --git a/lib/psiprocess.cc b/lib/psiprocess.cc
new file mode 100644
index 0000000..ce27450
--- /dev/null
+++ b/lib/psiprocess.cc
@@ -0,0 +1,102 @@
+/*-*-c++-*-
+ * $Id$
+ *
+ * This file is part of plptools.
+ *
+ * Copyright (C) 1999-2002 Fritz Elfert <felfert@to.com>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+#include "psiprocess.h"
+#include <stream.h>
+#include <strstream>
+#include <iomanip>
+
+PsiProcess::PsiProcess()
+ : pid(0), name(""), args(""), s5mx(false) {
+}
+
+PsiProcess::PsiProcess(const PsiProcess &p) {
+ pid = p.pid;
+ name = p.name;
+ args = p.args;
+ s5mx = p.s5mx;
+}
+
+PsiProcess::PsiProcess(int _pid, const char * const _name,
+ const char * const _args, bool _s5mx) {
+ pid = _pid;
+ name = _name;
+ args = _args;
+ s5mx = _s5mx;
+}
+
+int PsiProcess::
+getPID() {
+ return pid;
+}
+
+const char *PsiProcess::
+getName() {
+ return name.c_str();
+}
+
+const char *PsiProcess::
+getArgs() {
+ return args.c_str();
+}
+
+const char *PsiProcess::
+getProcId() {
+ ostrstream tmp;
+
+ if (s5mx)
+ tmp << name << ".$" << setw(2) << setfill('0') << pid << '\0';
+ else
+ tmp << name << ".$" << pid << '\0';
+ return tmp.str();
+}
+
+void PsiProcess::
+setArgs(string _args) {
+ args = _args;
+}
+
+PsiProcess &PsiProcess::
+operator=(const PsiProcess &p) {
+ pid = p.pid;
+ name = p.name;
+ args = p.args;
+ s5mx = p.s5mx;
+ return *this;
+}
+
+ostream &
+operator<<(ostream &o, const PsiProcess &p) {
+ ostream::fmtflags old = o.flags();
+
+ o << dec << setw(5) << setfill(' ') << p.pid << " " << setw(12)
+ << setfill(' ') << setiosflags(ios::left) << p.name.c_str()
+ << resetiosflags(ios::left) << " " << p.args;
+ o.flags(old);
+ return o;
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * End:
+ */