aboutsummaryrefslogtreecommitdiffhomepage
path: root/io.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2005-10-12 05:31:16 +1000
committerGravatar axel <axel@liljencrantz.se>2005-10-12 05:31:16 +1000
commit4ba35b891908adeba74f412bdbf2716e8f58851b (patch)
treec53922f34d014a616c608db0b6339db5eea9b0cc /io.c
parent838ba08eaa883026d6fb88cd65dde33b16a564fd (diff)
Stop using anonymous unions
darcs-hash:20051011193116-ac50b-ad5f877bc54069233f804dffd136656da3a2c8f1.gz
Diffstat (limited to 'io.c')
-rw-r--r--io.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/io.c b/io.c
index 0c868d0e..498d9b03 100644
--- a/io.c
+++ b/io.c
@@ -38,22 +38,21 @@ Utilities for io redirection.
void io_buffer_read( io_data_t *d )
{
- exec_close(d->pipe_fd[1] );
+ exec_close(d->param1.pipe_fd[1] );
if( d->io_mode == IO_BUFFER )
{
- if( fcntl( d->pipe_fd[0], F_SETFL, 0 ) )
+ if( fcntl( d->param1.pipe_fd[0], F_SETFL, 0 ) )
{
wperror( L"fcntl" );
return;
}
- debug( 4, L"exec_read_io_buffer: blocking read on fd %d", d->pipe_fd[0] );
-
+ debug( 4, L"exec_read_io_buffer: blocking read on fd %d", d->param1.pipe_fd[0] );
while(1)
{
char b[4096];
int l;
- l=read_blocked( d->pipe_fd[0], b, 4096 );
+ l=read_blocked( d->param1.pipe_fd[0], b, 4096 );
if( l==0 )
{
break;
@@ -71,7 +70,7 @@ void io_buffer_read( io_data_t *d )
{
debug( 1,
L"An error occured while reading output from code block on fd %d",
- d->pipe_fd[0] );
+ d->param1.pipe_fd[0] );
wperror( L"exec_read_io_buffer" );
}
@@ -79,7 +78,7 @@ void io_buffer_read( io_data_t *d )
}
else
{
- b_append( d->out_buffer, b, l );
+ b_append( d->param2.out_buffer, b, l );
}
}
}
@@ -92,26 +91,26 @@ io_data_t *io_buffer_create()
buffer_redirect->io_mode=IO_BUFFER;
buffer_redirect->next=0;
- buffer_redirect->out_buffer= malloc( sizeof(buffer_t));
- b_init( buffer_redirect->out_buffer );
+ buffer_redirect->param2.out_buffer= malloc( sizeof(buffer_t));
+ b_init( buffer_redirect->param2.out_buffer );
buffer_redirect->fd=1;
- if( exec_pipe( buffer_redirect->pipe_fd ) == -1 )
+ if( exec_pipe( buffer_redirect->param1.pipe_fd ) == -1 )
{
debug( 1, PIPE_ERROR );
wperror (L"pipe");
- free( buffer_redirect->out_buffer );
+ free( buffer_redirect->param2.out_buffer );
free( buffer_redirect );
return 0;
}
- else if( fcntl( buffer_redirect->pipe_fd[0],
+ else if( fcntl( buffer_redirect->param1.pipe_fd[0],
F_SETFL,
O_NONBLOCK ) )
{
debug( 1, PIPE_ERROR );
wperror( L"fcntl" );
- free( buffer_redirect->out_buffer );
+ free( buffer_redirect->param2.out_buffer );
free( buffer_redirect );
return 0;
}
@@ -121,16 +120,16 @@ io_data_t *io_buffer_create()
void io_buffer_destroy( io_data_t *io_buffer )
{
- exec_close( io_buffer->pipe_fd[0] );
+ exec_close( io_buffer->param1.pipe_fd[0] );
/*
Dont free fd for writing. This should already be free'd before
calling exec_read_io_buffer on the buffer
*/
- b_destroy( io_buffer->out_buffer );
+ b_destroy( io_buffer->param2.out_buffer );
- free( io_buffer->out_buffer );
+ free( io_buffer->param2.out_buffer );
free( io_buffer );
}