Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
7090df05
...
7090df05d0073065f56d1970e20cc2470be6241d
authored
2005-06-29 19:50:05 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(argcv_scan): Improved scanning.
1 parent
e9cf710c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
30 deletions
mailbox/argcv.c
mailbox/argcv.c
View file @
7090df0
...
...
@@ -40,7 +40,6 @@ argcv_scan (int len, const char *command, const char *delim, const char* cmnt,
int
*
start
,
int
*
end
,
int
*
save
)
{
int
i
=
0
;
int
expect_delim
;
for
(;;)
{
...
...
@@ -54,46 +53,35 @@ argcv_scan (int len, const char *command, const char *delim, const char* cmnt,
i
++
;
*
start
=
i
;
switch
(
command
[
i
]
)
if
(
!
isdelim
(
command
[
i
],
delim
)
)
{
case
'"'
:
case
'\''
:
while
(
++
i
<
len
&&
(
command
[
i
]
!=
command
[
*
start
]
||
command
[
i
-
1
]
==
'\\'
))
;
if
(
i
<
len
)
/* found matching quote */
break
;
/*FALLTHRU*/
default:
if
(
isdelim
(
command
[
i
],
delim
))
break
;
/* Skip until next whitespace character or end of line. Honor
escaped whitespace. */
expect_delim
=
0
;
while
(
++
i
<
len
)
while
(
i
<
len
)
{
if
(
expect_delim
)
if
(
command
[
i
]
==
'\\'
)
{
if
(
command
[
i
-
1
]
!=
'\\'
&&
command
[
i
]
==
expect_delim
)
expect_delim
=
0
;
else
continue
;
if
(
++
i
==
len
)
break
;
i
++
;
continue
;
}
if
(
command
[
i
-
1
]
!=
'\\
'
)
if
(
command
[
i
]
==
'\''
||
command
[
i
]
==
'"
'
)
{
if
(
command
[
i
]
==
'\''
||
command
[
i
]
==
'"'
)
expect_delim
=
command
[
i
];
else
if
(
isws
(
command
[
i
])
||
isdelim
(
command
[
i
],
delim
))
break
;
int
j
;
for
(
j
=
i
+
1
;
j
<
len
&&
command
[
j
]
!=
command
[
i
];
j
++
)
if
(
command
[
j
]
==
'\\'
)
j
++
;
if
(
j
<
len
)
i
=
j
+
1
;
else
i
++
;
}
else
if
(
isws
(
command
[
i
])
||
isdelim
(
command
[
i
],
delim
))
break
;
else
i
++
;
/* skip the escaped character */
}
if
(
expect_delim
)
i
--
;
i
--
;
break
;
}
*
end
=
i
;
...
...
Please
register
or
sign in
to post a comment