function c = pnm_getc( file )
#
# PNM_GETC(file) - read a character from a pnm file
#
#    file : file id (must be opened)
#
    ich = fgets( file, 1 );
    if ( !isstr(ich) )
        error( "unexpected end of file" );
    endif
    
    ch = ich;
    
    if ( ch == '#' )
        while (1)
            ich = fgets( file, 1 );
            if ( !isstr(ich) )
                error( "unexpected end of file" );
            endif
            ch = ich;
            if ( index( "\n\r", ch ) != 0 )
                break;
            endif
        endwhile
    endif

    c = ch;

endfunction
