00001 /* 00002 Copyright 2003 by Marc J. Rochkind. All rights reserved. 00003 May be copied only for purposes and under conditions described 00004 on the Web page www.basepath.com/aup/copyright.htm. 00005 00006 The Example Files are provided "as is," without any warranty; 00007 without even the implied warranty of merchantability or fitness 00008 for a particular purpose. The author and his publisher are not 00009 responsible for any damages, direct or incidental, resulting 00010 from the use or non-use of these Example Files. 00011 00012 The Example Files may contain defects, and some contain deliberate 00013 coding mistakes that were included for educational reasons. 00014 You are responsible for determining if and how the Example Files 00015 are to be used. 00016 00017 */ 00018 #ifndef _UXTERMINAL_HPP_ 00019 #define _UXTERMINAL_HPP_ 00020 00021 #include <termios.h> 00022 00023 namespace Ux { 00024 00025 /** 00026 \ingroup Ux 00027 */ 00028 class Termios : public termios, public Base { 00029 00030 public: 00031 speed_t cfgetispeed(void); 00032 speed_t cfgetospeed(void); 00033 void cfsetispeed(speed_t speed); 00034 void cfsetospeed(speed_t speed); 00035 }; 00036 00037 /** 00038 \ingroup Ux 00039 */ 00040 class Terminal : public File { 00041 00042 public: 00043 Terminal(int f = -1, const char *p = NULL, ssize_t s = -1) 00044 : File(f, p, s) 00045 { } 00046 Terminal(const char *p, ssize_t s = -1) 00047 : File(-1, p, s) 00048 { } 00049 bool isatty(void); 00050 static char * ctermid(char *buf = NULL); 00051 void tcdrain(void); 00052 void tcflow(int action); 00053 void tcflush(int queue); 00054 void tcgetattr(Termios& t); 00055 pid_t tcgetpgrp(void); 00056 pid_t tcgetsid(void); 00057 void tcsendbreak(int duration); 00058 void tcsetattr(int actions, const Termios& t); 00059 void tcsetpgrp(pid_t pgid); 00060 void ttyname(char *buf, size_t bufsize); 00061 }; 00062 00063 } // namespace 00064 00065 #endif // _UXTERMINAL_HPP_