Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zmap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
zmap
Commits
3c4283df
Commit
3c4283df
authored
15 years ago
by
edgrif
Browse files
Options
Downloads
Patches
Plain Diff
add calls to read in an extra configuration file.
parent
d7fac799
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/include/ZMap/zmapConfigIni.h
+4
-4
4 additions, 4 deletions
src/include/ZMap/zmapConfigIni.h
src/zmapConfig/zmapConfigIni.c
+56
-11
56 additions, 11 deletions
src/zmapConfig/zmapConfigIni.c
with
60 additions
and
15 deletions
src/include/ZMap/zmapConfigIni.h
+
4
−
4
View file @
3c4283df
...
...
@@ -27,9 +27,9 @@
*
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited:
Nov 20 09:41
200
8
(
rds
)
* Last edited:
May 26 14:53
200
9
(
edgrif
)
* Created: Thu Sep 11 10:40:13 2008 (rds)
* CVS info: $Id: zmapConfigIni.h,v 1.
4
200
8-11-20 09:55:56 rds
Exp $
* CVS info: $Id: zmapConfigIni.h,v 1.
5
200
9-05-26 14:38:35 edgrif
Exp $
*-------------------------------------------------------------------
*/
...
...
@@ -80,8 +80,8 @@ void zMapConfigIniDestroy(ZMapConfigIni config, gboolean save_user);
ZMapConfigIniContext
zMapConfigIniContextCreate
(
void
);
gboolean
zMapConfigIniContextIncludeBuffer
(
ZMapConfigIniContext
context
,
char
*
buffer
)
;
gboolean
zMapConfigIniContextIncludeBuffer
(
ZMapConfigIniContext
context
,
char
*
buffer
);
gboolean
zMapConfigIniContextIncludeFile
(
ZMapConfigIniContext
context
,
char
*
file
)
;
gboolean
zMapConfigIniContextAddGroup
(
ZMapConfigIniContext
context
,
char
*
stanza_name
,
char
*
stanza_type
,
ZMapConfigIniContextKeyEntryStruct
*
keys
);
...
...
This diff is collapsed.
Click to expand it.
src/zmapConfig/zmapConfigIni.c
+
56
−
11
View file @
3c4283df
...
...
@@ -27,9 +27,9 @@
*
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited:
Nov 20 09:42
200
8
(
rds
)
* Last edited:
May 26 15:30
200
9
(
edgrif
)
* Created: Wed Aug 27 16:21:40 2008 (rds)
* CVS info: $Id: zmapConfigIni.c,v 1.
8
200
8-11-20 09:54:37 rds
Exp $
* CVS info: $Id: zmapConfigIni.c,v 1.
9
200
9-05-26 14:38:35 edgrif
Exp $
*-------------------------------------------------------------------
*/
...
...
@@ -39,7 +39,7 @@
#include
<ZMap/zmapUtils.h>
#include
<ZMap/zmapConfigIni.h>
#define FILE_COUNT
4
#define FILE_COUNT
5
#define IMPORTANT_COUNT 2
#undef WITH_LOGGING
...
...
@@ -48,11 +48,13 @@ typedef struct _ZMapConfigIniStruct
{
// ZMapMagic magic;
GKeyFile
*
buffer_key_file
;
GKeyFile
*
extra_key_file
;
GKeyFile
*
user_key_file
;
GKeyFile
*
zmap_key_file
;
GKeyFile
*
sys_key_file
;
GError
*
buffer_key_error
;
GError
*
extra_key_error
;
GError
*
user_key_error
;
GError
*
zmap_key_error
;
GError
*
sys_key_error
;
...
...
@@ -164,6 +166,23 @@ gboolean zMapConfigIniReadBuffer(ZMapConfigIni config, char *buffer)
return
red
;
}
gboolean
zMapConfigIniReadFile
(
ZMapConfigIni
config
,
char
*
file
)
{
gboolean
read
=
FALSE
;
zMapAssert
(
config
);
if
((
g_path_is_absolute
(
file
)
||
(
file
=
zMapConfigDirFindFile
(
file
)))
&&
(
config
->
extra_key_file
=
read_file
(
file
,
&
(
config
->
extra_key_error
))))
{
read
=
TRUE
;
}
return
read
;
}
void
zMapConfigIniGetStanza
(
ZMapConfigIni
config
,
char
*
stanza_name
)
{
...
...
@@ -241,9 +260,10 @@ gboolean zMapConfigIniHasStanza(ZMapConfigIni config,
files
[
0
]
=
config
->
sys_key_file
;
files
[
1
]
=
config
->
zmap_key_file
;
files
[
2
]
=
config
->
user_key_file
;
files
[
3
]
=
config
->
buffer_key_file
;
files
[
3
]
=
config
->
extra_key_file
;
files
[
4
]
=
config
->
buffer_key_file
;
for
(
i
=
0
;
result
==
FALSE
&&
i
<
FILE_COUNT
;
i
++
)
for
(
i
=
0
;
result
==
FALSE
&&
i
<
FILE_COUNT
;
i
++
)
{
if
(
files
[
i
])
result
=
g_key_file_has_group
(
files
[
i
],
stanza_name
);
...
...
@@ -399,6 +419,8 @@ void zMapConfigIniDestroy(ZMapConfigIni config, gboolean save_user)
g_key_file_free
(
config
->
zmap_key_file
);
if
(
config
->
user_key_file
)
g_key_file_free
(
config
->
user_key_file
);
if
(
config
->
extra_key_file
)
g_key_file_free
(
config
->
extra_key_file
);
/* And any errors left hanging around */
if
(
config
->
sys_key_error
)
...
...
@@ -407,6 +429,8 @@ void zMapConfigIniDestroy(ZMapConfigIni config, gboolean save_user)
g_error_free
(
config
->
zmap_key_error
);
if
(
config
->
user_key_error
)
g_error_free
(
config
->
user_key_error
);
if
(
config
->
extra_key_error
)
g_error_free
(
config
->
extra_key_error
);
/* zero the memory */
memset
(
config
,
0
,
sizeof
(
ZMapConfigIniStruct
));
...
...
@@ -486,9 +510,10 @@ static gboolean get_merged_key_value(ZMapConfigIni config,
if
(
key_found
==
FALSE
)
{
files
[
0
]
=
config
->
buffer_key_file
;
files
[
1
]
=
config
->
user_key_file
;
files
[
2
]
=
config
->
zmap_key_file
;
files
[
3
]
=
config
->
sys_key_file
;
files
[
1
]
=
config
->
extra_key_file
;
files
[
2
]
=
config
->
user_key_file
;
files
[
3
]
=
config
->
zmap_key_file
;
files
[
4
]
=
config
->
sys_key_file
;
for
(
i
=
0
;
key_found
==
FALSE
&&
i
<
FILE_COUNT
;
i
++
)
{
...
...
@@ -757,8 +782,8 @@ ZMapConfigIniContext zMapConfigIniContextCreate(void)
return
context
;
}
gboolean
zMapConfigIniContextIncludeBuffer
(
ZMapConfigIniContext
context
,
char
*
buffer
)
gboolean
zMapConfigIniContextIncludeBuffer
(
ZMapConfigIniContext
context
,
char
*
buffer
)
{
gboolean
result
=
FALSE
;
...
...
@@ -768,6 +793,18 @@ gboolean zMapConfigIniContextIncludeBuffer(ZMapConfigIniContext context,
return
result
;
}
/* file can be a full path or a filename. */
gboolean
zMapConfigIniContextIncludeFile
(
ZMapConfigIniContext
context
,
char
*
file
)
{
gboolean
result
=
FALSE
;
if
(
file
&&
*
file
)
result
=
zMapConfigIniReadFile
(
context
->
config
,
file
)
;
return
result
;
}
char
*
zMapConfigIniContextErrorMessage
(
ZMapConfigIniContext
context
)
{
char
*
e
=
NULL
;
...
...
@@ -775,6 +812,7 @@ char *zMapConfigIniContextErrorMessage(ZMapConfigIniContext context)
return
e
;
}
gboolean
zMapConfigIniContextAddGroup
(
ZMapConfigIniContext
context
,
char
*
stanza_name
,
char
*
stanza_type
,
ZMapConfigIniContextKeyEntryStruct
*
keys
)
...
...
@@ -1057,7 +1095,14 @@ ZMapConfigIniContext zMapConfigIniContextDestroy(ZMapConfigIniContext context)
}
/* Context internals */
/*
* Context internals
*/
/* here we want to prefer exact matches of name and type */
/* then we'll only match types with a name == * already in the list */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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