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
1f741e79
Commit
1f741e79
authored
11 years ago
by
Steven Murray
Committed by
Steven Murray
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
rmcd -f option now works
parent
6e0d1ab6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mediachanger/castorrmc/rmc/rmc_serv.c
+91
-14
91 additions, 14 deletions
mediachanger/castorrmc/rmc/rmc_serv.c
mediachanger/castorrmc/rmc/rmcd.man
+1
-4
1 addition, 4 deletions
mediachanger/castorrmc/rmc/rmcd.man
with
92 additions
and
18 deletions
mediachanger/castorrmc/rmc/rmc_serv.c
+
91
−
14
View file @
1f741e79
...
...
@@ -45,7 +45,7 @@ char localhost[CA_MAXHOSTNAMELEN+1];
int
maxfds
;
struct
extended_robot_info
extended_robot_info
;
int
rmc_main
(
struct
main_args
*
main_args
)
int
rmc_main
(
const
char
*
const
robot
)
{
int
c
;
unsigned
char
cdb
[
12
];
...
...
@@ -57,7 +57,6 @@ int rmc_main(struct main_args *main_args)
int
on
=
1
;
/* for REUSEADDR */
char
plist
[
40
];
fd_set
readfd
,
readmask
;
char
*
robot
;
int
s
;
int
n
=
0
;
char
sense
[
MAXSENSE
];
...
...
@@ -82,11 +81,6 @@ int rmc_main(struct main_args *main_args)
strcat
(
localhost
,
domainname
);
}
if
(
main_args
->
argc
!=
2
)
{
rmc_logit
(
func
,
RMC01
);
exit
(
USERR
);
}
robot
=
main_args
->
argv
[
1
];
if
(
*
robot
==
'\0'
||
(
strlen
(
robot
)
+
(
*
robot
==
'/'
)
?
0
:
5
)
>
CA_MAXRBTNAMELEN
)
{
rmc_logit
(
func
,
RMC06
,
"robot"
);
...
...
@@ -191,16 +185,99 @@ int rmc_main(struct main_args *main_args)
}
}
int
main
(
int
argc
,
/**
* Returns 1 if the rmcd daemon should run in the background or 0 if the
* daemon should run in the foreground.
*/
static
int
run_rmcd_in_background
(
const
int
argc
,
char
**
argv
)
{
int
i
=
0
;
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
0
==
strcmp
(
argv
[
i
],
"-f"
))
{
return
0
;
}
}
return
1
;
}
/**
* Returns 1 if the specified command-line argument start with '-' else
* returns 0.
*/
static
int
cmdline_arg_is_an_option
(
const
char
*
arg
)
{
if
(
strlen
(
arg
)
<
1
)
{
return
0
;
}
else
{
if
(
'-'
==
arg
[
0
])
{
return
1
;
}
else
{
return
0
;
}
}
}
/**
* Returns the number of command-line arguments that start with '-'.
*/
static
int
get_nb_cmdline_options
(
const
int
argc
,
char
**
argv
)
{
int
i
=
0
;
int
nbOptions
=
0
;
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
cmdline_arg_is_an_option
(
argv
[
i
]))
{
nbOptions
++
;
}
}
return
nbOptions
;
}
int
main
(
const
int
argc
,
char
**
argv
)
{
struct
main_args
main_args
;
const
char
*
robot
=
""
;
const
int
nb_cmdline_options
=
get_nb_cmdline_options
(
argc
,
argv
);
main_args
.
argc
=
argc
;
main_args
.
argv
=
argv
;
if
((
maxfds
=
Cinitdaemon
(
"rmcd"
,
NULL
))
<
0
)
exit
(
SYERR
);
exit
(
rmc_main
(
&
main_args
));
switch
(
argc
)
{
case
1
:
fprintf
(
stderr
,
"RMC01 - robot parameter is mandatory
\n
"
);
exit
(
USERR
);
case
2
:
if
(
0
==
nb_cmdline_options
)
{
robot
=
argv
[
1
];
}
else
{
fprintf
(
stderr
,
"RMC01 - robot parameter is mandatory
\n
"
);
exit
(
USERR
);
}
break
;
case
3
:
if
(
0
==
nb_cmdline_options
)
{
fprintf
(
stderr
,
"Too many robot parameters
\n
"
);
exit
(
USERR
);
}
else
if
(
2
==
nb_cmdline_options
)
{
fprintf
(
stderr
,
"RMC01 - robot parameter is mandatory
\n
"
);
exit
(
USERR
);
/* At this point there is one argument starting with '-' */
}
else
if
(
0
==
strcmp
(
argv
[
1
],
"-f"
))
{
robot
=
argv
[
2
];
}
else
if
(
0
==
strcmp
(
argv
[
2
],
"-f"
))
{
robot
=
argv
[
1
];
}
else
{
fprintf
(
stderr
,
"Unknown option
\n
"
);
exit
(
USERR
);
}
break
;
default:
fprintf
(
stderr
,
"Too many command-line arguments
\n
"
);
exit
(
USERR
);
}
if
(
run_rmcd_in_background
(
argc
,
argv
))
{
if
((
maxfds
=
Cinitdaemon
(
"rmcd"
,
NULL
))
<
0
)
{
exit
(
SYERR
);
}
}
exit
(
rmc_main
(
robot
));
}
static
void
rmc_doit
(
const
int
rpfd
)
...
...
This diff is collapsed.
Click to expand it.
mediachanger/castorrmc/rmc/rmcd.man
+
1
−
4
View file @
1f741e79
...
...
@@ -13,11 +13,8 @@ The
command starts the Remote Media Changer daemon.
.SH OPTIONS
.TP
\fB\-f
, \-\-foreground
\fB\-f
Remain in the foreground.
.TP
\fB\-h, \-\-help
Prints the usage message
.SH CASTOR CONFIGURATION PARAMETERS READ BY THE SERVER
The remote media changer daemon reads and uses the following CASTOR
configuration parameters which are specified within the CASTOR
...
...
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