Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
2f780d57
Commit
2f780d57
authored
Dec 07, 2011
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/doc_extract: simplify handling fields with spaces in them.
eg. "See also" can match "see-also".
parent
0621cac3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
tools/doc_extract.c
tools/doc_extract.c
+19
-2
No files found.
tools/doc_extract.c
View file @
2f780d57
...
...
@@ -8,6 +8,23 @@
#include <ccan/grab_file/grab_file.h>
#include "doc_extract.h"
/* We regard non-alphanumerics as equiv. */
static
bool
typematch
(
const
char
*
a
,
const
char
*
b
)
{
size_t
i
;
for
(
i
=
0
;
a
[
i
];
i
++
)
{
if
(
cisalnum
(
a
[
i
]))
{
if
(
a
[
i
]
!=
b
[
i
])
return
false
;
}
else
{
if
(
cisalnum
(
b
[
i
]))
return
false
;
}
}
return
b
[
i
]
==
'\0'
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
unsigned
int
i
;
...
...
@@ -16,7 +33,7 @@ int main(int argc, char *argv[])
if
(
argc
<
3
)
errx
(
1
,
"Usage: doc_extract [--function=<funcname>] TYPE <file>...
\n
"
"Where TYPE is functions|author|license|maintainer|summary|description|example|all"
);
"Where TYPE is functions|author|license|maintainer|summary|description|example|
see_also|
all"
);
if
(
strstarts
(
argv
[
1
],
"--function="
))
{
function
=
argv
[
1
]
+
strlen
(
"--function="
);
...
...
@@ -60,7 +77,7 @@ int main(int argc, char *argv[])
}
if
(
streq
(
type
,
"all"
))
printf
(
"%s:
\n
"
,
d
->
type
);
else
if
(
!
streq
(
d
->
type
,
type
))
else
if
(
!
typematch
(
d
->
type
,
type
))
continue
;
for
(
j
=
0
;
j
<
d
->
num_lines
;
j
++
)
...
...
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