settings structure

This commit is contained in:
CTurt 2014-12-06 12:59:27 +00:00
parent 0de6f0fd77
commit 002f11646e
2 changed files with 7 additions and 2 deletions

View File

@ -3,7 +3,8 @@
#include <stdbool.h>
struct settings {
u8 IPParts[4];
char IPString[16];
int port;
} settings;
extern Handle fileHandle;

View File

@ -21,7 +21,6 @@ bool readSettings(void) {
ret = FSFILE_GetSize(fileHandle, &size);
if(ret) return false;
//buffer = linearAlloc(size);
buffer = malloc(size);
if(!buffer) return false;
@ -31,9 +30,14 @@ bool readSettings(void) {
ret = FSFILE_Close(fileHandle);
if(ret) return false;
strncpy(settings.IPString, (char *)buffer, 15);
buffer[15] = '\0';
//inet_pton(AF_INET, buffer, &(saout.sin_addr));
inet_pton4((const char *)buffer, (unsigned char *)&(saout.sin_addr));
settings.port = DEFAULT_PORT;
free(buffer);
return true;