delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/11/29/17:36:00

From: corinna DOT vinschen AT cityweb DOT de (Corinna Vinschen)
Subject: B20 patch: ioctl modes for fhandler_console
29 Nov 1998 17:36:00 -0800 :
Message-ID: <3661F0E6.16171E0D.cygnus.cygwin32.developers@cityweb.de>
Mime-Version: 1.0
To: cygwin32-developers AT cygnus DOT com

Hi!

The class fhandler_console implements `tcgetattr()' and
`tcsetattr()' with modes TCSANOW, TCSADRAIN and TCSAFLUSH.

The corresponding ioctl calls TCGETA, TCSETA, TCSETAW and
TCSETAF are missing. Older sources use them instead of the
above functions.

The following patch adds the ioctl calls by calling the
corresponding tc[gs]etattr function.

Regards,
Corinna

ChangeLog
---------
Mon Nov 30  1:49:00 1998  Corinna Vinschen <corinna DOT vinschen AT cityweb DOT de>

        * fhandler_console.cc (fhandler_console::ioctl):
        Added ioctl commands TCGETA, TCSETA, TCSETAW, TCSETAF.

Index: fhandler_console.cc
===================================================================
RCS file: /src/cvsroot/winsup-981126/fhandler_console.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- fhandler_console.cc 1998/11/26 22:14:35     1.1
+++ fhandler_console.cc 1998/11/30 00:48:52     1.2
@@ -215,8 +215,9 @@ fhandler_console::dup (fhandler_base *ch
 int
 fhandler_console::ioctl (unsigned int cmd, void *buf)
 {
-  if (cmd == TIOCGWINSZ)
+  switch (cmd)
     {
+      case TIOCGWINSZ:
        int st;

        st = fillin_info ();
@@ -238,9 +239,17 @@ fhandler_console::ioctl (unsigned int cm
            return -1;
          }
        return 0;
-      }
-    else if (cmd == TIOCSWINSZ)
-      return 0;
+      case TIOCSWINSZ:
+        return 0;
+      case TCGETA:
+        return tcgetattr ((struct termios *) buf);
+      case TCSETA:
+        return tcsetattr (TCSANOW, (struct termios *) buf);
+      case TCSETAW:
+        return tcsetattr (TCSADRAIN, (struct termios *) buf);
+      case TCSETAF:
+        return tcsetattr (TCSAFLUSH, (struct termios *) buf);
+    }

   return fhandler_base::ioctl (cmd, buf);
 }

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019