Init commit.
+The simplest 'echo' realisation added.
This commit is contained in:
parent
4d39653d68
commit
277a997113
2 changed files with 27 additions and 0 deletions
5
newnix/README.txt
Normal file
5
newnix/README.txt
Normal 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
22
newnix/echo/main.go
Normal 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,)
|
||||
}
|
Loading…
Reference in a new issue