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
ccf592bf
Commit
ccf592bf
authored
22 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
Support case insensitive parsing of the slurm configuration file.
parent
e2df5978
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/parse_spec.c
+33
-9
33 additions, 9 deletions
src/common/parse_spec.c
with
33 additions
and
9 deletions
src/common/parse_spec.c
+
33
−
9
View file @
ccf592bf
...
@@ -43,14 +43,15 @@
...
@@ -43,14 +43,15 @@
#define BUF_SIZE 1024
#define BUF_SIZE 1024
#define SEPCHARS " \n\t"
#define SEPCHARS " \n\t"
static
int
_load_long
(
long
*
destination
,
char
*
keyword
,
char
*
in_line
)
;
static
int
_load_long
(
long
*
destination
,
char
*
keyword
,
char
*
in_line
)
;
static
int
_load_integer
(
int
*
destination
,
char
*
keyword
,
char
*
in_line
)
;
static
int
_load_integer
(
int
*
destination
,
char
*
keyword
,
char
*
in_line
)
;
static
int
_load_float
(
float
*
destination
,
char
*
keyword
,
char
*
in_line
)
;
static
int
_load_float
(
float
*
destination
,
char
*
keyword
,
char
*
in_line
)
;
static
void
_remove_quotes
(
char
**
destination
)
;
static
void
_remove_quotes
(
char
**
destination
)
;
static
char
*
_strcasestr
(
char
*
haystack
,
char
*
needle
);
/*
/*
* slurm_parser - parse the supplied specification into keyword/value pairs
* slurm_parser - parse the supplied specification into keyword/value pairs
* only the keywords supplied will be searched for.
t
he supplied
* only the keywords supplied will be searched for.
T
he supplied
* specification is altered, overwriting the keyword and value pairs
* specification is altered, overwriting the keyword and value pairs
* with spaces.
* with spaces.
* spec - pointer to the string of specifications, sets of three values
* spec - pointer to the string of specifications, sets of three values
...
@@ -123,7 +124,7 @@ _load_float (float *destination, char *keyword, char *in_line)
...
@@ -123,7 +124,7 @@ _load_float (float *destination, char *keyword, char *in_line)
char
*
str_ptr1
,
*
str_ptr2
,
*
str_ptr3
;
char
*
str_ptr1
,
*
str_ptr2
,
*
str_ptr3
;
int
i
,
str_len1
,
str_len2
;
int
i
,
str_len1
,
str_len2
;
str_ptr1
=
(
char
*
)
strstr
(
in_line
,
keyword
);
str_ptr1
=
(
char
*
)
_
str
case
str
(
in_line
,
keyword
);
if
(
str_ptr1
!=
NULL
)
{
if
(
str_ptr1
!=
NULL
)
{
str_len1
=
strlen
(
keyword
);
str_len1
=
strlen
(
keyword
);
strcpy
(
scratch
,
str_ptr1
+
str_len1
);
strcpy
(
scratch
,
str_ptr1
+
str_len1
);
...
@@ -161,7 +162,7 @@ _load_integer (int *destination, char *keyword, char *in_line)
...
@@ -161,7 +162,7 @@ _load_integer (int *destination, char *keyword, char *in_line)
char
*
str_ptr1
,
*
str_ptr2
,
*
str_ptr3
;
char
*
str_ptr1
,
*
str_ptr2
,
*
str_ptr3
;
int
i
,
str_len1
,
str_len2
;
int
i
,
str_len1
,
str_len2
;
str_ptr1
=
(
char
*
)
strstr
(
in_line
,
keyword
);
str_ptr1
=
(
char
*
)
_
str
case
str
(
in_line
,
keyword
);
if
(
str_ptr1
!=
NULL
)
{
if
(
str_ptr1
!=
NULL
)
{
str_len1
=
strlen
(
keyword
);
str_len1
=
strlen
(
keyword
);
strcpy
(
scratch
,
str_ptr1
+
str_len1
);
strcpy
(
scratch
,
str_ptr1
+
str_len1
);
...
@@ -218,7 +219,7 @@ _load_long (long *destination, char *keyword, char *in_line)
...
@@ -218,7 +219,7 @@ _load_long (long *destination, char *keyword, char *in_line)
char
*
str_ptr1
,
*
str_ptr2
,
*
str_ptr3
;
char
*
str_ptr1
,
*
str_ptr2
,
*
str_ptr3
;
int
i
,
str_len1
,
str_len2
;
int
i
,
str_len1
,
str_len2
;
str_ptr1
=
(
char
*
)
strstr
(
in_line
,
keyword
);
str_ptr1
=
(
char
*
)
_
str
case
str
(
in_line
,
keyword
);
if
(
str_ptr1
!=
NULL
)
{
if
(
str_ptr1
!=
NULL
)
{
str_len1
=
strlen
(
keyword
);
str_len1
=
strlen
(
keyword
);
strcpy
(
scratch
,
str_ptr1
+
str_len1
);
strcpy
(
scratch
,
str_ptr1
+
str_len1
);
...
@@ -275,7 +276,7 @@ load_string (char **destination, char *keyword, char *in_line)
...
@@ -275,7 +276,7 @@ load_string (char **destination, char *keyword, char *in_line)
char
*
str_ptr1
,
*
str_ptr2
,
*
str_ptr3
;
char
*
str_ptr1
,
*
str_ptr2
,
*
str_ptr3
;
int
i
,
str_len1
,
str_len2
;
int
i
,
str_len1
,
str_len2
;
str_ptr1
=
(
char
*
)
strstr
(
in_line
,
keyword
);
str_ptr1
=
(
char
*
)
_
str
case
str
(
in_line
,
keyword
);
if
(
str_ptr1
!=
NULL
)
{
if
(
str_ptr1
!=
NULL
)
{
str_len1
=
strlen
(
keyword
);
str_len1
=
strlen
(
keyword
);
strcpy
(
scratch
,
str_ptr1
+
str_len1
);
strcpy
(
scratch
,
str_ptr1
+
str_len1
);
...
@@ -316,3 +317,26 @@ _remove_quotes (char **destination)
...
@@ -316,3 +317,26 @@ _remove_quotes (char **destination)
}
}
}
}
/* case insensitve version of strstr() */
static
char
*
_strcasestr
(
char
*
haystack
,
char
*
needle
)
{
int
hay_inx
,
hay_size
=
strlen
(
haystack
);
int
need_inx
,
need_size
=
strlen
(
needle
);
char
*
hay_ptr
=
haystack
;
for
(
hay_inx
=
0
;
hay_inx
<
hay_size
;
hay_inx
++
)
{
for
(
need_inx
=
0
;
need_inx
<
need_size
;
need_inx
++
)
{
if
(
tolower
((
int
)
hay_ptr
[
need_inx
])
!=
tolower
((
int
)
needle
[
need_inx
]))
break
;
/* mis-match */
}
if
(
need_inx
==
need_size
)
/* it matched */
return
hay_ptr
;
else
/* keep looking */
hay_ptr
++
;
}
return
NULL
;
/* no match anywhere in string */
}
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