Subversion Repositories SvarDOS

Rev

Rev 227 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 227 Rev 237
Line 9... Line 9...
9
 
9
 
10
#include <stdio.h>  /* printf(), fclose(), fopen()... */
10
#include <stdio.h>  /* printf(), fclose(), fopen()... */
11
#include <string.h> /* strcasecmp() */
11
#include <string.h> /* strcasecmp() */
12
#include <stdlib.h> /* malloc(), free() */
12
#include <stdlib.h> /* malloc(), free() */
13
 
13
 
14
#include "crc32.h"  /* crc32() */
-
 
15
#include "fdnpkg.h" /* PKGINST_SKIPLINKS... */
14
#include "fdnpkg.h" /* PKGINST_SKIPLINKS... */
16
#include "helpers.h" /* slash2backslash(), removeDoubleBackslashes()... */
15
#include "helpers.h" /* slash2backslash(), removeDoubleBackslashes()... */
17
#include "kprintf.h"
16
#include "kprintf.h"
18
#include "loadconf.h"
17
#include "loadconf.h"
19
#include "parsecmd.h"
18
#include "parsecmd.h"
Line 105... Line 104...
105
  *dirlist = newentry;
104
  *dirlist = newentry;
106
  return(0);
105
  return(0);
107
}
106
}
108
 
107
 
109
 
108
 
110
int loadconf(char *cfgfile, struct customdirs **dirlist, int *flags) {
109
int loadconf(const char *dosdir, struct customdirs **dirlist, int *flags) {
111
  int bytebuff, parserstate = 0;
110
  int bytebuff, parserstate = 0;
112
  FILE *fd;
111
  FILE *fd;
113
  #define maxtok 16
112
  #define maxtok 16
114
  char token[maxtok];
113
  char token[maxtok];
115
  #define maxval 1024
114
  #define maxval 256
116
  char value[maxval];
115
  char value[maxval];
-
 
116
  char cfgfile[256];
117
  int curtok = 0, curval = 0, nline = 1;
117
  int curtok = 0, curval = 0, nline = 1;
118
 
118
 
-
 
119
  snprintf(cfgfile, sizeof(cfgfile), "%s\\cfg\\pkg.cfg", dosdir);
119
  fd = fopen(cfgfile, "r");
120
  fd = fopen(cfgfile, "r");
120
  if (fd == NULL) {
121
  if (fd == NULL) {
121
    kitten_printf(7, 1, "Error: Could not open config file '%s'!", cfgfile);
122
    kitten_printf(7, 1, "Error: Could not open config file (%s)!", cfgfile);
122
    puts("");
123
    puts("");
123
    return(-1);
124
    return(-1);
124
  }
125
  }
125
 
126
 
126
  /* read the config file line by line */
127
  /* read the config file line by line */