XRootD
Loading...
Searching...
No Matches
XrdOucMsubs Class Reference

#include <XrdOucMsubs.hh>

+ Collaboration diagram for XrdOucMsubs:

Public Member Functions

 XrdOucMsubs (XrdSysError *errp)
 
 ~XrdOucMsubs ()
 
int Parse (const char *oname, char *msg)
 
int Subs (XrdOucMsubsInfo &Info, char **Data, int *Dlen)
 

Static Public Attributes

static const int maxElem = 32
 

Detailed Description

Definition at line 90 of file XrdOucMsubs.hh.

Constructor & Destructor Documentation

◆ XrdOucMsubs()

XrdOucMsubs::XrdOucMsubs ( XrdSysError * errp)

Definition at line 51 of file XrdOucMsubs.cc.

52{
53
54 if (vName[0] == 0)
55 {vName[0] = "$";
56 vName[vCGI] = "$CGI";
57 vName[vLFN] = "$LFN";
58 vName[vPFN] = "$PFN";
59 vName[vRFN] = "$RFN";
60 vName[vLFN2] = "$LFN2";
61 vName[vPFN2] = "$PFN2";
62 vName[vRFN2] = "$RFN2";
63 vName[vFM] = "$FMODE";
64 vName[vNFY] = "$NOTIFY";
65 vName[vOFL] = "$OFLAG";
66 vName[vOPT] = "$OPTS";
67 vName[vPTY] = "$PRTY";
68 vName[vUSR] = "$USER";
69 vName[vHST] = "$HOST";
70 vName[vRID] = "$RID";
71 vName[vTID] = "$TID";
72 vName[vMDP] = "$MDP";
73 vName[vSRC] = "$SRC";
74 vName[vDST] = "$DST";
75 vName[vCID] = "$CID";
76 vName[vINS] = "$INS";
77 }
78 mText = 0;
79 mData[0] = 0; mDlen[0] = 0;
80 numElem = 0;
81 eDest = errp;
82}

◆ ~XrdOucMsubs()

XrdOucMsubs::~XrdOucMsubs ( )

Definition at line 88 of file XrdOucMsubs.cc.

89{ int i;
90
91 if (mText) free(mText);
92
93 for (i = 0; i < numElem; i++) if (mDlen[i] < 0) free(mData[i]);
94}

Member Function Documentation

◆ Parse()

int XrdOucMsubs::Parse ( const char * oname,
char * msg )

Definition at line 100 of file XrdOucMsubs.cc.

101{
102 char ctmp, *vp, *ip, *lastp, *infop;
103 int i, j = 0;
104
105// Setup the additional stage information vector. Variable substitution:
106// <data>$var<data>.... (max of MaxArgs substitutions)
107//
108 lastp = infop = mText = strdup(msg);
109 while ((ip = index(infop, '$')) && j < maxElem)
110 if (isalnum(*(ip+1)) && (infop == ip || *(ip-1) != '\\'))
111 {if ((mDlen[j] = ip-lastp)) mData[j++] = lastp;
112 vp = ip; ip++;
113 while(isalnum(*ip) || *ip == '.') ip++;
114 ctmp = *ip; *ip = '\0';
115 mDlen[j] = -(ip-vp);
116 mData[j] = vp = strdup(vp); mData[j++]++;
117 *ip = ctmp; lastp = infop = ip;
118 if (isupper(*(vp+1)))
119 for (i = 1; i < vMax; i++)
120 if (!strcmp(vp, vName[i]))
121 {mDlen[j-1] = i; mData[j-1] = 0; free(vp); break;}
122 } else if (ip != infop && *(ip-1) == '\\')
123 {if ((mDlen[j] = (ip-lastp)-1) > 0) mData[j++] = lastp;
124 lastp = ip; infop = ip+1;
125 } else infop = ip+1;
126
127// Make sure we have not exceeded the array
128//
129 if (j < maxElem)
130 {if ((mDlen[j] = strlen(lastp))) mData[j++] = lastp;
131 numElem = j;
132 } else {
133 eDest->Emsg(dName, "Too many variables in", dName, "string.");
134 return 0;
135 }
136
137// All done
138//
139 return 1;
140}
static const int maxElem

References maxElem.

Referenced by XrdOssSys::ConfigStageC().

+ Here is the caller graph for this function:

◆ Subs()

int XrdOucMsubs::Subs ( XrdOucMsubsInfo & Info,
char ** Data,
int * Dlen )

Definition at line 146 of file XrdOucMsubs.cc.

147{
148 int k;
149
150// Perform substitutions
151//
152 for (k = 0; k < numElem; k++)
153 { if (!mData[k])
154 {Data[k] = getVal(Info, mDlen[k]);
155 Dlen[k] = strlen(Data[k]);
156 }
157 else if (mDlen[k] < 0)
158 {if ((Data[k] = Info.Env->Get(mData[k])))
159 Dlen[k] = strlen(Data[k]);
160 else {Data[k]=mData[k]-1; Dlen[k]=(-mDlen[k]);}
161 }
162 else {Data[k] = mData[k]; Dlen[k] = mDlen[k];}
163 }
164 return numElem;
165}

Member Data Documentation

◆ maxElem

const int XrdOucMsubs::maxElem = 32
static

Definition at line 94 of file XrdOucMsubs.hh.

Referenced by XrdCmsPrepare::Add(), Parse(), and XrdOssSys::Stage_QT().


The documentation for this class was generated from the following files: