From f3a63fb85bb938dcb52215057206915c23c51296 Mon Sep 17 00:00:00 2001 From: k1574 Date: Sun, 30 Aug 2020 02:46:11 +0500 Subject: [PATCH] pin: simple implementation added. --- main.go | 2 ++ pin/pin.go | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 pin/pin.go diff --git a/main.go b/main.go index 9a4885f..b5680e3 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ import( "fmt" "os" "github.com/k1574/utf8tmpl/tmpl" + "github.com/k1574/utf8tmpl/pin" ) func main() { @@ -15,6 +16,7 @@ func main() { utilsMap := map[string] interface{} { "tmpl" : tmpl.Run, + "pin" : pin.Run, } if len(os.Args)<2 { diff --git a/pin/pin.go b/pin/pin.go new file mode 100644 index 0000000..f6ade11 --- /dev/null +++ b/pin/pin.go @@ -0,0 +1,67 @@ +package pin + +import( + "os" + "fmt" + "strconv" + "log" +) + +var( + arg0 string + delim rune = '\n' + status int = 0 +) + + +func +usage() { + fmt.Fprintf(os.Stderr, "usage: %s [n_utf8_chars] [len]\n", arg0) + os.Exit(1) +} + +func +Pow(x, p int) int { + ret := 1 + for i:=0 ; i