<commit_before>// <NAME>

// fts() traverses a directory hierarchy. It works on Linux, Mac OS X,
// and the BSDs.
//
// fts() is the recommended way to traverse directories on Mac OS X
// because fts() is considered "legacy".
//
// A POSIX standard function which provides similar functionality is
// demonstrated in ftw.c

#define _BSD_SOURCE // required to make this program work on Linux
#include <stdio.h>
#include <stdlib.h>

#include <sys/errno.h> // lets us directly access errno

// includes recommended by "man fts":
#include <sys/types.h>
#include <sys/stat.h>
#include <fts.h>

int main(void)
{
	/* An array of paths to traverse. Each path must be null
	 * terminated and the list must end with a NULL pointer. */
	char *paths[] = { "/tmp/test-tree-1", NULL };
	
	/* 2nd parameter: An options parameter. Must include either
	   FTS_PHYSICAL or FTS_LOGICAL---they change how symbolic links
	   are handled.

	   Last parameter is a comparator which you can optionally provide
	   to change the traversal of the filesystem hierarchy.
	*/
	FTS *ftsp = fts_open(paths, FTS_PHYSICAL, NULL);
	if(ftsp == NULL)
	{
		perror("fts_open");
		exit(EXIT_FAILURE);
	}

	while(1) // call fts_read() enough times to get each file
	{
		FTSENT *ent = fts_read(ftsp); // get next entry (could be file or directory).
		if(ent == NULL)
		{
			if(errno == 0)
				break; // No more items, bail out of while loop
			else
			{
				// fts_read() had an error.
				perror("fts_read");
				exit(EXIT_FAILURE);
			}
		}<commit_msg>update fts example to use local directory<commit_after>// <NAME>

// fts() traverses a directory hierarchy. It works on Linux, Mac OS X,
// and the BSDs.
//
// fts() is the recommended way to traverse directories on Mac OS X
// because fts() is considered "legacy".
//
// A POSIX standard function which provides similar functionality is
// demonstrated in ftw.c

#define _BSD_SOURCE // required to make this program work on Linux
#include <stdio.h>
#include <stdlib.h>

#include <sys/errno.h> // lets us directly access errno

// includes recommended by "man fts":
#include <sys/types.h>
#include <sys/stat.h>
#include <fts.h>

int main(void)
{
	/* An array of paths to traverse. Each path must be null
	 * terminated and the list must end with a NULL pointer. */
	char *paths[] = { ".", NULL };
	
	/* 2nd parameter: An options parameter. Must include either
	   FTS_PHYSICAL or FTS_LOGICAL---they change how symbolic links
	   are handled.

	   Last parameter is a comparator which you can optionally provide
	   to change the traversal of the filesystem hierarchy.
	*/
	FTS *ftsp = fts_open(paths, FTS_PHYSICAL, NULL);
	if(ftsp == NULL)
	{
		perror("fts_open");
		exit(EXIT_FAILURE);
	}

	while(1) // call fts_read() enough times to get each file
	{
		FTSENT *ent = fts_read(ftsp); // get next entry (could be file or directory).
		if(ent == NULL)
		{
			if(errno == 0)
				break; // No more items, bail out of while loop
			else
			{
				// fts_read() had an error.
				perror("fts_read");
				exit(EXIT_FAILURE);
			}
		}
{'fraction_non_alphanumeric': 0.1148404080289569, 'fraction_numerical': 0.002303389272787101, 'mean_word_length': 3.1530054644808745, 'pattern_counts': {'":': 2, '<': 17, '<?xml version=': 0, '>': 17, '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': '3355420', 'n_tokens_mistral': 1073, 'n_tokens_neox': 973, 'n_words': 383}