Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
0ca2c663
Commit
0ca2c663
authored
21 years ago
by
Mark Grondona
Browse files
Options
Downloads
Patches
Plain Diff
o prefer error() to fprintf(stderr, ...) -- fix many missing newlines as
a side effect.
parent
2a03da97
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/squeue/opts.c
+17
-21
17 additions, 21 deletions
src/squeue/opts.c
with
17 additions
and
21 deletions
src/squeue/opts.c
+
17
−
21
View file @
0ca2c663
...
@@ -89,7 +89,8 @@ parse_command_line( int argc, char* argv[] )
...
@@ -89,7 +89,8 @@ parse_command_line( int argc, char* argv[] )
long_options
,
&
option_index
))
!=
-
1
)
{
long_options
,
&
option_index
))
!=
-
1
)
{
switch
(
opt_char
)
{
switch
(
opt_char
)
{
case
(
int
)
'?'
:
case
(
int
)
'?'
:
fprintf
(
stderr
,
"Try
\"
squeue --help
\"
for more information
\n
"
);
fprintf
(
stderr
,
"Try
\"
squeue --help
\"
"
"for more information
\n
"
);
exit
(
1
);
exit
(
1
);
case
(
int
)
'h'
:
case
(
int
)
'h'
:
params
.
no_header
=
true
;
params
.
no_header
=
true
;
...
@@ -97,9 +98,7 @@ parse_command_line( int argc, char* argv[] )
...
@@ -97,9 +98,7 @@ parse_command_line( int argc, char* argv[] )
case
(
int
)
'i'
:
case
(
int
)
'i'
:
params
.
iterate
=
atoi
(
optarg
);
params
.
iterate
=
atoi
(
optarg
);
if
(
params
.
iterate
<=
0
)
{
if
(
params
.
iterate
<=
0
)
{
fprintf
(
stderr
,
error
(
"--iterate=%s
\n
"
,
optarg
);
"Error: --iterate=%s"
,
optarg
);
exit
(
1
);
exit
(
1
);
}
}
break
;
break
;
...
@@ -167,13 +166,14 @@ parse_command_line( int argc, char* argv[] )
...
@@ -167,13 +166,14 @@ parse_command_line( int argc, char* argv[] )
params
.
step_list
=
_build_step_list
(
params
.
steps
);
params
.
step_list
=
_build_step_list
(
params
.
steps
);
}
}
if
(
optind
<
argc
)
{
if
(
optind
<
argc
)
{
fprintf
(
stderr
,
"Unrecognized option: %s"
,
argv
[
optind
]);
error
(
"Unrecognized option: %s"
,
argv
[
optind
]);
_usage
();
exit
(
1
);
exit
(
1
);
}
}
}
}
if
(
params
.
job_flag
&&
params
.
step_flag
)
{
if
(
params
.
job_flag
&&
params
.
step_flag
)
{
fprintf
(
stderr
,
"Incompatable options --jobs and --steps
\n
"
);
error
(
"Incompatable options --jobs and --steps
\n
"
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -256,7 +256,7 @@ _parse_state( char* str, enum job_states* states )
...
@@ -256,7 +256,7 @@ _parse_state( char* str, enum job_states* states )
return
SLURM_SUCCESS
;
return
SLURM_SUCCESS
;
}
}
fprintf
(
stderr
,
"Invalid job state specified: %s
\n
"
,
str
);
error
(
"Invalid job state specified: %s"
,
str
);
state_names
=
xstrdup
(
job_state_string
(
0
));
state_names
=
xstrdup
(
job_state_string
(
0
));
for
(
i
=
1
;
i
<
JOB_END
;
i
++
)
{
for
(
i
=
1
;
i
<
JOB_END
;
i
++
)
{
xstrcat
(
state_names
,
","
);
xstrcat
(
state_names
,
","
);
...
@@ -264,7 +264,7 @@ _parse_state( char* str, enum job_states* states )
...
@@ -264,7 +264,7 @@ _parse_state( char* str, enum job_states* states )
}
}
xstrcat
(
state_names
,
","
);
xstrcat
(
state_names
,
","
);
xstrcat
(
state_names
,
job_state_string
(
JOB_COMPLETING
));
xstrcat
(
state_names
,
job_state_string
(
JOB_COMPLETING
));
fprintf
(
stderr
,
"Valid job states include: %s
\n
"
,
state_names
);
error
(
"Valid job states include: %s
\n
"
,
state_names
);
xfree
(
state_names
);
xfree
(
state_names
);
return
SLURM_ERROR
;
return
SLURM_ERROR
;
}
}
...
@@ -284,7 +284,7 @@ extern int parse_format( char* format )
...
@@ -284,7 +284,7 @@ extern int parse_format( char* format )
char
field
[
1
];
char
field
[
1
];
if
(
format
==
NULL
)
{
if
(
format
==
NULL
)
{
fprintf
(
stderr
,
"Format option lacks specification
\n
"
);
error
(
"Format option lacks specification
."
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -343,10 +343,8 @@ extern int parse_format( char* format )
...
@@ -343,10 +343,8 @@ extern int parse_format( char* format )
right_justify
,
right_justify
,
suffix
);
suffix
);
else
else
fprintf
(
error
(
"Invalid job step format specification: %c"
,
stderr
,
field
[
0
]
);
"Invalid job step format specification: %c
\n
"
,
field
[
0
]
);
}
else
{
}
else
{
if
(
field
[
0
]
==
'b'
)
if
(
field
[
0
]
==
'b'
)
job_format_add_time_start
(
params
.
format_list
,
job_format_add_time_start
(
params
.
format_list
,
...
@@ -469,10 +467,8 @@ extern int parse_format( char* format )
...
@@ -469,10 +467,8 @@ extern int parse_format( char* format )
right_justify
,
right_justify
,
suffix
);
suffix
);
else
else
fprintf
(
error
(
"Invalid job format specification: %c"
,
stderr
,
field
[
0
]
);
"Invalid job format specification: %c
\n
"
,
field
[
0
]
);
}
}
token
=
strtok_r
(
NULL
,
"%"
,
&
tmp_char
);
token
=
strtok_r
(
NULL
,
"%"
,
&
tmp_char
);
}
}
...
@@ -635,7 +631,7 @@ _build_job_list( char* str )
...
@@ -635,7 +631,7 @@ _build_job_list( char* str )
{
{
i
=
strtol
(
job
,
(
char
**
)
NULL
,
10
);
i
=
strtol
(
job
,
(
char
**
)
NULL
,
10
);
if
(
i
<=
0
)
{
if
(
i
<=
0
)
{
fprintf
(
stderr
,
"Invalid job id: %s
\n
"
,
job
);
error
(
"Invalid job id: %s"
,
job
);
exit
(
1
);
exit
(
1
);
}
}
job_id
=
xmalloc
(
sizeof
(
uint32_t
)
);
job_id
=
xmalloc
(
sizeof
(
uint32_t
)
);
...
@@ -753,13 +749,13 @@ _build_step_list( char* str )
...
@@ -753,13 +749,13 @@ _build_step_list( char* str )
step_name
=
strtok_r
(
NULL
,
"."
,
&
tmps_char
);
step_name
=
strtok_r
(
NULL
,
"."
,
&
tmps_char
);
i
=
strtol
(
job_name
,
(
char
**
)
NULL
,
10
);
i
=
strtol
(
job_name
,
(
char
**
)
NULL
,
10
);
if
(
step_name
==
NULL
)
{
if
(
step_name
==
NULL
)
{
fprintf
(
stderr
,
"Invalid job_step id: %s.??
\n
"
,
error
(
"Invalid job_step id: %s.??"
,
job_name
);
job_name
);
exit
(
1
);
exit
(
1
);
}
}
j
=
strtol
(
step_name
,
(
char
**
)
NULL
,
10
);
j
=
strtol
(
step_name
,
(
char
**
)
NULL
,
10
);
if
((
i
<=
0
)
||
(
j
<
0
))
{
if
((
i
<=
0
)
||
(
j
<
0
))
{
fprintf
(
stderr
,
"Invalid job_step id: %s.%s
\n
"
,
error
(
"Invalid job_step id: %s.%s"
,
job_name
,
step_name
);
job_name
,
step_name
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -794,7 +790,7 @@ _build_user_list( char* str )
...
@@ -794,7 +790,7 @@ _build_user_list( char* str )
{
{
passwd_ptr
=
getpwnam
(
user
);
passwd_ptr
=
getpwnam
(
user
);
if
(
passwd_ptr
==
NULL
)
if
(
passwd_ptr
==
NULL
)
fprintf
(
stderr
,
"Invalid user: %s
\n
"
,
user
);
error
(
"Invalid user: %s
\n
"
,
user
);
else
{
else
{
uid
=
xmalloc
(
sizeof
(
uint32_t
));
uid
=
xmalloc
(
sizeof
(
uint32_t
));
*
uid
=
passwd_ptr
->
pw_uid
;
*
uid
=
passwd_ptr
->
pw_uid
;
...
...
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