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

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

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

    if (argc != 3) {
        Error("[WordCountSuffle] Usage: WordCountSuffle <nmappers> <nreducers>");
    }

    nmappers = atoi(argv[1]);
    nreducers = atoi(argv[2]);

    if (nmappers < 1 || nmappers > DMAX_FILES) {
        Error("[WordCountSuffle] Invalid number of mappers");
    }

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

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

    return 0;
}
