mirror of
https://github.com/vivier/EMILE.git
synced 2025-01-18 06:31:23 +00:00
configuration is int8_t
This commit is contained in:
parent
14a1b857f2
commit
fb677da2fe
@ -9,16 +9,16 @@
|
|||||||
|
|
||||||
#include "libconfig.h"
|
#include "libconfig.h"
|
||||||
|
|
||||||
int config_add_property(char* configuration, char* name, char* property)
|
int config_add_property(int8_t* configuration, char* name, char* property)
|
||||||
{
|
{
|
||||||
int index = strlen(configuration);
|
int index = strlen((char*)configuration);
|
||||||
|
|
||||||
if (index > 0)
|
if (index > 0)
|
||||||
{
|
{
|
||||||
configuration[index] = '\n';
|
configuration[index] = '\n';
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
sprintf(configuration + index,
|
sprintf((char*)configuration + index,
|
||||||
"%s %s", name, property);
|
"%s %s", name, property);
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include "libconfig.h"
|
#include "libconfig.h"
|
||||||
|
|
||||||
int config_find_entry(char *configuration, char *name, char *property)
|
int config_find_entry(int8_t *configuration, char *name, char *property)
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int last_index;
|
int last_index;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include "libconfig.h"
|
#include "libconfig.h"
|
||||||
|
|
||||||
int config_find_indexed_property(char *configuration, char *index_name, char *index_property, char *name, char *property)
|
int config_find_indexed_property(int8_t *configuration, char *index_name, char *index_property, char *name, char *property)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
int last_index;
|
int last_index;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include "libconfig.h"
|
#include "libconfig.h"
|
||||||
|
|
||||||
int config_get_indexed_property(char *configuration, char *index_name, char *index_property, char *name, char *property)
|
int config_get_indexed_property(int8_t *configuration, char *index_name, char *index_property, char *name, char *property)
|
||||||
{
|
{
|
||||||
int index ;
|
int index ;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ char *config_read_word(char *line, char **next)
|
|||||||
return word;
|
return word;
|
||||||
}
|
}
|
||||||
|
|
||||||
int config_get_next_property(char *configuration, int index, char *name, char *property)
|
int config_get_next_property(int8_t *configuration, int index, char *name, char *property)
|
||||||
{
|
{
|
||||||
char *next_word, *next_line;
|
char *next_word, *next_line;
|
||||||
char *current_name, *current_property;
|
char *current_name, *current_property;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "libconfig.h"
|
#include "libconfig.h"
|
||||||
|
|
||||||
int config_get_property(char *configuration, char *name, char *property)
|
int config_get_property(int8_t *configuration, char *name, char *property)
|
||||||
{
|
{
|
||||||
return config_get_indexed_property(configuration, NULL, NULL, name, property);
|
return config_get_indexed_property(configuration, NULL, NULL, name, property);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include "libconfig.h"
|
#include "libconfig.h"
|
||||||
|
|
||||||
int config_remove_indexed_property(char *configuration, char *index_name,
|
int config_remove_indexed_property(int8_t *configuration, char *index_name,
|
||||||
char *index_property, char *name)
|
char *index_property, char *name)
|
||||||
{
|
{
|
||||||
int last_index;
|
int last_index;
|
||||||
@ -24,7 +24,7 @@ int config_remove_indexed_property(char *configuration, char *index_name,
|
|||||||
last_index, NULL, NULL);
|
last_index, NULL, NULL);
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
len = strlen(configuration + index);
|
len = strlen((char*)configuration + index);
|
||||||
memmove(configuration + last_index, configuration + index, len);
|
memmove(configuration + last_index, configuration + index, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include "libconfig.h"
|
#include "libconfig.h"
|
||||||
|
|
||||||
int config_remove_property(char *configuration, char *name)
|
int config_remove_property(int8_t *configuration, char *name)
|
||||||
{
|
{
|
||||||
return config_remove_indexed_property(configuration, name, NULL, NULL);
|
return config_remove_indexed_property(configuration, name, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include "libconfig.h"
|
#include "libconfig.h"
|
||||||
|
|
||||||
int config_set_indexed_property(char *configuration,
|
int config_set_indexed_property(int8_t *configuration,
|
||||||
char *index_name, char *index_property,
|
char *index_name, char *index_property,
|
||||||
char *name, char *property)
|
char *name, char *property)
|
||||||
{
|
{
|
||||||
@ -36,7 +36,7 @@ int config_set_indexed_property(char *configuration,
|
|||||||
{
|
{
|
||||||
/* no, we add this property at the end */
|
/* no, we add this property at the end */
|
||||||
|
|
||||||
last_index = strlen(configuration);
|
last_index = strlen((char*)configuration);
|
||||||
if (last_index > 0)
|
if (last_index > 0)
|
||||||
last_index++; /* to insert a '\n' */
|
last_index++; /* to insert a '\n' */
|
||||||
index = last_index;
|
index = last_index;
|
||||||
@ -50,7 +50,7 @@ int config_set_indexed_property(char *configuration,
|
|||||||
last_index = config_find_entry(configuration + last_index, index_name, NULL);
|
last_index = config_find_entry(configuration + last_index, index_name, NULL);
|
||||||
if (last_index == -1)
|
if (last_index == -1)
|
||||||
{
|
{
|
||||||
last_index = strlen(configuration);
|
last_index = strlen((char*)configuration);
|
||||||
if (last_index > 0)
|
if (last_index > 0)
|
||||||
last_index++; /* to insert a '\n' */
|
last_index++; /* to insert a '\n' */
|
||||||
}
|
}
|
||||||
@ -61,22 +61,22 @@ int config_set_indexed_property(char *configuration,
|
|||||||
{
|
{
|
||||||
index = config_get_next_property(configuration, last_index, NULL, NULL);
|
index = config_get_next_property(configuration, last_index, NULL, NULL);
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
index = strlen(configuration);
|
index = strlen((char*)configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = strlen(configuration + index);
|
len = strlen((char*)configuration + index);
|
||||||
memmove(configuration + last_index + len_new,
|
memmove(configuration + last_index + len_new,
|
||||||
configuration + index, len);
|
configuration + index, len);
|
||||||
|
|
||||||
if (last_index > 0)
|
if (last_index > 0)
|
||||||
configuration[last_index - 1] = '\n';
|
configuration[last_index - 1] = '\n';
|
||||||
sprintf(configuration + last_index,
|
sprintf((char*)configuration + last_index,
|
||||||
"%s %s", name, property);
|
"%s %s", name, property);
|
||||||
configuration[last_index + len_new - 1] = '\n';
|
configuration[last_index + len_new - 1] = '\n';
|
||||||
|
|
||||||
/* remove ending '\n' */
|
/* remove ending '\n' */
|
||||||
|
|
||||||
len = strlen(configuration + last_index);
|
len = strlen((char*)configuration + last_index);
|
||||||
if (configuration[last_index + len - 1] == '\n')
|
if (configuration[last_index + len - 1] == '\n')
|
||||||
len--;
|
len--;
|
||||||
configuration[last_index + len] = 0;
|
configuration[last_index + len] = 0;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include "libconfig.h"
|
#include "libconfig.h"
|
||||||
|
|
||||||
int config_set_property(char *configuration, char *name, char *property)
|
int config_set_property(int8_t *configuration, char *name, char *property)
|
||||||
{
|
{
|
||||||
return config_set_indexed_property(configuration, NULL, NULL,
|
return config_set_indexed_property(configuration, NULL, NULL,
|
||||||
name, property);
|
name, property);
|
||||||
|
@ -4,14 +4,16 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
extern char *config_read_word(char *line, char **next);
|
extern char *config_read_word(char *line, char **next);
|
||||||
extern int config_get_next_property(char *configuration, int index, char *name, char *property);
|
extern int config_get_next_property(int8_t *configuration, int index, char *name, char *property);
|
||||||
extern int config_get_indexed_property(char *configuration, char *index_name, char *index_property, char *name, char *property);
|
extern int config_get_indexed_property(int8_t *configuration, char *index_name, char *index_property, char *name, char *property);
|
||||||
extern int config_get_property(char *configuration, char *name, char *property);
|
extern int config_get_property(int8_t *configuration, char *name, char *property);
|
||||||
extern int config_remove_property(char *configuration, char *name);
|
extern int config_remove_property(int8_t *configuration, char *name);
|
||||||
extern int config_set_property(char *configuration, char *name, char *property);
|
extern int config_set_property(int8_t *configuration, char *name, char *property);
|
||||||
extern int config_set_indexed_property(char *configuration, char *index_name, char *index_property, char *name, char *property);
|
extern int config_set_indexed_property(int8_t *configuration, char *index_name, char *index_property, char *name, char *property);
|
||||||
extern int config_remove_indexed_property(char *configuration, char *index_name, char *index_property, char *name);
|
extern int config_remove_indexed_property(int8_t *configuration, char *index_name, char *index_property, char *name);
|
||||||
extern int config_find_indexed_property(char *configuration, char *index_name, char *index_property, char *name, char *property);
|
extern int config_find_indexed_property(int8_t *configuration, char *index_name, char *index_property, char *name, char *property);
|
||||||
extern int config_find_entry(char *configuration, char *name, char *property);
|
extern int config_find_entry(int8_t *configuration, char *name, char *property);
|
||||||
extern int config_add_property(char* configuration, char* name, char* property);
|
extern int config_add_property(int8_t* configuration, char* name, char* property);
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
#include "libemile.h"
|
#include "libemile.h"
|
||||||
#include "emile.h"
|
#include "emile.h"
|
||||||
|
|
||||||
char* emile_second_get_configuration(int fd)
|
int8_t* emile_second_get_configuration(int fd)
|
||||||
{
|
{
|
||||||
char *conf = NULL;
|
int8_t *conf = NULL;
|
||||||
emile_l2_header_t header;
|
emile_l2_header_t header;
|
||||||
int ret;
|
int ret;
|
||||||
int size;
|
int size;
|
||||||
@ -35,7 +35,7 @@ char* emile_second_get_configuration(int fd)
|
|||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
size = read_short(&header.conf_size);
|
size = read_short(&header.conf_size);
|
||||||
conf = (char*)malloc(size);
|
conf = (int8_t*)malloc(size);
|
||||||
if (conf == NULL)
|
if (conf == NULL)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ int emile_second_get_param(int fd, char *kernel, char *parameters, char *initrd)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int drive, second, size;
|
int drive, second, size;
|
||||||
char *configuration;
|
int8_t *configuration;
|
||||||
|
|
||||||
/* can work on an image or directly on second level file */
|
/* can work on an image or directly on second level file */
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "emile.h"
|
#include "emile.h"
|
||||||
#include "bootblock.h"
|
#include "bootblock.h"
|
||||||
|
|
||||||
int emile_second_set_configuration(int fd, char *configuration)
|
int emile_second_set_configuration(int fd, int8_t *configuration)
|
||||||
{
|
{
|
||||||
emile_l2_header_t header;
|
emile_l2_header_t header;
|
||||||
int ret;
|
int ret;
|
||||||
@ -25,7 +25,7 @@ int emile_second_set_configuration(int fd, char *configuration)
|
|||||||
if (configuration == NULL)
|
if (configuration == NULL)
|
||||||
return EEMILE_CANNOT_READ_SECOND;
|
return EEMILE_CANNOT_READ_SECOND;
|
||||||
|
|
||||||
len = strlen (configuration) + 1; /* + 1 for ending 0 */
|
len = strlen ((char*)configuration) + 1; /* + 1 for ending 0 */
|
||||||
|
|
||||||
memset(&header, 0, sizeof(header));
|
memset(&header, 0, sizeof(header));
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
int emile_second_set_param(int fd, char *kernel, char *parameters, char *initrd)
|
int emile_second_set_param(int fd, char *kernel, char *parameters, char *initrd)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char *configuration;
|
int8_t *configuration;
|
||||||
off_t offset;
|
off_t offset;
|
||||||
|
|
||||||
offset = lseek(fd, 0, SEEK_CUR);
|
offset = lseek(fd, 0, SEEK_CUR);
|
||||||
|
@ -135,12 +135,12 @@ extern int emile_map_set_bootinfo(emile_map_t *map, int bootstart, int bootsize,
|
|||||||
extern int emile_map_set_driver_info(emile_map_t *map, int number, int block, int size, int type);
|
extern int emile_map_set_driver_info(emile_map_t *map, int number, int block, int size, int type);
|
||||||
extern int emile_map_set_driver_number(emile_map_t *map, int number);
|
extern int emile_map_set_driver_number(emile_map_t *map, int number);
|
||||||
extern int emile_block0_write(emile_map_t *map);
|
extern int emile_block0_write(emile_map_t *map);
|
||||||
extern char* emile_second_get_configuration(int fd);
|
extern int8_t* emile_second_get_configuration(int fd);
|
||||||
extern int emile_second_set_configuration(int fd, char *configuration);
|
extern int emile_second_set_configuration(int fd, int8_t *configuration);
|
||||||
extern int emile_second_get_next_property(char *configuration, int index, char *name, char *property);
|
extern int emile_second_get_next_property(int8_t *configuration, int index, char *name, char *property);
|
||||||
extern int emile_second_get_property(char *configuration, char *name, char *property);
|
extern int emile_second_get_property(int8_t *configuration, char *name, char *property);
|
||||||
extern void emile_second_set_property(char *configuration, char *name, char *property);
|
extern void emile_second_set_property(int8_t *configuration, char *name, char *property);
|
||||||
extern void emile_second_remove_property(char *configuration, char *name);
|
extern void emile_second_remove_property(int8_t *configuration, char *name);
|
||||||
extern int emile_second_set_param(int fd, char *kernel, char *parameters, char *initrd);
|
extern int emile_second_set_param(int fd, char *kernel, char *parameters, char *initrd);
|
||||||
extern int emile_second_get_param(int fd, char *kernel, char *parameters, char *initrd);
|
extern int emile_second_get_param(int fd, char *kernel, char *parameters, char *initrd);
|
||||||
extern unsigned long emile_map_get_driver_signature(emile_map_t* map);
|
extern unsigned long emile_map_get_driver_signature(emile_map_t* map);
|
||||||
|
@ -65,7 +65,7 @@ static int get_info(char *image, int verbose)
|
|||||||
int drive_num;
|
int drive_num;
|
||||||
int second_offset;
|
int second_offset;
|
||||||
int second_size;
|
int second_size;
|
||||||
char * configuration;
|
int8_t * configuration;
|
||||||
char property[1024];
|
char property[1024];
|
||||||
char title[1024];
|
char title[1024];
|
||||||
int index;
|
int index;
|
||||||
@ -192,7 +192,7 @@ static int set_config(char *image, int verbose, char *config_path,
|
|||||||
char* kernel_image = NULL;
|
char* kernel_image = NULL;
|
||||||
char* ramdisk = NULL;
|
char* ramdisk = NULL;
|
||||||
emile_config* config;
|
emile_config* config;
|
||||||
char *configuration;
|
int8_t *configuration;
|
||||||
int timeout;
|
int timeout;
|
||||||
int gestaltid;
|
int gestaltid;
|
||||||
int default_entry;
|
int default_entry;
|
||||||
@ -332,7 +332,7 @@ static int set_config(char *image, int verbose, char *config_path,
|
|||||||
if (kernel_ondisk != NULL)
|
if (kernel_ondisk != NULL)
|
||||||
free(kernel_ondisk);
|
free(kernel_ondisk);
|
||||||
|
|
||||||
if (strlen(configuration) > 1023)
|
if (strlen((char*)configuration) > 1023)
|
||||||
{
|
{
|
||||||
int tmpfd;
|
int tmpfd;
|
||||||
char *conf;
|
char *conf;
|
||||||
@ -342,7 +342,7 @@ static int set_config(char *image, int verbose, char *config_path,
|
|||||||
" will store it at end of floppy\n");
|
" will store it at end of floppy\n");
|
||||||
|
|
||||||
tmpfd = mkstemp(tmpfile);
|
tmpfd = mkstemp(tmpfile);
|
||||||
write(tmpfd, configuration, strlen(configuration) + 1);
|
write(tmpfd, configuration, strlen((char*)configuration) + 1);
|
||||||
close(tmpfd);
|
close(tmpfd);
|
||||||
|
|
||||||
conf = emile_floppy_add(fd, tmpfile);
|
conf = emile_floppy_add(fd, tmpfile);
|
||||||
|
@ -88,7 +88,7 @@ static void usage(int argc, char** argv)
|
|||||||
static int display_output(char* image)
|
static int display_output(char* image)
|
||||||
{
|
{
|
||||||
int drive, second, size;
|
int drive, second, size;
|
||||||
char *configuration;
|
int8_t *configuration;
|
||||||
char property[256];
|
char property[256];
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
@ -162,7 +162,7 @@ static int set_output(char* image,
|
|||||||
int drive, second, size;
|
int drive, second, size;
|
||||||
int fd;
|
int fd;
|
||||||
int ret;
|
int ret;
|
||||||
char *configuration;
|
int8_t *configuration;
|
||||||
char property[32];
|
char property[32];
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ static char *get_map_name(char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int add_file(char *configuration,
|
static int add_file(int8_t *configuration,
|
||||||
char *index, char *property, char *path, char *map_path)
|
char *index, char *property, char *path, char *map_path)
|
||||||
{
|
{
|
||||||
struct emile_container *container;
|
struct emile_container *container;
|
||||||
@ -407,7 +407,7 @@ static int add_file(char *configuration,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *set_config(emile_config *config, int drive)
|
static int8_t *set_config(emile_config *config, int drive)
|
||||||
{
|
{
|
||||||
int default_entry;
|
int default_entry;
|
||||||
int gestaltid;
|
int gestaltid;
|
||||||
@ -420,7 +420,7 @@ static char *set_config(emile_config *config, int drive)
|
|||||||
char *title;
|
char *title;
|
||||||
char buf[16];
|
char buf[16];
|
||||||
int ret;
|
int ret;
|
||||||
char *configuration;
|
int8_t *configuration;
|
||||||
|
|
||||||
configuration = malloc(65536);
|
configuration = malloc(65536);
|
||||||
if (configuration == NULL)
|
if (configuration == NULL)
|
||||||
@ -518,7 +518,7 @@ static char *set_config(emile_config *config, int drive)
|
|||||||
}
|
}
|
||||||
} while (!emile_config_read_next(config));
|
} while (!emile_config_read_next(config));
|
||||||
|
|
||||||
if (strlen(configuration) > 1023)
|
if (strlen((char*)configuration) > 1023)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
char* bootconfig = "/boot/emile/.bootconfig";
|
char* bootconfig = "/boot/emile/.bootconfig";
|
||||||
@ -535,7 +535,7 @@ static char *set_config(emile_config *config, int drive)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
write(fd, configuration, strlen(configuration) + 1);
|
write(fd, configuration, strlen((char*)configuration) + 1);
|
||||||
close(fd);
|
close(fd);
|
||||||
free(configuration);
|
free(configuration);
|
||||||
|
|
||||||
@ -572,7 +572,7 @@ int main(int argc, char **argv)
|
|||||||
emile_config *config;
|
emile_config *config;
|
||||||
int drive, second, size;
|
int drive, second, size;
|
||||||
int fd;
|
int fd;
|
||||||
char *configuration;
|
int8_t *configuration;
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user