Subversion Repositories SvarDOS

Rev

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

Rev 219 Rev 225
Line 1... Line 1...
1
/*
1
/*
2
 * This file is part of fdnpkg
2
 * This file is part of pkginst
3
 * Copyright (C) 2012-2017 Mateusz Viste
3
 * Copyright (C) 2012-2021 Mateusz Viste
4
 *
4
 *
5
 * It contains a few helper function...
5
 * It contains a few helper function...
6
 */
6
 */
7
 
7
 
8
 
8
 
Line 191... Line 191...
191
    }
191
    }
192
  }
192
  }
193
}
193
}
194
 
194
 
195
 
195
 
196
/* remap drive, if needed (hack for situations where fdinst is used to
-
 
197
 * install an OS to a drive that will change its letter post-install) */
-
 
198
void mapdrives(char *s, char *mapdrv) {
-
 
199
  int i = 0;
-
 
200
  if (mapdrv == NULL) return;
-
 
201
  if ((s == NULL) || (s[0] == 0) || (s[1] != ':')) return;
-
 
202
  while (mapdrv[i] != 0) {
-
 
203
    if (toupper(mapdrv[i]) == toupper(s[0])) {
-
 
204
      s[0] = toupper(mapdrv[i + 1]);
-
 
205
      return;
-
 
206
    }
-
 
207
    i += 2;
-
 
208
  }
-
 
209
}
-
 
210
 
-
 
211
 
-
 
212
/* */
-
 
213
void unmapdrives(char *s, char *mapdrv) {
-
 
214
  int i = 0;
-
 
215
  if (mapdrv == NULL) return;
-
 
216
  if ((s == NULL) || (s[0] == 0) || (s[1] != ':')) return;
-
 
217
  while (mapdrv[i] != 0) {
-
 
218
    if (toupper(mapdrv[i + 1]) == toupper(s[0])) {
-
 
219
      s[0] = toupper(mapdrv[i]);
-
 
220
      return;
-
 
221
    }
-
 
222
    i += 2;
-
 
223
  }
-
 
224
}
-
 
225
 
-
 
226
 
-
 
227
/* returns a pointer to the start of the filename, out of a path\to\file string, and
196
/* returns a pointer to the start of the filename, out of a path\to\file string, and
228
   fills respath with the local folder where the file should be placed. */
197
   fills respath with the local folder where the file should be placed. */
229
char *computelocalpath(char *longfilename, char *respath, char *dosdir, struct customdirs *dirlist) {
198
char *computelocalpath(char *longfilename, char *respath, char *dosdir, struct customdirs *dirlist) {
230
  int x, lastsep = 0, firstsep = -1;
199
  int x, lastsep = 0, firstsep = -1;
231
  char savedchar;
200
  char savedchar;