cross compilation using mingw32-w64
This commit is contained in:
@@ -13,4 +13,5 @@ generarxml_SOURCES = main.c \
|
||||
encoding.h
|
||||
generarxml_CPPFLAGS = $(XML_CPPFLAGS)
|
||||
generarxml_LDFLAGS= $(XML_LIBS)
|
||||
generarxml_LDADD = ${libxml2_LIBS}
|
||||
generarxml_LDADD = $(libxml2_LIBS) $(LDFLAGS)
|
||||
# -liconv
|
||||
|
||||
@@ -103,7 +103,7 @@ am_generarxml_OBJECTS = generarxml-main.$(OBJEXT) \
|
||||
generarxml-makexml.$(OBJEXT) generarxml-encoding.$(OBJEXT)
|
||||
generarxml_OBJECTS = $(am_generarxml_OBJECTS)
|
||||
am__DEPENDENCIES_1 =
|
||||
generarxml_DEPENDENCIES = $(am__DEPENDENCIES_1)
|
||||
generarxml_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
generarxml_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(generarxml_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
@@ -273,7 +273,7 @@ generarxml_SOURCES = main.c \
|
||||
|
||||
generarxml_CPPFLAGS = $(XML_CPPFLAGS)
|
||||
generarxml_LDFLAGS = $(XML_LIBS)
|
||||
generarxml_LDADD = ${libxml2_LIBS}
|
||||
generarxml_LDADD = $(libxml2_LIBS) $(LDFLAGS)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
@@ -656,6 +656,7 @@ uninstall-am: uninstall-binPROGRAMS
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
# -liconv
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
||||
@@ -83,6 +83,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
status = read_config(config_file);
|
||||
if (status != 0) {
|
||||
free(config_file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,78 @@
|
||||
#include "readfile.h"
|
||||
#include "encoding.h"
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#define GET_LINE_MAX_MEM 128
|
||||
size_t getline(char **lineptr, size_t *n, FILE *stream) {
|
||||
int ch;
|
||||
size_t chars = 0;
|
||||
char *line = *lineptr;
|
||||
|
||||
/* why even call this if you don't have a stream to read? */
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ch = fgetc(stream);
|
||||
if (ch == EOF) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (line == NULL) {
|
||||
if (*n == 0) {
|
||||
line = (char *) calloc(GET_LINE_MAX_MEM, sizeof(char));
|
||||
*n = GET_LINE_MAX_MEM;
|
||||
}
|
||||
else {
|
||||
line = (char *) calloc(*n, sizeof(char));
|
||||
}
|
||||
|
||||
/* out of memory */
|
||||
if (line == NULL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
free(line);
|
||||
*n = GET_LINE_MAX_MEM;
|
||||
line = (char *) calloc(GET_LINE_MAX_MEM, sizeof(char));
|
||||
}
|
||||
|
||||
while(ch != EOF) {
|
||||
if (chars == *n) {
|
||||
/* not enough memory for more chars, add more */
|
||||
*n = *n + GET_LINE_MAX_MEM;
|
||||
line = (char *) realloc(line, *n * sizeof(char));
|
||||
}
|
||||
if (ch == '\n') {
|
||||
if (chars == *n - 1) {
|
||||
/* add space for the null terminator */
|
||||
*n = *n + 1;
|
||||
line = (char *) realloc(line, *n * sizeof(char));
|
||||
}
|
||||
line[chars] = '\n';
|
||||
line[chars + 1] = '\0';
|
||||
break;
|
||||
}
|
||||
line[chars] = ch;
|
||||
ch = fgetc(stream);
|
||||
chars++;
|
||||
}
|
||||
if (ch == EOF) {
|
||||
if (chars == *n) {
|
||||
/* add space for the null terminator */
|
||||
*n = *n + 1;
|
||||
line = (char *) realloc(line, *n * sizeof(char));
|
||||
}
|
||||
line[chars] = '\0';
|
||||
}
|
||||
|
||||
*lineptr = line;
|
||||
|
||||
return chars + 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This function reads Biblia.txt, searches for the information in config,
|
||||
* and stores it into an array of strings to be used later to create the xml.
|
||||
|
||||
Reference in New Issue
Block a user