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
6b14d2ef
Commit
6b14d2ef
authored
21 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
Modified the code so it could accept quoted input. This is required for
multiple word node Reason values.
parent
c06d45ea
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/common/parse_spec.c
+14
-28
14 additions, 28 deletions
src/common/parse_spec.c
with
14 additions
and
28 deletions
src/common/parse_spec.c
+
14
−
28
View file @
6b14d2ef
...
@@ -46,7 +46,6 @@
...
@@ -46,7 +46,6 @@
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
char
*
_strcasestr
(
char
*
haystack
,
char
*
needle
);
static
char
*
_strcasestr
(
char
*
haystack
,
char
*
needle
);
/*
/*
...
@@ -278,45 +277,32 @@ load_string (char **destination, char *keyword, char *in_line)
...
@@ -278,45 +277,32 @@ load_string (char **destination, char *keyword, char *in_line)
str_ptr1
=
(
char
*
)
_strcasestr
(
in_line
,
keyword
);
str_ptr1
=
(
char
*
)
_strcasestr
(
in_line
,
keyword
);
if
(
str_ptr1
!=
NULL
)
{
if
(
str_ptr1
!=
NULL
)
{
int
quoted
=
0
;
str_len1
=
strlen
(
keyword
);
str_len1
=
strlen
(
keyword
);
strcpy
(
scratch
,
str_ptr1
+
str_len1
);
if
(
str_ptr1
[
str_len1
]
==
'"'
)
if
((
scratch
[
0
]
==
(
char
)
NULL
)
||
quoted
=
1
;
(
isspace
((
int
)
scratch
[
0
])))
{
strcpy
(
scratch
,
str_ptr1
+
str_len1
+
quoted
);
/* keyword with no value set */
if
(
quoted
)
str_ptr2
=
strtok_r
(
scratch
,
"
\042\n
"
,
&
str_ptr3
);
else
str_ptr2
=
strtok_r
(
scratch
,
SEPCHARS
,
&
str_ptr3
);
if
((
str_ptr2
==
NULL
)
||
((
str_len2
=
strlen
(
str_ptr2
))
==
0
)){
info
(
"load_string : keyword %s lacks value"
,
info
(
"load_string : keyword %s lacks value"
,
keyword
);
keyword
);
return
EINVAL
;
return
EINVAL
;
}
}
str_ptr2
=
(
char
*
)
strtok_r
(
scratch
,
SEPCHARS
,
&
str_ptr3
);
xfree
(
destination
[
0
]);
str_len2
=
strlen
(
str_ptr2
);
if
(
destination
[
0
]
!=
NULL
)
xfree
(
destination
[
0
]);
destination
[
0
]
=
(
char
*
)
xmalloc
(
str_len2
+
1
);
destination
[
0
]
=
(
char
*
)
xmalloc
(
str_len2
+
1
);
strcpy
(
destination
[
0
],
str_ptr2
);
strcpy
(
destination
[
0
],
str_ptr2
);
for
(
i
=
0
;
i
<
(
str_len1
+
str_len2
);
i
++
)
{
for
(
i
=
0
;
i
<
(
str_len1
+
str_len2
+
quoted
);
i
++
)
str_ptr1
[
i
]
=
' '
;
if
(
quoted
&&
(
str_ptr1
[
i
]
==
'"'
))
str_ptr1
[
i
]
=
' '
;
str_ptr1
[
i
]
=
' '
;
}
if
(
destination
[
0
][
0
]
==
'"'
)
_remove_quotes
(
destination
)
;
}
}
return
0
;
return
0
;
}
}
/* give a string starting and ending with '"', remove the quotes */
static
void
_remove_quotes
(
char
**
destination
)
{
int
i
;
for
(
i
=
0
;
;
i
++
)
{
destination
[
0
][
i
]
=
destination
[
0
][
i
+
1
];
if
(
destination
[
0
][
i
]
==
'"'
)
destination
[
0
][
i
]
=
'\0'
;
if
(
destination
[
0
][
i
]
==
'\0'
)
break
;
}
}
/* case insensitve version of strstr() */
/* case insensitve version of strstr() */
static
char
*
static
char
*
_strcasestr
(
char
*
haystack
,
char
*
needle
)
_strcasestr
(
char
*
haystack
,
char
*
needle
)
...
...
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