starting to add flipper

This commit is contained in:
2025-03-25 23:25:47 -07:00
parent 2a13827e87
commit 439ebe7279
4 changed files with 56 additions and 9 deletions

View File

@@ -1 +1,43 @@
#include "flipper.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const char* m_outputPath;
const char* m_workingPath;
flipper_buffer m_outputBuffer;
flipper_buffer m_workingBuffer;
void FlipperWorkingDir(const char* path) {
m_workingPath = path;
}
void FlipperOutputDir(const char* path) {
m_outputPath = path;
}
void _UpdateBuffer(flipper_buffer* buffer, const char* path) {
char command_buffer[1024];
int path_size = strlen(path);
char* command;
memset(command, (path_size + 6) * sizeof(char), sizeof(char));
strcpy(command, "ls ");
strcat(command, path);
strcat(command, " -a");
FILE* f = popen(command,"r");
fseek(f,0L,SEEK_END);
long sz = ftell(f);
fseek(f,0L,SEEK_SET);
fread(command_buffer, sz,0,f);
fclose(f);
free(command);
// do stuff with the command buffer.
}