#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 "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 475 of file XrdMapCluster.cc.
477 const char *opLetters =
":hl:rv";
478 struct option opVec[] =
483 {
OPT_TYPE "refresh", 0, 0, (int)
'r'},
484 {
OPT_TYPE "verify", 0, 0, (int)
'v'},
487 extern int optind, opterr;
490 clMap *baseNode, *clNow;
494 bool doRefresh =
false;
500 while((opC = getopt_long(argc, argv, opLetters, opVec, &i)) != (
char)-1)
504 case 'l':
if (!strcmp(
"all",optarg))
505 {listMan =
true; listSrv =
true;}
506 else if (!strcmp(
"m", optarg))
507 {listMan =
true; listSrv =
false;}
508 else if (!strcmp(
"s", optarg))
509 {listMan =
false; listSrv =
true;}
510 else Usage(
"Invalid list argument.");
512 case 'q': doHush =
true;
514 case 'r': doRefresh =
true;
516 case 'v': doVerify =
true;
518 case ':':
EMSG(
"'" <<OpName(argv) <<
"' argument missing.");
520 case '?':
EMSG(
"Invalid option, '" <<OpName(argv) <<
"'.");
522 default:
EMSG(
"Internal error processing '" <<OpName(argv) <<
"'.");
528 if (
optind >= argc)
Usage(
"Initial node not specified.");
533 {
EMSG(
"Unable to validate initial node; " <<
eMsg);
546 baseNode =
new clMap(argv[
optind]);
551 else doVerify =
false;
559 MapCluster(baseNode, baseNode);
564 {MapPath(baseNode,
Path, doRefresh);
565 eMsg = (doVerify ?
"0*rv* " :
"0*r** ");
566 }
else eMsg =
"0**** ";
570 std::cout <<
eMsg <<baseNode->name <<baseNode->state <<std::endl;
571 PrintMap(baseNode, 1);
576 {std::cerr <<
"Warning! " <<baseNode->name
577 <<
" referred to the following unconnected node:" <<std::endl;
580 {std::cerr <<
"????? " <<clNow->name <<std::endl;
581 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