diff lib/protocols.c @ 39:474d562c7268

2002-10-15 Brian Masney <masneyb@gftp.org> * lib/config_file.c - enable combo in GTK port for Proxy server type * lib/misc.c (gftp_sort_filelist) - make sure prev pointer to first entry is NULL * lib/protocols.c (copy_token) - when setting the end position of the token to \0, after we're done set it back to the origional position * src/gtk/gftp-gtk.c, src/gtk/menu-items.c - changed g_list_first (list) to just list
author masneyb
date Wed, 16 Oct 2002 02:11:09 +0000
parents c8ec7877432e
children 66c064fd05bc
line wrap: on
line diff
--- a/lib/protocols.c	Wed Oct 16 01:18:34 2002 +0000
+++ b/lib/protocols.c	Wed Oct 16 02:11:09 2002 +0000
@@ -1234,6 +1234,7 @@
       startpos = goto_next_token (startpos);
     }
 
+  /* FIXME - this is a bug if there is some extra spaces in the file */
   /* See if this is a Cray directory listing. It has the following format:
      drwx------     2 feiliu    g913     DK  common      4096 Sep 24  2001 wv */
   if (cols == 11 && strstr (str, "->") == NULL)
@@ -1367,16 +1368,19 @@
 copy_token (char **dest, char *source)
 {
   /* This function is used internally by gftp_parse_ls () */
-  char *endpos;
+  char *endpos, savepos;
 
   endpos = source;
   while (*endpos != ' ' && *endpos != '\t' && *endpos != '\0')
     endpos++;
   if (*endpos == '\0')
     return (NULL);
+
+  savepos = *endpos;
   *endpos = '\0';
   *dest = g_malloc (endpos - source + 1);
   strcpy (*dest, source);
+  *endpos = savepos;
 
   /* Skip the blanks till we get to the next entry */
   source = endpos + 1;
@@ -1391,10 +1395,13 @@
 {
   while (*pos != ' ' && *pos != '\t' && *pos != '\0')
     pos++;
+
   if (pos == '\0')
     return (pos);
+
   while ((*pos == ' ' || *pos == '\t') && *pos != '\0')
     pos++;
+
   return (pos);
 }