<commit_before>#ifndef __UTIL_H
#define __UTIL_H

#include "types.hh"

#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#include <signal.h>

#include <iostream>


namespace nix {


#define foreach(it_type, it, collection)                                \
    for (it_type it = collection.begin(); it != collection.end(); ++it)


/* Return an environment variable. */
string getEnv(const string & key, const string & def = "");

/* Return an absolutized path, resolving paths relative to the
   specified directory, or the current directory otherwise.  The path
   is also canonicalised. */
Path absPath(Path path, Path dir = "");

/* Canonicalise a path by removing all `.' or `..' components and
   double or trailing slashes.  Optionally resolves all symlink
   components such that each component of the resulting path is *not*<commit_msg>* Grrr.<commit_after>#ifndef __UTIL_H
#define __UTIL_H

#include "types.hh"

#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#include <signal.h>

#include <cstdio>


namespace nix {


#define foreach(it_type, it, collection)                                \
    for (it_type it = collection.begin(); it != collection.end(); ++it)


/* Return an environment variable. */
string getEnv(const string & key, const string & def = "");

/* Return an absolutized path, resolving paths relative to the
   specified directory, or the current directory otherwise.  The path
   is also canonicalised. */
Path absPath(Path path, Path dir = "");

/* Canonicalise a path by removing all `.' or `..' components and
   double or trailing slashes.  Optionally resolves all symlink
   components such that each component of the resulting path is *not*
{'fraction_non_alphanumeric': 0.10915492957746478, 'fraction_numerical': 0.0, 'mean_word_length': 3.4285714285714284, 'pattern_counts': {'":': 0, '<': 13, '<?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': '309885', 'n_tokens_mistral': 507, 'n_tokens_neox': 502, 'n_words': 188}