<commit_before>/*
 * A simple Brainfuck interpreter.
 *
 * This file was written by <NAME>, <<EMAIL>>. This is free
 * and unencumbered software released into the public domain. For more
 * information, please refer to the accompanying "UNLICENCE" file.
*/

#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "brainfuck.h"

int main(int argc, char **argv)
{
  uint8_t *commands = NULL;
  uint32_t number_of_commands = 0;
  FILE *brainfuck_stream = stdin;
  if ((argc != 1) && (strcmp(argv[1], "-") != 0)) {
    if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0)) {
      printf("\"%s\" is a simple Brainfuck interpreter.\n", argv[0]);
      printf("Usage: %s [options] [- | programfile]\n", argv[0]);
      puts("Options:\n  -h, --help    Print this message.");
      exit(EXIT_SUCCESS);
    } else if (argv[1][0] == '-') {
      fprintf(stderr, "Unrecognised option: %s\n", argv[1]);
      fprintf(stderr, "Try \"%s -h\" for more information.\n", argv[0]);
      exit(EXIT_SUCCESS);
    } else if ((brainfuck_stream = fopen(argv[1], "r")) == NULL) {
      fprintf(stderr, "Cannot open \"%s\": %s\n", argv[1], strerror(errno));
      exit(EXIT_FAILURE);
    }
  }
  while(true) {
    int8_t character = getc(brainfuck_stream);
    uint8_t *new_commands = realloc(commands,
        ++number_of_commands * sizeof(uint8_t));
    if (new_commands == NULL) {
      free(commands);
      perror("Unable to create command list");
      exit(EXIT_FAILURE);<commit_msg>Fix formatting and unrecognised option bug.<commit_after>/*
 * A simple Brainfuck interpreter.
 *
 * This file was written by <NAME>, <<EMAIL>>. This is free
 * and unencumbered software released into the public domain. For more
 * information, please refer to the accompanying "UNLICENCE" file.
*/

#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "brainfuck.h"

int main(int argc, char **argv)
{
  uint8_t *commands = NULL;
  uint32_t number_of_commands = 0;
  FILE *brainfuck_stream = stdin;
  if ((argc != 1) && (strcmp(argv[1], "-") != 0)) {
    if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0)) {
      printf("\"%s\" is a simple Brainfuck interpreter.\n", argv[0]);
      printf("Usage: %s [options] [- | programfile]\n", argv[0]);
      puts("Options:\n  -h, --help    Print this message.");
      exit(EXIT_SUCCESS);
    } else if (argv[1][0] == '-') {
      fprintf(stderr, "Unrecognised option: %s\n", argv[1]);
      fprintf(stderr, "Try \"%s -h\" for more information.\n", argv[0]);
      exit(EXIT_FAILURE);
    } else if ((brainfuck_stream = fopen(argv[1], "r")) == NULL) {
      fprintf(stderr, "Cannot open \"%s\": %s\n", argv[1], strerror(errno));
      exit(EXIT_FAILURE);
    }
  }
  while (true) {
    int8_t character = getc(brainfuck_stream);
    uint8_t *new_commands = realloc(commands,
        ++number_of_commands * sizeof(uint8_t));
    if (new_commands == NULL) {
      free(commands);
      perror("Unable to create command list");
      exit(EXIT_FAILURE);
{'fraction_non_alphanumeric': 0.18230989500477252, 'fraction_numerical': 0.013999363665287942, 'mean_word_length': 3.465909090909091, 'pattern_counts': {'":': 2, '<': 21, '<?xml version=': 0, '>': 21, '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': '2856250', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1112, 'n_words': 291}