• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef FILE_NAME_H
2 #define FILE_NAME_H
3 
4 /*  Copyright 2009 Alain Knaff.
5  *  This file is part of mtools.
6  *
7  *  Mtools is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  Mtools is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with Mtools.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include <sysincludes.h>
22 #include "mtools.h"
23 
24 /**
25  * raw dos-name coming straight from the directory entry
26  * MYFILE  TXT
27  */
28 struct dos_name_t {
29   char base[8] NONULLTERM;
30   char ext[3] NONULLTERM;
31   char sentinel;
32 };
33 
34 int dos_to_wchar(doscp_t *fromDos, const char *dos, wchar_t *wchar, size_t len);
35 void wchar_to_dos(doscp_t *toDos, wchar_t *wchar, char *dos, size_t len, int *mangled);
36 
37 doscp_t *cp_open(int codepage);
38 void cp_close(doscp_t *cp);
39 
40 int wchar_to_native(const wchar_t *wchar, char *native,
41 		    size_t len, size_t out_len);
42 
43 #define WCHAR_TO_NATIVE(wchar,native,len) \
44 	wchar_to_native((wchar),(native),(len),sizeof(native))
45 
46 int native_to_wchar(const char *native, wchar_t *wchar, size_t len,
47 		    const char *end, int *mangled);
48 
49 #endif
50