<commit_before>
#include <iostream>

#include "storage/Storage.h"
#include "storage/Environment.h"
#include "storage/Devicegraph.h"


using namespace std;
using namespace storage;


int
main()
{
    Environment environment(true, ProbeMode::STANDARD_WRITE_MOCKUP, TargetMode::DIRECT);
    environment.set_mockup_filename("probe1-mockup.xml");

    Storage storage(environment);

    const Devicegraph* probed = storage.get_probed();

    cout << *probed << endl;

    probed->check();
    probed->write_graphviz("probe1.gv");
    probed->save("probe1-devicegraph.xml");
}<commit_msg>- added options to example probe program<commit_after>
#include <stdlib.h>
#include <getopt.h>
#include <iostream>

#include "storage/Storage.h"
#include "storage/Environment.h"
#include "storage/Devicegraph.h"


using namespace std;
using namespace storage;


bool display_devicegraph = false;
bool save_devicegraph = false;
bool save_mockup = false;


void
doit()
{
    Environment environment(true, save_mockup ? ProbeMode::STANDARD_WRITE_MOCKUP : ProbeMode::STANDARD,
			    TargetMode::DIRECT);

    environment.set_mockup_filename("probe1-mockup.xml");

    Storage storage(environment);

    const Devicegraph* probed = storage.get_probed();

    cout << *probed << endl;

    probed->check();

    if (save_devicegraph)
	probed->save("probe1-devicegraph.xml");

    if (display_devicegraph)
    {
	probed->write_graphviz("probe1.gv");
	system("dot -Tpng < probe1.gv > probe1.png");
	system("display probe1.png");
    }
}


void usage() __attribute__ ((__noreturn__));

void
usage()
{
    cerr << "probe1 [--display-devicegraph] [--save-devicegraph] [--save-mockup]" << endl;
    exit(EXIT_FAILURE);
}


int
main(int argc, char **argv)
{
    const struct option options[] = {
	{ "display-devicegraph",	no_argument,	0,	1 },
	{ "save-devicegraph",		no_argument,	0,	2 },
	{ "save-mockup",		no_argument,	0,	3 },
	{ 0, 0, 0, 0 }
    };

    while (true)
    {
	int option_index = 0;
	int c = getopt_long(argc, argv, "", options, &option_index);
	if (c == -1)
	    break;

	if (c == '?')
	    usage();

	switch (c)
	{
	    case 1:
		display_devicegraph = true;
		break;

	    case 2:
		save_devicegraph = true;
		break;

	    case 3:
		save_mockup = true;
		break;

	    default:
		usage();
	}
    }

    if (optind < argc)
	usage();

    doit();

    exit(EXIT_SUCCESS);
}
{'fraction_non_alphanumeric': 0.14813242784380307, 'fraction_numerical': 0.010611205432937181, 'mean_word_length': 3.723446893787575, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '3664450', 'n_tokens_mistral': 880, 'n_tokens_neox': 824, 'n_words': 180}