CIDFonts: look for external replacement.
[swftools.git] / pdf2swf / ttf2pt1 / runt1asm.c
1 /*
2  * Wrap-around code to either compile in t1asm or call it externally
3  *
4  * Copyright (C) 2000 by Sergey Babkin
5  * Copyright (C) 2000 by The TTF2PT1 Project
6  *
7  * See COPYRIGHT for full license
8  */
9
10 #ifdef EXTERNAL_T1ASM
11
12 #include <stdio.h>
13 #include <errno.h>
14
15 FILE *ifp;
16 FILE *ofp;
17
18 int 
19 runt1asm(
20         int pfbflag
21 )
22 {
23         char *cmd;
24         int id, od;
25         int error;
26
27         /* first make a copy in case some of then is already stdin/stdout */
28         if(( id = dup(fileno(ifp)) )<0) {
29                 perror("** Re-opening input file for t1asm");
30                 exit(1);
31         }
32         if(( od = dup(fileno(ofp)) )<0) {
33                 perror("** Re-opening output file for t1asm");
34                 exit(1);
35         }
36         fclose(ifp); fclose(ofp);
37         close(0);
38         if(( dup(id) )!=0) {
39                 perror("** Re-directing input file for t1asm");
40                 exit(1);
41         }
42         close(1);
43         if(( dup(od) )!=1) {
44                 perror("** Re-directing output file for t1asm");
45                 exit(1);
46         }
47         close(id); close(od);
48
49         if(pfbflag)
50                 error = execlp("t1asm", "t1asm", "-b", NULL);
51         else
52                 error = execlp("t1asm", "t1asm", NULL);
53
54         perror("** Calling t1asm");
55         
56         exit(1);
57 }
58
59 #else
60 #       include "t1asm.c"
61 #endif