git://git.jankratochvil.net
/
gnokii.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Branch update for mygnokii2002_03_17_19_29nl
[gnokii.git]
/
common
/
files
/
cfgreader.c
diff --git
a/common/files/cfgreader.c
b/common/files/cfgreader.c
index
9908cc1
..
f7f35b9
100644
(file)
--- a/
common/files/cfgreader.c
+++ b/
common/files/cfgreader.c
@@
-27,8
+27,10
@@
#include "files/cfgreader.h"
#include "files/cfgreader.h"
+#ifndef UCLINUX
+
/* Read configuration information from a ".INI" style file */
/* Read configuration information from a ".INI" style file */
-struct CFG_Header *CFG_ReadFile(char *filename)
+st
atic st
ruct CFG_Header *CFG_ReadFile(char *filename)
{
FILE *handle;
char *line;
{
FILE *handle;
char *line;
@@
-48,7
+50,7
@@
struct CFG_Header *CFG_ReadFile(char *filename)
/* Open file */
if ((handle = fopen(filename, "r")) == NULL) {
#ifdef DEBUG
/* Open file */
if ((handle = fopen(filename, "r")) == NULL) {
#ifdef DEBUG
- fprintf( stderr, "CFG_ReadFile - open %s: %s\n", filename, strerror(errno));
+
//
fprintf( stderr, "CFG_ReadFile - open %s: %s\n", filename, strerror(errno));
#endif /* DEBUG */
return NULL;
}
#endif /* DEBUG */
return NULL;
}
@@
-104,7
+106,7
@@
struct CFG_Header *CFG_ReadFile(char *filename)
cfg_info = heading;
#ifdef DEBUG
cfg_info = heading;
#ifdef DEBUG
- fprintf(stderr, "Added new section %s\n", heading->section);
+
//
fprintf(stderr, "Added new section %s\n", heading->section);
#endif
/* Go on to next line */
#endif
/* Go on to next line */
@@
-153,7
+155,7
@@
struct CFG_Header *CFG_ReadFile(char *filename)
cfg_info->entries = entry;
#ifdef DEBUG
cfg_info->entries = entry;
#ifdef DEBUG
- fprintf(stderr, "Adding key/value %s/%s\n", entry->key, entry->value);
+
//
fprintf(stderr, "Adding key/value %s/%s\n", entry->key, entry->value);
#endif
/* Go on to next line */
continue;
#endif
/* Go on to next line */
continue;
@@
-169,7
+171,7
@@
struct CFG_Header *CFG_ReadFile(char *filename)
/* Write configuration information to a config file */
/* Write configuration information to a config file */
-int CFG_WriteFile(struct CFG_Header *cfg, char *filename)
+
static
int CFG_WriteFile(struct CFG_Header *cfg, char *filename)
{
/* Not implemented - tricky to do and preserve comments */
{
/* Not implemented - tricky to do and preserve comments */
@@
-209,7
+211,7
@@
char *CFG_Get(struct CFG_Header *cfg, char *section, char *key)
/* Set the value of a key in a config file. Return the new value if
the section/key can be found, else return NULL. */
/* Set the value of a key in a config file. Return the new value if
the section/key can be found, else return NULL. */
-char *CFG_Set(struct CFG_Header *cfg, char *section, char *key,
+
static
char *CFG_Set(struct CFG_Header *cfg, char *section, char *key,
char *value)
{
struct CFG_Header *h;
char *value)
{
struct CFG_Header *h;
@@
-265,7
+267,7
@@
struct CFG_Header *CFG_FindGnokiirc()
if ((cfg_info = CFG_ReadFile("/etc/gnokiirc")) == NULL) {
/* That failed too so exit */
#ifdef DEBUG
if ((cfg_info = CFG_ReadFile("/etc/gnokiirc")) == NULL) {
/* That failed too so exit */
#ifdef DEBUG
- fprintf(stderr, _("Couldn't open %s or /etc/gnokiirc. Using defaults...\n"), rcfile);
+
//
fprintf(stderr, _("Couldn't open %s or /etc/gnokiirc. Using defaults...\n"), rcfile);
#endif /* DEBUG */
return NULL;
}
#endif /* DEBUG */
return NULL;
}
@@
-276,7
+278,7
@@
struct CFG_Header *CFG_FindGnokiirc()
if ((cfg_info = CFG_ReadFile("gnokiirc")) == NULL) {
/* That failed too so exit */
#ifdef DEBUG
if ((cfg_info = CFG_ReadFile("gnokiirc")) == NULL) {
/* That failed too so exit */
#ifdef DEBUG
- fprintf(stderr, _("Couldn't open %s or gnokiirc. Using defaults...\n"), rcfile);
+
//
fprintf(stderr, _("Couldn't open %s or gnokiirc. Using defaults...\n"), rcfile);
#endif /* DEBUG */
return NULL;
}
#endif /* DEBUG */
return NULL;
}
@@
-287,10
+289,21
@@
struct CFG_Header *CFG_FindGnokiirc()
return cfg_info;
}
return cfg_info;
}
+#endif /* UCLINUX */
+
int CFG_ReadConfig(char **model, char **port, char **initlength,
int CFG_ReadConfig(char **model, char **port, char **initlength,
- char **connection, char **bindir,
char **synchronizetime,
+ char **connection, char **bindir,
bool isgnokiid)
{
bool isgnokiid)
{
+#ifdef UCLINUX
+
+ *model=strdup(CONFIG_CFG_MODEL);
+ *port=strdup(CONFIG_CFG_PORT);
+ *initlength=strdup(CONFIG_CFG_INITLENGTH);
+ *connection=strdup("fbus");
+ *bindir=NULL;
+
+#else /* UCLINUX */
struct CFG_Header *cfg_info;
#ifdef WIN32
char *DefaultPort = "com2:";
struct CFG_Header *cfg_info;
#ifdef WIN32
char *DefaultPort = "com2:";
@@
-300,7
+313,6
@@
int CFG_ReadConfig(char **model, char **port, char **initlength,
char *DefaultModel = "auto";
char *DefaultConnection = "fbus";
char *DefaultBindir = "/usr/local/sbin/";
char *DefaultModel = "auto";
char *DefaultConnection = "fbus";
char *DefaultBindir = "/usr/local/sbin/";
- char *DefaultSynchronizeTime = "yes";
char *DefaultInitLength = "30";
char *section = "global";
char *DefaultInitLength = "30";
char *section = "global";
@@
-309,7
+321,6
@@
int CFG_ReadConfig(char **model, char **port, char **initlength,
(char *)*port = DefaultPort;
(char *)*connection = DefaultConnection;
(char *)*bindir = DefaultBindir;
(char *)*port = DefaultPort;
(char *)*connection = DefaultConnection;
(char *)*bindir = DefaultBindir;
- (char *)*synchronizetime = DefaultSynchronizeTime;
(char *)*initlength = DefaultInitLength;
cfg_info=CFG_FindGnokiirc();
(char *)*initlength = DefaultInitLength;
cfg_info=CFG_FindGnokiirc();
@@
-329,11
+340,9
@@
int CFG_ReadConfig(char **model, char **port, char **initlength,
(char *)*bindir = CFG_Get(cfg_info, section, "bindir");
if (!*bindir) (char *)*bindir = DefaultBindir;
(char *)*bindir = CFG_Get(cfg_info, section, "bindir");
if (!*bindir) (char *)*bindir = DefaultBindir;
- (char *)*synchronizetime = CFG_Get(cfg_info, section, "synchronizetime");
- if (!*synchronizetime) (char *)*synchronizetime = DefaultSynchronizeTime;
-
(char *)*initlength = CFG_Get(cfg_info, section, "initlength");
if (!*initlength) (char *)*initlength = "default";
(char *)*initlength = CFG_Get(cfg_info, section, "initlength");
if (!*initlength) (char *)*initlength = "default";
+#endif /* UCLINUX */
return 0;
}
return 0;
}