|
From: Hans-Bernhard B. <br...@us...> - 2002-07-11 14:23:49
|
Update of /cvsroot/cscope/cscope/src
In directory usw-pr-cvs1:/tmp/cvs-serv8314/src
Modified Files:
constants.h global.h mypopen.c
Log Message:
Fixes for DOS: access() bits, lstat()->stat(), BSD<->DOS setmode()
Index: constants.h
===================================================================
RCS file: /cvsroot/cscope/cscope/src/constants.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** constants.h 13 Aug 2001 15:31:22 -0000 1.11
--- constants.h 11 Jul 2002 14:23:45 -0000 1.12
***************
*** 77,82 ****
#define STMTMAX 10000 /* maximum source statement length */
! #define READ 4 /* access(2) parameter */
! #define WRITE 2 /* access(2) parameter */
/* screen lines */
#define FLDLINE (LINES - FIELDS - 1) /* first input field line */
--- 77,81 ----
#define STMTMAX 10000 /* maximum source statement length */
!
/* screen lines */
#define FLDLINE (LINES - FIELDS - 1) /* first input field line */
Index: global.h
===================================================================
RCS file: /cvsroot/cscope/cscope/src/global.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** global.h 4 Jan 2002 12:11:50 -0000 1.20
--- global.h 11 Jul 2002 14:23:45 -0000 1.21
***************
*** 125,128 ****
--- 125,158 ----
#endif
+ #undef SETMODE
+ #if O_BINARY || O_TEXT
+ /* OK, looks like we are on an MSDOS-ish platform ---> define SETMODE
+ * to actually do something */
+ # ifdef HAVE_SETMODE
+ # define SETMODE(fildes, mode) setmode(fildes,mode)
+ # else
+ # ifdef HAVE__SETMODE
+ # define SETMODE(fildes, mode) _setmode(fildes,mode)
+ # endif
+ # endif
+ #endif
+
+ /* access(2) parameters. Only make assumptions about their values if
+ * <unistd.h> fails to define them. */
+ #ifdef R_OK
+ # define READ R_OK
+ #else
+ # define READ 4
+ #endif
+ #ifdef W_OK
+ # define WRITE W_OK
+ #else
+ # define WRITE 2
+ #endif
+
+ /* This can happen on only vaguely Unix-ish platforms... */
+ #ifndef HAVE_LSTAT
+ # define lstat(file,buf) stat(file,buf)
+ #endif
typedef enum { /* boolean data type */
Index: mypopen.c
===================================================================
RCS file: /cvsroot/cscope/cscope/src/mypopen.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** mypopen.c 4 Jan 2002 12:11:50 -0000 1.8
--- mypopen.c 11 Jul 2002 14:23:45 -0000 1.9
***************
*** 43,50 ****
#define WTR 1
- #if !defined(HAVE_SETMODE) && defined(HAVE__SETMODE)
- # define setmode _setmode
- #endif
-
/* HBB 20010312: make this a bit safer --- don't blindly assume it's 1 */
#ifdef FD_CLOEXEC
--- 43,46 ----
***************
*** 108,116 ****
fp = fopen(path, mode);
! #if HAVE_SETMODE
if (! strchr(mode, 'b')) {
! setmode(fileno(fp), O_TEXT);
}
! #endif /* HAVE_SETMODE */
#ifdef __DJGPP__ /* FIXME: test feature, not platform */
--- 104,112 ----
fp = fopen(path, mode);
! #ifdef SETMODE
if (! strchr(mode, 'b')) {
! SETMODE(fileno(fp), O_TEXT);
}
! #endif /* SETMODE */
#ifdef __DJGPP__ /* FIXME: test feature, not platform */
|