1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
#ifndef __CSUTILHXX__
#define __CSUTILHXX__
/* First some base level utility routines */
/* remove end of line char(s) */
void mychomp(char * s);
/* duplicate string */
char * mystrdup(const char * s);
/* parse into tokens with char delimiter */
char * mystrsep(char ** sptr, const char delim);
/* character encoding information */
struct cs_info {
unsigned char ccase;
unsigned char clower;
unsigned char cupper;
};
struct enc_entry {
const char * enc_name;
struct cs_info * cs_table;
};
/* language to encoding default map */
struct lang_map {
const char * lang;
const char * def_enc;
};
struct cs_info * get_current_cs(const char * es);
const char * get_default_enc(const char * lang);
/* convert null terminated string to all caps using encoding */
void enmkallcap(char * d, const char * p, const char * encoding);
/* convert null terminated string to all little using encoding */
void enmkallsmall(char * d, const char * p, const char * encoding);
/* convert null terminated string to have intial capital using encoding */
void enmkinitcap(char * d, const char * p, const char * encoding);
/* convert null terminated string to all caps */
void mkallcap(char * p, const struct cs_info * csconv);
/* convert null terminated string to all little */
void mkallsmall(char * p, const struct cs_info * csconv);
/* convert null terminated string to have intial capital */
void mkinitcap(char * p, const struct cs_info * csconv);
#endif
|