(file) Return to conf.h CVS log (file) (dir) Up to [OMI] / omi / base

File: [OMI] / omi / base / conf.h (download)
Revision: 1.3, Mon Apr 20 17:19:49 2015 UTC (9 years ago) by krisbash
Branch: MAIN
CVS Tags: OMI_1_0_8_2, OMI_1_0_8_1, HEAD
Changes since 1.2: +0 -0 lines
OMI 1.0.8-1

/*
**==============================================================================
**
** Open Management Infrastructure (OMI)
**
** Copyright (c) Microsoft Corporation
** 
** Licensed under the Apache License, Version 2.0 (the "License"); you may not 
** use this file except in compliance with the License. You may obtain a copy 
** of the License at 
**
**     http://www.apache.org/licenses/LICENSE-2.0 
**
** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
** MERCHANTABLITY OR NON-INFRINGEMENT. 
**
** See the Apache 2 License for the specific language governing permissions 
** and limitations under the License.
**
**==============================================================================
*/

#ifndef _omi_conf_h
#define _omi_conf_h

#include <common.h>

/*
**==============================================================================
**
** Conf
**
**     Provides processing of configuration files. Configuration files contain
**     options expressed KEY=VALUE pairs. For example:
**
**         # My Configuration File
**         port=1234
**         prefix=/usr/local/bin
**         libdir=/usr/local/lib
**         trace=3
**
**     The following example shows how to read key-value pairs form a 
**     configuration file.
**
**         Conf* conf = Conf_Open("/etc/mine.conf");
**
**         if (!conf)
**         {
**             fprintf(stderr, "error: failed to open file\n");
**             exit(1);
**         }
**
**         for (;;)
**         {
**             const char* key;
**             const char* value;
**             int r;
**
**             r = Conf_Read(conf, &key, &value);
**             if (r == -1)
**             {
**                 fprintf(stderr, "error: %s\n", Conf_Error(conf));
**                 exit(1);
**             }
**
**             printf("key{%s}, value{%s}\n", key, value);
**         }
**
**         Conf_Close(conf);
**
**==============================================================================
*/

BEGIN_EXTERNC

typedef struct _Conf Conf;

Conf* Conf_Open(const char* path);

int Conf_Read(Conf* self, const char** key, const char** value);

const char* Conf_Error(Conf* self);

unsigned int Conf_Line(Conf* self);

void Conf_Close(Conf* self);

END_EXTERNC

#endif /* _omi_conf_h */

ViewCVS 0.9.2