Mail Archives: djgpp/1992/10/08/19:01:03
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 -