input.c 901 B

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