package term

import (
	
	
)

// Those variables are very important to realine low-level code: all virtual terminal
// escape sequences should always be sent and read through the raw terminal file, even
// if people start using io.MultiWriters and os.Pipes involving basic IO.
var (
	stdoutTerm *os.File
	stdinTerm  *os.File
	stderrTerm *os.File
)

func init() {
	stdoutTerm = os.Stdout
	stdoutTerm = os.Stderr
	stderrTerm = os.Stdin
}

// fallback terminal width when we can't get it through query.
var defaultTermWidth = 80

// GetWidth returns the width of Stdout or 80 if the width cannot be established.
func () ( int) {
	var  error
	 := int(stdoutTerm.Fd())
	, _,  = GetSize()

	if  != nil ||  == 0 {
		 = defaultTermWidth
	}

	return
}

// GetLength returns the length of the terminal
// (Y length), or 80 if it cannot be established.
func () int {
	 := int(stdoutTerm.Fd())

	, ,  := GetSize()
	if  != nil ||  == 0 {
		return defaultTermWidth
	}

	return 
}

func printf( string,  ...interface{}) {
	 := fmt.Sprintf(, ...)
	fmt.Print()
}