summaryrefslogtreecommitdiff
path: root/Build/source/texk/lcdf-typetools/lcdf-typetools-2.94-PATCHES/patch-02-WIN32
blob: 26f2036a494c09a41e85de089aed58354485deef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.94.orig/otftotfm/automatic.cc lcdf-typetools-2.94/otftotfm/automatic.cc
--- lcdf-typetools-2.94.orig/otftotfm/automatic.cc	2011-11-03 17:51:58.000000000 +0100
+++ lcdf-typetools-2.94/otftotfm/automatic.cc	2012-08-11 17:49:05.000000000 +0200
@@ -40,6 +40,20 @@
 
 #ifdef WIN32
 # define mkdir(dir, access) mkdir(dir)
+# define COPY_CMD "copy"
+# define CMD_SEP "&"
+#else
+# define COPY_CMD "cp"
+# define CMD_SEP ";"
+#endif
+
+/* kpathsea may already have defined this */
+#ifndef DEV_NULL
+# ifdef WIN32
+#  define DEV_NULL "NUL"
+# else
+#  define DEV_NULL "/dev/null"
+# endif
 #endif
 
 #if HAVE_AUTO_T1DOTLESSJ
@@ -307,7 +321,11 @@
     if (!success && writable_texdir.find_left('\'') < 0 && directory.find_left('\'') < 0 && file.find_left('\'') < 0) {
 	// look for mktexupd script
 	if (!mktexupd_tried) {
+#ifdef WIN32
+	    mktexupd = strdup("mktexupd");
+#else
 	    mktexupd = kpsei_string(kpsei_find_file("mktexupd", KPSEI_FMT_WEB2C));
+#endif
 	    mktexupd_tried = true;
 	}
 
@@ -482,7 +498,7 @@
 
 	int retval;
 	if (!same_filename(ttf_filename, installed_ttf_filename)) {
-	    String command = "cp " + shell_quote(ttf_filename) + " " + shell_quote(installed_ttf_filename);
+	    String command = COPY_CMD " " + shell_quote(ttf_filename) + " " + shell_quote(installed_ttf_filename);
 	    retval = mysystem(command.c_str(), errh);
 	    if (retval == 127)
 		errh->error("could not run %<%s%>", command.c_str());
@@ -727,11 +741,11 @@
 	    int slash = filename.find_right('\'');
 	    if (slash >= 0)
 		filename = filename.substring(slash + 1);
-	    String command = "updmap --nomkmap --enable Map " + shell_quote(filename) + "; updmap";
+	    String command = "updmap --nomkmap --enable Map " + shell_quote(filename) + CMD_SEP " updmap";
 	    if (verbose)
 		command += " 1>&2";
 	    else
-		command += " >/dev/null 2>&1";
+		command += " >" DEV_NULL " 2>&1";
 	    int retval = mysystem(command.c_str(), errh);
 	    if (retval == 127)
 		errh->warning("could not run %<%s%>", command.c_str());
diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.94.orig/otftotfm/otftotfm.cc lcdf-typetools-2.94/otftotfm/otftotfm.cc
--- lcdf-typetools-2.94.orig/otftotfm/otftotfm.cc	2011-11-03 17:51:58.000000000 +0100
+++ lcdf-typetools-2.94/otftotfm/otftotfm.cc	2012-08-11 17:14:49.000000000 +0200
@@ -50,6 +50,10 @@
 #include <signal.h>
 #include <algorithm>
 #include <math.h>
+/* apparently M_PI isn't defined by <math.h> under VC++ */
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
 #ifdef HAVE_CTIME
 # include <time.h>
 #endif
diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.94.orig/otftotfm/util.cc lcdf-typetools-2.94/otftotfm/util.cc
--- lcdf-typetools-2.94.orig/otftotfm/util.cc	2011-11-03 17:51:58.000000000 +0100
+++ lcdf-typetools-2.94/otftotfm/util.cc	2012-08-11 17:42:50.000000000 +0200
@@ -103,15 +103,34 @@ same_filename(const String &a, const String &b)
 String
 shell_quote(const String &str)
 {
-#if defined(_MSDOS) || defined(_WIN32)
-    return str;			// XXX
-#else
     if (!str)
-	return String::make_stable("''");
+	return String::make_stable("\"\"");
 
     const char *begin = str.begin();
     const char *end = str.end();
     StringAccum sa;
+
+#if defined(_MSDOS) || defined(_WIN32)
+    sa.append('\"');
+
+    for (const char *s = begin; s < end; ++s)
+	if (isalnum((unsigned char) *s) || *s == '_' || *s == '-' || *s == '+' || *s == '\\' || *s == ':' || *s == '.')
+	    /* do nothing */;
+	else if (*s == '\"') {
+	    sa.append(begin, s);
+	    sa.append("\"\"\"", 3);
+	    begin = s + 1;
+	} else {
+	    sa.append(begin, s + 1);
+	    begin = s + 1;
+	}
+
+    if (sa.length() > 1) {
+	sa.append(begin, end);
+	sa.append('\"');
+	return sa.take_string();
+    }
+#else
     for (const char *s = begin; s < end; s++)
 	if (isalnum((unsigned char) *s) || *s == '_' || *s == '-' || *s == '+' || *s == '/' || *s == ':' || *s == '.')
 	    /* do nothing */;
@@ -121,13 +140,13 @@ shell_quote(const String &str)
 	    begin = s;
 	}
 
-    if (!sa)
-	return str;
-    else {
+    if (sa.length()) {
 	sa.append(begin, end);
 	return sa.take_string();
     }
 #endif
+
+    return str;
 }
 
 int