Weird C shit
This commit is contained in:
parent
84aa8da622
commit
780895b685
@ -106,8 +106,8 @@ void code(UWORD *blackImage, char* confName) {
|
|||||||
|
|
||||||
void config(UWORD *blackImage, char* configName) {
|
void config(UWORD *blackImage, char* configName) {
|
||||||
GoString goConfName = { configName, strlen(configName) };
|
GoString goConfName = { configName, strlen(configName) };
|
||||||
struct getConfig_return getConfigReturn = getConfig(goConfName);
|
const char *config = getConfig(goConfName);
|
||||||
if (getConfigReturn.r1 == -1) {
|
if (config == NULL) {
|
||||||
DebugLine(10, 0, "Config not found\n");
|
DebugLine(10, 0, "Config not found\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -119,15 +119,14 @@ void config(UWORD *blackImage, char* configName) {
|
|||||||
|
|
||||||
DebugLine(14, 10, "MADE IT TO HERE --------------------------------------");
|
DebugLine(14, 10, "MADE IT TO HERE --------------------------------------");
|
||||||
|
|
||||||
Paint_DrawString(5, 5, getConfigReturn.r0, &Font12, WHITE, BLACK);
|
Paint_DrawString(5, 5, config, &Font12, WHITE, BLACK);
|
||||||
|
//Paint_DrawString(5, 5, getConfigReturn.r0, &Font12, WHITE, BLACK);
|
||||||
EPD_2in13_V4_Display(blackImage);
|
EPD_2in13_V4_Display(blackImage);
|
||||||
|
|
||||||
int ch = getch();
|
int ch = getch();
|
||||||
if (ch == 'q') {
|
if (ch == 'q') {
|
||||||
free(getConfigReturn.r0);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
free(getConfigReturn.r0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawTotpHome(UWORD *blackImage, char** configNames, int *length) {
|
void drawTotpHome(UWORD *blackImage, char** configNames, int *length) {
|
||||||
|
@ -157,7 +157,7 @@ func getConfigNames() (**C.char, C.int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//export getConfig
|
//export getConfig
|
||||||
func getConfig(configName string) (*C.char, C.int) {
|
func getConfig(configName string) *C.char {
|
||||||
files, err := os.ReadDir(homeDir + "/.totp")
|
files, err := os.ReadDir(homeDir + "/.totp")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -178,10 +178,10 @@ func getConfig(configName string) (*C.char, C.int) {
|
|||||||
|
|
||||||
cStr := C.CString(fileStr)
|
cStr := C.CString(fileStr)
|
||||||
runtime.KeepAlive(fileStr)
|
runtime.KeepAlive(fileStr)
|
||||||
return cStr, (C.int)(len(fileStr))
|
return cStr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil, -1
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//export getCode
|
//export getCode
|
||||||
|
Loading…
Reference in New Issue
Block a user