mothra: remove debug code, dont create $home/lib/mothra/mothra.err file

This commit is contained in:
cinap_lenrek 2013-12-07 00:51:19 +01:00
parent a989f89f3e
commit 66cc2fa960
4 changed files with 20 additions and 43 deletions

View file

@ -4,7 +4,7 @@ mothra \- retrieve and display World-Wide Web files
.SH SYNOPSIS
.B mothra
[
.B -dva
.B -va
]
[
.B -m
@ -52,10 +52,6 @@ the environment variable
.PP
There are a number of options:
.TP
.B -d
Debug mode. Causes debug messages to appear in
.B $home/lib/mothra/mothra.err.
.TP
.B -a
Alt display. Starts in alt display mode, see menu
commands table below.
@ -70,8 +66,8 @@ The default is
.B /mnt/web.
.TP
.B -v
Verbose mode. Causes HTML errors to appear in
.B $home/lib/mothra/mothra.err.
Verbose mode. Causes HTML errors to be printed
on file-descriptor 2.
.PP
The display contains the last message from
.I mothra,
@ -169,9 +165,6 @@ for most image files.
.SH FILES
.B $home/lib/mothra/hit.html
the hit list
.br
.B $home/lib/mothra/mothra.err
log of debug and/or error messages, including HTML syntax errors
.SH SOURCE
.B /sys/src/cmd/mothra
.SH "SEE ALSO"

View file

@ -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);

View file

@ -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:

View file

@ -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 */