diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/LYClean.c | 3 | ||||
-rw-r--r-- | src/LYCookie.c | 15 | ||||
-rw-r--r-- | src/LYGlobalDefs.h | 1 | ||||
-rw-r--r-- | src/LYMain.c | 151 | ||||
-rw-r--r-- | src/LYMainLoop.c | 2 | ||||
-rw-r--r-- | src/LYOptions.c | 22 | ||||
-rw-r--r-- | src/LYReadCFG.c | 8 | ||||
-rw-r--r-- | src/LYUtils.c | 4 | ||||
-rw-r--r-- | src/chrtrans/makeuctb.c | 2 |
9 files changed, 94 insertions, 114 deletions
diff --git a/src/LYClean.c b/src/LYClean.c index 0ba852d3..113cc7cf 100644 --- a/src/LYClean.c +++ b/src/LYClean.c @@ -187,7 +187,8 @@ PUBLIC void cleanup NOARGS * handle two processes writing to the cookie file needs to be worked * out as well. */ - LYStoreCookies (LYCookieFile); + if (persistent_cookies) + LYStoreCookies (LYCookieFile); #endif cleanup_files(); diff --git a/src/LYCookie.c b/src/LYCookie.c index d3e26c25..2e115499 100644 --- a/src/LYCookie.c +++ b/src/LYCookie.c @@ -419,7 +419,8 @@ PRIVATE void store_cookie ARGS3( * isn't sensible. Perhaps something based on the domain * and the path in conjunction makes more sense? - RP */ - if (co->flags & COOKIE_FLAG_PERSISTENT) + if (persistent_cookies + && (co->flags & COOKIE_FLAG_PERSISTENT)) de->bv = FROM_FILE; else #endif @@ -513,10 +514,12 @@ PRIVATE void store_cookie ARGS3( * to maintain their order for servers that need cookies in * a particular order. This is a hack. */ - if ((de->bv = FROM_FILE) != 0) { - HTList_appendObject(cookie_list, co); - } else { - HTList_insertObjectAt(cookie_list, co, pos); + if (persistent_cookies) { + if ((de->bv = FROM_FILE) != 0) { + HTList_appendObject(cookie_list, co); + } else { + HTList_insertObjectAt(cookie_list, co, pos); + } } #else HTList_insertObjectAt(cookie_list, co, pos); @@ -1873,7 +1876,7 @@ PUBLIC void LYLoadCookies ARGS1 ( CONST char *, cookie_file) { FILE *cookie_handle; - char buf[5000]; /* should be long enough for a cookie line */ + char buf[max_cookies_buffer+10]; /* should be long enough for a cookie line */ static char domain[256], path[LY_MAXPATH], name[256], value[4100]; static char what[8], secure[8], expires_a[16]; static struct { diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index 3960b9f1..c326615d 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -320,6 +320,7 @@ extern BOOLEAN LYAcceptAllCookies; /* accept ALL cookies? */ extern char *LYCookieAcceptDomains; /* domains to accept all cookies */ extern char *LYCookieRejectDomains; /* domains to reject all cookies */ #ifdef EXP_PERSISTENT_COOKIES +extern BOOLEAN persistent_cookies; extern char *LYCookieFile; /* file to store cookies in */ #endif /* EXP_PERSISTENT_COOKIES */ extern char *XLoadImageCommand; /* Default image viewer for X */ diff --git a/src/LYMain.c b/src/LYMain.c index 4b7447c3..7b192d4f 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -342,6 +342,7 @@ PUBLIC BOOLEAN LYAcceptAllCookies = ACCEPT_ALL_COOKIES; /* take all cookies? */ PUBLIC char *LYCookieAcceptDomains = NULL; /* domains to accept all cookies */ PUBLIC char *LYCookieRejectDomains = NULL; /* domains to reject all cookies */ #ifdef EXP_PERSISTENT_COOKIES +BOOLEAN persistent_cookies = TRUE; PUBLIC char *LYCookieFile = NULL; /* default cookie file */ #endif /* EXP_PERSISTENT_COOKIES */ PUBLIC char *XLoadImageCommand = NULL; /* Default image viewer for X */ @@ -516,6 +517,23 @@ PRIVATE void LYStdinArgs_free NOARGS return; } +PRIVATE void exit_immediately ARGS1( + int, code) +{ +#ifndef NOSIGHUP + (void) signal(SIGHUP, SIG_DFL); +#endif /* NOSIGHUP */ + (void) signal(SIGTERM, SIG_DFL); +#ifndef VMS + (void) signal(SIGINT, SIG_DFL); +#endif /* !VMS */ +#ifdef SIGTSTP + if (no_suspend) + (void) signal(SIGTSTP, SIG_DFL); +#endif /* SIGTSTP */ + exit(code); +} + /* * Wow! Someone wants to start up Lynx. */ @@ -1488,20 +1506,22 @@ PUBLIC int main ARGS2( * Sod it, this looks like a reasonable place to load the * cookies file, probably. - RP */ - if(LYCookieFile == NULL) { - LYAddPathToHome(LYCookieFile = malloc(LY_MAXPATH), LY_MAXPATH, COOKIE_FILE); - } else { - if ((cp = strchr(LYCookieFile, '~'))) { - temp = NULL; - *(cp++) = '\0'; - StrAllocCopy(temp, cp); - LYTrimPathSep(temp); - StrAllocCopy(LYCookieFile, wwwName(Home_Dir())); - StrAllocCat(LYCookieFile, temp); - FREE(temp); + if (persistent_cookies) { + if(LYCookieFile == NULL) { + LYAddPathToHome(LYCookieFile = malloc(LY_MAXPATH), LY_MAXPATH, COOKIE_FILE); + } else { + if ((cp = strchr(LYCookieFile, '~'))) { + temp = NULL; + *(cp++) = '\0'; + StrAllocCopy(temp, cp); + LYTrimPathSep(temp); + StrAllocCopy(LYCookieFile, wwwName(Home_Dir())); + StrAllocCat(LYCookieFile, temp); + FREE(temp); + } } + LYLoadCookies(LYCookieFile); } - LYLoadCookies(LYCookieFile); #endif #ifdef SIGTSTP @@ -1513,6 +1533,36 @@ PUBLIC int main ARGS2( #endif /* SIGTSTP */ /* + * Check for a valid HEAD request. - FM + */ + if (HEAD_request && LYCanDoHEAD(startfile) != TRUE) { + fprintf(stderr, + "The '-head' switch is for http HEAD requests and cannot be used for\n'%s'.\n", + startfile); + exit_immediately(-1); + } + + /* + * Check for a valid MIME headers request. - FM + */ + if (keep_mime_headers && LYCanDoHEAD(startfile) != TRUE) { + fprintf(stderr, + "The '-mime_header' switch is for http URLs and cannot be used for\n'%s'.\n", + startfile); + exit_immediately(-1); + } + + /* + * Check for a valid traversal request. - FM + */ + if (traversal && strncmp(startfile, "http", 4)) { + fprintf(stderr, + "The '-traversal' switch is for http URLs and cannot be used for\n'%s'.\n", + startfile); + exit_immediately(-1); + } + + /* * Finish setting up for an INTERACTIVE session. * Done here so that URL guessing in LYEnsureAbsoluteURL() can be * interruptible (terminal is in raw mode, select() works). -BL @@ -1574,69 +1624,6 @@ PUBLIC int main ARGS2( } /* - * Check for a valid HEAD request. - FM - */ - if (HEAD_request && LYCanDoHEAD(startfile) != TRUE) { - fprintf(stderr, - "The '-head' switch is for http HEAD requests and cannot be used for\n'%s'.\n", - startfile); -#ifndef NOSIGHUP - (void) signal(SIGHUP, SIG_DFL); -#endif /* NOSIGHUP */ - (void) signal(SIGTERM, SIG_DFL); -#ifndef VMS - (void) signal(SIGINT, SIG_DFL); -#endif /* !VMS */ -#ifdef SIGTSTP - if (no_suspend) - (void) signal(SIGTSTP,SIG_DFL); -#endif /* SIGTSTP */ - exit(-1); - } - - /* - * Check for a valid MIME headers request. - FM - */ - if (keep_mime_headers && LYCanDoHEAD(startfile) != TRUE) { - fprintf(stderr, - "The '-mime_header' switch is for http URLs and cannot be used for\n'%s'.\n", - startfile); -#ifndef NOSIGHUP - (void) signal(SIGHUP, SIG_DFL); -#endif /* NOSIGHUP */ - (void) signal(SIGTERM, SIG_DFL); -#ifndef VMS - (void) signal(SIGINT, SIG_DFL); -#endif /* !VMS */ -#ifdef SIGTSTP - if (no_suspend) - (void) signal(SIGTSTP,SIG_DFL); -#endif /* SIGTSTP */ - exit(-1); - } - - /* - * Check for a valid traversal request. - FM - */ - if (traversal && strncmp(startfile, "http", 4)) { - fprintf(stderr, - "The '-traversal' switch is for http URLs and cannot be used for\n'%s'.\n", - startfile); -#ifndef NOSIGHUP - (void) signal(SIGHUP, SIG_DFL); -#endif /* NOSIGHUP */ - (void) signal(SIGTERM, SIG_DFL); -#ifndef VMS - (void) signal(SIGINT, SIG_DFL); -#endif /* !VMS */ -#ifdef SIGTSTP - if (no_suspend) - (void) signal(SIGTSTP,SIG_DFL); -#endif /* SIGTSTP */ - exit(-1); - } - - /* * Set up our help and about file base paths. - FM */ StrAllocCopy(helpfilepath, helpfile); @@ -1687,17 +1674,7 @@ PUBLIC int main ARGS2( (keypad_mode == LINKS_ARE_NUMBERED || keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED)) printlist(stdout,FALSE); -#ifndef NOSIGHUP - (void) signal(SIGHUP, SIG_DFL); -#endif /* NOSIGHUP */ - (void) signal(SIGTERM, SIG_DFL); -#ifndef VMS - (void) signal(SIGINT, SIG_DFL); -#endif /* !VMS */ -#ifdef SIGTSTP - if (no_suspend) - (void) signal(SIGTSTP,SIG_DFL); -#endif /* SIGTSTP */ + exit_immediately(status); } else { /* * Start an INTERACTIVE session. - FM @@ -1708,9 +1685,9 @@ PUBLIC int main ARGS2( ena_csi((LYlowest_eightbit[current_char_set] > 155)); status = mainloop(); cleanup(); + exit(status); } - exit(status); return(status); /* though redundant, for compiler-warnings */ } diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index 7b830ad2..87a751bd 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -3849,7 +3849,7 @@ if (!LYUseFormsOptions) { */ HTuncache_current_document(); } -#endif /* NO_OPTION_FORMS */ +#endif /* !NO_OPTION_FORMS */ break; case LYK_INDEX_SEARCH: /* search for a user string */ diff --git a/src/LYOptions.c b/src/LYOptions.c index 5ee3c02c..3d894764 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -3400,10 +3400,11 @@ PRIVATE PostPair * break_data ARGS1( * pointer. MRC * * By changing the certain options value (like preferred language or - * fake browser name) we need to inform the remote server and reload (uncache) - * the document which was active just before the Options menu was invoked. - * Another values (like display_char_set or assume_char_set) used by lynx - * initial rendering stages and can be changed only after reloading :-( + * fake browser name) we need to inform the remote server and reload + * (uncache on a proxy) the document which was active just before + * the Options menu was invoked. Another values (like display_char_set + * or assume_char_set) used by lynx initial rendering stages + * and can only be changed after reloading :-( * So we introduce boolean flag 'need_reload' (currently dummy). * * Options are processed in order according to gen_options(), we should not @@ -3612,21 +3613,12 @@ PUBLIC int postoptions ARGS1( /* Display Character Set: SELECT */ if (!strcmp(data[i].tag, display_char_set_string)) { - int newval; - - newval = atoi(data[i].value); - if (newval != current_char_set) { - current_char_set = newval; - } + current_char_set = atoi(data[i].value); } /* Raw Mode: ON/OFF */ if (!strcmp(data[i].tag, raw_mode_string)) { - BOOLEAN newmode = GetOptValues(bool_values, data[i].value); - - if (newmode != LYRawMode) { - LYRawMode = newmode; - } + LYRawMode = GetOptValues(bool_values, data[i].value); } /* diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index aef1c7af..59c8d15e 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -912,6 +912,9 @@ static Config_Type Config_Table [] = PARSE_SET("partial", CONF_BOOL, display_partial), PARSE_INT("partial_thres", CONF_INT, partial_threshold), #endif +#ifdef EXP_PERSISTENT_COOKIES + PARSE_SET("persistent_cookies", CONF_BOOL, persistent_cookies), +#endif /* EXP_PERSISTENT_COOKIES */ PARSE_STR("personal_mailcap", CONF_STR, personal_type_map), PARSE_STR("personal_extension_map", CONF_STR, personal_extension_map), PARSE_STR("preferred_charset", CONF_STR, pref_charset), @@ -938,6 +941,7 @@ static Config_Type Config_Table [] = PARSE_FUN("system_editor", CONF_FUN, system_editor_fun), PARSE_STR("system_mail", CONF_STR, system_mail), PARSE_STR("system_mail_flags", CONF_STR, system_mail_flags), + PARSE_SET("tagsoup", CONF_BOOL, New_DTD), #ifdef EXEC_LINKS PARSE_DEF("trusted_exec", CONF_ADD_TRUSTED, EXEC_PATH), #endif @@ -1163,13 +1167,17 @@ PUBLIC void read_cfg ARGS4( case CONF_INCLUDE: /* include another file */ +#ifndef NO_CONFIG_INFO if (fp0 != 0) { fprintf(fp0, "%s:%s\n\n", name, value); fprintf(fp0, " #<begin %s>\n", value); } +#endif read_cfg (value, cfg_filename, nesting_level + 1, fp0); +#ifndef NO_CONFIG_INFO if (fp0 != 0) fprintf(fp0, " #<end of %s>\n\n", value); +#endif break; case CONF_ADD_ITEM: diff --git a/src/LYUtils.c b/src/LYUtils.c index 3ed0f848..5e82ca6d 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -2823,8 +2823,6 @@ PUBLIC BOOLEAN inlocaldomain NOARGS /* For systems that have both, but both can't be included, duh (or neither) */ /* FIXME: this whole chunk may be redundant */ #ifdef TERMIO_AND_CURSES -# include <termio.h> -# else # ifdef TERMIO_AND_TERMIOS # include <termio.h> # else @@ -2836,7 +2834,7 @@ PUBLIC BOOLEAN inlocaldomain NOARGS # endif /* HAVE_TERMIO_H */ # endif /* HAVE_TERMIOS_H */ # endif /* TERMIO_AND_TERMIOS */ -#endif /* USE_TERMIO_H */ +#endif /* TERMIO_AND_CURSES */ PUBLIC void size_change ARGS1( int, sig GCC_UNUSED) diff --git a/src/chrtrans/makeuctb.c b/src/chrtrans/makeuctb.c index ff66ad6c..cc721723 100644 --- a/src/chrtrans/makeuctb.c +++ b/src/chrtrans/makeuctb.c @@ -660,8 +660,8 @@ PUBLIC int main ARGS2( p++, i++) { id_append[i+1] = isalnum(*p) ? *p : '_'; } + id_append[i+1] = '\0'; } - id_append[i+1] = '\0'; fprintf(stderr, " (%s).\n", id_append); printf("\ |