mirror of
https://github.com/rwinkhart/cmutton.git
synced 2026-08-27 20:36:31 -04:00
Port age package
This commit is contained in:
@@ -64,10 +64,10 @@ int main() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
# Progress
|
# Progress
|
||||||
- [ ] age
|
- [X] age
|
||||||
- [ ] AllPasswordEntries(forceReage bool, rcwPassword []byte) error
|
- [X] AllPasswordEntries(forceReage bool, rcwPassword []byte) error
|
||||||
- [ ] Entry(vanityPath string, timestamp int64) error
|
- [X] Entry(vanityPath string, timestamp int64) error
|
||||||
- [ ] TranslateAgeTimestamp(timestamp *int64) uint8
|
- [X] TranslateAgeTimestamp(timestamp *int64) uint8
|
||||||
- [ ] clip
|
- [ ] clip
|
||||||
- [ ] ClearArgument() error
|
- [ ] ClearArgument() error
|
||||||
- [ ] ClearProcess(assignedContents string) error
|
- [ ] ClearProcess(assignedContents string) error
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
// #include <stdlib.h>
|
||||||
|
// #include "types.h"
|
||||||
|
import "C"
|
||||||
|
import (
|
||||||
|
"github.com/rwinkhart/libmutton/age"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AgeEntry returns:
|
||||||
|
// err
|
||||||
|
//
|
||||||
|
//export AgeEntry
|
||||||
|
func AgeEntry(vanityPath C.PascalString, timestamp int64) *C.char {
|
||||||
|
if err := age.Entry(C.GoStringN(vanityPath.data, vanityPath.len), timestamp); err != nil {
|
||||||
|
return C.CString(err.Error())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AgeAllPasswordEntries returns:
|
||||||
|
// err
|
||||||
|
//
|
||||||
|
//export AgeAllPasswordEntries
|
||||||
|
func AgeAllPasswordEntries(forceReage bool, rcwPassword C.PascalString) *C.char {
|
||||||
|
if err := age.AllPasswordEntries(forceReage, []byte(C.GoStringN(rcwPassword.data, rcwPassword.len))); err != nil {
|
||||||
|
return C.CString(err.Error())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TranslateAgeTimestamp returns:
|
||||||
|
// ageStatusMagicNum (0 -> no age, 1 -> fresh, 2 -> expiring soon (within a month), 3 -> expired)
|
||||||
|
//
|
||||||
|
//export TranslateAgeTimestamp
|
||||||
|
func TranslateAgeTimestamp(timestamp *int64) uint8 {
|
||||||
|
return age.TranslateAgeTimestamp(timestamp)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user