<commit_before>/*
 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
 * See the copyright notice in the ACK home directory, in the file "Copyright".
 */
/* $Id$ */

#include "inputtype.h"
#include "file_info.h"
#include "input.h"

#define INP_PUSHBACK	3
#define INP_TYPE	struct file_info
#define INP_VAR		finfo
struct file_info	finfo;
#include "nopp.h"
#include <inp_pkg.body>
#include <alloc.h>

#include        "dbsymtab.h"
#include	"lint.h"
#ifndef NOPP
#ifdef DBSYMTAB
#include <stb.h>
#include <em.h>
extern int      IncludeLevel;
extern char	options[];
#endif

char *
getwdir(fn)
	register char *fn;
{
	register char *p;
	char *strrindex();

	p = strrindex(fn, '/');
	while (p && *(p + 1) == '\0') {	/* remove trailing /'s */
		*p = '\0';
		p = strrindex(fn, '/');
	}

	if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */
		return "";
	if (p) {
		*p = '\0';
		fn = Salloc(fn,(unsigned) (p - &fn[0] + 1));
		*p = '/';
		return fn;
	}
	return "";
}

int	InputLevel;
extern int		nestlevel;
#endif /* NOPP */

int	NoUnstack;

AtEoIT()
{
#ifndef NOPP
	InputLevel--;
	unstackrepl();
#endif /* NOPP */
	return 0;
}

extern char *source;

AtEoIF()
{
#ifndef NOPP
	if (nestlevel != nestlow) lexwarning("missing #endif");
	else
#endif /* NOPP */
	if (NoUnstack) lexerror("unexpected EOF");
#ifndef NOPP
	nestlevel = nestlow;
#ifdef DBSYMTAB
	if (options['g'] && IncludeLevel > 0) {
		C_ms_stb_cst(FileName, N_EINCL, 0, (arith) 0);
	}
	IncludeLevel--;
#endif
#endif /* NOPP */
	if (WorkingDir[0] != '\0') free(WorkingDir);
#ifndef LINT
	if (FileName != source) free(FileName);
#endif
	return 0;
}<commit_msg>free WorkingDir only if including cpp<commit_after>/*
 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
 * See the copyright notice in the ACK home directory, in the file "Copyright".
 */
/* $Id$ */

#include "inputtype.h"
#include "file_info.h"
#include "input.h"

#define INP_PUSHBACK	3
#define INP_TYPE	struct file_info
#define INP_VAR		finfo
struct file_info	finfo;
#include "nopp.h"
#include <inp_pkg.body>
#include <alloc.h>

#include        "dbsymtab.h"
#include	"lint.h"
#ifndef NOPP
#ifdef DBSYMTAB
#include <stb.h>
#include <em.h>
extern int      IncludeLevel;
extern char	options[];
#endif

char *
getwdir(fn)
	register char *fn;
{
	register char *p;
	char *strrindex();

	p = strrindex(fn, '/');
	while (p && *(p + 1) == '\0') {	/* remove trailing /'s */
		*p = '\0';
		p = strrindex(fn, '/');
	}

	if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */
		return "";
	if (p) {
		*p = '\0';
		fn = Salloc(fn,(unsigned) (p - &fn[0] + 1));
		*p = '/';
		return fn;
	}
	return "";
}

int	InputLevel;
extern int		nestlevel;
#endif /* NOPP */

int	NoUnstack;

AtEoIT()
{
#ifndef NOPP
	InputLevel--;
	unstackrepl();
#endif /* NOPP */
	return 0;
}

extern char *source;

AtEoIF()
{
#ifndef NOPP
	if (nestlevel != nestlow) lexwarning("missing #endif");
	else
#endif /* NOPP */
	if (NoUnstack) lexerror("unexpected EOF");
#ifndef NOPP
	nestlevel = nestlow;
#ifdef DBSYMTAB
	if (options['g'] && IncludeLevel > 0) {
		C_ms_stb_cst(FileName, N_EINCL, 0, (arith) 0);
	}
	IncludeLevel--;
#endif
	if (WorkingDir[0] != '\0') free(WorkingDir);
#endif /* NOPP */
#ifndef LINT
	if (FileName != source) free(FileName);
#endif
	return 0;
}
{'fraction_non_alphanumeric': 0.1848284166164961, 'fraction_numerical': 0.013245033112582781, 'mean_word_length': 3.7067988668555243, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5872703', 'n_tokens_mistral': 1436, 'n_tokens_neox': 1374, 'n_words': 371}