void _installYodl2(string where)
{
    list conversions;
    int idx;
    
    conversions = strtok(STD_CONVERSIONS, " ");
    
    for (idx = sizeof(conversions); idx--; )
        run("ln -sf yodl2whatever " + where + BIN + "/yodl2" +
                                                    conversions[idx]); 

    run("chmod +x " + where + BIN +  "/yodl2*");
}

void _installYodlConverters(string where)
{
    list conversions;
    int idx;
    
    conversions = (list)"whatever" + strtok(STD_CONVERSIONS, " ");
    
    for (idx = sizeof(conversions); idx--; )
        run("ln -sf yodlconverters.1 " + where + MAN + "/man1/yodl2" +
            conversions[idx] + ".1");
}

void installExit(string what, string where)
{
    if (what == "programs")
    {
        md(where + BIN);
        run("cp " + g_install + BIN + "/* " + where + BIN);
        run("chmod +x " + where + BIN +  "/yodlstriproff");
        _installYodl2(where);

        exit(0);
    }

    if (what == "yodl")
    {
        md(where + BIN);
        run("cp " + g_install + BIN + "/yodl " + where + BIN);
        exit(0);
    }

    if (what == "yodlpost")
    {
        md(where + BIN);
        run("cp " + g_install + BIN + "/yodlpost " + where + BIN);
        exit(0);
    }

    if (what == "yodlverbinsert")
    {
        md(where + BIN);
        run("cp " + g_install + BIN + "/yodlverbinsert " + where + BIN);
        exit(0);
    }

    if (what == "yodlstriproff")
    {
        md(where + BIN);
        run("cp " + g_install + BIN + "/yodlstriproff " + where + BIN);
        run("chmod +x " + where + BIN +  "/yodlstriproff");
        exit(0);
    }

    if (what == "yodl2whatever")
    {
        md(where + BIN);
        run("cp " + g_install + BIN + "/yodl2whatever " + where + BIN);

        _installYodl2(where);        
        exit(0);
    }

    if (what == "man")
    {
        md(where + MAN);
        run("cp -r " + g_install + MAN + "/* " + where + MAN);
        _installYodlConverters(where);
        exit(0);
    }

    if (what == "manual")
    {
        md(where + DOCDOC);
        run("cp -r " + g_install + DOCDOC + "/* " + where + DOCDOC);
        run("cp  AUTHORS.txt CHANGES changelog " + where + DOCDOC);
        exit(0);
    }

    if (what == "macros")
    {
        md(where + STD_INCLUDE);
        run("cp -r " + g_install + STD_INCLUDE + "/* " + where + STD_INCLUDE);
        exit(0);
    }

    if (what == "docs")
    {
        md(where + DOC);
        run("cp  AUTHORS.txt CHANGES changelog " + where + DOC);
        exit(0);
    }
}
