Mail Archives: djgpp-workers/2002/12/10/13:07:32
Hello.
Below is a patch to use the #define'd constants rather
than hard-coding constants.
OK to commit?
Bye, Rich =]
Index: include/libc/getdinfo.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/libc/getdinfo.h,v
retrieving revision 1.2
diff -p -c -3 -r1.2 getdinfo.h
*** include/libc/getdinfo.h 17 Oct 2002 23:00:24 -0000 1.2
--- include/libc/getdinfo.h 10 Dec 2002 18:03:23 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_libc_getdinfo_h__
***************
*** 18,23 ****
--- 19,25 ----
#define _DEV_CDEV 0x0080
#define _DEV_NO_INHERIT 0x1000 /* Undocumented. */
#define _DEV_IOCTRL 0x4000
+ #define _DEV_REMOTE 0x8000
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
Index: src/libc/dos/io/setmode.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/setmode.c,v
retrieving revision 1.6
diff -p -c -3 -r1.6 setmode.c
*** src/libc/dos/io/setmode.c 16 Jan 2000 08:10:05 -0000 1.6
--- src/libc/dos/io/setmode.c 10 Dec 2002 18:03:24 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
***************
*** 11,16 ****
--- 12,18 ----
#include <libc/dosio.h>
#include <libc/ttyprvt.h>
+ #include <libc/getdinfo.h>
void (*__setmode_stdio_hook)(int fd, int mode); /* BSS to zero */
*************** setmode(int handle, int mode)
*** 25,35 ****
return -1;
if (mode & O_BINARY)
! newmode |= 0x20;
else
! newmode &= ~0x20;
! if (oldmode & 0x80) /* Only for character dev */
{
regs.x.ax = 0x4401;
regs.x.bx = handle;
--- 27,37 ----
return -1;
if (mode & O_BINARY)
! newmode |= _DEV_RAW;
else
! newmode &= ~_DEV_RAW;
! if (oldmode & _DEV_CDEV) /* Only for character dev */
{
regs.x.ax = 0x4401;
regs.x.bx = handle;
Index: src/libc/posix/sys/stat/fstat.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/fstat.c,v
retrieving revision 1.9
diff -p -c -3 -r1.9 fstat.c
*** src/libc/posix/sys/stat/fstat.c 14 Jun 2002 14:26:04 -0000 1.9
--- src/libc/posix/sys/stat/fstat.c 10 Dec 2002 18:03:33 -0000
***************
*** 110,115 ****
--- 110,116 ----
#include <sys/stat.h>
#include <limits.h>
#include <libc/fd_props.h>
+ #include <libc/getdinfo.h>
#include <dpmi.h>
#include <go32.h>
*************** fstat_assist(int fhandle, struct stat *s
*** 410,416 ****
else
have_trusted_values = 0;
! if (dev_info & 0x0080)
{
is_dev = 1;
is_remote = 0; /* device can't be remote */
--- 411,417 ----
else
have_trusted_values = 0;
! if (dev_info & _DEV_CDEV)
{
is_dev = 1;
is_remote = 0; /* device can't be remote */
*************** fstat_assist(int fhandle, struct stat *s
*** 418,424 ****
else
{
is_dev = 0;
! if (dev_info & 0x8000)
is_remote = 1;
else
is_remote = 0;
--- 419,425 ----
else
{
is_dev = 0;
! if (dev_info & _DEV_REMOTE)
is_remote = 1;
else
is_remote = 0;
*************** fstat_assist(int fhandle, struct stat *s
*** 769,784 ****
* We will also pretend devices belong to a special drive
* named `@'.
*/
! if (dev_info & 0xf)
{
char dev_name[16];
strcpy(dev_name, "@:\\dev\\");
! if (dev_info & 3) /* either STDIN or STDOUT */
strcat(dev_name, "CON ");
! else if (dev_info & 4) /* NULL device */
strcat(dev_name, "NUL ");
! else if (dev_info & 8) /* CLOCK device */
strcat(dev_name, "CLOCK$ ");
stat_buf->st_ino = _invent_inode(dev_name, 0, 0);
--- 770,785 ----
* We will also pretend devices belong to a special drive
* named `@'.
*/
! if (dev_info & (_DEV_STDIN|_DEV_STDOUT|_DEV_NUL|_DEV_CLOCK))
{
char dev_name[16];
strcpy(dev_name, "@:\\dev\\");
! if (dev_info & (_DEV_STDIN|_DEV_STDOUT))
strcat(dev_name, "CON ");
! else if (dev_info & _DEV_NUL)
strcat(dev_name, "NUL ");
! else if (dev_info & _DEV_CLOCK)
strcat(dev_name, "CLOCK$ ");
stat_buf->st_ino = _invent_inode(dev_name, 0, 0);
- Raw text -