diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2013-12-07 00:51:19 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2013-12-07 00:51:19 +0100 |
commit | 66cc2fa96036398b10bc8def293bb5759bbbabe4 (patch) | |
tree | 373be246558d5c2ffcfd86285b8b88f6801c7399 /sys/src/cmd | |
parent | a989f89f3e15bae969c764114a256237c3538672 (diff) |
mothra: remove debug code, dont create $home/lib/mothra/mothra.err file
Diffstat (limited to 'sys/src/cmd')
-rw-r--r-- | sys/src/cmd/mothra/forms.c | 9 | ||||
-rw-r--r-- | sys/src/cmd/mothra/mothra.c | 40 | ||||
-rw-r--r-- | sys/src/cmd/mothra/mothra.h | 1 |
3 files changed, 17 insertions, 33 deletions
diff --git a/sys/src/cmd/mothra/forms.c b/sys/src/cmd/mothra/forms.c index d8feef5ba..90cfe4683 100644 --- a/sys/src/cmd/mothra/forms.c +++ b/sys/src/cmd/mothra/forms.c @@ -701,17 +701,8 @@ void h_submitinput(Panel *p, int){ return; } buf[n] = 0; - if(debug)fprint(2, "GET %s\n", buf); geturl(buf, -1, 0, 0); } else { - if(debug){ - fprint(2, "POST %s ->\n", form->action); - if(form->ctype) - mencodeform(form, 2); - else - uencodeform(form, 2); - fprint(2, "\n"); - } /* only set for multipart/form-data */ if(form->ctype) mencodeform(form, fd); diff --git a/sys/src/cmd/mothra/mothra.c b/sys/src/cmd/mothra/mothra.c index 9e87d4819..d851ecc25 100644 --- a/sys/src/cmd/mothra/mothra.c +++ b/sys/src/cmd/mothra/mothra.c @@ -11,8 +11,8 @@ #include <panel.h> #include "mothra.h" #include "rtext.h" -int debug=0; /* -d flag causes debug messages to appear in mothra.err */ -int verbose=0; /* -v flag causes html errors to appear in mothra.err */ +int debug=0; +int verbose=0; /* -v flag causes html errors to be written to file-descriptor 2 */ int defdisplay=1; /* is the default (initial) display visible? */ Panel *root; /* the whole display */ Panel *alt; /* the alternate display */ @@ -208,29 +208,29 @@ void catch(void*, char*){ void dienow(void*, char*){ noted(NDFLT); } -int mkmfile(char *stem, int mode){ - char *henv; - char filename[NNAME]; + +char* mkhome(void){ + static char *home; /* where to put files */ + char *henv, *tmp; int f; - if(home[0]=='\0'){ + + if(home == nil){ henv=getenv("home"); if(henv){ - sprint(home, "%s/lib", henv); - f=create(home, OREAD, DMDIR|0777); + tmp = smprint("%s/lib", henv); + f=create(tmp, OREAD, DMDIR|0777); if(f!=-1) close(f); - sprint(home, "%s/lib/mothra", henv); + free(tmp); + + home = smprint("%s/lib/mothra", henv); f=create(home, OREAD, DMDIR|0777); if(f!=-1) close(f); free(henv); } else - strcpy(home, "/tmp"); + home = strdup("/tmp"); } - snprint(filename, sizeof(filename), "%s/%s", home, stem); - f=create(filename, OWRITE, mode); - if(f==-1) - f=create(stem, OWRITE, mode); - return f; + return home; } void donecurs(void){ @@ -263,7 +263,6 @@ void main(int argc, char *argv[]){ Www *new; Action *a; char *url; - int errfile; int i; quotefmtinstall(); @@ -302,11 +301,6 @@ void main(int argc, char *argv[]){ break; case 1: url=argv[0]; break; } - errfile=mkmfile("mothra.err", 0666); - if(errfile!=-1){ - dup(errfile, 2); - close(errfile); - } if(initdraw(0, 0, mothra) < 0) sysfatal("initdraw: %r"); display->locking = 1; @@ -1129,7 +1123,7 @@ void hit3(int button, int item){ message("no url selected"); break; } - snprint(name, sizeof(name), "%s/hit.html", home); + snprint(name, sizeof(name), "%s/hit.html", mkhome()); fd=open(name, OWRITE); if(fd==-1){ fd=create(name, OWRITE, 0666); @@ -1145,7 +1139,7 @@ void hit3(int button, int item){ close(fd); break; case 5: - snprint(name, sizeof(name), "file:%s/hit.html", home); + snprint(name, sizeof(name), "file:%s/hit.html", mkhome()); geturl(name, -1, 1, 0); break; case 6: diff --git a/sys/src/cmd/mothra/mothra.h b/sys/src/cmd/mothra/mothra.h index ef0c44f1a..6f74d0b50 100644 --- a/sys/src/cmd/mothra/mothra.h +++ b/sys/src/cmd/mothra/mothra.h @@ -65,7 +65,6 @@ enum{ }; Image *hrule, *bullet, *linespace; -char home[512]; /* where to put files */ int chrwidth; /* nominal width of characters in font */ Panel *text; /* Panel displaying the current www page */ int debug; /* command line flag */ |