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

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

void _installYodlConverters(string where, int debian)
{
    list conversions;
    int idx;
    
    conversions = (list)"whatever" + strtok(STD_CONVERSIONS, " ");

    string gzipped;
   
    if (debian == 1)
        gzipped = ".1.gz ";
    else
        gzipped = ".1 ";

    for (idx = listlen(conversions); idx--; )
        run("ln -sf yodlconverters" + gzipped + 
            where + MAN + "/man1/yodl2" + conversions[idx] + gzipped);
}

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);
    }

    int debian = 0;
    
    if (what == "mandeb")
    {
        debian = 1;
        what = "man";
    }
         
    if (what == "man")
    {
        md(where + MAN);
        run("cp -r " + g_install + MAN + "/* " + where + MAN);
        _installYodlConverters(where, debian);  // debian: .gz links to
                                                // yodlconverters.1.gz
        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);
    }
}
