#include "head.h"

int main(int argc, char *argv[]){
    setlocale(LC_ALL, "");

    if(argc < 2){
        printf("Not enough arguments. (-help)\n");
        return 1;
    }

    int query[QUERYMAX];
    int assist[QUERYMAX];
    int inquery;
    int x[XMAX];
    for (int i = 0;i<XMAX;i++)x[i]=0;
    for (int i = 0;i<QUERYMAX;i++)assist[i]=0;


    if(str(argv[1],"-help")||str(argv[1],"-h")){
        printf("\nHelpMenu");
        printf("\n\tprog [arg1] [arg2] [arg3]");
        printf("\n\t[arg1] - Block of func");
        printf("\n\t[arg2] - Func num");
        printf("\n\t[arg3] - Func input");
        return 0;
    }

    if (argc < 3){
        printf("Not enough arguments. (-help)\n");
        return 1;
    }

    int swt=0;
    if(((int)*argv[1])>='1' && ((int)*argv[1])<='3'){
        swt = ((int)*argv[1]) - '0';
    }
    else{
        printf("Wrong [arg1]\n");
        return 1;
    }

    if(((int)*argv[2])>='0' && ((int)*argv[2])<='9'){
        switch(swt){
            case 1:
                while(queryinput(x,&inquery,query)!=-1)
                    func1(argv,x,inquery,query);
                x[32]=1;
                func1(argv,x,inquery,query);
                break;
            case 2:
                while(queryinput(x,&inquery,query)!=-1)
                    func2(argv,x,inquery,query,assist);
                x[32]=1;
                func2(argv,x,inquery,query,assist);
                break;
            case 3:
                while(queryinput(x,&inquery,query)!=-1)
                    func3(argv,x,inquery,query);
                break;
        }
        printcount(x);
    }
    else{
        printf("Wrong [arg2]\n");
        return 1;
    }

    return 0;
}
