<commit_before>#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif

#include <string.h>
#include <locale.h>
#include <limits.h>
#include <sys/stat.h>

#include "elm_prefs_cc.h"

int _elm_prefs_cc_log_dom = -1;
static void main_help(void);

Eina_Prefix *pfx = NULL;
char *file_in = NULL;
char *tmp_dir = NULL;
char *file_out = NULL;

static const char *progname = NULL;

static void
_elm_prefs_cc_log_cb(const Eina_Log_Domain *d,
                     Eina_Log_Level level,
                     const char *file,
                     const char *fnc,
                     int _line,
                     const char *fmt,
                     EINA_UNUSED void *data,
                     va_list args)
{
   if ((d->name) && (d->namelen == sizeof("elm_prefs_cc") - 1) &&
       (memcmp(d->name, "elm_prefs_cc", sizeof("elm_prefs_cc") - 1) == 0))
     {
        const char *prefix;

        eina_log_console_color_set(stderr, eina_log_level_color_get(level));
        switch (level)
          {
           case EINA_LOG_LEVEL_CRITICAL:
             prefix = "Critical. ";
             break;

           case EINA_LOG_LEVEL_ERR:
             prefix = "Error. ";
             break;

           case EINA_LOG_LEVEL_WARN:
             prefix = "Warning. ";
             break;

           default:
             prefix = "";
          }
        fprintf(stderr, "%s: %s", progname, prefix);
        eina_log_console_color_set(stderr, EINA_COLOR_RESET);

        vfprintf(stderr, fmt, args);
        putc('\n', stderr);
     }
   else
     eina_log_print_cb_stderr(d, level, file, fnc, _line, fmt, NULL, args);
}

static void
main_help(void)
{
   printf
     ("Usage:\n"
      "\t%s [OPTIONS] input_file.epc [output_file.epb]\n"
      "\n"
      "Where OPTIONS is one or more of:\n"
      "\n"
      "-v                       Verbose output\n"
     , progname);
}

int
main(int argc, char **argv)
{
   int i;
   struct stat st;
#ifdef HAVE_REALPATH
   char rpath[PATH_MAX], rpath2[PATH_MAX];
#endif

   setlocale(LC_NUMERIC, "C");

   if (!eina_init())
     return -1;

   _elm_prefs_cc_log_dom = eina_log_domain_register
       ("elm_prefs_cc", ELM_PREFS_CC_DEFAULT_LOG_COLOR);
   if (_elm_prefs_cc_log_dom < 0)
     {
        EINA_LOG_ERR("Unable to create a log domain.");
        exit(-1);
     }
   if (!eina_log_domain_level_check(_elm_prefs_cc_log_dom, EINA_LOG_LEVEL_WARN))
     eina_log_domain_level_set("elm_prefs_cc", EINA_LOG_LEVEL_WARN);

   progname = ecore_file_file_get(argv[0]);
   eina_log_print_cb_set(_elm_prefs_cc_log_cb, NULL);

   tmp_dir = getenv("TMPDIR");

   for (i = 1; i < argc; i++)
     {
        if (!strcmp(argv[i], "-h"))
          {
             main_help();
             exit(0);
          }
        else if (!strcmp(argv[i], "-v"))
          {
             eina_log_domain_level_set("elm_prefs_cc", EINA_LOG_LEVEL_INFO);
          }
        else if (!file_in)
          file_in = argv[i];
        else if (!file_out)<commit_msg>test: elm_prefs_cc - use eina_environment_tmp_get() instead of getenv("TMPDIR")<commit_after>#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif

#include <string.h>
#include <locale.h>
#include <limits.h>
#include <sys/stat.h>

#include "elm_prefs_cc.h"

int _elm_prefs_cc_log_dom = -1;
static void main_help(void);

Eina_Prefix *pfx = NULL;
char *file_in = NULL;
char *tmp_dir = NULL;
char *file_out = NULL;

static const char *progname = NULL;

static void
_elm_prefs_cc_log_cb(const Eina_Log_Domain *d,
                     Eina_Log_Level level,
                     const char *file,
                     const char *fnc,
                     int _line,
                     const char *fmt,
                     EINA_UNUSED void *data,
                     va_list args)
{
   if ((d->name) && (d->namelen == sizeof("elm_prefs_cc") - 1) &&
       (memcmp(d->name, "elm_prefs_cc", sizeof("elm_prefs_cc") - 1) == 0))
     {
        const char *prefix;

        eina_log_console_color_set(stderr, eina_log_level_color_get(level));
        switch (level)
          {
           case EINA_LOG_LEVEL_CRITICAL:
             prefix = "Critical. ";
             break;

           case EINA_LOG_LEVEL_ERR:
             prefix = "Error. ";
             break;

           case EINA_LOG_LEVEL_WARN:
             prefix = "Warning. ";
             break;

           default:
             prefix = "";
          }
        fprintf(stderr, "%s: %s", progname, prefix);
        eina_log_console_color_set(stderr, EINA_COLOR_RESET);

        vfprintf(stderr, fmt, args);
        putc('\n', stderr);
     }
   else
     eina_log_print_cb_stderr(d, level, file, fnc, _line, fmt, NULL, args);
}

static void
main_help(void)
{
   printf
     ("Usage:\n"
      "\t%s [OPTIONS] input_file.epc [output_file.epb]\n"
      "\n"
      "Where OPTIONS is one or more of:\n"
      "\n"
      "-v                       Verbose output\n"
     , progname);
}

int
main(int argc, char **argv)
{
   int i;
   struct stat st;
#ifdef HAVE_REALPATH
   char rpath[PATH_MAX], rpath2[PATH_MAX];
#endif

   setlocale(LC_NUMERIC, "C");

   if (!eina_init())
     return -1;

   _elm_prefs_cc_log_dom = eina_log_domain_register
       ("elm_prefs_cc", ELM_PREFS_CC_DEFAULT_LOG_COLOR);
   if (_elm_prefs_cc_log_dom < 0)
     {
        EINA_LOG_ERR("Unable to create a log domain.");
        exit(-1);
     }
   if (!eina_log_domain_level_check(_elm_prefs_cc_log_dom, EINA_LOG_LEVEL_WARN))
     eina_log_domain_level_set("elm_prefs_cc", EINA_LOG_LEVEL_WARN);

   progname = ecore_file_file_get(argv[0]);
   eina_log_print_cb_set(_elm_prefs_cc_log_cb, NULL);

   tmp_dir = eina_environment_tmp_get();

   for (i = 1; i < argc; i++)
     {
        if (!strcmp(argv[i], "-h"))
          {
             main_help();
             exit(0);
          }
        else if (!strcmp(argv[i], "-v"))
          {
             eina_log_domain_level_set("elm_prefs_cc", EINA_LOG_LEVEL_INFO);
          }
        else if (!file_in)
          file_in = argv[i];
        else if (!file_out)
{'fraction_non_alphanumeric': 0.11929356881039653, 'fraction_numerical': 0.0036654448517160947, 'mean_word_length': 2.1087519419989644, 'pattern_counts': {'":': 0, '<': 15, '<?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': '5411860', 'n_tokens_mistral': 2201, 'n_tokens_neox': 2131, 'n_words': 425}