<commit_before>#include <stdio.h>
#include "util.h"
#include "opt.h"
char* ccl_binname(void) {
  char* ret=q("");
  char* _uname_m=uname_m();
  char* _uname=uname();
  if(strcmp(_uname,"linux")==0) {
    ret=s_cat(ret,q("l"),NULL);
  }else if(strcmp(_uname,"windows")==0) {
    ret=s_cat(ret,q("w"),NULL);
  }
  if(strcmp(_uname_m,"x86-64")==0 ||
     strcmp(_uname_m,"x86")==0) {
    ret=s_cat(ret,q("x86"),NULL);
  }
  ret=s_cat(ret,q("cl"),NULL);
  if(strcmp(_uname_m,"x86-64")==0)
    ret=s_cat(ret,q("64"),NULL);
  return ret;
}

char** cmd_run_ccl(int argc,char** argv,struct sub_command* cmd)
{
  char** arg=NULL;
  char* home=configdir();
  char* arch=uname_m();
  char* os=uname();
  char* impl=(char*)cmd->name;
  char* version=(char*)cmd->short_name;
  int offset=8;  /*[binpath for ccl] --no-init --quiet --batch --image-name param --eval init.lisp
                   [terminating NULL] that total 9 are default. */
  int i;
  int paramc=0;
  char* impl_path= cat(home,"impls",SLASH,arch,SLASH,os,SLASH,impl,SLASH,version,NULL);
  char* bin;
  char* script=get_opt("script");
  char* image=get_opt("image");
  char* program=get_opt("program");
  int issystem=(strcmp("system",version)==0);
  if(issystem){
    bin=truename(which("ccl"));
  }else {
    bin=s_cat(impl_path,SLASH,ccl_binname(),q(EXE_EXTENTION),NULL);
  }

  if(script)
    offset+=1;
  if(quicklisp) {
    char* setup_file=s_cat(ql_path(),q("setup.lisp"),NULL);
    if(file_exist_p(setup_file)) {
      offset+=2;
    }else {
      quicklisp=0;
    }
    s(setup_file);
  }
  if(program||script)
    offset+=2;

  arg=alloc(sizeof(char*)*(offset+argc));
  arg[paramc++]=bin;
  arg[paramc++]=q("--no-init");
  arg[paramc++]=q("--quiet");
  arg[paramc++]=q("--batch");
  if(image||!issystem)
    arg[paramc++]=q("--image-name");
  if(!image) {
    if(!issystem) {
      char* binname=ccl_binname();
      arg[paramc++]=cat(impl_path,SLASH,binname,".image",NULL);
      s(binname);
    }
  }else {
    arg[paramc++]=cat(impl_path,SLASH,"dump",SLASH,image,".core",NULL);<commit_msg>fix core dump.<commit_after>#include <stdio.h>
#include "util.h"
#include "opt.h"
char* ccl_binname(void) {
  char* ret=q("");
  char* _uname_m=uname_m();
  char* _uname=uname();
  if(strcmp(_uname,"linux")==0) {
    ret=s_cat(ret,q("l"),NULL);
  }else if(strcmp(_uname,"windows")==0) {
    ret=s_cat(ret,q("w"),NULL);
  }
  if(strcmp(_uname_m,"x86-64")==0 ||
     strcmp(_uname_m,"x86")==0) {
    ret=s_cat(ret,q("x86"),NULL);
  }
  ret=s_cat(ret,q("cl"),NULL);
  if(strcmp(_uname_m,"x86-64")==0)
    ret=s_cat(ret,q("64"),NULL);
  return ret;
}

char** cmd_run_ccl(int argc,char** argv,struct sub_command* cmd)
{
  char** arg=NULL;
  char* home=configdir();
  char* arch=uname_m();
  char* os=uname();
  char* impl=(char*)cmd->name;
  char* version=(char*)cmd->short_name;
  int offset=8;  /*[binpath for ccl] --no-init --quiet --batch --image-name param --eval init.lisp
                   [terminating NULL] that total 9 are default. */
  int i;
  int paramc=0;
  char* impl_path= cat(home,"impls",SLASH,arch,SLASH,os,SLASH,impl,SLASH,version,NULL);
  char* bin;
  char* script=get_opt("script");
  char* image=get_opt("image");
  char* program=get_opt("program");
  int issystem=(strcmp("system",version)==0);
  if(issystem){
    bin=truename(which("ccl"));
  }else {
    bin=s_cat(q(impl_path),q(SLASH),ccl_binname(),q(EXE_EXTENTION),NULL);
  }

  if(script)
    offset+=1;
  if(quicklisp) {
    char* setup_file=s_cat(ql_path(),q("setup.lisp"),NULL);
    if(file_exist_p(setup_file)) {
      offset+=2;
    }else {
      quicklisp=0;
    }
    s(setup_file);
  }
  if(program||script)
    offset+=2;

  arg=alloc(sizeof(char*)*(offset+argc));
  arg[paramc++]=bin;
  arg[paramc++]=q("--no-init");
  arg[paramc++]=q("--quiet");
  arg[paramc++]=q("--batch");
  if(image||!issystem)
    arg[paramc++]=q("--image-name");
  if(!image) {
    if(!issystem) {
      char* binname=ccl_binname();
      arg[paramc++]=cat(impl_path,SLASH,binname,".image",NULL);
      s(binname);
    }
  }else {
    arg[paramc++]=cat(impl_path,SLASH,"dump",SLASH,image,".core",NULL);
{'fraction_non_alphanumeric': 0.22516395433568132, 'fraction_numerical': 0.013116346854505708, 'mean_word_length': 4.447089947089947, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '575793', 'n_tokens_mistral': 1755, 'n_tokens_neox': 1740, 'n_words': 225}