ack/lang/cem/cemcom/input.c

55 lines
829 B
C
Raw Normal View History

1986-03-10 13:07:55 +00:00
/* $Header$ */
#include "inputtype.h"
#include "file_info.h"
#include "input.h"
#define INP_TYPE struct file_info
#define INP_VAR finfo
struct file_info finfo;
#include <inp_pkg.body>
#include "nopp.h"
1986-03-10 13:07:55 +00:00
#ifndef NOPP
char *
getwdir(fn)
register char *fn;
1986-03-10 13:07:55 +00:00
{
register char *p;
1986-03-26 16:58:43 +00:00
char *strrindex();
1986-03-10 13:07:55 +00:00
1986-03-26 16:58:43 +00:00
p = strrindex(fn, '/');
1986-03-10 13:07:55 +00:00
while (p && *(p + 1) == '\0') { /* remove trailing /'s */
*p = '\0';
1986-03-26 16:58:43 +00:00
p = strrindex(fn, '/');
1986-03-10 13:07:55 +00:00
}
if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */
return "";
1986-03-10 13:07:55 +00:00
else
if (p) {
*p = '\0';
fn = Salloc(fn, p - &fn[0] + 1);
1986-03-10 13:07:55 +00:00
*p = '/';
return fn;
1986-03-10 13:07:55 +00:00
}
else return ".";
1986-03-10 13:07:55 +00:00
}
#endif NOPP
int NoUnstack;
AtEoIT()
1986-03-10 13:07:55 +00:00
{
#ifndef NOPP
if (NoUnstack) lexerror("unexpected EOF");
DoUnstack();
#endif NOPP
return 0;
}
1986-03-10 13:07:55 +00:00
AtEoIF()
{
if (NoUnstack) lexerror("unexpected EOF");
return 0;
1986-03-10 13:07:55 +00:00
}