File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 45
45
#include "reb-c.h"
46
46
#include "reb-args.h"
47
47
48
- #define ARG_BUF_SIZE 1024
49
-
50
48
extern int OS_Get_Current_Dir (REBCHR * * lp );
51
49
52
50
// REBOL Option --Words:
@@ -201,6 +199,8 @@ const struct arg_chr arg_chars2[] = {
201
199
**
202
200
***********************************************************************/
203
201
{
202
+ int ARG_BUF_SIZE = 1024 ;
203
+
204
204
REBCHR * arg ;
205
205
REBCHR * args = 0 ; // holds trailing args
206
206
int flag ;
@@ -261,12 +261,20 @@ const struct arg_chr arg_chars2[] = {
261
261
if (!rargs -> script )
262
262
rargs -> script = arg ;
263
263
else {
264
- int len ;
264
+ int len ; REBCHR * tmp ;
265
265
if (!args ) {
266
266
args = MAKE_STR (ARG_BUF_SIZE );
267
267
args [0 ] = 0 ;
268
268
}
269
269
len = ARG_BUF_SIZE - LEN_STR (args ) - 2 ; // space remaining
270
+ while (len < 0 ) {
271
+ tmp = args ;
272
+ args = MAKE_STR (2 * ARG_BUF_SIZE );
273
+ memcpy (args , tmp , ARG_BUF_SIZE );
274
+ ARG_BUF_SIZE *= 2 ;
275
+ free (tmp );
276
+ len = ARG_BUF_SIZE - LEN_STR (args ) - 2 ;
277
+ }
270
278
JOIN_STR (args , arg , len );
271
279
JOIN_STR (args , TXT (" " ), 1 );
272
280
}
You can’t perform that action at this time.
0 commit comments