summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/progname.c
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/source/texk/kpathsea/progname.c
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/source/texk/kpathsea/progname.c')
-rw-r--r--Build/source/texk/kpathsea/progname.c16
1 files changed, 6 insertions, 10 deletions
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__)