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 }