input.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* $Header$ */
  6. #include "file_info.h"
  7. #include "input.h"
  8. #define INP_PUSHBACK 3
  9. #define INP_TYPE struct file_info
  10. #define INP_VAR finfo
  11. struct file_info finfo;
  12. #include <inp_pkg.body>
  13. char *
  14. getwdir(fn)
  15. register char *fn;
  16. {
  17. register char *p;
  18. char *strrindex();
  19. p = strrindex(fn, '/');
  20. while (p && *(p + 1) == '\0') { /* remove trailing /'s */
  21. *p = '\0';
  22. p = strrindex(fn, '/');
  23. }
  24. if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */
  25. return "";
  26. if (p) {
  27. *p = '\0';
  28. fn = Salloc(fn, p - &fn[0] + 1);
  29. *p = '/';
  30. return fn;
  31. }
  32. return ".";
  33. }
  34. int NoUnstack;
  35. int InputLevel;
  36. AtEoIT()
  37. {
  38. InputLevel--;
  39. /* if (NoUnstack) warning("unexpected EOF"); ??? */
  40. unstackrepl();
  41. return 0;
  42. }
  43. AtEoIF()
  44. {
  45. extern int nestlevel;
  46. extern int nestcount;
  47. extern int svnestlevel[];
  48. if (nestlevel > svnestlevel[nestcount]) warning("missing #endif");
  49. else if (NoUnstack) warning("unexpected EOF");
  50. nestlevel = svnestlevel[nestcount--];
  51. return 0;
  52. }