2
0
Эх сурвалжийг харах

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

Roberto Ierusalimschy 27 жил өмнө
parent
commit
aee3f97acb
1 өөрчлөгдсөн 5 нэмэгдсэн , 2 устгасан
  1. 5 2
      ldo.c

+ 5 - 2
ldo.c

@@ -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;