From 6967788eb4ffff49269dbf5bda81cef62df8a7c6 Mon Sep 17 00:00:00 2001 From: Daniel Whitenack Date: Sun, 19 Jun 2016 21:01:28 -0500 Subject: [PATCH] modify structure of bindings --- src/gethdep.go | 7 +++---- src/library.c | 5 ----- src/library.go | 16 +++------------- 3 files changed, 6 insertions(+), 22 deletions(-) delete mode 100644 src/library.c diff --git a/src/gethdep.go b/src/gethdep.go index e90b99c31..c67bc4a58 100644 --- a/src/gethdep.go +++ b/src/gethdep.go @@ -5,7 +5,6 @@ import ( "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/node" - "github.com/urfave/cli" ) var ( @@ -13,13 +12,13 @@ var ( scryptP = 1 ) -func createAccount(c *cli.Context) error { +func createAccount(password, keydir string) error { var sync *[]node.Service w := true - accman := accounts.NewManager(c.String("keydir"), scryptN, scryptP, sync) + accman := accounts.NewManager(keydir, scryptN, scryptP, sync) - account, err := accman.NewAccount(c.String("password"), w) + account, err := accman.NewAccount(password, w) if err != nil { return err } diff --git a/src/library.c b/src/library.c deleted file mode 100644 index 9a04c9f28..000000000 --- a/src/library.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "_cgo_export.h" - -int runCreateAccount(const char* args) { - return doRunCreateAccount((char*)args); -} diff --git a/src/library.go b/src/library.go index e223c68cb..c10eb93fb 100644 --- a/src/library.go +++ b/src/library.go @@ -1,26 +1,16 @@ package main -// #ifdef __cplusplus -// extern "C" { -// #endif -// -// extern int runCreateAccount(const char*); -// -// #ifdef __cplusplus -// } -// #endif import "C" import ( "fmt" "os" - "strings" ) -//export doRunCreateAccount -func doRunCreateAccount(args *C.char) C.int { +//export doCreateAccount +func doCreateAccount(password, keydir *C.char) C.int { // This is equivalent to creating an account from the command line, // just modified to handle the function arg passing - if err := app.Run(strings.Split("statusgo "+C.GoString(args), " ")); err != nil { + if err := createAccount(C.GoString(password), C.GoString(keydir)); err != nil { fmt.Fprintln(os.Stderr, err) return -1 }