touched up the cut utility
This commit is contained in:
10
lib/cut.c
10
lib/cut.c
@ -324,15 +324,7 @@ int hawk_cut_comp (hawk_cut_t* cut, hawk_cut_io_impl_t inf)
|
||||
int mask = 0;
|
||||
|
||||
while (hawk_is_ooch_space(c)) NXTSC_GOTO(cut, c, oops);
|
||||
if (EOF(c))
|
||||
{
|
||||
if (cut->sel.count > 0)
|
||||
{
|
||||
SETERR0(cut, HAWK_CUT_ESELNV);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (EOF(c)) break;
|
||||
|
||||
if (c == HAWK_T('d'))
|
||||
{
|
||||
|
@ -779,7 +779,7 @@ static hawk_ooi_t read_input_stream (hawk_cut_t* cut, hawk_cut_io_arg_t* arg, ha
|
||||
n = hawk_sio_getoochars(arg->handle, buf, len);
|
||||
if (n <= -1)
|
||||
{
|
||||
set_eiofil_for_iostd (cut, io);
|
||||
set_eiofil_for_iostd(cut, io);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -798,6 +798,7 @@ static hawk_ooi_t read_input_stream (hawk_cut_t* cut, hawk_cut_io_arg_t* arg, ha
|
||||
/* == end of file on the current input stream == */
|
||||
/* ============================================= */
|
||||
|
||||
#if 0
|
||||
if (base == &xtn->s.in && xtn->s.last != HAWK_T('\n'))
|
||||
{
|
||||
/* TODO: different line termination convension */
|
||||
@ -806,6 +807,7 @@ static hawk_ooi_t read_input_stream (hawk_cut_t* cut, hawk_cut_io_arg_t* arg, ha
|
||||
xtn->s.newline_squeezed = 1;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
open_next:
|
||||
next = base->cur + 1;
|
||||
@ -821,7 +823,7 @@ static hawk_ooi_t read_input_stream (hawk_cut_t* cut, hawk_cut_io_arg_t* arg, ha
|
||||
if (open_input_stream(cut, arg, next, base) <= -1)
|
||||
{
|
||||
/* failed to open the next input stream */
|
||||
set_eiofil_for_iostd (cut, next);
|
||||
set_eiofil_for_iostd(cut, next);
|
||||
n = -1;
|
||||
break;
|
||||
}
|
||||
@ -1082,7 +1084,7 @@ static hawk_ooi_t x_out (
|
||||
{
|
||||
hawk_ooi_t n;
|
||||
n = hawk_sio_putoochars(arg->handle, dat, len);
|
||||
if (n <= -1) set_eiofil_for_iostd (cut, io);
|
||||
if (n <= -1) set_eiofil_for_iostd(cut, io);
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ static hawk_ooi_t read_input_stream (hawk_sed_t* sed, hawk_sed_io_arg_t* arg, ha
|
||||
n = hawk_sio_getoochars(arg->handle, buf, len);
|
||||
if (n <= -1)
|
||||
{
|
||||
set_eiofil_for_iostd (sed, io);
|
||||
set_eiofil_for_iostd(sed, io);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -704,7 +704,7 @@ static hawk_ooi_t read_input_stream (hawk_sed_t* sed, hawk_sed_io_arg_t* arg, ha
|
||||
if (open_input_stream(sed, arg, next, base) <= -1)
|
||||
{
|
||||
/* failed to open the next input stream */
|
||||
set_eiofil_for_iostd (sed, next);
|
||||
set_eiofil_for_iostd(sed, next);
|
||||
n = -1;
|
||||
break;
|
||||
}
|
||||
@ -965,7 +965,7 @@ static hawk_ooi_t x_out (
|
||||
{
|
||||
hawk_ooi_t n;
|
||||
n = hawk_sio_putoochars(arg->handle, dat, len);
|
||||
if (n <= -1) set_eiofil_for_iostd (sed, io);
|
||||
if (n <= -1) set_eiofil_for_iostd(sed, io);
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user