some simple touch-ups
This commit is contained in:
parent
e8e5aa7935
commit
30887f7f2c
@ -382,7 +382,7 @@ static int apply_fs_and_gvs_to_rtx (hawk_rtx_t* rtx, arg_t* arg)
|
||||
|
||||
/* compose a string value to use to set FS to */
|
||||
fs = hawk_rtx_makestrvalwithbcstr(rtx, arg->fs);
|
||||
if (!fs) return -1;
|
||||
if (HAWK_UNLIKELY(!fs)) return -1;
|
||||
|
||||
/* change FS according to the command line argument */
|
||||
hawk_rtx_refupval (rtx, fs);
|
||||
@ -402,7 +402,7 @@ static int apply_fs_and_gvs_to_rtx (hawk_rtx_t* rtx, arg_t* arg)
|
||||
|
||||
v = (arg->gvm.ptr[i].uc)? hawk_rtx_makenstrvalwithuchars(rtx, arg->gvm.ptr[i].value.ptr, arg->gvm.ptr[i].value.len):
|
||||
hawk_rtx_makenstrvalwithbchars(rtx, arg->gvm.ptr[i].value.ptr, arg->gvm.ptr[i].value.len);
|
||||
if (!v) return -1;
|
||||
if (HAWK_UNLIKELY(!v)) return -1;
|
||||
|
||||
hawk_rtx_refupval (rtx, v);
|
||||
hawk_rtx_setgbl (rtx, arg->gvm.ptr[i].idx, v);
|
||||
@ -1217,9 +1217,9 @@ static HAWK_INLINE int execute_hawk (int argc, hawk_bch_t* argv[])
|
||||
hawk_rtx_callwithbcstrarr(rtx, arg.call, (const hawk_bch_t**)arg.icf.ptr, arg.icf.size):
|
||||
hawk_rtx_loop(rtx); /* this doesn't support @pragma startup ... */
|
||||
#else
|
||||
/* note about @pragma startup ...
|
||||
* hawk_rtx_execwithbcstrarr() invokes the specified function is @pragma startup ... is set
|
||||
* in the source code. becuase arg.icf.ptr has been passed to hawk_rtx_openstdwithbcstr() when
|
||||
/* note about @pragma entry ...
|
||||
* hawk_rtx_execwithbcstrarr() invokes the specified function if '@pragma entry' is set
|
||||
* in the source code. because arg.icf.ptr has been passed to hawk_rtx_openstdwithbcstr() when
|
||||
* arg.call is HAWK_NULL, arg.icf.ptr serves as parameters to the startup function and
|
||||
* affects input consoles */
|
||||
retv = arg.call?
|
||||
|
@ -2049,10 +2049,7 @@ static int open_rio_console (hawk_rtx_t* rtx, hawk_rio_arg_t* riod)
|
||||
* 'BEGIN { ARGV[1]=""; ARGV[2]=""; }
|
||||
* { print $0; }' file1 file2
|
||||
*/
|
||||
sio = open_sio_std_rtx (
|
||||
rtx, HAWK_SIO_STDIN,
|
||||
HAWK_SIO_READ | HAWK_SIO_IGNOREECERR
|
||||
);
|
||||
sio = open_sio_std_rtx(rtx, HAWK_SIO_STDIN, HAWK_SIO_READ | HAWK_SIO_IGNOREECERR);
|
||||
if (sio == HAWK_NULL) return -1;
|
||||
|
||||
if (rxtn->c.cmgr) hawk_sio_setcmgr (sio, rxtn->c.cmgr);
|
||||
@ -2079,7 +2076,7 @@ static int open_rio_console (hawk_rtx_t* rtx, hawk_rio_arg_t* riod)
|
||||
map = ((hawk_val_map_t*)argv)->map;
|
||||
HAWK_ASSERT (map != HAWK_NULL);
|
||||
|
||||
ibuflen = hawk_int_to_oocstr (rxtn->c.in.index + 1, 10, HAWK_NULL, ibuf, HAWK_COUNTOF(ibuf));
|
||||
ibuflen = hawk_int_to_oocstr(rxtn->c.in.index + 1, 10, HAWK_NULL, ibuf, HAWK_COUNTOF(ibuf));
|
||||
|
||||
pair = hawk_htb_search(map, ibuf, ibuflen);
|
||||
HAWK_ASSERT (pair != HAWK_NULL);
|
||||
@ -2108,6 +2105,10 @@ static int open_rio_console (hawk_rtx_t* rtx, hawk_rio_arg_t* riod)
|
||||
|
||||
file = as.ptr;
|
||||
|
||||
|
||||
/* TODO: special awk quarkyness - check if the file name is var=val format.
|
||||
* if so, do variable assignment */
|
||||
|
||||
sio = (file[0] == HAWK_T('-') && file[1] == HAWK_T('\0'))?
|
||||
open_sio_std_rtx(rtx, HAWK_SIO_STDIN, HAWK_SIO_READ | HAWK_SIO_IGNOREECERR):
|
||||
open_sio_rtx(rtx, file, HAWK_SIO_READ | HAWK_SIO_IGNOREECERR);
|
||||
@ -2150,7 +2151,7 @@ static int open_rio_console (hawk_rtx_t* rtx, hawk_rio_arg_t* riod)
|
||||
);
|
||||
if (sio == HAWK_NULL) return -1;
|
||||
|
||||
if (rxtn->c.cmgr) hawk_sio_setcmgr (sio, rxtn->c.cmgr);
|
||||
if (rxtn->c.cmgr) hawk_sio_setcmgr (sio, rxtn->c.cmgr);
|
||||
|
||||
riod->handle = sio;
|
||||
rxtn->c.out.count++;
|
||||
|
Loading…
Reference in New Issue
Block a user