TABLE OF CONTENTS


::pwtk::backup_io

SYNOPSIS

proc ::pwtk::backup_io {{flag {}}} {

ARGUMENTS

PURPOSE

Either query or set (turn on/off) the I/O backup machinery, depending on the value of flag.

When backup is turned on and PWTK is to write to an input or output file that already exists then a backup copy of file will be made before the PWTK overwrites it.

SOURCE

    variable state

    if { $flag != "" } {
        # e.g., .true. --> true
        set flag [string trim $flag .]
        
        if { ! [string is boolean $flag] } {
            ::pwtk::error "wrong value of flag \"$flag\"$, must be boolean" 1
        }
        set state(backup_io) [::pwtk::is_true $flag]

        if { $state(backup_io) } {
            ::pwtk::print "I/O backup is ON\n"
        } else {
            ::pwtk::print "I/O backup is OFF\n"
        }
    }
    return $state(backup_io)
}