File tree 2 files changed +26
-2
lines changed
2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -118,8 +118,8 @@ sl_environ(sl_vm_t* vm)
118
118
size_t i = 0 ;
119
119
for (char * eptr = envzz ; * eptr ; eptr += strlen (eptr ) + 1 ) {
120
120
enva [i ] = sl_alloc_buffer (vm -> arena , strlen (eptr ) + 1 );
121
- strcpy (enva [i ], eptr );
122
- i ++ ;
121
+ strcpy (enva [i ], eptr );
122
+ i ++ ;
123
123
}
124
124
enva [i ] = NULL ;
125
125
FreeEnvironmentStrings (envzz );
Original file line number Diff line number Diff line change 4
4
#include <stdio.h>
5
5
#include "readline.h"
6
6
7
+ #ifdef SL_HAS_UNISTD
8
+ #include <unistd.h>
9
+ #endif
10
+
11
+ #ifdef __WIN32
12
+ #include <io.h>
13
+ #endif
14
+
7
15
static bool
8
16
opt_interactive ;
9
17
@@ -213,6 +221,22 @@ main(int argc, char** argv)
213
221
{
214
222
sl_vm_t * vm = setup_vm (& argc );
215
223
224
+ if (argc == 1 ) {
225
+ // if we have no command line args and we're running in a TTY,
226
+ // enable interactive mode by default
227
+ #ifdef SL_HAS_UNISTD
228
+ if (isatty (0 )) {
229
+ opt_interactive = true;
230
+ }
231
+ #else
232
+ #ifdef __WIN32
233
+ if (_isatty (_fileno (stdin ))) {
234
+ opt_interactive = true;
235
+ }
236
+ #endif
237
+ #endif
238
+ }
239
+
216
240
process_arguments (vm , argc , argv );
217
241
218
242
sl_vm_frame_t frame ;
You can’t perform that action at this time.
0 commit comments