#include <algorithm>
#include <cerrno>
#include <getopt.h>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <strings.h>
#include <unistd.h>
#include <sys/param.h>
#include <sys/types.h>
#include <vector>
#include "XProtocol/XProtocol.hh"
#include "XrdCl/XrdClEnv.hh"
#include "XrdCl/XrdClFileSystem.hh"
#include "XrdCl/XrdClDefaultEnv.hh"
#include "XrdNet/XrdNetAddr.hh"
#include "XrdOuc/XrdOucHash.hh"
#include "XrdSys/XrdSysHeaders.hh"
Go to the source code of this file.
|
| #define | EMSG(x) std::cerr <<"xrdmapc: " <<x <<std::endl |
| |
| #define | OPT_TYPE |
| |
|
| int | main (int argc, char *argv[]) |
| |
◆ EMSG
| #define EMSG |
( |
|
x | ) |
std::cerr <<"xrdmapc: " <<x <<std::endl |
◆ OPT_TYPE
◆ main()
| int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 569 of file XrdMapCluster.cc.
571 const char *opLetters =
":f:hl:rv";
572 struct option opVec[] =
574 {
OPT_TYPE "format", 1, 0, (int)
'f'},
578 {
OPT_TYPE "refresh", 0, 0, (int)
'r'},
579 {
OPT_TYPE "verify", 0, 0, (int)
'v'},
582 extern int optind, opterr;
585 clMap *baseNode, *clNow;
589 bool doRefresh =
false;
595 while((opC = getopt_long(argc, argv, opLetters, opVec, &i)) != (
char)-1)
599 {
case 'f':
if (!strcmp(
"json",optarg))
600 {doJson =
true; doHush =
true;}
601 else if (!strcmp(
"text",optarg))
603 else Usage(
"Invalid format argument.");
607 case 'l':
if (!strcmp(
"all",optarg))
608 {listMan =
true; listSrv =
true;}
609 else if (!strcmp(
"m", optarg))
610 {listMan =
true; listSrv =
false;}
611 else if (!strcmp(
"s", optarg))
612 {listMan =
false; listSrv =
true;}
613 else Usage(
"Invalid list argument.");
615 case 'q': doHush =
true;
617 case 'r': doRefresh =
true;
619 case 'v': doVerify =
true;
621 case ':':
EMSG(
"'" <<OpName(argv) <<
"' argument missing.");
623 case '?':
EMSG(
"Invalid option, '" <<OpName(argv) <<
"'.");
625 default:
EMSG(
"Internal error processing '" <<OpName(argv) <<
"'.");
631 if (
optind >= argc)
Usage(
"Initial node not specified.");
636 {
EMSG(
"Unable to validate initial node; " <<
eMsg);
649 baseNode =
new clMap(argv[
optind]);
654 else doVerify =
false;
662 MapCluster(baseNode, baseNode);
667 {MapPath(baseNode,
Path, doRefresh);
668 eMsg = (doVerify ?
"0*rv* " :
"0*r** ");
669 }
else eMsg =
"0**** ";
674 {PrintJson(baseNode);
678 {std::cout <<
eMsg <<baseNode->name <<baseNode->state <<std::endl;
679 PrintMap(baseNode, 1);
685 {std::cerr <<
"Warning! " <<baseNode->name
686 <<
" referred to the following unconnected node:" <<std::endl;
689 {std::cerr <<
"????? " <<clNow->name <<std::endl;
690 clNow = clNow->nextSrv;
void Usage(const char *msg)
const char * Name(const char *eName=0, const char **eText=0)
const char * Set(const char *hSpec, int pNum=PortInSpec)
References EMSG, eMsg, XrdNetAddrInfo::Name(), OPT_TYPE, optind, Path, XrdNetAddr::Set(), and Usage().
◆ optind
◆ optopt