diff options
| author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-10-17 21:26:25 -0400 |
|---|---|---|
| committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-10-17 21:26:25 -0400 |
| commit | 227916a0760fb81d8dd539790a76bf76eceb8e4e (patch) | |
| tree | 897052dba6f5691874e9beaa49c96760fe834476 /src | |
| parent | 64c4d93e6c1d2751c8517e10192e585db0cbce82 (diff) | |
| download | lynx-snapshots-227916a0760fb81d8dd539790a76bf76eceb8e4e.tar.gz | |
snapshot of project "lynx", label v2-8-1pre_11
Diffstat (limited to 'src')
| -rw-r--r-- | src/HTML.c | 2 | ||||
| -rw-r--r-- | src/LYCookie.c | 45 | ||||
| -rw-r--r-- | src/LYExtern.c | 7 | ||||
| -rw-r--r-- | src/LYMap.c | 2 | ||||
| -rw-r--r-- | src/LYOptions.c | 40 | ||||
| -rw-r--r-- | src/LYReadCFG.c | 13 | ||||
| -rw-r--r-- | src/LYShowInfo.c | 2 | ||||
| -rw-r--r-- | src/LYrcFile.c | 4 | ||||
| -rw-r--r-- | src/chrtrans/makeuctb.c | 46 | ||||
| -rw-r--r-- | src/makefile.in | 1 |
10 files changed, 95 insertions, 67 deletions
@@ -4458,7 +4458,7 @@ PRIVATE void HTML_start_element ARGS6( if (I.type && !strcasecomp(I.type, "hidden")) { me->HiddenValue = TRUE; - current_char_set = 0; /* Default ISO-Latin1 */ + current_char_set = LATIN1; /* Default ISO-Latin1 */ LYUseDefaultRawMode = TRUE; HTMLSetCharacterHandling(current_char_set); } diff --git a/src/LYCookie.c b/src/LYCookie.c index 2e0b40a2..d3e26c25 100644 --- a/src/LYCookie.c +++ b/src/LYCookie.c @@ -60,6 +60,10 @@ #include <LYLeaks.h> +#define max_cookies_domain 50 +#define max_cookies_global 500 +#define max_cookies_buffer 4096 + /* ** The first level of the cookie list is a list indexed by the domain ** string; cookies with the same domain will be placed in the same @@ -474,7 +478,7 @@ PRIVATE void store_cookie ARGS3( /* * Don't add the cookie if we're over the domain's limit. - FM */ - } else if (HTList_count(cookie_list) > 50) { + } else if (HTList_count(cookie_list) > max_cookies_domain) { CTRACE(tfp, "store_cookie: Domain's cookie limit exceeded! Rejecting cookie.\n"); freeCookie(co); co = NULL; @@ -482,7 +486,7 @@ PRIVATE void store_cookie ARGS3( /* * Don't add the cookie if we're over the total cookie limit. - FM */ - } else if (total_cookies > 500) { + } else if (total_cookies > max_cookies_global) { CTRACE(tfp, "store_cookie: Total cookie limit exceeded! Rejecting cookie.\n"); freeCookie(co); co = NULL; @@ -749,7 +753,7 @@ PRIVATE void LYProcessSetCookies ARGS6( if (SetCookie && *p) { CTRACE(tfp, "LYProcessSetCookies: Using Set-Cookie2 header.\n"); } - while (NumCookies <= 50 && *p) { + while (NumCookies <= max_cookies_domain && *p) { attr_start = attr_end = value_start = value_end = NULL; p = LYSkipCBlanks(p); /* @@ -926,8 +930,8 @@ PRIVATE void LYProcessSetCookies ARGS6( if (value_end > value_start) { int value_len = (value_end - value_start); - if (value_len > 4096) { - value_len = 4096; + if (value_len > max_cookies_buffer) { + value_len = max_cookies_buffer; } value = (char *)calloc(1, value_len + 1); if (value == NULL) @@ -1152,7 +1156,7 @@ PRIVATE void LYProcessSetCookies ARGS6( * If we've started a cookie, and it's not too big, * save it in the CombinedCookies list. - FM */ - if (length <= 4096 && cur_cookie != NULL) { + if (length <= max_cookies_buffer && cur_cookie != NULL) { /* * Assume version 1 if not set to that or higher. - FM */ @@ -1198,7 +1202,9 @@ PRIVATE void LYProcessSetCookies ARGS6( * Add any final SetCookie2 cookie to the CombinedCookie list * if we are within the length limit. - FM */ - if (NumCookies <= 50 && length <= 4096 && cur_cookie != NULL) { + if (NumCookies <= max_cookies_domain + && length <= max_cookies_buffer + && cur_cookie != NULL) { if (cur_cookie->version < 1) { cur_cookie->version = 1; } @@ -1208,9 +1214,12 @@ PRIVATE void LYProcessSetCookies ARGS6( (cur_cookie->name ? cur_cookie->name : "[no name]"), (cur_cookie->value ? cur_cookie->value : "[no value]")); CTRACE(tfp, " due to excessive %s%s%s\n", - (length > 4096 ? "length" : ""), - (length > 4096 && NumCookies > 50 ? " and " : ""), - (NumCookies > 50 ? "number!\n" : "!\n")); + (length > max_cookies_buffer ? "length" : ""), + (length > max_cookies_buffer && + NumCookies > max_cookies_domain + ? " and " + : ""), + (NumCookies > max_cookies_domain ? "number!\n" : "!\n")); freeCookie(cur_cookie); cur_cookie = NULL; } @@ -1226,7 +1235,7 @@ PRIVATE void LYProcessSetCookies ARGS6( if (SetCookie2 && *p) { CTRACE(tfp, "LYProcessSetCookies: Using Set-Cookie header.\n"); } - while (NumCookies <= 50 && *p) { + while (NumCookies <= max_cookies_domain && *p) { attr_start = attr_end = value_start = value_end = NULL; p = LYSkipCBlanks(p); /* @@ -1400,8 +1409,8 @@ PRIVATE void LYProcessSetCookies ARGS6( if (value_end > value_start) { int value_len = (value_end - value_start); - if (value_len > 4096) { - value_len = 4096; + if (value_len > max_cookies_buffer) { + value_len = max_cookies_buffer; } value = (char *)calloc(1, value_len + 1); if (value == NULL) @@ -1613,7 +1622,7 @@ PRIVATE void LYProcessSetCookies ARGS6( * If we've started a cookie, and it's not too big, * save it in the CombinedCookies list. - FM */ - if (length <= 4096 && cur_cookie != NULL) { + if (length <= max_cookies_buffer && cur_cookie != NULL) { /* * If we had a Set-Cookie2 header, make sure * the version is at least 1, and mark it for @@ -1661,7 +1670,7 @@ PRIVATE void LYProcessSetCookies ARGS6( /* * Handle the final Set-Cookie cookie if within length limit. - FM */ - if (NumCookies <= 50 && length <= 4096 && cur_cookie != NULL) { + if (NumCookies <= max_cookies_domain && length <= max_cookies_buffer && cur_cookie != NULL) { if (SetCookie2 != NULL) { if (cur_cookie->version < 1) { cur_cookie->version = 1; @@ -1674,9 +1683,9 @@ PRIVATE void LYProcessSetCookies ARGS6( (cur_cookie->name ? cur_cookie->name : "[no name]"), (cur_cookie->value ? cur_cookie->value : "[no value]")); CTRACE(tfp, " due to excessive %s%s%s\n", - (length > 4096 ? "length" : ""), - (length > 4096 && NumCookies > 50 ? " and " : ""), - (NumCookies > 50 ? "number!\n" : "!\n")); + (length > max_cookies_buffer ? "length" : ""), + (length > max_cookies_buffer && NumCookies > max_cookies_domain ? " and " : ""), + (NumCookies > max_cookies_domain ? "number!\n" : "!\n")); freeCookie(cur_cookie); cur_cookie = NULL; } diff --git a/src/LYExtern.c b/src/LYExtern.c index 329fe103..652fb3e2 100644 --- a/src/LYExtern.c +++ b/src/LYExtern.c @@ -35,11 +35,8 @@ void run_external ARGS1(char *, c) externals2=externals2->next) { -#ifdef _WINDOWS - if (!strnicmp(externals2->name,c,strlen(externals2->name))) -#else - if (!strncasecomp(externals2->name,c,strlen(externals2->name))) -#endif + if (externals2->command != 0 + && !strncasecomp(externals2->name,c,strlen(externals2->name))) { char *cp; diff --git a/src/LYMap.c b/src/LYMap.c index 75527572..0d63a36e 100644 --- a/src/LYMap.c +++ b/src/LYMap.c @@ -168,6 +168,8 @@ PUBLIC BOOL LYAddImageMap ARGS3( if (theList) { cur = theList; while (NULL != (old = (LYImageMap *)HTList_nextObject(cur))) { + if (old->address == 0) /* shouldn't happen */ + continue; if (!strcmp(old->address, address)) { FREE(old->address); FREE(old->title); diff --git a/src/LYOptions.c b/src/LYOptions.c index f86fad24..5ee3c02c 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -3422,8 +3422,8 @@ PUBLIC int postoptions ARGS1( PostPair *data = 0; int i; BOOLEAN save_all = FALSE; - BOOLEAN display_char_set_changed = FALSE; - BOOLEAN raw_mode_changed = FALSE; + int display_char_set_old = current_char_set; + BOOLEAN raw_mode_old = LYRawMode; BOOLEAN assume_char_set_changed = FALSE; BOOLEAN need_reload = FALSE; #if defined(USE_SLANG) || defined(COLOR_CURSES) @@ -3599,7 +3599,11 @@ PUBLIC int postoptions ARGS1( int newval; newval = UCGetLYhndl_byMIME(data[i].value); - if (newval != UCLYhndl_for_unspec) { + if ((raw_mode_old && + newval != safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset)) + || (!raw_mode_old && + newval != UCLYhndl_for_unspec)) { + UCLYhndl_for_unspec = newval; StrAllocCopy(UCAssume_MIMEcharset, data[i].value); assume_char_set_changed = TRUE; @@ -3613,7 +3617,6 @@ PUBLIC int postoptions ARGS1( newval = atoi(data[i].value); if (newval != current_char_set) { current_char_set = newval; - display_char_set_changed = TRUE; } } @@ -3623,7 +3626,6 @@ PUBLIC int postoptions ARGS1( if (newmode != LYRawMode) { LYRawMode = newmode; - raw_mode_changed = TRUE; } } @@ -3677,11 +3679,13 @@ PUBLIC int postoptions ARGS1( /* * Process the flags: */ - if ( display_char_set_changed || raw_mode_changed || assume_char_set_changed ) { + if ( display_char_set_old != current_char_set || + raw_mode_old != LYRawMode || + assume_char_set_changed ) { /* * charset settings: the order is essential here. */ - if (display_char_set_changed) { + if (display_char_set_old != current_char_set) { /* * Set the LYUseDefaultRawMode value and character * handling if LYRawMode was changed. - FM @@ -3692,7 +3696,7 @@ PUBLIC int postoptions ARGS1( if (assume_char_set_changed) { LYRawMode = (UCLYhndl_for_unspec == current_char_set); } - if (raw_mode_changed || assume_char_set_changed) { + if (raw_mode_old != LYRawMode || assume_char_set_changed) { /* * Set the raw 8-bit or CJK mode defaults and * character set if changed. - FM @@ -3990,20 +3994,18 @@ PUBLIC int gen_options ARGS1( /* Assume Character Set: SELECT */ /* if (user_mode==ADVANCED_MODE) */ - { + { int curval; curval = UCLYhndl_for_unspec; - /* - * FIXME: If bogus value in lynx.cfg, then in old way, that is the - * string that was displayed. Now, user will never see that. Good - * or bad? I don't know. MRC - */ - if (curval == current_char_set && UCAssume_MIMEcharset) { - curval = UCGetLYhndl_byMIME(UCAssume_MIMEcharset); - } - if (curval < 0) { - curval = LYRawMode ? current_char_set : 0; + /* + * FIXME: If bogus value in lynx.cfg, then in old way, that is the + * string that was displayed. Now, user will never see that. Good + * or bad? I don't know. MRC + */ + if (curval == current_char_set) { + /* ok, LYRawMode, so use UCAssume_MIMEcharset */ + curval = safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset); } PutLabel(fp0, "Assumed document character set"); BeginSelect(fp0, assume_char_set_string); diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 8b823e84..aef1c7af 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -167,15 +167,22 @@ PRIVATE void add_item_to_list ARGS2( remove_backslashes(cur_item->name); /* - * Process TRUE/FALSE field + * Process TRUE/FALSE field. If we do not find one, assume it is + * true. In any case, we want the command string. */ - if ((next_colon = find_colon(colon+1)) != NULL) { + if ((next_colon = find_colon(colon+1)) == NULL) { + next_colon = colon + strlen(colon); + } + if (next_colon - (colon+1) > 0) { cur_item->command = (char *)calloc(next_colon-colon, sizeof(char)); if (cur_item->command == NULL) outofmem(__FILE__, "read_cfg"); LYstrncpy(cur_item->command, colon+1, (int)(next_colon-(colon+1))); remove_backslashes(cur_item->command); - cur_item->always_enabled = is_true(next_colon+1); + cur_item->always_enabled = TRUE; + } + if (*next_colon++) { + cur_item->always_enabled = is_true(next_colon); } } } diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c index f5439ed7..ec2002c9 100644 --- a/src/LYShowInfo.c +++ b/src/LYShowInfo.c @@ -23,7 +23,7 @@ #include <LYLocal.h> #endif /* DIRED_SUPPORT */ -#ifndef NO_CONFIG_INFO +#if defined(HAVE_CONFIG_H) && !defined(NO_CONFIG_INFO) #define HAVE_CFG_DEFS_H #define PutDefs(table, N) fprintf(fp0, "%-35s %s\n", table[N].name, table[N].value) diff --git a/src/LYrcFile.c b/src/LYrcFile.c index f2b4a2a7..1c63fff1 100644 --- a/src/LYrcFile.c +++ b/src/LYrcFile.c @@ -813,7 +813,7 @@ PUBLIC int save_rc NOPARAMS # current link in documents, or current option in select popup windows.\n\ # Positioning the cursor to the left of the current link or option is\n\ # helpful for speech or braille interfaces, and when the terminal is\n\ -# one which does not distingish the current link based on highlighting\n\ +# one which does not distinguish the current link based on highlighting\n\ # or color. A value of \"on\" will set positioning to the left as the\n\ # default while a value of \"off\" will set 'hiding' of the cursor.\n\ # The default can be overridden via the -show_cursor command line toggle.\n"); @@ -961,7 +961,7 @@ PUBLIC int save_rc NOPARAMS * Local execution mode - all links. */ fprintf(fp, "\ -# If run_all_execution_links is set \"on\" then all local exection links\n\ +# If run_all_execution_links is set \"on\" then all local execution links\n\ # will be executed when they are selected.\n\ #\n\ # WARNING - This is potentially VERY dangerous. Since you may view\n\ diff --git a/src/chrtrans/makeuctb.c b/src/chrtrans/makeuctb.c index 4c191d77..ff66ad6c 100644 --- a/src/chrtrans/makeuctb.c +++ b/src/chrtrans/makeuctb.c @@ -40,6 +40,16 @@ */ typedef u16 unicode; +/* + * Since we're writing the formatted file to stdout, ensure that we flush + * everything before leaving, since some old (and a few not-so-old) platforms + * that do not implement POSIX 'exit()'. + */ +#define done(code) \ + fflush(stdout); \ + fflush(stderr); \ + exit(code) + PRIVATE void usage ARGS1( char *, argv0) { @@ -49,7 +59,7 @@ PRIVATE void usage ARGS1( argv0); fprintf(stderr, "Utility to convert .tbl into .h files for Lynx compilation.\n"); - exit(EX_USAGE); + done(EX_USAGE); } /* copied from HTString.c, not everybody has strncasecmp */ @@ -122,7 +132,7 @@ PRIVATE void addpair_str ARGS2( if (!themap_str.entries) { fprintf(stderr, "%s: Out of memory\n", tblname); - exit(EX_DATAERR); + done(EX_DATAERR); } } else { /* @@ -142,7 +152,7 @@ PRIVATE void addpair_str ARGS2( if (themap_str.entry_ct > 1999) { fprintf(stderr, "ERROR: Only 2000 unicode replacement strings permitted!\n"); - exit(EX_DATAERR); + done(EX_DATAERR); } themap_str.entries[themap_str.entry_ct].unicode = un; themap_str.entries[themap_str.entry_ct].replace_str = str; @@ -188,7 +198,7 @@ PRIVATE void addpair ARGS2( */ if (unicount[fp] > 254) { fprintf(stderr, "ERROR: Only 255 unicodes/glyph permitted!\n"); - exit(EX_DATAERR); + done(EX_DATAERR); } unitable[fp][unicount[fp]] = un; unicount[fp]++; @@ -226,7 +236,7 @@ PUBLIC int main ARGS2( ctbl = fopen(tblname = argv[1], "r"); if (!ctbl) { perror(tblname); - exit(EX_NOINPUT); + done(EX_NOINPUT); } } @@ -376,11 +386,11 @@ PUBLIC int main ARGS2( un0 = getunicode(&p); if (un0 < 0) { fprintf(stderr, "Bad input line: %s\n", buffer); - exit(EX_DATAERR); + done(EX_DATAERR); fprintf(stderr, "%s: Bad Unicode range corresponding to font position range 0x%x-0x%x\n", tblname, fp0, fp1); - exit(EX_DATAERR); + done(EX_DATAERR); } un1 = un0; while (*p == ' ' || *p == '\t') { @@ -397,7 +407,7 @@ PUBLIC int main ARGS2( "%s: Bad Unicode range U+%x-U+%x\n", tblname, un0, un1); fprintf(stderr, "Bad input line: %s\n", buffer); - exit(EX_DATAERR); + done(EX_DATAERR); } while (*p == ' ' || *p == '\t') { p++; @@ -414,7 +424,7 @@ PUBLIC int main ARGS2( if (!(p1 = tbuf)) { fprintf(stderr, "%s: Out of memory\n", tblname); - exit(EX_DATAERR); + done(EX_DATAERR); } if (*p == '"') { /* @@ -474,7 +484,7 @@ PUBLIC int main ARGS2( fp0 = strtol(p, &p1, 0); if (p1 == p) { fprintf(stderr, "Bad input line: %s\n", buffer); - exit(EX_DATAERR); + done(EX_DATAERR); } p = p1; @@ -486,7 +496,7 @@ PUBLIC int main ARGS2( fp1 = strtol(p, &p1, 0); if (p1 == p) { fprintf(stderr, "Bad input line: %s\n", buffer); - exit(EX_DATAERR); + done(EX_DATAERR); } p = p1; } else { @@ -497,13 +507,13 @@ PUBLIC int main ARGS2( fprintf(stderr, "%s: Glyph number (0x%x) larger than font length\n", tblname, fp0); - exit(EX_DATAERR); + done(EX_DATAERR); } if (fp1 && (fp1 < fp0 || fp1 >= fontlen)) { fprintf(stderr, "%s: Bad end of range (0x%x)\n", tblname, fp1); - exit(EX_DATAERR); + done(EX_DATAERR); } if (fp1) { @@ -530,7 +540,7 @@ PUBLIC int main ARGS2( tblname); fprintf(stderr, " there should be a Unicode range.\n"); - exit(EX_DATAERR); + done(EX_DATAERR); } p++; un1 = getunicode(&p); @@ -538,7 +548,7 @@ PUBLIC int main ARGS2( fprintf(stderr, "%s: Bad Unicode range corresponding to font position range 0x%x-0x%x\n", tblname, fp0, fp1); - exit(EX_DATAERR); + done(EX_DATAERR); } if (un1 - un0 != fp1 - fp0) { fprintf(stderr, @@ -547,7 +557,7 @@ PUBLIC int main ARGS2( fprintf(stderr, " as font position range 0x%x-0x%x\n", fp0, fp1); - exit(EX_DATAERR); + done(EX_DATAERR); } for (i = fp0; i <= fp1; i++) { addpair(i,un0-fp0+i); @@ -578,7 +588,7 @@ PUBLIC int main ARGS2( fprintf(stderr, "%s: Bad Unicode range 0x%x-0x%x\n", tblname, un0, un1); - exit(EX_DATAERR); + done(EX_DATAERR); } for (un0++; un0 <= un1; un0++) { addpair(fp0, un0); @@ -755,5 +765,5 @@ dfont_replacedesc%s,%d,%d)\n", id_append, this_MIMEcharset, this_LYNXcharset, id_append, id_append, nuni, id_append, lowest_eight, RawOrEnc); - exit(EX_OK); + done(EX_OK); } diff --git a/src/makefile.in b/src/makefile.in index 3e6786d9..e14fa843 100644 --- a/src/makefile.in +++ b/src/makefile.in @@ -112,6 +112,7 @@ HTInit.o: ../userdefs.h LYTraversal.o: ../userdefs.h LYMail.o: ../userdefs.h LYCharSets.o: ../userdefs.h +LYShowInfo.o: ../cfg_defs.h CHRTR= chrtrans/ |