[links-list] patch to add -force-html to links (fwd)

Mikulas Patocka mikulas at artax.karlin.mff.cuni.cz
Sun May 5 19:00:47 PDT 2002



---------- Forwarded message ----------
Date: Fri, 26 Apr 2002 10:34:15 -0700
From: David O'Brien <obrien at FreeBSD.org>
To: Mikulas Patocka <mikulas at artax.karlin.mff.cuni.cz>
Subject: patch to add -force-html to links

Sorry, but I am NOT going to join a mailing list just to submit a patch
for links (http://links.sourceforge.net/mailing.html).  So you are
getting this directly.

This adds the very useful feature of making links treat a file as HTML.
The file should be parsed for <html></html> tags as depending on the
file's extention name is a poor indicator.  Anyway, this patch adds the
ability to make links treat a file as HTML.

-- 
-- David  (obrien at FreeBSD.org)



--- default.c.orig	Wed Jan 30 06:53:48 2002
+++ default.c	Fri Apr 26 09:12:21 2002
@@ -697,6 +697,11 @@
 	anonymous = 1;
 	return NULL;
 }
+unsigned char *force_html_cmd(struct option *o, unsigned char ***argv, int *argc)
+{
+	force_html = 1;
+	return NULL;
+}
 unsigned char *dump_cmd(struct option *o, unsigned char ***argv, int *argc)
 {
 	if (dmp != o->min && dmp) return "Can't use both -dump and -source";
@@ -769,6 +774,9 @@
   is allowed, but user can't add or modify entries in\n\
   association table.\n\
 \n\
+ -force-html\n\
+  Treat file as if it had an .html extension.\n\
+\n\
  -dump\n\
   Write a plain-text version of the given HTML document to\n\
   stdout.\n\
@@ -826,6 +834,7 @@
 int no_connect = 0;
 int base_session = 0;
 int dmp = 0;
+int force_html = 0;

 int async_lookup = 1;
 int download_utime = 0;
@@ -877,6 +886,7 @@
 	1, no_connect_cmd, NULL, NULL, 0, 0, NULL, NULL, "no-connect",
 	1, anonymous_cmd, NULL, NULL, 0, 0, NULL, NULL, "anonymous",
 	1, gen_cmd, num_rd, NULL, 0, MAXINT, &base_session, NULL, "base-session",
+	1, force_html_cmd, NULL, NULL, 0, 0, NULL, NULL, "force-html",
 	1, dump_cmd, NULL, NULL, D_DUMP, 0, NULL, NULL, "dump",
 	1, dump_cmd, NULL, NULL, D_SOURCE, 0, NULL, NULL, "source",
 	1, gen_cmd, num_rd, num_wr, 0, 1, &async_lookup, "async_dns", "async-dns",


--- types.c.orig	Fri Apr 26 09:11:15 2002
+++ types.c	Fri Apr 26 09:12:27 2002
@@ -66,5 +66,6 @@
 		else if (dir_sep(*ct)) ext = NULL;
 	if (ext) while (ext[extl] && !dir_sep(ext[extl]) && !end_of_dir(ext[extl])) extl++;
-	if ((extl == 3 && !casecmp(ext, "htm", 3)) ||
+	if (force_html ||
+	    (extl == 3 && !casecmp(ext, "htm", 3)) ||
 	    (extl == 4 && !casecmp(ext, "html", 4))) return stracpy("text/html");
 	foreach(e, extensions) if (is_in_list(e->ext, ext, extl)) return stracpy(e->ct);


--- links.h.orig	Sat Mar  2 05:35:30 2002
+++ links.h	Fri Apr 26 09:11:47 2002
@@ -1984,4 +1984,5 @@
 extern int no_connect;
 extern int base_session;
+extern int force_html;

 #define D_DUMP		1


-- 
Unsubscribe: send email to links-list-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message



More information about the links-list mailing list