]> cygwin.com Git - cygwin-apps/setup.git/blobdiff - concat.cc
2002-07-15 Robert Collins <rbtcollins@hotmail.com>
[cygwin-apps/setup.git] / concat.cc
index 0f49c038a7c86cc7cfa844da7c6e2716c3c5eccf..e08df4eb19b7464854ffc9fd32ad0255ff3f039f 100644 (file)
--- a/concat.cc
+++ b/concat.cc
@@ -21,87 +21,11 @@ static const char *cvsid =
   "\n%%% $Id$\n";
 #endif
 
-
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 #include "concat.h"
 
-char *
-concat (const char *s, ...)
-{
-  va_list v;
-
-  va_start (v, s);
-
-  return vconcat (s, v);
-}
-
-char *
-vconcat (const char *s, va_list v)
-{
-  int len;
-  char *rv, *arg;
-  va_list save_v = v;
-  int unc;
-
-  if (!s)
-    return 0;
-
-  len = strlen (s);
-
-  unc = SLASH_P (*s) && SLASH_P (s[1]);
-
-  while (1)
-    {
-      arg = va_arg (v, char *);
-      if (arg == 0)
-       break;
-      len += strlen (arg);
-    }
-  va_end (v);
-
-  rv = (char *) malloc (len + 1);
-  strcpy (rv, s);
-  v = save_v;
-  while (1)
-    {
-      arg = va_arg (v, char *);
-      if (arg == 0)
-       break;
-      strcat (rv, arg);
-    }
-  va_end (v);
-
-  char *d, *p;
-  for (p = rv; *p; p++)
-    if (*p == '\\')
-      *p = '/';
-
-  /* concat is only used for urls and files, so we can safely
-     canonicalize the results */
-  for (p = d = rv; *p; p++)
-    {
-      *d++ = *p;
-      /* special case for URLs */
-      if (*p == ':' && p[1] == '/' && p[2] == '/' && p > rv + 1)
-       {
-         *d++ = *++p;
-         *d++ = *++p;
-       }
-      else if (*p == '/' || *p == '\\')
-       {
-         if (p == rv && unc)
-           p++;
-         while (p[1] == '/')
-           p++;
-       }
-    }
-  *d = 0;
-
-  return rv;
-}
-
 char *
 backslash (char *s)
 {
This page took 0.027705 seconds and 5 git commands to generate.