declare constant function parameters const (as well as constant function return values)
This commit is contained in:
@@ -177,7 +177,7 @@ int process_command_line(int argc, char **argv)
|
|||||||
|
|
||||||
int process_configfile(char *configfile)
|
int process_configfile(char *configfile)
|
||||||
{
|
{
|
||||||
char * tmp;
|
const char *tmp;
|
||||||
|
|
||||||
if (configfile == NULL)
|
if (configfile == NULL)
|
||||||
configfile = DEFAULT_CONFIGFILE;
|
configfile = DEFAULT_CONFIGFILE;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
|
|
||||||
/* recursively read the menu hierarchy */
|
/* recursively read the menu hierarchy */
|
||||||
MenuEntry *menu_read(MenuEntry *parent, char *name)
|
MenuEntry *menu_read(MenuEntry *parent, const char *name)
|
||||||
{
|
{
|
||||||
static int id = 0;
|
static int id = 0;
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ MenuEntry *menu_read(MenuEntry *parent, char *name)
|
|||||||
|
|
||||||
if (config_get_string(name, "Entry", 0, NULL) != NULL) {
|
if (config_get_string(name, "Entry", 0, NULL) != NULL) {
|
||||||
MenuEntry **addr = &me->entries;
|
MenuEntry **addr = &me->entries;
|
||||||
char *entryname;
|
const char *entryname;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
// it is a sub-menu
|
// it is a sub-menu
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ typedef struct menu_entry {
|
|||||||
} MenuEntry;
|
} MenuEntry;
|
||||||
|
|
||||||
|
|
||||||
MenuEntry *menu_read(MenuEntry *parent, char *name);
|
MenuEntry *menu_read(MenuEntry *parent, const char *ame);
|
||||||
int menu_sock_send(MenuEntry *me, MenuEntry *parent, int sock);
|
int menu_sock_send(MenuEntry *me, MenuEntry *parent, int sock);
|
||||||
MenuEntry *menu_find_by_id(MenuEntry *me, int id);
|
MenuEntry *menu_find_by_id(MenuEntry *me, int id);
|
||||||
const char *menu_command(MenuEntry *me);
|
const char *menu_command(MenuEntry *me);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ static struct option const long_options[] =
|
|||||||
static int
|
static int
|
||||||
iface_process_configfile()
|
iface_process_configfile()
|
||||||
{
|
{
|
||||||
char *unit;
|
const char *unit;
|
||||||
|
|
||||||
debug( RPT_DEBUG, "%s()", __FUNCTION__ );
|
debug( RPT_DEBUG, "%s()", __FUNCTION__ );
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,17 @@
|
|||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#if TIME_WITH_SYS_TIME
|
||||||
|
# include <sys/time.h>
|
||||||
|
# include <time.h>
|
||||||
|
#else
|
||||||
|
# if HAVE_SYS_TIME_H
|
||||||
|
# include <sys/time.h>
|
||||||
|
# else
|
||||||
|
# include <time.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_GETLOADAVG
|
#ifdef USE_GETLOADAVG
|
||||||
# include <sys/loadavg.h>
|
# include <sys/loadavg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ static int
|
|||||||
process_configfile(char *configfile)
|
process_configfile(char *configfile)
|
||||||
{
|
{
|
||||||
int k;
|
int k;
|
||||||
char *tmp;
|
const char *tmp;
|
||||||
|
|
||||||
debug(RPT_DEBUG, "%s(%s)", __FUNCTION__, (configfile) ? configfile : "<null>");
|
debug(RPT_DEBUG, "%s(%s)", __FUNCTION__, (configfile) ? configfile : "<null>");
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ int
|
|||||||
drivers_load_driver( char * name )
|
drivers_load_driver( char * name )
|
||||||
{
|
{
|
||||||
Driver * driver;
|
Driver * driver;
|
||||||
char * s;
|
const char * s;
|
||||||
char * driverpath;
|
char * driverpath;
|
||||||
char * filename;
|
char * filename;
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ static void CwLnx_draw_frame(Driver *drvthis, char *dat);
|
|||||||
static char CwLnx_parse_keypad_setting(Driver *drvthis, char * keyname, char default_value)
|
static char CwLnx_parse_keypad_setting(Driver *drvthis, char * keyname, char default_value)
|
||||||
{
|
{
|
||||||
char return_val = 0;
|
char return_val = 0;
|
||||||
char * s;
|
const char *s;
|
||||||
char buf[255];
|
char buf[255];
|
||||||
|
|
||||||
s = drvthis->config_get_string(drvthis->name, keyname, 0, NULL);
|
s = drvthis->config_get_string(drvthis->name, keyname, 0, NULL);
|
||||||
@@ -501,7 +501,7 @@ int CwLnx_init(Driver * drvthis)
|
|||||||
int tmp;
|
int tmp;
|
||||||
int w;
|
int w;
|
||||||
int h;
|
int h;
|
||||||
char *s;
|
const char *s;
|
||||||
|
|
||||||
PrivateData *p;
|
PrivateData *p;
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ static void EyeboxOne_use_led(int fd, int led, int color);
|
|||||||
static char EyeboxOne_parse_keypad_setting (Driver *drvthis, char * keyname, char default_value)
|
static char EyeboxOne_parse_keypad_setting (Driver *drvthis, char * keyname, char default_value)
|
||||||
{
|
{
|
||||||
char return_val = 0;
|
char return_val = 0;
|
||||||
char * s;
|
const char *s;
|
||||||
char buf[255];
|
char buf[255];
|
||||||
|
|
||||||
s = drvthis->config_get_string(drvthis->name, keyname, 0, NULL);
|
s = drvthis->config_get_string(drvthis->name, keyname, 0, NULL);
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ static void MtxOrb_old_hbar (Driver *drvthis, int x, int y, int len);
|
|||||||
static char MtxOrb_parse_keypad_setting (Driver *drvthis, char * keyname, char default_value)
|
static char MtxOrb_parse_keypad_setting (Driver *drvthis, char * keyname, char default_value)
|
||||||
{
|
{
|
||||||
char return_val = 0;
|
char return_val = 0;
|
||||||
char * s;
|
const char *s;
|
||||||
char buf[255];
|
char buf[255];
|
||||||
|
|
||||||
s = drvthis->config_get_string(drvthis->name, keyname, 0, NULL);
|
s = drvthis->config_get_string(drvthis->name, keyname, 0, NULL);
|
||||||
|
|||||||
@@ -258,8 +258,7 @@ void
|
|||||||
serial_HD44780_backlight (PrivateData *p, unsigned char state)
|
serial_HD44780_backlight (PrivateData *p, unsigned char state)
|
||||||
{
|
{
|
||||||
/* TODO */
|
/* TODO */
|
||||||
if(p->have_backlight);
|
//if (p->have_backlight) ....
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char
|
unsigned char
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ static char *defaultKeyMapMatrix[KEYPAD_MAXY][KEYPAD_MAXX] = {
|
|||||||
void HD44780_position (Driver *drvthis, int x, int y);
|
void HD44780_position (Driver *drvthis, int x, int y);
|
||||||
static void uPause (PrivateData *p, int usecs);
|
static void uPause (PrivateData *p, int usecs);
|
||||||
unsigned char HD44780_scankeypad(PrivateData *p);
|
unsigned char HD44780_scankeypad(PrivateData *p);
|
||||||
static int parse_span_list (int *spanListArray[], int *spLsize, int *dispOffsets[], int *dOffsize, int *dispSizeArray[], char *spanlist);
|
static int parse_span_list (int *spanListArray[], int *spLsize, int *dispOffsets[], int *dOffsize, int *dispSizeArray[], const char *spanlist);
|
||||||
|
|
||||||
// Vars for the server core
|
// Vars for the server core
|
||||||
MODULE_EXPORT char * api_version = API_VERSION;
|
MODULE_EXPORT char * api_version = API_VERSION;
|
||||||
@@ -132,7 +132,7 @@ HD44780_init (Driver * drvthis)
|
|||||||
// TODO: remove the two magic numbers below
|
// TODO: remove the two magic numbers below
|
||||||
// TODO: single point of return
|
// TODO: single point of return
|
||||||
char buf[40];
|
char buf[40];
|
||||||
char *s;
|
const char *s;
|
||||||
int i;
|
int i;
|
||||||
int if_type = IF_TYPE_PARPORT;
|
int if_type = IF_TYPE_PARPORT;
|
||||||
PrivateData *p;
|
PrivateData *p;
|
||||||
@@ -1072,7 +1072,7 @@ HD44780_output (Driver *drvthis, int on)
|
|||||||
// returns number of span elements, -1 on parse error
|
// returns number of span elements, -1 on parse error
|
||||||
|
|
||||||
int
|
int
|
||||||
parse_span_list (int *spanListArray[], int *spLsize, int *dispOffsets[], int *dOffsize, int *dispSizeArray[], char *spanlist)
|
parse_span_list (int *spanListArray[], int *spLsize, int *dispOffsets[], int *dOffsize, int *dispSizeArray[], const char *spanlist)
|
||||||
{
|
{
|
||||||
int j = 0, retVal = 0;
|
int j = 0, retVal = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ joy_init (Driver *drvthis)
|
|||||||
|
|
||||||
for (i = 0; i < p->axes; i++) {
|
for (i = 0; i < p->axes; i++) {
|
||||||
char mapkey[50];
|
char mapkey[50];
|
||||||
char *mapval;
|
const char *mapval;
|
||||||
|
|
||||||
snprintf(mapkey, sizeof(mapkey), "Map_Axis%dneg", i+1);
|
snprintf(mapkey, sizeof(mapkey), "Map_Axis%dneg", i+1);
|
||||||
mapval = drvthis->config_get_string(drvthis->name, mapkey, 0, NULL);
|
mapval = drvthis->config_get_string(drvthis->name, mapkey, 0, NULL);
|
||||||
@@ -154,7 +154,7 @@ joy_init (Driver *drvthis)
|
|||||||
|
|
||||||
for (i = 0; i < p->buttons; i++) {
|
for (i = 0; i < p->buttons; i++) {
|
||||||
char mapkey[50];
|
char mapkey[50];
|
||||||
char *mapval;
|
const char *mapval;
|
||||||
|
|
||||||
snprintf(mapkey, sizeof(mapkey), "Map_Button%d", i+1);
|
snprintf(mapkey, sizeof(mapkey), "Map_Button%d", i+1);
|
||||||
mapval = drvthis->config_get_string(drvthis->name, mapkey, 0, NULL);
|
mapval = drvthis->config_get_string(drvthis->name, mapkey, 0, NULL);
|
||||||
|
|||||||
@@ -188,12 +188,12 @@ typedef struct lcd_logical_driver {
|
|||||||
/* Configfile functions */
|
/* Configfile functions */
|
||||||
/* See configfile.h for descriptions and usage. */
|
/* See configfile.h for descriptions and usage. */
|
||||||
|
|
||||||
short (*config_get_bool)( char *sectionname, char *keyname, int skip, short default_value );
|
short (*config_get_bool) (const char *sectionname, const char *keyname, int skip, short default_value);
|
||||||
long int (*config_get_int) ( char *sectionname, char *keyname, int skip, long int default_value );
|
long int (*config_get_int) (const char *sectionname, const char *keyname, int skip, long int default_value);
|
||||||
double (*config_get_float) ( char *sectionname, char *keyname, int skip, double default_value );
|
double (*config_get_float) (const char *sectionname, const char *keyname, int skip, double default_value);
|
||||||
char *( *config_get_string) ( char *sectionname, char *keyname, int skip, char *default_value );
|
const char *( *config_get_string)(const char *sectionname, const char *keyname, int skip, const char *default_value);
|
||||||
int (*config_has_section) ( char *sectionname );
|
int (*config_has_section) (const char *sectionname);
|
||||||
int (*config_has_key) ( char *sectionname, char *keyname );
|
int (*config_has_key) (const char *sectionname, const char *keyname);
|
||||||
|
|
||||||
/* Reporting function */
|
/* Reporting function */
|
||||||
/* Easily usable by including drivers/report.h */
|
/* Easily usable by including drivers/report.h */
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ lcterm_init (Driver *drvthis)
|
|||||||
/* Get and parse size */
|
/* Get and parse size */
|
||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
char *s = drvthis->config_get_string(drvthis->name, "Size", 0, "16x2");
|
const char *s = drvthis->config_get_string(drvthis->name, "Size", 0, "16x2");
|
||||||
|
|
||||||
debug(RPT_DEBUG, "%s: reading size: %s", __FUNCTION__, s);
|
debug(RPT_DEBUG, "%s: reading size: %s", __FUNCTION__, s);
|
||||||
|
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ unsigned char sed1330_readkeypad (PrivateData *p, unsigned int YData);
|
|||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
sed1330_init( Driver * drvthis )
|
sed1330_init( Driver * drvthis )
|
||||||
{
|
{
|
||||||
char * s;
|
const char *s;
|
||||||
PrivateData * p;
|
PrivateData * p;
|
||||||
unsigned char data[8];
|
unsigned char data[8];
|
||||||
|
|
||||||
|
|||||||
@@ -610,7 +610,7 @@ ula200_init(Driver *drvthis)
|
|||||||
{
|
{
|
||||||
PrivateData *p;
|
PrivateData *p;
|
||||||
int err, i;
|
int err, i;
|
||||||
char *s;
|
const char *s;
|
||||||
|
|
||||||
// Alocate and store private data
|
// Alocate and store private data
|
||||||
p = (PrivateData *) malloc( sizeof( PrivateData) );
|
p = (PrivateData *) malloc( sizeof( PrivateData) );
|
||||||
|
|||||||
+1
-1
@@ -404,7 +404,7 @@ process_command_line(int argc, char **argv)
|
|||||||
static int
|
static int
|
||||||
process_configfile(char *configfile)
|
process_configfile(char *configfile)
|
||||||
{
|
{
|
||||||
char * s;
|
const char *s;
|
||||||
/*char buf[64];*/
|
/*char buf[64];*/
|
||||||
|
|
||||||
debug( RPT_DEBUG, "%s()", __FUNCTION__ );
|
debug( RPT_DEBUG, "%s()", __FUNCTION__ );
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ MenuEventFunc (brightness_handler);
|
|||||||
|
|
||||||
int menuscreens_init()
|
int menuscreens_init()
|
||||||
{
|
{
|
||||||
char *tmp;
|
const char *tmp;
|
||||||
|
|
||||||
debug (RPT_DEBUG, "%s()", __FUNCTION__);
|
debug (RPT_DEBUG, "%s()", __FUNCTION__);
|
||||||
|
|
||||||
|
|||||||
+19
-19
@@ -44,12 +44,12 @@ static section * first_section = NULL;
|
|||||||
/* Yes there is a static. It's C after all :)*/
|
/* Yes there is a static. It's C after all :)*/
|
||||||
|
|
||||||
|
|
||||||
section * find_section(char * sectionname);
|
section *find_section(const char *sectionname);
|
||||||
section * add_section(char * sectionname);
|
section *add_section(const char *sectionname);
|
||||||
key * find_key(section * s, char * keyname, int skip);
|
key *find_key(section *s, const char *keyname, int skip);
|
||||||
key * add_key(section * s, char * keyname, char * value);
|
key *add_key(section *s, const char *keyname, const char *value);
|
||||||
char get_next_char_f(FILE *f);
|
char get_next_char_f(FILE *f);
|
||||||
int process_config(section ** current_section, char(*get_next_char)(), char modify_section_allowed, char * source_descr, FILE *f);
|
int process_config(section **current_section, char(*get_next_char)(), char modify_section_allowed, const char *source_descr, FILE *f);
|
||||||
|
|
||||||
|
|
||||||
#ifdef WITH_LDAP_SUPPORT
|
#ifdef WITH_LDAP_SUPPORT
|
||||||
@@ -70,7 +70,7 @@ int ldap_port;
|
|||||||
|
|
||||||
/**** EXTERNAL FUNCTIONS ****/
|
/**** EXTERNAL FUNCTIONS ****/
|
||||||
|
|
||||||
int config_read_file(char *filename)
|
int config_read_file(const char *filename)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
section *curr_section = NULL;
|
section *curr_section = NULL;
|
||||||
@@ -123,7 +123,7 @@ int config_read_file(char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int config_read_string(char *sectionname, char *str)
|
int config_read_string(const char *sectionname, const char *str)
|
||||||
/* All the config parameters are placed in the given section in memory.*/
|
/* All the config parameters are placed in the given section in memory.*/
|
||||||
{
|
{
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
@@ -143,8 +143,8 @@ int config_read_string(char *sectionname, char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *config_get_string(char * sectionname, char * keyname,
|
const char *config_get_string(const char *sectionname, const char *keyname,
|
||||||
int skip, char * default_value)
|
int skip, const char *default_value)
|
||||||
{
|
{
|
||||||
key *k = find_key(find_section(sectionname), keyname, skip);
|
key *k = find_key(find_section(sectionname), keyname, skip);
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ char *config_get_string(char * sectionname, char * keyname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
short config_get_bool(char *sectionname, char *keyname,
|
short config_get_bool(const char *sectionname, const char *keyname,
|
||||||
int skip, short default_value)
|
int skip, short default_value)
|
||||||
{
|
{
|
||||||
key *k = find_key(find_section(sectionname), keyname, skip);
|
key *k = find_key(find_section(sectionname), keyname, skip);
|
||||||
@@ -187,7 +187,7 @@ short config_get_bool(char *sectionname, char *keyname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long int config_get_int(char *sectionname, char *keyname,
|
long int config_get_int(const char *sectionname, const char *keyname,
|
||||||
int skip, long int default_value)
|
int skip, long int default_value)
|
||||||
{
|
{
|
||||||
key *k = find_key(find_section(sectionname), keyname, skip);
|
key *k = find_key(find_section(sectionname), keyname, skip);
|
||||||
@@ -204,7 +204,7 @@ long int config_get_int(char *sectionname, char *keyname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double config_get_float(char *sectionname, char *keyname,
|
double config_get_float(const char *sectionname, const char *keyname,
|
||||||
int skip, double default_value)
|
int skip, double default_value)
|
||||||
{
|
{
|
||||||
key *k = find_key(find_section(sectionname), keyname, skip);
|
key *k = find_key(find_section(sectionname), keyname, skip);
|
||||||
@@ -221,13 +221,13 @@ double config_get_float(char *sectionname, char *keyname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int config_has_section(char *sectionname)
|
int config_has_section(const char *sectionname)
|
||||||
{
|
{
|
||||||
return (find_section(sectionname) != NULL) ? 1 : 0;
|
return (find_section(sectionname) != NULL) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int config_has_key(char *sectionname, char *keyname)
|
int config_has_key(const char *sectionname, const char *keyname)
|
||||||
{
|
{
|
||||||
section *s = find_section(sectionname);
|
section *s = find_section(sectionname);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -320,7 +320,7 @@ connect_to_ldap(void)
|
|||||||
#define BUFSIZE 255
|
#define BUFSIZE 255
|
||||||
#endif /* WITH_LDAP_SUPPORT */
|
#endif /* WITH_LDAP_SUPPORT */
|
||||||
|
|
||||||
section * find_section(char * sectionname)
|
section *find_section(const char *sectionname)
|
||||||
{
|
{
|
||||||
section *s;
|
section *s;
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ section * find_section(char * sectionname)
|
|||||||
return NULL; /* not found */
|
return NULL; /* not found */
|
||||||
}
|
}
|
||||||
|
|
||||||
section * add_section(char * sectionname)
|
section *add_section(const char *sectionname)
|
||||||
{
|
{
|
||||||
section *s;
|
section *s;
|
||||||
section **place = &first_section;
|
section **place = &first_section;
|
||||||
@@ -392,7 +392,7 @@ section * add_section(char * sectionname)
|
|||||||
return(*place);
|
return(*place);
|
||||||
}
|
}
|
||||||
|
|
||||||
key * find_key(section * s, char * keyname, int skip)
|
key *find_key(section *s, const char *keyname, int skip)
|
||||||
{
|
{
|
||||||
key *k;
|
key *k;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -516,7 +516,7 @@ key * find_key(section * s, char * keyname, int skip)
|
|||||||
return NULL; /* not found*/
|
return NULL; /* not found*/
|
||||||
}
|
}
|
||||||
|
|
||||||
key * add_key(section * s, char * keyname, char * value)
|
key *add_key(section *s, const char *keyname, const char *value)
|
||||||
{
|
{
|
||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
key *k;
|
key *k;
|
||||||
@@ -566,7 +566,7 @@ char get_next_char_f(FILE *f)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int process_config(section ** current_section, char(*get_next_char)(), char modify_section_allowed, char * source_descr, FILE *f)
|
int process_config(section **current_section, char(*get_next_char)(), char modify_section_allowed, const char *source_descr, FILE *f)
|
||||||
{
|
{
|
||||||
char state = ST_INITIAL;
|
char state = ST_INITIAL;
|
||||||
char ch;
|
char ch;
|
||||||
|
|||||||
+9
-9
@@ -19,20 +19,20 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int config_read_file( char *filename );
|
int config_read_file(const char *filename);
|
||||||
/* Opens the specified file and reads everything into memory.
|
/* Opens the specified file and reads everything into memory.
|
||||||
* Returns -1 on parsing errors.
|
* Returns -1 on parsing errors.
|
||||||
* Returns -2 if the file could not be opened or a read error occured.
|
* Returns -2 if the file could not be opened or a read error occured.
|
||||||
* Returns -16 if a malloc went wrong.
|
* Returns -16 if a malloc went wrong.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int config_read_string( char *sectionname, char *str );
|
int config_read_string(const char *sectionname, const char *str);
|
||||||
/* Reads everything in the string into memory.
|
/* Reads everything in the string into memory.
|
||||||
* Returns -1 on parsing errors.
|
* Returns -1 on parsing errors.
|
||||||
* Returns -16 if a malloc went wrong.
|
* Returns -16 if a malloc went wrong.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
short config_get_bool( char *sectionname, char *keyname,
|
short config_get_bool(const char *sectionname, const char *keyname,
|
||||||
int skip, short default_value);
|
int skip, short default_value);
|
||||||
/* Tries to interpret a value in the config file as a boolean.
|
/* Tries to interpret a value in the config file as a boolean.
|
||||||
* 0, false, no, n = false
|
* 0, false, no, n = false
|
||||||
@@ -44,16 +44,16 @@ short config_get_bool( char *sectionname, char *keyname,
|
|||||||
* last.
|
* last.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
long int config_get_int( char *sectionname, char *keyname,
|
long int config_get_int(const char *sectionname, const char *keyname,
|
||||||
int skip, long int default_value);
|
int skip, long int default_value);
|
||||||
/* Tries to interpret a value in the config file as an integer.*/
|
/* Tries to interpret a value in the config file as an integer.*/
|
||||||
|
|
||||||
double config_get_float( char *sectionname, char *keyname,
|
double config_get_float(const char *sectionname, const char *keyname,
|
||||||
int skip, double default_value);
|
int skip, double default_value);
|
||||||
/* Tries to interpret a value in the config file as a float.*/
|
/* Tries to interpret a value in the config file as a float.*/
|
||||||
|
|
||||||
char *config_get_string( char * sectionname, char * keyname,
|
const char *config_get_string(const char *sectionname, const char *keyname,
|
||||||
int skip, char * default_value );
|
int skip, const char *default_value);
|
||||||
/* Returns a pointer to the string associated with the specified key.
|
/* Returns a pointer to the string associated with the specified key.
|
||||||
* The string should never be modified, and used only short-term. You can
|
* The string should never be modified, and used only short-term. You can
|
||||||
* for example scan it or copy it. In successive calls this function can
|
* for example scan it or copy it. In successive calls this function can
|
||||||
@@ -80,12 +80,12 @@ char *config_get_string( char * sectionname, char * keyname,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int config_has_section( char *sectionname );
|
int config_has_section(const char *sectionname);
|
||||||
/* Checks if a specified section exists.
|
/* Checks if a specified section exists.
|
||||||
* Returns whether it exists.
|
* Returns whether it exists.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int config_has_key( char *sectionname, char *keyname );
|
int config_has_key(const char *sectionname, const char *keyname);
|
||||||
/* Checks if a specified key within the specified section exists.
|
/* Checks if a specified key within the specified section exists.
|
||||||
* Returns the number of times the key exists.
|
* Returns the number of times the key exists.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user