Port config package

This commit is contained in:
2026-01-31 21:04:19 -05:00
parent 5ae7b41d76
commit 4ea47594ae
3 changed files with 22 additions and 5 deletions
+16
View File
@@ -47,3 +47,19 @@ func FreeArray(items *C.PascalString, count C.int) {
}
C.free(unsafe.Pointer(items))
}
// safeStringDeref safely dereferences a string pointer, returning empty string if nil.
func safeStringDeref(s *string) string {
if s == nil {
return ""
}
return *s
}
// safeBoolDeref safely dereferences a bool pointer, returning false if nil.
func safeBoolDeref(b *bool) bool {
if b == nil {
return false
}
return *b
}
+5 -4
View File
@@ -9,7 +9,7 @@ to export to C.
### Building
`go build -buildmode=c-archive`.
### Functions
All relevant exported libmutton functions have C functions of the same name.
All relevant exported libmutton functions have C counterparts with similar names.
Functions with multiple return values all have CGO-generated structs to store the return values.
These structs are named `<FunctionName>_return`, as per CGO.
All functions perform similar basic operations, with a couple caveats:
@@ -75,9 +75,9 @@ int main() {
- [ ] CopyString(clearClipboardAutomatically bool, copySubject string) error
- [ ] LaunchClearProcess(copySubject string)
- [ ] TOTPCopier(secret string, errorChan chan<- error, done <-chan bool)
- [ ] config
- [ ] Write(cfg *CfgT, appendMode bool) error
- [ ] Load() (*CfgT, error)
- [X] config
- [X] Write(cfg *CfgT, appendMode bool) error
- [X] Load() (*CfgT, error)
- [ ] core
- [ ] EntryAddPrecheck(realPath string) (uint8, error)
- [ ] EntryIsNotEmpty(entryData []string) bool
@@ -86,6 +86,7 @@ int main() {
- [ ] GetOldEntryData(realPath string, field int, rcwPassword []byte) ([]string, error)
- [ ] LibmuttonInit(inputCB func(prompt string) string, rcwPassword []byte, ...) error
- [ ] RCWSanityCheckGen(password []byte) error
- [ ] VerifyEntries(rcwPassword []byte) error
- [ ] WriteEntry(realPath string, decSlice []string, passwordIsNew bool, rcwPassword []byte) error
- [X] crypt
- [X] ~~VAR: RetryPassword bool~~ (RCWD not supported)
+1 -1
View File
@@ -1,6 +1,6 @@
module cmutton
go 1.25.6
go 1.26rc2
require (
github.com/rwinkhart/libmutton v0.4.3-0.20260124190333-b963ccf33e54