Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
544cda6a
Commit
544cda6a
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
rcfile: allow a syntax name to be unquoted
parent
28933cf5
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/rcfile.c
+9
-8
src/rcfile.c
with
9 additions
and
8 deletions
+9
-8
src/rcfile.c
View file @
544cda6a
...
...
@@ -258,8 +258,7 @@ bool nregcomp(const char *regex, int compile_flags)
* line at ptr, and add it to the global linked list of color syntaxes. */
void
parse_syntax
(
char
*
ptr
)
{
char
*
nameptr
;
/* A pointer to what should be the name of the syntax. */
char
*
nameptr
=
ptr
;
opensyntax
=
FALSE
;
...
...
@@ -270,17 +269,19 @@ void parse_syntax(char *ptr)
return
;
}
nameptr
=
++
ptr
;
ptr
=
parse_next_word
(
ptr
);
/* Check that the
name starts and ends with a double quote
. */
if
(
*
(
nameptr
-
1
)
!
=
'\x22'
||
nameptr
[
strlen
(
nameptr
)
-
1
]
!
=
'\x22'
)
{
rcfile_error
(
N_
(
"
A syntax name must be quoted
"
));
/* Check that the
re are no quotes or that they are paired
. */
if
((
*
nameptr
=
=
'\x22'
)
^
(
nameptr
[
strlen
(
nameptr
)
-
1
]
=
=
'\x22'
)
)
{
rcfile_error
(
N_
(
"
Unpaired quote in syntax name
"
));
return
;
}
/* Strip the end quote. */
nameptr
[
strlen
(
nameptr
)
-
1
]
=
'\0'
;
/* If the name is quoted, strip the quotes. */
if
(
*
nameptr
==
'\x22'
)
{
nameptr
++
;
nameptr
[
strlen
(
nameptr
)
-
1
]
=
'\0'
;
}
/* Redefining the "none" syntax is not allowed. */
if
(
strcmp
(
nameptr
,
"none"
)
==
0
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help