. service tells you which device it couldn't stat
[minix3.git] / lib / ack / libp / ini.c
blob149bbe444b14c02d64a119685388246e1258d834
1 /* $Header$ */
2 /*
3 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
5 * This product is part of the Amsterdam Compiler Kit.
7 * Permission to use, sell, duplicate or disclose this software must be
8 * obtained in writing. Requests for such permissions may be sent to
10 * Dr. Andrew S. Tanenbaum
11 * Wiskundig Seminarium
12 * Vrije Universiteit
13 * Postbox 7161
14 * 1007 MC Amsterdam
15 * The Netherlands
19 /* Author: J.W. Stevenson */
21 #include <pc_file.h>
22 #include <pc_err.h>
24 extern (*_sig())();
25 extern _catch();
26 #ifndef CPM
27 extern int _isatty();
28 #endif
30 struct file **_extfl;
31 int _extflc; /* number of external files */
32 char *_m_lb; /* LB of _m_a_i_n */
33 struct file *_curfil; /* points to file struct in case of errors */
34 int _pargc;
35 char **_pargv;
36 char ***_penviron;
37 int _fp_hook = 1; /* This is for Minix, but does not harm others */
39 _ini(args,c,p,mainlb) char *args,*mainlb; int c; struct file **p; {
40 struct file *f;
41 char buf[128];
43 _pargc= *(int *)args; args += sizeof (int);
44 _pargv= *(char ***)args;
45 _sig(_catch);
46 _extfl = p;
47 _extflc = c;
48 if( !c ) return;
49 _m_lb = mainlb;
50 if ( (f = _extfl[0]) != (struct file *) 0) {
51 f->ptr = f->bufadr;
52 f->flags = MAGIC|TXTBIT;
53 f->fname = "INPUT";
54 f->ufd = 0;
55 f->size = 1;
56 f->count = 0;
57 f->buflen = PC_BUFLEN;
59 if ( (f = _extfl[1]) != (struct file *) 0) {
60 f->ptr = f->bufadr;
61 f->flags = MAGIC|TXTBIT|WRBIT|EOFBIT|ELNBIT;
62 f->fname = "OUTPUT";
63 f->ufd = 1;
64 f->size = 1;
65 #ifdef CPM
66 f->count = 1;
67 #else
68 f->count = (_isatty(1) ? 1 : PC_BUFLEN);
69 #endif
70 f->buflen = f->count;