Subversion Repositories SvarDOS

Rev

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

Rev 399 Rev 406
Line 243... Line 243...
243
    int 0x21
243
    int 0x21
244
    FAILED:
244
    FAILED:
245
  }
245
  }
246
  return(drv);
246
  return(drv);
247
}
247
}
-
 
248
 
-
 
249
 
-
 
250
/* converts a 8+3 filename into 11-bytes FCB format (MYFILE  EXT) */
-
 
251
void file_fname2fcb(char *dst, const char *src) {
-
 
252
  unsigned short i;
-
 
253
 
-
 
254
  /* fill dst with 11 spaces and a NULL terminator */
-
 
255
  for (i = 0; i < 12; i++) dst[i] = ' ';
-
 
256
  dst[12] = 0;
-
 
257
 
-
 
258
  /* copy fname until dot (.) or 8 characters */
-
 
259
  for (i = 0; i < 8; i++) {
-
 
260
    if ((src[i] == '.') || (src[i] == 0)) break;
-
 
261
    dst[i] = src[i];
-
 
262
  }
-
 
263
 
-
 
264
  /* advance src until extension or end of string */
-
 
265
  src += i;
-
 
266
  for (;;) {
-
 
267
    if (*src == '.') {
-
 
268
      src++; /* next character is extension */
-
 
269
      break;
-
 
270
    }
-
 
271
    if (*src == 0) break;
-
 
272
  }
-
 
273
 
-
 
274
  /* copy extension to dst (3 chars max) */
-
 
275
  dst += 8;
-
 
276
  for (i = 0; i < 3; i++) {
-
 
277
    if (src[i] == 0) break;
-
 
278
    dst[i] = src[i];
-
 
279
  }
-
 
280
}
-
 
281
 
-
 
282
 
-
 
283
/* converts a 11-bytes FCB filename (MYFILE  EXT) into 8+3 format (MYFILE.EXT) */
-
 
284
void file_fcb2fname(char *dst, const char *src) {
-
 
285
  unsigned short i, end = 0;
-
 
286
 
-
 
287
  for (i = 0; i < 8; i++) {
-
 
288
    dst[i] = src[i];
-
 
289
    if (dst[i] != ' ') end = i + 1;
-
 
290
  }
-
 
291
 
-
 
292
  /* is there an extension? */
-
 
293
  if (src[8] == ' ') {
-
 
294
    dst[end] = 0;
-
 
295
  } else { /* found extension: copy it until first space */
-
 
296
    dst[end++] = '.';
-
 
297
    for (i = 8; i < 11; i++) {
-
 
298
      if (src[i] == ' ') break;
-
 
299
      dst[end++] = src[i];
-
 
300
    }
-
 
301
    dst[end] = 0;
-
 
302
  }
-
 
303
}