links

lynx-like text mode web browser
git clone anongit@rnpnr.xyz:links.git
Log | Files | Refs | Feed | README | LICENSE

Commit: c49f83269636906033bcf8069fcfd92ae5e06112
Parent: 4d597ce941612fbf29a062c28ca39b97ba7910a8
Author: opask
Date:   Sat, 18 Aug 2018 17:41:53 -0600

more simplification in language.c
get_default_charset() always returns 0 so remove it

Diffstat:
Mdrivers.c | 2+-
Mkbd.c | 2+-
Mlanguage.c | 30+-----------------------------
Mlinks.h | 1-
Mterminal.c | 2+-
5 files changed, 4 insertions(+), 33 deletions(-)

diff --git a/drivers.c b/drivers.c @@ -113,7 +113,7 @@ int g_kbd_codepage(struct graphics_driver *drv) { if (drv->kbd_codepage >= 0) return drv->kbd_codepage; - return get_default_charset(); + return 0; } void generic_set_clip_area(struct graphics_device *dev, struct rect *r) diff --git a/kbd.c b/kbd.c @@ -335,7 +335,7 @@ void handle_trm(int sock_out, void *init_string, int init_len) } free(ts); queue_event(itrm, (unsigned char *)&xwin, sizeof(int)); - def_charset = get_default_charset(); + def_charset = 0; queue_event(itrm, (unsigned char *)&def_charset, sizeof(int)); queue_event(itrm, (unsigned char *)&init_len, sizeof(int)); queue_event(itrm, (unsigned char *)init_string, init_len); diff --git a/language.c b/language.c @@ -15,37 +15,9 @@ struct translation { unsigned char dummyarray[T__N_TEXTS]; -int get_default_charset(void) -{ - char *lang, *p; - int r; - - if (!(lang = getenv("LC_CTYPE"))) - if (!(lang = getenv("LANG"))) - return 0; - - if ((p = strchr(lang, '.'))) - p++; - else { - if (strlen(lang) > 5 - && !casestrcmp((unsigned char *)(strchr(lang, 0) - 5), - (unsigned char *)"@euro")) - p = "ISO-8859-15"; - else { - p = (char *)translation[T__DEFAULT_CHAR_SET].name; - if (!p) - p = ""; - } - } - if ((r = get_cp_index((unsigned char *)p)) < 0) - return 0; - - return r; -} - int get_commandline_charset(void) { - return dump_codepage == -1 ? get_default_charset() : dump_codepage; + return dump_codepage == -1 ? 0 : dump_codepage; } static inline int is_direct_text(unsigned char *text) diff --git a/links.h b/links.h @@ -1636,7 +1636,6 @@ extern unsigned char dummyarray[]; extern int current_language; -int get_default_charset(void); int get_commandline_charset(void); unsigned char *get_text_translation(unsigned char *, struct terminal *term); unsigned char *get_english_translation(unsigned char *); diff --git a/terminal.c b/terminal.c @@ -684,7 +684,7 @@ struct terminal *init_gfx_term(void (*root_window)(struct window *, struct links term->environment = !(drv->flags & GD_ONLY_1_WINDOW) ? ENV_G : 0; if (!casestrcmp(drv->name, cast_uchar "x")) term->environment |= ENV_XWIN; term->spec = &gfx_term; - term->default_character_set = get_default_charset(); + term->default_character_set = 0; safe_strncpy(term->cwd, cwd, MAX_CWD_LEN); gfx_term.character_set = utf8_table; if (gfx_term.character_set == -1) gfx_term.character_set = 0;