Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
2a72f595
Commit
2a72f595
authored
16 years ago
by
Dennis Waldron
Browse files
Options
Downloads
Patches
Plain Diff
Fixed compilation warning and provided as flag to ignore error messages related to forced CNS hosts
parent
91e11b76
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ns/nsgetpath.c
+35
-18
35 additions, 18 deletions
ns/nsgetpath.c
with
35 additions
and
18 deletions
ns/nsgetpath.c
+
35
−
18
View file @
2a72f595
...
...
@@ -14,13 +14,17 @@
#include
"Cns_api.h"
#include
"Cgetopt.h"
#include
"serrno.h"
#include
"getconfent.h"
void
usage
(
int
status
,
char
*
name
)
{
if
(
status
!=
0
)
{
fprintf
(
stderr
,
"Try `%s --help` for more information.
\n
"
,
name
);
}
else
{
printf
(
"Usage: %s <CNSHOST> [FILEID|-x HEXID]
\n
"
,
name
);
printf
(
"Usage: %s
[OPTION]
<CNSHOST> [FILEID|-x HEXID]
\n
"
,
name
);
printf
(
"Resolve a fileid to a filepath.
\n\n
"
);
printf
(
" -x, --hex=HEXID the fileid represented in hexidecimal
\n
"
);
printf
(
" -i, --ignore ignore error messages related to forced CNS hosts
\n
"
);
printf
(
" --help display this help and exit
\n\n
"
);
printf
(
"Report bugs to <castor.support@cern.ch>.
\n
"
);
}
exit
(
status
);
...
...
@@ -31,26 +35,25 @@ int main(int argc, char**argv) {
int
c
;
int
errflg
=
0
;
int
hflg
=
0
;
int
iflg
=
0
;
int
i
=
0
;
int
j
=
0
;
u_signed64
fileid
=
0
;
char
*
server
=
NULL
;
char
filepath
[
CA_MAXPATHLEN
+
1
];
char
tmpbuf
[
21
];
char
*
p
=
NULL
;
Coptind
=
1
;
if
(
argc
>=
3
)
{
server
=
argv
[
1
];
fileid
=
strtou64
(
argv
[
2
]);
Coptind
=
2
;
}
Coptions_t
longopts
[]
=
{
{
"help"
,
NO_ARGUMENT
,
&
hflg
,
1
},
{
NULL
,
0
,
NULL
,
0
}
{
"help"
,
NO_ARGUMENT
,
&
hflg
,
1
},
{
"hex"
,
REQUIRED_ARGUMENT
,
NULL
,
'x'
},
{
"ignore"
,
NO_ARGUMENT
,
NULL
,
'i'
},
{
NULL
,
0
,
NULL
,
0
}
};
Copterr
=
1
;
while
((
c
=
Cgetopt_long
(
argc
,
argv
,
"x:"
,
longopts
,
NULL
))
!=
EOF
)
{
Coptind
=
1
;
while
((
c
=
Cgetopt_long
(
argc
,
argv
,
"x:i"
,
longopts
,
NULL
))
!=
EOF
)
{
switch
(
c
)
{
case
'x'
:
fileid
=
strtoull
(
Coptarg
,
NULL
,
16
);
...
...
@@ -60,6 +63,9 @@ int main(int argc, char**argv) {
exit
(
USERR
);
}
break
;
case
'i'
:
iflg
++
;
break
;
case
'?'
:
errflg
++
;
break
;
...
...
@@ -67,18 +73,29 @@ int main(int argc, char**argv) {
break
;
}
}
for
(
i
=
Coptind
,
j
=
0
;
i
<
argc
&&
j
<
2
;
i
++
,
j
++
)
{
if
(
j
==
0
)
{
server
=
argv
[
i
];
}
else
if
(
fileid
==
0
)
{
fileid
=
strtou64
(
argv
[
i
]);
}
}
if
(
hflg
)
{
usage
(
0
,
argv
[
0
]);
}
if
(
errflg
||
(
server
==
NULL
)
||
(
fileid
==
0
))
{
usage
(
USERR
,
argv
[
0
]);
}
if
((
p
=
getenv
(
CNS_HOST_ENV
))
||
(
p
=
getconfent
(
CNS_SCE
,
"HOST"
,
0
)))
{
if
(
strcmp
(
p
,
server
)
!=
0
)
{
fprintf
(
stderr
,
"CNSHOST option is not permitted when CNS/HOST is defined
\n
"
);
exit
(
USERR
);
if
(
!
iflg
)
{
if
((
p
=
getenv
(
CNS_HOST_ENV
))
||
(
p
=
getconfent
(
CNS_SCE
,
"HOST"
,
0
)))
{
if
(
strcmp
(
p
,
server
)
!=
0
)
{
fprintf
(
stderr
,
"cannot query '%s', all name server commands are forced to "
"query '%s'
\n
"
,
server
,
p
);
exit
(
USERR
);
}
}
}
if
(
Cns_getpath
(
server
,
fileid
,
filepath
)
!=
0
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment