[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/support dir.c,1.14,1.15
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/support dir.c,1.14,1.15 |
Date: |
Thu, 24 Apr 2003 02:00:45 -0400 |
Update of /cvsroot/dotgnu-pnet/pnet/support
In directory subversions:/tmp/cvs-serv5997/support
Modified Files:
dir.c
Log Message:
Fixes to various internalcalls.
Index: dir.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/dir.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** dir.c 18 Feb 2003 13:58:34 -0000 1.14
--- dir.c 24 Apr 2003 06:00:43 -0000 1.15
***************
*** 131,134 ****
--- 131,189 ----
#ifndef USE_WIN32_FIND
+ int ILGetFileType(const char *path)
+ {
+ struct stat st;
+ #ifdef HAVE_LSTAT
+ if(lstat(path, &st) >= 0)
+ #else
+ if(stat(path, &st) >= 0)
+ #endif
+ {
+ #ifdef S_ISFIFO
+ if(S_ISFIFO(st.st_mode))
+ {
+ return ILFileType_FIFO;
+ }
+ #endif
+ #ifdef S_ISCHR
+ if(S_ISCHR(st.st_mode))
+ {
+ return ILFileType_CHR;
+ }
+ #endif
+ #ifdef S_ISDIR
+ if(S_ISDIR(st.st_mode))
+ {
+ return ILFileType_DIR;
+ }
+ #endif
+ #ifdef S_ISBLK
+ if(S_ISBLK(st.st_mode))
+ {
+ return ILFileType_BLK;
+ }
+ #endif
+ #ifdef S_ISREG
+ if(S_ISREG(st.st_mode))
+ {
+ return ILFileType_REG;
+ }
+ #endif
+ #ifdef S_ISLNK
+ if(S_ISLNK(st.st_mode))
+ {
+ return ILFileType_LNK;
+ }
+ #endif
+ #ifdef S_ISSOCK
+ if(S_ISSOCK(st.st_mode))
+ {
+ return ILFileType_SOCK;
+ }
+ #endif
+ }
+ return ILFileType_Unknown;
+ }
+
#ifdef HAVE_DIRENT_H
***************
*** 158,162 ****
{
char *fullName;
- struct stat st;
entry->type = ILFileType_Unknown;
fullName = (char *)ILMalloc(strlen(dir->pathname) +
--- 213,216 ----
***************
*** 167,219 ****
strcat(fullName, "/");
strcat(fullName, entry->dptr->d_name);
! #ifdef HAVE_LSTAT
! if(lstat(fullName, &st) >= 0)
! #else
! if(stat(fullName, &st) >= 0)
! #endif
! {
! #ifdef S_ISFIFO
! if(S_ISFIFO(st.st_mode))
! {
! entry->type = ILFileType_FIFO;
! }
! #endif
! #ifdef S_ISCHR
! if(S_ISCHR(st.st_mode))
! {
! entry->type = ILFileType_CHR;
! }
! #endif
! #ifdef S_ISDIR
! if(S_ISDIR(st.st_mode))
! {
! entry->type = ILFileType_DIR;
! }
! #endif
! #ifdef S_ISBLK
! if(S_ISBLK(st.st_mode))
! {
! entry->type = ILFileType_BLK;
! }
! #endif
! #ifdef S_ISREG
! if(S_ISREG(st.st_mode))
! {
! entry->type = ILFileType_REG;
! }
! #endif
! #ifdef S_ISLNK
! if(S_ISLNK(st.st_mode))
! {
! entry->type = ILFileType_LNK;
! }
! #endif
! #ifdef S_ISSOCK
! if(S_ISSOCK(st.st_mode))
! {
! entry->type = ILFileType_SOCK;
! }
! #endif
! }
ILFree(fullName);
}
--- 221,225 ----
strcat(fullName, "/");
strcat(fullName, entry->dptr->d_name);
! entry->type = ILGetFileType(fullName);
ILFree(fullName);
}
***************
*** 342,345 ****
--- 348,374 ----
#else /* USE_WIN32_FIND */
+
+ int ILGetFileType(const char *path)
+ {
+ struct _finddata_t fileinfo;
+ long handle;
+ handle = _findfirst(path, &fileinfo);
+ if(handle >= 0)
+ {
+ _findclose(handle);
+ if((fileinfo.attrib & _A_SUBDIR) != 0)
+ {
+ return ILFileType_DIR;
+ }
+ else
+ {
+ return ILFileType_REG;
+ }
+ }
+ else
+ {
+ return ILFileType_Unknown;
+ }
+ }
/*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/support dir.c,1.14,1.15,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h,1.59,1.60 int_table.c,1.61,1.62 lib_file.c,1.8,1.9 lib_helpers.c,1.8,1.9 lib_object.c,1.10,1.11 lib_thread.c,1.9,1.10
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.2308,1.2309
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h,1.59,1.60 int_table.c,1.61,1.62 lib_file.c,1.8,1.9 lib_helpers.c,1.8,1.9 lib_object.c,1.10,1.11 lib_thread.c,1.9,1.10
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.2308,1.2309
- Index(es):