From: scottk AT rimu DOT ig DOT utexas DOT edu (Scott Kempf) Subject: patch for diropen() fixes access to root directory 2 Jan 1997 11:06:43 -0800 Sender: daemon AT cygnus DOT com Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <199701021633.KAA12009.cygnus.gnu-win32@rimu.ig.utexas.edu> Original-To: gnu-win32 AT cygnus DOT com Original-Sender: owner-gnu-win32 AT cygnus DOT com A number of programs have trouble with accessing "/". The problem seems to be due to opendir() changing "/" into "c:\/*". This patch fixes this and allows "ls /" to work correctly. This doesn't fix "ls //". Scott *** cdksrc/src/winsup/dirsearch.cc.orig Tue Dec 31 14:42:55 1996 --- cdksrc/src/winsup/dirsearch.cc Tue Dec 31 14:43:17 1996 *************** *** 22,27 **** --- 22,29 ---- #define _COMPILING_NEWLIB #include "dirent.h" + #define SLASH_P(C) ((C) == '/' || (C) == '\\') + extern "C" DIR * opendir (const char *dirname) *************** *** 70,76 **** strcpy (dir->__d_dirname, real_dirname.get_win32 ()); /* FindFirstFile doesn't seem to like duplicate /'s. */ len = strlen (dir->__d_dirname); ! if (len == 0 || dir->__d_dirname[len - 1] == '/') strcat (dir->__d_dirname, "*"); else strcat (dir->__d_dirname, "/*"); /**/ --- 72,78 ---- strcpy (dir->__d_dirname, real_dirname.get_win32 ()); /* FindFirstFile doesn't seem to like duplicate /'s. */ len = strlen (dir->__d_dirname); ! if (len == 0 || SLASH_P(dir->__d_dirname[len - 1])) strcat (dir->__d_dirname, "*"); else strcat (dir->__d_dirname, "/*"); /**/ ---------------------------------- Scott Kempf (scottk AT ig DOT utexas DOT edu) Running gnu-win32 beta 17.1 under Windows 95. - For help on using this list, send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".