#include "sysdep1.h"#include "f2c.h"#include "stdlib.h"#include "fio.h"#include "fmt.h"Include dependency graph for err.c:

Go to the source code of this file.
Defines | |
| #define | MAXERR (sizeof(F_err)/sizeof(char *)+100) |
Functions | |
| int(*)(*) | f__donewrec (void) |
| int | f__canseek (FILE *f) |
| void | f__fatal (int n, char *s) |
| VOID | f_init (Void) |
| int | f__nowreading (unit *x) |
| int | f__nowwriting (unit *x) |
| int | err__fl (int f, int m, char *s) |
Variables | |
| unit | f__units [MXUNIT] |
| flag | f__init |
| cilist * | f__elist |
| icilist * | f__svic |
| flag | f__reading |
| flag | f__cplus |
| flag | f__cblank |
| char * | f__fmtbuf |
| flag | f__external |
| int(*) | f__getn (void) |
| void(*) | f__putn (int) |
| int(* | f__doed )(struct syl *, char *, ftnlen) |
| int(*)(*) | f__doned (struct syl *) |
| int(* | f__dorevert )(void) |
| int(*)(*)(*) | f__doend (void) |
| flag | f__sequential |
| flag | f__formatted |
| FILE * | f__cf |
| unit * | f__curunit |
| int | f__recpos |
| OFF_T | f__cursor |
| OFF_T | f__hiwater |
| int | f__scale |
| char * | f__icptr |
| char * | F_err [] |
| #define MAXERR (sizeof(F_err)/sizeof(char *)+100) |
Definition at line 278 of file err.c.
References errno, f__doend, and f__fatal().
Referenced by Lfinish().
00280 { 00281 if (!f) 00282 f__fatal(m, s); 00283 if (f__doend) 00284 (*f__doend)(); 00285 return errno = m; 00286 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int f__canseek | ( | FILE * | f | ) |
Definition at line 91 of file err.c.
References FSTAT, isatty(), STAT_ST, and work.
Referenced by f_init(), and f_open().
00093 { 00094 #ifdef NON_UNIX_STDIO 00095 #ifdef _MSC_VER 00096 #define fileno _fileno 00097 #define isatty _isatty 00098 #endif 00099 return !isatty(fileno(f)); 00100 #else 00101 struct STAT_ST x; 00102 00103 if (FSTAT(fileno(f),&x) < 0) 00104 return(0); 00105 #ifdef S_IFMT 00106 switch(x.st_mode & S_IFMT) { 00107 case S_IFDIR: 00108 case S_IFREG: 00109 if(x.st_nlink > 0) /* !pipe */ 00110 return(1); 00111 else 00112 return(0); 00113 case S_IFCHR: 00114 if(isatty(fileno(f))) 00115 return(0); 00116 return(1); 00117 #ifdef S_IFBLK 00118 case S_IFBLK: 00119 return(1); 00120 #endif 00121 } 00122 #else 00123 #ifdef S_ISDIR 00124 /* POSIX version */ 00125 if (S_ISREG(x.st_mode) || S_ISDIR(x.st_mode)) { 00126 if(x.st_nlink > 0) /* !pipe */ 00127 return(1); 00128 else 00129 return(0); 00130 } 00131 if (S_ISCHR(x.st_mode)) { 00132 if(isatty(fileno(f))) 00133 return(0); 00134 return(1); 00135 } 00136 if (S_ISBLK(x.st_mode)) 00137 return(1); 00138 #else 00139 Help! How does fstat work on this system? 00140 #endif 00141 #endif 00142 return(0); /* who knows what it is? */ 00143 #endif 00144 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int(*)(*) f__donewrec | ( | void | ) |
| void f__fatal | ( | int | n, | |
| char * | s | |||
| ) |
Definition at line 150 of file err.c.
References f__curunit, f__units, MAXERR, sig_die(), and unit::ufnm.
Referenced by err__fl(), f__bufadj(), l_write(), opn_err(), and unit_chk().
00152 { 00153 if(n<100 && n>=0) perror(s); /*SYSDEP*/ 00154 else if(n >= (int)MAXERR || n < -1) 00155 { fprintf(stderr,"%s: illegal error number %d\n",s,n); 00156 } 00157 else if(n == -1) fprintf(stderr,"%s: end of file\n",s); 00158 else 00159 fprintf(stderr,"%s: %s\n",s,F_err[n-100]); 00160 if (f__curunit) { 00161 fprintf(stderr,"apparent state: unit %d ", 00162 (int)(f__curunit-f__units)); 00163 fprintf(stderr, f__curunit->ufnm ? "named %s\n" : "(unnamed)\n", 00164 f__curunit->ufnm); 00165 } 00166 else 00167 fprintf(stderr,"apparent state: internal I/O\n"); 00168 if (f__fmtbuf) 00169 fprintf(stderr,"last format: %s\n",f__fmtbuf); 00170 fprintf(stderr,"lately %s %s %s %s",f__reading?"reading":"writing", 00171 f__sequential?"sequential":"direct",f__formatted?"formatted":"unformatted", 00172 f__external?"external":"internal"); 00173 sig_die(" IO", 1); 00174 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 202 of file err.c.
References done, errno, f__r_mode, f__w_mode, FREOPEN, FSEEK, FTELL, OFF_T, SEEK_SET, unit::ufd, unit::ufmt, unit::ufnm, unit::url, unit::urw, and unit::uwrt.
Referenced by f_back(), s_rdfe(), s_rdue(), s_rsfe(), s_rsle(), s_rsne(), and s_rsue().
00204 { 00205 OFF_T loc; 00206 int ufmt, urw; 00207 extern char *f__r_mode[], *f__w_mode[]; 00208 00209 if (x->urw & 1) 00210 goto done; 00211 if (!x->ufnm) 00212 goto cantread; 00213 ufmt = x->url ? 0 : x->ufmt; 00214 loc = FTELL(x->ufd); 00215 urw = 3; 00216 if (!FREOPEN(x->ufnm, f__w_mode[ufmt|2], x->ufd)) { 00217 urw = 1; 00218 if(!FREOPEN(x->ufnm, f__r_mode[ufmt], x->ufd)) { 00219 cantread: 00220 errno = 126; 00221 return 1; 00222 } 00223 } 00224 FSEEK(x->ufd,loc,SEEK_SET); 00225 x->urw = urw; 00226 done: 00227 x->uwrt = 0; 00228 return 0; 00229 }
Here is the caller graph for this function:

Definition at line 235 of file err.c.
References done, errno, f__w_mode, FREOPEN, FSEEK, FTELL, NULL, OFF_T, SEEK_CUR, SEEK_SET, unit::ufd, unit::ufmt, unit::ufnm, unit::url, unit::urw, and unit::uwrt.
Referenced by s_wdfe(), s_wdue(), s_wsfe(), s_wsle(), s_wsne(), and s_wsue().
00237 { 00238 OFF_T loc; 00239 int ufmt; 00240 extern char *f__w_mode[]; 00241 00242 if (x->urw & 2) { 00243 if (x->urw & 1) 00244 FSEEK(x->ufd, (OFF_T)0, SEEK_CUR); 00245 goto done; 00246 } 00247 if (!x->ufnm) 00248 goto cantwrite; 00249 ufmt = x->url ? 0 : x->ufmt; 00250 if (x->uwrt == 3) { /* just did write, rewind */ 00251 if (!(f__cf = x->ufd = 00252 FREOPEN(x->ufnm,f__w_mode[ufmt],x->ufd))) 00253 goto cantwrite; 00254 x->urw = 2; 00255 } 00256 else { 00257 loc=FTELL(x->ufd); 00258 if (!(f__cf = x->ufd = 00259 FREOPEN(x->ufnm, f__w_mode[ufmt | 2], x->ufd))) 00260 { 00261 x->ufd = NULL; 00262 cantwrite: 00263 errno = 127; 00264 return(1); 00265 } 00266 x->urw = 3; 00267 FSEEK(x->ufd,loc,SEEK_SET); 00268 } 00269 done: 00270 x->uwrt = 1; 00271 return 0; 00272 }
Here is the caller graph for this function:

| VOID f_init | ( | Void | ) |
Definition at line 177 of file err.c.
References f__canseek(), f__units, and p.
Referenced by c_due(), c_le(), f_open(), main(), nl_init(), s_rdfe(), s_rsfe(), s_rsue(), s_wdfe(), s_wsfe(), and s_wsue().
00178 { unit *p; 00179 00180 f__init=1; 00181 p= &f__units[0]; 00182 p->ufd=stderr; 00183 p->useek=f__canseek(stderr); 00184 p->ufmt=1; 00185 p->uwrt=1; 00186 p = &f__units[5]; 00187 p->ufd=stdin; 00188 p->useek=f__canseek(stdin); 00189 p->ufmt=1; 00190 p->uwrt=0; 00191 p= &f__units[6]; 00192 p->ufd=stdout; 00193 p->useek=f__canseek(stdout); 00194 p->ufmt=1; 00195 p->uwrt=1; 00196 }
Here is the call graph for this function:

Here is the caller graph for this function:

| FILE* f__cf |
Definition at line 42 of file err.c.
Referenced by c_dfe(), c_due(), c_lir(), c_liw(), c_si(), c_sue(), do_ud(), do_us(), e_rdue(), e_rsue(), e_wdue(), e_wsfe(), e_wsle(), e_wsue(), f__putbuf(), getname(), print_ne(), rd_ed(), s_rsfe(), s_rsue(), s_wsfe(), s_wsue(), t_runc(), x_getc(), x_rsne(), xrd_SL(), xw_end(), y_getc(), and y_rsk().
| OFF_T f__cursor |
Definition at line 43 of file err.c.
Referenced by c_dfe(), c_due(), c_le(), c_lir(), c_liw(), c_sfe(), c_si(), c_sue(), do_ud(), e_rdue(), e_rsle(), f__fatal(), f_back(), f_open(), opn_err(), print_ne(), rd_ed(), s_rdfe(), s_rdue(), s_rsfe(), s_rsle(), s_rsne(), s_rsue(), s_wdfe(), s_wdue(), s_wsfe(), s_wsle(), s_wsne(), s_wsue(), t_getc(), x_endp(), x_getc(), xrd_SL(), y_getc(), y_rev(), and y_rsk().
| int(* f__dorevert)(void) |
Definition at line 23 of file err.c.
Referenced by ap_end(), c_dfe(), c_due(), c_le(), c_lir(), c_liw(), c_si(), c_sue(), do_fio(), do_ud(), do_us(), e_rdue(), e_wdue(), e_wsfe(), e_wsle(), e_wsue(), getname(), l_C(), l_CHAR(), l_L(), l_R(), l_read(), Lfinish(), mv_cur(), print_ne(), rd_ed(), s_rsfe(), s_rsle(), s_wsfe(), x_rsne(), y_err(), and y_getc().
| char* f__fmtbuf |
| OFF_T f__hiwater |
Definition at line 44 of file err.c.
Referenced by c_dfe(), c_due(), c_le(), c_liw(), c_si(), do_ud(), do_us(), donewrec(), e_rdue(), e_rsue(), e_wsfi(), e_wsle(), f__putbuf(), iw_rev(), lwrt_A(), lwrt_C(), lwrt_F(), lwrt_I(), lwrt_L(), mv_cur(), print_ne(), rd_ed(), rd_ned(), s_rsfe(), s_rsue(), s_wsfe(), w_ned(), x_getc(), x_putc(), x_wSL(), x_wsne(), xrd_SL(), xw_end(), xw_rev(), y_getc(), y_rev(), y_rsk(), z_getc(), z_putc(), z_rnew(), and z_wnew().
1.5.1