Esempio n. 1
0
/*
 * fill the input buffer, doing ascii conversions if requested
 * conversions are  lf -> cr,lf  and cr -> cr, nul
 */
void read_ahead(PIO_CONTEXT pio_context, int  convert)  /*__fn__*/
{
struct bf *b;
struct tftphdr *dp;

    ARGSUSED_INT(convert);
    b = &bfs[nextone];              /* look at "next" buffer */
    if (b->counter != BF_FREE)      /* nop if not free */
        return;
    nextone = !nextone;             /* "incr" next buffer ptr */

    dp = (struct tftphdr *)b->buf;

        b->counter = (int)vf_read(pio_context->virtual_fd,
                                  (PFBYTE)&dp->th_data,
                                  SEGSIZE);
        return;
}
Esempio n. 2
0
/*----------------------------------------------------------------------*
                              rtp_file_read
 *----------------------------------------------------------------------*/
long rtp_file_read (RTP_HANDLE fileHandle, unsigned char * buffer, long count)
{
int result;

#ifdef RTP_DEBUG
    /* ----------------------------------- */
    /*  Clear the error state by setting   */
    /*  to 0.                              */
    /* ----------------------------------- */
    set_errno (0);
#endif

    if ((result = vf_read((int) fileHandle, (PFBYTE) buffer, (word) count)) < 0)
    {
#ifdef RTP_DEBUG
        result = xn_getlasterror( );
        RTP_DEBUG_OUTPUT_STR("rtp_file_read: error returned ");
        RTP_DEBUG_OUTPUT_INT(result);
        RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        return (-1);
    }
    return (result);
}