diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/HTAlert.c | 32 | ||||
-rw-r--r-- | src/HTAlert.h | 1 | ||||
-rw-r--r-- | src/LYCharSets.c | 4 | ||||
-rw-r--r-- | src/LYClean.c | 2 | ||||
-rw-r--r-- | src/LYGlobalDefs.h | 5 | ||||
-rw-r--r-- | src/LYHistory.c | 17 | ||||
-rw-r--r-- | src/LYMain.c | 13 | ||||
-rw-r--r-- | src/LYOptions.c | 200 | ||||
-rw-r--r-- | src/LYOptions.h | 1 | ||||
-rw-r--r-- | src/LYReadCFG.c | 6 | ||||
-rw-r--r-- | src/LYrcFile.c | 3 | ||||
-rw-r--r-- | src/LYrcFile.h | 2 | ||||
-rw-r--r-- | src/UCdomap.c | 155 | ||||
-rw-r--r-- | src/makefile.dos | 4 |
14 files changed, 340 insertions, 105 deletions
diff --git a/src/HTAlert.c b/src/HTAlert.c index d9a5f37b..0fed7542 100644 --- a/src/HTAlert.c +++ b/src/HTAlert.c @@ -140,22 +140,31 @@ PUBLIC void HTProgress ARGS1( LYSleepDebug(); } -PRIVATE char *sprint_bytes ARGS3( - char *, s, - long, n, - char *, was_units) +PUBLIC CONST char *HTProgressUnits ARGS1( + int, rate) { - static long kb_units = 1024; - static char *bunits; - static char *kbunits; - char *u; + static CONST char *bunits = 0; + static CONST char *kbunits = 0; if (!bunits) { bunits = gettext("bytes"); - kbunits = gettext("KB"); + kbunits = gettext(LYTransferName); } + return ((rate == rateKB) +#ifdef USE_READPROGRESS + || (rate == rateEtaKB) +#endif + ) ? kbunits : bunits; +} + +PRIVATE CONST char *sprint_bytes ARGS3( + char *, s, + long, n, + CONST char *, was_units) +{ + static long kb_units = 1024; + CONST char *u = HTProgressUnits(LYTransferRate); - u = kbunits; if ( (LYTransferRate == rateKB || LYTransferRate == rateEtaKB_maybe) && (n >= 10 * kb_units) ) sprintf(s, "%ld", n/kb_units); @@ -164,7 +173,6 @@ PRIVATE char *sprint_bytes ARGS3( sprintf(s, "%.2g", ((double)n)/kb_units); else { sprintf(s, "%ld", n); - u = bunits; } if (!was_units || was_units != u) @@ -200,7 +208,7 @@ PUBLIC void HTReadProgress ARGS2( static char *line = NULL; char bytesp[80], totalp[80], transferp[80]; int renew = 0; - char *was_units; + CONST char *was_units; #ifdef HAVE_GETTIMEOFDAY struct timeval tv; diff --git a/src/HTAlert.h b/src/HTAlert.h index 43ffd49a..49456c42 100644 --- a/src/HTAlert.h +++ b/src/HTAlert.h @@ -40,6 +40,7 @@ extern void HTUserMsg2 PARAMS((CONST char * Msg, CONST char * Arg)); ** On entry, ** The input is a list of parameters for printf. */ +extern CONST char *HTProgressUnits PARAMS((int kilobytes)); extern void HTProgress PARAMS((CONST char * Msg)); extern void HTReadProgress PARAMS((long bytes, long total)); #define _HTProgress(msg) mustshow = TRUE, HTProgress(msg) diff --git a/src/LYCharSets.c b/src/LYCharSets.c index d5baf0a2..410d7131 100644 --- a/src/LYCharSets.c +++ b/src/LYCharSets.c @@ -378,8 +378,6 @@ PUBLIC LYUCcharset LYCharSet_UC[MAXCHARSETS]= UCT_REP_SUBSETOF_LAT1, UCT_CP_SUBSETOF_LAT1, UCT_R_ASCII,UCT_R_ASCII}, -/* {-1,"iso-8859-15", UCT_ENC_8BIT,0,0,0, UCT_R_8BIT,UCT_R_ASCII}, */ - }; /* @@ -710,6 +708,8 @@ PUBLIC int UCGetLYhndl_byAnyName ARGS1 (char *, value) LYTrimTrailing(value); if (value == NULL) return -1; + CTRACE((tfp, "UCGetLYhndl_byAnyName(%s)\n", value)); + /* search by name */ for (i = 0; (i < MAXCHARSETS && LYchar_set_names[i]); i++) { if (!strcmp(value, LYchar_set_names[i])) { diff --git a/src/LYClean.c b/src/LYClean.c index d3d3de84..8bb59b3d 100644 --- a/src/LYClean.c +++ b/src/LYClean.c @@ -37,7 +37,7 @@ PUBLIC void cleanup_sig ARGS1( #ifdef DJGPP if (wathndlcbrk) { sig_handler_watt(sig); /* Use WATT-32 signal handler */ - } /* Requires patch to WATT-32 */ + } #endif /* DJGPP */ signal(SIGINT, cleanup_sig); sigint = TRUE; diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index 21c56613..9df42f62 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -223,6 +223,7 @@ extern BOOLEAN verbose_img; /* display filenames of images? */ extern BOOLEAN vi_keys; /* TRUE to turn on vi-like key movement */ extern char *LYRequestReferer; /* Referer, may be set in getfile() */ extern char *LYRequestTitle; /* newdoc.title in calls to getfile() */ +extern char *LYTransferName; /* abbreviation for Kilobytes */ extern char *LynxHome; extern char *LynxSigFile; /* Signature file, in or off home */ extern char *checked_box; /* form boxes */ @@ -499,6 +500,10 @@ extern BOOL ok_justify; extern int justify_max_void_percent; #endif +#ifdef EXP_LOCALE_CHARSET +extern BOOLEAN LYLocaleCharset; +#endif + #ifndef NO_DUMP_WITH_BACKSPACES extern BOOLEAN with_backspaces; #endif diff --git a/src/LYHistory.c b/src/LYHistory.c index 64d3f76d..6713e777 100644 --- a/src/LYHistory.c +++ b/src/LYHistory.c @@ -15,6 +15,7 @@ #include <LYStrings.h> #include <LYCharUtils.h> #include <LYCharSets.h> +#include <LYrcFile.h> #ifdef DISP_PARTIAL #include <LYMainLoop.h> #endif @@ -818,23 +819,13 @@ PUBLIC int LYShowVisitedLinks ARGS1( BeginInternalPage(fp0, VISITED_LINKS_TITLE, VISITED_LINKS_HELP); +#ifndef NO_OPTION_FORMS fprintf(fp0, "<form action=\"%s\" method=\"post\">\n", STR_LYNXOPTIONS); - fprintf(fp0, "<select name=\"visited_pages_type\">\n"); - fprintf(fp0, " <option value=\"first_visited\" %s>Sort By First Visited\n", - (Visited_Links_As == VISITED_LINKS_AS_FIRST_V ? "selected" : "")); - fprintf(fp0, " <option value=\"first_visited_reversed\" %s>Reverse Sort By First Visited\n", - (Visited_Links_As == (VISITED_LINKS_AS_FIRST_V|VISITED_LINKS_REVERSE) ? "selected" : "")); - fprintf(fp0, " <option value=\"visit_tree\" %s>View As Visit Tree\n", - (Visited_Links_As == VISITED_LINKS_AS_TREE ? "selected" : "")); - fprintf(fp0, " <option value=\"last_visited\" %s>Sort By Last Visited\n", - (Visited_Links_As == VISITED_LINKS_AS_LATEST ? "selected" : "")); - fprintf(fp0, " <option value=\"last_visited_reversed\" %s>Reverse Sort By Last Visited\n", - (Visited_Links_As == (VISITED_LINKS_AS_LATEST|VISITED_LINKS_REVERSE) - ? "selected" : "")); - fprintf(fp0, "</select>\n"); + LYMenuVisitedLinks (fp0, FALSE); fprintf(fp0, "<input type=\"submit\" value=\"Accept Changes\">\n"); fprintf(fp0, "</form>\n"); fprintf(fp0, "<P>\n"); +#endif fprintf(fp0, "<pre>\n"); fprintf(fp0, "<em>%s</em>\n", diff --git a/src/LYMain.c b/src/LYMain.c index df11538d..fa8b4484 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -465,6 +465,7 @@ PUBLIC BOOLEAN nested_tables = PUBLIC BOOLEAN LYShowTransferRate = TRUE; PUBLIC int LYTransferRate = rateKB; +PUBLIC char * LYTransferName = NULL; PUBLIC char *XLoadImageCommand = NULL; /* Default image viewer for X */ PUBLIC BOOLEAN LYNoISMAPifUSEMAP = FALSE; /* Omit ISMAP link if MAP present? */ @@ -503,6 +504,10 @@ PUBLIC BOOL ok_justify = TRUE; PUBLIC int justify_max_void_percent = 35; #endif +#ifdef EXP_LOCALE_CHARSET +PUBLIC BOOLEAN LYLocaleCharset = FALSE; +#endif + #ifndef NO_DUMP_WITH_BACKSPACES PUBLIC BOOLEAN with_backspaces = FALSE; #endif @@ -708,6 +713,7 @@ PRIVATE void free_lynx_globals NOARGS FREE(URLDomainSuffixes); FREE(XLoadImageCommand); FREE(lynx_temp_space); + FREE(LYTransferName); FREE(LYTraceLogPath); FREE(lynx_cfg_file); #if defined(USE_COLOR_STYLE) @@ -1110,6 +1116,7 @@ PUBLIC int main ARGS2( MessageSecs = SECS2Secs(MESSAGESECS); ReplaySecs = SECS2Secs(REPLAYSECS); + StrAllocCopy(LYTransferName, "KiB"); StrAllocCopy(helpfile, HELPFILE); StrAllocCopy(startfile, STARTFILE); LYEscapeStartfile(&startfile); @@ -1555,6 +1562,10 @@ PUBLIC int main ARGS2( */ read_rc(NULL); +#ifdef EXP_LOCALE_CHARSET + LYFindLocaleCharset(); +#endif + /* * Get WWW_HOME environment variable if it exists. */ @@ -3167,7 +3178,7 @@ PRIVATE int version_fun ARGS1( )); printf(gettext("Distributed under the GNU General Public License.\n")); printf(gettext( - "See http://lynx.browser.org/ and the online help for more information.\n\n" + "See http://lynx.isc.org/ and the online help for more information.\n\n" )); #ifdef USE_SSL printf("See http://www.moxienet.com/lynx/ for information about SSL for Lynx.\n"); diff --git a/src/LYOptions.c b/src/LYOptions.c index 23db216a..6bef4f79 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -2100,13 +2100,13 @@ typedef struct { static CONST char selected_string[] = "selected"; static CONST char disabled_string[] = "disabled"; -static CONST char on_string[] = "ON"; -static CONST char off_string[] = "OFF"; -static CONST char never_string[] = "NEVER"; -static CONST char always_string[] = "ALWAYS"; +static CONST char on_string[] = N_("ON"); +static CONST char off_string[] = N_("OFF"); +static CONST char never_string[] = N_("NEVER"); +static CONST char always_string[] = N_("ALWAYS"); static OptValues bool_values[] = { - { FALSE, "OFF", "OFF" }, - { TRUE, "ON", "ON" }, + { FALSE, N_("OFF"), "OFF" }, + { TRUE, N_("ON"), "ON" }, { 0, 0, 0 }}; static char * secure_string = "secure"; @@ -2117,9 +2117,9 @@ static char * save_options_string = "save_options"; * Personal Preferences */ static char * cookies_string = RC_SET_COOKIES; -static char * cookies_ignore_all_string = "ignore"; -static char * cookies_up_to_user_string = "ask user"; -static char * cookies_accept_all_string = "accept all"; +static char * cookies_ignore_all_string = N_("ignore"); +static char * cookies_up_to_user_string = N_("ask user"); +static char * cookies_accept_all_string = N_("accept all"); static char * x_display_string = RC_DISPLAY; static char * editor_string = RC_FILE_EDITOR; static char * emacs_keys_string = RC_EMACS_KEYS; @@ -2130,10 +2130,10 @@ static char * emacs_keys_string = RC_EMACS_KEYS; #define EXEC_NEVER 0 static char * exec_links_string = RC_RUN_ALL_EXECUTION_LINKS; static OptValues exec_links_values[] = { - { EXEC_NEVER, "ALWAYS OFF", "ALWAYS OFF" }, - { EXEC_LOCAL, "FOR LOCAL FILES ONLY", "FOR LOCAL FILES ONLY" }, + { EXEC_NEVER, N_("ALWAYS OFF"), "ALWAYS OFF" }, + { EXEC_LOCAL, N_("FOR LOCAL FILES ONLY"), "FOR LOCAL FILES ONLY" }, #ifndef NEVER_ALLOW_REMOTE_EXEC - { EXEC_ALWAYS, "ALWAYS ON", "ALWAYS ON" }, + { EXEC_ALWAYS, N_("ALWAYS ON"), "ALWAYS ON" }, #endif { 0, 0, 0 }}; #endif /* ENABLE_OPTS_CHANGE_EXEC */ @@ -2143,21 +2143,23 @@ static char * kblayout_string = RC_KBLAYOUT; #endif static char * keypad_mode_string = RC_KEYPAD_MODE; static OptValues keypad_mode_values[] = { - { NUMBERS_AS_ARROWS, "Numbers act as arrows", "number_arrows" }, - { LINKS_ARE_NUMBERED, "Links are numbered", "links_numbered" }, + { NUMBERS_AS_ARROWS, N_("Numbers act as arrows"), + "number_arrows" }, + { LINKS_ARE_NUMBERED, N_("Links are numbered"), + "links_numbered" }, { LINKS_AND_FIELDS_ARE_NUMBERED, - "Links and form fields are numbered", + N_("Links and form fields are numbered"), "links_and_forms" }, { FIELDS_ARE_NUMBERED, - "Form fields are numbered", + N_("Form fields are numbered"), "forms_numbered" }, { 0, 0, 0 }}; static char * lineedit_mode_string = RC_LINEEDIT_MODE; static char * mail_address_string = RC_PERSONAL_MAIL_ADDRESS; static char * search_type_string = RC_CASE_SENSITIVE_SEARCHING; static OptValues search_type_values[] = { - { FALSE, "Case insensitive", "case_insensitive" }, - { TRUE, "Case sensitive", "case_sensitive" }, + { FALSE, N_("Case insensitive"), "case_insensitive" }, + { TRUE, N_("Case sensitive"), "case_sensitive" }, { 0, 0, 0 }}; #if defined(USE_SLANG) || defined(COLOR_CURSES) @@ -2176,9 +2178,9 @@ static char * show_cursor_string = RC_SHOW_CURSOR; static char * show_scrollbar_string = RC_SCROLLBAR; #endif -static CONST char prompt_dft_string[] = "prompt normally"; -static CONST char prompt_yes_string[] = "force yes-response"; -static CONST char prompt_no_string[] = "force no-response"; +static CONST char prompt_dft_string[] = N_("prompt normally"); +static CONST char prompt_yes_string[] = N_("force yes-response"); +static CONST char prompt_no_string[] = N_("force no-response"); static OptValues prompt_values[] = { { FORCE_PROMPT_DFT, prompt_dft_string, prompt_dft_string }, { FORCE_PROMPT_YES, prompt_yes_string, prompt_yes_string }, @@ -2193,22 +2195,22 @@ static char * ssl_prompt_string = RC_FORCE_SSL_PROMPT; static char * user_mode_string = RC_USER_MODE; static OptValues user_mode_values[] = { - { NOVICE_MODE, "Novice", "Novice" }, - { INTERMEDIATE_MODE, "Intermediate", "Intermediate" }, - { ADVANCED_MODE, "Advanced", "Advanced" }, + { NOVICE_MODE, N_("Novice"), "Novice" }, + { INTERMEDIATE_MODE, N_("Intermediate"), "Intermediate" }, + { ADVANCED_MODE, N_("Advanced"), "Advanced" }, { 0, 0, 0 }}; static char * vi_keys_string = RC_VI_KEYS; static char * visited_links_string = RC_VISITED_LINKS; static OptValues visited_links_values[] = { - { VISITED_LINKS_AS_FIRST_V, "By First Visit", "first_visited" }, + { VISITED_LINKS_AS_FIRST_V, N_("By First Visit"), "first_visited" }, { VISITED_LINKS_AS_FIRST_V | VISITED_LINKS_REVERSE, - "By First Visit Reversed", "first_visited_reversed" }, - { VISITED_LINKS_AS_TREE, "As Visit Tree", "visit_tree" }, - { VISITED_LINKS_AS_LATEST, "By Last Visit", "last_visited" }, + N_("By First Visit Reversed"), "first_visited_reversed" }, + { VISITED_LINKS_AS_TREE, N_("As Visit Tree"), "visit_tree" }, + { VISITED_LINKS_AS_LATEST, N_("By Last Visit"), "last_visited" }, { VISITED_LINKS_AS_LATEST | VISITED_LINKS_REVERSE, - "By Last Visit Reversed", "last_visited_reversed" }, + N_("By Last Visit Reversed"), "last_visited_reversed" }, { 0, 0, 0 }}; /* @@ -2217,20 +2219,21 @@ static OptValues visited_links_values[] = { static char * DTD_recovery_string = RC_TAGSOUP; static OptValues DTD_type_values[] = { /* Old_DTD variable */ - { TRUE, "relaxed (TagSoup mode)", "tagsoup" }, - { FALSE, "strict (SortaSGML mode)", "sortasgml" }, + { TRUE, N_("relaxed (TagSoup mode)"), "tagsoup" }, + { FALSE, N_("strict (SortaSGML mode)"), "sortasgml" }, { 0, 0, 0 }}; static char * select_popups_string = RC_SELECT_POPUPS; static char * images_string = "images"; -static char * images_ignore_all_string = "ignore"; -static char * images_use_label_string = "as labels"; -static char * images_use_links_string = "as links"; +static char * images_ignore_all_string = N_("ignore"); +static char * images_use_label_string = N_("as labels"); +static char * images_use_links_string = N_("as links"); + static char * verbose_images_string = RC_VERBOSE_IMAGES; static OptValues verbose_images_type_values[] = { /* verbose_img variable */ - { FALSE, "OFF", "OFF" }, - { TRUE, "show filename", "ON" }, + { FALSE, N_("OFF"), "OFF" }, + { TRUE, N_("show filename"), "ON" }, { 0, 0, 0 }}; /* @@ -2238,9 +2241,9 @@ static OptValues verbose_images_type_values[] = { */ static char * mbm_string = RC_MULTI_BOOKMARK; static OptValues mbm_values[] = { - { MBM_OFF, "OFF", "OFF" }, - { MBM_STANDARD, "STANDARD", "STANDARD" }, - { MBM_ADVANCED, "ADVANCED", "ADVANCED" }, + { MBM_OFF, N_("OFF"), "OFF" }, + { MBM_STANDARD, N_("STANDARD"), "STANDARD" }, + { MBM_ADVANCED, N_("ADVANCED"), "ADVANCED" }, { 0, 0, 0 }}; static char * single_bookmark_string = RC_BOOKMARK_FILE; @@ -2252,6 +2255,10 @@ static char * assume_char_set_string = RC_ASSUME_CHARSET; static char * display_char_set_string = RC_CHARACTER_SET; static char * raw_mode_string = RC_RAW_MODE; +#ifdef EXP_LOCALE_CHARSET +static char * locale_charset_string = RC_LOCALE_CHARSET; +#endif + /* * File Management Options */ @@ -2260,21 +2267,21 @@ static char * show_dotfiles_string = RC_SHOW_DOTFILES; #ifdef DIRED_SUPPORT static char * dired_list_string = RC_DIR_LIST_STYLE; static OptValues dired_list_values[] = { - { DIRS_FIRST, "Directories first", "dired_dir" }, - { FILES_FIRST, "Files first", "dired_files" }, - { MIXED_STYLE, "Mixed style", "dired_mixed" }, + { DIRS_FIRST, N_("Directories first"), "dired_dir" }, + { FILES_FIRST, N_("Files first"), "dired_files" }, + { MIXED_STYLE, N_("Mixed style"), "dired_mixed" }, { 0, 0, 0 }}; #ifdef LONG_LIST static char * dired_sort_string = RC_DIR_LIST_ORDER; static OptValues dired_sort_values[] = { - { ORDER_BY_NAME, "By name", "dired_by_name" }, - { ORDER_BY_TYPE, "By type", "dired_by_type" }, - { ORDER_BY_SIZE, "By size", "dired_by_size" }, - { ORDER_BY_DATE, "By date", "dired_by_date" }, - { ORDER_BY_MODE, "By mode", "dired_by_mode" }, + { ORDER_BY_NAME, N_("By Name"), "dired_by_name" }, + { ORDER_BY_TYPE, N_("By Type"), "dired_by_type" }, + { ORDER_BY_SIZE, N_("By Size"), "dired_by_size" }, + { ORDER_BY_DATE, N_("By Date"), "dired_by_date" }, + { ORDER_BY_MODE, N_("By Mode"), "dired_by_mode" }, #ifndef NO_GROUPS - { ORDER_BY_USER, "By user", "dired_by_user" }, - { ORDER_BY_GROUP, "By group", "dired_by_group" }, + { ORDER_BY_USER, N_("By User"), "dired_by_user" }, + { ORDER_BY_GROUP, N_("By Group"), "dired_by_group" }, #endif { 0, 0, 0 }}; #endif /* LONG_LIST */ @@ -2282,22 +2289,24 @@ static OptValues dired_sort_values[] = { static char * ftp_sort_string = RC_FILE_SORTING_METHOD; static OptValues ftp_sort_values[] = { - { FILE_BY_NAME, "By Name", "ftp_by_name" }, - { FILE_BY_TYPE, "By Type", "ftp_by_type" }, - { FILE_BY_SIZE, "By Size", "ftp_by_size" }, - { FILE_BY_DATE, "By Date", "ftp_by_date" }, + { FILE_BY_NAME, N_("By Name"), "ftp_by_name" }, + { FILE_BY_TYPE, N_("By Type"), "ftp_by_type" }, + { FILE_BY_SIZE, N_("By Size"), "ftp_by_size" }, + { FILE_BY_DATE, N_("By Date"), "ftp_by_date" }, { 0, 0, 0 }}; +#ifdef USE_READPROGRESS static char * show_rate_string = RC_SHOW_KB_RATE; static OptValues rate_values[] = { - { rateOFF, "Do not show rate", "rate_off" }, - { rateBYTES, "Show Bytes/sec rate", "rate_bytes" }, - { rateKB, "Show KB/sec rate", "rate_kb" }, + { rateOFF, N_("Do not show rate"), "rate_off" }, + { rateBYTES, N_("Show %s/sec rate"), "rate_bytes" }, + { rateKB, N_("Show %s/sec rate"), "rate_kb" }, #ifdef USE_READPROGRESS - { rateEtaBYTES, "Show Bytes/sec, ETA", "rate_eta_bytes" }, - { rateEtaKB, "Show KB/sec, ETA", "rate_eta_kb" }, + { rateEtaBYTES, N_("Show %s/sec, ETA"), "rate_eta_bytes" }, + { rateEtaKB, N_("Show %s/sec, ETA"), "rate_eta_kb" }, #endif { 0, 0, 0 }}; +#endif /* USE_READPROGRESS */ /* * Headers transferred to remote server @@ -2312,7 +2321,7 @@ static char * user_agent_string = RC_USERAGENT; (int) Size, Name, Value, disable_all?disabled_string:disable) #define PutOption(fp, flag, html, name) \ - fprintf(fp,"<option value=\"%s\" %s>%s\n", html, SELECTED(flag), name) + fprintf(fp,"<option value=\"%s\" %s>%s\n", html, SELECTED(flag), gettext(name)) #define BeginSelect(fp, text) \ fprintf(fp,"<select name=\"%s\" %s>\n", text, disable_all?disabled_string:"") @@ -2817,6 +2826,14 @@ PUBLIC int postoptions ARGS1( } } +#ifdef EXP_LOCALE_CHARSET + /* Use locale-based character set: ON/OFF */ + if (!strcmp(data[i].tag, locale_charset_string) + && GetOptValues(bool_values, data[i].value, &code)) { + LYLocaleCharset = (BOOL) code; + } +#endif + /* Display Character Set: SELECT */ if (!strcmp(data[i].tag, display_char_set_string)) { int newval = atoi(data[i].value); @@ -2859,11 +2876,13 @@ PUBLIC int postoptions ARGS1( show_dotfiles = (BOOL) code; } +#ifdef USE_READPROGRESS /* Show Transfer Rate: enumerated value */ if (!strcmp(data[i].tag, show_rate_string) && GetOptValues(rate_values, data[i].value, &code)) { LYTransferRate = code; } +#endif /* USE_READPROGRESS */ /* Preferred Document Character Set: INPUT */ if (!strcmp(data[i].tag, preferred_doc_char_string)) { @@ -2903,9 +2922,12 @@ PUBLIC int postoptions ARGS1( /* * Process the flags: */ - if ( display_char_set_old != current_char_set || - raw_mode_old != LYRawMode || - assume_char_set_changed ) { +#ifdef EXP_LOCALE_CHARSET + LYFindLocaleCharset(); +#endif + if ( display_char_set_old != current_char_set || + raw_mode_old != LYRawMode || + assume_char_set_changed ) { /* * charset settings: the order is essential here. */ @@ -2935,8 +2957,7 @@ PUBLIC int postoptions ARGS1( HTMLSetCharacterHandling(current_char_set); } need_reload = TRUE; - } /* end of charset settings */ - + } /* end of charset settings */ /* * FIXME: Golly gee, we need to write all of this out now, don't we? @@ -3097,6 +3118,8 @@ PRIVATE char *NewSecureValue NOARGS return "?"; } +#define LABEL_LEN 33 + /* * Note: the 'value' we are passing here is a local copy of the "same" string * as is used in LYrcFile.c to index the savable options. @@ -3107,13 +3130,13 @@ PRIVATE void PutLabel ARGS3( char *, value) { if (will_save_rc(value) && !no_option_save) { - fprintf(fp, " %-33s: ", name); + fprintf(fp, " %-*s: ", LABEL_LEN, name); } else { int l = strlen(name); fprintf(fp, " %s", name); fprintf(fp, "%s%-*s: ", - (l < 30) ? " " : "", - (l < 30) ? 32 - l : 3, "(!)"); + (l < (LABEL_LEN-3)) ? " " : "", + (l < (LABEL_LEN-3)) ? (LABEL_LEN-1) - l : 3, "(!)"); } } @@ -3167,6 +3190,19 @@ PRIVATE char *will_save_images NOARGS } /* + * The visited-links menu is used from the visited-links page as well as the + * options page. + */ +PUBLIC void LYMenuVisitedLinks ARGS2( + FILE *, fp0, + int, disable_all) +{ + BeginSelect(fp0, visited_links_string); + PutOptValues(fp0, Visited_Links_As, visited_links_values); + EndSelect(fp0); +} + +/* * Okay, someone wants to change options. So, let's gen up a form for them * and pass it around. Gor, this is ugly. Be a lot easier in Bourne with * "here" documents. :-> @@ -3360,9 +3396,19 @@ PRIVATE int gen_options ARGS1( fprintf(fp0,"\n <em>%s</em>\n", gettext("Display and Character Set")); /*****************************************************************/ +#ifdef EXP_LOCALE_CHARSET + /* Use locale-based character set: ON/OFF */ + PutLabel(fp0, gettext("Use locale-based character set"), locale_charset_string); + BeginSelect(fp0, locale_charset_string); + PutOptValues(fp0, LYLocaleCharset, bool_values); + EndSelect(fp0); +#else +#define LYLocaleCharset FALSE +#endif + /* Display Character Set: SELECT */ PutLabel(fp0, gettext("Display character set"), display_char_set_string); - BeginSelect(fp0, display_char_set_string); + MaybeSelect(fp0, LYLocaleCharset, display_char_set_string); for (i = 0; LYchar_set_names[i]; i++) { char temp[10]; size_t len = strlen(LYchar_set_names[i]); @@ -3585,10 +3631,20 @@ PRIVATE int gen_options ARGS1( #endif /* ENABLE_OPTS_CHANGE_EXEC */ #ifdef USE_READPROGRESS - /* Local Directory Sort: SELECT */ + /* Show transfer rate: SELECT */ PutLabel(fp0, gettext("Show transfer rate"), show_rate_string); BeginSelect(fp0, show_rate_string); - PutOptValues(fp0, LYTransferRate, rate_values); + for (i = 0; rate_values[i].LongName != 0; ++i) { + char *message = NULL; + HTSprintf0(&message, + rate_values[i].LongName, + HTProgressUnits(rate_values[i].value)); + PutOption(fp0, + LYTransferRate == rate_values[i].value, + rate_values[i].HtmlName, + message); + FREE(message); + } EndSelect(fp0); #endif /* USE_READPROGRESS */ @@ -3619,9 +3675,7 @@ PRIVATE int gen_options ARGS1( /* Visited Pages: SELECT */ PutLabel(fp0, gettext("Visited Pages"), visited_links_string); - BeginSelect(fp0, visited_links_string); - PutOptValues(fp0, Visited_Links_As, visited_links_values); - EndSelect(fp0); + LYMenuVisitedLinks(fp0, disable_all); if (!no_lynxcfg_info) { fprintf(fp0, "\n %s<a href=\"%s\">lynx.cfg</a>.\n", diff --git a/src/LYOptions.h b/src/LYOptions.h index b0c3ffad..16b4394e 100644 --- a/src/LYOptions.h +++ b/src/LYOptions.h @@ -21,6 +21,7 @@ extern int popup_choice PARAMS(( popup_choice(cur, line, column, (CONST char **)choices, length, disabled, mouse) #ifndef NO_OPTION_FORMS +extern void LYMenuVisitedLinks PARAMS((FILE * fp0, int disable_all)); extern int postoptions PARAMS((DocInfo *newdoc)); #endif /* !NO_OPTION_FORMS */ diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 4297de76..195edf71 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -1371,12 +1371,15 @@ PRIVATE Config_Type Config_Table [] = PARSE_SET(RC_LIST_NEWS_DATES, LYListNewsDates), PARSE_SET(RC_LIST_NEWS_NUMBERS, LYListNewsNumbers), #endif +#ifdef EXP_LOCALE_CHARSET + PARSE_SET(RC_LOCALE_CHARSET, LYLocaleCharset), +#endif PARSE_STR(RC_LOCAL_DOMAIN, LYLocalDomain), + PARSE_FUN(RC_LOCALHOST_ALIAS, localhost_alias_fun), #if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) PARSE_SET(RC_LOCAL_EXECUTION_LINKS_ALWAYS, local_exec), PARSE_SET(RC_LOCAL_EXECUTION_LINKS_LOCAL, local_exec_on_local_files), #endif - PARSE_FUN(RC_LOCALHOST_ALIAS, localhost_alias_fun), PARSE_STR(RC_LYNX_HOST_NAME, LYHostName), PARSE_FUN(RC_LYNX_SIG_FILE, lynx_sig_file_fun), #ifdef LYNXCGI_LINKS @@ -1465,6 +1468,7 @@ PRIVATE Config_Type Config_Table [] = PARSE_SET(RC_SEEK_FRAG_MAP_IN_CUR, LYSeekFragMAPinCur), PARSE_SET(RC_SET_COOKIES, LYSetCookies), PARSE_SET(RC_SHOW_CURSOR, LYShowCursor), + PARSE_STR(RC_SHOW_KB_NAME, LYTransferName), PARSE_ENU(RC_SHOW_KB_RATE, LYTransferRate, tbl_transfer_rate), PARSE_Env(RC_SNEWS_PROXY, 0), PARSE_Env(RC_SNEWSPOST_PROXY, 0), diff --git a/src/LYrcFile.c b/src/LYrcFile.c index 781d5964..65ba26c6 100644 --- a/src/LYrcFile.c +++ b/src/LYrcFile.c @@ -399,6 +399,9 @@ the following control characters are used for moving and deleting:\n\ \n\ Current lineedit modes are:\n\ ")), +#ifdef EXP_LOCALE_CHARSET + MAYBE_SET(RC_LOCALE_CHARSET, LYLocaleCharset, MSG_ENABLE_LYNXRC), +#endif MAYBE_SET(RC_MAKE_PSEUDO_ALTS_FOR_INLINES, pseudo_inline_alts, MSG_ENABLE_LYNXRC), MAYBE_SET(RC_MAKE_LINKS_FOR_ALL_IMAGES, clickable_images, MSG_ENABLE_LYNXRC), PARSE_MBM(RC_MULTI_BOOKMARK, N_("\ diff --git a/src/LYrcFile.h b/src/LYrcFile.h index ad6c4086..e5ae4548 100644 --- a/src/LYrcFile.h +++ b/src/LYrcFile.h @@ -107,6 +107,7 @@ #define RC_LIST_FORMAT "list_format" #define RC_LIST_NEWS_DATES "list_news_dates" #define RC_LIST_NEWS_NUMBERS "list_news_numbers" +#define RC_LOCALE_CHARSET "locale_charset" #define RC_LOCALHOST_ALIAS "localhost_alias" #define RC_LOCAL_DOMAIN "local_domain" #define RC_LOCAL_EXECUTION_LINKS_ALWAYS "local_execution_links_always_on" @@ -183,6 +184,7 @@ #define RC_SHOW_COLOR "show_color" #define RC_SHOW_CURSOR "show_cursor" #define RC_SHOW_DOTFILES "show_dotfiles" +#define RC_SHOW_KB_NAME "show_kb_name" #define RC_SHOW_KB_RATE "show_kb_rate" #define RC_SNEWSPOST_PROXY "snewspost_proxy" #define RC_SNEWSREPLY_PROXY "snewsreply_proxy" diff --git a/src/UCdomap.c b/src/UCdomap.c index 1e4c6cff..887ee962 100644 --- a/src/UCdomap.c +++ b/src/UCdomap.c @@ -25,6 +25,10 @@ #include <UCDefs.h> #include <LYCharSets.h> +#if defined(EXP_LOCALE_CHARSET) && defined(HAVE_LANGINFO_CODESET) +#include <langinfo.h> +#endif + #include <LYLeaks.h> /* @@ -2129,3 +2133,154 @@ PUBLIC int safeUCGetLYhndl_byMIME ARGS1 (CONST char *, value) return(i); } + +#ifdef EXP_LOCALE_CHARSET + +#if defined(EXP_LOCALE_CHARSET) && !defined(HAVE_LANGINFO_CODESET) +/* + * This is a quick-and-dirty emulator of the nl_langinfo(CODESET) + * function defined in the Single Unix Specification for those systems + * (FreeBSD, etc.) that don't have one yet. It behaves as if it had + * been called after setlocale(LC_CTYPE, ""), that is it looks at + * the locale environment variables. + * + * http://www.opengroup.org/onlinepubs/7908799/xsh/langinfo.h.html + * + * Please extend it as needed and suggest improvements to the author. + * This emulator will hopefully become redundant soon as + * nl_langinfo(CODESET) becomes more widely implemented. + * + * Since the proposed Li18nux encoding name registry is still not mature, + * the output follows the MIME registry where possible: + * + * http://www.iana.org/assignments/character-sets + * + * A possible autoconf test for the availability of nl_langinfo(CODESET) + * can be found in + * + * http://www.cl.cam.ac.uk/~mgk25/unicode.html#activate + * + * Markus.Kuhn@cl.cam.ac.uk -- 2002-03-11 + * Permission to use, copy, modify, and distribute this software + * for any purpose and without fee is hereby granted. The author + * disclaims all warranties with regard to this software. + * + * Latest version: + * + * http://www.cl.cam.ac.uk/~mgk25/ucs/langinfo.c + */ + +/* +#include "langinfo.h" +*/ +typedef int nl_item; +#define CODESET 1 + +#define C_CODESET "US-ASCII" /* Return this as the encoding of the + * C/POSIX locale. Could as well one day + * become "UTF-8". */ + +#define digit(x) ((x) >= '0' && (x) <= '9') + +static char buf[16]; + +PRIVATE char *nl_langinfo(nl_item item) +{ + char *l, *p; + + if (item != CODESET) + return NULL; + + if (((l = getenv("LC_ALL")) && *l) || + ((l = getenv("LC_CTYPE")) && *l) || + ((l = getenv("LANG")) && *l)) { + /* check standardized locales */ + if (!strcmp(l, "C") || !strcmp(l, "POSIX")) + return C_CODESET; + /* check for encoding name fragment */ + if (strstr(l, "UTF") || strstr(l, "utf")) + return "UTF-8"; + if ((p = strstr(l, "8859-"))) { + memcpy(buf, "ISO-8859-\0\0", 12); + p += 5; + if (digit(*p)) { + buf[9] = *p++; + if (digit(*p)) buf[10] = *p++; + return buf; + } + } + if (strstr(l, "KOI8-R")) return "KOI8-R"; + if (strstr(l, "KOI8-U")) return "KOI8-U"; + if (strstr(l, "620")) return "TIS-620"; + if (strstr(l, "2312")) return "GB2312"; + if (strstr(l, "HKSCS")) return "Big5HKSCS"; /* no MIME charset */ + if (strstr(l, "Big5") || strstr(l, "BIG5")) return "Big5"; + if (strstr(l, "GBK")) return "GBK"; /* no MIME charset */ + if (strstr(l, "18030")) return "GB18030"; /* no MIME charset */ + if (strstr(l, "Shift_JIS") || strstr(l, "SJIS")) return "Shift_JIS"; + /* check for conclusive modifier */ + if (strstr(l, "euro")) return "ISO-8859-15"; + /* check for language (and perhaps country) codes */ + if (strstr(l, "zh_TW")) return "Big5"; + if (strstr(l, "zh_HK")) return "Big5HKSCS"; /* no MIME charset */ + if (strstr(l, "zh")) return "GB2312"; + if (strstr(l, "ja")) return "EUC-JP"; + if (strstr(l, "ko")) return "EUC-KR"; + if (strstr(l, "ru")) return "KOI8-R"; + if (strstr(l, "uk")) return "KOI8-U"; + if (strstr(l, "pl") || strstr(l, "hr") || + strstr(l, "hu") || strstr(l, "cs") || + strstr(l, "sk") || strstr(l, "sl")) return "ISO-8859-2"; + if (strstr(l, "eo") || strstr(l, "mt")) return "ISO-8859-3"; + if (strstr(l, "el")) return "ISO-8859-7"; + if (strstr(l, "he")) return "ISO-8859-8"; + if (strstr(l, "tr")) return "ISO-8859-9"; + if (strstr(l, "th")) return "TIS-620"; /* or ISO-8859-11 */ + if (strstr(l, "lt")) return "ISO-8859-13"; + if (strstr(l, "cy")) return "ISO-8859-14"; + if (strstr(l, "ro")) return "ISO-8859-2"; /* or ISO-8859-16 */ + if (strstr(l, "am") || strstr(l, "vi")) return "UTF-8"; + /* Send me further rules if you like, but don't forget that we are + * *only* interested in locale naming conventions on platforms + * that do not already provide an nl_langinfo(CODESET) implementation. */ + return "ISO-8859-1"; /* should perhaps be "UTF-8" instead */ + } + return C_CODESET; +} +#endif /* defined(EXP_LOCALE_CHARSET) && !defined(HAVE_LANGINFO_CODESET) */ + +/* + * If LYLocaleCharset is true, use the current locale to lookup a MIME name + * that corresponds, and use that as the display charset. This feature is + * experimental because while nl_langinfo(CODESET) itself is standardized, + * the return values and their relationship to the locale value is not. + * GNU libiconv happens to give useful values, but other implementations are + * not guaranteed to do this. + * + * Not all Linux versions provide useful information. GNU libc 2.2 returns + * "ANSI_X3.4-1968" + * whether locale is POSIX or en_US.UTF-8. + * + * Another possible thing to investigate is the locale_charset() function + * provided in libiconv 1.5.1. + */ +PUBLIC void LYFindLocaleCharset NOARGS +{ + CTRACE((tfp, "LYFindLocaleCharset(%d)\n", LYLocaleCharset)); + if (LYLocaleCharset) { + char *name = nl_langinfo(CODESET); + if (name != 0) { + int value = UCGetLYhndl_byMIME(name); + if (value >= 0) { + current_char_set = value; + } else { + CTRACE((tfp, "Cannot find a handle for MIME name \"%s\"\n", name)); + LYLocaleCharset = FALSE; + } + } else { + CTRACE((tfp, "Cannot find a MIME name for locale\n")); + LYLocaleCharset = FALSE; + } + } +} +#endif /* EXP_LOCALE_CHARSET */ diff --git a/src/makefile.dos b/src/makefile.dos index e58e1cf5..6c574947 100644 --- a/src/makefile.dos +++ b/src/makefile.dos @@ -53,13 +53,13 @@ MCFLAGS = \ $(SSLINC) \ -I./chrtrans \ -I../WWW/Library/Implementation \ - -I/djgpp/pdcur24 \ + -I/djgpp/pdcur26 \ -I/djgpp/watt32/inc \ -I/djgpp/watt32/inc/sys WWWLIB = \ ../WWW/Library/djgpp/libwww.a \ - /djgpp/pdcur24/lib/pdcurses.a + /djgpp/pdcur26/lib/pdcurses.a LIBS= -L/djgpp/watt32/lib -lwatt -lz -lwmemu |