63 while((fP =
dP)) {
dP =
dP->Next;
delete fP;}
64 while((fP =
nP)) {
nP =
nP->Next;
delete fP;}
73int XrdFrmAdmin::Unlink(
const char *
Path)
76 XrdOucNSWalk::NSEnt *fP;
79 char Resp, lclPath[MAXPATHLEN+8];
85 {numProb++;
return -1;}
90 {Emsg(errno,
"remove ",lclPath); numProb++;
return -1;}
94 if ((
Stat.st_mode & S_IFMT) != S_IFDIR)
95 {
if (Opt.All) {Emsg(ENOTDIR,
"remove ",
Path); numProb++;
return -1;}
96 return UnlinkFile(lclPath);
101 if (!Opt.Recurse)
return UnlinkDir(
Path, lclPath);
107 if (Resp !=
'y')
return Resp !=
'a';
118 {
if ((rc = UnlinkDir(NSE.
nP, NSE.
dP)) < 0)
break;
128 {Emsg(-rc,
"remove directory ", fP->
Path); aOK = 0; numProb++;}
129 else {
if (Opt.Echo) Msg(
"Local directory ",fP->
Path,
" removed.");
140 {Emsg(-rc,
"remove directory ", lclPath); aOK = 0;}
142 if (Opt.Echo) Msg(
"Local directory ", lclPath,
" removed.");
155int XrdFrmAdmin::UnlinkDir(
const char *
Path,
const char *lclPath)
159 XrdOucNSWalk::NSEnt *fP;
171 if (rc) {numProb++;
return -1;}
178 if (
unlink(NSE.
nP->
Path)) {Emsg(-rc,
"remove ", lclPath);
return -1;}
180 {Emsg(-rc,
"remove directory ", lclPath); numProb++;
return -1;}
181 if (Opt.Echo) Msg(
"Local directory ",
Path,
" removed.");
191 else {Emsg(EISDIR,
"remove ", fP->
Path); numProb++;
return -1;}
198 if (Resp !=
'y')
return Resp !=
'a';
203 if ((rc = UnlinkDir(NSE.
nP, NSE.
dP)) < 0)
return -1;
212 XrdOucNSWalk::NSEnt *fP;
220 {fP->
Next = dP; dP = fP;}
221 else {
if (UnlinkFile(fP->
Path) < 0) retval = -1;
235int XrdFrmAdmin::UnlinkFile(
const char *lclPath)
243 {
if (!
unlink(lclPath) || errno == ENOENT)
return 1;
247 {
if (Opt.Echo) Msg(
"Local file ", lclPath,
" removed.");
256 Emsg(-rc,
"remove ", lclPath);
XrdOucPup XrdCmsParser::Pup & Say
static char Ask(char dflt, const char *Msg1, const char *Msg2="", const char *Msg3="")
static void Rmd(const char *Path, int islfn=0)
static void Rm(const char *Path, int islfn=0)
XrdNetCmsNotify * cmsPath
int LocalPath(const char *oldp, char *newp, int newpsz)
int Gone(const char *Path, int isPfn=1)
static theSfx pathType(const char *Path, int chkWhat=chkAll)
virtual int Remdir(const char *path, int Opts=0, XrdOucEnv *envP=0)=0
virtual int Unlink(const char *path, int Opts=0, XrdOucEnv *envP=0)=0
NSEnt * Index(int &rc, const char **dPath=0)