<commit_before>/* Copyright (C) 2000 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/* Saves all errmesg in a header file, updated by me, in a compact file  */

#include <my_global.h>
#include <m_ctype.h>
#include <my_sys.h>
#include <m_string.h>

#define MAXLENGTH 1000
#define MAX_ROWS  1000
#define MAX_FILES 10
#define MAX_CHARSET_NAME	64

int	row_count;
uint	file_pos[MAX_ROWS],file_row_pos[MAX_FILES];
my_string saved_row[MAX_ROWS];
uchar   file_head[]= { 254,254,2,1 };
char    charset_name[MAX_CHARSET_NAME];

static void get_options(int *argc,char **argv[]);
static int count_rows(FILE *from,pchar c, pchar c2);
static int remember_rows(FILE *from,pchar c);
static int copy_rows(FILE *to);


	/* Functions defined in this file */

int main(int argc,char *argv[])
{
  uint csnum= 0;
  int i,error,files,length;
  uchar head[32];
  FILE *from,*to;
  MY_INIT(argv[0]);
  
  get_options(&argc,&argv);
  error=1;
  row_count=files=0;

  to=0;
  for ( ; argc-- > 1 ; argv++)
  {
    file_row_pos[files++] = row_count;

    if ((from = fopen(*argv,"r")) == NULL)
    {
      fprintf(stderr,"Can't open file '%s'\n",*argv);
      return(1);
    }

    VOID(count_rows(from,'"','}'));	/* Calculate start-info */
    if (!charset_name[0])
    {
      fprintf(stderr,"Character set is not specified in '%s'\n",*argv);
      fclose(from);
      goto end;
    }
    
    if (!(csnum= get_charset_number(charset_name, MY_CS_PRIMARY)))
    {
      fprintf(stderr,"Unknown character '%s' in '%s'\n",charset_name, *argv);
      fclose(from);
      goto end;
    }
    
    if (remember_rows(from,'}') < 0)	/* Remember rows */
    {
      fprintf(stderr,"Can't find textrows in '%s'\n",*argv);
      fclose(from);
      goto end;
    }
    fclose(from);
  }

  if ((to=my_fopen(*argv,O_WRONLY | FILE_BINARY,MYF(0))) == NULL)
  {
    fprintf(stderr,"Can't create file '%s'\n",*argv);
    return(1);
  }

  fseek(to,(long) (32+row_count*2),0);
  if (copy_rows(to))
    goto end;

  length=ftell(to)-32-row_count*2;

  bzero((gptr) head,32);		/* Save Header & pointers */
  bmove((byte*) head,(byte*) file_head,4);
  head[4]=files;<commit_msg>comp_err.c:   There are some problems compiling with pure "configure"   I need to fix it first.<commit_after>/* Copyright (C) 2000 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/* Saves all errmesg in a header file, updated by me, in a compact file  */

#include <my_global.h>
#include <m_ctype.h>
#include <my_sys.h>
#include <m_string.h>

#define MAXLENGTH 1000
#define MAX_ROWS  1000
#define MAX_FILES 10
#define MAX_CHARSET_NAME	64

int	row_count;
uint	file_pos[MAX_ROWS],file_row_pos[MAX_FILES];
my_string saved_row[MAX_ROWS];
uchar   file_head[]= { 254,254,2,1 };
char    charset_name[MAX_CHARSET_NAME];

static void get_options(int *argc,char **argv[]);
static int count_rows(FILE *from,pchar c, pchar c2);
static int remember_rows(FILE *from,pchar c);
static int copy_rows(FILE *to);


	/* Functions defined in this file */

int main(int argc,char *argv[])
{
  uint csnum= 0;
  int i,error,files,length;
  uchar head[32];
  FILE *from,*to;
  MY_INIT(argv[0]);
  
  get_options(&argc,&argv);
  error=1;
  row_count=files=0;

  to=0;
  for ( ; argc-- > 1 ; argv++)
  {
    file_row_pos[files++] = row_count;

    if ((from = fopen(*argv,"r")) == NULL)
    {
      fprintf(stderr,"Can't open file '%s'\n",*argv);
      return(1);
    }

    VOID(count_rows(from,'"','}'));	/* Calculate start-info */
    if (!charset_name[0])
    {
      fprintf(stderr,"Character set is not specified in '%s'\n",*argv);
      fclose(from);
      goto end;
    }

#ifdef NEEDS_FIXES
    if (!(csnum= get_charset_number(charset_name, MY_CS_PRIMARY)))
    {
      fprintf(stderr,"Unknown character '%s' in '%s'\n",charset_name, *argv);
      fclose(from);
      goto end;
    }
#endif
    
    if (remember_rows(from,'}') < 0)	/* Remember rows */
    {
      fprintf(stderr,"Can't find textrows in '%s'\n",*argv);
      fclose(from);
      goto end;
    }
    fclose(from);
  }

  if ((to=my_fopen(*argv,O_WRONLY | FILE_BINARY,MYF(0))) == NULL)
  {
    fprintf(stderr,"Can't create file '%s'\n",*argv);
    return(1);
  }

  fseek(to,(long) (32+row_count*2),0);
  if (copy_rows(to))
    goto end;

  length=ftell(to)-32-row_count*2;

  bzero((gptr) head,32);		/* Save Header & pointers */
  bmove((byte*) head,(byte*) file_head,4);
  head[4]=files;
{'fraction_non_alphanumeric': 0.1341378104232249, 'fraction_numerical': 0.022385449457852397, 'mean_word_length': 3.582532051282051, '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': '3777741', 'n_tokens_mistral': 2086, 'n_tokens_neox': 1960, 'n_words': 596}