Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
378f990b
Commit
378f990b
authored
13 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Created iniReadSectionCount(), like iniGetSectionCount(), except it operates
on FILE* (like iniReadSectionList()).
parent
9c4d5134
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/xpdev/ini_file.c
+27
-0
27 additions, 0 deletions
src/xpdev/ini_file.c
src/xpdev/ini_file.h
+2
-0
2 additions, 0 deletions
src/xpdev/ini_file.h
with
29 additions
and
0 deletions
src/xpdev/ini_file.c
+
27
−
0
View file @
378f990b
...
...
@@ -931,6 +931,33 @@ size_t iniGetSectionCount(str_list_t list, const char* prefix)
return
(
items
);
}
size_t
iniReadSectionCount
(
FILE
*
fp
,
const
char
*
prefix
)
{
char
*
p
;
char
str
[
INI_MAX_LINE_LEN
];
ulong
items
=
0
;
if
(
fp
==
NULL
)
return
(
0
);
rewind
(
fp
);
while
(
!
feof
(
fp
))
{
if
(
fgets
(
str
,
sizeof
(
str
),
fp
)
==
NULL
)
break
;
if
(
is_eof
(
str
))
break
;
if
((
p
=
section_name
(
str
))
==
NULL
)
continue
;
if
(
prefix
!=
NULL
)
if
(
strnicmp
(
p
,
prefix
,
strlen
(
prefix
))
!=
0
)
continue
;
items
++
;
}
return
(
items
);
}
str_list_t
iniReadKeyList
(
FILE
*
fp
,
const
char
*
section
)
{
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/ini_file.h
+
2
−
0
View file @
378f990b
...
...
@@ -67,6 +67,8 @@ extern "C" {
/* Read all section names and return as an allocated string list */
/* Optionally (if prefix!=NULL), returns a subset of section names */
str_list_t
iniReadSectionList
(
FILE
*
,
const
char
*
prefix
);
/* Returns number (count) of sections */
size_t
iniReadSectionCount
(
FILE
*
,
const
char
*
prefix
);
/* Read all key names and return as an allocated string list */
str_list_t
iniReadKeyList
(
FILE
*
,
const
char
*
section
);
/* Read all key and value pairs and return as a named string list */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment