87int main(
int argc,
char *argv[])
93 const char *Stats =
"bldpsu", *pgm =
"xrdqstats: ";
94 const char *valOpts =
"df:i:n:s:z";
95 int WTime = 0, Count = 0;
98 bool Debug =
false, nozed =
false;
103 if (argc > 1 &&
'-' == *argv[1])
104 while ((c = getopt(argc,argv,valOpts)) && ((
unsigned char)c != 0xff))
107 case 'd':
Debug =
true;
112 else {std::cerr <<pgm <<
"Invalid format - " <<optarg <<std::endl;
118 case 'i':
if ((WTime = atoi(optarg)) <= 0)
119 {std::cerr <<pgm <<
"Invalid interval - " <<optarg <<std::endl;
123 case 'n':
if ((Count = atoi(optarg)) <= 0)
124 {std::cerr <<pgm <<
"Invalid count - " <<optarg <<std::endl;
128 case 's': sP = optarg;
130 {
if (!index(
"abcdipsuz", *sP))
131 {std::cerr <<pgm<<
"Invalid statistic letter - "<<*sP<<std::endl;
133 }
else if (*sP ==
'c') *sP =
'l';
138 case 'z': nozed =
true;
140 default: std::cerr <<pgm <<
'-' <<char(
optopt);
141 if (c ==
':') std::cerr <<
" value not specified." <<std::endl;
142 else std::cerr <<
" option is invalid" <<std::endl;
151 {std::cerr <<pgm <<
"Host has not been specified." <<std::endl;
Usage(1);}
155 std::string sURL(
"root://");
159 {std::cerr <<pgm <<
"Invalid host specification - " <<argv[
optind] <<std::endl;
170 if (!WTime && Count) WTime = 10;
171 else if (WTime && !Count) Count = -1;
172 else if (!WTime && !Count) Count = 1;
189 if (!xP) std::cout <<theStats->
GetBuffer() <<std::endl;
193 {
do {rc =
write(STDOUT_FILENO, bP, wLen);}
194 while(rc < 0 && errno == EINTR);
195 wLen -= rc; bP += rc;
199 if (WTime) sleep(WTime);
200 if (Count) std::cout <<
"\n";
int main(int argc, char *argv[])