First version, development moved to 5110-connected machine
[gnokii.git] / common / files / cfgreader.c
index 9908cc1..ad25708 100644 (file)
 
 #include "files/cfgreader.h"
 
+#ifndef UCLINUX
+
 /* Read configuration information from a ".INI" style file */
-struct CFG_Header *CFG_ReadFile(char *filename)
+static struct CFG_Header *CFG_ReadFile(char *filename)
 {
         FILE *handle;
         char *line;
@@ -169,7 +171,7 @@ struct CFG_Header *CFG_ReadFile(char *filename)
 
 /*  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 */
 
@@ -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.  */
 
-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;
@@ -287,10 +289,21 @@ struct CFG_Header *CFG_FindGnokiirc()
        return cfg_info;
 }
 
+#endif /* UCLINUX */
+
 int CFG_ReadConfig(char **model, char **port, char **initlength,
-               char **connection, char **bindir, char **synchronizetime,
+               char **connection, char **bindir,
               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:";
@@ -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 *DefaultSynchronizeTime = "yes";
        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 *)*synchronizetime = DefaultSynchronizeTime;
         (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 *)*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";
+#endif /* UCLINUX */
 
         return 0;
 }