From 23f25b04b95f08f5fc3aeaf9ea745326246dec9f Mon Sep 17 00:00:00 2001 From: Fritz Elfert Date: Mon, 18 Mar 2002 05:01:40 +0000 Subject: - 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 --- lib/psiprocess.cc | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 lib/psiprocess.cc (limited to 'lib/psiprocess.cc') 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 + * + * 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 +#include +#include + +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: + */ -- cgit v1.2.3