X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fttf2pt1%2Fttf2pt1.c;h=0b03b2363995b45179e61faf9c514f6608355dd7;hb=0e6deb35dd62be9cb5b56af78c08fa3842030040;hp=009f7079d966502eb93d67a044aeedb3763d7df2;hpb=95188f7e5e440a90515a50c85478ed2fc9ed6859;p=swftools.git diff --git a/pdf2swf/ttf2pt1/ttf2pt1.c b/pdf2swf/ttf2pt1/ttf2pt1.c index 009f707..0b03b23 100644 --- a/pdf2swf/ttf2pt1/ttf2pt1.c +++ b/pdf2swf/ttf2pt1/ttf2pt1.c @@ -108,6 +108,12 @@ struct frontsw *frontswtab[] = { NULL /* end of table */ }; +#ifdef WIN32 +#define NOPIPES +#else +#undef NOPIPES +#endif + struct frontsw *cursw=0; /* the active front end */ char *front_arg=""; /* optional argument */ @@ -2074,14 +2080,13 @@ ttf2pt1_main( BITBUCKET); exit(1); } - if (argv[2][0] == '-' && argv[2][1] == 0) { -#ifdef WIN32 +#ifdef NOPIPES if(encode) { fprintf(stderr, "**** can't write encoded file to stdout ***\n"); exit(1); } -#endif /* WIN32 */ +#endif /* NOPIPES */ pfa_file = afm_file = dvienc_file = null_file; if(wantafm || genlast == &gen_afm) { /* print .afm instead of .pfa */ @@ -2092,13 +2097,13 @@ ttf2pt1_main( pfa_file=stdout; } } else { -#ifndef WIN32 +#ifndef NOPIPES snprintf(filename, sizeof filename, "%s.%s", argv[2], encode ? (pfbflag ? "pfb" : "pfa") : "t1a" ); -#else /* WIN32 */ +#else /* NOPIPES */ snprintf(filename, sizeof filename, "%s.t1a", argv[2]); -#endif /* WIN32 */ +#endif /* NOPIPES */ if(gen_pfa) { - if ((pfa_file = fopen(filename, "w+b")) == NULL) { + if ((pfa_file = fopen(filename, "wb+")) == NULL) { fprintf(stderr, "**** Cannot create %s ****\n", filename); exit(1); } else { @@ -2129,13 +2134,13 @@ ttf2pt1_main( /* * Now check whether we want a fully encoded .pfa file */ -#ifndef WIN32 +#ifndef NOPIPES if (encode && pfa_file != null_file) { int p[2]; extern FILE *ifp, *ofp; /* from t1asm.c */ - ifp=stdin; - ofp=stdout; + ifp=stdin; //? + ofp=stdout; //? if (pipe(p) < 0) { perror("**** Cannot create pipe ****\n"); @@ -2163,7 +2168,7 @@ ttf2pt1_main( fclose(ifp); fclose(ofp); } } -#endif /* WIN32 */ +#endif /* NOPIPES */ numglyphs = cursw->nglyphs(); @@ -2529,7 +2534,7 @@ ttf2pt1_main( cursw->close(); -#ifndef WIN32 +#ifndef NOPIPES while (wait(&ws) > 0) { } #else @@ -2538,8 +2543,7 @@ ttf2pt1_main( snprintf(filename, sizeof filename, "%s.%s", argv[2], pfbflag ? "pfb" : "pfa" ); - if ((ofp = fopen(filename, "w+b")) == NULL) { - fprintf(stderr, "**** Cannot create %s ****\n", filename); + if ((ofp = fopen(filename, "wb+")) == NULL) { exit(1); } else { WARNING_2 fprintf(stderr, "Creating file %s\n", filename); @@ -2548,7 +2552,6 @@ ttf2pt1_main( snprintf(filename, sizeof filename, "%s.t1a", argv[2]); if ((ifp = fopen(filename, "rb")) == NULL) { - fprintf(stderr, "**** Cannot read %s ****\n", filename); exit(1); } else { WARNING_2 fprintf(stderr, "Converting file %s\n", filename); @@ -2560,7 +2563,7 @@ ttf2pt1_main( if(unlink(filename) < 0) WARNING_1 fprintf(stderr, "Unable to remove file %s\n", filename); } -#endif /* WIN32 */ +#endif /* NOPIPES */ fclose(null_file); return 0;