diff lib/misc.c @ 245:41af60bc1f88

2003-8-4 Brian Masney <masneyb@gftp.org> * src/gtk/gftp-gtk.c (CreateMenus) - on startup, select the proper ASCII/binary radio button (looks like an old bug!) * lib/misc.c lib/gftp.h - renamed my version of g_build_path() (was used only in glib 1.2 only) to gftp_build_path() and it's compiled in all the time now * lib/protocols.c lib/sshv2.c src/gtk/dnd.c src/gtk/menu-items.c - instead of using g_build_path(), use gftp_build_path()
author masneyb
date Tue, 05 Aug 2003 01:40:49 +0000
parents afbbc72b73e2
children f41650dc896c
line wrap: on
line diff
--- a/lib/misc.c	Sun Aug 03 18:44:29 2003 +0000
+++ b/lib/misc.c	Tue Aug 05 01:40:49 2003 +0000
@@ -1192,10 +1192,8 @@
 }
 
 
-#if GLIB_MAJOR_VERSION == 1
-
 char *
-g_build_path (const char *separator, const char *first_element, ...)
+gftp_build_path (const char *first_element, ...) 
 {
   const char *element;
   size_t len, retlen;
@@ -1203,7 +1201,7 @@
   va_list args;
   char *ret;
 
-  g_return_val_if_fail (separator != NULL, NULL);
+  g_return_val_if_fail (first_element != NULL, NULL);
 
   ret = g_malloc0 (1);
   retlen = 0;
@@ -1215,7 +1213,7 @@
     {
       len = strlen (element);
 
-      if (len > 0 && element[len - 1] == *separator)
+      if (len > 0 && element[len - 1] == '/')
         add_separator = 0;
       else
         {
@@ -1225,17 +1223,16 @@
       
       retlen += len;
       ret = g_realloc (ret, retlen + 1);
-      strncat (ret, element, retlen);
 
       if (add_separator)
-        strncat (ret, separator, retlen);
+        strncat (ret, "/", retlen);
+
+      strncat (ret, element, retlen);
     }
 
   return (ret);
 }
 
-#endif
-
 
 off_t
 gftp_parse_file_size (char *str)