mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 03:18:59 +00:00
Portable new line converter
This commit is contained in:
parent
3f791b57ce
commit
c64321df47
3
build.sh
3
build.sh
@ -75,8 +75,7 @@ zipDist() {
|
|||||||
rm -rf "$name"
|
rm -rf "$name"
|
||||||
mkdir -p "$name"
|
mkdir -p "$name"
|
||||||
for f in "${distFiles[@]}" ; do
|
for f in "${distFiles[@]}" ; do
|
||||||
sed 's/$/
|
GOARCH="" GOOS="" go run cmd/todos/main.go < "$f" > "$name/$f.txt"
|
||||||
/' < "$f" > "$name/$f.txt"
|
|
||||||
done
|
done
|
||||||
cp syncthing.exe "$name"
|
cp syncthing.exe "$name"
|
||||||
sign "$name/syncthing.exe"
|
sign "$name/syncthing.exe"
|
||||||
|
31
cmd/todos/main.go
Normal file
31
cmd/todos/main.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
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)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user