lib: implemement parsecmdlineargs

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
This commit is contained in:
Noah Watkins 2014-05-27 20:12:17 -07:00
parent bb67ba13a4
commit c995a1c1ec

15
conn.go
View File

@ -153,3 +153,18 @@ func (c *Conn) GetClusterStats() (stat ClusterStat, err error) {
}, nil
}
}
func (c *Conn) ParseCmdLineArgs(args []string) error {
argc := C.int(len(args))
argv := make([]*C.char, argc)
for i, arg := range args {
argv[i] = C.CString(arg)
defer C.free(unsafe.Pointer(argv[i]))
}
ret := C.rados_conf_parse_argv(c.cluster, argc, &argv[0])
if ret < 0 {
return RadosError(int(ret))
} else {
return nil
}
}