shithub: pdffs

Download patch

ref: 77b04087e2d02e9e889789ce74eda0bbffb5b781
parent: a04da7cfc947f56ab85e19f752a6d3a10194382c
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Wed Dec 9 09:21:53 EST 2020

add * to list the keys of a dict

--- a/main.c
+++ b/main.c
@@ -22,7 +22,7 @@
 	Biobuf *b;
 	Stream *s;
 	Pdf *pdf;
-	int i, n;
+	int i, n, k;
 
 	quotefmtinstall();
 	inflateinit();
@@ -48,6 +48,11 @@
 			if(write(1, s->buf.b, s->buf.sz) != s->buf.sz)
 				sysfatal("write failed");
 			Sclose(s);
+			v = nil;
+			break;
+		}else if(argv[i][0] == '*' && argv[i][1] == 0 && v->type == Odict){
+			for(k = 0; k < v->dict.nkv; k++)
+				print("%s\n", v->dict.kv[k].key);
 			v = nil;
 			break;
 		}else if(argv[i][0] == '@' && argv[i][1] == 0 && v->type == Ostream){