summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-03-16 18:58:52 +0000
committerKarl Berry <karl@freefriends.org>2008-03-16 18:58:52 +0000
commit4d931d655146eb8429cd506a2060e20e6491bd62 (patch)
treed5aa9a366cda5cc27fb0af38eb7deab77ceec271
parent1944915ff698b237c9123b01fec720ab6264b895 (diff)
avoid double .fmt with -fmt=foo.fmt
git-svn-id: svn://tug.org/texlive/trunk@6978 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/lib/ChangeLog5
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c14
2 files changed, 17 insertions, 2 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog
index a6e44c1548f..af6eed7223f 100644
--- a/Build/source/texk/web2c/lib/ChangeLog
+++ b/Build/source/texk/web2c/lib/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-16 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (maininit): don't append DUMP_EXT if it's already
+ there. Report from Hans.
+
2008-03-09 Karl Berry <karl@tug.org>
* texmfmp.c (maketexstring) [!MP]: only define this fn if !MP,
diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c
index 2fdec76a9d0..bc4b1a0eeaf 100644
--- a/Build/source/texk/web2c/lib/texmfmp.c
+++ b/Build/source/texk/web2c/lib/texmfmp.c
@@ -297,8 +297,18 @@ maininit P2C(int, ac, string *, av)
/* If we've set up the fmt/base default in any of the various ways
above, also set its length. */
if (dump_name) {
- /* adjust array for Pascal and provide extension */
- DUMP_VAR = concat3 (" ", dump_name, DUMP_EXT);
+ const_string with_ext = NULL;
+ unsigned name_len = strlen (dump_name);
+ unsigned ext_len = strlen (DUMP_EXT);
+
+ /* Provide extension if not there already. */
+ if (name_len > ext_len
+ && FILESTRCASEEQ (dump_name + name_len - ext_len, DUMP_EXT)) {
+ with_ext = dump_name;
+ } else {
+ with_ext = concat (dump_name, DUMP_EXT);
+ }
+ DUMP_VAR = concat (" ", with_ext); /* adjust array for Pascal */
DUMP_LENGTH_VAR = strlen (DUMP_VAR + 1);
} else {
/* For dump_name to be NULL is a bug. */