diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-06-16 14:16:34 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-06-16 14:16:34 -0300 |
| commit | e3ea307434c876f561fa22d22d64ec1030f10415 (patch) | |
| tree | ee6448cd9a5c78b6e54a04a589e6377fcccaf522 /lua.c | |
| parent | 18b0e8270de991556460c57b1e3d88b2df5965fc (diff) | |
| download | lua-e3ea307434c876f561fa22d22d64ec1030f10415.tar.gz lua-e3ea307434c876f561fa22d22d64ec1030f10415.tar.bz2 lua-e3ea307434c876f561fa22d22d64ec1030f10415.zip | |
small changes to allow redefinition of some buffer sizes.
Diffstat (limited to 'lua.c')
| -rw-r--r-- | lua.c | 10 |
1 files changed, 7 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.c,v 1.38 2000/05/10 17:00:21 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.39 2000/06/12 13:52:05 roberto Exp roberto $ |
| 3 | ** Lua stand-alone interpreter | 3 | ** Lua stand-alone interpreter |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -129,12 +129,16 @@ static void file_input (const char *argv) { | |||
| 129 | } | 129 | } |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | /* maximum length of an input string */ | ||
| 133 | #ifndef MAXINPUT | ||
| 134 | #define MAXINPUT BUFSIZ | ||
| 135 | #endif | ||
| 132 | 136 | ||
| 133 | static void manual_input (int version, int prompt) { | 137 | static void manual_input (int version, int prompt) { |
| 134 | int cont = 1; | 138 | int cont = 1; |
| 135 | if (version) print_version(); | 139 | if (version) print_version(); |
| 136 | while (cont) { | 140 | while (cont) { |
| 137 | char buffer[BUFSIZ]; | 141 | char buffer[MAXINPUT]; |
| 138 | int i = 0; | 142 | int i = 0; |
| 139 | lua_beginblock(); | 143 | lua_beginblock(); |
| 140 | if (prompt) { | 144 | if (prompt) { |
| @@ -153,7 +157,7 @@ static void manual_input (int version, int prompt) { | |||
| 153 | buffer[i-1] = '\n'; | 157 | buffer[i-1] = '\n'; |
| 154 | else break; | 158 | else break; |
| 155 | } | 159 | } |
| 156 | else if (i >= BUFSIZ-1) { | 160 | else if (i >= MAXINPUT-1) { |
| 157 | fprintf(stderr, "lua: input line too long\n"); | 161 | fprintf(stderr, "lua: input line too long\n"); |
| 158 | break; | 162 | break; |
| 159 | } | 163 | } |
