00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2.1 of the GNU Lesser General Public License 00007 as published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with this program; if not, write the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 00023 USA. 00024 00025 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00026 Mountain View, CA 94043, or: 00027 00028 http://www.sgi.com 00029 00030 For further information regarding this notice, see: 00031 00032 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00033 00034 */ 00035 00036 00037 #pragma ident "@(#) libf/pxf/pxftcsendbreak.c 92.2 06/29/99 11:36:06" 00038 00039 /* 00040 * Line Control Functions: 00041 * 00042 * PXFTCSENDBREAK -- Transmit stream of zeros for a specific duration. 00043 * PXFTCDRAIN -- Wait until all output written to specified file has 00044 * been transmitted. 00045 * PXFTCFLUSH -- Discard data written but not sent, or received by not 00046 * read depending on the queue_selector. 00047 * PXFTCFLOW -- Suspend transmission or reception of data on the file 00048 * specified depending on the action specified. 00049 * (section 7.2.2 of Posix 1003.9-1992) 00050 * 00051 * Synopsis: 00052 * 00053 * SUBROUTINE PXFTCSENDBREAK(ifildes, iduration, ierror) 00054 * INTEGER ifildes, iduration, ierror 00055 * 00056 * SUBROUTINE PXFTCDRAIN(ifildes, ierror) 00057 * INTEGER ifildes, ierror 00058 * 00059 * SUBROUTINE PXFTCFLUSH(ifildes, iqueue, ierror) 00060 * INTEGER ifildes, iqueue, ierror 00061 * 00062 * SUBROUTINE PXFTCFLOW(ifildes, iaction, ierror) 00063 * INTEGER ifildes, iaction, ierror 00064 * 00065 * Description: 00066 * 00067 * PXFTCSENDBREAK, PXFTCDRAIN, PXFTCFLUSH, and PXFTCFLOW use c 00068 * functions tcsendbreak(), tcdrain(), tcflush(), and tcflow() to 00069 * provide terminal control. The constant values for iqueue and 00070 * iaction are available through the use of PXFCONST. 00071 * 00072 * The arguments are: 00073 * 00074 * ifildes - default integer input variable containing a file 00075 * descriptor. 00076 * iduration - default input integer variable specifying duration. 00077 * If duration = 0, zero-valued bits are transmitted 00078 * every 0.25 seconds and not more than 0.5 seconds. 00079 * Otherwise zero-valued bits are transmitted for an 00080 * implementation-defined period of time. 00081 * iqueue - default input integer variable containing the 00082 * queue selector. 00083 * iaction - default input integer variable containing the 00084 * action. 00085 * ierror - default integer output variable that contains zero 00086 * if the operation was successful or nonzero if the 00087 * operation was not successful. 00088 * 00089 * PXFTCSENDBREAK, PXFTCDRAIN, PXFTCFLUSH, and PXFTCFLOW may 00090 * return one of the following error values: 00091 * 00092 * EBADF If ifildes is not a valid file descriptor. 00093 * 00094 * EINTR If tcdrain was interrupted by a signal. 00095 * 00096 * EINVAL If iqueue or iaction is not a proper value. 00097 * 00098 * ENOTTY If the file associated with ifildes is not a terminal. 00099 * 00100 */ 00101 00102 #include <errno.h> 00103 #include <fortran.h> 00104 #include <liberrno.h> 00105 #include <stdlib.h> 00106 #include <string.h> 00107 #include <termios.h> 00108 #include <sys/errno.h> 00109 #include <sys/types.h> 00110 #include <unistd.h> 00111 00112 #ifdef _UNICOS 00113 void 00114 PXFTCSENDBREAK( 00115 #else /* _UNICOS */ 00116 void 00117 pxftcsendbreak_( 00118 #endif /* _UNICOS */ 00119 _f_int *ifildes, 00120 _f_int *iduration, 00121 _f_int *ierror) 00122 { 00123 int fildes; 00124 int durat; 00125 int stat; 00126 durat = *iduration; 00127 fildes = *ifildes; 00128 *ierror = 0; 00129 if (stat = tcsendbreak(fildes,durat) == -1) 00130 *ierror = errno; 00131 return; 00132 } 00133 00134 #ifdef _UNICOS 00135 void 00136 PXFTCDRAIN( 00137 #else /* _UNICOS */ 00138 void 00139 pxftcdrain_( 00140 #endif /* _UNICOS */ 00141 _f_int *ifildes, 00142 _f_int *ierror) 00143 { 00144 int fildes; 00145 int stat; 00146 fildes = *ifildes; 00147 *ierror = 0; 00148 if (stat = tcdrain(fildes) == -1) 00149 *ierror = errno; 00150 return; 00151 } 00152 00153 #ifdef _UNICOS 00154 void 00155 PXFTCFLUSH( 00156 #else /* _UNICOS */ 00157 void 00158 pxftcflush_( 00159 #endif /* _UNICOS */ 00160 _f_int *ifildes, 00161 _f_int *iqueue, 00162 _f_int *ierror) 00163 { 00164 int fildes; 00165 int queue; 00166 int stat; 00167 queue = *iqueue; 00168 fildes = *ifildes; 00169 *ierror = 0; 00170 if (stat = tcflush(fildes,queue) == -1) 00171 *ierror = errno; 00172 return; 00173 } 00174 00175 #ifdef _UNICOS 00176 void 00177 PXFTCFLOW( 00178 #else /* _UNICOS */ 00179 void 00180 pxftcflow_( 00181 #endif /* _UNICOS */ 00182 _f_int *ifildes, 00183 _f_int *iaction, 00184 _f_int *ierror) 00185 { 00186 int fildes; 00187 int action; 00188 int stat; 00189 action = *iaction; 00190 fildes = *ifildes; 00191 *ierror = 0; 00192 if (stat = tcflow(fildes,action) == -1) 00193 *ierror = errno; 00194 return; 00195 }
1.5.6