From 4574bf7d0c75e4a950b179e6fafdb4b346dddf12 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 24 Apr 2018 23:42:42 +0200 Subject: [PATCH] [cmd.client] fixed standard inverted output/input --- src/git.xdrm.io/schastsp/cmd/client/client.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/git.xdrm.io/schastsp/cmd/client/client.go b/src/git.xdrm.io/schastsp/cmd/client/client.go index df1ddec..82cfba2 100644 --- a/src/git.xdrm.io/schastsp/cmd/client/client.go +++ b/src/git.xdrm.io/schastsp/cmd/client/client.go @@ -45,11 +45,11 @@ func main(){ ---------------------------------------------------------*/ /* (1) Create context */ ctx, err := context.Create( float64(*winSize) / 1e3, uint16(*minDepth), uint16(*thrDepth), uint16(*maxDepth) ); - if err != nil { os.Stderr.WriteString( fmt.Sprintf("[ERROR:context] %s\n", err) ); return } + if err != nil { os.Stderr.WriteString( fmt.Sprintf("[CLIENT_ERROR:context] %s\n", err) ); return } /* (2) Create client */ cli, err := client.New(ctx, *clientConfigPath) - if err != nil { os.Stderr.WriteString( fmt.Sprintf("[ERROR:client] %s\n", err) ); return } + if err != nil { os.Stderr.WriteString( fmt.Sprintf("[CLIENT_ERROR:client] %s\n", err) ); return } @@ -62,14 +62,14 @@ func main(){ /* (2) If request */ } else if *isRequest { - err = cli.Send(os.Stdin) - if err != nil { os.Stderr.WriteString( fmt.Sprintf("[ERROR:request] %s\n", err) ) } + err = cli.Send(os.Stdout) + if err != nil { os.Stderr.WriteString( fmt.Sprintf("[CLIENT_ERROR:request] %s\n", err) ) } /* (3) If response */ } else if *isResponse { - err = cli.Receive(os.Stdout) - if err != nil { os.Stderr.WriteString( fmt.Sprintf("[ERROR:response] %s\n", err) ); return } + err = cli.Receive(os.Stdin) + if err != nil { os.Stderr.WriteString( fmt.Sprintf("[CLIENT_ERROR:response] %s\n", err) ); return } /* (4) Else -> nothing */ }else { @@ -101,7 +101,7 @@ func synchronisationRequest(cli *client.T){ /* (1) Get synchronisation key */ syncKey, err := cli.SynchronisationKey() - if err != nil { fmt.Errorf("[ERROR:syncKey] %s\n", err); return } + if err != nil { fmt.Errorf("[CLIENT_ERROR:syncKey] %s\n", err); return } /* (2) Print synchronisation key */ os.Stdout.Write(syncKey)