put back quotes (") when string in dostring ends with a \n

This commit is contained in:
Roberto Ierusalimschy 1998-01-29 13:59:35 -02:00
parent 46968b8ffa
commit aee3f97acb
1 changed files with 5 additions and 2 deletions

7
ldo.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: ldo.c,v 1.22 1998/01/27 21:21:27 roberto Exp roberto $ ** $Id: ldo.c,v 1.23 1998/01/28 17:47:05 roberto Exp roberto $
** Stack and Call structure of Lua ** Stack and Call structure of Lua
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -401,7 +401,10 @@ int lua_dostring (char *str)
if (str == NULL) return 1; if (str == NULL) return 1;
sprintf(name, "(dostring) >> \"%." SSIZE_PREF "s\"", str); sprintf(name, "(dostring) >> \"%." SSIZE_PREF "s\"", str);
temp = strchr(name, '\n'); temp = strchr(name, '\n');
if (temp) *temp = 0; /* end string after first line */ if (temp) { /* end string after first line */
*temp = '"';
*(temp+1) = 0;
}
luaZ_sopen(&z, str, name); luaZ_sopen(&z, str, name);
status = do_main(&z, 0); status = do_main(&z, 0);
return status; return status;