diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-08-06 13:04:14 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-08-06 13:04:14 -0400 |
commit | d7e8d7e419ae58610a9988ff09910670a59526ff (patch) | |
tree | a7c02ce435a282a5f60b1a297b5dd4d053b92d67 /src | |
parent | e6ba2a01f70f84d9133cf305e4b493c9d656cb21 (diff) | |
download | lynx-snapshots-d7e8d7e419ae58610a9988ff09910670a59526ff.tar.gz |
snapshot of project "lynx", label v2-8-1dev_20
Diffstat (limited to 'src')
70 files changed, 553 insertions, 368 deletions
diff --git a/src/DefaultStyle.c b/src/DefaultStyle.c index bff1b11d..2e00ba62 100644 --- a/src/DefaultStyle.c +++ b/src/DefaultStyle.c @@ -4,7 +4,6 @@ */ #include <HTUtils.h> -#include <tcp.h> #include <HTStyle.h> #include <HTFont.h> diff --git a/src/GridText.c b/src/GridText.c index bff01ebd..192b9d21 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -3,7 +3,6 @@ */ #include <HTUtils.h> -#include <tcp.h> #include <HTString.h> #include <HTFont.h> #include <HTAccess.h> @@ -16,7 +15,6 @@ #include <UCAux.h> #include <assert.h> -#include <ctype.h> #ifndef VMS #ifdef SYSLOG_REQUESTED_URLS #include <syslog.h> @@ -72,8 +70,6 @@ struct _HTStream { /* only know it as object */ #define IS_UTF_EXTRA(ch) (text->T.output_utf8 && \ ((unsigned char)(ch)&0xc0) == 0x80) -#define FREE(x) if (x) {free(x); x = NULL;} - extern BOOL HTPassHighCtrlRaw; extern HTkcode kanji_code; extern HTCJKlang HTCJK; diff --git a/src/HTAlert.c b/src/HTAlert.c index 3a160ca5..fd5440d2 100644 --- a/src/HTAlert.c +++ b/src/HTAlert.c @@ -10,7 +10,6 @@ */ #include <HTUtils.h> -#include <tcp.h> #include <HTAlert.h> #include <LYGlobalDefs.h> #include <LYCurses.h> @@ -22,9 +21,6 @@ #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - - /* Issue a message about a problem. HTAlert() ** -------------------------------- */ @@ -435,13 +431,13 @@ PUBLIC BOOL HTConfirmCookie ARGS4( namelen = (int)(percentage*(float)namelen); valuelen = (int)(percentage*(float)valuelen); } - if(!LYEatAllCookies) { + if(!LYAcceptAllCookies) { sprintf(message, ADVANCED_COOKIE_CONFIRMATION, server, namelen, name, valuelen, value); _statusline(message); } while (1) { - if(!LYEatAllCookies) { + if(!LYAcceptAllCookies) { ch = LYgetch(); } else { ch = 'A'; diff --git a/src/HTAlert.h b/src/HTAlert.h index 77be4315..9327bb2d 100644 --- a/src/HTAlert.h +++ b/src/HTAlert.h @@ -8,10 +8,7 @@ #ifndef HTALERT_H #define HTALERT_H 1 -#ifndef HTUTILS_H #include <HTUtils.h> -#endif /* HTUTILS_H */ -#include <tcp.h> /* Display a message and get the input ** diff --git a/src/HTFWriter.c b/src/HTFWriter.c index fd35802e..49884d79 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -9,7 +9,6 @@ */ #include <HTUtils.h> -#include <tcp.h> #include <LYCurses.h> #include <HTFWriter.h> #include <HTSaveToFile.h> @@ -58,9 +57,6 @@ PUBLIC HTStream* HTSaveToFile PARAMS(( HTParentAnchor * anchor, HTStream * sink)); -#define FREE(x) if (x) {free(x); x = NULL;} - - /* Stream Object ** ------------- */ @@ -301,7 +297,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) * (or even the same!). We can skip this * needless duplication by using the * viewer_command which has already been - * determind when the HTCompressed stream was + * determined when the HTCompressed stream was * created. - kw */ FREE(me->end_command); @@ -869,7 +865,7 @@ PUBLIC HTStream* HTCompressed ARGS3( FILE *fp = NULL; /* - * Deal with any inappropriate invokations of this function, + * Deal with any inappropriate invocations of this function, * or a download request, in which case we won't bother to * uncompress the file. - FM */ @@ -1162,7 +1158,7 @@ PUBLIC unsigned long LYVMS_FixedLengthRecords ARGS1(char *, filename) /* RMS supplies a user-mode channel (see FAB$L_FOP FAB$V_UFO doc) */ channel = (unsigned short) fab.fab$l_stv; - /* set up ACP interface strutures */ + /* set up ACP interface structures */ /* file information block, passed by descriptor; it's okay to start with an empty FIB after RMS has accessed the file for us */ fib_dsc.len = sizeof fib; diff --git a/src/HTInit.c b/src/HTInit.c index b9e0c4c6..4d7227ec 100644 --- a/src/HTInit.c +++ b/src/HTInit.c @@ -1,4 +1,4 @@ -/* Configuration-specific Initialialization HTInit.c +/* Configuration-specific Initialization HTInit.c ** ---------------------------------------- */ @@ -7,7 +7,6 @@ */ #include <HTUtils.h> -#include <tcp.h> /* Implements: */ @@ -32,8 +31,6 @@ #include <LYexit.h> #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - #ifdef VMS #define DISPLAY "DECW$DISPLAY" #else @@ -658,7 +655,7 @@ PUBLIC void HTFileInit NOARGS #ifdef EXEC_SCRIPTS /* - * define these extentions for exec scripts. + * define these extensions for exec scripts. */ #ifndef VMS /* for csh exec links */ diff --git a/src/HTML.c b/src/HTML.c index 8513ff44..39ed1ae8 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -14,7 +14,6 @@ #define DICKEY_TEST #include <HTUtils.h> -#include <tcp.h> #define Lynx_HTML_Handler #include <HTChunk.h> @@ -65,8 +64,6 @@ char Style_className[16384]; #include <LYexit.h> #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - #define STACKLEVEL(me) ((me->stack + MAX_NESTING - 1) - me->sp) extern BOOL HTPassEightBitRaw; diff --git a/src/HTSaveToFile.h b/src/HTSaveToFile.h index a13ad78a..4374f7a4 100644 --- a/src/HTSaveToFile.h +++ b/src/HTSaveToFile.h @@ -1,6 +1,10 @@ #ifndef HTSAVETOFILE_H #define HTSAVETOFILE_H +#include <HTUtils.h> +#include <HTStream.h> +#include <HTFormat.h> + extern HTStream * HTSaveToFile PARAMS(( HTPresentation * pres, HTParentAnchor * anchor, diff --git a/src/LYBookmark.c b/src/LYBookmark.c index 5d1774d2..b08ea97f 100644 --- a/src/LYBookmark.c +++ b/src/LYBookmark.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTAlert.h> #include <LYUtils.h> #include <LYStrings.h> @@ -23,8 +22,6 @@ extern BOOLEAN HadVMSInterrupt; /* Flag from cleanup_sig() AST */ #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - PUBLIC char *MBM_A_subbookmark[MBM_V_MAXFILES+1]; PUBLIC char *MBM_A_subdescript[MBM_V_MAXFILES+1]; diff --git a/src/LYCgi.c b/src/LYCgi.c index e30d53f7..c70db2d4 100644 --- a/src/LYCgi.c +++ b/src/LYCgi.c @@ -24,7 +24,6 @@ */ #include <HTUtils.h> -#include <tcp.h> #include <HTTP.h> #include <HTParse.h> #include <HTTCP.h> @@ -41,7 +40,6 @@ #include <LYGetFile.h> #include <LYBookmark.h> #include <GridText.h> -#include <ctype.h> #include <LYCgi.h> #include <LYSignal.h> #include <LYLocal.h> diff --git a/src/LYCgi.h b/src/LYCgi.h index 56a8d15d..b0e1cd63 100644 --- a/src/LYCgi.h +++ b/src/LYCgi.h @@ -1,7 +1,8 @@ - #ifndef LYCGI_H #define LYCGI_H +#include <HTUtils.h> + extern void add_lynxcgi_environment PARAMS((CONST char *variable_name)); #endif /* LYGETFILE_H */ diff --git a/src/LYCharSets.c b/src/LYCharSets.c index d6609a99..81cfa9af 100644 --- a/src/LYCharSets.c +++ b/src/LYCharSets.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTCJK.h> #include <HTMLDTD.h> diff --git a/src/LYCharSets.h b/src/LYCharSets.h index cd9e4ccc..746f84c2 100644 --- a/src/LYCharSets.h +++ b/src/LYCharSets.h @@ -1,7 +1,9 @@ - #ifndef LYCHARSETS_H #define LYCHARSETS_H +#include <HTUtils.h> +#include <UCDefs.h> + #ifndef UCMAP_H #include <UCMap.h> #endif /* !UCMAP_H */ diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index ed4722f7..572da3cb 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -3,7 +3,6 @@ ** ========================================================================== */ #include <HTUtils.h> -#include <tcp.h> #include <SGML.h> #define Lynx_HTML_Handler @@ -48,8 +47,6 @@ #include <LYexit.h> #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - extern BOOL HTPassEightBitRaw; extern BOOL HTPassEightBitNum; extern BOOL HTPassHighCtrlRaw; diff --git a/src/LYClean.c b/src/LYClean.c index 0c79b9e6..1f65bbae 100644 --- a/src/LYClean.c +++ b/src/LYClean.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <LYCurses.h> #include <LYUtils.h> #include <LYSignal.h> @@ -13,8 +12,6 @@ #include <LYexit.h> #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - #ifdef VMS BOOLEAN HadVMSInterrupt = FALSE; #endif /* VMS */ diff --git a/src/LYClean.h b/src/LYClean.h index ec5ee39b..dbd6a5ad 100644 --- a/src/LYClean.h +++ b/src/LYClean.h @@ -1,6 +1,8 @@ #ifndef LYCLEAN_H #define LYCLEAN_H +#include <HTUtils.h> + #ifdef VMS extern BOOLEAN HadVMSInterrupt; #endif diff --git a/src/LYCookie.c b/src/LYCookie.c index c1979941..4d7d496b 100644 --- a/src/LYCookie.c +++ b/src/LYCookie.c @@ -22,7 +22,7 @@ * Hex escaping isn't considered at all. Any semi-colons, commas, or spaces actually in cookie names or values (i.e., not serving as punctuation for the overall Set-Cookie value) should be hex - escaped if not quoted, but presumeably the server is expecting + escaped if not quoted, but presumably the server is expecting them to be hex escaped in our Cookie request header as well, so in theory we need not unescape them. We'll see how this works out in practice. @@ -40,12 +40,11 @@ of use. * If a cookie has the secure flag set, we presently treat only SSL connections as secure. This may need to be expanded for other - secure communication protocols that become standarized. + secure communication protocols that become standardized. * Cookies could be optionally stored in a file from session to session. */ #include <HTUtils.h> -#include <tcp.h> #include <HTAccess.h> #include <HTParse.h> #include <HTAlert.h> @@ -65,8 +64,6 @@ #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - /* ** 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 @@ -2017,7 +2014,7 @@ PRIVATE int LYHandleCookies ARGS4 ( extern BOOLEAN HadVMSInterrupt; #endif /* VMS */ -#ifdef EXP_PERSISTENT_COOKIES +#ifdef EXP_PERSISTENT_COOKIES /* rjp - this can go here for now */ LYStoreCookies ("j"); #endif @@ -2212,11 +2209,11 @@ Delete_all_cookies_in_domain: case 'P': /* - * Set to prompt for cookie acceptence + * Set to prompt for cookie acceptance * from this domain. - FM */ de->bv = QUERY_USER; - _user_message(PROMTING_TO_ALLOW_COOKIES, + _user_message(PROMPTING_TO_ALLOW_COOKIES, de->domain); sleep(MessageSecs); return(HT_NO_DATA); @@ -2435,6 +2432,100 @@ Delete_all_cookies_in_domain: return(HT_LOADED); } +/* cookie_add_acceptlist + * is passed a comma delimited string of domains (with leading '.') + * to add to the "always accept" list for cookies. + */ + +PUBLIC void cookie_add_acceptlist ARGS1( + char *, acceptdomains) +{ + domain_entry *de = NULL; + char **domain1 = 0; + char **origstr = 0; + + if (domain_list == NULL) { + atexit(LYCookieJar_free); + domain_list = HTList_new(); + total_cookies = 0; + } + + *origstr = (char *)acceptdomains; + + for(; (*domain1 = LYstrsep(origstr, ",")) != NULL;) { + if(**domain1 != '\0') { + de = (domain_entry *)calloc(1, sizeof(domain_entry)); + + if (de == NULL) + outofmem(__FILE__, "cookie_accept_domains"); + + de->bv = ACCEPT_ALWAYS; + + StrAllocCopy(de->domain, *domain1); + HTList_addObject(domain_list, de); + } + } + + /* then one last one, cos that's how LYstrsep() works */ + + de = (domain_entry *)calloc(1, sizeof(domain_entry)); + + if (de == NULL) + outofmem(__FILE__, "cookie_accept_domains"); + + de->bv = ACCEPT_ALWAYS; + + StrAllocCopy(de->domain, *origstr); + HTList_addObject(domain_list, de); +} + +/* cookie_add_rejectlist + * is passed a comma delimited string of domains (with leading '.') + * to add to the "always reject" list for cookies. + */ + +PUBLIC void cookie_add_rejectlist ARGS1( + char *, rejectdomains) +{ + domain_entry *de = NULL; + char **domain1 = 0; + char **origstr = 0; + + if (domain_list == NULL) { + atexit(LYCookieJar_free); + domain_list = HTList_new(); + total_cookies = 0; + } + + *origstr = rejectdomains; + + for(; (*domain1 = LYstrsep(origstr, ",")) != NULL;) { + if(**domain1 != '\0') { + de = (domain_entry *)calloc(1, sizeof(domain_entry)); + + if (de == NULL) + outofmem(__FILE__, "cookie_reject_domains"); + + de->bv = REJECT_ALWAYS; + + StrAllocCopy(de->domain, *domain1); + HTList_addObject(domain_list, de); + } + } + + /* then one last one, cos that's how LYstrsep() works */ + + de = (domain_entry *)calloc(1, sizeof(domain_entry)); + + if (de == NULL) + outofmem(__FILE__, "cookie_reject_domains"); + + de->bv = REJECT_ALWAYS; + + StrAllocCopy(de->domain, *origstr); + HTList_addObject(domain_list, de); +} + #ifdef GLOBALDEF_IS_MACRO #define _LYCOOKIE_C_GLOBALDEF_1_INIT { "LYNXCOOKIE",LYHandleCookies,0} GLOBALDEF (HTProtocol,LYLynxCookies,_LYCOOKIE_C_GLOBALDEF_1_INIT); diff --git a/src/LYCookie.h b/src/LYCookie.h index e1e4ad1a..62ea77a4 100644 --- a/src/LYCookie.h +++ b/src/LYCookie.h @@ -1,6 +1,9 @@ #ifndef LYCOOKIES_H #define LYCOOKIES_H +#include <HTUtils.h> +#include <HTList.h> + extern void LYSetCookie PARAMS(( CONST char * SetCookie, CONST char * SetCookie2, @@ -12,6 +15,10 @@ extern char *LYCookie PARAMS(( BOOL secure)); extern void LYLoadCookies PARAMS(( CONST char * cookie_file)); +extern void cookie_add_acceptlist PARAMS(( + char * acceptdomains)); +extern void cookie_add_rejectlist PARAMS(( + char * rejectdomains)); typedef enum {ACCEPT_ALWAYS, REJECT_ALWAYS, QUERY_USER, FROM_FILE} behaviour; diff --git a/src/LYCurses.c b/src/LYCurses.c index 03d5aba7..8bf79563 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <LYCurses.h> #include <LYStyle.h> #include <LYUtils.h> @@ -15,8 +14,6 @@ #include <LYexit.h> #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - #ifdef VMS #define DISPLAY "DECW$DISPLAY" #else @@ -652,9 +649,9 @@ PUBLIC void start_curses NOARGS if (slinit == 0) { SLtt_get_terminfo(); -#if defined(__DJGPP__) && !defined(DJGPP_KEYHANDLER) +#if defined(__DJGPP__) && !defined(DJGPP_KEYHANDLER) SLkp_init (); -#endif /* __DJGPP__ && !DJGPP_KEYHANDLER */ +#endif /* __DJGPP__ && !DJGPP_KEYHANDLER */ #ifdef UNIX #if SLANG_VERSION >= 9935 @@ -726,7 +723,7 @@ PUBLIC void start_curses NOARGS scrollok(0,0); SLsmg_Backspace_Moves = 1; #ifndef VMS -#if !defined(_WINDOWS) && !defined(__DJGPP__) +#if !defined(_WINDOWS) && !defined(__DJGPP__) SLtty_set_suspend_state(1); #endif /* !_WINDOWS */ #ifdef SIGTSTP @@ -1231,7 +1228,6 @@ PUBLIC void LYstopTargetEmphasis NOARGS #include <descrip.h> #include <iodef.h> #include <ssdef.h> -#include <stdlib.h> #include <msgdef.h> #include <ttdef.h> #include <tt2def.h> diff --git a/src/LYCurses.h b/src/LYCurses.h index 38545cd7..cd658287 100644 --- a/src/LYCurses.h +++ b/src/LYCurses.h @@ -1,6 +1,7 @@ #ifndef LYCURSES_H #define LYCURSES_H +#include <HTUtils.h> #include <userdefs.h> /* diff --git a/src/LYDownload.c b/src/LYDownload.c index edc79d0c..33e81896 100644 --- a/src/LYDownload.c +++ b/src/LYDownload.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTParse.h> #include <HTList.h> #include <HTAlert.h> @@ -22,8 +21,6 @@ #include <LYexit.h> #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - /* * LYDownload takes a URL and downloads it using a user selected * download program @@ -215,12 +212,7 @@ check_recall: } if (no_dotfiles || !show_dotfiles) { - if (*buffer == '.' || -#ifdef VMS - ((cp = strrchr(buffer, ':')) && *(cp+1) == '.') || - ((cp = strrchr(buffer, ']')) && *(cp+1) == '.') || -#endif /* VMS */ - ((cp = strrchr(buffer, '/')) && *(cp+1) == '.')) { + if (*LYPathLeaf(buffer) == '.') { HTAlert(FILENAME_CANNOT_BE_DOT); _statusline(NEW_FILENAME_PROMPT); FirstRecall = TRUE; @@ -500,12 +492,7 @@ check_recall: } if (no_dotfiles || !show_dotfiles) { - if (*buffer == '.' || -#ifdef VMS - ((cp = strrchr(buffer, ':')) && *(cp+1) == '.') || - ((cp = strrchr(buffer, ']')) && *(cp+1) == '.') || -#endif /* VMS */ - ((cp = strrchr(buffer, '/')) && *(cp+1) == '.')) { + if (*LYPathLeaf(buffer) == '.') { HTAlert(FILENAME_CANNOT_BE_DOT); _statusline(NEW_FILENAME_PROMPT); goto again; diff --git a/src/LYEdit.c b/src/LYEdit.c index 75f0521e..36da56c2 100644 --- a/src/LYEdit.c +++ b/src/LYEdit.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTParse.h> #include <HTAlert.h> #include <LYCurses.h> @@ -20,8 +19,6 @@ #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - /* * In edit mode invoke either emacs, vi, pico, jove, jed sedt or the * default editor to display and edit the current file. diff --git a/src/LYEdit.h b/src/LYEdit.h index 08c07625..f8ee515d 100644 --- a/src/LYEdit.h +++ b/src/LYEdit.h @@ -1,7 +1,8 @@ - #ifndef LYEDIT_H #define LYEDIT_H +#include <HTUtils.h> + extern int edit_current_file PARAMS((char *newfile, int cur, int lineno)); #endif /* LYEDIT_H */ diff --git a/src/LYEditmap.c b/src/LYEditmap.c index 290a47d1..cf8cc312 100644 --- a/src/LYEditmap.c +++ b/src/LYEditmap.c @@ -3,7 +3,6 @@ */ #include <HTUtils.h> -#include <tcp.h> #include <LYStrings.h> PUBLIC int current_lineedit = 0; /* Index into LYLineEditors[] */ diff --git a/src/LYExtern.c b/src/LYExtern.c index 9701d576..fb52cea7 100644 --- a/src/LYExtern.c +++ b/src/LYExtern.c @@ -15,17 +15,14 @@ See lynx.cfg for other info. */ -#include <tcp.h> -#include <LYGlobalDefs.h> #include <LYUtils.h> +#include <LYGlobalDefs.h> #include <LYExtern.h> #include <LYCurses.h> #include <LYLeaks.h> #ifdef USE_EXTERNALS -#define FREE(x) if (x) {free(x); x = NULL;} - void run_external ARGS1(char *, c) { char command[1024]; diff --git a/src/LYForms.c b/src/LYForms.c index 3f572bc2..4935e2f1 100644 --- a/src/LYForms.c +++ b/src/LYForms.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTCJK.h> #include <HTTP.h> #include <HTAlert.h> @@ -13,6 +12,9 @@ #include <LYGlobalDefs.h> #include <LYKeymap.h> #include <LYSignal.h> +#ifdef DJGPP_KEYHANDLER +#include <keys.h> +#endif /* DJGPP_KEYHANDLER */ #include <LYLeaks.h> @@ -381,6 +383,20 @@ again: if (keymap[ch + 1] == LYK_REFRESH) break; switch (ch) { +#ifdef DJGPP_KEYHANDLER + case K_Down: + case K_EDown: + case K_Up: + case K_EUp: + case K_PageUp: + case K_EPageUp: + case K_PageDown: + case K_EPageDown: + case K_Home: + case K_EHome: + case K_End: + case K_EEnd: +#else case DNARROW: case UPARROW: case PGUP: @@ -391,13 +407,19 @@ again: case FIND_KEY: case SELECT_KEY: #endif /* NOTDEFINED */ +#endif /* DJGPP_KEYHANDLER */ goto breakfor; /* * Left arrrow in column 0 deserves special treatment here, * else you can get trapped in a form without submit button! */ +#ifdef DJGPP_KEYHANDLER + case K_Left: + case K_ELeft: +#else case LTARROW: +#endif /* DJGPP_KEYHANDLER */ if (MyEdit.pos == 0) { int c = 'Y'; /* Go back immediately if no changes */ if (strcmp(MyEdit.buffer, value)) { diff --git a/src/LYGetFile.c b/src/LYGetFile.c index 28bac09e..7d40e685 100644 --- a/src/LYGetFile.c +++ b/src/LYGetFile.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTTP.h> #include <HTAnchor.h> /* Anchor class */ #include <HTAccess.h> @@ -45,8 +44,6 @@ #endif /* SYSLOG_REQUESTED_URLS */ #endif /* !VMS */ -#define FREE(x) if (x) {free(x); x = NULL;} - PRIVATE int fix_http_urls PARAMS((document *doc)); extern char * WWW_Download_File; #ifdef VMS @@ -286,8 +283,10 @@ Try_Redirected_URL: } else if (url_type == LYNXPRINT_URL_TYPE) { return(printfile(doc)); +#ifdef EXP_FORMS_OPTIONS } else if (url_type == LYNXOPTIONS_URL_TYPE) { return(postoptions(doc)); +#endif /* EXP_FORMS_OPTIONS */ } else if (url_type == NEWSPOST_URL_TYPE || url_type == NEWSREPLY_URL_TYPE || @@ -452,11 +451,7 @@ Try_Redirected_URL: #endif /* !VMS */ printf("\n%s", RETURN_TO_LYNX); fflush(stdout); -#ifdef DJGPP_KEYHANDLER - getxkey(); -#else LYgetch(); -#endif /* DJGPP_KEYHANDLER */ #ifdef VMS { extern BOOLEAN HadVMSInterrupt; @@ -909,7 +904,7 @@ Try_Redirected_URL: HTMLSetCharacterHandling(current_char_set); /* * Check for a suggested filename from - * the Content-Dispostion header. - FM + * the Content-Disposition header. - FM */ if (((tmpanchor = HTAnchor_parent( HTAnchor_findAddress(&WWWDoc) diff --git a/src/LYGetFile.h b/src/LYGetFile.h index 8ddfb999..93239e83 100644 --- a/src/LYGetFile.h +++ b/src/LYGetFile.h @@ -1,7 +1,8 @@ - #ifndef LYGETFILE_H #define LYGETFILE_H +#include <LYStructs.h> + #define NOT_FOUND 0 #define NORMAL 1 #define NULLFILE 3 diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index a66dc1af..3dcb7e2f 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -285,10 +285,12 @@ extern BOOLEAN LYMBMAdvanced; /* MBM statusline for ADVANCED? */ extern int LYStatusLine; /* Line for statusline() or -1 */ extern BOOLEAN LYCollapseBRs; /* Collapse serial BRs? */ extern BOOLEAN LYSetCookies; /* Process Set-Cookie headers? */ -extern BOOLEAN LYEatAllCookies; /* accept ALL cookies? */ +extern BOOLEAN LYAcceptAllCookies; /* accept ALL cookies? */ +extern char *LYCookieAcceptDomains; /* domains to accept all cookies */ +extern char *LYCookieRejectDomains; /* domains to reject all cookies */ extern char *XLoadImageCommand; /* Default image viewer for X */ #ifdef USE_EXTERNALS -extern BOOLEAN no_externals; /* don't allow the use of externals */ +extern BOOLEAN no_externals; /* don't allow the use of externals */ #endif extern BOOLEAN LYNoISMAPifUSEMAP; /* Omit ISMAP link if MAP present? */ extern int LYHiddenLinks; @@ -297,7 +299,7 @@ extern BOOL New_DTD; #define BOOKMARK_TITLE "Bookmark file" #define MOSAIC_BOOKMARK_TITLE "Converted Mosaic Hotlist" -#define MBM_V_MAXFILES 25 /* Max number of sub-bookmark files */ +#define MBM_V_MAXFILES 25 /* Max number of sub-bookmark files */ /* * Arrays that holds the names of sub-bookmark files * and their descriptions. diff --git a/src/LYHash.h b/src/LYHash.h index 00f8066c..c76ae994 100644 --- a/src/LYHash.h +++ b/src/LYHash.h @@ -1,6 +1,8 @@ #if !defined(_LYHASH_H_) #define _LYHASH_H_ 1 +#include <HTUtils.h> + struct _hashbucket { char *name; /* name of this item */ int code; /* code of this item */ diff --git a/src/LYHistory.c b/src/LYHistory.c index 38522586..9355d979 100644 --- a/src/LYHistory.c +++ b/src/LYHistory.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTTP.h> #include <HTAlert.h> #include <HText.h> @@ -23,8 +22,6 @@ #include <LYexit.h> #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - PUBLIC HTList * Visited_Links = NULL; /* List of safe popped docs. */ /* diff --git a/src/LYJump.c b/src/LYJump.c index ec211f02..aab39263 100644 --- a/src/LYJump.c +++ b/src/LYJump.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTAlert.h> #include <LYUtils.h> #include <LYStrings.h> @@ -15,8 +14,6 @@ #include <fab.h> #endif /* VMS */ -#define FREE(x) if (x) {free(x); x = NULL;} - struct JumpTable *JThead = NULL; PRIVATE int LYCompare PARAMS ((CONST void *e1, CONST void *e2)); diff --git a/src/LYJump.h b/src/LYJump.h index 5da8f885..3a82b075 100644 --- a/src/LYJump.h +++ b/src/LYJump.h @@ -1,7 +1,8 @@ - #ifndef LYJUMP_H #define LYJUMP_H +#include <HTList.h> + typedef struct _JumpDatum { char *key; char *url; diff --git a/src/LYKeymap.c b/src/LYKeymap.c index 3e087687..4386ebde 100644 --- a/src/LYKeymap.c +++ b/src/LYKeymap.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <LYUtils.h> #include <LYKeymap.h> #include <LYGlobalDefs.h> diff --git a/src/LYKeymap.h b/src/LYKeymap.h index 406d3660..1c02cd61 100644 --- a/src/LYKeymap.h +++ b/src/LYKeymap.h @@ -1,6 +1,8 @@ #ifndef LYKEYMAP_H #define LYKEYMAP_H +#include <HTUtils.h> + extern BOOLEAN LYisNonAlnumKeyname PARAMS((int ch, int key_name)); extern char *key_for_func PARAMS((int func)); extern int LYReverseKeymap PARAMS((int key_name)); diff --git a/src/LYLeaks.c b/src/LYLeaks.c index 222b48aa..bb41b9ad 100644 --- a/src/LYLeaks.c +++ b/src/LYLeaks.c @@ -10,13 +10,9 @@ #define NO_MEMORY_TRACKING #include <HTUtils.h> -#include <tcp.h> #include <LYexit.h> #include <LYLeaks.h> #include <LYUtils.h> -#include <ctype.h> - -#define FREE(x) if (x) {free(x); x = NULL;} PRIVATE AllocationList *ALp_RunTimeAllocations = NULL; diff --git a/src/LYList.c b/src/LYList.c index f7b31e4c..54a78b7b 100644 --- a/src/LYList.c +++ b/src/LYList.c @@ -6,7 +6,6 @@ */ #include <HTUtils.h> -#include <tcp.h> #include <LYUtils.h> #include <GridText.h> #include <LYList.h> @@ -22,8 +21,6 @@ #include <LYexit.h> #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - /* showlist - F.Macrides (macrides@sci.wfeb.edu) ** -------- ** Create a temporary text/html file with a list of links to @@ -164,8 +161,8 @@ PUBLIC int showlist ARGS2( /* * Set flag to note that we had at least one internal link, * if the document from which we are generating the list - * has assosiated POST data; after an extra check that the - * link destination really has hthe same POST data so that + * has associated POST data; after an extra check that the + * link destination really has the same POST data so that * we can believe it is an internal link. */ intern_w_post = TRUE; @@ -226,7 +223,7 @@ PUBLIC int showlist ARGS2( * Make necessary changes to newdoc before returning to caller. * If the intern_w_post flag is set, we keep the POST data in * newdoc that have been passed in. They should be the same as - * in the loaded locument for which we generated the list. + * in the loaded document for which we generated the list. * In that case the file we have written will be associated with * the same POST data when it is loaded after we are done here, * so that following one of the links we have marked as "internal @@ -289,7 +286,7 @@ PUBLIC void printlist ARGS2( if (child == 0) { /* * child should not be 0 unless form field numbering is on - * and cnt is the number of a form intput field. + * and cnt is the number of a form input field. * HText_FormDescNumber() will set desc to a description * of what type of input field this is. We'll create a * within-document link to ensure that the link numbers on diff --git a/src/LYList.h b/src/LYList.h index 4a717284..f0071d49 100644 --- a/src/LYList.h +++ b/src/LYList.h @@ -1,7 +1,8 @@ - #ifndef LYLIST_H #define LYLIST_H +#include <LYStructs.h> + extern char * LYlist_temp_url NOPARAMS; extern int showlist PARAMS((document *newdoc, BOOLEAN titles)); extern void printlist PARAMS((FILE *fp, BOOLEAN titles)); diff --git a/src/LYLocal.c b/src/LYLocal.c index d85be6e3..c22c6b79 100644 --- a/src/LYLocal.c +++ b/src/LYLocal.c @@ -29,7 +29,6 @@ */ #include <HTUtils.h> -#include <tcp.h> #include <HTAlert.h> #include <HTParse.h> #include <LYCurses.h> @@ -72,9 +71,6 @@ #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - - PRIVATE int LYExecv PARAMS(( char * path, char ** argv, @@ -265,7 +261,7 @@ PRIVATE BOOLEAN remove_tagged NOARGS count = 0; tag = tagged; while (ans == 'Y' && (cp = (char *)HTList_nextObject(tag)) != NULL) { - if (is_url(cp) == FILE_URL_TYPE) { /* unecessary check */ + if (is_url(cp) == FILE_URL_TYPE) { /* unnecessary check */ tp = cp; if (!strncmp(tp, "file://localhost", 16)) { tp += 16; @@ -447,7 +443,7 @@ PRIVATE BOOLEAN modify_tagged ARGS1( * Make sure the target location is a directory which is owned * by the same uid as the owner of the current location. */ - if ((dir_info.st_mode & S_IFMT) == S_IFDIR) { + if (S_ISDIR(dir_info.st_mode)) { if (dir_info.st_uid == owner) { count = 0; tag = tagged; @@ -525,9 +521,9 @@ PRIVATE BOOLEAN modify_name ARGS1( /* * Change the name of the file or directory. */ - if ((dir_info.st_mode & S_IFMT) == S_IFDIR) { + if (S_ISDIR(dir_info.st_mode)) { cp = "Enter new name for directory: "; - } else if ((dir_info.st_mode & S_IFMT) == S_IFREG) { + } else if (S_ISREG(dir_info.st_mode)) { cp = "Enter new name for file: "; } else { _statusline( @@ -570,11 +566,11 @@ PRIVATE BOOLEAN modify_name ARGS1( return (-1); return 1; } - } else if ((dir_info.st_mode & S_IFMT) == S_IFDIR) { + } else if (S_ISDIR(dir_info.st_mode)) { _statusline( "There is already a directory with that name! Request ignored."); sleep(AlertSecs); - } else if ((dir_info.st_mode & S_IFMT) == S_IFREG) { + } else if (S_ISREG(dir_info.st_mode)) { _statusline( "There is already a file with that name! Request ignored."); sleep(AlertSecs); @@ -620,9 +616,9 @@ PRIVATE BOOLEAN modify_location ARGS1( /* * Change the location of the file or directory. */ - if ((dir_info.st_mode & S_IFMT) == S_IFDIR) { + if (S_ISDIR(dir_info.st_mode)) { cp = "Enter new location for directory: "; - } else if ((dir_info.st_mode & S_IFMT) == S_IFREG) { + } else if (S_ISREG(dir_info.st_mode)) { cp = "Enter new location for file: "; } else { _statusline( @@ -670,7 +666,7 @@ PRIVATE BOOLEAN modify_location ARGS1( sleep(AlertSecs); return 0; } - if ((dir_info.st_mode & S_IFMT) != S_IFDIR) { + if (S_ISDIR(dir_info.st_mode)) { _statusline( "Destination is not a valid directory! Request denied."); sleep(AlertSecs); @@ -838,11 +834,11 @@ PRIVATE BOOLEAN create_file ARGS1( if (LYExecv(TOUCH_PATH, args, tmpbuf) <= 0) return (-1); return 1; - } else if ((dir_info.st_mode & S_IFMT) == S_IFDIR) { + } else if (S_ISDIR(dir_info.st_mode)) { _statusline( "There is already a directory with that name! Request ignored."); sleep(AlertSecs); - } else if ((dir_info.st_mode & S_IFMT) == S_IFREG) { + } else if (S_ISREG(dir_info.st_mode)) { _statusline( "There is already a file with that name! Request ignored."); sleep(AlertSecs); @@ -904,11 +900,11 @@ PRIVATE BOOLEAN create_directory ARGS1( if (LYExecv(MKDIR_PATH, args, tmpbuf) <= 0) return (-1); return 1; - } else if ((dir_info.st_mode & S_IFMT) == S_IFDIR) { + } else if (S_ISDIR(dir_info.st_mode)) { _statusline( "There is already a directory with that name! Request ignored."); sleep(AlertSecs); - } else if ((dir_info.st_mode & S_IFMT) == S_IFREG) { + } else if (S_ISREG(dir_info.st_mode)) { _statusline( "There is already a file with that name! Request ignored."); sleep(AlertSecs); @@ -985,7 +981,7 @@ PRIVATE BOOLEAN remove_single ARGS1( } else { cp = testpath; } - if ((dir_info.st_mode & S_IFMT) == S_IFDIR) { + if (S_ISDIR(dir_info.st_mode)) { if (strlen(cp) < 37) { sprintf(tmpbuf, "Remove '%s' and all of its contents (y or n): ", cp); @@ -993,14 +989,14 @@ PRIVATE BOOLEAN remove_single ARGS1( sprintf(tmpbuf, "Remove directory and all of its contents (y or n): "); } - } else if ((dir_info.st_mode & S_IFMT) == S_IFREG) { + } else if (S_ISREG(dir_info.st_mode)) { if (strlen(cp) < 60) { sprintf(tmpbuf, "Remove file '%s' (y or n): ", cp); } else { sprintf(tmpbuf, "Remove file (y or n): "); } #ifdef S_IFLNK - } else if ((dir_info.st_mode & S_IFMT) == S_IFLNK) { + } else if (S_ISLNK(dir_info.st_mode)) { if (strlen(cp) < 50) { sprintf(tmpbuf, "Remove symbolic link '%s' (y or n): ", cp); } else { @@ -1102,10 +1098,6 @@ static struct { use shell access for that. */ }; -#ifndef S_ISDIR -#define S_ISDIR(mode) ((mode&0xF000) == 0x4000) -#endif /* !S_ISDIR */ - PRIVATE char LYValidPermitFile[256] = "\0"; /* @@ -1146,8 +1138,8 @@ PRIVATE BOOLEAN permit_location ARGS3( _statusline(tmpbuf); sleep(AlertSecs); return 0; - } else if ((dir_info.st_mode & S_IFMT) != S_IFDIR && - (dir_info.st_mode & S_IFMT) != S_IFREG) { + } else if (!S_ISDIR(dir_info.st_mode) && + !S_ISREG(dir_info.st_mode)) { _statusline( "The specified item is not a file nor a directory - request ignored."); sleep(AlertSecs); @@ -1249,7 +1241,7 @@ PRIVATE BOOLEAN permit_location ARGS3( fprintf(fp0, "<Br>\n<Li><Input Type=\"submit\" Value=\"Submit\"> \ form to permit %s %s.\n</Ol>\n</Form>\n", - (dir_info.st_mode & S_IFMT) == S_IFDIR ? "directory" : "file", + S_ISDIR(dir_info.st_mode) ? "directory" : "file", user_filename); fprintf(fp0, "</Body></Html>"); LYCloseTempFP(fp0); @@ -1312,8 +1304,8 @@ form to permit %s %s.\n</Ol>\n</Form>\n", _statusline(tmpbuf); sleep(AlertSecs); return 0; - } else if ((dir_info.st_mode & S_IFMT) != S_IFDIR && - (dir_info.st_mode & S_IFMT) != S_IFREG) { + } else if (!S_ISDIR(dir_info.st_mode) && + !S_ISREG(dir_info.st_mode)) { _statusline( "The specified item is not a file nor a directory - request ignored."); sleep(AlertSecs); @@ -1823,14 +1815,14 @@ PUBLIC int dired_options ARGS2( if (mp->cond == DE_TAG && nothing_tagged) continue; if (mp->cond == DE_DIR && - (!*path || (dir_info.st_mode & S_IFMT) != S_IFDIR)) + (!*path || !S_ISDIR(dir_info.st_mode))) continue; if (mp->cond == DE_FILE && - (!*path || (dir_info.st_mode & S_IFMT) != S_IFREG)) + (!*path || !S_ISREG(dir_info.st_mode))) continue; #ifdef S_IFLNK if (mp->cond == DE_SYMLINK && - (!*path || (dir_info.st_mode & S_IFMT) != S_IFLNK)) + (!*path || !S_ISLNK(dir_info.st_mode))) continue; #endif if (*mp->sfx && @@ -1931,8 +1923,8 @@ PUBLIC BOOLEAN local_install ARGS3( _statusline(tmpbuf); sleep(AlertSecs); return 0; - } else if ((dir_info.st_mode & S_IFMT) != S_IFDIR && - (dir_info.st_mode & S_IFMT) != S_IFREG) { + } else if (!S_ISDIR(dir_info.st_mode) && + !S_ISREG(dir_info.st_mode)) { _statusline( "The selected item is not a file or a directory! Request ignored."); sleep(AlertSecs); @@ -1954,12 +1946,12 @@ PUBLIC BOOLEAN local_install ARGS3( _statusline(tmpbuf); sleep(AlertSecs); return 0; - } else if ((dir_info.st_mode & S_IFMT) != S_IFDIR) { + } else if (!S_ISDIR(dir_info.st_mode)) { _statusline( "The selected item is not a directory! Request ignored."); sleep(AlertSecs); return 0; - } else if (0 /*directory not writeable*/) { + } else if (0 /*directory not writable*/) { _statusline("Install in the selected directory not permitted."); sleep(AlertSecs); return 0; diff --git a/src/LYLocal.h b/src/LYLocal.h index 47fff5c0..48f9509a 100644 --- a/src/LYLocal.h +++ b/src/LYLocal.h @@ -6,11 +6,6 @@ #ifdef VMS #include <types.h> #include <stat.h> -#else -#if 0 /* already included in tcp.h */ -#include <sys/types.h> -#include <sys/stat.h> -#endif #endif /* VMS */ #ifndef S_IRWXU diff --git a/src/LYMail.c b/src/LYMail.c index 50c78f19..3557907f 100644 --- a/src/LYMail.c +++ b/src/LYMail.c @@ -9,7 +9,6 @@ */ #include <HTUtils.h> -#include <tcp.h> #include <HTParse.h> #include <LYGlobalDefs.h> #include <HTAlert.h> @@ -25,8 +24,6 @@ #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - BOOLEAN term_letter; /* Global variable for async i/o. */ PRIVATE void terminate_letter PARAMS((int sig)); PRIVATE void remove_tildes PARAMS((char *string)); diff --git a/src/LYMain.c b/src/LYMain.c index 3651f0cc..ea5584d0 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTTP.h> #include <HTParse.h> #include <HTAccess.h> @@ -52,8 +51,6 @@ #include <LYexit.h> #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - #ifdef VMS #define DISPLAY "DECW$DISPLAY" #else @@ -336,7 +333,9 @@ PUBLIC BOOLEAN LYMBMAdvanced = TRUE; PUBLIC int LYStatusLine = -1; /* Line for statusline() if > -1 */ PUBLIC BOOLEAN LYCollapseBRs = COLLAPSE_BR_TAGS; /* Collapse serial BRs? */ PUBLIC BOOLEAN LYSetCookies = SET_COOKIES; /* Process Set-Cookie headers? */ -PUBLIC BOOLEAN LYEatAllCookies = EAT_ALL_COOKIES; /* take all cookies? */ +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 */ PUBLIC char *XLoadImageCommand = NULL; /* Default image viewer for X */ PUBLIC BOOLEAN LYNoISMAPifUSEMAP = FALSE; /* Omit ISMAP link if MAP present? */ PUBLIC int LYHiddenLinks = HIDDENLINKS_SEPARATE; /* Show hidden links? */ @@ -2525,6 +2524,10 @@ static int width_fun ARGS3( static Parse_Args_Type Arg_Table [] = { + PARSE_SET( + "accept_all_cookies", SET_ARG, &LYAcceptAllCookies, + "accepts all cookies" + ), PARSE_FUN( "anonymous", FUNCTION_ARG, anonymous_fun, "used to specify the anonymous account" @@ -2608,10 +2611,6 @@ with -dump, format output as with -traversal, but to stdout" "dump", FUNCTION_ARG, dump_output_fun, "dump the first file to stdout and exit" ), - PARSE_SET( - "eat_all_cookies", SET_ARG, &LYEatAllCookies, - "accepts all cookies" - ), PARSE_FUN( "editor", NEED_FUNCTION_ARG, editor_fun, "=EDITOR\nenable edit mode with specified editor" diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index a232be02..b00b039b 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTAccess.h> #include <HTParse.h> #include <HTList.h> @@ -84,8 +83,6 @@ PRIVATE int sametext ARGS2( } #endif /* FASTTAB */ -#define FREE(x) if (x) {free(x); x = NULL;} - PUBLIC HTList * Goto_URLs = NULL; /* List of Goto URLs */ PUBLIC char * LYRequestTitle = NULL; /* newdoc.title in calls to getfile() */ @@ -234,7 +231,9 @@ int mainloop NOARGS char *temp = NULL; BOOLEAN ForcePush = FALSE; BOOLEAN override_LYresubmit_posts = FALSE; +#ifdef EXP_FORMS_OPTIONS BOOLEAN was_in_options = FALSE; +#endif unsigned int len; int i; @@ -382,11 +381,12 @@ try_again: * under case NORMAL. - FM */ #ifndef EXP_FORMS_OPTIONS - if (strncmp(newdoc.address, "LYNXDOWNLOAD:", 13)) { + if (strncmp(newdoc.address, "LYNXDOWNLOAD:", 13)) #else /* EXP_FORMS_OPTIONS */ if (strncmp(newdoc.address, "LYNXDOWNLOAD:", 13) && - strncmp(newdoc.address, "LYNXOPTIONS:", 12)) { + strncmp(newdoc.address, "LYNXOPTIONS:", 12)) #endif /* EXP_FORMS_OPTIONS */ + { LYpush(&curdoc, ForcePush); } } else if (!newdoc.address) { @@ -3818,7 +3818,7 @@ check_goto_URL: c = dir_list_style; #endif /* DIRED_SUPPORT */ #ifndef EXP_FORMS_OPTIONS - options(); /* do the options stuff */ + LYoptions(); /* do the options stuff */ if (keypad_mode_flag != keypad_mode || (user_mode_flag != user_mode && @@ -4302,7 +4302,7 @@ check_goto_URL: _statusline(NO_STATUS); sleep(AlertSecs); } else { - if (((dir_info.st_mode) & S_IFMT) == S_IFREG) { + if (S_ISREG(dir_info.st_mode)) { StrAllocCopy(tp, cp); HTUnEscapeSome(tp, "/"); if (edit_current_file(tp, @@ -4616,7 +4616,7 @@ check_goto_URL: } else { char *VMSdir = NULL; - if (((stat_info.st_mode) & S_IFMT) == S_IFDIR) { + if (S_ISDIR(stat_info.st_mode)) { /* * We're viewing a local directory. Make * that the CSwing argument. - FM diff --git a/src/LYMainLoop.h b/src/LYMainLoop.h index 8a501234..25d7b133 100644 --- a/src/LYMainLoop.h +++ b/src/LYMainLoop.h @@ -1,7 +1,8 @@ - #ifndef LYMAINLOOP_H #define LYMAINLOOP_H +#include <HTUtils.h> + extern void LYCloseTracelog NOPARAMS; extern int mainloop NOPARAMS; diff --git a/src/LYMap.c b/src/LYMap.c index 1e1ba24d..75527572 100644 --- a/src/LYMap.c +++ b/src/LYMap.c @@ -6,7 +6,6 @@ */ #include <HTUtils.h> -#include <tcp.h> #include <HTTP.h> #include <HTAnchor.h> #include <HTAccess.h> @@ -29,8 +28,6 @@ #include <LYexit.h> #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x=NULL;} - typedef struct _LYMapElement { char * address; char * title; diff --git a/src/LYMap.h b/src/LYMap.h index ae0f9d69..0ce31797 100644 --- a/src/LYMap.h +++ b/src/LYMap.h @@ -1,7 +1,10 @@ - #ifndef LYMAP_H #define LYMAP_H +#include <HTUtils.h> +#include <HTList.h> +#include <HTAnchor.h> + extern BOOL LYMapsOnly; extern void ImageMapList_free PARAMS((HTList * list)); diff --git a/src/LYNews.c b/src/LYNews.c index 3237a0ea..91c6fc3d 100644 --- a/src/LYNews.c +++ b/src/LYNews.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTParse.h> #include <HTAccess.h> #include <HTCJK.h> @@ -21,8 +20,6 @@ #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - /* ** Global variable for async i/o. */ diff --git a/src/LYOptions.c b/src/LYOptions.c index 62f1c367..267d8770 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTFTP.h> #include <HTML.h> #include <LYCurses.h> @@ -22,18 +21,17 @@ #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - #ifdef VMS #define DISPLAY "DECW$DISPLAY" #else #define DISPLAY "DISPLAY" #endif /* VMS */ -#define COL_OPTION_VALUES 36 /* display column where option values start */ - BOOLEAN term_options; + PRIVATE void terminate_options PARAMS((int sig)); + +#ifndef EXP_FORMS_OPTIONS PRIVATE int boolean_choice PARAMS(( int status, int line, @@ -46,9 +44,12 @@ PRIVATE int popup_choice PARAMS(( char ** choices, int i_length, int disabled)); +#endif /* EXP_FORMS_OPTIONS */ #define MAXCHOICES 10 +#define COL_OPTION_VALUES 36 /* display column where option values start */ + #define L_Bool_A (use_assume_charset ? L_BOOL_A + 1 : L_BOOL_A) #define L_Bool_B (use_assume_charset ? L_BOOL_B + 1 : L_BOOL_B) #define L_Exec (use_assume_charset ? L_EXEC + 1 : L_EXEC) @@ -84,6 +85,7 @@ PRIVATE void option_statusline ARGS1( LYStatusLine = -1; } +#ifndef EXP_FORMS_OPTIONS PRIVATE void option_user_message ARGS2( CONST char *, message, char *, argument) @@ -108,7 +110,7 @@ PRIVATE void option_user_message ARGS2( LYStatusLine = -1; } -PUBLIC void options NOARGS +PUBLIC void LYoptions NOARGS { #ifdef ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS int itmp; @@ -300,7 +302,7 @@ draw_options: } else { switch (LYChosenShowColor) { case SHOW_COLOR_NEVER: - addstr("NEVER "); + addstr("NEVER "); break; case SHOW_COLOR_OFF: addstr("OFF"); @@ -830,9 +832,9 @@ draw_options: } /* - * Set the raw 8-bit or CJK mode defaults and - * character set if changed. - FM - */ + * Set the raw 8-bit or CJK mode defaults and + * character set if changed. - FM + */ if (CurrentAssumeCharSet != UCLYhndl_for_unspec || UCLYhndl_for_unspec != curval) { if (UCLYhndl_for_unspec != CurrentAssumeCharSet) { @@ -841,7 +843,7 @@ draw_options: } LYRawMode = (UCLYhndl_for_unspec == current_char_set); HTMLSetUseDefaultRawMode(current_char_set, LYRawMode); - HTMLUseCharacterSet(current_char_set); + HTMLSetCharacterHandling(current_char_set); CurrentAssumeCharSet = UCLYhndl_for_unspec; CurrentAssumeLocalCharSet = UCLYhndl_HTFile_for_unspec; CurrentRawMode = LYRawMode; @@ -1754,6 +1756,7 @@ PRIVATE int boolean_choice ARGS4( } } } +#endif /* EXP_FORMS_OPTIONS */ PRIVATE void terminate_options ARGS1( int, sig GCC_UNUSED) @@ -2060,6 +2063,7 @@ draw_bookmark_list: signal(SIGINT, cleanup_sig); } +#ifndef EXP_FORMS_OPTIONS /* ** This function prompts for a choice or page number. ** If a 'g' or 'p' suffix is included, that will be @@ -3106,6 +3110,8 @@ restore_popup_statusline: } } +#else /* EXP_FORMS_OPTIONS */ + /* * I'm paranoid about mistyping strings. Also, this way they get combined * so we don't have to worry about the intelligence of the compiler. @@ -3141,9 +3147,9 @@ static char * search_type_string = "search_type"; static char * search_case_insensitive_string = "case_insensitive"; static char * search_case_sensitive_string = "case_sensitive"; -static char * prefered_doc_lang_string = "prefered_doc_lang"; +static char * preferred_doc_lang_string = "preferred_doc_lang"; -static char * prefered_doc_char_string = "prefered_doc_char"; +static char * preferred_doc_char_string = "preferred_doc_char"; static char * assume_char_set_string = "assume_char_set"; @@ -3240,6 +3246,13 @@ PRIVATE struct post_pair * break_data ARGS1( * Handle options from the pseudo-post. I think we really only need * post_data here, but bring along everything just in case. It's only a * 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 :-( + * So we introduce boolean flag 'need_reload' (currently dummy). */ PUBLIC int postoptions ARGS1( @@ -3248,6 +3261,7 @@ PUBLIC int postoptions ARGS1( struct post_pair *data; int i; BOOLEAN save_all = FALSE; + BOOLEAN need_reload = FALSE; data = break_data(newdoc->post_data); @@ -3321,22 +3335,36 @@ PUBLIC int postoptions ARGS1( } /* - * prefered_doc_lang + * preferred_doc_lang */ - if (!strcmp(data[i].tag, prefered_doc_lang_string)) { + if (!strcmp(data[i].tag, preferred_doc_lang_string)) { FREE(language); StrAllocCopy(language, data[i].value); } /* - * prefered_doc_char + * preferred_doc_char */ - if (!strcmp(data[i].tag, prefered_doc_lang_string)) { + if (!strcmp(data[i].tag, preferred_doc_char_string)) { FREE(pref_charset); StrAllocCopy(pref_charset, data[i].value); } /* + * raw_mode + */ + if (!strcmp(data[i].tag, raw_mode_string)) { + BOOLEAN newmode; + newmode = (!strcmp(data[i].value, on_string)); + if (newmode != LYRawMode) { + LYRawMode = newmode; + HTMLSetUseDefaultRawMode(current_char_set, LYRawMode); + HTMLSetCharacterHandling(current_char_set); + need_reload = TRUE; + } + } + + /* * assume_char_set */ if (!strcmp(data[i].tag, assume_char_set_string)) { @@ -3360,16 +3388,13 @@ PUBLIC int postoptions ARGS1( StrAllocCopy(UCAssume_MIMEcharset, data[i].value); LYRawMode = (UCLYhndl_for_unspec == current_char_set); HTMLSetUseDefaultRawMode(current_char_set, LYRawMode); - HTMLUseCharacterSet(current_char_set); + HTMLSetCharacterHandling(current_char_set); } } /* * display_char_set */ - /* - * FIXME: This needs validation. - MRC - */ if (!strcmp(data[i].tag, display_char_set_string)) { int newval; @@ -3383,6 +3408,7 @@ PUBLIC int postoptions ARGS1( HTMLSetRawModeDefault(current_char_set); LYUseDefaultRawMode = TRUE; HTMLUseCharacterSet(current_char_set); + need_reload = TRUE; } } @@ -3403,19 +3429,6 @@ PUBLIC int postoptions ARGS1( } /* - * raw_mode - */ - if (!strcmp(data[i].tag, raw_mode_string)) { - BOOLEAN newmode; - newmode = (!strcmp(data[i].value, on_string)); - if (newmode != LYRawMode) { - LYRawMode = newmode; - HTMLSetUseDefaultRawMode(current_char_set, LYRawMode); - HTMLSetCharacterHandling(current_char_set); - } - } - - /* * vi_keys */ if (!strcmp(data[i].tag, vi_keys_string)) { @@ -3535,6 +3548,9 @@ PUBLIC int postoptions ARGS1( HTAlert(OPTIONS_NOT_SAVED); } } + if (need_reload == TRUE) { + /* FIXME: currently dummy */ + } return(NULLFILE); } @@ -3545,6 +3561,10 @@ PUBLIC int postoptions ARGS1( * Basic Strategy: For each option, throw up the appropriate type of * control, giving defaults as appropriate. If nothing else, we're * probably going to test every control there is. MRC + * + * Each option from this form will be processed whether it was changed or not. + * The order may be important for some fields (like RawMode) + * unless we add a special flag in postoptions() */ PUBLIC int gen_options ARGS1( char **, newfile) @@ -3567,10 +3587,10 @@ PUBLIC int gen_options ARGS1( StrAllocCopy(*newfile, print_filename); LYforce_no_cache = TRUE; - fprintf(fp0, "<head>\n<title>%s</title>\n</head>\n<body>\n", + fprintf(fp0, "<html><head>\n<title>%s</title>\n</head>\n<body>\n", OPTIONS_TITLE); - fprintf(fp0,"<h1>Options Menu (%s Version %s)</h1><pre>\n", + fprintf(fp0,"<h1>Options Menu (%s Version %s)</h1>\n", LYNX_NAME, LYNX_VERSION); /* @@ -3588,6 +3608,18 @@ PUBLIC int gen_options ARGS1( secure_string, secure_value); /* + * visible preformated text begins here + */ + fprintf(fp0,"<pre>\n\n"); + + /* + * save/reset + */ + fprintf(fp0,"<input type=\"submit\" value=\"Accept Changes\">"); + fprintf(fp0," <input type=\"reset\" value=\"Reset\">"); + fprintf(fp0," Use the back key to cancel changes.\n\n"); + + /* * editor */ fprintf(fp0,"<%s>Editor:</%s> ", label_string, label_string); @@ -3645,24 +3677,51 @@ PUBLIC int gen_options ARGS1( fprintf(fp0,"</select>\n"); /* - * prefered_doc_lang + * preferred_doc_lang */ - fprintf(fp0,"<%s>Prefered document language</%s> ", label_string, + fprintf(fp0,"<%s>Preferred document language</%s> ", label_string, label_string); fprintf(fp0,"<input type=\"text\" name=\"%s\" value=\"%s\">\n", - prefered_doc_lang_string, + preferred_doc_lang_string, (language && language[0])?language:empty_string); /* - * prefered_doc_char + * preferred_doc_char */ - fprintf(fp0,"<%s>Prefered document character set</%s> ", label_string, + fprintf(fp0,"<%s>Preferred document character set</%s> ", label_string, label_string); fprintf(fp0,"<input type=\"text\" name=\"%s\" value=\"%s\">\n", - prefered_doc_char_string, + preferred_doc_char_string, (pref_charset && pref_charset[0])?pref_charset:empty_string); /* + * display_char_set + */ + fprintf(fp0,"<%s>Display character set:</%s> ", label_string, + label_string); + fprintf(fp0,"<select name=\"%s\">\n", display_char_set_string); + for (i = 0; LYchar_set_names[i]; i++) { + fprintf(fp0,"<option %s value=\"%d\">%s</options>\n", + (i==current_char_set)?selected_string:empty_string, + i, LYchar_set_names[i]); + } + fprintf(fp0,"</select>\n"); + + /* + * raw_mode + */ + fprintf(fp0,"<%s>Raw 8-bit or CJK mode:</%s> ", label_string, + label_string); + fprintf(fp0,"<select name=\"%s\">\n", raw_mode_string); + fprintf(fp0,"<option %s value=\"%s\">%s</option>\n", + (LYRawMode)?empty_string:selected_string, + off_string, off_string); + fprintf(fp0,"<option %s value=\"%s\">%s</option>\n", + (LYRawMode)?selected_string:empty_string, + on_string, on_string); + fprintf(fp0,"</select>\n"); + + /* * assume_char_set */ /* @@ -3692,33 +3751,6 @@ PUBLIC int gen_options ARGS1( } /* - * display_char_set - */ - fprintf(fp0,"<%s>Display character set:</%s> ", label_string, - label_string); - fprintf(fp0,"<select name=\"%s\">\n", display_char_set_string); - for (i = 0; LYchar_set_names[i]; i++) { - fprintf(fp0,"<option %s value=\"%d\">%s</options>\n", - (i==current_char_set)?selected_string:empty_string, - i, LYchar_set_names[i]); - } - fprintf(fp0,"</select>\n"); - - /* - * raw_mode - */ - fprintf(fp0,"<%s>Raw 8-bit or CJK mode:</%s> ", label_string, - label_string); - fprintf(fp0,"<select name=\"%s\">\n", raw_mode_string); - fprintf(fp0,"<option %s value=\"%s\">%s</option>\n", - (LYRawMode)?empty_string:selected_string, - off_string, off_string); - fprintf(fp0,"<option %s value=\"%s\">%s</option>\n", - (LYRawMode)?selected_string:empty_string, - on_string, on_string); - fprintf(fp0,"</select>\n"); - - /* * show_color */ #if defined(USE_SLANG) || defined(COLOR_CURSES) @@ -3868,7 +3900,7 @@ PUBLIC int gen_options ARGS1( /* * dired_sort */ - fprintf(fp0,"<%s>User Mode:</%s> ", label_string, label_string); + fprintf(fp0,"<%s>Local directory sort criteria:</%s> ", label_string, label_string); fprintf(fp0,"<select name=\"%s\">\n", dired_sort_string); fprintf(fp0,"<option %s value=\"%s\">Directories first</option>\n", (dir_list_style==0)?selected_string:empty_string, @@ -3902,21 +3934,27 @@ PUBLIC int gen_options ARGS1( * save options */ if (!no_option_save) { - fprintf(fp0,"<%s>Save options to disk: </%s> ", label_string, + fprintf(fp0,"<%s>Save options to disk: </%s> ", label_string, label_string); - fprintf(fp0,"<input type=\"checkbox\" name=\"%s\">\n", + fprintf(fp0,"<input type=\"checkbox\" name=\"%s\">\n", save_options_string); } /* * save/reset */ - fprintf(fp0,"<p>Use the back key to cancel changes.\n"); + fprintf(fp0,"\n"); fprintf(fp0,"<input type=\"submit\" value=\"Accept Changes\">"); - fprintf(fp0," <input type=\"reset\" value=\"Reset\">\n"); - fprintf(fp0,"</p>"); + fprintf(fp0," <input type=\"reset\" value=\"Reset\">"); + fprintf(fp0," Use the back key to cancel changes.\n"); + + /* + * close HTML + */ + fprintf(fp0,"</pre>\n"); fprintf(fp0,"</body>\n"); fclose(fp0); return(0); } +#endif /* EXP_FORMS_OPTIONS */ diff --git a/src/LYOptions.h b/src/LYOptions.h index 973901a3..fc7f528a 100644 --- a/src/LYOptions.h +++ b/src/LYOptions.h @@ -1,12 +1,17 @@ #ifndef LYOPTIONS_H #define LYOPTIONS_H +#include <LYStructs.h> + extern BOOLEAN term_options; -extern void options NOPARAMS; extern void edit_bookmarks NOPARAMS; + +#ifdef EXP_FORMS_OPTIONS extern int postoptions PARAMS((document *newdoc)); extern int gen_options PARAMS((char **newfile)); +#else +extern void LYoptions NOPARAMS; /* * Values for the options menu. - FM @@ -64,6 +69,8 @@ extern int gen_options PARAMS((char **newfile)); #define L_EXEC 18 #endif /* DIRED_SUPPORT */ +#endif /* EXP_FORMS_OPTIONS */ + #define OPTIONS_TITLE "Lynx Options Configuration" #endif /* LYOPTIONS_H */ diff --git a/src/LYPrint.c b/src/LYPrint.c index d4005267..9a7bc90a 100644 --- a/src/LYPrint.c +++ b/src/LYPrint.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTAccess.h> #include <HTList.h> #include <HTAlert.h> @@ -26,8 +25,6 @@ #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - /* * printfile prints out the current file minus the links and targets * to a verity of places @@ -351,12 +348,7 @@ PUBLIC int printfile ARGS1( } if (no_dotfiles || !show_dotfiles) { - if (*filename == '.' || -#ifdef VMS - ((cp = strrchr(filename, ':')) && *(cp+1) == '.') || - ((cp = strrchr(filename, ']')) && *(cp+1) == '.') || -#endif /* VMS */ - ((cp = strrchr(filename, '/')) && *(cp+1) == '.')) { + if (*LYPathLeaf(filename) == '.') { HTAlert(FILENAME_CANNOT_BE_DOT); _statusline(NEW_FILENAME_PROMPT); FirstRecall = TRUE; @@ -1125,15 +1117,7 @@ PUBLIC int printfile ARGS1( } if (no_dotfiles || !show_dotfiles) { - if (*filename == '.' || -#ifdef VMS - ((cp = strrchr(filename, ':')) && - *(cp+1) == '.') || - ((cp = strrchr(filename, ']')) && - *(cp+1) == '.') || -#endif /* VMS */ - ((cp = strrchr(filename, '/')) && - *(cp+1) == '.')) { + if (*LYPathLeaf(filename) == '.') { HTAlert(FILENAME_CANNOT_BE_DOT); _statusline(NEW_FILENAME_PROMPT); FirstRecall = TRUE; diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index a49bf7a6..0e503e1d 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTFile.h> #include <UCMap.h> @@ -15,6 +14,7 @@ #include <LYCurses.h> #include <LYSignal.h> #include <LYBookmark.h> +#include <LYCookie.h> #include <LYReadCFG.h> #ifdef DIRED_SUPPORT @@ -24,8 +24,6 @@ #include <LYexit.h> #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - extern int HTNewsMaxChunk; /* Max news articles before chunking (HTNews.c) */ extern int HTNewsChunkSize; /* Number of news articles per chunk (HTNews.c) */ @@ -787,6 +785,7 @@ static int viewer_fun ARGS1( static Config_Type Config_Table [] = { + PARSE_SET("accept_all_cookies", CONF_BOOL, LYAcceptAllCookies), PARSE_INT("alertsecs", CONF_INT, AlertSecs), PARSE_SET("always_resubmit_posts", CONF_BOOL, LYresubmit_posts), #ifdef EXEC_LINKS @@ -806,6 +805,8 @@ static Config_Type Config_Table [] = #ifdef USE_COLOR_TABLE PARSE_FUN("color", CONF_FUN, color_fun), #endif + PARSE_STR("cookie_accept_domains", CONF_STR, LYCookieAcceptDomains), + PARSE_STR("cookie_reject_domains", CONF_STR, LYCookieRejectDomains), PARSE_ENV("cso_proxy", CONF_ENV, 0 ), #ifdef VMS PARSE_STR("CSWING_PATH", CONF_STR, LYCSwingPath), @@ -823,7 +824,6 @@ static Config_Type Config_Table [] = PARSE_FUN("dired_menu", CONF_FUN, dired_menu_fun), #endif PARSE_ADD("downloader", CONF_ADD_ITEM, downloaders), - PARSE_SET("eat_all_cookies", CONF_BOOL, LYEatAllCookies), PARSE_SET("emacs_keys_always_on", CONF_BOOL, emacs_keys), PARSE_SET("enable_scrollback", CONF_BOOL, enable_scrollback), #ifdef USE_EXTERNALS @@ -1163,4 +1163,18 @@ PUBLIC void read_cfg ARGS3( cur_download = cur_download->next; } } + + /* + * If any COOKIE_{ACCEPT,REJECT}_DOMAINS have been defined, + * process them. These are comma delimited lists of + * domains, with leading '.'. - BJP + */ + + if (LYCookieAcceptDomains != NULL) { + cookie_add_acceptlist(LYCookieAcceptDomains); + } + + if (LYCookieRejectDomains != NULL) { + cookie_add_rejectlist(LYCookieRejectDomains); + } } diff --git a/src/LYSearch.c b/src/LYSearch.c index aed16225..6fcfa362 100644 --- a/src/LYSearch.c +++ b/src/LYSearch.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <LYUtils.h> #include <LYStrings.h> #include <LYSearch.h> @@ -9,8 +8,6 @@ #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - /* * Search for the target string inside of the links * that are currently displayed on the screen beginning diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c index a70a1a04..54be1077 100644 --- a/src/LYShowInfo.c +++ b/src/LYShowInfo.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTParse.h> #include <HTAlert.h> #include <HTTP.h> @@ -22,8 +21,6 @@ #include <LYLocal.h> #endif /* DIRED_SUPPORT */ -#define FREE(x) if (x) {free(x); x = NULL;} - /* * Showinfo prints a page of info about the current file and the link * that the cursor is on. @@ -109,14 +106,14 @@ PUBLIC int showinfo ARGS4( sleep(AlertSecs); } else { char modes[80]; - if (((dir_info.st_mode) & S_IFMT) == S_IFDIR) { + if (S_ISDIR(dir_info.st_mode)) { fprintf(fp0, "\nDirectory that you have currently selected\n\n"); - } else if (((dir_info.st_mode) & S_IFMT) == S_IFREG) { + } else if (S_ISREG(dir_info.st_mode)) { fprintf(fp0, "\nFile that you have currently selected\n\n"); #ifdef S_IFLNK - } else if (((dir_info.st_mode) & S_IFMT) == S_IFLNK) { + } else if (S_ISLNK(dir_info.st_mode)) { fprintf(fp0, "\nSymbolic link that you have currently selected\n\n"); #endif @@ -126,7 +123,7 @@ PUBLIC int showinfo ARGS4( } fprintf(fp0," <em>Full name:</em> %s\n", temp); #ifdef S_IFLNK - if (((dir_info.st_mode) & S_IFMT) == S_IFLNK) { + if (S_ISLNK(dir_info.st_mode)) { char buf[1025]; int buf_size; @@ -144,7 +141,7 @@ PUBLIC int showinfo ARGS4( grp = getgrgid(dir_info.st_gid); if (grp && grp->gr_name) fprintf(fp0, " <em>Group name:</em> %s\n", grp->gr_name); - if (((dir_info.st_mode) & S_IFMT) == S_IFREG) { + if (S_ISREG(dir_info.st_mode)) { sprintf(temp, " <em>File size:</em> %ld (bytes)\n", (long)dir_info.st_size); fprintf(fp0, "%s", temp); @@ -171,7 +168,7 @@ PUBLIC int showinfo ARGS4( if ((dir_info.st_mode & S_IWUSR)) strcat(modes, ", write"); if ((dir_info.st_mode & S_IXUSR)) { - if (((dir_info.st_mode) & S_IFMT) == S_IFDIR) + if (S_ISDIR(dir_info.st_mode)) strcat(modes, ", search"); else { strcat(modes, ", execute"); @@ -190,7 +187,7 @@ PUBLIC int showinfo ARGS4( if ((dir_info.st_mode & S_IWGRP)) strcat(modes, ", write"); if ((dir_info.st_mode & S_IXGRP)) { - if (((dir_info.st_mode) & S_IFMT) == S_IFDIR) + if (S_ISDIR(dir_info.st_mode)) strcat(modes, ", search"); else { strcat(modes, ", execute"); @@ -209,7 +206,7 @@ PUBLIC int showinfo ARGS4( if ((dir_info.st_mode & S_IWOTH)) strcat(modes, ", write"); if ((dir_info.st_mode & S_IXOTH)) { - if (((dir_info.st_mode) & S_IFMT) == S_IFDIR) + if (S_ISDIR(dir_info.st_mode)) strcat(modes, ", search"); else { strcat(modes, ", execute"); diff --git a/src/LYStrings.c b/src/LYStrings.c index 90cb8979..73a04f8b 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTCJK.h> #include <LYCurses.h> #include <LYUtils.h> @@ -20,12 +19,8 @@ #include <keys.h> #endif /* DJGPP_KEYHANDLER */ -#include <ctype.h> - #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - extern BOOL HTPassHighCtrlRaw; extern HTCJKlang HTCJK; @@ -572,7 +567,7 @@ re_read: #ifndef USE_SLANG clearerr(stdin); /* needed here for ultrix and SOCKETSHR, but why? - FM */ #endif /* !USE_SLANG */ -#if !defined(USE_SLANG) || defined(VMS) +#if !defined(USE_SLANG) || defined(VMS) || defined(DJGPP_KEYHANDLER) c = GetChar(); #else if (LYCursesON) { @@ -825,7 +820,7 @@ re_read: c = 127; /* backspace key (delete, not Ctrl-H) */ break; #endif /* KEY_BACKSPACE */ -#if defined(KEY_F) && !defined(__DJGPP__) +#if defined(KEY_F) && !defined(__DJGPP__) && !defined(_WINDOWS) case KEY_F(1): c = F1; /* VTxxx Help */ break; @@ -894,7 +889,7 @@ re_read: c = set_clicked_link(Mouse_status.x, Mouse_status.y); } } -#endif /* _WINDOWS */ +#endif /* DOSPATH */ } break; #endif /* NCURSES_MOUSE_VERSION */ @@ -902,11 +897,11 @@ re_read: } #endif /* HAVE_KEYPAD */ -#ifdef __DJGPP__ +#if (defined(__DJGPP__) || defined(_WINDOWS)) if (c > 659) #else if (c > DO_NOTHING) -#endif /* __DJGPP__ */ +#endif /* __DJGPP__ || _WINDOWS */ { /* * Don't return raw values for KEYPAD symbols which we may have @@ -1458,13 +1453,24 @@ PUBLIC char *LYstrsep ARGS2( char **, stringp, CONST char *, delim) { - char *tmp, *out = 0; + char *tmp, *out; + + if (!stringp || !*stringp) /* nothing to do? */ + return 0; /* then don't fall on our faces */ + + if (!**stringp) { /* empty string: */ + *stringp = 0; /* let caller see he's done; */ + return 0; /* no tokens in an empty string */ + } + + out = *stringp; /* save the start of the string */ tmp = strpbrk(*stringp, delim); if (tmp) { - out = *stringp; /* save the start of the string */ - *tmp = '\0'; /* terminate the substring with \0 */ - *stringp = ++tmp; /* point at the terminator */ + *tmp = '\0'; /* terminate the substring with \0 */ + *stringp = ++tmp; /* point at the next substring */ } + else *stringp = 0; /* this was the last substring: */ + /* let caller see he's done */ return out; } diff --git a/src/LYStrings.h b/src/LYStrings.h index cfb8b5eb..ccd78dee 100644 --- a/src/LYStrings.h +++ b/src/LYStrings.h @@ -1,8 +1,7 @@ #ifndef LYSTRINGS_H #define LYSTRINGS_H -#include <string.h> - +#include <HTUtils.h> /* UPPER8(ch1,ch2) is an extension of (TOUPPER(ch1) - TOUPPER(ch2)) */ extern int UPPER8 PARAMS(( diff --git a/src/LYStyle.c b/src/LYStyle.c index af21fdd3..8a95d2b6 100644 --- a/src/LYStyle.c +++ b/src/LYStyle.c @@ -1,10 +1,9 @@ /* character level styles for Lynx * (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-) - * @Id: LYStyle.c 1.18 Thu, 23 Apr 1998 06:35:21 -0600 dickey @ + * @Id: LYStyle.c 1.19 Thu, 06 Aug 1998 06:28:22 -0600 dickey @ */ #include <HTUtils.h> #include <HTML.h> -#include <tcp.h> #include <LYSignal.h> #include <LYGlobalDefs.h> @@ -50,9 +49,6 @@ PUBLIC int s_alink = NOSTYLE, s_a = NOSTYLE, s_status = NOSTYLE, PRIVATE int colorPairs = 0; PRIVATE int last_fA = COLOR_WHITE, last_bA = COLOR_BLACK; - -#define FREE(x) if (x) {free(x); x = NULL;} - /* icky parsing of the style options */ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char*,element) { diff --git a/src/LYTraversal.c b/src/LYTraversal.c index c8e0df47..d92b7dcd 100644 --- a/src/LYTraversal.c +++ b/src/LYTraversal.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <LYGlobalDefs.h> #include <LYUtils.h> #include <LYSignal.h> diff --git a/src/LYUpload.c b/src/LYUpload.c index f453751c..125e5dca 100644 --- a/src/LYUpload.c +++ b/src/LYUpload.c @@ -15,7 +15,6 @@ */ #include <HTUtils.h> -#include <tcp.h> #include <HTParse.h> #include <HTAlert.h> #include <LYCurses.h> @@ -32,8 +31,6 @@ #include <LYexit.h> #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} - PUBLIC char LYUploadFileURL[256] = "\0"; /* @@ -124,14 +121,9 @@ retry: sprintf(buffer, "%s/%s", directory, tmpbuf); if (no_dotfiles || !show_dotfiles) { - if (*buffer == '.' || -#ifdef VMS - ((cp = strrchr(buffer, ':')) && *(cp+1) == '.') || - ((cp = strrchr(buffer, ']')) && *(cp+1) == '.') || -#endif /* VMS */ - ((cp = strrchr(buffer, '/')) && *(cp+1) == '.')) { - _statusline( - "File name may not begin with dot. Enter a new filename: "); + if (*LYPathLeaf(buffer) == '.') { + HTAlert(FILENAME_CANNOT_BE_DOT); + _statusline(NEW_FILENAME_PROMPT); goto retry; } } diff --git a/src/LYUtils.c b/src/LYUtils.c index 7f926295..9a2432a2 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -1,6 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> -#include <ctype.h> #include <HTParse.h> #include <HTAccess.h> #include <HTCJK.h> @@ -59,8 +57,6 @@ #include <LYStyle.h> #endif -#undef hline /* FIXME: this is a curses feature used as a variable here */ - #ifdef SVR4_BSDSELECT extern int BSDselect PARAMS((int nfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds, struct timeval * timeout)); @@ -88,8 +84,6 @@ extern int BSDselect PARAMS((int nfds, fd_set * readfds, fd_set * writefds, #endif /* __FreeBSD__ || __bsdi__ */ #endif /* !UTMP_FILE */ -#define FREE(x) if (x) {free(x); x = NULL;} - extern HTkcode kanji_code; extern BOOLEAN LYHaveCJKCharacterSet; extern HTCJKlang HTCJK; @@ -4747,6 +4741,37 @@ PUBLIC CONST char * Home_Dir NOARGS } /* + * Return a pointer to the final leaf of the given pathname, If no pathname + * separators are found, returns the original pathname. The leaf may be + * empty. + */ +PUBLIC char *LYPathLeaf ARGS1(char *, pathname) +{ + char *leaf; +#ifdef UNIX + if ((leaf = strrchr(pathname, '/')) != 0) { + leaf++; + } +#else +#ifdef VMS + if ((leaf = strrchr(pathname, ']')) == 0) + leaf = strrchr(pathname, ':'); + if (leaf != 0) + leaf++; +#else + int n; + for (leaf = 0, n = strlen(pathname)-1; n >= 0; n--) { + if (strchr("\\/:", pathname[n]) != 0) { + leaf = pathname + n; + break; + } + } +#endif +#endif + return (leaf != 0) ? leaf : pathname; +} + +/* * This function checks the acceptability of file paths that * are intended to be off the home directory. The file path * should be passed in fbuffer, together with the size of the @@ -5303,11 +5328,6 @@ Cambridge, MA 02139, USA. */ #include <sys/types.h> #include <errno.h> -#ifdef STDC_HEADERS -#include <stdlib.h> -#else -extern int errno; -#endif /* STDC_HEADERS */ #if defined(STDC_HEADERS) || defined(USG) #include <string.h> @@ -5389,6 +5409,71 @@ int remove ARGS1(char *, name) #ifdef UNIX /* + * Verify if this is really a file, not accessed by a link, except for the + * special case of its directory being pointed to by a link from a directory + * owned by root and not writable by other users. + */ +PRIVATE BOOL IsOurFile ARGS1(char *, name) +{ + struct stat data; + + if (lstat(name, &data) == 0 + && S_ISREG(data.st_mode) + && data.st_nlink == 1 + && data.st_uid == getuid()) { + int linked = 0; +#if HAVE_LSTAT + char *path = 0; + char *leaf; + + StrAllocCopy(path, name); + do { + if ((leaf = LYPathLeaf(path)) != path) + *--leaf = '\0'; /* write a null on the '/' */ + if (lstat(*path ? path : "/", &data) != 0) { + break; + } + /* + * If we find a symbolic link, it has to be in a directory that's + * protected. Otherwise someone could have switched it to point + * to one of the real user's files. + */ + if (S_ISLNK(data.st_mode)) { + if (!linked) { + linked++; + } else { /* a link-to-link is a little hard to digest */ + break; + } + } else if (S_ISDIR(data.st_mode)) { + if (linked) { + if (--linked == 0) { + /* + * We assume that a properly-configured system has the + * unwritable directories owned by root. This is not + * necessarily so (bin, news, etc., may), but the only + * uid we can count on is 0. It would be nice to add a + * check for the gid also, but that wouldn't be + * portable. + */ + if (data.st_uid != 0 + || data.st_mode & S_IWOTH) { + linked = 1; + break; + } + } + } + } else if (linked) { + break; + } + } while (leaf != path); + free(path); +#endif + return !linked; + } + return FALSE; +} + +/* * Open a file that we don't want other users to see. */ PRIVATE FILE *OpenHiddenFile ARGS2(char *, name, char *, mode) @@ -5401,20 +5486,24 @@ PRIVATE FILE *OpenHiddenFile ARGS2(char *, name, char *, mode) * that no one has an existing file or link that they happen to own. */ if (*mode == 'w') { - struct stat sb; int fd = open(name, O_CREAT|O_EXCL|O_WRONLY, HIDE_CHMOD); + if (fd < 0 + && errno == EEXIST + && IsOurFile(name)) { + remove(name); + /* FIXME: there's a race at this point if directory is open */ + fd = open(name, O_CREAT|O_EXCL|O_WRONLY, HIDE_CHMOD); + } if (fd >= 0) { fp = fdopen(fd, mode); } - else if (errno == EEXIST - && stat(name, &sb) == 0 - && sb.st_uid == getuid() - && chmod(name, HIDE_CHMOD) == 0 - && (fd = open(name, O_TRUNC|O_WRONLY, HIDE_CHMOD)) >= 0) - fp = fdopen(fd, mode); } else #endif + if (*mode == 'a' + && IsOurFile(name) + && chmod(name, HIDE_CHMOD) == 0) + fp = fopen(name, mode); /* * This is less stringent, but reasonably portable. For new files, the * umask will suffice; however if the file already exists we'll change @@ -5424,7 +5513,7 @@ PRIVATE FILE *OpenHiddenFile ARGS2(char *, name, char *, mode) * * This won't work properly if the user is root, since the chmod succeeds. */ - { + else if (*mode != 'a') { int save = umask(HIDE_UMASK); if (chmod(name, HIDE_CHMOD) == 0 || errno == ENOENT) fp = fopen(name, mode); diff --git a/src/LYUtils.h b/src/LYUtils.h index e7cb4cc3..67ff15cc 100644 --- a/src/LYUtils.h +++ b/src/LYUtils.h @@ -46,6 +46,7 @@ extern void Define_VMSLogical PARAMS(( char *LogicalName, char *LogicalValue)); #endif /* VMS */ extern CONST char *Home_Dir NOPARAMS; +extern char *LYPathLeaf PARAMS((char * pathname)); extern BOOLEAN LYPathOffHomeOK PARAMS((char *fbuffer, size_t fbuffer_size)); extern void LYAddPathToHome PARAMS(( char *fbuffer, size_t fbuffer_size, char *fname)); diff --git a/src/LYexit.c b/src/LYexit.c index 5c8d7d2c..0eace151 100644 --- a/src/LYexit.c +++ b/src/LYexit.c @@ -2,7 +2,6 @@ * Copyright (c) 1994, University of Kansas, All Rights Reserved */ #include <HTUtils.h> -#include <tcp.h> #include <LYexit.h> #ifndef VMS #include <LYGlobalDefs.h> @@ -15,8 +14,6 @@ #endif /* SYSLOG_REQUESTED_URLS */ #endif /* !VMS */ -#define FREE(x) if (x) {free(x); x = NULL;} - /* * Stack of functions to call upon exit. */ diff --git a/src/LYrcFile.c b/src/LYrcFile.c index 986e3942..54dafdcd 100644 --- a/src/LYrcFile.c +++ b/src/LYrcFile.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTFTP.h> #include <LYUtils.h> #include <LYrcFile.h> @@ -427,22 +426,50 @@ PUBLIC void read_rc NOPARAMS #endif /* DIRED_SUPPORT */ /* - * eat all cookies? i think it should work user-by-user. - * -BJP + * Accept cookies from all domains? */ - } else if ((cp = LYstrstr(line_buffer, "eat_all_cookies")) != NULL && + } else if ((cp = LYstrstr(line_buffer, "accept_all_cookies")) != NULL && cp-line_buffer < number_sign) { if((cp2 = (char *)strchr(cp,'=')) != NULL) cp = cp2 + 1; while (isspace(*cp)) cp++; /* get rid of spaces */ if (LYstrstr(cp,"TRUE") != NULL) { - LYEatAllCookies = TRUE; + LYAcceptAllCookies = TRUE; } else { - LYEatAllCookies = FALSE; + LYAcceptAllCookies = FALSE; } - /* BJP */ +#ifdef THIS_DOESNT_WORK_YET_DONT_USE_IT + + /* + * Accept all cookies from certain domains? + */ + } else if ((cp = LYstrstr(line_buffer, "cookie_accept_domains")) + != NULL && cp-line_buffer < number_sign) { + if((cp2 = (char *)strchr(cp,'=')) != NULL) + cp = cp2 + 1; + while (isspace(*cp)) + cp++; /* get rid of spaces */ + if (LYstrstr(cp,NULL) != NULL) { +/* cookie_add_acceptlist(cp); */ + } + + + /* + * Reject all cookies from certain domains? + */ + } else if ((cp = LYstrstr(line_buffer, "cookie_reject_domains")) + != NULL && cp-line_buffer < number_sign) { + if((cp2 = (char *)strchr(cp,'=')) != NULL) + cp = cp2 + 1; + while (isspace(*cp)) + cp++; /* get rid of spaces */ + if (LYstrstr(cp,NULL) != NULL) { +/* cookie_add_rejectlist(cp); */ + } + +#endif /* * User mode. diff --git a/src/UCAuto.c b/src/UCAuto.c index 269baf35..7d910a20 100644 --- a/src/UCAuto.c +++ b/src/UCAuto.c @@ -15,7 +15,6 @@ */ #include <HTUtils.h> -#include <tcp.h> #include <UCMap.h> #include <UCDefs.h> @@ -105,7 +104,7 @@ PRIVATE int nonempty_file ARGS1( struct stat sb; return (stat(p, &sb) == 0 && - (sb.st_mode & S_IFMT) == S_IFREG && + S_ISREG(sb.st_mode) && (sb.st_size != 0)); } diff --git a/src/UCAuto.h b/src/UCAuto.h index b4d582c3..e9f1681e 100644 --- a/src/UCAuto.h +++ b/src/UCAuto.h @@ -1,7 +1,8 @@ - #ifndef UCAUTO_H #define UCAUTO_H +#include <UCDefs.h> + extern void UCChangeTerminalCodepage PARAMS((int newcs, LYUCcharset *p)); #endif /* UCAUTO_H */ diff --git a/src/UCAux.c b/src/UCAux.c index 3a8bc56d..01ea1593 100644 --- a/src/UCAux.c +++ b/src/UCAux.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTCJK.h> #include <UCDefs.h> diff --git a/src/UCdomap.c b/src/UCdomap.c index ae3ac64c..0392457b 100644 --- a/src/UCdomap.c +++ b/src/UCdomap.c @@ -15,7 +15,6 @@ * aeb, 950210 */ #include <HTUtils.h> -#include <tcp.h> #include <HTMLDTD.h> #include <LYGlobalDefs.h> @@ -67,8 +66,6 @@ #include <mnem_suni.h> #endif /* NOTDEFINED */ -#define FREE(x) if (x) {free(x); x = NULL;} - /* * Some of the code below, and some of the comments, are left in for * historical reasons. Not all those tables below are currently diff --git a/src/UCdomap.h b/src/UCdomap.h index 1570baf0..e0160953 100644 --- a/src/UCdomap.h +++ b/src/UCdomap.h @@ -1,7 +1,9 @@ - #ifndef UCDOMAP_H #define UCDOMAP_H +#include <HTUtils.h> +#include <UCkd.h> + /* * [old comments: - KW ] * consolemap.h diff --git a/src/makefile.dos b/src/makefile.dos index 452b6aeb..9997308b 100644 --- a/src/makefile.dos +++ b/src/makefile.dos @@ -12,7 +12,7 @@ LYStyle.o LYHash.o CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC) CC = gcc -MCFLAGS = -O3 -DUSE_ZLIB -DUSE_EXTERNALS -DCOLOR_CURSES -DNCURSES -DFANCY_CURSES -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -Ichrtrans -I../WWW/library/implementation -I../curses -I../djgpp/tcplib/include -I../djgpp/tcplib/include/tcp +MCFLAGS = -O3 -DDISP_PARTIAL -DUSE_ZLIB -DUSE_EXTERNALS -DCOLOR_CURSES -DNCURSES -DFANCY_CURSES -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -Ichrtrans -I../WWW/library/implementation -I../curses -I../djgpp/tcplib/include -I../djgpp/tcplib/include/tcp WWWLIB = ../WWW/library/djgpp/libwww.a ../curses/pdcurses.a ../djgpp/tcplib/obj/libtcp.a LIBS=-lz diff --git a/src/makefile.dsl b/src/makefile.dsl index 542abd1b..a66349ca 100644 --- a/src/makefile.dsl +++ b/src/makefile.dsl @@ -58,5 +58,5 @@ DefaultStyle.o: DefaultStyle.c ../userdefs.h LYEditmap.o: LYEditmap.c ../userdefs.h LYCharUtils.o: LYCharUtils.c ../userdefs.h LYExtern.o: LYExtern.c ../userdefs.h -LyUtils.o: LYUtils.c ../userdefs.h +LYUtils.o: LYUtils.c ../userdefs.h LYCookie.o: ../userdefs.h diff --git a/src/makefile.wsl b/src/makefile.wsl index ff7d3813..8a5504d9 100644 --- a/src/makefile.wsl +++ b/src/makefile.wsl @@ -58,5 +58,5 @@ DefaultStyle.o: DefaultStyle.c ../userdefs.h LYEditmap.o: LYEditmap.c ../userdefs.h LYCharUtils.o: LYCharUtils.c ../userdefs.h LYExtern.o: LYExtern.c ../userdefs.h -LyUtils.o: LYUtils.c ../userdefs.h +LYUtils.o: LYUtils.c ../userdefs.h LYCookie.o: ../userdefs.h |