shithub: riscv

Download patch

ref: 70b8ddeaae8864dfb3bea0477d3e70aa1f456644
parent: e393b278069fcc2690832c5e6fcbf58c008837dc
author: cinap_lenrek <[email protected]>
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