00001 /* $Header$ */ 00002 /* 00003 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands. 00004 * 00005 * This product is part of the Amsterdam Compiler Kit. 00006 * 00007 * Permission to use, sell, duplicate or disclose this software must be 00008 * obtained in writing. Requests for such permissions may be sent to 00009 * 00010 * Dr. Andrew S. Tanenbaum 00011 * Wiskundig Seminarium 00012 * Vrije Universiteit 00013 * Postbox 7161 00014 * 1007 MC Amsterdam 00015 * The Netherlands 00016 * 00017 */ 00018 00019 /* Author: J.W. Stevenson */ 00020 00021 #include <pc_file.h> 00022 00023 extern (*_sig())(); 00024 extern _catch(); 00025 #ifndef CPM 00026 extern int _isatty(); 00027 #endif 00028 00029 struct file **_extfl; 00030 int _extflc; /* number of external files */ 00031 char *_m_lb; /* LB of _m_a_i_n */ 00032 struct file *_curfil; /* points to file struct in case of errors */ 00033 int _pargc; 00034 char **_pargv; 00035 char ***_penviron; 00036 int _fp_hook = 1; /* This is for Minix, but does not harm others */ 00037 00038 _ini(args,c,p,mainlb) char *args,*mainlb; int c; struct file **p; { 00039 struct file *f; 00040 char buf[128]; 00041 00042 _pargc= *(int *)args; args += sizeof (int); 00043 _pargv= *(char ***)args; 00044 _sig(_catch); 00045 _extfl = p; 00046 _extflc = c; 00047 if( !c ) return; 00048 _m_lb = mainlb; 00049 if ( (f = _extfl[0]) != (struct file *) 0) { 00050 f->ptr = f->bufadr; 00051 f->flags = MAGIC|TXTBIT; 00052 f->fname = "INPUT"; 00053 f->ufd = 0; 00054 f->size = 1; 00055 f->count = 0; 00056 f->buflen = PC_BUFLEN; 00057 } 00058 if ( (f = _extfl[1]) != (struct file *) 0) { 00059 f->ptr = f->bufadr; 00060 f->flags = MAGIC|TXTBIT|WRBIT|EOFBIT|ELNBIT; 00061 f->fname = "OUTPUT"; 00062 f->ufd = 1; 00063 f->size = 1; 00064 #ifdef CPM 00065 f->count = 1; 00066 #else 00067 f->count = (_isatty(1) ? 1 : PC_BUFLEN); 00068 #endif 00069 f->buflen = f->count; 00070 } 00071 }
1.5.8