www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/10/08/19:01:03

From: Eric Backus <ericb AT lsid DOT hp DOT com>
Subject: One more patch to /djgpp/libsrc/c/dos/dir.c
To: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp)
Date: Thu, 8 Oct 92 15:26:55 PDT
Mailer: Elm [revision: 66.25]

Here is one more patch to dir.c, to get it to correctly list the
contents of a path that has only a device name and no path (like
"b:").  This patch assumes you have applied my previous patch to
dir.c.
--
				Eric Backus
				ericb%hplsla AT hplabs DOT hp DOT com
				(206) 335-2495


*** dirc.ori	Sat Sep 26 11:39:24 1992
--- dir.c	Sat Sep 26 11:42:02 1992
***************
*** 7,14 ****
    int length;
    DIR *dir = (DIR *)malloc(sizeof(DIR));
    dir->num_read = 0;
!   dir->name = (char *)malloc(strlen(name)+5);
    strcpy(dir->name, name);
  
    /* Strip trailing slashes, so we can append "/*.*" */
    while (1)
--- 7,18 ----
    int length;
    DIR *dir = (DIR *)malloc(sizeof(DIR));
    dir->num_read = 0;
!   dir->name = (char *)malloc(strlen(name)+6);
    strcpy(dir->name, name);
+ 
+   /* Append a "." if we got only the device name */
+   if (dir->name[1] == ':' && strlen(dir->name) == 2)
+       strcat(dir->name, ".");
  
    /* Strip trailing slashes, so we can append "/*.*" */
    while (1)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019