#!/mod/bin/jimsh

package require cgi
source /mod/webif/lib/setup

source _lib.jim

cgi_input

httpheader

set file [cgi_get file "-"]
if {$file ni $loglist} {
	puts "$file is not a log file."
	exit
}

set action [cgi_get action -]

switch $action {
    clear {
        file copy -force "/dev/null" $file
        puts "Cleared $file"
        exit
    }
    unlink {
        file delete $file
        puts "Removed $file"
        exit
    }
}

puts "Unknown action."

