summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdfm-x/pdfximage.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2015-08-12 11:06:16 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2015-08-12 11:06:16 +0000
commit73447a07f1f4c93539418cc14fbfbbe6ede62728 (patch)
treeed4f5efb169a8e20e9947af3b09aee9b886452d4 /Build/source/texk/dvipdfm-x/pdfximage.c
parentaecb768e7189355e7b96d2796a6ec23133088840 (diff)
texk/dvipdfm-x: Moved check_for_mp() and declared as static
git-svn-id: svn://tug.org/texlive/trunk@38104 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfm-x/pdfximage.c')
-rw-r--r--Build/source/texk/dvipdfm-x/pdfximage.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/Build/source/texk/dvipdfm-x/pdfximage.c b/Build/source/texk/dvipdfm-x/pdfximage.c
index 8765e3a4f10..5e6aa96344c 100644
--- a/Build/source/texk/dvipdfm-x/pdfximage.c
+++ b/Build/source/texk/dvipdfm-x/pdfximage.c
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2007-2014 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2007-2015 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu>
@@ -45,8 +45,8 @@
#include "pdfximage.h"
-/* From psimage.h */
-static int check_for_ps (FILE *fp);
+static int check_for_ps (FILE *image_file);
+static int check_for_mp (FILE *image_file);
static int ps_include_page (pdf_ximage *ximage, const char *file_name);
@@ -979,3 +979,25 @@ static int check_for_ps (FILE *image_file)
return 1;
return 0;
}
+
+static int check_for_mp (FILE *image_file)
+{
+ int try_count = 10;
+
+ rewind (image_file);
+ mfgets(work_buffer, WORK_BUFFER_SIZE, image_file);
+ if (strncmp(work_buffer, "%!PS", 4))
+ return 0;
+
+ while (try_count > 0) {
+ mfgets(work_buffer, WORK_BUFFER_SIZE, image_file);
+ if (!strncmp(work_buffer, "%%Creator:", 10)) {
+ if (strlen(work_buffer+10) >= 8 &&
+ strstr(work_buffer+10, "MetaPost"))
+ break;
+ }
+ try_count--;
+ }
+
+ return ((try_count > 0) ? 1 : 0);
+}