Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #pragma ident "@(#) libf/fio/isatty.c 92.1 06/21/99 10:37:55"
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 #include <stdio.h>
00069 #include <foreign.h>
00070 #include <errno.h>
00071 #include <liberrno.h>
00072 #include <sys/types.h>
00073 #include <sys/stat.h>
00074 #include "fio.h"
00075
00076 extern _f_int __isatty_f90 (_f_int *u);
00077 extern _f_int isattyf90_(_f_int *u);
00078 extern _f_int8 isattyf90_8_(_f_int8 *u);
00079
00080 _f_int
00081 __isatty_f90 (_f_int *u)
00082 {
00083 return isattyf90_(u);
00084 }
00085
00086 _f_int
00087 isattyf90_(_f_int *u)
00088 {
00089 int rtrn, errval;
00090 unum_t unum;
00091 unit *cup;
00092 struct fiostate cfs;
00093
00094 unum = *u;
00095 STMT_BEGIN(unum, 0, T_INQU, NULL, &cfs, cup);
00096
00097 errval = 0;
00098 if (cup == NULL && !GOOD_UNUM(unum))
00099 _ferr(&cfs, FEIVUNIT, unum);
00100
00101 if (cup == NULL)
00102 errval = FEIVUNIT;
00103 else if (cup->usysfd == -1)
00104 errval = FEIVUNIT;
00105 else {
00106 rtrn = isatty(cup->usysfd);
00107 }
00108
00109 STMT_END(cup, T_INQU, NULL, &cfs);
00110
00111 if (errval!=0)
00112 errno = errval;
00113 return (_btol(rtrn));
00114 }
00115
00116 _f_int8
00117 isattyf90_8_(_f_int8 *u)
00118 {
00119 int rtrn, errval;
00120 unum_t unum;
00121 unit *cup;
00122 struct fiostate cfs;
00123
00124 unum = *u;
00125 STMT_BEGIN(unum, 0, T_INQU, NULL, &cfs, cup);
00126
00127 errval = 0;
00128 if (cup == NULL && !GOOD_UNUM(unum))
00129 _ferr(&cfs, FEIVUNIT, unum);
00130
00131 if (cup == NULL)
00132 errval = FEIVUNIT;
00133 else if (cup->usysfd == -1)
00134 errval = FEIVUNIT;
00135 else {
00136 rtrn = isatty(cup->usysfd);
00137 }
00138
00139 STMT_END(cup, T_INQU, NULL, &cfs);
00140
00141 if (errval!=0)
00142 errno = errval;
00143 return (_btol(rtrn));
00144 }