input.c 829 B

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