texlive[68029] Build/source/texk/afm2pl: afm2pl: Open files with

commits+takuji at tug.org commits+takuji at tug.org
Wed Aug 23 16:53:00 CEST 2023


Revision: 68029
          http://tug.org/svn/texlive?view=revision&revision=68029
Author:   takuji
Date:     2023-08-23 16:53:00 +0200 (Wed, 23 Aug 2023)
Log Message:
-----------
afm2pl: Open files with binary mode (Windows only)

Modified Paths:
--------------
    trunk/Build/source/texk/afm2pl/ChangeLog
    trunk/Build/source/texk/afm2pl/afm2pl.c
    trunk/Build/source/texk/afm2pl/afm2pl.test

Modified: trunk/Build/source/texk/afm2pl/ChangeLog
===================================================================
--- trunk/Build/source/texk/afm2pl/ChangeLog	2023-08-23 14:52:55 UTC (rev 68028)
+++ trunk/Build/source/texk/afm2pl/ChangeLog	2023-08-23 14:53:00 UTC (rev 68029)
@@ -1,3 +1,8 @@
+2023-08-23  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>
+
+	* afm2pl.c: Open files with binary mode (Windows only).
+	* afm2pl.test: Make easier to test on Windows.
+
 2022-08-30  Karl Berry  <karl at freefriends.org>
 
 	* afm2pl.1: typo fixes from Hilmar Preu\ss{}e,

Modified: trunk/Build/source/texk/afm2pl/afm2pl.c
===================================================================
--- trunk/Build/source/texk/afm2pl/afm2pl.c	2023-08-23 14:52:55 UTC (rev 68028)
+++ trunk/Build/source/texk/afm2pl/afm2pl.c	2023-08-23 14:53:00 UTC (rev 68029)
@@ -95,6 +95,14 @@
 #define fopen cmsfopen
 #endif
 
+#ifdef WIN32
+#define R_MODE  "rb"
+#define W_MODE  "wb"
+#else
+#define R_MODE  "r"
+#define W_MODE  "w"
+#endif
+
 /* from dvips.h: */
 
 #ifdef VMS
@@ -473,10 +481,10 @@
   const char *realfname;
 
   realfname = fname;
-  infile = fopen (realfname, "r");
+  infile = fopen (realfname, R_MODE);
   if (!infile && !find_suffix (realfname)) {
     realfname = concat (fname, ext);
-    infile = fopen (realfname, "r");
+    infile = fopen (realfname, R_MODE);
   }
   if (infile)
     return realfname;
@@ -522,7 +530,7 @@
     else
       realfname = concat (fname, outext);
   }
-  outfile = fopen (realfname, "w");
+  outfile = fopen (realfname, W_MODE);
   /* afm2tfm uses WRITEBIN instead of "w" for some OS-es */
   if (outfile)
     return realfname;
@@ -1664,7 +1672,7 @@
 writedump(void)
 {
   int i;
-  dmp = fopen (dmpname, "w");
+  dmp = fopen (dmpname, W_MODE);
   if (!dmp)
     error ("Cant open dump file");
   if (lbound) {

Modified: trunk/Build/source/texk/afm2pl/afm2pl.test
===================================================================
--- trunk/Build/source/texk/afm2pl/afm2pl.test	2023-08-23 14:52:55 UTC (rev 68028)
+++ trunk/Build/source/texk/afm2pl/afm2pl.test	2023-08-23 14:53:00 UTC (rev 68029)
@@ -4,9 +4,13 @@
 # Copyright 2009, 2011 Peter Breitenlohner <tex-live at tug.org>
 # You may freely use, modify and/or distribute this file.
 
+BinDir=${BinDir:-.}
+ExeExt=${ExeExt:-}
+_afm2pl=$BinDir/afm2pl$ExeExt
+
 rm -f logo10.*
 TEXMFCNF=$srcdir/../kpathsea \
-	./afm2pl -l 0 $srcdir/tests/logo10 ./logo10.pl \
+	$_afm2pl -l 0 $srcdir/tests/logo10 ./logo10.pl \
 	&& diff $srcdir/tests/logo10.pl logo10.pl \
 	&& diff $srcdir/tests/logo10.map logo10.map \
 	|| exit 1



More information about the tex-live-commits mailing list.