コード例 #1
0
ファイル: main-gcu.c プロジェクト: CJNyfalt/angband
/*
 * Place some text on the screen using an attribute
 */
static errr Term_text_gcu(int x, int y, int n, byte a, const char *s)
{
	term_data *td = (term_data *)(Term->data);

#ifdef A_COLOR
	/* Set the color */
	if (can_use_color) (void)wattrset(td->win, colortable[a & 255]);
#endif

	/* Move the cursor */
	wmove(td->win, y, x);

	/* Write to screen */
	while (n--) {
		unsigned char c = *(s++);

		if (c < 32) {
			wattron(td->win, ctrl_attr[c]);
			waddch(td->win, filter_char(ctrl_char[c]));
			wattroff(td->win, ctrl_attr[c]);
		} else {
			waddch(td->win, filter_char(c));
		}
	}

#if defined(A_COLOR)
	/* Unset the color */
	if (can_use_color) wattrset(td->win, A_NORMAL);
#endif

	/* Success */
	return (0);
}
コード例 #2
0
ファイル: entrez-fetcher.c プロジェクト: mariux/sratoolkit
rc_t KEntrezFetcherRead ( KEntrezFetcher *self,
                          void *dst, size_t dst_size, size_t *num_read )
{
    rc_t rc;
    
    if ( dst == NULL || dst_size == 0 || num_read == NULL )
        return RC ( rcApp, rcFunction, rcAccessing, rcParam, rcNull );
    if ( self == NULL )
        return RC ( rcApp, rcFunction, rcAccessing, rcSelf, rcNull );
    if ( self -> url_fetcher == NULL || self -> uri == NULL )
        return RC ( rcApp, rcFunction, rcAccessing, rcParam, rcNull );

    rc = KUrlFetcherRead( self -> url_fetcher, self -> uri, dst, dst_size, num_read );
    if ( rc == 0 )
    {
        remove_first_line( dst, num_read );
        filter_char( dst, num_read, '\n' );
    }
    return rc;
}