Subversion Repositories SvarDOS

Rev

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

Rev 1678 Rev 1878
Line 15... Line 15...
15
 
15
 
16
#include "trim.h"
16
#include "trim.h"
17
#include "helpers.h"
17
#include "helpers.h"
18
 
18
 
19
 
19
 
-
 
20
/* returns the DOS boot drive */
-
 
21
static unsigned char GETDOSBOOTDRIVE(void);
-
 
22
#pragma aux GETDOSBOOTDRIVE = \
-
 
23
"mov ax, 0x3305" /* int 0x21,AX=3305 - get boot drive (MS-DOS 4.0+) */ \
-
 
24
"int 0x21" \
-
 
25
"jnc GOOD" \
-
 
26
"mov dl, 3"      /* fall back to "C" on error (DOS 3.x...) */ \
-
 
27
"GOOD:" \
-
 
28
"add dl, '@'"    /* convert the drive id (A=1, B=2...) into a drive letter */ \
-
 
29
modify [ax] \
-
 
30
value [dl]
-
 
31
 
-
 
32
 
20
/* change all / to \ in a string */
33
/* change all / to \ in a string */
21
void slash2backslash(char *str) {
34
void slash2backslash(char *str) {
22
  int x;
35
  int x;
23
  for (x = 0; str[x] != 0; x++) {
36
  for (x = 0; str[x] != 0; x++) {
24
    if (str[x] == '/') str[x] = '\\';
37
    if (str[x] == '/') str[x] = '\\';
Line 101... Line 114...
101
    if ((longfilename[x] == '/') || (longfilename[x] == '\\')) {
114
    if ((longfilename[x] == '/') || (longfilename[x] == '\\')) {
102
      lastsep = x;
115
      lastsep = x;
103
      if (firstsep < 0) firstsep = x;
116
      if (firstsep < 0) firstsep = x;
104
    }
117
    }
105
  }
118
  }
106
  /* if it's a file without any directory, then it goes to C:\ (COMMAND.COM, KERNEL.SYS...) */
119
  /* if it's a file without any directory, then it goes to BOOTDRIVE:\ (COMMAND.COM, KERNEL.SYS...) */
107
  if (firstsep < 0) {
120
  if (firstsep < 0) {
108
    sprintf(respath, "C:\\");
121
    sprintf(respath, "%c:\\", GETDOSBOOTDRIVE());
109
    return(longfilename);
122
    return(longfilename);
110
  }
123
  }
111
  /* */
124
  /* */
112
  shortfilename = &longfilename[lastsep + 1];
125
  shortfilename = &longfilename[lastsep + 1];
113
  /* look for possible custom path */
126
  /* look for possible custom path */