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
a9521050
...
a9521050ce3b8dcbf7421ac09fe553326357fa5a
authored
2006-09-27 16:12:46 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(mu_string_unfold): Convert \n followed by any amount of whitespace to single space.
1 parent
13ad8cc3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
3 deletions
mailbox/mutil.c
mailbox/mutil.c
View file @
a952105
...
...
@@ -1172,13 +1172,44 @@ int
mu_string_unfold
(
char
*
text
,
size_t
*
plen
)
{
char
*
p
,
*
q
;
enum
uf_state
{
uf_init
,
uf_nl
,
uf_fold
}
state
=
uf_init
;
#define ISSPACE(c) (c == '\r' || c == ' ' || c == '\t')
if
(
!
text
)
return
EINVAL
;
for
(
p
=
q
=
text
;
*
q
;
q
++
)
if
(
*
q
!=
'\n'
)
*
p
++
=
*
q
;
{
switch
(
state
)
{
case
uf_init
:
if
(
*
q
==
'\n'
)
state
=
uf_nl
;
else
*
p
++
=
*
q
;
break
;
case
uf_nl
:
if
(
ISSPACE
(
*
q
))
state
=
uf_fold
;
else
{
state
=
uf_init
;
*
p
++
=
*
q
;
}
break
;
case
uf_fold
:
if
(
!
ISSPACE
(
*
q
))
{
*
p
++
=
' '
;
*
p
++
=
*
q
;
state
=
uf_init
;
}
break
;
}
}
*
p
++
=
0
;
if
(
plen
)
*
plen
=
p
-
text
;
...
...
Please
register
or
sign in
to post a comment