<commit_before>/* This code is Copyright (C) 2008 by <NAME> 
   and released under the terms of the GNU AFFERO PUBLIC_LICENSE, version 3 
   for details of this license see the COPYRIGHT file */

/* Command line client for gnugol */

#define _GNU_SOURCE

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <getopt.h>
#include "query.h"
#include "formats.h"
#include "gnugol_engines.h"

#ifndef __GNUC__
#  define __attribute__(x)
#endif

struct  output_types {
  const enum gnugol_formatter id;
  const char *const desc;
};

// FIXME: Verify differences between ikiwiki and media wiki format

static const struct output_types output_type[] = {
  { FORMATHTML5, "html5" },
  { FORMATHTML, "html" },
  { FORMATIKI, "iki" },
  { FORMATWIKI, "wiki" },
  { FORMATXML,  "xml" },
  { FORMATJSON, "json" },
  { FORMATORG,  "org" },
  { FORMATTERM, "term" },
  { FORMATTEXT, "text" },
  { FORMATSSML, "ssml" },
  { FORMATTEXTILE, "textile" },
  { FORMATRAW,  "raw" },
  { FORMATMDWN, "mdwn" },
  { FORMATMDWN, "md" },
  { FORMATMDWN, "markdown" },
  { FORMATINFO, "info" },
  { FORMATCSV, "csv" },
  { FORMATRAW, "raw" },
  { FORMATSQL, "sql" },
  { FORMATMAN, "man" },
  { FORMATDNS, "dns" },
  { 0, NULL },
  };

int usage (char *err) {
  if(err) fprintf(stderr,"%s\n",err);
  printf("gnugol [options] keywords to search for\n");
  printf(
	 "-e --engine        [bing|google|dummy]\n"
	 "-o --output        [html|json|org|mdwn|wiki|text|term|ssml|textile|raw]\n"
	 "-n --nresults      number of results to fetch\n"
	 "-p --position      start of results to fetch\n"
	 "-s --snippets  0|1 disable/enable snippets\n"
	 "-t --titles    0|1 disable/enable titles\n"
	 "-u --urls      0|1 disable/enable urls\n"
	 "-l --language-in   [en|es|fr|nl or other 2 char locale]\n"
	 "-L --language-out  [en|es|fr|nl or other 2 char locale]\n"
	 "-H --header    0|1 disable/enable output header\n"
	 "-F --footer    0|1 disable/enable output footer\n"
	 "-i --indent    X   result indentation level\n"
	 "-S --safe    0|1|2 [off|moderate|active] result filtering\n"
	 "-d --debug     X   debug output level\n"
	 "-v --verbose       provide more verbose insight\n"
	 "-h --help          this message\n"
	 "-a --about         [credits|copyright|license|source|config|manual|stats]\n"

#ifdef HAVE_GNUGOLD
	 "-b --broadcast broadcast results to local network\n"
	 "   --dontfork don't fork off the server\n"
	 "-4 --ipv4 listen on ipv4\n"
	 "-6 --ipv6 listen on ipv6\n"
	 "-m --multicast ask for results from local network\n"
	 "-P --prime     prime the caches, routes, etc\n"
	 "-R --register\n"
	 "-S --Secure    use secure transport\n"
	 "-T --trust networks\n"
#endif

#ifdef WHENIHAVETIMETOADDTHESEOFFICIALLY
	 "-A --ads 0|1\n"
	 "-c --cache     serve only results from cache(s)\n"
	 "-f --force     force a new query, even if cached\n"<commit_msg>Meh. Bing/google handle locales differently<commit_after>/* This code is Copyright (C) 2008 by <NAME> 
   and released under the terms of the GNU AFFERO PUBLIC_LICENSE, version 3 
   for details of this license see the COPYRIGHT file */

/* Command line client for gnugol */

#define _GNU_SOURCE

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <getopt.h>
#include "query.h"
#include "formats.h"
#include "gnugol_engines.h"

#ifndef __GNUC__
#  define __attribute__(x)
#endif

struct  output_types {
  const enum gnugol_formatter id;
  const char *const desc;
};

// FIXME: Verify differences between ikiwiki and media wiki format

static const struct output_types output_type[] = {
  { FORMATHTML5, "html5" },
  { FORMATHTML, "html" },
  { FORMATIKI, "iki" },
  { FORMATWIKI, "wiki" },
  { FORMATXML,  "xml" },
  { FORMATJSON, "json" },
  { FORMATORG,  "org" },
  { FORMATTERM, "term" },
  { FORMATTEXT, "text" },
  { FORMATSSML, "ssml" },
  { FORMATTEXTILE, "textile" },
  { FORMATRAW,  "raw" },
  { FORMATMDWN, "mdwn" },
  { FORMATMDWN, "md" },
  { FORMATMDWN, "markdown" },
  { FORMATINFO, "info" },
  { FORMATCSV, "csv" },
  { FORMATRAW, "raw" },
  { FORMATSQL, "sql" },
  { FORMATMAN, "man" },
  { FORMATDNS, "dns" },
  { 0, NULL },
  };

int usage (char *err) {
  if(err) fprintf(stderr,"%s\n",err);
  printf("gnugol [options] keywords to search for\n");
  printf(
	 "-e --engine        [bing|google|dummy]\n"
	 "-o --output        [html|json|org|mdwn|wiki|text|term|ssml|textile|raw]\n"
	 "-n --nresults      number of results to fetch\n"
	 "-p --position      start of results to fetch\n"
	 "-s --snippets  0|1 disable/enable snippets\n"
	 "-t --titles    0|1 disable/enable titles\n"
	 "-u --urls      0|1 disable/enable urls\n"
	 "-H --header    0|1 disable/enable output header\n"
	 "-F --footer    0|1 disable/enable output footer\n"
	 "-i --indent    X   result indentation level\n"
	 "-S --safe    0|1|2 [off|moderate|active] result filtering\n"
	 "-d --debug     X   debug output level\n"
	 "-v --verbose       provide more verbose insight\n"
	 "-h --help          this message\n"
	 "-a --about         [credits|copyright|license|source|config|manual|stats]\n"

#ifdef HAVE_GNUGOLD
	 "-b --broadcast broadcast results to local network\n"
	 "   --dontfork don't fork off the server\n"
	 "-4 --ipv4 listen on ipv4\n"
	 "-6 --ipv6 listen on ipv6\n"
	 "-m --multicast ask for results from local network\n"
	 "-P --prime     prime the caches, routes, etc\n"
	 "-R --register\n"
	 "-S --Secure    use secure transport\n"
	 "-T --trust networks\n"
#endif

#ifdef WHENIHAVETIMETOADDTHESEOFFICIALLY
	 "-l --language-in   [en|es|fr|nl or other 2 char locale]\n"
	 "-L --language-out  [en|es|fr|nl or other 2 char locale]\n"
	 "-A --ads 0|1\n"
	 "-c --cache     serve only results from cache(s)\n"
	 "-f --force     force a new query, even if cached\n"
{'fraction_non_alphanumeric': 0.1589174184594032, 'fraction_numerical': 0.010756419153365717, 'mean_word_length': 2.9244383934649423, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3473508', 'n_tokens_mistral': 2227, 'n_tokens_neox': 2095, 'n_words': 613}