shithub: neatpost

Download patch

ref: f2030e386371d32081f82f793c82ef6635ba04da
parent: f4fb4f43d7e643d83e818924cfe0a1d28e908f7a
author: Ali Gholami Rudi <ali@rudi.ir>
date: Sun Nov 27 14:38:50 EST 2022

ps: ignore version numbers when checking EPSF header

--- a/ps.c
+++ b/ps.c
@@ -263,7 +263,7 @@
 	char buf[1 << 12];
 	int llx, lly, urx, ury;
 	FILE *filp;
-	int nbb;
+	int nbb, ver;
 	if (!(filp = fopen(eps, "r")))
 		return;
 	if (!fgets(buf, sizeof(buf), filp)) {
@@ -271,10 +271,8 @@
 		fclose(filp);
 		return;
 	}
-	if (strncmp(buf, "%!PS-Adobe-2.0 EPSF-1.2", 23) &&
-			strncmp(buf, "%!PS-Adobe-2.0 EPSF-2.0", 23) &&
-			strncmp(buf, "%!PS-Adobe-3.0 EPSF-3.0", 23)) {
-		fprintf(stderr, "warning: unsupported EPSF version in %s\n", eps);
+	if (sscanf(buf, "%%!PS-Adobe-%d.%d EPSF-%d.%d", &ver, &ver, &ver, &ver) != 4) {
+		fprintf(stderr, "warning: unsupported EPSF header in %s\n", eps);
 		fclose(filp);
 		return;
 	}