XRootD
Loading...
Searching...
No Matches
XrdPinls.cc
Go to the documentation of this file.
1/******************************************************************************/
2/* */
3/* X r d P i n l s . c c */
4/* */
5/* (c) 2009 by the Board of Trustees of the Leland Stanford, Jr., University */
6/* Produced by Andrew Hanushevsky for Stanford University under contract */
7/* DE-AC02-76-SFO0515 with the Department of Energy */
8/* */
9/* This file is part of the XRootD software suite. */
10/* */
11/* XRootD is free software: you can redistribute it and/or modify it under */
12/* the terms of the GNU Lesser General Public License as published by the */
13/* Free Software Foundation, either version 3 of the License, or (at your */
14/* option) any later version. */
15/* */
16/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
17/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
18/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
19/* License for more details. */
20/* */
21/* You should have received a copy of the GNU Lesser General Public License */
22/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
23/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
24/* */
25/* The copyright holder's institutional names and contributor's names may not */
26/* be used to endorse or promote products derived from this software without */
27/* specific prior written permission of the institution or contributor. */
28/******************************************************************************/
29
30/* This utility prints plugin version requirements. Syntax:
31
32 xrdpinls
33
34*/
35
36/******************************************************************************/
37/* i n c l u d e f i l e s */
38/******************************************************************************/
39
40#include <cctype>
41#include <iostream>
42#include <map>
43#include <cstdio>
44#include <cstring>
45
46#include "XrdVersionPlugin.hh"
47
48/******************************************************************************/
49/* L o c a l O b j e c t s */
50/******************************************************************************/
51
52namespace
53{
54struct cmp_str
55{
56 bool operator()(char const *a, char const *b) const
57 {
58 return strcmp(a, b) < 0;
59 }
60};
61}
62
63/******************************************************************************/
64/* D i s p l a y */
65/******************************************************************************/
66
67void Display(const char *drctv, XrdVersionPlugin *vP)
68{
69 const char *vType = "Unknown";
70 char buff[80];
71
72// First determine what kind of rule this is
73//
74 if (vP->vProcess == XrdVERSIONPLUGIN_DoNotChk) vType = "Untested";
75 else if (vP->vProcess == XrdVERSIONPLUGIN_Optional) vType = "Optional";
76 else if (vP->vProcess == XrdVERSIONPLUGIN_Required) vType = "Required";
77
78// Establish minimum version
79//
80 if (vP->vMinLow < 0) snprintf(buff, sizeof(buff), "%2d.x ", vP->vMajLow);
81 else snprintf(buff, sizeof(buff), "%2d.%-2d", vP->vMajLow, vP->vMinLow);
82
83// Output the line
84//
85 std::cout <<vType <<" >= "<<buff <<' ' <<drctv <<std::endl;
86}
87
88/******************************************************************************/
89/* m a i n */
90/******************************************************************************/
91
92int main(int argc, char *argv[])
93{
96 std::map<const char *, XrdVersionPlugin*, cmp_str> vRules;
97 std::map<const char *, XrdVersionPlugin*, cmp_str> dRules;
98 std::map<const char *, XrdVersionPlugin*, cmp_str>::iterator itD, itV;
99 int i;
100
101// Map all of plugin rules by plugin object creator
102//
103 i = 0;
104 while(vInfo[i].pName)
105 {vRules[vInfo[i].pName] = &vInfo[i];
106 i++;
107 }
108
109// Now for each directive, find the matching rule
110//
111 i = 0;
112 while(dInfo[i].dName)
113 {itV = vRules.find(dInfo[i].pName);
114 dRules[dInfo[i].dName] = (itV != dRules.end() ? itV->second : 0);
115 i++;
116 }
117
118// Now display the results
119//
120 for (itD = dRules.begin(); itD != dRules.end(); itD++)
121 {if (itD->second) Display(itD->first, itD->second);
122 else std::cout <<"No version rule present for " <<itD->first
123 <<std::endl;
124 }
125
126// All done
127//
128 return(0);
129}
void Display()
Definition XrdCks.cc:56
int main(int argc, char *argv[])
Definition XrdPinls.cc:92
#define XrdVERSIONPLUGIN_Optional
#define XrdVERSIONPLUGINRULES
int vProcess
version: <0 skip, =0 optional, >0 required
const char * dName
-> plugin directive name
#define XrdVERSIONPLUGIN_DoNotChk
const char * pName
-> plugin object creator function name
#define XrdVERSIONPLUGINMAPD2P
#define XrdVERSIONPLUGIN_Required
short vMajLow
Lowest compatible major version number.
short vMinLow
Lowest compatible minor (< 0 don't check).