Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 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 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 34 | size_t dos_to_wchar(doscp_t *fromDos, const char *dos, wchar_t *wchar, size_t len); |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 35 | void wchar_to_dos(doscp_t *toDos, wchar_t *wchar, char *dos, size_t len, int *mangled); |
| 36 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 37 | doscp_t *cp_open(unsigned int codepage); |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 38 | void cp_close(doscp_t *cp); |
| 39 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 40 | size_t wchar_to_native(const wchar_t *wchar, char *native, |
| 41 | size_t len, size_t out_len); |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 42 | |
| 43 | #define WCHAR_TO_NATIVE(wchar,native,len) \ |
| 44 | wchar_to_native((wchar),(native),(len),sizeof(native)) |
| 45 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 46 | size_t native_to_wchar(const char *native, wchar_t *wchar, size_t len, |
| 47 | const char *end, int *mangled); |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 48 | |
| 49 | #endif |