mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 14:50:56 +00:00
32 lines
452 B
Go
32 lines
452 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"io"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
buf := make([]byte, 4096)
|
|
var err error
|
|
for err == nil {
|
|
n, err := io.ReadFull(os.Stdin, buf)
|
|
if n > 0 {
|
|
buf = buf[:n]
|
|
repl := bytes.Replace(buf, []byte("\n"), []byte("\r\n"), -1)
|
|
_, err = os.Stdout.Write(repl)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
if err == io.EOF {
|
|
return
|
|
}
|
|
buf = buf[:cap(buf)]
|
|
}
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|