commit 98263e2ef156c04c305708fa8792d80b3b76aceb
parent d2117d66ec893ed01efa6bc065f842e39d80e6df
Author: Waldemar Celes <celes@tecgraf.puc-rio.br>
Date: Mon, 12 Sep 1994 16:24:12 -0300
acertar bug no formato de string.
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/iolib.c b/iolib.c
@@ -3,7 +3,7 @@
** Input/output library to LUA
*/
-char *rcs_iolib="$Id: iolib.c,v 1.7 1994/08/17 15:10:04 celes Exp roberto $";
+char *rcs_iolib="$Id: iolib.c,v 1.8 1994/08/17 22:34:20 roberto Exp celes $";
#include <stdlib.h>
#include <string.h>
@@ -345,7 +345,7 @@ static char *buildformat (char *e, lua_Object o)
static char buffer[512];
static char f[80];
char *string = &buffer[255];
- char *fstart=e, *fspace;
+ char *fstart=e, *fspace, *send;
char t, j='r';
int m=0, n=0, l;
while (isspace(*e)) e++;
@@ -354,7 +354,7 @@ static char *buildformat (char *e, lua_Object o)
if (*e == '<' || *e == '|' || *e == '>') j = *e++;
while (isdigit(*e))
m = m*10 + (*e++ - '0');
- e++; /* skip point */
+ if (*e == '.') e++; /* skip point */
while (isdigit(*e))
n = n*10 + (*e++ - '0');
@@ -383,6 +383,7 @@ static char *buildformat (char *e, lua_Object o)
default: return "";
}
l = strlen(string);
+ send = string+l;
if (m!=0 && l>m)
{
int i;
@@ -406,8 +407,8 @@ static char *buildformat (char *e, lua_Object o)
fspace--;
*string = *fspace;
}
- while (isspace(*e)) string[l++] = *e++;
- string[l] = 0;
+ while (isspace(*e)) *send++ = *e++;
+ *send = 0;
return string;
}
static void io_write (void)