[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lynx-dev] Feature Request: download current page

From: Thorsten Glaser
Subject: [Lynx-dev] Feature Request: download current page
Date: Sat, 28 Aug 2004 12:53:55 +0000

Hi all,

wouldn't a feature like the diff below be useful?

I often visit webpages which are somehow parsed by lynx, but
I have to get them "as is". Printing the source of the page
is not an option usually, because it modifies it, and going
back and pressing 'd' on the link is sometimes not an option
either, because the file is not linked anywhere.
Of course I could just write a temporary HTML page on my local
workstation, linking to the file mentioned - but what if the
webserver is buggy and serves me the (binary, ascii plaintext,
whatever) content as text/html? The charset and base get pre-
pended, which means even _more_ work.

That's why I want a download-me-this-page-as-is option, just
as if I'd call wget or ftp (on BSD it does http) on the file
(which doesn't do basic auth, for example).

The diff below is the UI part, I couldn't get the grip on the
lynx source to find out how to actually code the option.
Maybe adding a parameter to the send_file_to_file() function
and modifying it.

Index: LYPrint.c
RCS file: /cvs/src/gnu/usr.bin/lynx/src/LYPrint.c,v
retrieving revision 1.5
diff -d -u -r1.5 LYPrint.c
--- LYPrint.c   15 Jul 2004 18:16:39 -0000      1.5
+++ LYPrint.c   28 Aug 2004 12:46:54 -0000
@@ -29,6 +29,7 @@
 /* it parses an incoming link that looks like
  * LYNXPRINT://MAIL_FILE/lines=##
  * LYNXPRINT://TO_SCREEN/lines=##
  * LYNXPRINT://LPANSI/lines=##
@@ -55,6 +56,7 @@
 #define LPANSI   3
 #define MAIL     4
 #define PRINTER   5
+#define        TO_FILE_DOWNLOAD 6

 static int remove_quotes(char *string);
@@ -1117,6 +1119,8 @@
     if (strstr(link_info, "LOCAL_FILE")) {
        type = TO_FILE;
+    } else if (strstr(link_info, "LOCAL_FILE_BINARY")) {
+       type = TO_FILE_DOWNLOAD;
     } else if (strstr(link_info, "TO_SCREEN")) {
        type = TO_SCREEN;
     } else if (strstr(link_info, "LPANSI")) {
@@ -1147,6 +1151,7 @@
     switch (type) {

     case TO_FILE:
        send_file_to_file(newdoc, content_base, sug_filename);
@@ -1239,6 +1244,7 @@
  * printer links look like
  * LYNXPRINT://LOCAL_FILE/lines=#           print to a local file
+ * LYNXPRINT://LOCAL_FILE_BINARY/lines=#     download to a local file
  * LYNXPRINT://TO_SCREEN/lines=#            print to the screen
  * LYNXPRINT://LPANSI/lines=#               print to the local terminal
  * LYNXPRINT://MAIL_FILE/lines=#            mail the file
@@ -1292,6 +1298,11 @@
                gettext("Save to a local file"));
+       fprintf(fp0,
+               "   <a href=\"%s//LOCAL_FILE_BINARY/lines=%d\">%s</a>\n",
+               STR_LYNXPRINT,
+               lines_in_file,
+               gettext("Download to a local file"));
     } else {
        fprintf(fp0, "   <em>%s</em>\n", gettext("Save to disk disabled"));

Thanks in advance,

Currently blocking eMail from the following domains:, biz,,,, info,,, name,,,,,,,,,,,,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]