input.c 982 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 "inputtype.h"
  7. #include "file_info.h"
  8. #include "input.h"
  9. #define INP_TYPE struct file_info
  10. #define INP_VAR finfo
  11. struct file_info finfo;
  12. #include <inp_pkg.body>
  13. #include "nopp.h"
  14. #ifndef NOPP
  15. char *
  16. getwdir(fn)
  17. register char *fn;
  18. {
  19. register char *p;
  20. char *strrindex();
  21. p = strrindex(fn, '/');
  22. while (p && *(p + 1) == '\0') { /* remove trailing /'s */
  23. *p = '\0';
  24. p = strrindex(fn, '/');
  25. }
  26. if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */
  27. return "";
  28. if (p) {
  29. *p = '\0';
  30. fn = Salloc(fn, p - &fn[0] + 1);
  31. *p = '/';
  32. return fn;
  33. }
  34. return ".";
  35. }
  36. #endif NOPP
  37. int NoUnstack;
  38. AtEoIT()
  39. {
  40. #ifndef NOPP
  41. if (NoUnstack) lexerror("unexpected EOF");
  42. DoUnstack();
  43. #endif NOPP
  44. return 0;
  45. }
  46. AtEoIF()
  47. {
  48. if (NoUnstack) lexerror("unexpected EOF");
  49. return 0;
  50. }