19 #include "file_operations.h"    24   { .onNo = cli_onNoMatch,
    25     .onFull = cli_onFullMatch,
    26     .onBeginOutput = cli_onBeginOutput,
    27     .onBetweenIndividualOutputs = cli_onBetweenIndividualOutputs,
    28     .onEndOutput = cli_onEndOutput,
    32 int matchCliFileWithLicenses(
MonkState* state, 
const Licenses* licenses, 
int argi, 
char** argv) {
    35   file.fileName = argv[argi];
    36   if (!readTokensFromFile(file.fileName, &(file.tokens), DELIMITERS))
    41   tokens_free(file.tokens);
    46 int handleCliMode(
MonkState* state, 
const Licenses* licenses, 
int argc, 
char** argv, 
int fileOptInd) {
    47 #ifdef MONK_MULTI_THREAD    52     MonkState* threadLocalState = &threadLocalStateStore;
    54 #ifdef MONK_MULTI_THREAD    55     #pragma omp for schedule(dynamic)    57     for (
int fileId = fileOptInd; fileId < argc; fileId++) {
    58       matchCliFileWithLicenses(threadLocalState, licenses, fileId, argv);
    66   if (state->verbosity >= 1) {
    67     printf(
"File %s contains license(s) No_license_found\n", file->fileName);
    70     printf(
"{\"type\":\"no-match\"}");
    77     printf(
"{\"type\":\"full\",\"license\":\"%s\",\"ref-pk\":%ld,\"matched\":\"%zu+%zu\"}",
    78            license->shortname, license->refId,
    79            matchInfo->text.start, matchInfo->text.length);
    81     printf(
"found full match between \"%s\" and \"%s\" (rf_pk=%ld); matched: %zu+%zu\n",
    82            file->fileName, license->shortname, license->refId,
    83            matchInfo->text.start, matchInfo->text.length);
    89   unsigned short rank = diffResult->percentual;
    91   char * formattedMatchArray = formatMatchArray(diffResult->matchedInfo);
    94     printf(
"{\"type\":\"diff\",\"license\":\"%s\",\"ref-pk\":%ld,\"rank\":%u,\"diffs\":\"%s\"}",
    95            license->shortname, license->refId,
    96            rank, formattedMatchArray);
    98     printf(
"found diff match between \"%s\" and \"%s\" (rf_pk=%ld); rank %u; diffs: {%s}\n",
    99            file->fileName, license->shortname, license->refId,
   101            formattedMatchArray);
   104   free(formattedMatchArray);
   109 int cli_onBeginOutput(
MonkState* state) {
   115 int cli_onBetweenIndividualOutputs(
MonkState* state) {
 
void matchFileWithLicenses(const string &sContent, unsigned long pFileId, CopyrightState const &state, int agentId, CopyrightDatabaseHandler &databaseHandler)
Scan a given file with all available scanners and save findings to database.