diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2008-02-11 01:05:04 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2008-02-11 01:05:04 -0500 |
commit | a054e1c90b5f1e36eb889a118393c8ec79e57d02 (patch) | |
tree | d0958fb5aa99b70ba9a082c98280a5cec17a565e /src | |
parent | acdfec8f90ac4aa21cfc20b6b7ad3ecb7e56ea90 (diff) | |
download | lynx-snapshots-a054e1c90b5f1e36eb889a118393c8ec79e57d02.tar.gz |
snapshot of project "lynx", label v2-8-7dev_7d
Diffstat (limited to 'src')
-rw-r--r-- | src/GridText.c | 69 | ||||
-rw-r--r-- | src/HTAlert.c | 10 | ||||
-rw-r--r-- | src/LYClean.c | 18 | ||||
-rw-r--r-- | src/LYHistory.h | 3 | ||||
-rw-r--r-- | src/LYMain.c | 41 | ||||
-rw-r--r-- | src/LYReadCFG.c | 32 | ||||
-rw-r--r-- | src/LYSession.c | 47 | ||||
-rw-r--r-- | src/LYSession.h | 6 |
8 files changed, 146 insertions, 80 deletions
diff --git a/src/GridText.c b/src/GridText.c index 0212d43a..388ac476 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -1,5 +1,5 @@ /* - * $LynxId: GridText.c,v 1.143 2008/02/10 23:25:38 tom Exp $ + * $LynxId: GridText.c,v 1.144 2008/02/11 00:07:05 Paul.B.Mahol Exp $ * * Character grid hypertext object * =============================== @@ -14253,6 +14253,9 @@ static int LYHandleCache(const char *arg, char *content_language = NULL; char *content_encoding = NULL; char *content_location = NULL; + char *content_disposition = NULL; + char *content_md5 = NULL; + char *message_id = NULL; char *date = NULL; char *owner = NULL; char *subject = NULL; @@ -14328,9 +14331,6 @@ static int LYHandleCache(const char *arg, helpfilepath, CACHE_JAR_HELP, CACHE_JAR_TITLE); PUTS(buf); - HTSprintf0(&buf, "<pre>\n"); - PUTS(buf); - /* * Max number of cached documents is always same as HTCacheSize. * We count them from oldest to newest. Currently cached document @@ -14347,39 +14347,41 @@ static int LYHandleCache(const char *arg, if (cachedoc != 0) { HTParentAnchor *docanchor = cachedoc->node_anchor; - Size = docanchor->content_length; if (docanchor != 0) { #ifdef USE_SOURCE_CACHE source_cache_file = docanchor->source_cache_file; #endif - title = docanchor->title; - address = docanchor->address; + Size = docanchor->content_length; + StrAllocCopy(title, docanchor->title); + StrAllocCopy(address, docanchor->address); content_type = docanchor->content_type; content_language = docanchor->content_language; content_encoding = docanchor->content_encoding; content_location = docanchor->content_location; + content_disposition = docanchor->content_disposition; + content_md5 = docanchor->content_md5; + message_id = docanchor->message_id; owner = docanchor->owner; - subject = docanchor->subject; + StrAllocCopy(subject, docanchor->subject); date = docanchor->date; expires = docanchor->expires; ETag = docanchor->ETag; - server = docanchor->server; + StrAllocCopy(server, docanchor->server); FileCache = docanchor->FileCache; last_modified = docanchor->last_modified; cache_control = docanchor->cache_control; } } - HTSprintf0(&buf, "%s<em>%d</em>. <tab id=t%d>", - (x > 99 ? "" : x < 10 ? " " : " "), x, x); - PUTS(buf); - HTSprintf0(&buf, "<a href=\"%s%d\">", STR_LYNXCACHE, x); - PUTS(buf); - HTSprintf0(&buf, "%s</a>\n%s", title == NULL ? address : title, - (x > 99 ? " " : x < 10 ? " " : " ")); - PUTS(buf); - HTSprintf0(&buf, "URL: <a href=\"%s\">%s</a>\n%s", address, address, - (x > 99 ? " " : x < 10 ? " " : " ")); + LYEntify(&address, TRUE); + if (isEmpty(title)) + StrAllocCopy(title, NO_TITLE); + else + LYEntify(&title, TRUE); + + HTSprintf0(&buf, + "<p><em>%d.</em> Title: <a href=\"%s%d\">%s</a><br />URL: <a href=\"%s\">%s</a><br />", + x, STR_LYNXCACHE, x, title, address, address); PUTS(buf); if (Size > 0) { HTSprintf0(&buf, "Size: %d ", Size); @@ -14390,7 +14392,8 @@ static int LYHandleCache(const char *arg, PUTS(buf); } if (FileCache != NULL) { - HTSprintf0(&buf, "File-Cache: %s ", FileCache); + HTSprintf0(&buf, "File-Cache: <a href=\"file://%s\">%s</a> ", + FileCache, FileCache); PUTS(buf); } if (cache_control != NULL) { @@ -14413,12 +14416,25 @@ static int LYHandleCache(const char *arg, HTSprintf0(&buf, "Content-Location: %s ", content_location); PUTS(buf); } + if (content_disposition != NULL) { + HTSprintf0(&buf, "Content-Disposition: %s ", content_disposition); + PUTS(buf); + } + if (content_md5 != NULL) { + HTSprintf0(&buf, "Content-MD5: %s ", content_md5); + PUTS(buf); + } + if (message_id != NULL) { + HTSprintf0(&buf, "Message-ID: %s ", message_id); + PUTS(buf); + } if (subject != NULL) { + LYEntify(&subject, TRUE); HTSprintf0(&buf, "Subject: %s ", subject); PUTS(buf); } if (owner != NULL) { - HTSprintf0(&buf, "Owner: %s ", owner); + HTSprintf0(&buf, "Owner: <a href=%s>%s</a> ", owner, owner); PUTS(buf); } if (date != NULL) { @@ -14438,7 +14454,8 @@ static int LYHandleCache(const char *arg, PUTS(buf); } if (server != NULL) { - HTSprintf0(&buf, "Server: %s ", server); + LYEntify(&server, TRUE); + HTSprintf0(&buf, "Server: <em>%s</em> ", server); PUTS(buf); } #ifdef USE_SOURCE_CACHE @@ -14449,11 +14466,15 @@ static int LYHandleCache(const char *arg, PUTS(buf); } #endif - HTSprintf0(&buf, "<tab to=t%d>\n", x); + HTSprintf0(&buf, "<br />"); PUTS(buf); } - HTSprintf0(&buf, "</pre>\n</body>\n</html>\n"); + HTSprintf0(&buf, "</body></html>"); PUTS(buf); + FREE(subject); + FREE(title); + FREE(address); + FREE(server); /* * Free the target to complete loading of the Cache Jar Page, and report a diff --git a/src/HTAlert.c b/src/HTAlert.c index 498163e8..7f20322f 100644 --- a/src/HTAlert.c +++ b/src/HTAlert.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTAlert.c,v 1.78 2008/02/10 21:39:42 tom Exp $ + * $LynxId: HTAlert.c,v 1.79 2008/02/11 00:28:56 tom Exp $ * * Displaying messages and getting input for Lynx Browser * ========================================================== @@ -316,10 +316,12 @@ void HTReadProgress(long bytes, long total) break; #endif default: - if (total > 0) - HTSprintf0(&line, gettext("Read %s of %s of data"), bytesp, totalp); - else + if (total > 0) { + HTSprintf0(&line, gettext("Read %s of %s of data"), + bytesp, totalp); + } else { HTSprintf0(&line, gettext("Read %s of data"), bytesp); + } if (LYTransferRate != rateOFF && transfer_rate > 0) { diff --git a/src/LYClean.c b/src/LYClean.c index 14078a4a..efeb3841 100644 --- a/src/LYClean.c +++ b/src/LYClean.c @@ -1,3 +1,4 @@ +/* $LynxId: LYClean.c,v 1.38 2008/02/11 00:50:19 Paul.B.Mahol Exp $ */ #include <HTUtils.h> #include <LYCurses.h> #include <LYUtils.h> @@ -8,6 +9,7 @@ #include <LYTraversal.h> #include <LYHistory.h> #include <LYCookie.h> +#include <LYSession.h> #include <UCAuto.h> #include <HTAlert.h> @@ -123,10 +125,18 @@ void cleanup_sig(int sig) } #ifndef NOSIGHUP } else { +#ifdef USE_SESSIONS + /* + * Wondering is this right place and time to do it. + * We need this, for example it is usefull to save session + * if user closed lynx in non standard way, like closing + * xterm window or in worst one like crash. + */ + SaveSession(); +#endif /* USE_SESSIONS */ cleanup_files(); } #endif /* NOSIGHUP */ - if (sig != 0) { exit_immediately(EXIT_SUCCESS); } else { @@ -190,6 +200,12 @@ void cleanup(void) if (persistent_cookies) LYStoreCookies(LYCookieSaveFile); #endif +#ifdef USE_SESSIONS + /* + * Wondering is this right place and time to do it. + */ + SaveSession(); +#endif /* USE_SESSIONS */ cleanup_files(); #ifdef VMS diff --git a/src/LYHistory.h b/src/LYHistory.h index 37315ca5..db94144c 100644 --- a/src/LYHistory.h +++ b/src/LYHistory.h @@ -1,3 +1,6 @@ +/* + * $LynxId: LYHistory.h,v 1.19 2008/02/11 01:05:04 tom Exp $ + */ #ifndef LYHISTORY_H #define LYHISTORY_H diff --git a/src/LYMain.c b/src/LYMain.c index c5dd20c7..f5a023d8 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -1,4 +1,4 @@ -/* $LynxId: LYMain.c,v 1.178 2008/01/08 00:48:59 tom Exp $ */ +/* $LynxId: LYMain.c,v 1.179 2008/02/11 00:41:46 Paul.B.Mahol Exp $ */ #include <HTUtils.h> #include <HTTP.h> #include <HTParse.h> @@ -2185,11 +2185,8 @@ int main(int argc, ena_csi((BOOLEAN) (LYlowest_eightbit[current_char_set] > 155)); #ifdef USE_SESSIONS RestoreSession(); +#endif /* USE_SESSIONS */ status = mainloop(); - SaveSession(); -#else - status = mainloop(); -#endif LYCloseCloset(RECALL_URL); LYCloseCloset(RECALL_MAIL); #if defined(PDCURSES) && defined(PDC_BUILD) && PDC_BUILD >= 2401 @@ -3315,7 +3312,8 @@ static Config_Type Arg_Table [] = ), PARSE_FUN( "base", 4|FUNCTION_ARG, base_fun, - "prepend a request URL comment and BASE tag to text/html\noutputs for -source dumps" + "prepend a request URL comment and BASE tag to text/html\n\ +outputs for -source dumps" ), #ifndef DISABLE_BIBP PARSE_STR( @@ -3484,7 +3482,8 @@ keys (may be incompatible with some curses packages)" #endif PARSE_SET( "force_empty_hrefless_a", 4|SET_ARG, force_empty_hrefless_a, - "\nforce HREF-less 'A' elements to be empty (close them as\nsoon as they are seen)" + "\nforce HREF-less 'A' elements to be empty (close them as\n\ +soon as they are seen)" ), PARSE_SET( "force_html", 4|SET_ARG, LYforce_HTML_mode, @@ -3642,7 +3641,7 @@ keys (may be incompatible with some curses packages)" ), PARSE_SET( "nomargins", 4|SET_ARG, no_margins, - "disable the right/left margins in the default style-sheet" + "disable the right/left margins in the default\nstyle-sheet" ), #if defined(HAVE_SIGACTION) && defined(SIGWINCH) PARSE_SET( @@ -3729,11 +3728,13 @@ with partial-display logic" ), PARSE_SET( "popup", 4|UNSET_ARG, LYUseDefSelPop, - "toggles handling of single-choice SELECT options via\npopup windows or as lists of radio buttons" + "toggles handling of single-choice SELECT options via\n\ +popup windows or as lists of radio buttons" ), PARSE_FUN( "post_data", 2|FUNCTION_ARG, post_data_fun, - "user data for post forms, read from stdin,\nterminated by '---' on a line" + "user data for post forms, read from stdin,\n\ +terminated by '---' on a line" ), PARSE_SET( "preparsed", 4|SET_ARG, LYPreparsedSource, @@ -3804,7 +3805,8 @@ with the PREV_DOC command or from the History List" #ifdef USE_SESSIONS PARSE_STR( "session", 2|NEED_LYSTRING_ARG, session_file, - "=FILENAME\nresumes from specified file on startup and saves session to that file on exit" + "=FILENAME\nresumes from specified file on startup and\n\ +saves session to that file on exit" ), PARSE_STR( "sessionin", 2|NEED_LYSTRING_ARG, sessionin_file, @@ -3837,8 +3839,8 @@ with the PREV_DOC command or from the History List" #endif PARSE_SET( "soft_dquotes", 4|TOGGLE_ARG, soft_dquotes, - "toggles emulation of the old Netscape and Mosaic bug which\n\ -treated '>' as a co-terminator for double-quotes and tags" + "toggles emulation of the old Netscape and Mosaic\n\ +bug which treated '>' as a co-terminator for\ndouble-quotes and tags" ), PARSE_FUN( "source", 4|FUNCTION_ARG, source_fun, @@ -3854,7 +3856,7 @@ treated '>' as a co-terminator for double-quotes and tags" ), PARSE_SET( "stderr", 4|SET_ARG, dump_to_stderr, - "write warning messages to standard error when -dump -or -source is used" + "write warning messages to standard error when -dump\nor -source is used" ), PARSE_SET( "stdin", 4|SET_ARG, startfile_stdin, @@ -3890,7 +3892,7 @@ treated '>' as a co-terminator for double-quotes and tags" #endif PARSE_SET( "tlog", 2|TOGGLE_ARG, LYUseTraceLog, - "toggles use of a Lynx Trace Log for the current session" + "toggles use of a Lynx Trace Log for the current\nsession" ), #ifdef TEXTFIELDS_MAY_NEED_ACTIVATION PARSE_SET( @@ -3914,7 +3916,7 @@ treated '>' as a co-terminator for double-quotes and tags" ), PARSE_SET( "trim_input_fields", 2|SET_ARG, LYtrimInputFields, - "trim input text/textarea fields in forms" + "\ntrim input text/textarea fields in forms" ), PARSE_SET( "underline_links",4|TOGGLE_ARG, LYUnderlineLinks, @@ -3936,11 +3938,14 @@ treated '>' as a co-terminator for double-quotes and tags" ), PARSE_SET( "validate", 2|SET_ARG, LYValidate, - "accept only http URLs (meant for validation)\nimplies more restrictions than -anonymous, but\ngoto is allowed for http and https" + "accept only http URLs (meant for validation)\n\ +implies more restrictions than -anonymous, but\n\ +goto is allowed for http and https" ), PARSE_SET( "verbose", 4|TOGGLE_ARG, verbose_img, - "toggles [LINK], [IMAGE] and [INLINE] comments \nwith filenames of these images" + "toggles [LINK], [IMAGE] and [INLINE] comments\n\ +with filenames of these images" ), PARSE_FUN( "version", 1|FUNCTION_ARG, version_fun, diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index f489d88f..af3358db 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -1,4 +1,4 @@ -/* $LynxId: LYReadCFG.c,v 1.126 2008/02/10 22:05:02 tom Exp $ */ +/* $LynxId: LYReadCFG.c,v 1.127 2008/02/11 00:54:34 Paul.B.Mahol Exp $ */ #ifndef NO_RULES #include <HTRules.h> #else @@ -111,16 +111,42 @@ static void free_all_item_lists(void) } /* - * Process string buffer fields for DOWNLOADER or UPLOADER menus. + * Process string buffer fields for DOWNLOADER or UPLOADER + * or PRINTERS or EXTERNALS menus */ static void add_item_to_list(char *buffer, lynx_list_item_type **list_ptr, int special) { - char *colon, *next_colon; + char *colon, *next_colon, *last_colon; lynx_list_item_type *cur_item, *prev_item; /* + * Check if the XWINDOWS or NON_XWINDOWS keyword is present in the last + * field, and act properly when found depending if external environment + * $DISPLAY variable is set. + */ + if ((last_colon = strrchr(buffer, ':')) != NULL && *(last_colon - 1) != '\\') { + *last_colon++ = '\0'; + /* + * If last_colon equals XWINDOWS then only continue + * if there is a $DISPLAY variable + */ + if (!strcasecomp(last_colon, "XWINDOWS")) { + if (LYgetXDisplay() == NULL) + return; + } + /* + * If last_colon equals NON_XWINDOWS then only continue + * if there is no $DISPLAY variable + */ + else if (!strcasecomp(last_colon, "NON_XWINDOWS")) { + if (LYgetXDisplay() != NULL) + return; + } + } + + /* * Make a linked list */ if (*list_ptr == NULL) { diff --git a/src/LYSession.c b/src/LYSession.c index d578c7c4..ed9e170c 100644 --- a/src/LYSession.c +++ b/src/LYSession.c @@ -1,4 +1,4 @@ -/* $LynxId: LYSession.c,v 1.3 2008/01/12 01:32:08 tom Exp $ */ +/* $LynxId: LYSession.c,v 1.4 2008/02/11 00:00:19 Paul.B.Mahol Exp $ */ #include <LYSession.h> @@ -55,19 +55,18 @@ static char *get_filename(char *given_name) /* Restore session from file, pretty slow, but it should be fine * for everyday, normal use. */ -BOOLEAN RestoreSession(void) +void RestoreSession(void) { - int code; char *my_filename = get_filename(sessionin_file); FILE *fp; char *buffer = 0; DocInfo doc; VisitedLink *vl; int i = 0; - short errors = 10; /* how much syntax errors are allowed in + short errors = 10; /* how many syntax errors are allowed in - session file before abort. */ - char *value1, *value2, *line, *linktext, *level; + session file before aborting. */ + char *value1, *value2, *rsline, *linktext, *rslevel; /* * This should be done only once, here: iff USE_SESSIONS is defined or: @@ -77,13 +76,12 @@ BOOLEAN RestoreSession(void) if (my_filename == NULL) { /* nothing to do, so exit */ - return (TRUE); + return; } CTRACE((tfp, "RestoreSession %s\n", my_filename)); SetDefaultMode(O_TEXT); if ((fp = fopen(my_filename, TXT_R)) != NULL) { - code = TRUE; /* * This should be safe, entries are added to lynx until memory i @@ -111,11 +109,11 @@ BOOLEAN RestoreSession(void) #endif /* GOTOURL_OUT_SESSION */ } else if (*buffer == 'h') { #ifdef HISTORY_OUT_SESSION - if ((line = strchr(buffer, ' ')) == 0) + if ((rsline = strchr(buffer, ' ')) == 0) continue; else { - line++; - if ((linktext = strchr(line, ' ')) == 0) + rsline++; + if ((linktext = strchr(rsline, ' ')) == 0) continue; else *linktext++ = 0; @@ -125,7 +123,7 @@ BOOLEAN RestoreSession(void) *value1++ = 0; if ((value2 = strchr(value1, '\t')) != 0) { *value2++ = 0; - doc.line = atoi(line); + doc.line = atoi(rsline); doc.link = atoi(linktext); StrAllocCopy(doc.address, value1); StrAllocCopy(doc.title, value2); @@ -135,11 +133,11 @@ BOOLEAN RestoreSession(void) #endif /* HISTORY_OUT_SESSION */ } else if (*buffer == 'V') { #ifdef VLINK_OUT_SESSION - if ((level = strchr(buffer, ' ')) == 0) + if ((rslevel = strchr(buffer, ' ')) == 0) continue; else { - level++; - if ((value1 = strchr(level, ' ')) == 0) + rslevel++; + if ((value1 = strchr(rslevel, ' ')) == 0) continue; else *value1++ = 0; @@ -151,7 +149,7 @@ BOOLEAN RestoreSession(void) vl = (VisitedLink *) HTList_objectAt(Visited_Links, i); if (vl != NULL) { - vl->level = atoi(level); + vl->level = atoi(rslevel); i++; } } @@ -170,17 +168,13 @@ BOOLEAN RestoreSession(void) LYCloseOutput(fp); } SetDefaultMode(O_BINARY); - return (TRUE); } -/* Save session to file, overwriting one. - * Fast as much as lynx allow. - * If it is still slow for you improve following functions: - * HTListObjectAt() and HTList_count(). +/* + * Save session to file, overwriting one. */ -BOOLEAN SaveSession(void) +void SaveSession(void) { - int code = FALSE; char *my_filename = get_filename(sessionout_file); FILE *fp; VisitedLink *vl; @@ -188,19 +182,19 @@ BOOLEAN SaveSession(void) if (my_filename == NULL) { /* nothing to do, so exit */ - return (TRUE); + return; } CTRACE((tfp, "SaveSession %s\n", my_filename)); SetDefaultMode(O_TEXT); if ((fp = fopen(my_filename, TXT_W)) != NULL) { - code = TRUE; fprintf(fp, "# lynx session\n"); /* @@@ simple for now */ /* Note use of session_limit, the most recent entries in list, - from end of list, are saved */ + * from the end of list, are saved. + */ #ifdef SEARCH_IN_SESSION k = HTList_count(search_queries); @@ -264,7 +258,6 @@ BOOLEAN SaveSession(void) } SetDefaultMode(O_BINARY); - return (code); } #endif /* USE_SESSIONS */ diff --git a/src/LYSession.h b/src/LYSession.h index f6c26a01..90d74fca 100644 --- a/src/LYSession.h +++ b/src/LYSession.h @@ -1,4 +1,4 @@ -/* $LynxId: LYSession.h,v 1.2 2008/01/10 23:50:45 tom Exp $ */ +/* $LynxId: LYSession.h,v 1.3 2008/02/10 23:47:39 Paul.B.Mahol Exp $ */ #ifndef LYSESSION_H #define LYSESSION_H @@ -7,8 +7,8 @@ #ifdef __cplusplus extern "C" { #endif - extern BOOLEAN RestoreSession(void); - extern BOOLEAN SaveSession(void); + extern void RestoreSession(void); + extern void SaveSession(void); #ifdef __cplusplus } |