void pspdf(string basename)
{
    string pdfname;
    string psname;
    string papersizeoption = "a4";

    psname = basename + ".ps";
    if (basename + ".dvi" younger psname)
        system("dvips -t " + papersizeoption + " -o" + psname + " " + basename);

    pdfname = basename + ".pdf";

    system("ps2pdf -sPAPERSIZE=" + papersizeoption + " " + psname + " " +
            pdfname);

    chdir(g_cwd);
}
