summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/progname.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-08-08 14:20:10 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-08-08 14:20:10 +0000
commit323596a9825b0bc191d0e9ccdcb5c054bd6bfe4c (patch)
tree87ef587fe74192e8023f048933ce6440675c3e88 /Build/source/texk/kpathsea/progname.c
parent2ecffc40c146978bd7a054c6c943e9ab1ae48a52 (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/progname.c')
-rw-r--r--Build/source/texk/kpathsea/progname.c57
1 files changed, 39 insertions, 18 deletions
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 */