third_party/inchi/INCHI_BASE/src/ichi_io.c
char* inchi_fgetsLf( char* line, int line_len, INCHI_IOSTREAM* inp_stream )
{
    char *p = NULL, *q;
    FILE* finp = NULL;

    if (inp_stream->type == INCHI_IOS_TYPE_FILE)
    {
        /* Read from file */
        finp = inp_stream->f;
        memset( line, 0, line_len );
        if (NULL != ( p = fgets( line, line_len, finp ) ) &&
             NULL == strchr( p, '\n' ))
        {
            char temp[64];
            /* bypass up to '\n' or up to end of file whichever comes first */
            while (NULL != fgets( temp, sizeof( temp ), finp ) && NULL == strchr( temp, '\n' ))
            {
                ;
            }
        }
    }
    else if (inp_stream->type == INCHI_IOS_TYPE_STRING)
    {
        /* Read from supplied string representing Molfile */
        memset( line, 0, line_len );
        if (NULL != ( p = inchi_sgets( line, line_len, inp_stream ) ) &&
             NULL == strchr( p, '\n' ))
        {
            char temp[64];
            /* bypass up to '\n' or up to end of file whichever comes first */
            while (NULL != inchi_sgets( temp, sizeof( temp ), inp_stream ) && NULL == strchr( temp, '\n' ))
            {
                ;
            }
        }
    }
    else
    {
        ;
    }

    if (p)
    {
        if (q = strchr( line, '\r' ))
        {
            /*  fix CR CR LF line terminator. */
            q[0] = '\n';
            q[1] = '\0';
        }
    }

    return p;
}
/****************************************************************************
    Read up to LF but not more than line_len bytes;
    if input line is too long, quietly ignore the rest of the line
****************************************************************************/
Read up to LF but not more than line_len bytes;
if input line is too long, quietly ignore the rest of the line
Read up to LF but not more than line_len bytes ; if input line is too long quietly ignore the rest of the line
char* inchi_fgetsLf( char* line, int line_len, INCHI_IOSTREAM* inp_stream )
{
    char *p = NULL, *q;
    FILE* finp = NULL;
    if (inp_stream->type == INCHI_IOS_TYPE_FILE)
    {
        finp = inp_stream->f;
        memset( line, 0, line_len );
        if (NULL != ( p = fgets( line, line_len, finp ) ) &&
             NULL == strchr( p, '\n' ))
        {
            char temp[64];
            while (NULL != fgets( temp, sizeof( temp ), finp ) && NULL == strchr( temp, '\n' ))
            {
                ;
            }
        }
    }
    else if (inp_stream->type == INCHI_IOS_TYPE_STRING)
    {
        memset( line, 0, line_len );
        if (NULL != ( p = inchi_sgets( line, line_len, inp_stream ) ) &&
             NULL == strchr( p, '\n' ))
        {
            char temp[64];
            while (NULL != inchi_sgets( temp, sizeof( temp ), inp_stream ) && NULL == strchr( temp, '\n' ))
            {
                ;
            }
        }
    }
    else
    {
        ;
    }
    if (p)
    {
        if (q = strchr( line, '\r' ))
        {
            q[0] = '\n';
            q[1] = '\0';
        }
    }
    return p;
}
char * inchi_fgetsLf ( char * line , int line_len , INCHI_IOSTREAM * inp_stream ) { char * p = NULL , * q ; FILE * finp = NULL ; if ( inp_stream -> type == INCHI_IOS_TYPE_FILE ) { finp = inp_stream -> f ; memset ( line , 0 , line_len ) ; if ( NULL != ( p = fgets ( line , line_len , finp ) ) && NULL == strchr ( p , ' \n ' ) ) { char temp [ 64 ] ; while ( NULL != fgets ( temp , sizeof ( temp ) , finp ) && NULL == strchr ( temp , ' \n ' ) ) { ; } } } else if ( inp_stream -> type == INCHI_IOS_TYPE_STRING ) { memset ( line , 0 , line_len ) ; if ( NULL != ( p = inchi_sgets ( line , line_len , inp_stream ) ) && NULL == strchr ( p , ' \n ' ) ) { char temp [ 64 ] ; while ( NULL != inchi_sgets ( temp , sizeof ( temp ) , inp_stream ) && NULL == strchr ( temp , ' \n ' ) ) { ; } } } else { ; } if ( p ) { if ( q = strchr ( line , ' \r ' ) ) { q [ 0 ] = ' \n ' ; q [ 1 ] = ' \0 ' ; } } return p ; }
Read up to LF but not more than line_len bytes;
if input line is too long, quietly ignore the rest of the line
Read up to LF but not more than line_len bytes ; if input line is too long quietly ignore the rest of the line
/* Read from file */ /* bypass up to '\n' or up to end of file whichever comes first */ /* Read from supplied string representing Molfile */ /* bypass up to '\n' or up to end of file whichever comes first */ /*  fix CR CR LF line terminator. */