mothra: cleanup

This commit is contained in:
cinap_lenrek 2012-06-19 10:58:59 +02:00
parent e393b27806
commit 70b8ddeaae
2 changed files with 7 additions and 10 deletions

View file

@ -1,6 +1,3 @@
/*
* type=image is treated like submit
*/
#include <u.h> #include <u.h>
#include <libc.h> #include <libc.h>
#include <draw.h> #include <draw.h>
@ -463,17 +460,18 @@ void h_fileinput(Panel *p, int){
f = p->userp; f = p->userp;
nstrcpy(name, f->value, sizeof(name)); nstrcpy(name, f->value, sizeof(name));
free(f->value);
f->state=0;
for(;;){ for(;;){
if(eenter("Upload file", name, sizeof(name), &mouse) <= 0) if(eenter("Upload file", name, sizeof(name), &mouse) <= 0){
p->state = 0;
break; break;
}
if(access(name, AREAD) == 0){ if(access(name, AREAD) == 0){
f->state=1; free(f->value);
f->value = strdup(name);
p->state = 1;
break; break;
} }
} }
f->value = strdup(name);
pldraw(f->p, screen); pldraw(f->p, screen);
} }

View file

@ -57,8 +57,7 @@ struct Panel{
void (*free)(Panel *); /* free fields of data when done */ void (*free)(Panel *); /* free fields of data when done */
}; };
/* /*
* Panel flags -- there are more private flags in panelprivate.h * Panel flags
* that need to be kept synchronized with these!
*/ */
#define PACK 0x0007 /* which side of the parent is the Panel attached to? */ #define PACK 0x0007 /* which side of the parent is the Panel attached to? */
#define PACKN 0x0000 #define PACKN 0x0000