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
3713f95f
...
3713f95ffd4ace42bb745bffdef5c07b2615f8d8
authored
2005-08-11 07:26:50 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(argcv_get_n): New function
1 parent
561a5ed8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
include/mailutils/argcv.h
mailbox/argcv.c
include/mailutils/argcv.h
View file @
3713f95
...
...
@@ -39,6 +39,10 @@ extern "C" {
extern
int
argcv_get
__P
((
const
char
*
command
,
const
char
*
delim
,
const
char
*
cmnt
,
int
*
argc
,
char
***
argv
));
extern
int
argcv_get_n
__P
((
const
char
*
command
,
int
len
,
const
char
*
delim
,
const
char
*
cmnt
,
int
*
argc
,
char
***
argv
));
extern
int
argcv_string
__P
((
int
argc
,
char
**
argv
,
char
**
string
));
extern
int
argcv_free
__P
((
int
argc
,
char
**
argv
));
extern
int
argcv_unquote_char
__P
((
int
c
));
...
...
mailbox/argcv.c
View file @
3713f95
/* argcv.c - simple functions for parsing input based on whitespace
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2003, 2004, 2005
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -91,7 +91,7 @@ argcv_scan (int len, const char *command, const char *delim, const char* cmnt,
to the newline and restart the token search. */
if
(
*
save
<=
len
)
{
if
(
cmnt
&&
strchr
(
cmnt
,
command
[
*
start
])
!=
NULL
)
if
(
strchr
(
cmnt
,
command
[
*
start
])
!=
NULL
)
{
i
=
*
save
;
while
(
i
<
len
&&
command
[
i
]
!=
'\n'
)
...
...
@@ -300,10 +300,9 @@ argcv_quote_copy (char *dst, const char *src)
}
int
argcv_get
(
const
char
*
command
,
const
char
*
delim
,
const
char
*
cmnt
,
argcv_get
_n
(
const
char
*
command
,
int
len
,
const
char
*
delim
,
const
char
*
cmnt
,
int
*
argc
,
char
***
argv
)
{
int
len
=
strlen
(
command
);
int
i
=
0
;
int
start
,
end
,
save
;
...
...
@@ -313,6 +312,11 @@ argcv_get (const char *command, const char *delim, const char *cmnt,
*
argc
=
0
;
save
=
0
;
if
(
!
delim
)
delim
=
""
;
if
(
!
cmnt
)
cmnt
=
""
;
while
(
argcv_scan
(
len
,
command
,
delim
,
cmnt
,
&
start
,
&
end
,
&
save
)
<=
len
)
(
*
argc
)
++
;
...
...
@@ -344,6 +348,14 @@ argcv_get (const char *command, const char *delim, const char *cmnt,
return
0
;
}
int
argcv_get
(
const
char
*
command
,
const
char
*
delim
,
const
char
*
cmnt
,
int
*
argc
,
char
***
argv
)
{
return
argcv_get_n
(
command
,
strlen
(
command
),
delim
,
cmnt
,
argc
,
argv
);
}
/*
* frees all elements of an argv array
* argc is the number of elements
...
...
Please
register
or
sign in
to post a comment