dosfstools  4.2
About: dosfstools are utilities to create, check and label (MS-DOS) FAT filesystems.
  Fossies Dox: dosfstools-4.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

charconv.c File Reference
#include "charconv.h"
#include <langinfo.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <wchar.h>
Include dependency graph for charconv.c:

Go to the source code of this file.

Functions

static int wchar_string_to_cp850_string (char *out, const wchar_t *in, unsigned int out_size)
 
static int cp850_string_to_wchar_string (wchar_t *out, const char *in, unsigned int out_size)
 
static int cp850_char_to_printable (char **p, unsigned char c, unsigned int out_size)
 
static int local_string_to_cp850_string (char *out, const char *in, unsigned int out_size)
 
int set_dos_codepage (int codepage)
 
int dos_char_to_printable (char **p, unsigned char c, unsigned int out_size)
 
int local_string_to_dos_string (char *out, char *in, unsigned int out_size)
 
int dos_string_to_wchar_string (wchar_t *out, char *in, unsigned int out_size)
 
int wchar_string_to_dos_string (char *out, wchar_t *in, unsigned int out_size)
 

Variables

static const wchar_t cp850_table [128]
 
static const char *const cp850_translit_table [128]
 

Function Documentation

◆ cp850_char_to_printable()

static int cp850_char_to_printable ( char **  p,
unsigned char  c,
unsigned int  out_size 
)
static

Definition at line 119 of file charconv.c.

References cp850_table, and cp850_translit_table.

Referenced by dos_char_to_printable().

◆ cp850_string_to_wchar_string()

static int cp850_string_to_wchar_string ( wchar_t *  out,
const char *  in,
unsigned int  out_size 
)
static

Definition at line 105 of file charconv.c.

References cp850_table.

Referenced by dos_string_to_wchar_string().

◆ dos_char_to_printable()

int dos_char_to_printable ( char **  p,
unsigned char  c,
unsigned int  out_size 
)

Definition at line 353 of file charconv.c.

References cp850_char_to_printable().

Referenced by pretty_label(), and put_char().

◆ dos_string_to_wchar_string()

int dos_string_to_wchar_string ( wchar_t *  out,
char *  in,
unsigned int  out_size 
)

Definition at line 363 of file charconv.c.

References cp850_string_to_wchar_string().

Referenced by check_boot_label(), check_label(), and validate_volume_label().

◆ local_string_to_cp850_string()

static int local_string_to_cp850_string ( char *  out,
const char *  in,
unsigned int  out_size 
)
static

Definition at line 142 of file charconv.c.

References wchar_string_to_cp850_string().

Referenced by local_string_to_dos_string().

◆ local_string_to_dos_string()

int local_string_to_dos_string ( char *  out,
char *  in,
unsigned int  out_size 
)

Definition at line 358 of file charconv.c.

References local_string_to_cp850_string().

Referenced by get_new_label(), handle_label(), and setup_tables().

◆ set_dos_codepage()

int set_dos_codepage ( int  codepage)

Definition at line 339 of file charconv.c.

References DEFAULT_DOS_CODEPAGE.

Referenced by main().

◆ wchar_string_to_cp850_string()

static int wchar_string_to_cp850_string ( char *  out,
const wchar_t *  in,
unsigned int  out_size 
)
static

Definition at line 78 of file charconv.c.

References cp850_table.

Referenced by local_string_to_cp850_string(), and wchar_string_to_dos_string().

◆ wchar_string_to_dos_string()

int wchar_string_to_dos_string ( char *  out,
wchar_t *  in,
unsigned int  out_size 
)

Definition at line 368 of file charconv.c.

References wchar_string_to_cp850_string().

Referenced by check_boot_label(), and check_label().

Variable Documentation

◆ cp850_table

const wchar_t cp850_table[128]
static
Initial value:
= {
0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7,
0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5,
0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9,
0x00ff, 0x00d6, 0x00dc, 0x00f8, 0x00a3, 0x00d8, 0x00d7, 0x0192,
0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00d1, 0x00aa, 0x00ba,
0x00bf, 0x00ae, 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab, 0x00bb,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00c1, 0x00c2, 0x00c0,
0x00a9, 0x2563, 0x2551, 0x2557, 0x255d, 0x00a2, 0x00a5, 0x2510,
0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x00e3, 0x00c3,
0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x00a4,
0x00f0, 0x00d0, 0x00ca, 0x00cb, 0x00c8, 0x0131, 0x00cd, 0x00ce,
0x00cf, 0x2518, 0x250c, 0x2588, 0x2584, 0x00a6, 0x00cc, 0x2580,
0x00d3, 0x00df, 0x00d4, 0x00d2, 0x00f5, 0x00d5, 0x00b5, 0x00fe,
0x00de, 0x00da, 0x00db, 0x00d9, 0x00fd, 0x00dd, 0x00af, 0x00b4,
0x00ad, 0x00b1, 0x2017, 0x00be, 0x00b6, 0x00a7, 0x00f7, 0x00b8,
0x00b0, 0x00a8, 0x00b7, 0x00b9, 0x00b3, 0x00b2, 0x25a0, 0x00a0,
}

Definition at line 39 of file charconv.c.

Referenced by cp850_char_to_printable(), cp850_string_to_wchar_string(), and wchar_string_to_cp850_string().

◆ cp850_translit_table

const char* const cp850_translit_table[128]
static
Initial value:
= {
"C", "u", "e", "a", "a", "a", "a", "c",
"e", "e", "e", "i", "i", "i", "A", "A",
"E", "ae", "AE", "o", "o", "o", "u", "u",
"y", "O", "U", "o", "GBP", "O", "x", "f",
"a", "i", "o", "u", "n", "N", "a", "o",
"?", "(R)", "!", " 1/2 ", " 1/4 ", "!", "<<", ">>",
"?", "?", "?", "|", "+", "A", "A", "A",
"(C)", "?", "?", "?", "?", "c", "JPY", "+",
"+", "+", "+", "+", "-", "+", "a", "A",
"?", "?", "?", "?", "?", "?", "?", "?",
"d", "D", "E", "E", "E", "i", "I", "I",
"I", "+", "+", "?", "?", "|", "I", "?",
"O", "ss", "O", "O", "o", "O", "u", "th",
"TH", "U", "U", "U", "y", "Y", "?", "'",
"-", "+-", "?", " 3/4 ", "?", "?", "/", ",",
"?", "?", ".", "1", "3", "2", "?", " ",
}

Definition at line 59 of file charconv.c.

Referenced by cp850_char_to_printable().