Added option to run the eval it checks for and prints whatever you pass it as an arguement

This commit is contained in:
Amadeo Bellotti 2022-07-07 09:23:42 -04:00
parent c8a5824576
commit 7d7209764f
2 changed files with 18 additions and 0 deletions

View File

@ -990,6 +990,22 @@ _cw_intr_win(c3_c* han_c)
}
#endif
/* _cw_eval_commence(): initialize and run the hoon evaluator
*/
static void
_cw_eval_commence(c3_i argc, c3_c* argv[])
{
#ifdef U3_OS_mingw
if ( 4 > argc ) {
#else
if ( 3 > argc ) {
#endif
fprintf(stderr, "eval: no hoon to eval\n");
exit(1);
}
c3_c* evl_c = argv[2];
printf("%s \n", evl_c);
}
/* _cw_serf_commence(): initialize and run serf
*/
static void
@ -1638,6 +1654,7 @@ _cw_utils(c3_i argc, c3_c* argv[])
case c3__vere: _cw_vere(argc, argv); return 1;
case c3__serf: _cw_serf_commence(argc, argv); return 1;
case c3__eval: _cw_eval_commence(argc, argv); return 1;
}
return 0;

View File

@ -387,6 +387,7 @@
# define c3__ergo c3_s4('e','r','g','o')
# define c3__esh c3_s3('e','s','h')
# define c3__etch c3_s4('e','t','c','h')
# define c3__eval c3_s4('e','v','a','l')
# define c3__ex c3_s2('e','x')
# define c3__exit c3_s4('e','x','i','t')
# define c3__eyre c3_s4('e','y','r','e')