shithub: pdffs

Download patch

ref: 6d2612e1503c37990bba44b409e5402d9dbd5c19
parent: cbd761013ebea1a24594f016e67cd601cbb1a856
author: Noam Preil <noam@pixelhero.dev>
date: Tue Jun 1 19:30:17 EDT 2021

don't print object when using " for page

--- a/main.c
+++ b/main.c
@@ -54,7 +54,7 @@
 	Biobuf *b;
 	Stream *s;
 	Pdf *pdf;
-	int i, n, k;
+	int i, n, k, nodump;
 
 	quotefmtinstall();
 	inflateinit();
@@ -63,6 +63,8 @@
 	default:
 		usage();
 	}ARGEND
+	
+	nodump = 0;
 
 	if(argc < 1)
 		usage();
@@ -84,9 +86,11 @@
 			break;
 		}else if(argv[i][0] == '"' && argv[i][1] == 0 && v->type == Odict && strcmp(dictget(v, "Type")->name, "Page") == 0){
 			dumppage(v);
+			nodump = 1;
 			break;
 		}else if(argv[i][0] == '"' && argv[i][1] == 0 && v->type == Odict && strcmp(dictget(v, "Type")->name, "Pages") == 0){
 			dumppages(v);
+			nodump = 1;
 			break;
 		}else if(argv[i][0] == '*' && argv[i][1] == 0 && v->type == Odict){
 			for(k = 0; k < v->dict.nkv; k++)
@@ -108,7 +112,8 @@
 			v = dictget(v, argv[i]);
 		}
 	}
-	if(v == &null)
+	if(nodump){}
+	else if(v == &null)
 		fprint(2, "%r\n");
 	else if(v != nil)
 		print("%O\n", v);