func TrzszMain() int {
	// parse command line arguments
	parseTrzszArgs()
	if gTrzszArgs.Help {
		printHelp()
		return 0
	}
	if gTrzszArgs.Version {
		printVersion()
		return 0
	}

	// spawn a pty
	pty, err := Spawn(gTrzszArgs.Name, gTrzszArgs.Args...)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return -1
	}
	defer func() { pty.Close() }()

	// set stdin in raw mode
	state, err := term.MakeRaw(int(os.Stdin.Fd()))
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return -2
	}
	defer func() { _ = term.Restore(int(os.Stdin.Fd()), state) }()

	// wrap input and output
	go wrapInput(pty)
	go wrapOutput(pty)

	// handle signal
	go handleSignal(pty)

	// wait for exit
	pty.Wait()
	return pty.ExitCode()
}
// TrzszMain entry of trzsz client
TrzszMain entry of trzsz client
// TrzszMain entry of trzsz client
func TrzszMain() int {
	parseTrzszArgs()
	if gTrzszArgs.Help {
		printHelp()
		return 0
	}
	if gTrzszArgs.Version {
		printVersion()
		return 0
	}
	pty, err := Spawn(gTrzszArgs.Name, gTrzszArgs.Args...)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return -1
	}
	defer func() { pty.Close() }()
	state, err := term.MakeRaw(int(os.Stdin.Fd()))
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return -2
	}
	defer func() { _ = term.Restore(int(os.Stdin.Fd()), state) }()
	go wrapInput(pty)
	go wrapOutput(pty)
	go handleSignal(pty)
	pty.Wait()
	return pty.ExitCode()
}
func TrzszMain ( ) int { parseTrzszArgs ( ) if gTrzszArgs . Help { printHelp ( ) return 0 } if gTrzszArgs . Version { printVersion ( ) return 0 } pty , err := Spawn ( gTrzszArgs . Name , gTrzszArgs . Args ... ) if err != nil { fmt . Fprintln ( os . Stderr , err ) return - 1 } defer func ( ) { pty . Close ( ) } ( ) state , err := term . MakeRaw ( int ( os . Stdin . Fd ( ) ) ) if err != nil { fmt . Fprintln ( os . Stderr , err ) return - 2 } defer func ( ) { _ = term . Restore ( int ( os . Stdin . Fd ( ) ) , state ) } ( ) go wrapInput ( pty ) go wrapOutput ( pty ) go handleSignal ( pty ) pty . Wait ( ) return pty . ExitCode ( ) }
TrzszMain entry of trzsz client
TrzszMain entry of trzsz client
// parse command line arguments // spawn a pty // set stdin in raw mode // wrap input and output // handle signal // wait for exit