Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2006/0116/2

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Invoke pdfs with -dDELAYSAFER.
 [rsc] --rw-rw-r-- M 661145 glenda sys 6553 Jan 16 19:52 sys/src/cmd/page/gs.c
	/n/sourcesdump/2006/0116/plan9/sys/src/cmd/page/gs.c:134,140 - 
	/n/sourcesdump/2006/0117/plan9/sys/src/cmd/page/gs.c:134,140
	  }
	  
	  int 
	- spawngs(GSInfo *g)
	+ spawngs(GSInfo *g, char *safer)
	  {
	  	char *args[16];
	  	char tb[32], gb[32];
	/n/sourcesdump/2006/0116/plan9/sys/src/cmd/page/gs.c:158,164 - 
	/n/sourcesdump/2006/0117/plan9/sys/src/cmd/page/gs.c:158,164
	  	nargs = 0;
	  	args[nargs++] = "gs";
	  	args[nargs++] = "-dNOPAUSE";
	- 	args[nargs++] = "-dSAFER";
	+ 	args[nargs++] = safer;
	  	args[nargs++] = "-sDEVICE=plan9";
	  	args[nargs++] = "-sOutputFile=/fd/3";
	  	args[nargs++] = "-dQUIET";
 [rsc] --rw-rw-r-- M 661145 glenda sys 2159 Jan 16 19:52 sys/src/cmd/page/page.h
	/n/sourcesdump/2006/0116/plan9/sys/src/cmd/page/page.h:56,62 - 
	/n/sourcesdump/2006/0117/plan9/sys/src/cmd/page/page.h:56,62
	  };
	  void	waitgs(GSInfo*);
	  int	gscmd(GSInfo*, char*, ...);
	- int	spawngs(GSInfo*);
	+ int	spawngs(GSInfo*, char*);
	  void	setdim(GSInfo*, Rectangle, int, int);
	  int	spawnwriter(GSInfo*, Biobuf*);
	  Rectangle	screenrect(void);
 [rsc] --rw-rw-r-- M 661145 glenda sys 2942 Jan 16 19:52 sys/src/cmd/page/pdf.c
	/n/sourcesdump/2006/0116/plan9/sys/src/cmd/page/pdf.c:97,103 - 
	/n/sourcesdump/2006/0117/plan9/sys/src/cmd/page/pdf.c:97,103
	  	d->pagename = pdfpagename;
	  	d->fwdonly = 0;
	  
	- 	if(spawngs(pdf) < 0)
	+ 	if(spawngs(pdf, "-dDELAYSAFER") < 0)
	  		return nil;
	  
	  	gscmd(pdf, "%s", pdfprolog);
	/n/sourcesdump/2006/0116/plan9/sys/src/cmd/page/pdf.c:104,110 - 
	/n/sourcesdump/2006/0117/plan9/sys/src/cmd/page/pdf.c:104,110
	  	waitgs(pdf);
	  
	  	setdim(pdf, Rect(0,0,0,0), ppi, 0);
	- 	gscmd(pdf, "(%s) (r) file pdfopen begin\n", fn);
	+ 	gscmd(pdf, "(%s) (r) file { DELAYSAFER { .setsafe } if } stopped pop pdfopen begin\n", fn);
	  	gscmd(pdf, "pdfpagecount PAGE==\n");
	  	p = Brdline(&pdf->gsrd, '\n');
	  	npage = atoi(p);
	/n/sourcesdump/2006/0116/plan9/sys/src/cmd/page/pdf.c:125,131 - 
	/n/sourcesdump/2006/0117/plan9/sys/src/cmd/page/pdf.c:125,130
	  		if(Dx(pdf->pagebbox[i]) <= 0)
	  			pdf->pagebbox[i] = bbox;
	  	}
	- 
	  	return d;
	  }
	  
 [rsc] --rw-rw-r-- M 661145 rob sys 519 Jan 16 19:52 sys/src/cmd/page/pdfprolog.ps
	/n/sourcesdump/2006/0116/plan9/sys/src/cmd/page/pdfprolog.ps:2,8 - 
	/n/sourcesdump/2006/0117/plan9/sys/src/cmd/page/pdfprolog.ps:2,8
	  /Page# 0 def
	  /PDFSave null def
	  /DSCPageCount 0 def
	- /DoPDFPage {dup /Page# exch store pdfgetpage mypdfshowpage } def
	+ /DoPDFPage {dup /Page# exch store pdfgetpage pdfshowpage } def
	  
	  /pdfshowpage_mysetpage {	% <pagedict> pdfshowpage_mysetpage <pagedict>
	    dup /CropBox pget {
	/n/sourcesdump/2006/0116/plan9/sys/src/cmd/page/pdfprolog.ps:15,32 - 
	/n/sourcesdump/2006/0117/plan9/sys/src/cmd/page/pdfprolog.ps:15,20
	        << 5 1 roll >> setpagedevice
	    } if
	  } bind def
	- 
	- /mypdfshowpage		% <pagedict> pdfshowpage -
	-  { dup /Page exch store
	-    pdfshowpage_init 
	-    pdfshowpage_setpage 
	-    pdfshowpage_mysetpage
	-    save /PDFSave exch store
	-    (before exec) VMDEBUG
	-      pdfshowpage_finish
	-    (after exec) VMDEBUG
	-    PDFSave restore
	-  } bind def
	  
	  GS_PDF_ProcSet begin
	  pdfdict begin
 [rsc] --rw-rw-r-- M 661145 glenda sys 9187 Jan 16 19:52 sys/src/cmd/page/ps.c
	/n/sourcesdump/2006/0116/plan9/sys/src/cmd/page/ps.c:348,354 - 
	/n/sourcesdump/2006/0117/plan9/sys/src/cmd/page/ps.c:348,354
	  	d->fwdonly = ps->clueless = dumb;
	  	d->docname = argv[0];
	  
	- 	if(spawngs(ps) < 0)
	+ 	if(spawngs(ps, "-dSAFER") < 0)
	  		return nil;
	  
	  	if(!cantranslate)


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.