int bck_read( void* handle, char* buf, int len ){ char *eot = ((CHILD*)handle)->cph_eot; int eot_len = strlen(eot); if( len ){ if( !strncmp( buf, eot, len ) ){ _dbg(F,L,3, "logical end of stdin from %s", ((CHILD*)handle)->cph_cmd ); return NPOLL_RET_IDLE; } else if (!strncmp(eot, buf+len-eot_len, eot_len)) { len -= eot_len; _dbg(F,L,3, "unterminated end of stdin from %s", ((CHILD*)handle)->cph_cmd ); _dbg(F,L,2, "<<-- %.*s", len, buf); Perl_av_push( aTHX_ ((CHILD*)handle)->cph_out_array , Perl_newSVpv( aTHX_ buf, len ) ); return NPOLL_RET_IDLE; } else { _dbg(F,L,2, "<<-- %.*s", len, buf); Perl_av_push( aTHX_ ((CHILD*)handle)->cph_out_array , Perl_newSVpv( aTHX_ buf, len ) ); return NPOLL_CONTINUE; } } else { _dbg(F,L,3, "eof on stdin from %s", ((CHILD*)handle)->cph_cmd ); return NPOLL_RET_IDLE; } }
int err_read( void* handle, char* buf, int len ){ if( len ){ /* * Interrupt handling doesn't work quite right. As yet undiagnosed * but this code is left in because it's no worse than not having it. */ if( !strncmp( buf, "Interrupt", 9 ) ){ _dbg(F,L,3, "interrupted end of cmd from %s", ((CHILD*)handle)->cph_cmd ); return NPOLL_RET_IDLE; } else { _dbg(F,L,2, "<<== '%.*s'", len, buf); Perl_av_push( aTHX_ ((CHILD*)handle)->cph_err_array , Perl_newSVpv( aTHX_ buf, len ) ); return NPOLL_CONTINUE; } } else { return NPOLL_RET_IDLE; } }
void AV::push( const SV& val ){ SV temp = val; Perl_av_push( my_perl, (old_AV_ptr)m_c_av_ptr, (old_SV_ptr)temp.m_c_sv_ptr ); }