git: 9front

Download patch

ref: 1c26c7b9cb137ce88c13043ce370540b1a690998
parent: fcb29de25ef3fc4ae82f09bf39e92447aaa51d85
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){
--