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