<commit_before>#define _USE_XOPEN /* for strdup() */
#include <stdio.h>
#include <string.h>

#include <barrelfish/barrelfish.h>
#include <barrelfish/cpu_arch.h> // for CURRENT_CPU_TYPE
#include <barrelfish/spawn_client.h>

#include <spawndomain/spawndomain.h>
#include <vfs/vfs.h>

#include "kaluga.h"
#include "debug.h"

#define MAX_DRIVER_MODULES 128

extern char **environ;

static struct module_info modules[MAX_DRIVER_MODULES];

inline bool is_auto_driver(struct module_info* mi) {
    return strcmp(mi->argv[1], "auto") == 0;
}

inline bool is_started(struct module_info* mi)
{
    return mi->did > 0;
}

void set_start_function(char* binary, module_start_fn start_fn)
{
    struct module_info* mi = find_module(binary);<commit_msg>kaluga: don't crash if a module exists with no arguments<commit_after>#define _USE_XOPEN /* for strdup() */
#include <stdio.h>
#include <string.h>

#include <barrelfish/barrelfish.h>
#include <barrelfish/cpu_arch.h> // for CURRENT_CPU_TYPE
#include <barrelfish/spawn_client.h>

#include <spawndomain/spawndomain.h>
#include <vfs/vfs.h>

#include "kaluga.h"
#include "debug.h"

#define MAX_DRIVER_MODULES 128

extern char **environ;

static struct module_info modules[MAX_DRIVER_MODULES];

inline bool is_auto_driver(struct module_info* mi) {
    return mi->argc > 1 && strcmp(mi->argv[1], "auto") == 0;
}

inline bool is_started(struct module_info* mi)
{
    return mi->did > 0;
}

void set_start_function(char* binary, module_start_fn start_fn)
{
    struct module_info* mi = find_module(binary);
{'fraction_non_alphanumeric': 0.12964169381107493, 'fraction_numerical': 0.008469055374592834, 'mean_word_length': 5.481012658227848, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, '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': '7429378', 'n_tokens_mistral': 597, 'n_tokens_neox': 575, 'n_words': 130}