diff --git a/sys/src/cmd/mothra/forms.c b/sys/src/cmd/mothra/forms.c index b3bbc2e9b..615f2a813 100644 --- 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 #include #include @@ -463,17 +460,18 @@ void h_fileinput(Panel *p, int){ 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); } diff --git a/sys/src/cmd/mothra/libpanel/panel.h b/sys/src/cmd/mothra/libpanel/panel.h index becca3eb8..740bb5d45 100644 --- a/sys/src/cmd/mothra/libpanel/panel.h +++ b/sys/src/cmd/mothra/libpanel/panel.h @@ -57,8 +57,7 @@ struct Panel{ 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