<commit_before>/* -*- tab-width : 2 -*- */
#include "opt.h"
#include "cmd-run.h"
#include "gend.h"

struct proc_opt internal;

DEF_SUBCMD(cmd_download) {
  int argc=length(arg_);
  int opt=argc>3?atoi(firsts(nthcdr(3,arg_))):0;
  return argc>=3?
    (1&opt?
     0:
     fprintf(opt?stdout:stderr,"Downloading %s\n",firsts(nthcdr(1,arg_)))),
    download_simple(firsts(nthcdr(1,arg_)),
                    backslash_decode(q_(firsts(nthcdr(2,arg_)))),
                    opt>2?0:opt):0;
}

DEF_SUBCMD(cmd_uname) {
  int argc=length(arg_);

  if(argc==1) {
    printf("%s\n",uname());
  }else if(argc==2) {
    if(strncmp(firsts(nthcdr(1,arg_)),"-m",2)==0)
      printf("%s\n",uname_m());
  }
  return 0;
}

DEF_SUBCMD(cmd_which) {
  int argc=length(arg_);

  if(argc==2) {
    char* str=which(firsts(nthcdr(1,arg_)));
    printf("%s\n",str);
    s(str);
  }
  return 0;
}

DEF_SUBCMD(cmd_impl) {
  int argc=length(arg_);

  if(argc==1 && get_opt("default.lisp",0)) {
    char* impl=determin_impl(get_opt("default.lisp",0));
    printf("%s\n",impl);
    s(impl);
  }
  if(argc==2) {
    char* impl=determin_impl(firsts(nthcdr(1,arg_)));
    printf("%s\n",impl);
    s(impl);
  }
  return 0;
}

DEF_SUBCMD(cmd_internal_version) {
  int argc=length(arg_);

  if(argc==1) {
    printf("%s\n",PACKAGE_VERSION);
  }else if(argc==2) {
    char* ev=NULL;
    char* arg1=firsts(nthcdr(1,arg_));
    if(strcmp(arg1,"lisp")==0) {
      ev= "version";
    }else if(strcmp(arg1,"dump")==0) {
      ev= "roswell";
    }
    if(ev) {
      char *cmd=cat("(progn(format t\"~A~%\"(or(ignore-errors(getf(symbol-value(read-from-string \"ros.util::*version*\")) :",ev,
                    "))(ros:quit 1))) (ros:quit 0))",NULL);
      LVal arg=stringlist("--no-rc","-L",DEFAULT_IMPL,"-m",PACKAGE,"--eval",cmd,"run",NULL);
      for(;arg;arg=dispatch(arg,&top));
      s(cmd);
    }else if(strncmp(arg1,"date",4)==0) {
      char* opt=get_opt("sbcl-bin.version",0);
      char* impl_path=s_cat(configdir(),q("impls"SLASH),uname_m(),q(SLASH),uname(),q(SLASH DEFAULT_IMPL SLASH),
                            q(opt?opt:"dummy-version"),q(SLASH "dump" SLASH PACKAGE".core"),NULL);
      cond_printf(1,"mtime of %s:%lu\n",impl_path,file_mtime(impl_path));
      printf("%lu\n",2208988800+file_mtime(impl_path));
      s(impl_path);
    }else if(strncmp(arg1,"cc",2)==0) {<commit_msg>delete some code.<commit_after>/* -*- tab-width : 2 -*- */
#include "opt.h"
#include "cmd-run.h"
#include "gend.h"

struct proc_opt internal;

DEF_SUBCMD(cmd_download) {
  int argc=length(arg_);
  int opt=argc>3?atoi(firsts(nthcdr(3,arg_))):0;
  return argc>=3?
    (1&opt?
     0:
     fprintf(opt?stdout:stderr,"Downloading %s\n",firsts(nthcdr(1,arg_)))),
    download_simple(firsts(nthcdr(1,arg_)),
                    backslash_decode(q_(firsts(nthcdr(2,arg_)))),
                    opt>2?0:opt):0;
}

DEF_SUBCMD(cmd_uname) {
  int argc=length(arg_);

  if(argc==1) {
    printf("%s\n",uname());
  }else if(argc==2) {
    if(strncmp(firsts(nthcdr(1,arg_)),"-m",2)==0)
      printf("%s\n",uname_m());
  }
  return 0;
}

DEF_SUBCMD(cmd_which) {
  int argc=length(arg_);

  if(argc==2) {
    char* str=which(firsts(nthcdr(1,arg_)));
    printf("%s\n",str);
    s(str);
  }
  return 0;
}

DEF_SUBCMD(cmd_impl) {
  int argc=length(arg_);

  if(argc==1 && get_opt("default.lisp",0)) {
    char* impl=determin_impl(get_opt("default.lisp",0));
    printf("%s\n",impl);
    s(impl);
  }
  if(argc==2) {
    char* impl=determin_impl(firsts(nthcdr(1,arg_)));
    printf("%s\n",impl);
    s(impl);
  }
  return 0;
}

DEF_SUBCMD(cmd_internal_version) {
  int argc=length(arg_);

  if(argc==1) {
    printf("%s\n",PACKAGE_VERSION);
  }else if(argc==2) {
    char* ev=NULL;
    char* arg1=firsts(nthcdr(1,arg_));
    if(strcmp(arg1,"lisp")==0) {
      ev= "version";
    }else if(strcmp(arg1,"dump")==0) {
      ev= "roswell";
    }
    if(ev) {
      char *cmd=cat("(progn(format t\"~A~%\"(or(ignore-errors(getf(symbol-value(read-from-string \"ros.util::*version*\")) :",ev,
                    "))(ros:quit 1))) (ros:quit 0))",NULL);
      LVal arg=stringlist("--no-rc","-L",DEFAULT_IMPL,"-m",PACKAGE,"--eval",cmd,"run",NULL);
      for(;arg;arg=dispatch(arg,&top));
      s(cmd);
    }else if(strncmp(arg1,"cc",2)==0) {
{'fraction_non_alphanumeric': 0.22669789227166276, 'fraction_numerical': 0.02271662763466042, 'mean_word_length': 3.683114035087719, 'pattern_counts': {'":': 0, '<': 3, '<?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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1732558', 'n_tokens_mistral': 1879, 'n_tokens_neox': 1854, 'n_words': 213}