<commit_before>/*
 * PiFace
 * © 2013 <NAME>
 * This file is redistributable under the terms of the 3-clause BSD license.
 * See the file 'Copying' in the root of the distribution for the full text.
 */

#include "globals.h"

#define MAX_WORDS 32
static char* argv[MAX_WORDS];

static void help_cb(int argc, const char* argv[]);
static void set_cb(int argc, const char* argv[]);

static const struct command help_cmd =
{
	"help",
	"gets help on available commands",

	"On its own, lists the available PiFace commands; when used with an\n"
	"argument, shows more detailed information on one particular command.",

	help_cb
};

static const struct command set_cmd =
{
	"set",
	"sets, lists or unsets an environment variable",

	"To set one or more variables:\n"
	"  set NAME1=VALUE1 NAME2=VALUE2...\n"
	"\n"
	"To unset one or more variables:\n"
	"  set NAME1= NAME2=...\n"
	"\n"
	"To list all variables:\n"
	"  set\n"
	"\n"
	"(To set a variable to a value containing spaces, quote the argument.)",

	set_cb
};

static const struct command* commands[] =
{
	&help_cmd,
	&set_cmd,
	&send_cmd,
	&recv_cmd,
	&dump_cmd,
	&go_cmd,
	&poke_cmd,
};
#define NUM_COMMANDS sizeof(commands)/sizeof(*commands)

static void parse_buffer(char* buffer)
{
	int word = 0;
	char* inp = buffer;
	char* outp = buffer;
	int c;

	goto waitforword;

waitforword: /* skip whitespace leading up to new word */
	while (isspace(*inp))
		inp++;
	goto startword;

startword: /* start of new word; is this the end of string? */
	if (!*inp)<commit_msg>Disable recv, as it doesn't work yet.<commit_after>/*
 * PiFace
 * © 2013 <NAME>
 * This file is redistributable under the terms of the 3-clause BSD license.
 * See the file 'Copying' in the root of the distribution for the full text.
 */

#include "globals.h"

#define MAX_WORDS 32
static char* argv[MAX_WORDS];

static void help_cb(int argc, const char* argv[]);
static void set_cb(int argc, const char* argv[]);

static const struct command help_cmd =
{
	"help",
	"gets help on available commands",

	"On its own, lists the available PiFace commands; when used with an\n"
	"argument, shows more detailed information on one particular command.",

	help_cb
};

static const struct command set_cmd =
{
	"set",
	"sets, lists or unsets an environment variable",

	"To set one or more variables:\n"
	"  set NAME1=VALUE1 NAME2=VALUE2...\n"
	"\n"
	"To unset one or more variables:\n"
	"  set NAME1= NAME2=...\n"
	"\n"
	"To list all variables:\n"
	"  set\n"
	"\n"
	"(To set a variable to a value containing spaces, quote the argument.)",

	set_cb
};

static const struct command* commands[] =
{
	&help_cmd,
	&set_cmd,
	&send_cmd,
#if 0 /* doesn't work yet */
	&recv_cmd,
#endif
	&dump_cmd,
	&go_cmd,
	&poke_cmd,
};
#define NUM_COMMANDS sizeof(commands)/sizeof(*commands)

static void parse_buffer(char* buffer)
{
	int word = 0;
	char* inp = buffer;
	char* outp = buffer;
	int c;

	goto waitforword;

waitforword: /* skip whitespace leading up to new word */
	while (isspace(*inp))
		inp++;
	goto startword;

startword: /* start of new word; is this the end of string? */
	if (!*inp)
{'fraction_non_alphanumeric': 0.12419146183699871, 'fraction_numerical': 0.009379042690815007, 'mean_word_length': 3.9095238095238094, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1591191', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1087, 'n_words': 403}