1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2025-10-04 04:31:00 +00:00

vis/unvis: pull in exact implementation from FreeBSD

Perhaps this is not completely ideal, because it brings in cgo.
And with the flags, it can have tailored experience.

I've added a basic test to ensure that the cases we're interested in are
covered.

This does not yet integrate the usage of Vis()/Unviz() into the manifest
create and compare.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-07-20 14:58:48 -04:00 committed by Stephen Chung
parent cc939615c7
commit a63f83d94d
6 changed files with 649 additions and 0 deletions

15
unvis.go Normal file
View file

@ -0,0 +1,15 @@
package mtree
// #include "vis.h"
import "C"
import "fmt"
func Unvis(str string) (string, error) {
dst := new(C.char)
ret := C.strunvis(dst, C.CString(str))
if ret == 0 {
return "", fmt.Errorf("failed to encode string")
}
return C.GoString(dst), nil
}