git: 9front

Download patch

ref: 5c398c1ebdf31c58964e48a0de5cfb45c38bb920
parent: cfe6d587c9bf8ba72da73b26eff1c9302b5c317b
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Tue Jun 19 06:58:59 EDT 2012

mothra: cleanup

--- a/sys/src/cmd/mothra/forms.c
+++ b/sys/src/cmd/mothra/forms.c
@@ -1,6 +1,3 @@
-/*
- * type=image is treated like submit
- */
 #include <u.h>
 #include <libc.h>
 #include <draw.h>
@@ -463,17 +460,18 @@
 
 	f = p->userp;
 	nstrcpy(name, f->value, sizeof(name));
-	free(f->value);
-	f->state=0;
 	for(;;){
-		if(eenter("Upload file", name, sizeof(name), &mouse) <= 0)
+		if(eenter("Upload file", name, sizeof(name), &mouse) <= 0){
+			p->state = 0;
 			break;
+		}
 		if(access(name, AREAD) == 0){
-			f->state=1;
+			free(f->value);
+			f->value = strdup(name);
+			p->state = 1;
 			break;
 		}
 	}
-	f->value = strdup(name);
 	pldraw(f->p, screen);
 }
 
--- a/sys/src/cmd/mothra/libpanel/panel.h
+++ b/sys/src/cmd/mothra/libpanel/panel.h
@@ -57,8 +57,7 @@
 	void (*free)(Panel *);				/* free fields of data when done */
 };
 /*
- * Panel flags -- there are more private flags in panelprivate.h
- * that need to be kept synchronized with these!
+ * Panel flags
  */
 #define	PACK	0x0007		/* which side of the parent is the Panel attached to? */
 #define		PACKN	0x0000
--