Subversion Repositories SvarDOS

Rev

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

Rev 260 Rev 262
Line 8... Line 8...
8
 
8
 
9
#include <stdio.h>  /* printf(), fclose(), fopen()... */
9
#include <stdio.h>  /* printf(), fclose(), fopen()... */
10
#include <string.h> /* strcasecmp() */
10
#include <string.h> /* strcasecmp() */
11
#include <stdlib.h> /* malloc(), free() */
11
#include <stdlib.h> /* malloc(), free() */
12
 
12
 
13
#include "pkginst.h" /* PKGINST_SKIPLINKS... */
-
 
14
#include "helpers.h" /* slash2backslash(), removeDoubleBackslashes()... */
13
#include "helpers.h" /* slash2backslash(), removeDoubleBackslashes()... */
15
#include "kprintf.h"
14
#include "kprintf.h"
-
 
15
 
16
#include "loadconf.h"
16
#include "loadconf.h"
17
#include "parsecmd.h"
-
 
18
 
17
 
19
 
18
 
20
void freeconf(struct customdirs **dirlist) {
19
void freeconf(struct customdirs **dirlist) {
21
  struct customdirs *curpos;
20
  struct customdirs *curpos;
22
  /* free the linked list of custom dirs */
21
  /* free the linked list of custom dirs */
Line 120... Line 119...
120
      continue;
119
      continue;
121
    }
120
    }
122
 
121
 
123
    /* printf("token='%s' ; value = '%s'\n", token, value); */
122
    /* printf("token='%s' ; value = '%s'\n", token, value); */
124
    if (strcasecmp(token, "DIR") == 0) { /* custom directory entry */
123
    if (strcasecmp(token, "DIR") == 0) { /* custom directory entry */
125
      char *argv[2];
124
      char *location = NULL;
-
 
125
      int i;
-
 
126
      /* find nearer space */
-
 
127
      for (i = 0; (value[i] != ' ') && (value[i] != 0); i++);
126
      if (parsecmd(value, argv, 2) != 2) {
128
      if (value[i] == 0) {
127
        kitten_printf(7, 11, "Warning: Invalid 'DIR' directive found at line #%d", nline);
129
        kitten_printf(7, 11, "Warning: Invalid 'DIR' directive found at line #%d", nline);
128
        puts("");
130
        puts("");
-
 
131
        continue;
129
      }
132
      }
-
 
133
      value[i] = 0;
-
 
134
      location = value + i + 1;
-
 
135
 
130
      /* add the entry to the list */
136
      /* add the entry to the list */
131
      slash2backslash(argv[1]);
137
      slash2backslash(location);
132
      removeDoubleBackslashes(argv[1]);
138
      removeDoubleBackslashes(location);
133
      if (argv[1][strlen(argv[1]) - 1] != '\\') strcat(argv[1], "\\"); /* make sure to end dirs with a backslash */
139
      if (location[strlen(location) - 1] != '\\') strcat(location, "\\"); /* make sure to end dirs with a backslash */
134
      if (addnewdir(dirlist, argv[0], argv[1]) != 0) {
140
      if (addnewdir(dirlist, value, location) != 0) {
135
        kitten_printf(2, 14, "Out of memory! (%s)", "addnewdir");
141
        kitten_printf(2, 14, "Out of memory! (%s)", "addnewdir");
136
        puts("");
142
        puts("");
137
        freeconf(dirlist);
143
        freeconf(dirlist);
138
        fclose(fd);
144
        fclose(fd);
139
        return(-1);
145
        return(-1);