ini.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. _pargc= *(int *)args; args += sizeof (int);
  34. _pargv= *(char ***)args; args += sizeof (char **);
  35. _penvp= *(char ***)args;
  36. _sig(_catch);
  37. _extfl = p;
  38. _extflc = c;
  39. if( !c ) return;
  40. _m_lb = mainlb;
  41. if ( (f = _extfl[0]) != (struct file *) 0) {
  42. f->ptr = f->bufadr;
  43. f->flags = MAGIC|TXTBIT;
  44. f->fname = "INPUT";
  45. f->ufd = 0;
  46. f->size = 1;
  47. f->count = 0;
  48. f->buflen = PC_BUFLEN;
  49. }
  50. if ( (f = _extfl[1]) != (struct file *) 0) {
  51. f->ptr = f->bufadr;
  52. f->flags = MAGIC|TXTBIT|WRBIT|EOFBIT|ELNBIT;
  53. f->fname = "OUTPUT";
  54. f->ufd = 1;
  55. f->size = 1;
  56. f->count = 1;
  57. f->buflen = f->count;
  58. }
  59. }