ini.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* $Id$ */
  2. /*
  3. * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
  4. *
  5. * This product is part of the Amsterdam Compiler Kit.
  6. *
  7. * Permission to use, sell, duplicate or disclose this software must be
  8. * obtained in writing. Requests for such permissions may be sent to
  9. *
  10. * Dr. Andrew S. Tanenbaum
  11. * Wiskundig Seminarium
  12. * Vrije Universiteit
  13. * Postbox 7161
  14. * 1007 MC Amsterdam
  15. * The Netherlands
  16. *
  17. */
  18. /* Author: J.W. Stevenson */
  19. #include <pc_file.h>
  20. #include <pc_err.h>
  21. extern (*_sig())();
  22. extern _catch();
  23. struct file **_extfl;
  24. int _extflc; /* number of external files */
  25. char *_m_lb; /* LB of _m_a_i_n */
  26. struct file *_curfil; /* points to file struct in case of errors */
  27. int _pargc;
  28. char **_pargv;
  29. char **_penvp;
  30. int _fp_hook = 1; /* This is for Minix, but does not harm others */
  31. _ini(args,c,p,mainlb) char *args,*mainlb; int c; struct file **p; {
  32. struct file *f;
  33. char buf[128];
  34. _pargc= *(int *)args; args += sizeof (int);
  35. _pargv= *(char ***)args; args += sizeof (char **);
  36. _penvp= *(char ***)args;
  37. _sig(_catch);
  38. _extfl = p;
  39. _extflc = c;
  40. if( !c ) return;
  41. _m_lb = mainlb;
  42. if ( (f = _extfl[0]) != (struct file *) 0) {
  43. f->ptr = f->bufadr;
  44. f->flags = MAGIC|TXTBIT;
  45. f->fname = "INPUT";
  46. f->ufd = 0;
  47. f->size = 1;
  48. f->count = 0;
  49. f->buflen = PC_BUFLEN;
  50. }
  51. if ( (f = _extfl[1]) != (struct file *) 0) {
  52. f->ptr = f->bufadr;
  53. f->flags = MAGIC|TXTBIT|WRBIT|EOFBIT|ELNBIT;
  54. f->fname = "OUTPUT";
  55. f->ufd = 1;
  56. f->size = 1;
  57. f->count = 1;
  58. f->buflen = f->count;
  59. }
  60. }