+ char *xpmdata=0;
+ r= XpmCreateBufferFromImage(disp, &xpmdata, sn, 0, &xpma);
+ eassert(!r);
+ eassert(xpmdata);
+
+ paster= fork(); eassert(paster!=-1);
+ if (!paster) {
+ FILE *f= fdopen(paste[1],"w"); eassert(f);
+ close(paste[0]);
+ close(results[0]);
+ close(results[1]);
+ r= fputs(xpmdata,f); eassert(r!=EOF);
+ //size_t did= fwrite(sn->d, 1, sn->len, f);
+ //eassert(did==sn->len);
+ eassert(!fclose(f));
+ exit(0);
+ }
+
+ close(paste[0]);
+ close(paste[1]);
+ close(results[1]);
+
+ XpmFree(xpmdata);
+
+ FILE *f= fdopen(results[0],"r");
+ int c1= fgetc(f);
+ if (c1!=EOF) {
+ ungetc(c1,f);
+ page_images[pageno]= file_read_image(f);
+ r= fgetc(f); eassert(r==EOF); eassert(!ferror(f)); eassert(feof(f));
+ fclose(f);
+ }
+
+ pid_t got_conv,got_paste;
+ int st_conv, st_paste;
+
+ got_conv= waitpid(converter,&st_conv,0); eassert(got_conv==converter);
+ got_paste= waitpid(paster,&st_paste,0); eassert(got_paste==paster);
+
+ if (!st_conv &&
+ (!st_paste || (WIFSIGNALED(st_paste) && WTERMSIG(st_paste)==SIGPIPE))
+ && c1!=EOF) {
+ fclose(err);
+ return;
+ }
+ rewind(err); int c; while ((c=getc(err))!=EOF) fputc(c,stderr);
+ fprintf(stderr, "convert: subprocess statuses: %d %d\n", st_conv, st_paste);
+ _exit(127);
+}