@@ -42,6 +42,7 @@ extern char *dirname(char *);
4242
4343static int opt_log = 0 ;
4444static int opt_lua = 0 ;
45+ static int opt_echo = 0 ;
4546static int opt_debug = 0 ;
4647static int opt_width = WIDTH ;
4748static char * opt_autoload = NULL ;
@@ -314,6 +315,8 @@ int main(int argc, const char **argv)
314315 } else if (!strncmp (argv [i ], "-m" , 2 )) {
315316 opt_mmedia = 1 ;
316317 mmedia_bin = argv [i ] + 2 ;
318+ } else if (!strcmp (argv [i ], "-e" )) {
319+ opt_echo = 1 ;
317320 } else if (!strncmp (argv [i ], "-d" , 2 )) {
318321 opt_debug = 1 ;
319322 reopen_stderr (argv [i ] + 2 );
@@ -377,7 +380,8 @@ int main(int argc, const char **argv)
377380 mmedia (0 ); mmedia (1 );
378381 if (opt_autoload ) {
379382 snprintf (cmd , sizeof (cmd ), "load %s" , opt_autoload );
380- printf ("%s\n" , cmd );
383+ if (opt_echo )
384+ printf ("%s\n" , cmd );
381385 str = instead_cmd (cmd , & rc );
382386 } else
383387 str = instead_cmd ("look" , & rc );
@@ -400,6 +404,8 @@ int main(int argc, const char **argv)
400404 printf ("\n" );
401405 break ;
402406 }
407+ if (opt_echo )
408+ fprintf (stdout , "%s\n" , p );
403409 rc = 1 ; str = NULL ;
404410
405411 if (* p == '/' ) {
0 commit comments