Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
c9a09b91
Commit
c9a09b91
authored
Nov 06, 2019
by
Etienne Samson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples: extract argument conversion helper
parent
204a464f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
examples/args.c
+14
-0
examples/args.h
+5
-0
No files found.
examples/args.c
View file @
c9a09b91
...
...
@@ -181,3 +181,17 @@ int match_arg_separator(struct args_info *args)
args
->
pos
++
;
return
1
;
}
void
strarray_from_args
(
git_strarray
*
array
,
struct
args_info
*
args
)
{
size_t
i
;
array
->
count
=
args
->
argc
-
args
->
pos
;
array
->
strings
=
calloc
(
array
->
count
,
sizeof
(
char
*
));
assert
(
array
->
strings
!=
NULL
);
for
(
i
=
0
;
args
->
pos
<
args
->
argc
;
++
args
->
pos
)
{
array
->
strings
[
i
++
]
=
args
->
argv
[
args
->
pos
];
}
args
->
pos
=
args
->
argc
;
}
examples/args.h
View file @
c9a09b91
...
...
@@ -82,4 +82,9 @@ extern int match_bool_arg(int *out, struct args_info *args, const char *opt);
*/
extern
int
match_arg_separator
(
struct
args_info
*
args
);
/**
* Consume all remaining arguments in a git_strarray
*/
extern
void
strarray_from_args
(
git_strarray
*
array
,
struct
args_info
*
args
);
#endif
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