summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/lib
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-10-05 06:46:46 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-10-05 06:46:46 +0000
commit0dc119d557620b5abcb51d25fb8ac6c9b2c09466 (patch)
treee416b6f9f876a78c354f9b9962883584caafd268 /Build/source/texk/web2c/lib
parent3151a4a67bd0a28056b1ebf91eb88a3307d9d6ef (diff)
remove more TL vs W32TeX diffs
git-svn-id: svn://tug.org/texlive/trunk@24207 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/lib')
-rw-r--r--Build/source/texk/web2c/lib/ChangeLog4
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c86
2 files changed, 76 insertions, 14 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog
index aeebbdc05e2..b897b4f5ae9 100644
--- a/Build/source/texk/web2c/lib/ChangeLog
+++ b/Build/source/texk/web2c/lib/ChangeLog
@@ -1,3 +1,7 @@
+2011-10-04 Peter Breitenlohner <peb@mp.mpg.de>
+
+ * texmfmp.c (calledit): More changes to reduce diffs with W32TeX.
+
2011-10-01 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* texmfmp.c: write (sock, buff, n) and send (sock, buff, n, 0)
diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c
index f1bf7f95109..233d319f5eb 100644
--- a/Build/source/texk/web2c/lib/texmfmp.c
+++ b/Build/source/texk/web2c/lib/texmfmp.c
@@ -116,6 +116,16 @@ char *generic_synctex_get_current_name (void)
}
#endif
+#if defined(TeX) || (defined(MF) && defined(WIN32))
+static int
+Isspace (char c)
+{
+ return (c == ' ' || c == '\t');
+}
+#endif /* TeX || (MF && WIN32) */
+
+#ifdef TeX
+
/* Shell escape.
If shellenabledp == 0, all shell escapes are forbidden.
@@ -157,8 +167,6 @@ char *generic_synctex_get_current_name (void)
irrelevant if shellenabledp == 0.
*/
-#ifdef TeX
-
/* cmdlist is a list of allowed commands which are given like this:
shell_escape_commands = kpsewhich,ebb,extractbb,mpost,metafun
in texmf.cnf. */
@@ -259,12 +267,6 @@ char_needs_quote (int c)
}
#endif
-static int
-Isspace (char c)
-{
- return (c == ' ' || c == '\t');
-}
-
#if 0
/* We could call this at the end of the main program, but does it matter?
The process is about to exit anyway. */
@@ -2125,10 +2127,16 @@ calledit (packedASCIIcode *filename,
integer fnlength,
integer linenumber)
{
- char *temp, *command;
+ char *temp, *command, *fullcmd;
char c;
int sdone, ddone, i;
+#ifdef WIN32
+ char *fp, *ffp, *env, editorname[256], buffer[256];
+ int cnt = 0;
+ int dontchange = 0;
+#endif
+
sdone = ddone = 0;
filename += fnstart;
@@ -2153,6 +2161,17 @@ calledit (packedASCIIcode *filename,
/* So we can construct it as we go. */
temp = command;
+#ifdef WIN32
+ fp = editorname;
+ if ((isalpha(*edit_value) && *(edit_value + 1) == ':'
+ && IS_DIR_SEP (*(edit_value + 2)))
+ || (*edit_value == '"' && isalpha(*(edit_value + 1))
+ && *(edit_value + 2) == ':'
+ && IS_DIR_SEP (*(edit_value + 3)))
+ )
+ dontchange = 1;
+#endif
+
while ((c = *edit_value++) != 0)
{
if (c == '%')
@@ -2188,17 +2207,56 @@ calledit (packedASCIIcode *filename,
break;
}
}
- else
+ else {
+#ifdef WIN32
+ if (dontchange)
+ *temp++ = c;
+ else { if(Isspace(c) && cnt == 0) {
+ cnt++;
+ temp = command;
+ *temp++ = c;
+ *fp = '\0';
+ } else if(!Isspace(c) && cnt == 0) {
+ *fp++ = c;
+ } else {
+ *temp++ = c;
+ }
+ }
+#else
*temp++ = c;
+#endif
+ }
}
*temp = 0;
+#ifdef WIN32
+ if (dontchange == 0) {
+ if(editorname[0] == '.' ||
+ editorname[0] == '/' ||
+ editorname[0] == '\\') {
+ fprintf(stderr, "%s is not allowed to execute.\n", editorname);
+ uexit(1);
+ }
+ env = (char *)getenv("PATH");
+ if(SearchPath(env, editorname, ".exe", 256, buffer, &ffp)==0) {
+ if(SearchPath(env, editorname, ".bat", 256, buffer, &ffp)==0) {
+ fprintf(stderr, "I cannot find %s in the PATH.\n", editorname);
+ uexit(1);
+ }
+ }
+ fullcmd = (char *)xmalloc(strlen(buffer)+strlen(command)+5);
+ strcpy(fullcmd, "\"");
+ strcat(fullcmd, buffer);
+ strcat(fullcmd, "\"");
+ strcat(fullcmd, command);
+ } else
+#endif
+ fullcmd = command;
+
/* Execute the command. */
- {
- if (system (command) != 0)
- fprintf (stderr, "! Trouble executing `%s'.\n", command);
- }
+ if (system (fullcmd) != 0)
+ fprintf (stderr, "! Trouble executing `%s'.\n", command);
/* Quit, since we found an error. */
uexit (1);