From 3ae59505d04bfca289ea4936e40a1cbbb08693d5 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 28 Dec 2010 08:46:57 +0000 Subject: 2010-12-28 Sebastian Huber * libfs/src/dosfs/msdos_misc.c: Create short file names acceptable for Windows. --- cpukit/libfs/src/dosfs/msdos_misc.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'cpukit/libfs') diff --git a/cpukit/libfs/src/dosfs/msdos_misc.c b/cpukit/libfs/src/dosfs/msdos_misc.c index d8a7773090..3af6492a07 100644 --- a/cpukit/libfs/src/dosfs/msdos_misc.c +++ b/cpukit/libfs/src/dosfs/msdos_misc.c @@ -92,12 +92,13 @@ msdos_short_name_hex(char* sfn, int num) static const char* hex = "0123456789ABCDEF"; char* c = MSDOS_DIR_NAME(sfn); int i; - for (i = 0; i < 3; i++, c++) + for (i = 0; i < 2; i++, c++) if ((*c == ' ') || (*c == '.')) - *c = '~'; - *c++ = '~'; + *c = '_'; for (i = 0; i < 4; i++, c++) *c = hex[(num >> ((3 - i) * 4)) & 0xf]; + *c++ = '~'; + *c++ = '1'; } /* msdos_name_type -- @@ -1535,6 +1536,7 @@ int msdos_find_name_in_fat_file( char* p; const char* n; int i; + char fill = 0; length += MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE; lfn_entry++; @@ -1600,9 +1602,17 @@ int msdos_find_name_in_fat_file( for (i = 0; i < MSDOS_LFN_LEN_PER_ENTRY; i++) { - *p = *n; if (*n != 0) + { + *p = *n; n++; + } + else + { + p [0] = fill; + p [1] = fill; + fill = 0xff; + } switch (i) { -- cgit v1.2.3