diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1997-12-18 17:31:01 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1997-12-18 17:31:01 -0500 |
commit | b6c832d07f5a1c68607a9cff0da25cee0de89dad (patch) | |
tree | 46428c4ecb61ce53eccb5b9c367a917e9e6dba9d /src | |
parent | 97d3287af85e3890f03d2a48474de0d1a431b676 (diff) | |
download | lynx-snapshots-b6c832d07f5a1c68607a9cff0da25cee0de89dad.tar.gz |
snapshot of project "lynx", label v2-7-1ac_0-102
Diffstat (limited to 'src')
-rw-r--r-- | src/GridText.c | 8 | ||||
-rw-r--r-- | src/LYBookmark.c | 6 | ||||
-rw-r--r-- | src/LYCharUtils.c | 8 | ||||
-rw-r--r-- | src/LYCurses.c | 43 | ||||
-rw-r--r-- | src/LYEdit.c | 4 | ||||
-rw-r--r-- | src/LYGlobalDefs.h | 4 | ||||
-rw-r--r-- | src/LYMain.c | 22 | ||||
-rw-r--r-- | src/LYOptions.c | 2 | ||||
-rw-r--r-- | src/LYPrint.c | 6 | ||||
-rw-r--r-- | src/LYReadCFG.c | 88 | ||||
-rw-r--r-- | src/LYReadCFG.h | 14 | ||||
-rw-r--r-- | src/LYStrings.c | 35 | ||||
-rw-r--r-- | src/LYStyle.c | 420 | ||||
-rw-r--r-- | src/LYrcFile.c | 22 | ||||
-rw-r--r-- | src/UCAux.c | 4 | ||||
-rw-r--r-- | src/chrtrans/MAKEW32.BAT | 11 | ||||
-rw-r--r-- | src/chrtrans/cp850_uni.tbl | 2 | ||||
-rw-r--r-- | src/chrtrans/makefile.dos | 108 | ||||
-rw-r--r-- | src/makefile.in | 2 | ||||
-rw-r--r-- | src/mktime.c | 42 |
20 files changed, 487 insertions, 364 deletions
diff --git a/src/GridText.c b/src/GridText.c index 2cfae408..1848efa4 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -7155,9 +7155,9 @@ PUBLIC void HText_SubmitForm ARGS4( /* those specials will be trivial */ } else if (UCNeedNotTranslate(form_ptr->value_cs, target_cs)) { /* already ok */ - } else if (UCCanTranslateFromTo(form_ptr->value_cs, target_cs)) { + } else if (UCCanTranslateFromTo(form_ptr->value_cs, target_cs) != TQ_NO) { /* also ok */ - } else if (UCCanTranslateFromTo(target_cs, form_ptr->value_cs)) { + } else if (UCCanTranslateFromTo(target_cs, form_ptr->value_cs) != TQ_NO) { target_cs = form_ptr->value_cs; /* try this */ target_csname = NULL; /* will be set after loop */ } else { @@ -7175,9 +7175,9 @@ PUBLIC void HText_SubmitForm ARGS4( /* those specials will be trivial */ } else if (UCNeedNotTranslate(form_ptr->name_cs, target_cs)) { /* already ok */ - } else if (UCCanTranslateFromTo(form_ptr->name_cs, target_cs)) { + } else if (UCCanTranslateFromTo(form_ptr->name_cs, target_cs) != TQ_NO) { /* also ok */ - } else if (UCCanTranslateFromTo(target_cs, form_ptr->name_cs)) { + } else if (UCCanTranslateFromTo(target_cs, form_ptr->name_cs) != TQ_NO) { target_cs = form_ptr->value_cs; /* try this */ target_csname = NULL; /* will be set after loop */ } else { diff --git a/src/LYBookmark.c b/src/LYBookmark.c index 24fa5614..faacac0a 100644 --- a/src/LYBookmark.c +++ b/src/LYBookmark.c @@ -317,6 +317,9 @@ PUBLIC void save_bookmark_link ARGS2( * Create the bookmark file, if it doesn't exist already, * Otherwise, open the pre-existing bookmark file. - FM */ +#if defined(__DJGPP__) || defined(_WINDOWS) + _fmode = O_TEXT; +#endif /* __DJGPP__ or _WINDOWS */ if (first_time) { /* * Seek it in the home path. - FM @@ -375,6 +378,9 @@ PUBLIC void save_bookmark_link ARGS2( } fclose(fp); +#if defined(__DJGPP__) || defined(_WINDOWS) + _fmode = O_BINARY; +#endif /* __DJGPP__ or _WINDOWS */ /* * If this is a cached bookmark file, set nocache for * it so we'll see the new bookmark link when that diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index 20969f52..4de3728e 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -1083,7 +1083,7 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9( do_ent = FALSE; /* Can't do, caller should figure out what to do... */ - if (!UCCanTranslateFromTo(cs_from, cs_to)) { + if (UCCanTranslateFromTo(cs_from, cs_to) == TQ_NO) { if (cs_to < 0) return NULL; if (!do_ent && no_bytetrans) @@ -3225,7 +3225,7 @@ PRIVATE BOOL LYUCTranslateString ARGS7( return YES; /* Can't do, caller should figure out what to do... */ - else if (!UCCanTranslateFromTo(cs_from, cs_to)) + else if (UCCanTranslateFromTo(cs_from, cs_to) == TQ_NO) return NO; /* ** Start a clean copy of the string, without @@ -3679,7 +3679,7 @@ PUBLIC void LYHandleMETA ARGS4( *cp4 = '\0'; cp4 = cp3; chndl = UCGetLYhndl_byMIME(cp3); - if (UCCanTranslateFromTo(chndl, current_char_set)) { + if (UCCanTranslateFromTo(chndl, current_char_set) != TQ_NO) { chartrans_ok = YES; StrAllocCopy(me->node_anchor->charset, cp4); HTAnchor_setUCInfoStage(me->node_anchor, chndl, @@ -3690,7 +3690,7 @@ PUBLIC void LYHandleMETA ARGS4( * Got something but we don't recognize it. */ chndl = UCLYhndl_for_unrec; - if (UCCanTranslateFromTo(chndl, current_char_set)) { + if (UCCanTranslateFromTo(chndl, current_char_set) != TQ_NO) { chartrans_ok = YES; HTAnchor_setUCInfoStage(me->node_anchor, chndl, UCT_STAGE_PARSER, diff --git a/src/LYCurses.c b/src/LYCurses.c index 3ab3c51c..bea0ad43 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -6,6 +6,7 @@ #include "LYGlobalDefs.h" #include "LYSignal.h" #include "LYClean.h" +#include "LYReadCFG.h" #include "LYStrings.h" #include "LYCharSets.h" #include "UCAux.h" @@ -37,7 +38,7 @@ extern int _NOSHARE(COLS); #endif #if defined(COLOR_CURSES) -int lynx_has_color = 0; +int lynx_has_color = FALSE; #endif /* @@ -236,7 +237,7 @@ PUBLIC void LYbox ARGS2( * specifiy our own ASCII characters for the corners and call * wborder() instead of box(). - kw */ -#ifdef FANCY_CURSES +#ifdef HAVE_WBORDER if (!boxvert || !boxhori) box(win, boxvert, boxhori); else if (boxvert == '*' || boxhori == '*') @@ -560,12 +561,10 @@ PUBLIC int lynx_chg_color ARGS3( int, bg ) { - if (color >= 0 && color < 8 - && fg >= 0 && fg < 16 - && bg >= 0 && bg < 16) { - lynx_color_cfg[color].fg = fg & 7; - lynx_color_cfg[color].bg = bg & 7; - lynx_color_cfg[color].attr = (fg & 8) ? A_BOLD : A_NORMAL; + if (color >= 0 && color < 8) { + lynx_color_cfg[color].fg = (fg > 7) ? (fg & 7) : fg; + lynx_color_cfg[color].bg = (bg > 7) ? (bg & 7) : bg; + lynx_color_cfg[color].attr = ((fg > 7) && (fg & 8)) ? A_BOLD : A_NORMAL; lynx_map_color(color); } else { return -1; @@ -590,13 +589,11 @@ PUBLIC void lynx_standout ARGS1(int, flag) PRIVATE void lynx_init_colors NOARGS { - lynx_has_color = FALSE; - - if (has_colors()) { + if (lynx_has_color) { int n, m; - lynx_has_color = TRUE; - start_color(); + lynx_color_cfg[0].fg = default_fg; + lynx_color_cfg[0].bg = default_bg; for (n = 0; n < sizeof(lynx_color_cfg)/sizeof(lynx_color_cfg[0]); n++) { for (m = 0; m <= 16; m += 8) { @@ -634,7 +631,6 @@ PUBLIC void start_curses NOARGS initscr(); /* start curses */ first_time = FALSE; cbreak(); - noecho(); keypad(stdscr, TRUE); fflush(stdin); fflush(stdout); @@ -651,6 +647,7 @@ PUBLIC void start_curses NOARGS LYCursesON = TRUE; clear(); + noecho(); } #else PUBLIC void start_curses NOARGS @@ -792,17 +789,27 @@ PUBLIC void start_curses NOARGS } #endif +#if defined(USE_COLOR_STYLE) || defined(USE_COLOR_TABLE) + if (has_colors()) { + lynx_has_color = TRUE; + start_color(); +#if HAVE_USE_DEFAULT_COLORS + if (use_default_colors() == OK) { + default_fg = DEFAULT_COLOR; + default_bg = DEFAULT_COLOR; + } +#endif + } +#endif /* USE_COLOR_STYLE || USE_COLOR_TABLE */ + #ifdef USE_COLOR_STYLE - lynx_has_color = has_colors(); - if (lynx_has_color) - start_color(); parse_userstyles(); #endif first_time = FALSE; #if USE_COLOR_TABLE lynx_init_colors(); lynx_called_initscr = TRUE; -#endif /* USE_SLANG */ +#endif /* USE_COLOR_TABLE */ } #endif /* VMS */ diff --git a/src/LYEdit.c b/src/LYEdit.c index 38346c90..6b3c0736 100644 --- a/src/LYEdit.c +++ b/src/LYEdit.c @@ -144,12 +144,16 @@ PUBLIC int edit_current_file ARGS3( filename); #endif /* DOSPATH */ else +#ifdef __DJGPP__ + sprintf(command, "%s %s", editor, HTDOS_name(filename)); +#else sprintf(command, "%s \"%s\"", editor, #ifdef DOSPATH HTDOS_name(filename)); #else filename); #endif /* DOSPATH */ +#endif /* __DJGPP__ */ #endif /* VMS */ if (TRACE) { fprintf(stderr, "LYEdit: %s\n", command); diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index ee2939b6..c66b26bd 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -326,6 +326,10 @@ extern BOOLEAN LYForceSSLCookiesSecure; extern BOOLEAN LYNoCc; extern BOOLEAN LYPreparsedSource; /* Show source as preparsed? */ +#ifdef RAWDOSKEYHACK +extern BOOLEAN raw_dos_key_hack; /* Turn on and off DOS key hack */ +#endif /* RAWDOSKEYHACK */ + #ifndef VMS extern BOOLEAN LYNoCore; #endif /* !VMS */ diff --git a/src/LYMain.c b/src/LYMain.c index 5a6875e3..c3d208cd 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -201,6 +201,9 @@ PUBLIC BOOLEAN system_editor = FALSE; #ifdef USE_EXTERNALS PUBLIC BOOLEAN no_externals = FALSE; #endif +#ifdef RAWDOSKEYHACK +PUBLIC BOOLEAN raw_dos_key_hack = TRUE; +#endif /* RAWDOSKEYHACK */ PUBLIC BOOLEAN no_inside_telnet = FALSE; PUBLIC BOOLEAN no_outside_telnet = FALSE; PUBLIC BOOLEAN no_telnet_port = FALSE; @@ -530,8 +533,6 @@ PUBLIC int main ARGS2( int err; WORD wVerReq; - _fmode = O_BINARY; - wVerReq = MAKEWORD(1,1); err = WSAStartup(wVerReq, &WSAData); @@ -546,7 +547,16 @@ PUBLIC int main ARGS2( #ifdef DJGPP sock_init(); - _fmode = O_BINARY; +#endif + +#if defined(_WINDOWS) || defined(DJGPP) + /* + * To prevent corrupting binary data with _WINDOWS and DJGPP + * we open files and stdout in BINARY mode by default. + * Where necessary we should open and (close!) TEXT mode. + */ + _fmode = O_BINARY; + setmode( fileno( stdout ), O_BINARY ); #endif #ifdef DOSPATH @@ -815,7 +825,8 @@ PUBLIC int main ARGS2( StrAllocCopy(lynx_lss_file, argv[i+1]); i++; } - fprintf(stderr, "LYMain found -lss flag, lss file is %s\n", + if (TRACE) + fprintf(stderr, "LYMain found -lss flag, lss file is %s\n", lynx_lss_file ? lynx_lss_file : "<NONE>"); #endif } @@ -898,7 +909,8 @@ PUBLIC int main ARGS2( if (*cp) StrAllocCopy(lynx_cfg_file, cp); } - fprintf(stderr, "LYMain found -lss flag, lss file is %s\n", + if (TRACE) + fprintf(stderr, "LYMain found -lss flag, lss file is %s\n", lynx_lss_file ? lynx_lss_file : "<NONE>"); #endif } else if (strcmp(buf, "-get_data") == 0) { diff --git a/src/LYOptions.c b/src/LYOptions.c index 5d657a7a..e48ada2e 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -796,7 +796,7 @@ draw_options: if (use_assume_charset) { int i, curval; char ** assume_list; - assume_list = calloc(LYNumCharsets + 1, sizeof(char *)); + assume_list = (char **)calloc(LYNumCharsets + 1, sizeof(char *)); if (!assume_list) { outofmem(__FILE__, "options"); } diff --git a/src/LYPrint.c b/src/LYPrint.c index b466ff74..e4903ede 100644 --- a/src/LYPrint.c +++ b/src/LYPrint.c @@ -223,6 +223,9 @@ PUBLIC int printfile ARGS1( */ switch (type) { case TO_FILE: +#if defined(__DJGPP__) || defined(_WINDOWS) + _fmode = O_TEXT; +#endif /* __DJGPP__ or _WINDOWS */ _statusline(FILENAME_PROMPT); retry: strcpy(filename, sug_filename); /* add suggestion info */ /* make the sug_filename conform to system specs */ @@ -477,6 +480,9 @@ PUBLIC int printfile ARGS1( #else HTAddSugFilename(buffer); #endif /* VMS */ +#if defined(__DJGPP__) || defined(_WINDOWS) + _fmode = O_BINARY; +#endif /* __DJGPP__ or _WINDOWS */ break; case MAIL: diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 070fbcfc..87d31358 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -288,28 +288,16 @@ PRIVATE void add_printer_to_list ARGS2( } } -#if USE_COLOR_TABLE -#ifdef DOSPATH /* I.E. broken curses */ -static char *Color_Strings[16] = -{ - "black", - "blue", - "green", - "cyan", - "red", - "magenta", - "brown", - "lightgray", - "gray", - "brightblue", - "brightgreen", - "brightcyan", - "brightred", - "brightmagenta", - "yellow", - "white" -}; -#else +#if defined(USE_COLOR_STYLE) || defined(USE_COLOR_TABLE) + +#ifdef USE_SLANG +#define COLOR_WHITE 7 +#define COLOR_BLACK 0 +#endif + +int default_fg = COLOR_WHITE; +int default_bg = COLOR_BLACK; + static char *Color_Strings[16] = { "black", @@ -329,22 +317,47 @@ static char *Color_Strings[16] = "brightcyan", "white" }; -#endif /* DOSPATH (broken curses) */ + +#ifdef DOSPATH +/* + * PDCurses (and possibly some other implementations) use a non-ANSI set of + * codes for colors. + */ +PRIVATE int ColorCode ARGS1( + int, color) +{ + static int map[] = { + 0, 4, 2, 6, 1, 5, 3, 7, + 8, 12, 10, 14, 9, 13, 11, 15 }; + return map[n]; +} +#else +#define ColorCode(n) (n) +#endif /* * Validator for COLOR fields. */ -PRIVATE int check_color ARGS1( - char *, color) +PUBLIC int check_color ARGS2( + char *, color, + int, the_default) { int i; + if (!strcasecmp(color, "default")) + return the_default; + if (!strcasecmp(color, "nocolor")) + return NO_COLOR; + for (i = 0; i < 16; i++) { - if (!strcmp(color, Color_Strings[i])) - return i; + if (!strcasecmp(color, Color_Strings[i])) + return ColorCode(i); } - return -1; + return ERR_COLOR; } +#endif /* USE_COLOR_STYLE || USE_COLOR_TABLE */ + +#if defined(USE_COLOR_TABLE) /* * Exit routine for failed COLOR parsing. @@ -358,7 +371,8 @@ Syntax Error parsing COLOR in configuration file:\n\ The line must be of the form:\n\ COLOR:INTEGER:FOREGROUND:BACKGROUND\n\ \n\ -Here FOREGROUND and BACKGROUND must be one of:\n" +Here FOREGROUND and BACKGROUND must be one of:\n\ +The special strings 'nocolor' or 'default', or\n" ); for (i = 0; i < 16; i += 4) { fprintf(stderr, "%16s %16s %16s %16s\n", @@ -412,13 +426,15 @@ PRIVATE void parse_color ARGS1( *bg++ = 0; #if defined(USE_SLANG) - if ((-1 == check_color(fg)) || - (-1 == check_color(bg))) + if ((check_color(fg, default_fg) < 0) || + (check_color(bg, default_bg) < 0)) exit_with_color_syntax(parse_color_line); SLtt_set_color(color, NULL, fg, bg); #else - if (lynx_chg_color(color, check_color(fg), check_color(bg)) < 0) + if (lynx_chg_color(color, + check_color(fg, default_fg), + check_color(bg, default_bg)) < 0) exit_with_color_syntax(parse_color_line); #endif } @@ -1040,6 +1056,14 @@ PUBLIC void read_cfg ARGS1( } break; +#ifdef RAWDOSKEYHACK + case 'R': + if (!strncasecomp(buffer, "RAW_DOS_KEY_HACK:", 17)) { + raw_dos_key_hack = is_true(buffer+17); + } + break; +#endif /* RAWDOSKEYHACK */ + case 'S': if (!strncasecomp(buffer, "SAVE_SPACE:", 11)) { StrAllocCopy(lynx_save_space, buffer+11); diff --git a/src/LYReadCFG.h b/src/LYReadCFG.h index a16ce4ac..7cf805c0 100644 --- a/src/LYReadCFG.h +++ b/src/LYReadCFG.h @@ -1,4 +1,3 @@ - #ifndef LYREADCFG_H #define LYREADCFG_H @@ -6,8 +5,19 @@ #include "LYStructs.h" #endif /* LYSTRUCTS_H */ +#if defined(USE_COLOR_STYLE) || defined(USE_COLOR_TABLE) + +#define DEFAULT_COLOR -1 +#define NO_COLOR -2 +#define ERR_COLOR -3 + +extern int default_fg; +extern int default_bg; + +extern int check_color PARAMS((char * color, int the_default)); +#endif + extern void read_cfg PARAMS((char *cfg_filename)); extern BOOLEAN have_read_cfg; #endif /* LYREADCFG_H */ - diff --git a/src/LYStrings.c b/src/LYStrings.c index 868590df..9e995b39 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -349,7 +349,8 @@ re_read: } #endif /* !USE_SLANG || VMS */ -#ifdef DOSPATH +#ifdef RAWDOSKEYHACK + if (raw_dos_key_hack) { if (c == 0) c = '/'; if (c > 255) { /* handle raw dos keys */ switch (c) @@ -362,7 +363,9 @@ re_read: default: break; } } -#endif + } +#endif /* RAWDOSKEYHACK */ + #ifdef USE_GETCHAR if (c == EOF && errno == EINTR) /* Ctrl-Z causes EINTR in getchar() */ goto re_read; @@ -613,6 +616,34 @@ re_read: c=127; /* backspace key (delete, not Ctrl-H) */ break; #endif /* KEY_BACKSPACE */ +#ifdef KEY_DC + case KEY_DC: + c=REMOVE_KEY; /* delete character */ + break; +#endif /* KEY_DC */ +#ifdef KEY_IC + case KEY_IC: + c=INSERT_KEY; /* insert character */ + break; +#endif /* KEY_IC */ +#ifdef KEY_FIND + case KEY_FIND: + c=FIND_KEY; /* find */ + break; +#endif /* KEY_FIND */ +#ifdef KEY_SELECT + case KEY_SELECT: + c=SELECT_KEY; /* select */ + break; +#endif /* KEY_SELECT */ +#ifdef KEY_F + case KEY_F(1): + c=F1; /* help-key */ + break; + case KEY_F(16): + c=DO_KEY; /* help-key */ + break; +#endif /* KEY_F */ #ifdef NCURSES_MOUSE_VERSION case KEY_MOUSE: diff --git a/src/LYStyle.c b/src/LYStyle.c index a596214e..082f0a6b 100644 --- a/src/LYStyle.c +++ b/src/LYStyle.c @@ -1,6 +1,6 @@ /* character level styles for Lynx * (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-) - * @Id: LYStyle.c 1.13 Wed, 22 Oct 1997 08:29:34 -0600 dickey @ + * @Id: LYStyle.c 1.15 Sat, 13 Dec 1997 16:30:40 -0700 dickey @ */ #include "HTUtils.h" #include "HTML.h" @@ -9,6 +9,7 @@ #include "LYGlobalDefs.h" #include "LYStructs.h" +#include "LYReadCFG.h" #include "LYCurses.h" #include "LYCharUtils.h" #include "AttrList.h" @@ -40,30 +41,14 @@ static char *Mono_Strings[7] = "normal", "bold", "reverse", "underline", "standout", "blink", "dim" }; -/* definitions for the colour attributes we can use */ -static int ncursesColors[8] = { - COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, - COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE -}; - -/* - * Ditto for these strings - RP - */ -static char *Color_Strings[16] = -{ - "black", "red", "green", "brown", "blue", "magenta", "cyan", "lightgray", - "gray", "brightred", "brightgreen", "yellow", "brightblue", "brightmagenta", - "brightcyan", "white" -}; - /* Remember the hash codes for common elements */ -PUBLIC int s_alink=NOSTYLE, s_a=NOSTYLE, s_status=NOSTYLE, - s_label=NOSTYLE, s_value=NOSTYLE, s_high=NOSTYLE, - s_normal=NOSTYLE, s_alert=NOSTYLE, s_title=NOSTYLE; +PUBLIC int s_alink = NOSTYLE, s_a = NOSTYLE, s_status = NOSTYLE, + s_label = NOSTYLE, s_value = NOSTYLE, s_high = NOSTYLE, + s_normal = NOSTYLE, s_alert = NOSTYLE, s_title = NOSTYLE; -/* start somewhere safe */ -PRIVATE int colorPairs=0; -PRIVATE int last_fA=COLOR_WHITE, last_bA=COLOR_BLACK; +/* start somewhere safe */ +PRIVATE int colorPairs = 0; +PRIVATE int last_fA = COLOR_WHITE, last_bA = COLOR_BLACK; #define FREE(x) if (x) {free(x); x = NULL;} @@ -71,80 +56,59 @@ PRIVATE int last_fA=COLOR_WHITE, last_bA=COLOR_BLACK; /* icky parsing of the style options */ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char*,element) { - int i; - int mA=0, fA=COLOR_WHITE, bA=COLOR_BLACK, cA=0; - int newstyle=hash_code(element); - if (TRACE) + int i; + int mA = 0, fA = default_fg, bA = default_bg, cA = A_NORMAL; + int newstyle = hash_code(element); + + if (TRACE) fprintf(stderr, "CSS(PA):style d=%d / h=%d, e=%s\n", style, newstyle,element); - - for (i=0; i<7; i++) - { + + for (i = 0; i <7; i++) + { if (!strcasecmp(Mono_Strings[i], mono)) { - mA = ncursesMono[i]; + mA = ncursesMono[i]; } - } - if (TRACE) + } + if (TRACE) fprintf(stderr, "CSS(CP):%d\n", colorPairs); - /* - * `nocolor' means don't even try to do colour for this - RP - */ - if (!strcasecmp("nocolor", fg)) - { - fA=-1; - bA=-1; - cA=-1; - } - else - { - for (i=0; i<16; i++) - { - if (!strcasecmp(Color_Strings[i], fg)) - { - fA = ncursesColors[i%8]; - /* - * if the string was in the upper 8, then it's - * a bright version, so set the BOLD attribute - */ - cA = (i>=8 ? A_BOLD : 0); - } - } - /* - * Backgrounds are horribly broken under ncurses - RP - */ - for (i=0; i<16; i++) - { - if (!strcasecmp(Color_Strings[i], bg)) - { - bA = ncursesColors[i%8]; - cA |=(i>=8 ? A_BOLD : 0); - } + + fA = check_color(fg, default_fg); + bA = check_color(bg, default_bg); + if (fA == NO_COLOR) { + bA = NO_COLOR; + } else { + if (fA >= COLORS || bA >= COLORS) + cA = A_BOLD; + if (fA >= COLORS) + fA %= COLORS; + if (bA > COLORS) + bA %= COLORS; + } + + /* + * If we have colour, and space to create a new colour attribute, + * and we have a valid colour description, then add this style + */ + if (lynx_has_color && colorPairs < COLOR_PAIRS-1 && fA != NO_COLOR) + { + if (colorPairs <= 0 || fA != last_fA || bA != last_bA) { + colorPairs++; + init_pair(colorPairs, fA, bA); + last_fA = fA; + last_bA = bA; } - } - - /* - * If we have colour, and space to create a new colour attribute, - * and we have a valid colour description, then add this style - */ - if (lynx_has_color && colorPairs < COLOR_PAIRS-1 && fA!=-1) - { - if (colorPairs <= 0 || fA != last_fA || bA != last_bA) { - colorPairs++; - init_pair(colorPairs, fA, bA); - last_fA = fA; - last_bA = bA; - } if (style < DSTYLE_ELEMENTS) setStyle(style, COLOR_PAIR(colorPairs)|cA, cA, mA); setHashStyle(newstyle, COLOR_PAIR(colorPairs)|cA, cA, mA, element); - } - else - { - /* only mono is set */ + } + else + { + /* only mono is set */ if (style < DSTYLE_ELEMENTS) setStyle(style, -1, -1, mA); setHashStyle(newstyle, -1, -1, mA, element); - } + } } /* parse a style option of the format @@ -152,11 +116,11 @@ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char* */ PRIVATE void parse_style ARGS1(char*,buffer) { - char *tmp = strchr(buffer, ':'); - char *element, *mono, *fg, *bg; - - if(!tmp) - { + char *tmp = strchr(buffer, ':'); + char *element, *mono, *fg, *bg; + + if(!tmp) + { fprintf (stderr, "\ Syntax Error parsing style in lss file:\n\ [%s]\n\ @@ -178,90 +142,100 @@ where OBJECT is one of EM,STRONG,B,I,U,BLINK etc.\n\n", buffer); exit(-1); } exit(1); - } - { - char *i; - for (i=buffer; *i; *i++=tolower(*i)); - } - *tmp='\0'; - element=buffer; - - mono=tmp+1; - tmp=strchr(mono, ':'); - - if (!tmp) { fg="nocolor"; bg="nocolor"; } - else - { - *tmp='\0'; - fg=tmp+1; - tmp=strchr(fg, ':'); - if (!tmp) bg="black"; - else {*tmp='\0'; bg=tmp+1;} - } - - if (TRACE) + } + { + char *i; + for (i = buffer; *i; *i++ = tolower(*i)) + ; + } + *tmp = '\0'; + element = buffer; + + mono = tmp + 1; + tmp = strchr(mono, ':'); + + if (!tmp) + { + fg = "nocolor"; + bg = "nocolor"; + } + else + { + *tmp = '\0'; + fg = tmp+1; + tmp = strchr(fg, ':'); + if (!tmp) + bg = "default"; + else { - int bucket = hash_code(element); - fprintf(stderr, "CSSPARSE:%s => %d %s\n", - element, bucket, - (hashStyles[bucket].name ? "used" : "")); + *tmp = '\0'; + bg = tmp + 1; } - - strtolower(element); - - /* - * We use some pseudo-elements, so catch these first - */ - if (!strncasecmp(element, "alink", 5)) /* active link */ - { + } + + if (TRACE) + { + int bkt = hash_code(element); + fprintf(stderr, "CSSPARSE:%s => %d %s\n", + element, bkt, + (hashStyles[bkt].name ? "used" : "")); + } + + strtolower(element); + + /* + * We use some pseudo-elements, so catch these first + */ + if (!strncasecmp(element, "alink", 5)) /* active link */ + { parse_attributes(mono,fg,bg,DSTYLE_ALINK,"alink"); - } - else if (!strcasecmp(element, "a")) /* normal link */ - { + } + else if (!strcasecmp(element, "a")) /* normal link */ + { parse_attributes(mono,fg,bg, DSTYLE_LINK,"a"); parse_attributes(mono,fg,bg, HTML_A,"a"); - } - else if (!strncasecmp(element, "status", 4)) /* status bar */ - { + } + else if (!strncasecmp(element, "status", 4)) /* status bar */ + { parse_attributes(mono,fg,bg, DSTYLE_STATUS,"status"); - } - else if (!strncasecmp(element, "label", 6)) /* [INLINE]'s */ - { + } + else if (!strncasecmp(element, "label", 6)) /* [INLINE]'s */ + { parse_attributes(mono,fg,bg,DSTYLE_OPTION,"label"); - } - else if (!strncasecmp(element, "value", 5)) /* [INLINE]'s */ - { + } + else if (!strncasecmp(element, "value", 5)) /* [INLINE]'s */ + { parse_attributes(mono,fg,bg,DSTYLE_VALUE,"value"); - } - else if (!strncasecmp(element, "high", 4)) /* [INLINE]'s */ - { + } + else if (!strncasecmp(element, "high", 4)) /* [INLINE]'s */ + { parse_attributes(mono,fg,bg,DSTYLE_HIGH,"high"); - } - else if (!strcmp(element, "normal")) /* added - kw */ - { + } + else if (!strcmp(element, "normal")) /* added - kw */ + { parse_attributes(mono,fg,bg,DSTYLE_NORMAL,"html"); - } - /* this may vanish */ - else if (!strncasecmp(element, "candy", 5)) /* [INLINE]'s */ - { + } + /* this may vanish */ + else if (!strncasecmp(element, "candy", 5)) /* [INLINE]'s */ + { parse_attributes(mono,fg,bg,DSTYLE_CANDY,"candy"); - } - /* Ok, it must be a HTML element, so look through the list until we - * find it - */ - else - { + } + /* Ok, it must be a HTML element, so look through the list until we + * find it + */ + else + { #if !defined(USE_HASH) int i; - for (i=0; i<HTML_ELEMENTS; i++) + for (i = 0; i <HTML_ELEMENTS; i++) { - if (!strcasecmp (HTML_dtd.tags[i].name, element)) - { + if (!strcasecmp (HTML_dtd.tags[i].name, element)) + { if (TRACE) - fprintf(stderr, "PARSECSS:applying style <%s,%s,%s> for HTML_%s\n",mono,fg,bg,HTML_dtd.tags[i].name); - parse_attributes(mono,fg,bg,i+STARTAT,element); + fprintf(stderr, "PARSECSS:applying style <%s,%s,%s> for HTML_%s\n",mono,fg,bg,HTML_dtd.tags[i].name); + parse_attributes(mono,fg,bg,i+STARTAT,element); break; - } + } } #else int element_number = -1; @@ -275,7 +249,7 @@ where OBJECT is one of EM,STRONG,B,I,U,BLINK etc.\n\n", buffer); else parse_attributes(mono,fg,bg, DSTYLE_ELEMENTS,element); #endif - } + } } PRIVATE void free_colorstylestuff NOARGS @@ -297,31 +271,31 @@ PUBLIC void style_initialiseHashTable NOARGS { int i; static int firsttime = 1; - - for (i=0; i<CSHASHSIZE; i++) + + for (i = 0; i <CSHASHSIZE; i++) { if (firsttime) - hashStyles[i].name=NULL; + hashStyles[i].name = NULL; else FREE(hashStyles[i].name); - hashStyles[i].color=-1; - hashStyles[i].cattr=-1; - hashStyles[i].mono=-1; + hashStyles[i].color = -1; + hashStyles[i].cattr = -1; + hashStyles[i].mono = -1; } if (firsttime) { firsttime = 0; atexit(free_colorstylestuff); } - s_high=hash_code("high"); - s_alink=hash_code("alink"); - s_value=hash_code("value"); - s_label=hash_code("label"); - s_a=hash_code("a"); - s_status=hash_code("status"); - s_alert=hash_code("alert"); - s_title=hash_code("title"); + s_high = hash_code("high"); + s_alink = hash_code("alink"); + s_value = hash_code("value"); + s_label = hash_code("label"); + s_a = hash_code("a"); + s_status = hash_code("status"); + s_alert = hash_code("alert"); + s_title = hash_code("title"); } - + /* because curses isn't started when we parse the config file, we * need to remember the STYLE: lines we encounter and parse them * after curses has started @@ -332,13 +306,13 @@ PUBLIC void parse_userstyles NOARGS { char *name; HTList *cur = lss_styles; - colorPairs=0; + colorPairs = 0; style_initialiseHashTable(); /* set our styles to be the same as vanilla-curses-lynx */ initialise_default_stylesheet(); - while ((name=HTList_nextObject(cur)) != NULL) + while ((name = HTList_nextObject(cur)) != NULL) { if (TRACE) fprintf(stderr, "LSS:%s\n", name ? name : "!?! empty !?!"); @@ -351,10 +325,10 @@ PUBLIC void parse_userstyles NOARGS /* Add a STYLE: option line to our list */ PUBLIC void HStyle_addStyle ARGS1(char*,buffer) { - char *name=NULL; + char *name = NULL; StrAllocCopy(name, buffer); - if (lss_styles==NULL) - lss_styles=HTList_new(); + if (lss_styles == NULL) + lss_styles = HTList_new(); strtolower(name); if (TRACE) fprintf(stderr, "READCSS:%s\n", name ? name : "!?! empty !?!"); @@ -367,10 +341,10 @@ PUBLIC void style_deleteStyleList NOARGS while ((name = HTList_removeLastObject(lss_styles)) != NULL) FREE(name); HTList_delete (lss_styles); - lss_styles=NULL; + lss_styles = NULL; } -char* default_stylesheet[]={ +char* default_stylesheet[] = { "a:bold", "em:bold", "strong:bold", "b:bold", "i:bold", "alink:reverse", "status:reverse", NULL }; @@ -378,55 +352,55 @@ char* default_stylesheet[]={ PUBLIC void style_defaultStyleSheet NOARGS { int i; - for (i=0; default_stylesheet[i]; i++) + for (i = 0; default_stylesheet[i]; i++) HStyle_addStyle(default_stylesheet[i]); } PUBLIC int style_readFromFile ARGS1(char*, file) { - FILE *fh; - char buffer[1024]; - int len; - + FILE *fh; + char buffer[1024]; + int len; + + if (TRACE) + fprintf(stderr, "CSS:Reading styles from file: %s\n", file ? file : "?!? empty ?!?"); + if (file == NULL || *file == '\0') + return -1; + fh = fopen(file, "r"); + if (!fh) + { + /* this should probably be an alert or something */ if (TRACE) - fprintf(stderr, "CSS:Reading styles from file: %s\n", file ? file : "?!? empty ?!?"); - if (file == NULL || *file == '\0') - return -1; - fh=fopen(file, "r"); - if (!fh) - { -/* this should probably be an alert or something */ - if (TRACE) - fprintf(stderr, "CSS:Can't open style file %s, using defaults\n", file); - return -1; - } - - style_initialiseHashTable(); - style_deleteStyleList(); + fprintf(stderr, "CSS:Can't open style file %s, using defaults\n", file); + return -1; + } - while (!feof(fh) - && fgets(buffer, sizeof(buffer)-1, fh) != NULL) - { - len = strlen(buffer); - if (len > 0) { - if (buffer[len-1] == '\n' || buffer[len-1] == '\r') - buffer[len-1]='\0'; /* hack */ - else - buffer[1023]='\0'; /* hack */ - } - LYTrimTail(buffer); - LYTrimHead(buffer); - if (buffer[0] != '#' && (len = strlen(buffer)) > 0) - HStyle_addStyle(buffer); + style_initialiseHashTable(); + style_deleteStyleList(); + + while (!feof(fh) + && fgets(buffer, sizeof(buffer)-1, fh) != NULL) + { + len = strlen(buffer); + if (len > 0) { + if (buffer[len-1] == '\n' || buffer[len-1] == '\r') + buffer[len-1] = '\0'; /* hack */ + else + buffer[sizeof(buffer)-1] = '\0'; /* hack */ } - /* the default styles are added after the user styles in order - ** that they come before them <grin> RP - */ -/* style_defaultStyleSheet(); */ - - fclose (fh); - if (LYCursesON) - parse_userstyles(); - return 0; + LYTrimTail(buffer); + LYTrimHead(buffer); + if (buffer[0] != '#' && (len = strlen(buffer)) > 0) + HStyle_addStyle(buffer); + } + /* the default styles are added after the user styles in order + ** that they come before them <grin> RP + */ + /* style_defaultStyleSheet(); */ + + fclose (fh); + if (LYCursesON) + parse_userstyles(); + return 0; } #endif /* USE_COLOR_STYLE */ diff --git a/src/LYrcFile.c b/src/LYrcFile.c index e83d72cb..2ba688dd 100644 --- a/src/LYrcFile.c +++ b/src/LYrcFile.c @@ -34,6 +34,9 @@ PUBLIC void read_rc NOPARAMS sprintf(rcfile, "%s/.lynxrc", Home_Dir()); #endif /* VMS */ #endif /* DJGPP */ +#if defined(__DJGPP__) || defined(_WINDOWS) + _fmode = O_TEXT; +#endif /* __DJGPP__ or _WINDOWS */ /* * Open the RC file for reading. @@ -663,7 +666,8 @@ PUBLIC int save_rc NOPARAMS */ fprintf(fp, "\ # preferred_language specifies the language in MIME notation (e.g., en,\n\ -# fr) which Lynx will indicate you prefer in requests to http servers.\n\ +# fr, may be a comma-separated list in decreasing preference)\n\ +# which Lynx will indicate you prefer in requests to http servers.\n\ # If a file in that language is available, the server will send it.\n\ # Otherwise, the server will send the file in it's default language.\n"); fprintf(fp, "preferred_language=%s\n\n", (language ? language : "")); @@ -675,10 +679,15 @@ PUBLIC int save_rc NOPARAMS # preferred_charset specifies the character set in MIME notation (e.g.,\n\ # ISO-8859-2, ISO-8859-5) which Lynx will indicate you prefer in requests\n\ # to http servers using an Accept-Charset header. The value should NOT\n\ -# include ISO-8859-1 or US-ASCII, since those values are always assumed by\n\ -# default. If a file in that character set is available, the server will\n\ -# send it. Otherwise, the server will send the file in ISO-8859-1 or\n\ -# US-ASCII.\n"); +# include ISO-8859-1 or US-ASCII, since those values are always assumed\n\ +# by default. May be a comma-separated list.\n\ +# If a file in that character set is available, the server will send it.\n\ +# If no Accept-Charset header is present, the default is that any\n\ +# character set is acceptable. If an Accept-Charset header is present,\n\ +# and if the server cannot send a response which is acceptable\n\ +# according to the Accept-Charset header, then the server SHOULD send\n\ +# an error response, though the sending of an unacceptable response\n\ +# is also allowed.\n"); fprintf(fp, "preferred_charset=%s\n\n", (pref_charset ? pref_charset : "")); @@ -896,6 +905,9 @@ PUBLIC int save_rc NOPARAMS * Close the RC file. */ fclose(fp); +#if defined(__DJGPP__) || defined(_WINDOWS) + _fmode = O_BINARY; +#endif /* __DJGPP__ or _WINDOWS */ #ifdef VMS /* diff --git a/src/UCAux.c b/src/UCAux.c index 98fb9e37..d0323233 100644 --- a/src/UCAux.c +++ b/src/UCAux.c @@ -261,7 +261,7 @@ PUBLIC void UCSetTransParams ARGS5( ** treated as already Unicode here. */ pT->trans_to_uni = (!intm_ucs && - UCCanUniTranslateFrom(cs_in)); + UCCanUniTranslateFrom(cs_in) != TQ_NO); /* ** We set this if we are translating to Unicode and ** what normally are low value control characters in @@ -329,7 +329,7 @@ PUBLIC void UCSetTransParams ARGS5( */ pT->trans_from_uni = (use_ucs && !pT->do_8bitraw && !pT->use_raw_char_in && - UCCanTranslateUniTo(cs_out)); + UCCanTranslateUniTo(cs_out) != TQ_NO); } } } diff --git a/src/chrtrans/MAKEW32.BAT b/src/chrtrans/MAKEW32.BAT index 4a3afaf9..009de876 100644 --- a/src/chrtrans/MAKEW32.BAT +++ b/src/chrtrans/MAKEW32.BAT @@ -26,4 +26,13 @@ makeuctb mnem_suni.tbl > mnem_suni.h makeuctb rfc_suni.tbl > rfc_suni.h makeuctb def7_uni.tbl > def7_uni.h makeuctb koi8r_uni.tbl > koi8r_uni.h - +makeuctb mac_uni.tbl > mac_uni.h +makeuctb next_uni.tbl > next_uni.h +makeuctb dmcs_uni.tbl > dmcs_uni.h +makeuctb cp869_uni.tbl > cp869_uni.h +makeuctb cp864_uni.tbl > cp864_uni.h +makeuctb cp862_uni.tbl > cp862_uni.h +makeuctb cp737_uni.tbl > cp737_uni.h +makeuctb cp1256_uni.tbl > cp1256_uni.h +makeuctb cp1255_uni.tbl > cp1255_uni.h +makeuctb cp1253_uni.tbl > cp1253_uni.h diff --git a/src/chrtrans/cp850_uni.tbl b/src/chrtrans/cp850_uni.tbl index 759bf950..a8e66e15 100644 --- a/src/chrtrans/cp850_uni.tbl +++ b/src/chrtrans/cp850_uni.tbl @@ -18,7 +18,7 @@ OIBM PC codepage 850 # General notes: none # # Format: Three tab-separated columns -# Column #1 is the cp1255_WinHebrew code (in hex) +# Column #1 is the cp850_DOSLatin1 code (in hex) # Column #2 is the Unicode (in hex as U+XXXX) # Column #3 is the Unicode name (follows a comment sign, '#') # diff --git a/src/chrtrans/makefile.dos b/src/chrtrans/makefile.dos index 6a99e87f..deb0987c 100644 --- a/src/chrtrans/makefile.dos +++ b/src/chrtrans/makefile.dos @@ -25,30 +25,40 @@ FONTMAP_INC = iso01_un.h CHRTR= -TABLES= $(CHRTR)iso01_un.h \ - $(CHRTR)iso02_un.h \ +TABLES= $(CHRTR)iso01_uni.h \ $(CHRTR)def7_uni.h \ - $(CHRTR)iso03_un.h \ - $(CHRTR)iso04_un.h \ - $(CHRTR)iso05_un.h \ - $(CHRTR)iso06_un.h \ - $(CHRTR)iso07_un.h \ - $(CHRTR)iso08_un.h \ - $(CHRTR)iso09_un.h \ - $(CHRTR)iso10_un.h \ - $(CHRTR)koi8r_un.h \ - $(CHRTR)cp437_un.h \ - $(CHRTR)cp850_un.h \ - $(CHRTR)cp852_un.h \ - $(CHRTR)cp866_un.h \ - $(CHRTR)cp1250_u.h \ - $(CHRTR)cp1251_u.h \ - $(CHRTR)cp1252_u.h \ - $(CHRTR)viscii_u.h \ + $(CHRTR)iso02_uni.h \ + $(CHRTR)cp1252_uni.h \ + $(CHRTR)dmcs_uni.h \ + $(CHRTR)mac_uni.h \ + $(CHRTR)next_uni.h \ + $(CHRTR)koi8r_uni.h \ + $(CHRTR)viscii_uni.h \ + $(CHRTR)cp437_uni.h \ + $(CHRTR)cp850_uni.h \ + $(CHRTR)cp852_uni.h \ + $(CHRTR)cp866_uni.h \ + $(CHRTR)cp737_uni.h \ + $(CHRTR)cp869_uni.h \ + $(CHRTR)cp864_uni.h \ + $(CHRTR)cp862_uni.h \ + $(CHRTR)cp1250_uni.h \ + $(CHRTR)cp1251_uni.h \ + $(CHRTR)cp1253_uni.h \ + $(CHRTR)cp1255_uni.h \ + $(CHRTR)cp1256_uni.h \ + $(CHRTR)iso03_uni.h \ + $(CHRTR)iso04_uni.h \ + $(CHRTR)iso05_uni.h \ + $(CHRTR)iso06_uni.h \ + $(CHRTR)iso07_uni.h \ + $(CHRTR)iso08_uni.h \ + $(CHRTR)iso09_uni.h \ + $(CHRTR)iso10_uni.h \ $(CHRTR)utf8_uni.h \ $(CHRTR)rfc_suni.h \ - $(CHRTR)mnemonic.h \ - $(CHRTR)mnem_sun.h + $(CHRTR)mnemonic_suni.h \ + $(CHRTR)mnem_suni.h default: $(TABLES) @@ -61,28 +71,40 @@ makeuctb.exe: makeuctb.c UCkd.h .tbl.h: ./makeuctb $*.tbl > $@ -iso01_un.h: iso01_un.tbl makeuctb.exe -iso02_un.h: iso02_un.tbl makeuctb.exe -def7_uni.h: def7_uni.tbl makeuctb.exe -iso03_un.h: iso03_un.tbl makeuctb.exe -iso04_un.h: iso04_un.tbl makeuctb.exe -iso05_un.h: iso05_un.tbl makeuctb.exe -iso06_un.h: iso06_un.tbl makeuctb.exe -iso07_un.h: iso07_un.tbl makeuctb.exe -iso08_un.h: iso08_un.tbl makeuctb.exe -iso09_un.h: iso09_un.tbl makeuctb.exe -iso10_un.h: iso10_un.tbl makeuctb.exe -koi8r_un.h: koi8r_un.tbl makeuctb.exe -cp437_un.h: cp437_un.tbl makeuctb.exe -cp850_un.h: cp850_un.tbl makeuctb.exe -cp852_un.h: cp852_un.tbl makeuctb.exe -cp1250_u.h: cp1250_u.tbl makeuctb.exe -cp1251_u.h: cp1251_u.tbl makeuctb.exe -cp1252_u.h: cp1252_u.tbl makeuctb.exe -utf8_uni.h: utf8_uni.tbl makeuctb.exe -mnemonic.h: mnemonic.tbl makeuctb.exe -mnem_sun.h: mnem_sun.tbl makeuctb.exe -rfc_suni.h: rfc_suni.tbl makeuctb.exe +def7_uni.h: def7_uni.tbl makeuctb.exe +iso01_uni.h: iso01_uni.tbl makeuctb.exe +iso02_uni.h: iso02_uni.tbl makeuctb.exe +cp1252_uni.h: cp1252_uni.tbl makeuctb.exe +dmcs_uni.h: dmcs_uni.tbl makeuctb.exe +mac_uni.h: mac_uni.tbl makeuctb.exe +next_uni.h: next_uni.tbl makeuctb.exe +koi8r_uni.h: koi8r_uni.tbl makeuctb.exe +viscii_uni.h: viscii_uni.tbl makeuctb.exe +cp437_uni.h: cp437_uni.tbl makeuctb.exe +cp850_uni.h: cp850_uni.tbl makeuctb.exe +cp852_uni.h: cp852_uni.tbl makeuctb.exe +cp866_uni.h: cp866_uni.tbl makeuctb.exe +cp737_uni.h: cp737_uni.tbl makeuctb.exe +cp869_uni.h: cp869_uni.tbl makeuctb.exe +cp864_uni.h: cp864_uni.tbl makeuctb.exe +cp862_uni.h: cp862_uni.tbl makeuctb.exe +cp1250_uni.h: cp1250_uni.tbl makeuctb.exe +cp1251_uni.h: cp1251_uni.tbl makeuctb.exe +cp1253_uni.h: cp1253_uni.tbl makeuctb.exe +cp1255_uni.h: cp1255_uni.tbl makeuctb.exe +cp1256_uni.h: cp1256_uni.tbl makeuctb.exe +iso03_uni.h: iso03_uni.tbl makeuctb.exe +iso04_uni.h: iso04_uni.tbl makeuctb.exe +iso05_uni.h: iso05_uni.tbl makeuctb.exe +iso06_uni.h: iso06_uni.tbl makeuctb.exe +iso07_uni.h: iso07_uni.tbl makeuctb.exe +iso08_uni.h: iso08_uni.tbl makeuctb.exe +iso09_uni.h: iso09_uni.tbl makeuctb.exe +iso10_uni.h: iso10_uni.tbl makeuctb.exe +utf8_uni.h: utf8_uni.tbl makeuctb.exe +mnemonic_suni.h: mnemonic_suni.tbl makeuctb.exe +mnem_suni.h: mnem_suni.tbl makeuctb.exe +rfc_suni.h: rfc_suni.tbl makeuctb.exe clean: rm -f makeuctb.exe makeuctb *.o *un.h *u.h *c.h *i.h diff --git a/src/makefile.in b/src/makefile.in index e6f436f5..c9e73326 100644 --- a/src/makefile.in +++ b/src/makefile.in @@ -78,6 +78,8 @@ message: do_chartrans_stuff: -cd chrtrans && $(MAKE) \ SITE_DEFS="$(SITE_DEFS)" \ + CFLAGS="$(CFLAGS)" \ + CPPFLAGS="$(CPPFLAGS)" \ CC="$(CC)" tables lint: diff --git a/src/mktime.c b/src/mktime.c index 0db7f122..46ca944b 100644 --- a/src/mktime.c +++ b/src/mktime.c @@ -27,9 +27,9 @@ mkgmtime(t) register struct tm *t; { register short month, year; - register long time; + register time_t result; static int m_to_d[12] = -{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; + {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; month = t->tm_mon; year = t->tm_year + month / 12 + 1900; @@ -39,22 +39,22 @@ register struct tm *t; year -= 1; month += 12; } - time = (year - 1970) * 365 + (year - 1969) / 4 + m_to_d[month]; - time = (year - 1970) * 365 + m_to_d[month]; + result = (year - 1970) * 365 + (year - 1969) / 4 + m_to_d[month]; + result = (year - 1970) * 365 + m_to_d[month]; if (month <= 1) year -= 1; - time += (year - 1968) / 4; - time -= (year - 1900) / 100; - time += (year - 1600) / 400; - time += t->tm_mday; - time -= 1; - time *= 24; - time += t->tm_hour; - time *= 60; - time += t->tm_min; - time *= 60; - time += t->tm_sec; - return(time); + result += (year - 1968) / 4; + result -= (year - 1900) / 100; + result += (year - 1600) / 400; + result += t->tm_mday; + result -= 1; + result *= 24; + result += t->tm_hour; + result *= 60; + result += t->tm_min; + result *= 60; + result += t->tm_sec; + return(result); } /* @@ -66,12 +66,12 @@ time_t mktime(t) struct tm *t; { - time_t now; + time_t result; tzset(); - now = mkgmtime(t) + timezone; + result = mkgmtime(t) + timezone; if (t->tm_isdst > 0 - || (t->tm_isdst < 0 && localtime(&now)->tm_isdst)) - now -= 3600; - return(now); + || (t->tm_isdst < 0 && localtime(&result)->tm_isdst)) + result -= 3600; + return(result); } |