Re: < ftp-problem with windows-nt ftpserver >

From: Edward Moy <moy@dont-contact.us>
Date: Thu, 1 Aug 1996 15:32:03 PDT

I made some further improvements...

----------- cut ---------------- cut ---------------- cut ------------
*** ftpget.c.orig Wed Jul 24 10:02:42 1996
--- ftpget.c Thu Aug 1 15:17:35 1996
***************
*** 1818,1835 ****
  
      /* try it as a DOS listing */
      if (n_tokens > 3 && p->name == NULL &&
! !sscanf(tokens[0], "%[-0-9]", sbuf) && /* 04-05-70 */
! !sscanf(tokens[1], "%[0-9:apm]", sbuf)) { /* 09:33pm */
          if (!strcasecmp(tokens[2], "<dir>")) {
              p->type = 'd';
! sprintf(sbuf, "%s %s", tokens[0], tokens[1]);
! p->date = xstrdup(sbuf);
! p->name = xstrdup(tokens[3]);
          }
- p->type = '-';
          sprintf(sbuf, "%s %s", tokens[0], tokens[1]);
          p->date = xstrdup(sbuf);
- p->size = atoi(tokens[2]);
          p->name = xstrdup(tokens[3]);
      }
      for (i = 0; i < n_tokens; i++)
--- 1818,1835 ----
  
      /* try it as a DOS listing */
      if (n_tokens > 3 && p->name == NULL &&
! sscanf(tokens[0], "%[0-9]-%[0-9]-%[0-9]", sbuf, sbuf, sbuf)
! == 3 && /* 04-05-70 */
! sscanf(tokens[1], "%[0-9]:%[0-9]%[AaPp]%[Mm]", sbuf, sbuf, sbuf, sbuf)
! == 4) { /* 09:33PM */
          if (!strcasecmp(tokens[2], "<dir>")) {
              p->type = 'd';
! } else {
! p->type = '-';
! p->size = atoi(tokens[2]);
          }
          sprintf(sbuf, "%s %s", tokens[0], tokens[1]);
          p->date = xstrdup(sbuf);
          p->name = xstrdup(tokens[3]);
      }
      for (i = 0; i < n_tokens; i++)
----------- cut ---------------- cut ---------------- cut ------------

First, I improved the test for the date and time string. But secondly,
it seemed that even if <dir> was detected, it would be overriden later,
because of a missing "else".

Which these patches, the correct directory icons appears.

------------------------------------------------------------------------
Edward Moy
Xerox Palo Alto Research Center
3333 Coyote Hill Rd.
Palo Alto, CA 94304

Email: moy@parc.xerox.com
WWW: http://www.parc.xerox.com/moy/
PGP key fingerprint: AA A1 12 00 9B 13 07 45 19 61 26 A1 AF AF 99 F3
Received on Thu Aug 01 1996 - 15:35:54 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:32:45 MST