Rename scconf_init to scconf_new
Rename scconf_deinit to scconf_free Add initial comments to scldap.h git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@398 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
4502555bcc
commit
19f7f1073a
|
@ -273,12 +273,12 @@ void process_config_file(struct sc_context *ctx, struct _sc_ctx_options *opts)
|
|||
int i, r, count = 0;
|
||||
scconf_block **blocks;
|
||||
|
||||
ctx->conf = scconf_init(OPENSC_CONF_PATH);
|
||||
ctx->conf = scconf_new(OPENSC_CONF_PATH);
|
||||
if (ctx->conf == NULL)
|
||||
return;
|
||||
r = scconf_parse(ctx->conf);
|
||||
if (r < 1) {
|
||||
scconf_deinit(ctx->conf);
|
||||
scconf_free(ctx->conf);
|
||||
ctx->conf = NULL;
|
||||
return;
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ int sc_release_context(struct sc_context *ctx)
|
|||
}
|
||||
ctx->debug_file = ctx->error_file = NULL;
|
||||
if (ctx->conf)
|
||||
scconf_deinit(ctx->conf);
|
||||
scconf_free(ctx->conf);
|
||||
free(ctx->app_name);
|
||||
free(ctx);
|
||||
return 0;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <ctype.h>
|
||||
#include "scconf.h"
|
||||
|
||||
scconf_context *scconf_init(const char *filename)
|
||||
scconf_context *scconf_new(const char *filename)
|
||||
{
|
||||
scconf_context *config;
|
||||
|
||||
|
@ -49,7 +49,7 @@ scconf_context *scconf_init(const char *filename)
|
|||
return config;
|
||||
}
|
||||
|
||||
void scconf_deinit(scconf_context * config)
|
||||
void scconf_free(scconf_context * config)
|
||||
{
|
||||
if (config) {
|
||||
scconf_block_destroy(config->root);
|
||||
|
|
|
@ -61,14 +61,14 @@ typedef struct {
|
|||
scconf_block *root;
|
||||
} scconf_context;
|
||||
|
||||
/* Init configuration
|
||||
/* Allocate scconf_context
|
||||
* The filename can be NULL
|
||||
*/
|
||||
extern scconf_context *scconf_init(const char *filename);
|
||||
extern scconf_context *scconf_new(const char *filename);
|
||||
|
||||
/* Free configuration
|
||||
/* Free scconf_context
|
||||
*/
|
||||
extern void scconf_deinit(scconf_context * config);
|
||||
extern void scconf_free(scconf_context * config);
|
||||
|
||||
/* Parse configuration
|
||||
* Returns 1 = ok, 0 = error, -1 = error opening config file
|
||||
|
@ -88,7 +88,7 @@ extern const scconf_block *scconf_find_block(scconf_context * config, const scco
|
|||
|
||||
/* Find a config by the item_name
|
||||
* If the block is NULL, the root block is used
|
||||
* The key can be used to specify what the blocks first name should be.
|
||||
* The key can be used to specify what the blocks first name should be
|
||||
*/
|
||||
extern scconf_block **scconf_find_blocks(scconf_context * config, const scconf_block * block, const char *item_name, const char *key);
|
||||
|
||||
|
|
|
@ -70,14 +70,14 @@ int main(int argc, char **argv)
|
|||
in = argv[argc - 2];
|
||||
out = argv[argc - 1];
|
||||
|
||||
conf = scconf_init(in);
|
||||
conf = scconf_new(in);
|
||||
if (!conf) {
|
||||
printf("scconf_init failed\n");
|
||||
printf("scconf_new failed\n");
|
||||
return 1;
|
||||
}
|
||||
if (scconf_parse(conf) < 1) {
|
||||
printf("scconf_parse failed\n");
|
||||
scconf_deinit(conf);
|
||||
scconf_free(conf);
|
||||
return 1;
|
||||
}
|
||||
/* See if the file contains any ldap configuration blocks */
|
||||
|
@ -88,6 +88,6 @@ int main(int argc, char **argv)
|
|||
} else {
|
||||
printf("Successfully rewrote file \"%s\" as \"%s\"\n", in, out);
|
||||
}
|
||||
scconf_deinit(conf);
|
||||
scconf_free(conf);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ scldap_context *scldap_parse_parameters(const char *filename)
|
|||
memset(&ctx->entry[ctx->entries], 0, sizeof(scldap_param_entry));
|
||||
|
||||
if (filename) {
|
||||
ctx->conf = scconf_init(filename);
|
||||
ctx->conf = scconf_new(filename);
|
||||
if (!ctx->conf) {
|
||||
scldap_free_parameters(ctx);
|
||||
return NULL;
|
||||
|
@ -225,7 +225,7 @@ void scldap_free_parameters(scldap_context * ctx)
|
|||
ctx->entry = NULL;
|
||||
ctx->entries = 0;
|
||||
if (ctx->conf) {
|
||||
scconf_deinit(ctx->conf);
|
||||
scconf_free(ctx->conf);
|
||||
}
|
||||
ctx->conf = NULL;
|
||||
free(ctx);
|
||||
|
@ -309,7 +309,7 @@ void scldap_parse_arguments(scldap_context ** ctx, int argc, const char **argv)
|
|||
*ctx = ptr;
|
||||
}
|
||||
|
||||
char *scldap_show_arguments(void)
|
||||
const char *scldap_show_arguments(void)
|
||||
{
|
||||
static char buf[250];
|
||||
|
||||
|
|
|
@ -65,28 +65,74 @@ typedef struct _scldap_result {
|
|||
scldap_result_entry *result;
|
||||
} scldap_result;
|
||||
|
||||
/* Allocate scldap_context
|
||||
* The filename can be NULL
|
||||
*/
|
||||
extern scldap_context *scldap_parse_parameters(const char *filename);
|
||||
|
||||
/* Print all entries and configurations to stdout
|
||||
*/
|
||||
extern void scldap_show_parameters(scldap_context * ctx);
|
||||
|
||||
/* Free scldap_context
|
||||
*/
|
||||
extern void scldap_free_parameters(scldap_context * ctx);
|
||||
|
||||
/* Parse command line arguments
|
||||
*/
|
||||
extern void scldap_parse_arguments(scldap_context ** ctx, int argc, const char **argv);
|
||||
extern char *scldap_show_arguments(void);
|
||||
|
||||
/* Return a string that contains all
|
||||
* known command line arguments
|
||||
*/
|
||||
extern const char *scldap_show_arguments(void);
|
||||
|
||||
/* Add new configuration entry
|
||||
*/
|
||||
extern int scldap_add_entry(scldap_context * ctx, const char *entry);
|
||||
|
||||
/* Return entry index number
|
||||
*
|
||||
extern int scldap_get_entry(scldap_context * ctx, const char *entry);
|
||||
|
||||
/* Set entry as the current active entry
|
||||
*/
|
||||
extern void scldap_set_entry(scldap_context * ctx, const char *entry);
|
||||
|
||||
/* Remove entry and all configurations for it
|
||||
*/
|
||||
extern void scldap_remove_entry(scldap_context * ctx, const char *entry);
|
||||
|
||||
/* See if the string is a valid URL
|
||||
* Returns 1 = ok, 0 = not valid
|
||||
*/
|
||||
extern int scldap_is_valid_url(const char *url);
|
||||
|
||||
/* Convert URL to a search entry
|
||||
*/
|
||||
extern int scldap_url_to_entry(scldap_context * ctx, const char *entry, const char *url);
|
||||
|
||||
extern int scldap_approx_base_by_dn(scldap_context * ctx, const char *entry, const char *dn, char **base);
|
||||
|
||||
/* Split DN to result entries
|
||||
*
|
||||
* If notypes is a non-zero, just values
|
||||
* will be added to result entries
|
||||
*/
|
||||
extern int scldap_dn_to_result(const char *dn, scldap_result ** result, int notypes);
|
||||
|
||||
/* Search data from LDAP server
|
||||
*
|
||||
* If numwantedresults is a non-zero, we require
|
||||
* that the given value will match with the number
|
||||
* of the actual results we have got from the server
|
||||
*/
|
||||
extern int scldap_search(scldap_context * ctx, const char *entry,
|
||||
scldap_result ** result, unsigned int numwantedresults,
|
||||
const char *searchpattern);
|
||||
|
||||
/* Free search results
|
||||
*/
|
||||
extern void scldap_free_result(scldap_result * result);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Reference in New Issue