shithub: pdffs

Download patch

ref: a8650067946d600cbf7e6406bc85d248cf96607d
parent: a105fe96aac770cd3c939c7744715a8d8982795f
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sat Nov 21 15:24:19 EST 2020

change the command line array indexing

--- a/main.c
+++ b/main.c
@@ -1,11 +1,12 @@
 #include <u.h>
 #include <libc.h>
 #include <thread.h>
+#include <ctype.h>
 #include <bio.h>
 #include <flate.h>
 #include "pdf.h"
 
-int mainstacksize = 32768;
+int mainstacksize = 128*1024;
 
 static void
 usage(void)
@@ -38,8 +39,8 @@
 	if((pdf = pdfopen(b)) == nil)
 		sysfatal("%s: %r", argv[0]);
 	for(v = pdf->top, i = 1; v != nil && i < argc; i++){
-		if(argv[i][0] == '['){
-			n = atoi(argv[i]+1);
+		if(isdigit(argv[i][0])){
+			n = atoi(argv[i]);
 			v = arrayget(v, n);
 		}else if(argv[i][0] == '.' && argv[i][1] == 0 && v->type == Ostream){
 			if((s = Sopen(v)) == nil)