[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] [PATCH] Fix mktbl for cross-compilation



Hello.

I have noticed that while mktbl is a very simple tool, a few minor bugs prevents it to be correctly cross-compiled.

1) The local function getdelim() conflicts with the one provided by the libc.

2) The output .tbl file is opened in text mode.

The following patch fixes the problems. Please commit.

mktbl.patch
Fix mktbl for cross-compilation. Contributed by Vincent Riviere.

--
Vincent Rivière
--- freemint.orig/tools/mktbl/mktbl.c	2004-07-11 03:31:12.000000000 +0200
+++ freemint/tools/mktbl/mktbl.c	2013-01-15 21:29:32.703125000 +0100
@@ -72,7 +72,7 @@
 /* Own getdelim(). The `n' buffer size must definitely be bigger than 0!
  */
 static int
-getdelim(char **lineptr, size_t *n, int terminator, FILE *stream)
+my_getdelim(char **lineptr, size_t *n, int terminator, FILE *stream)
 {
 	int ch;
 	char *buf = *lineptr;
@@ -159,13 +159,13 @@
 	if (!fd)
 		return 3;
 
-	out = fopen(outname, "w");
+	out = fopen(outname, "wb");
 	if (!fd)
 		return 4;
 
 	do
 	{
-		r = getdelim(&line, &buf, '\n', fd);
+		r = my_getdelim(&line, &buf, '\n', fd);
 		if (r >= 0 && line[0] != ';' && (ln = strstr(line, "dc.")))
 		{
 			w = strncmp(ln, "dc.b", 4);