Loading...
Searching...
No Matches
XrdFrmAdminMain.cc File Reference
`#include <unistd.h>`
`#include <cctype>`
`#include <cerrno>`
`#include <signal.h>`
`#include <cstdlib>`
`#include <cstring>`
`#include <strings.h>`
`#include <cstdio>`
`#include <sys/param.h>`
`#include "XrdFrc/XrdFrcTrace.hh"`
`#include "XrdFrm/XrdFrmAdmin.hh"`
`#include "XrdFrm/XrdFrmConfig.hh"`
`#include "XrdNet/XrdNetOpts.hh"`
`#include "XrdNet/XrdNetSocket.hh"`
`#include "XrdOuc/XrdOucTokenizer.hh"`
`#include "XrdSys/XrdSysError.hh"`
`#include "XrdSys/XrdSysHeaders.hh"`
`#include "XrdSys/XrdSysLogger.hh"`
Include dependency graph for XrdFrmAdminMain.cc:

Go to the source code of this file.

## Functions

void | add_history (const char *cLine)
int | main (int argc, char *argv[])
char * | readline (const char *prompt)
void | stifle_history (int hnum)

## Variables

XrdOucTrace XrdTrace & | Say
static const char * | XrdFrmOpts = "c:dhn:v"
static const char * | XrdFrmUsage
XrdSysError | XrdLog (0, "")
XrdOucTrace * | XrdXrootdTrace

## Function Documentation

## add_history()

void add_history | ( | const char * | cLine | ) |

Definition at line 117 of file XrdFrmAdminMain.cc.

{}

Referenced by main().

Here is the caller graph for this function:

## main()

int main | ( | int | argc,
|  | char * | argv[] )

Definition at line 125 of file XrdFrmAdminMain.cc.

{
XrdSysLogger Logger;
sigset_t myset;
XrdOucTokenizer Request(0);
char *cLine = 0, *pLine = 0, *Cmd = 0, *CmdArgs = 0;
int IMode;
// Turn off sigpipe and host a variety of others before we start any threads
//
signal(SIGPIPE, SIG_IGN); // Solaris optimization
sigemptyset(&myset);
sigaddset(&myset, SIGPIPE);
sigaddset(&myset, SIGCHLD);
pthread_sigmask(SIG_BLOCK, &myset, NULL);
// Perform configuration
//
Say.logger(&Logger);
XrdLog.logger(&Logger);
if (!Config.Configure(argc, argv, 0)) exit(4);
// Fill out the dummy symbol to avoid crashes
//
XrdXrootdTrace = new XrdOucTrace(&Say);
// We either have a command line or need to enter interactive mode
//
if (Config.nextArg >= argc) IMode = 1;
else {Cmd = argv[Config.nextArg++];
Admin.setArgs(argc-Config.nextArg, &argv[Config.nextArg]);
IMode = 0;
}
// Set readline history list (keep only 256 lines, max)
//
if (IMode) stifle_history(256);
// Process the request(s)
//
do {if (IMode)
{if (!(cLine = readline("frm_admin> "))) Admin.Quit();
if (!pLine || strcmp(pLine, cLine))
{add_history(cLine);
if (pLine) free(pLine);
pLine = strdup(cLine);
}
Request.Attach(cLine);
if (!Request.GetLine() || !(Cmd=Request.GetToken(&CmdArgs)))
Admin.Quit();
Admin.setArgs(CmdArgs);
}
Admin.xeqArgs(Cmd);
if (cLine) free(cLine);
} while(IMode);
// All done
//
Admin.Quit();
}
Say
XrdOucPup XrdCmsParser::Pup & Say
Definition XrdCmsParser.cc:124
Logger
static XrdSysLogger Logger
Definition XrdCryptoAux.cc:37
XrdXrootdTrace
XrdOucTrace * XrdXrootdTrace
Definition XrdFrmAdminMain.cc:96
XrdLog
XrdSysError XrdLog(0, "")
stifle_history
void stifle_history(int hnum)
Definition XrdFrmAdminMain.cc:118
readline
char * readline(const char *prompt)
Definition XrdFrmAdminMain.cc:108
add_history
void add_history(const char *cLine)
Definition XrdFrmAdminMain.cc:117
XrdOucTokenizer
Definition XrdOucTokenizer.hh:33
XrdOucTrace
Definition XrdOucTrace.hh:36
XrdSysLogger
Definition XrdSysLogger.hh:53
XrdFrm::Config
XrdFrmConfig Config
XrdFrm::Admin
XrdFrmAdmin Admin
Definition XrdFrmAdminMain.cc:92

References add_history(), XrdFrm::Admin, XrdOucTokenizer::Attach(), XrdFrm::Config, XrdOucTokenizer::GetLine(), XrdOucTokenizer::GetToken(), Logger, readline(), Say, stifle_history(), XrdLog, and XrdXrootdTrace.

Here is the call graph for this function:

## readline()

char * readline | ( | const char * | prompt | ) |

Definition at line 108 of file XrdFrmAdminMain.cc.

{
char buff[4096];
std::cout << prompt;
if (!fgets(buff, 4096, stdin) || *buff == '\n' || !strlen(buff)) return 0;
return strdup(buff);
}

Referenced by main().

Here is the caller graph for this function:

## stifle_history()

void stifle_history | ( | int | hnum | ) |

Definition at line 118 of file XrdFrmAdminMain.cc.

{}

Referenced by main().

Here is the caller graph for this function:

## Variable Documentation

## Say

XrdOucTrace XrdTrace& Say

Definition at line 98 of file XrdFrmAdminMain.cc.

## XrdFrmOpts

const char* XrdFrmOpts = "c:dhn:v"

static

Definition at line 33 of file XrdFrmAdminMain.cc.

## XrdFrmUsage

const char* XrdFrmUsage

static

Initial value:
=
" [-c <cfgfile>] [-d] [-h] [-n name] [-v] [help | cmd & opts]\n"

Definition at line 34 of file XrdFrmAdminMain.cc.

## XrdLog

XrdSysError XrdLog(0, "") | ( | 0 | ,
|  | "" | )

Referenced by main().

## XrdXrootdTrace

XrdOucTrace* XrdXrootdTrace

Definition at line 96 of file XrdFrmAdminMain.cc.

Referenced by XrdXrootdProtocol::Configure(), XrdXrootdTransit::Init(), and main().