#include <stdlib.h>
#include <locale.h>

#include "Suffle.h"
#include "Errors.h"

int main(int argc, char *argv[])
{
    int nreducers = 1;

    if (argc > 2) {
        Error("[WordCountSuffle] Usage: WordCountSuffle [nreducers]");
    }

    if (argc == 2) {
        nreducers = atoi(argv[1]);
    }

    if (nreducers < 1 || nreducers > DMAX_REDUCERS) {
        Error("[WordCountSuffle] Invalid number of reducers");
    }

    setlocale(LC_ALL, "");
    wordcount_suffle(1, nreducers);

    return 0;
}
