summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-08-08 11:04:42 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-08-08 11:04:42 +0000
commit2ecffc40c146978bd7a054c6c943e9ab1ae48a52 (patch)
tree99ca3736d3d3bd80f2401206a43419a1ae6dd21e /Build
parent34c47a7c4363950281106076fa3e666c8cda557a (diff)
kpathsea: progname.c: Simplify fix_selfdir() and clarify remove_dots().
git-svn-id: svn://tug.org/texlive/trunk@23460 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog5
-rw-r--r--Build/source/texk/kpathsea/progname.c16
2 files changed, 11 insertions, 10 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index bdcce6411ff..1f6b72068f6 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-06 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * progname.c (fix_selfdir): Simplified to not modify arg.
+ (remove_dots): Somewhat clarify the code (suggested by Karl).
+
2011-08-08 Karl Berry <karl@tug.org>
* cnf-to-paths.awk: preserve values starting with /,
diff --git a/Build/source/texk/kpathsea/progname.c b/Build/source/texk/kpathsea/progname.c
index eccf31028a4..56d896c5907 100644
--- a/Build/source/texk/kpathsea/progname.c
+++ b/Build/source/texk/kpathsea/progname.c
@@ -291,13 +291,9 @@ remove_dots (kpathsea kpse, string dir)
unsigned last;
string p = NAME_BEGINS_WITH_DEVICE (ret) ? ret + 2 : ret;
for (last = strlen (p); last > 0; last--) {
-#if defined(WIN32)
- if (p[last - 1] == '/') {
-#else
- if (IS_DIR_SEP (p[last - 1])) {
-#endif
+ if (IS_DIR_SEP_CH (p[last - 1])) {
/* If we have `/../', that's the same as `/'. */
- p[(last - 1 ? last - 1 : 1)] = 0;
+ p[(last > 1 ? last - 1 : 1)] = 0;
break;
}
}
@@ -479,8 +475,8 @@ static inline string
fix_selfdir (string dir)
{
#if defined(WIN32)
- if (IS_DIR_SEP (*dir) && dir[1] == 0)
- *dir = 0;
+ if (IS_DIR_SEP_CH (*dir) && dir[1] == 0)
+ dir++;
#endif
return dir;
}
@@ -667,10 +663,10 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0,
#endif
/* SELFAUTODIR is actually the parent of the invocation directory,
and SELFAUTOPARENT the grandparent. This is how teTeX did it. */
- sdir_parent = xdirname (sdir);
- sdir_grandparent = xdirname (sdir_parent);
kpathsea_xputenv (kpse, "SELFAUTOLOC", fix_selfdir (sdir));
+ sdir_parent = xdirname (sdir);
kpathsea_xputenv (kpse, "SELFAUTODIR", fix_selfdir (sdir_parent));
+ sdir_grandparent = xdirname (sdir_parent);
kpathsea_xputenv (kpse, "SELFAUTOPARENT", fix_selfdir (sdir_grandparent));
#if defined(WIN32) || defined(__CYGWIN__)