From e29d3b031826e3682366db40ac72db2b65c70673 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Thu, 28 Jul 2011 15:10:43 +0000 Subject: kpathsea: More changes to reduce diffs with W32TeX git-svn-id: svn://tug.org/texlive/trunk@23257 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 6 +++++- Build/source/texk/kpathsea/db.c | 19 +++++++++++-------- Build/source/texk/kpathsea/progname.c | 27 +++++++++++++++++++++++++-- Build/source/texk/kpathsea/types.h | 31 +++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 11 deletions(-) (limited to 'Build/source') diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 41863ffb866..11b2f675f69 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,12 +1,16 @@ 2011-07-28 Peter Breitenlohner More diffs between TeX Live and W32TeX. - * find-suffix.c, xbasename.c: + * db.c, find-suffix.c, xbasename.c: Reformulate and test for 2-Byte Kanji (CP 932, SJIS) codes. * expand.c, make-suffix.c, tilde.c: Slashify, reformulate, and test for 2-Byte Kanji (CP 932, SJIS) codes. + * progname.c: Make sure SELFAUTO{LOC,DIR,PARENT} is not just /. + + * types.h (kpathsea_instance): Merge TL and W32TeX. + 2011-07-27 Peter Breitenlohner More diffs between TeX Live and W32TeX. diff --git a/Build/source/texk/kpathsea/db.c b/Build/source/texk/kpathsea/db.c index 86ac3786875..2e8aeef78c4 100644 --- a/Build/source/texk/kpathsea/db.c +++ b/Build/source/texk/kpathsea/db.c @@ -44,18 +44,13 @@ #endif /* read ls-R only on WIN32 */ -#ifdef WIN32 -static const_string db_names[] = { - DB_NAME, - NULL -}; -#else static const_string db_names[] = { DB_NAME, +#ifndef WIN32 DB_NAME_LC, +#endif NULL }; -#endif #ifndef ALIAS_NAME #define ALIAS_NAME "aliases" @@ -74,9 +69,17 @@ ignore_dir_p (const_string dirname) { const_string dot_pos = dirname; +#if defined(WIN32) + while (*(++dot_pos)) { + if (IS_KANJI(dot_pos-1)) + dot_pos++; + else if (*dot_pos == '.' && +#else while ((dot_pos = strchr (dot_pos + 1, '.'))) { + if ( +#endif /* If / before and no / after, skip it. */ - if (IS_DIR_SEP (dot_pos[-1]) && dot_pos[1] && !IS_DIR_SEP (dot_pos[1])) + IS_DIR_SEP (dot_pos[-1]) && dot_pos[1] && !IS_DIR_SEP (dot_pos[1])) return true; } diff --git a/Build/source/texk/kpathsea/progname.c b/Build/source/texk/kpathsea/progname.c index 8f84bed7004..9313ccbabb0 100644 --- a/Build/source/texk/kpathsea/progname.c +++ b/Build/source/texk/kpathsea/progname.c @@ -291,7 +291,11 @@ 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 we have `/../', that's the same as `/'. */ p[(last - 1 ? last - 1 : 1)] = 0; break; @@ -469,6 +473,24 @@ mk_suffixlist (kpathsea kpse) } #endif /* WIN32 || __CYGWIN__ */ +/* Append a dot if SELFAUTO{LOC,DIR,PARENT} is just `/'. Otherwise, + e.g., $SELFAUTODIR/texmf would search the entire filesystem. */ +static inline string +fix_selfdir (string dir) +{ +#if defined(WIN32) + if (dir[strlen (dir) - 1] == '/') { +#else + if (IS_DIR_SEP (dir[strlen (dir) - 1])) { +#endif + string ret = concat (dir, "."); + free (dir); + return ret; + } + + return dir; +} + void kpathsea_set_program_name (kpathsea kpse, const_string argv0, const_string progname) @@ -651,10 +673,11 @@ 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 = fix_selfdir (sdir); kpathsea_xputenv (kpse, "SELFAUTOLOC", sdir); - sdir_parent = xdirname (sdir); + sdir_parent = fix_selfdir (xdirname (sdir)); kpathsea_xputenv (kpse, "SELFAUTODIR", sdir_parent); - sdir_grandparent = xdirname (sdir_parent); + sdir_grandparent = fix_selfdir (xdirname (sdir_parent)); kpathsea_xputenv (kpse, "SELFAUTOPARENT", sdir_grandparent); #if defined(WIN32) || defined(__CYGWIN__) diff --git a/Build/source/texk/kpathsea/types.h b/Build/source/texk/kpathsea/types.h index 4d7b8654554..68e3c967d93 100644 --- a/Build/source/texk/kpathsea/types.h +++ b/Build/source/texk/kpathsea/types.h @@ -187,6 +187,25 @@ typedef struct boolean binmode; /* Open files in binary mode? */ } kpse_format_info_type; +#if defined(WIN32) && !defined(__MINGW32__) +struct passwd { + char *pw_name; + char *pw_passwd; + int pw_uid; + int pw_gid; + int pw_quota; + char *pw_gecos; + char *pw_dir; + char *pw_shell; +}; + +struct _popen_elt { + FILE *f; /* File stream returned */ + void *hp; /* Handle of associated process */ + struct _popen_elt *next; /* Next list element */ +}; +#endif /* WIN32 && !__MINGW32 */ + typedef struct kpathsea_instance *kpathsea; typedef struct kpathsea_instance { @@ -254,6 +273,18 @@ typedef struct kpathsea_instance { #if defined(WIN32) || defined(__CYGWIN__) char **suffixlist; #endif /* WIN32 || __CYGWIN__ */ + +#if defined(WIN32) && !defined(__MINGW32__) + struct _popen_elt _z_p_open; + struct _popen_elt *_popen_list; + char the_passwd_name[256]; + char the_passwd_passwd[256]; + char the_passwd_gecos[256]; + char the_passwd_dir[256]; + char the_passwd_shell[256]; + struct passwd the_passwd; + int __system_allow_multiple_cmds; +#endif /* WIN32 && !__MINGW32__ */ } kpathsea_instance; /* these come from kpathsea.c */ -- cgit v1.2.3