blob: 0e29af25c7ef3bb552de69483c6aae935ab81dc6 [file] [log] [blame]
Alistair Delvabeaee832021-02-24 11:27:23 -08001#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 */
28struct dos_name_t {
29 char base[8] NONULLTERM;
30 char ext[3] NONULLTERM;
31 char sentinel;
32};
33
Yi Kong39bbd962022-01-09 19:41:38 +080034size_t dos_to_wchar(doscp_t *fromDos, const char *dos, wchar_t *wchar, size_t len);
Alistair Delvabeaee832021-02-24 11:27:23 -080035void wchar_to_dos(doscp_t *toDos, wchar_t *wchar, char *dos, size_t len, int *mangled);
36
Yi Kong39bbd962022-01-09 19:41:38 +080037doscp_t *cp_open(unsigned int codepage);
Alistair Delvabeaee832021-02-24 11:27:23 -080038void cp_close(doscp_t *cp);
39
Yi Kong39bbd962022-01-09 19:41:38 +080040size_t wchar_to_native(const wchar_t *wchar, char *native,
41 size_t len, size_t out_len);
Alistair Delvabeaee832021-02-24 11:27:23 -080042
43#define WCHAR_TO_NATIVE(wchar,native,len) \
44 wchar_to_native((wchar),(native),(len),sizeof(native))
45
Yi Kong39bbd962022-01-09 19:41:38 +080046size_t native_to_wchar(const char *native, wchar_t *wchar, size_t len,
47 const char *end, int *mangled);
Alistair Delvabeaee832021-02-24 11:27:23 -080048
49#endif