Init commit.

+The simplest 'echo' realisation added.
This commit is contained in:
jienfak 2019-09-24 22:19:01 +05:00
parent 4d39653d68
commit 277a997113
2 changed files with 27 additions and 0 deletions

5
newnix/README.txt Normal file
View file

@ -0,0 +1,5 @@
New implementations with no dependence
on POSIX and other old shit.
There are too many stupid things
on options to put all of this in
one implementation only.

22
newnix/echo/main.go Normal file
View file

@ -0,0 +1,22 @@
/* Simple 'echo' implementation. */
package main
import (
"fmt"
"strings"
"os"
)
func main() {
strsId := 1
firstOpt := os.Args[strsId]
nextLineStr := "\n"
joinStr := " "
if firstOpt == "-n" {
nextLineStr = ""
strsId += 1
}
fmt.Printf("%s%s",
strings.Join(os.Args[strsId:], joinStr),
nextLineStr,)
}