15/* 15 Gets previews of PDF Documents 15*/ 10void15 07getPDFPreview(10char15 *filepath,15 10int15 maxy,15 10int15 maxx) { 15 10char15 imgout[]15 =15 05"05/tmp/prev.jpg05"; 15 10pid_t15 pid; 15 pid15 =15 fork(); 15 02struct15 07sigaction15 act; 15 sigemptyset(&act.sa_mask); 15 act.sa_flags15 =15 020; 15 act.sa_handler15 =15 cb_sig; 15 02if(pid15 ==15 020) 15 { 15 execlp(05"05pdftoppm05",05"05pdftoppm05",05"05-l05",05"05105",05"05-jpeg05",filepath,05"05-singlefile05",15 05"05/tmp/prev05",15 (10char15 *)10NULL); 15 exit(021); 15 } 15 02else 15 { 15 15//int status; 15 15//waitpid(pid, &status, 0); 15 02if15 (ERR15 ==15 wgetch(current_win)) 15 { 15 printf(05"05wgetch interrupted by signal05\n05"); 15 } 15 02else 15 { 15 raise(SIGUSR1); 15 } 15 02if15 (raised_signal15 ==15 SIGUSR1) 15 { 15 kill(pid,15 SIGINT); 15 } 15 02else15 02if15 (raised_signal15 ==15 SIGCHLD) 15 { 15 getImgPreview(imgout,15 maxy,15 maxx); 15 clearFlagImg15 =15 021; 15 } 15 } }