about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2009-05-29 00:24:15 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2009-05-29 00:24:15 -0400
commita321a1e3ce91c7cd6a97cc4a652062ebfa20363f (patch)
tree3c638b6cbf0cb3af703b438fc793960f59884a63 /src
parenteda526bc92383f455c44cf4f411924c8d4df3bea (diff)
downloadlynx-snapshots-a321a1e3ce91c7cd6a97cc4a652062ebfa20363f.tar.gz
snapshot of project "lynx", label v2-8-7pre_4a
Diffstat (limited to 'src')
-rw-r--r--src/GridText.c16
-rw-r--r--src/HTForms.h5
-rw-r--r--src/HTML.c71
-rw-r--r--src/LYForms.c8
-rw-r--r--src/LYMain.c4
5 files changed, 52 insertions, 52 deletions
diff --git a/src/GridText.c b/src/GridText.c
index a36875ea..e45755df 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: GridText.c,v 1.167 2009/04/26 13:05:17 tom Exp $
+ * $LynxId: GridText.c,v 1.170 2009/05/29 00:04:24 tom Exp $
  *
  *		Character grid hypertext object
  *		===============================
@@ -6117,6 +6117,9 @@ void HText_FormDescNumber(int number,
     case F_RESET_TYPE:
 	*desc = gettext("reset button");
 	return;
+    case F_BUTTON_TYPE:
+	*desc = gettext("script button");
+	return;
     case F_OPTION_LIST_TYPE:
 	*desc = gettext("popup menu");
 	return;
@@ -9854,6 +9857,8 @@ int HText_beginInput(HText *text, BOOL underline,
 	    CTRACE((tfp, "ok, got a file uploader\n"));
 	} else if (!strcasecomp(I->type, "keygen")) {
 	    f->type = F_KEYGEN_TYPE;
+	} else if (!strcasecomp(I->type, "button")) {
+	    f->type = F_BUTTON_TYPE;
 	} else {
 	    /*
 	     * Note that TYPE="scribble" defaults to TYPE="text".  -FM
@@ -9938,6 +9943,13 @@ int HText_beginInput(HText *text, BOOL underline,
 	    StrAllocCopy(f->value, "Reset");
 	    f->size = 5;
 	}
+    } else if (f->type == F_BUTTON_TYPE) {
+	if (non_empty(f->value)) {
+	    f->size = strlen(f->value);
+	} else {
+	    StrAllocCopy(f->value, "BUTTON");
+	    f->size = 5;
+	}
     } else if (f->type == F_IMAGE_SUBMIT_TYPE ||
 	       f->type == F_SUBMIT_TYPE) {
 	if (non_empty(f->value)) {
@@ -10003,6 +10015,7 @@ int HText_beginInput(HText *text, BOOL underline,
 #endif
     case F_RANGE_TYPE:
     case F_KEYGEN_TYPE:
+    case F_BUTTON_TYPE:
 	a->number = 0;
 	break;
 
@@ -11410,6 +11423,7 @@ int HText_SubmitForm(FormInfo * submit_item, DocInfo *doc, char *link_name,
 		break;
 #endif /* USE_FILE_UPLOAD */
 	    case F_KEYGEN_TYPE:
+	    case F_BUTTON_TYPE:
 		/* not implemented */
 		break;
 	    }
diff --git a/src/HTForms.h b/src/HTForms.h
index de4ae372..ec994051 100644
--- a/src/HTForms.h
+++ b/src/HTForms.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTForms.h,v 1.26 2008/09/07 16:35:26 tom Exp $
+ * $LynxId: HTForms.h,v 1.27 2009/05/28 22:49:51 tom Exp $
  */
 #ifndef HTFORMS_H
 #define HTFORMS_H
@@ -133,7 +133,8 @@ extern "C" {
 	F_FILE_TYPE,
 	F_TEXT_SUBMIT_TYPE,
 	F_IMAGE_SUBMIT_TYPE,
-	F_KEYGEN_TYPE
+	F_KEYGEN_TYPE,
+	F_BUTTON_TYPE
     } FieldTypes;
 
 #define F_TEXTLIKE(type) ((type) == F_TEXT_TYPE || \
diff --git a/src/HTML.c b/src/HTML.c
index 007f3a4e..eaca6ad7 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTML.c,v 1.122 2009/05/25 19:53:35 tom Exp $
+ * $LynxId: HTML.c,v 1.126 2009/05/29 00:24:15 tom Exp $
  *
  *		Structured stream to Rich hypertext converter
  *		============================================
@@ -4316,35 +4316,24 @@ static int HTML_start_element(HTStructured * me, int element_number,
 	    I.value_cs = ATTR_CS_IN;
 
 	    UPDATE_STYLE;
-	    if ((present && present[HTML_BUTTON_TYPE] &&
-		 value[HTML_BUTTON_TYPE]) &&
-		(!strcasecomp(value[HTML_BUTTON_TYPE], "submit") ||
-		 !strcasecomp(value[HTML_BUTTON_TYPE], "reset"))) {
-		/*
-		 * It's a button for submitting or resetting a form.  - FM
-		 */
-		I.type = value[HTML_BUTTON_TYPE];
+	    if (present &&
+		present[HTML_BUTTON_TYPE] &&
+		value[HTML_BUTTON_TYPE]) {
+		if (!strcasecomp(value[HTML_BUTTON_TYPE], "submit") ||
+		    !strcasecomp(value[HTML_BUTTON_TYPE], "reset")) {
+		    /*
+		     * It's a button for submitting or resetting a form.  - FM
+		     */
+		    I.type = value[HTML_BUTTON_TYPE];
+		} else {
+		    /*
+		     * Ugh, it's a button for a script.  - FM
+		     */
+		    I.type = value[HTML_BUTTON_TYPE];
+		}
 	    } else {
-		/*
-		 * Ugh, it's a button for a script.  - FM
-		 */
-		HTML_put_string(me, " [BUTTON] ");
-		break;
-	    }
-
-	    /*
-	     * Make sure we're in a form.
-	     */
-	    if (!me->inFORM) {
-		if (LYBadHTML(me))
-		    CTRACE((tfp,
-			    "Bad HTML: BUTTON tag not within FORM tag\n"));
-		/*
-		 * We'll process it, since the chances of a crash are small,
-		 * and we probably do have a form started.  - FM
-		 *
-		 break;
-		 */
+		/* default, if no type given, is a submit button */
+		I.type = "submit";
 	    }
 
 	    /*
@@ -4391,6 +4380,12 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		 * trailing spaces.  - FM
 		 */
 		LYReduceBlanks(I.value);
+	    } else if (!strcasecomp(I.type, "button")) {
+		if (!isEmpty(I.name)) {
+		    StrAllocCopy(I.value, I.name);
+		} else {
+		    StrAllocCopy(I.value, "BUTTON");
+		}
 	    }
 
 	    if (present && present[HTML_BUTTON_DISABLED])
@@ -4550,8 +4545,7 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		    /*
 		     * Ugh, a button for a script.
 		     */
-		    HTML_put_string(me, "[BUTTON] ");
-		    break;
+		    not_impl = "[BUTTON Input]";
 		}
 		if (not_impl != NULL) {
 		    if (me->inUnderline == FALSE) {
@@ -4572,21 +4566,6 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		}
 	    }
 
-	    /*
-	     * Check if we're in a form.  - FM
-	     */
-	    if (!me->inFORM) {
-		if (LYBadHTML(me))
-		    CTRACE((tfp,
-			    "Bad HTML: INPUT tag not within FORM tag\n"));
-		/*
-		 * We'll process it, since the chances of a crash are small,
-		 * and we probably do have a form started.  - FM
-		 *
-		 break;
-		 */
-	    }
-
 	    CTRACE((tfp, "Ok, we're trying type=[%s]\n", NONNULL(I.type)));
 
 	    /*
diff --git a/src/LYForms.c b/src/LYForms.c
index 1e3b5af8..d6ea2fe9 100644
--- a/src/LYForms.c
+++ b/src/LYForms.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYForms.c,v 1.80 2009/01/01 23:21:07 tom Exp $ */
+/* $LynxId: LYForms.c,v 1.81 2009/05/28 23:10:06 tom Exp $ */
 #include <HTUtils.h>
 #include <HTCJK.h>
 #include <HTTP.h>
@@ -982,6 +982,12 @@ void show_formlink_statusline(const FormInfo * form,
 	else
 	    statusline(FORM_LINK_RESET_MESSAGE);
 	break;
+    case F_BUTTON_TYPE:
+	if (form->disabled == YES)
+	    statusline(FORM_LINK_BUTTON_DIS_MSG);
+	else
+	    statusline(FORM_LINK_BUTTON_MESSAGE);
+	break;
     case F_FILE_TYPE:
 	if (form->disabled == YES)
 	    statusline(FORM_LINK_FILE_UNM_MSG);
diff --git a/src/LYMain.c b/src/LYMain.c
index 1f12fcfe..e7c6d767 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMain.c,v 1.201 2009/05/22 00:18:53 tom Exp $
+ * $LynxId: LYMain.c,v 1.202 2009/05/28 21:37:03 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTP.h>
@@ -372,7 +372,7 @@ BOOLEAN LYNoRefererForThis = FALSE;	/* No Referer header for this URL? */
 BOOLEAN LYNoRefererHeader = FALSE;	/* Never send Referer header?     */
 BOOLEAN LYRawMode;
 BOOLEAN LYSelectPopups = USE_SELECT_POPUPS;
-BOOLEAN LYSendUserAgent = FALSE;	/* send Lynx User-Agent header? */
+BOOLEAN LYSendUserAgent = SEND_USERAGENT;	/* send Lynx User-Agent header? */
 BOOLEAN LYSetCookies = SET_COOKIES;	/* Process Set-Cookie headers? */
 BOOLEAN LYUseDefSelPop = TRUE;	/* Command line -popup toggle */
 BOOLEAN LYUseDefaultRawMode = TRUE;