FreeBASIC  0.91.0
sys_getshortpath.c
Go to the documentation of this file.
1 #include "../fb.h"
2 
3 char *fb_hGetShortPath( char *src, char *dst, ssize_t maxlen )
4 {
5  if( strchr( src, 32 ) == NULL ) {
6  strcpy( dst, src );
7  } else {
8  /* FIXME: SPC is only allowed when using LFNs provided by a Windows
9  * environment. So I guess that we have to use the following INT
10  * function:
11  *
12  * IN:
13  *
14  * AX = 0x7160
15  * CL = 0x01
16  * CH = SUBST expansion flag, 0x00 = true path for SUBSTed drive letter
17  * 0x80 = SUBSTed drive letter
18  * DS:SI = ASCIZ FLN
19  * ES:DI = buffer for SFN ( max size = 67 or 128 ??? )
20  *
21  * OUT:
22  *
23  * CF = 1 on error
24  * AX = error code
25  *
26  */
27  strncpy( dst, src, maxlen-1 );
28  dst[maxlen-1] = 0;
29  }
30 
31  return dst;
32 }