@tools.dpuser

function fixpgplot, current {
    fixpgplot = stringarray(0)
    n = 1
    while (strpos(current[n], "<table CELLSPACING=0") == -1) {
        fixpgplot += current[n]
        n++
    }
    n += 2
    fixpgplot += "
" + current[n] + "
"
    n += 2
    while (n <= nelements(current)) {
        fixpgplot += current[n]
        n++
    }
}

files = ["index.html","history.html","syntax.html","operators.html","ifandloop.html","variables.html","plotting.html","fitsfiles.html","bridges.html","category.html","functions.html","procedures.html","pgplot.html","examples.html"]
curdir = pwd()
cd ".."
files += dir("function_*.html")
files += dir("procedure_*.html")
files += dir("pgplot_*.html")
cd curdir

style = import("style.html", /text);

for n=1, nelements(files) {
    print files[n]
    content = import("../" + files[n], /text)
    if (strpos(files[n], "pgplot_") != -1) content = fixpgplot(content)
    output = stringarray(0)
    j = 1
    while (strpos(content[j], "") == -1) {
        output += content[j]
        j++
    }
    output += style
    while (strpos(content[j], "<h1") == -1) {
        output += content[j]
        j++
    }
    output += menu(html_header(), files[n])
    while (strpos(content[j], "") == -1) {
        output += content[j]
        j++
    }
    output += footer()
    while (j <= nelements(content)) {
        output += content[j]
        j++
    }
    export files[n], output
}

exec "cp ../*.png ."

output = stringarray(0)
output += ""
output += ""
output += "DPUSER Search Results"
output += style
output += ""
output += ""
output += ""
output += menu(html_header(), "nix.html")
output += "
Search Results
"
output += "
"

output += ""

output += "This search was created by &copy Satadip Dutta 1997"
output += "
"
output += footer()
output += ""
output += ""
export "search.html", output
