shithub: riscv

Download patch

ref: 72989ba9cb9946e489363855ea6a85a931f6990b
parent: ec70fc64ad6e5072f83ce672f20ae200055fe0eb
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Sat Sep 24 04:51:19 EDT 2011

mothra: fix j command

--- a/sys/src/cmd/mothra/mothra.c
+++ b/sys/src/cmd/mothra/mothra.c
@@ -540,11 +540,11 @@
 		else geturl(s, GET, 0, 1, 0);
 		break;
 	case 'j':
-		s=arg(s);
+		s = arg(s);
 		if(*s)
-			geturl(www(atoi(s)-1)->url->fullname, GET, 0, 0, 0);
+			doprev(nil, 1, wwwtop-atoi(s));
 		else
-			message("no url selected");
+			message("Usgae: j index");
 		break;
 	case 'r':
 		s = arg(s);
@@ -601,7 +601,7 @@
 void doprev(Panel *p, int buttons, int index){
 	int i;
 	USED(p);
-	if(index >= nwww())
+	if(index < 0 || index >= nwww())
 		return;
 	i = wwwtop-index-1;
 	switch(buttons){
--