1994-06-24 11:31:16 +00:00
|
|
|
/* $Id$ */
|
1987-03-09 19:15:41 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
2006-07-18 17:10:18 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
1987-01-06 15:16:53 +00:00
|
|
|
#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>
|
1995-08-17 13:33:55 +00:00
|
|
|
#include <alloc.h>
|
1987-01-06 15:16:53 +00:00
|
|
|
|
|
|
|
char *
|
|
|
|
getwdir(fn)
|
|
|
|
char *fn;
|
|
|
|
{
|
|
|
|
register char *p;
|
2006-07-23 20:01:02 +00:00
|
|
|
char *strrchr();
|
1987-01-06 15:16:53 +00:00
|
|
|
|
2006-07-23 20:01:02 +00:00
|
|
|
p = strrchr(fn, '/');
|
1987-01-06 15:16:53 +00:00
|
|
|
while (p && *(p + 1) == '\0') { /* remove trailing /'s */
|
|
|
|
*p = '\0';
|
2006-07-23 20:01:02 +00:00
|
|
|
p = strrchr(fn, '/');
|
1987-01-06 15:16:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */
|
|
|
|
return "";
|
|
|
|
else
|
|
|
|
if (p) {
|
|
|
|
*p = '\0';
|
|
|
|
fn = Salloc(fn, p - &fn[0] + 1);
|
|
|
|
*p = '/';
|
|
|
|
return fn;
|
|
|
|
}
|
1989-02-16 11:18:44 +00:00
|
|
|
else return "";
|
1987-01-06 15:16:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int NoUnstack;
|
|
|
|
int Unstacked;
|
1989-07-14 09:51:02 +00:00
|
|
|
int InputLevel;
|
1987-01-06 15:16:53 +00:00
|
|
|
|
|
|
|
AtEoIT()
|
|
|
|
{
|
1990-01-16 10:08:34 +00:00
|
|
|
/* if (NoUnstack) warning("unexpected EOF"); ??? */
|
1990-01-16 10:11:45 +00:00
|
|
|
/* This is wrong; in an #elif, NoUnstack can be set, but you
|
|
|
|
can still get calls to AtEoIT().
|
|
|
|
*/
|
1989-07-14 09:51:02 +00:00
|
|
|
InputLevel--;
|
1987-01-06 15:16:53 +00:00
|
|
|
DoUnstack();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
AtEoIF()
|
|
|
|
{
|
1987-08-20 18:12:31 +00:00
|
|
|
extern int nestlevel;
|
|
|
|
extern int nestcount;
|
|
|
|
extern int svnestlevel[];
|
1987-08-07 19:54:45 +00:00
|
|
|
|
1987-08-20 18:12:31 +00:00
|
|
|
if (nestlevel > svnestlevel[nestcount]) warning("missing #endif");
|
1987-08-07 19:54:45 +00:00
|
|
|
else if (NoUnstack) warning("unexpected EOF");
|
1987-08-20 18:12:31 +00:00
|
|
|
nestlevel = svnestlevel[nestcount--];
|
1987-01-06 15:16:53 +00:00
|
|
|
return 0;
|
|
|
|
}
|