From: "Mark E." To: djgpp-workers AT delorie DOT com Date: Sun, 11 Jun 2000 16:22:40 -0400 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: patch for _get_dev_info return bits Message-ID: <3943BCD0.22771.2CF8D0@localhost> X-mailer: Pegasus Mail for Win32 (v3.12c) Reply-To: djgpp-workers AT delorie DOT com Hello, Several of the termios implementation files define _DEV_* macros to parse the dev info word returned by _get_dev_info. This patch deletes all these macros and defines them in just one place in where the prototype for _get_dev_info is located. I noticed the large number of duplicates while working on the enhanced fcntl. Also, should the _DEV_* macros be documented and extended to cover all the bits? Index: djgpp/include/io.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/io.h,v retrieving revision 1.3 diff -c -3 -r1.3 io.h *** io.h 1998/06/28 22:42:16 1.3 --- io.h 2000/06/11 17:20:59 *************** *** 1,3 **** --- 1,4 ---- + /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #ifndef __dj_include_io_h_ *************** *** 14,19 **** --- 15,30 ---- #ifndef _POSIX_SOURCE #include + + /* For parsing the dev info word returned by _get_dev_info. */ + #define _DEV_STDIN 0x0001 + #define _DEV_STDOUT 0x0002 + #define _DEV_NUL 0x0004 + #define _DEV_CLOCK 0x0008 + #define _DEV_RAW 0x0020 + #define _DEV_CDEV 0x0080 + #define _DEV_NO_INHERIT 0x1000 /* Undocumented. */ + #define _DEV_IOCTRL 0x4000 int chsize(int handle, long size); int _close(int _fd); Index: djgpp/src/libc/posix/termios/tcdrain.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/termios/tcdrain.c,v retrieving revision 1.2 diff -c -3 -r1.2 tcdrain.c *** tcdrain.c 1996/09/15 17:02:22 1.2 --- tcdrain.c 2000/06/11 17:18:28 *************** *** 1,17 **** /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ #include #include #include #include #include - - #define _DEV_STDIN 0x0001 - #define _DEV_STDOUT 0x0002 - #define _DEV_NUL 0x0004 - #define _DEV_CLOCK 0x0008 - #define _DEV_RAW 0x0020 - #define _DEV_CDEV 0x0080 - #define _DEV_IOCTRL 0x4000 int tcdrain (int handle) --- 1,10 ---- + /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ #include #include #include #include #include int tcdrain (int handle) Index: djgpp/src/libc/posix/termios/tcflow.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/termios/tcflow.c,v retrieving revision 1.2 diff -c -3 -r1.2 tcflow.c *** tcflow.c 1996/09/15 17:02:22 1.2 --- tcflow.c 2000/06/11 17:18:40 *************** *** 1,3 **** --- 1,4 ---- + /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ #include #include *************** *** 6,19 **** #include #include #include - - #define _DEV_STDIN 0x0001 - #define _DEV_STDOUT 0x0002 - #define _DEV_NUL 0x0004 - #define _DEV_CLOCK 0x0008 - #define _DEV_RAW 0x0020 - #define _DEV_CDEV 0x0080 - #define _DEV_IOCTRL 0x4000 int tcflow (int handle, int action) --- 7,12 ---- Index: djgpp/src/libc/posix/termios/tcflush.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/termios/tcflush.c,v retrieving revision 1.4 diff -c -3 -r1.4 tcflush.c *** tcflush.c 1999/06/03 17:27:40 1.4 --- tcflush.c 2000/06/11 17:18:48 *************** *** 1,3 **** --- 1,4 ---- + /* 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 */ #include *************** *** 8,21 **** #include #include #include - - #define _DEV_STDIN 0x0001 - #define _DEV_STDOUT 0x0002 - #define _DEV_NUL 0x0004 - #define _DEV_CLOCK 0x0008 - #define _DEV_RAW 0x0020 - #define _DEV_CDEV 0x0080 - #define _DEV_IOCTRL 0x4000 static int getkey_nowait (void) --- 9,14 ---- Index: djgpp/src/libc/posix/termios/tcgetatr.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/termios/tcgetatr.c,v retrieving revision 1.2 diff -c -3 -r1.2 tcgetatr.c *** tcgetatr.c 1996/09/15 17:02:22 1.2 --- tcgetatr.c 2000/06/11 17:18:56 *************** *** 1,3 **** --- 1,4 ---- + /* Copyrifht (C) 2000 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ #include #include *************** *** 5,18 **** #include #include #include - - #define _DEV_STDIN 0x0001 - #define _DEV_STDOUT 0x0002 - #define _DEV_NUL 0x0004 - #define _DEV_CLOCK 0x0008 - #define _DEV_RAW 0x0020 - #define _DEV_CDEV 0x0080 - #define _DEV_IOCTRL 0x4000 int tcgetattr (int handle, struct termios *termiosp) --- 6,11 ---- Index: djgpp/src/libc/posix/termios/tcsetatr.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/termios/tcsetatr.c,v retrieving revision 1.4 diff -c -3 -r1.4 tcsetatr.c *** tcsetatr.c 1999/06/03 17:27:40 1.4 --- tcsetatr.c 2000/06/11 17:19:02 *************** *** 1,3 **** --- 1,4 ---- + /* 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 */ #include *************** *** 7,20 **** #include #include #include - - #define _DEV_STDIN 0x0001 - #define _DEV_STDOUT 0x0002 - #define _DEV_NUL 0x0004 - #define _DEV_CLOCK 0x0008 - #define _DEV_RAW 0x0020 - #define _DEV_CDEV 0x0080 - #define _DEV_IOCTRL 0x4000 int tcsetattr (int handle, int action, const struct termios *termiosp) --- 8,13 ---- Index: djgpp/src/libc/posix/termios/tcsndbrk.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/termios/tcsndbrk.c,v retrieving revision 1.2 diff -c -3 -r1.2 tcsndbrk.c *** tcsndbrk.c 1996/09/15 17:02:22 1.2 --- tcsndbrk.c 2000/06/11 17:19:10 *************** *** 1,3 **** --- 1,4 ---- + /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ #include #include *************** *** 5,18 **** #include #include #include - - #define _DEV_STDIN 0x0001 - #define _DEV_STDOUT 0x0002 - #define _DEV_NUL 0x0004 - #define _DEV_CLOCK 0x0008 - #define _DEV_RAW 0x0020 - #define _DEV_CDEV 0x0080 - #define _DEV_IOCTRL 0x4000 int tcsendbreak (int handle, int duration) --- 6,11 ---- Index: djgpp/src/libc/posix/termios/tminit.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/termios/tminit.c,v retrieving revision 1.7 diff -c -3 -r1.7 tminit.c *** tminit.c 1999/06/03 17:27:40 1.7 --- tminit.c 2000/06/11 17:19:31 *************** *** 1,3 **** --- 1,4 ---- + /* 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 */ /* *************** *** 24,36 **** #include #include - #define _DEV_STDIN 0x0001 - #define _DEV_STDOUT 0x0002 - #define _DEV_NUL 0x0004 - #define _DEV_CLOCK 0x0008 - #define _DEV_RAW 0x0020 - #define _DEV_CDEV 0x0080 - #define _DEV_IOCTRL 0x4000 #define CPMEOF 0x1a /* Ctrl+Z */ --- 25,30 ----