input.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. extern int nestlevel;
  13. #include "nopp.h"
  14. #include <inp_pkg.body>
  15. #ifndef NOPP
  16. char *
  17. getwdir(fn)
  18. register char *fn;
  19. {
  20. register char *p;
  21. char *strrindex();
  22. p = strrindex(fn, '/');
  23. while (p && *(p + 1) == '\0') { /* remove trailing /'s */
  24. *p = '\0';
  25. p = strrindex(fn, '/');
  26. }
  27. if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */
  28. return "";
  29. if (p) {
  30. *p = '\0';
  31. fn = Salloc(fn, p - &fn[0] + 1);
  32. *p = '/';
  33. return fn;
  34. }
  35. return ".";
  36. }
  37. #endif NOPP
  38. int NoUnstack;
  39. AtEoIT()
  40. {
  41. #ifndef NOPP
  42. /* if (NoUnstack) lexwarning("unexpected EOF"); ??? */
  43. DoUnstack();
  44. #endif NOPP
  45. return 0;
  46. }
  47. AtEoIF()
  48. {
  49. #ifndef NOPP
  50. if (nestlevel != nestlow) lexwarning("missing #endif");
  51. else
  52. #endif NOPP
  53. if (NoUnstack) lexerror("unexpected EOF");
  54. #ifndef NOPP
  55. nestlevel = nestlow;
  56. #endif
  57. return 0;
  58. }