diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-08-08 14:20:10 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-08-08 14:20:10 +0000 |
commit | 323596a9825b0bc191d0e9ccdcb5c054bd6bfe4c (patch) | |
tree | 87ef587fe74192e8023f048933ce6440675c3e88 /Build/source/texk/kpathsea | |
parent | 2ecffc40c146978bd7a054c6c943e9ab1ae48a52 (diff) |
kpathsea: standalone test program progname-test
git-svn-id: svn://tug.org/texlive/trunk@23461 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea')
-rw-r--r-- | Build/source/texk/kpathsea/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/Makefile.am | 6 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/Makefile.in | 31 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/progname.c | 57 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/progname.h | 4 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/xdirtest.c | 2 |
6 files changed, 82 insertions, 23 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 1f6b72068f6..68f900f6734 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -2,6 +2,11 @@ * progname.c (fix_selfdir): Simplified to not modify arg. (remove_dots): Somewhat clarify the code (suggested by Karl). + * progname.h [WIN32]: Don't declare {kpathsea,kpse)_selfdir(). + + * progname.c [TEST]: Update and extend the test program. + * Makefile.am (progname-test): Add rules to build the standalone + test program. 2011-08-08 Karl Berry <karl@tug.org> diff --git a/Build/source/texk/kpathsea/Makefile.am b/Build/source/texk/kpathsea/Makefile.am index d5040794466..9257bec27c8 100644 --- a/Build/source/texk/kpathsea/Makefile.am +++ b/Build/source/texk/kpathsea/Makefile.am @@ -218,7 +218,11 @@ kpsereadlink_SOURCES = readlink.c kpsewhich_LDADD = libkpathsea.la -EXTRA_PROGRAMS = xdirtest +EXTRA_PROGRAMS = progname-test xdirtest + +progname_test_CPPFLAGS = -DMAKE_KPSE_DLL -DTEST +progname_test_SOURCES = progname.c +progname_test_LDADD = libkpathsea.la xdirtest_LDADD = libkpathsea.la diff --git a/Build/source/texk/kpathsea/Makefile.in b/Build/source/texk/kpathsea/Makefile.in index b6efd2fa0a9..b1fe69aa7ee 100644 --- a/Build/source/texk/kpathsea/Makefile.in +++ b/Build/source/texk/kpathsea/Makefile.in @@ -43,7 +43,7 @@ host_triplet = @host@ @WIN32_TRUE@am__append_3 = knj.c bin_PROGRAMS = kpseaccess$(EXEEXT) kpsereadlink$(EXEEXT) \ kpsestat$(EXEEXT) kpsewhich$(EXEEXT) -EXTRA_PROGRAMS = xdirtest$(EXEEXT) +EXTRA_PROGRAMS = progname-test$(EXEEXT) xdirtest$(EXEEXT) subdir = . DIST_COMMON = README $(am__configure_deps) $(dist_noinst_DATA) \ $(dist_noinst_SCRIPTS) $(dist_web2c_DATA) \ @@ -168,6 +168,9 @@ kpsestat_LDADD = $(LDADD) kpsewhich_SOURCES = kpsewhich.c kpsewhich_OBJECTS = kpsewhich.$(OBJEXT) kpsewhich_DEPENDENCIES = libkpathsea.la +am_progname_test_OBJECTS = progname_test-progname.$(OBJEXT) +progname_test_OBJECTS = $(am_progname_test_OBJECTS) +progname_test_DEPENDENCIES = libkpathsea.la xdirtest_SOURCES = xdirtest.c xdirtest_OBJECTS = xdirtest.$(OBJEXT) xdirtest_DEPENDENCIES = libkpathsea.la @@ -186,10 +189,11 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libkpathsea_la_SOURCES) $(kpseaccess_SOURCES) \ - $(kpsereadlink_SOURCES) kpsestat.c kpsewhich.c xdirtest.c + $(kpsereadlink_SOURCES) kpsestat.c kpsewhich.c \ + $(progname_test_SOURCES) xdirtest.c DIST_SOURCES = $(am__libkpathsea_la_SOURCES_DIST) \ $(kpseaccess_SOURCES) $(kpsereadlink_SOURCES) kpsestat.c \ - kpsewhich.c xdirtest.c + kpsewhich.c $(progname_test_SOURCES) xdirtest.c RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -457,6 +461,9 @@ DISTCLEANFILES = paths.h stamp-paths kpathsea.h kpseaccess_SOURCES = access.c kpsereadlink_SOURCES = readlink.c kpsewhich_LDADD = libkpathsea.la +progname_test_CPPFLAGS = -DMAKE_KPSE_DLL -DTEST +progname_test_SOURCES = progname.c +progname_test_LDADD = libkpathsea.la xdirtest_LDADD = libkpathsea.la web2cdir = ${prefix}/texmf/web2c dist_web2c_SCRIPTS = mktexdir mktexnam mktexupd @@ -614,6 +621,9 @@ kpsestat$(EXEEXT): $(kpsestat_OBJECTS) $(kpsestat_DEPENDENCIES) kpsewhich$(EXEEXT): $(kpsewhich_OBJECTS) $(kpsewhich_DEPENDENCIES) @rm -f kpsewhich$(EXEEXT) $(LINK) $(kpsewhich_OBJECTS) $(kpsewhich_LDADD) $(LIBS) +progname-test$(EXEEXT): $(progname_test_OBJECTS) $(progname_test_DEPENDENCIES) + @rm -f progname-test$(EXEEXT) + $(LINK) $(progname_test_OBJECTS) $(progname_test_LDADD) $(LIBS) xdirtest$(EXEEXT): $(xdirtest_OBJECTS) $(xdirtest_DEPENDENCIES) @rm -f xdirtest$(EXEEXT) $(LINK) $(xdirtest_OBJECTS) $(xdirtest_LDADD) $(LIBS) @@ -724,6 +734,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-xrealloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-xstat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-xstrdup.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/progname_test-progname.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readlink.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdirtest.Po@am__quote@ @@ -1161,6 +1172,20 @@ libkpathsea_la-knj.lo: knj.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkpathsea_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libkpathsea_la-knj.lo `test -f 'knj.c' || echo '$(srcdir)/'`knj.c +progname_test-progname.o: progname.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(progname_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT progname_test-progname.o -MD -MP -MF $(DEPDIR)/progname_test-progname.Tpo -c -o progname_test-progname.o `test -f 'progname.c' || echo '$(srcdir)/'`progname.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/progname_test-progname.Tpo $(DEPDIR)/progname_test-progname.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='progname.c' object='progname_test-progname.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(progname_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o progname_test-progname.o `test -f 'progname.c' || echo '$(srcdir)/'`progname.c + +progname_test-progname.obj: progname.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(progname_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT progname_test-progname.obj -MD -MP -MF $(DEPDIR)/progname_test-progname.Tpo -c -o progname_test-progname.obj `if test -f 'progname.c'; then $(CYGPATH_W) 'progname.c'; else $(CYGPATH_W) '$(srcdir)/progname.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/progname_test-progname.Tpo $(DEPDIR)/progname_test-progname.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='progname.c' object='progname_test-progname.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(progname_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o progname_test-progname.obj `if test -f 'progname.c'; then $(CYGPATH_W) 'progname.c'; else $(CYGPATH_W) '$(srcdir)/progname.c'; fi` + mostlyclean-libtool: -rm -f *.lo diff --git a/Build/source/texk/kpathsea/progname.c b/Build/source/texk/kpathsea/progname.c index 56d896c5907..678e0118247 100644 --- a/Build/source/texk/kpathsea/progname.c +++ b/Build/source/texk/kpathsea/progname.c @@ -722,26 +722,47 @@ kpse_set_program_name (const_string argv0, const_string progname) #ifdef TEST +static const char *tab[] = { +/* 'normal' names */ + "/w/kpathsea", + "/w//kpathsea", + "/w/./kpathsea", + ".", + "./", + "./.", + "../kpathsea", + "/kpathsea/../foo", + "/../w/kpathsea", + "/../w/kpathsea/.", + "/te/share/texmf/../../../../bin/gnu", + NULL +}; + int main (int argc, char **argv) { - kpathsea kpse = xcalloc(1, sizeof(kpathsea_instance)); - kpathsea_set_program_name(kpse, argv[0], NULL); - puts (remove_dots (kpse,"/w/kpathsea")); - puts (remove_dots (kpse,"/w//kpathsea")); - puts (remove_dots (kpse,"/w/./kpathsea")); - puts (remove_dots (kpse,".")); - puts (remove_dots (kpse,"./")); - puts (remove_dots (kpse,"./.")); - puts (remove_dots (kpse,"../kpathsea")); - puts (remove_dots (kpse,"/kpathsea/../foo")); - puts (remove_dots (kpse,"/../w/kpathsea")); - puts (remove_dots (kpse,"/../w/kpathsea/.")); - puts (remove_dots (kpse,"/te/share/texmf/../../../../bin/gnu")); + const char **p; + kpathsea kpse = xcalloc(1, sizeof(kpathsea_instance)); + + kpathsea_set_program_name(kpse, argv[0], NULL); + +#if defined(WIN32) + printf("\n%s: Nothing to do for WIN32\n", + kpse->invocation_short_name); +#else + printf("\n%s: name -> remove_dots(name)\n\n", + kpse->invocation_short_name); + + for (p = tab; *p; p++) { + char *q = xstrdup(*p); + char *s = remove_dots(kpse, q); + + printf("%s -> %s\n", q, s); + free (q); + free (s); + } +#endif + + return 0; } -/* -Local variables: -standalone-compile-command: "gcc -g -I. -I.. -DTEST progname.c kpathsea.a" -End: -*/ #endif /* TEST */ diff --git a/Build/source/texk/kpathsea/progname.h b/Build/source/texk/kpathsea/progname.h index dd3c1bffce7..3d012b35152 100644 --- a/Build/source/texk/kpathsea/progname.h +++ b/Build/source/texk/kpathsea/progname.h @@ -25,7 +25,9 @@ /* Return directory ARGV0 comes from. Check PATH if ARGV0 is not absolute. */ +#if !defined (WIN32) extern KPSEDLL string kpathsea_selfdir (kpathsea kpse, const_string argv0); +#endif /* Set the first two variables above (if they're not predefined) to a copy of ARGV0 and everything in ARGV0 after the last directory separator, @@ -44,7 +46,9 @@ extern KPSEDLL void kpathsea_set_program_name (kpathsea kpse, #if defined (KPSE_COMPAT_API) +#if !defined (WIN32) extern KPSEDLL string kpse_selfdir (const_string argv0); +#endif extern KPSEDLL void kpse_set_program_name (const_string argv0, const_string progname); diff --git a/Build/source/texk/kpathsea/xdirtest.c b/Build/source/texk/kpathsea/xdirtest.c index 2299e8fde06..78fa4046b7e 100644 --- a/Build/source/texk/kpathsea/xdirtest.c +++ b/Build/source/texk/kpathsea/xdirtest.c @@ -1,4 +1,4 @@ -/* xdirtest.c: standalone test xdirname() and xbasename(). +/* xdirtest.c: standalone program to test xdirname() and xbasename(). Copyright 1999 Karl Berry. Copyright 2005 Olaf Weber. |