Ignore:
Timestamp:
Jul 31, 2009, 2:01:25 AM (10 years ago)
Author:
Sam Hocevar
Message:

Make caca_printf(), caca_vprintf() and caca_put_str() return the number of
printed cells instead of always returning 0. This is handy if we want to
advance a cursor after each printf() call.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/caca_conio.c

    r3594 r3595  
    7474{
    7575    va_list args;
     76    int ret;
    7677
    7778    conio_init();
    7879
    7980    va_start(args, format);
    80     caca_vprintf(cv, caca_wherex(cv), caca_wherey(cv), format, args);
     81    ret = caca_vprintf(cv, caca_wherex(cv), caca_wherey(cv), format, args);
    8182    va_end(args);
    8283
     84    caca_gotoxy(cv, caca_wherex(cv) + ret, caca_wherey(cv));
     85
    8386    conio_refresh();
    8487
    85     /* FIXME: we should fix caca_vprintf so that it returns the number of
    86      * characters that were printed. */
    87     return 0;
     88    return ret;
    8889}
    8990
     
    113114    conio_init();
    114115
    115     /* TODO: implement this function */
     116    _caca_sleep(i * 1000);
    116117}
    117118
     
    272273{
    273274    va_list args;
     275    int ret;
    274276
    275277    conio_init();
    276278
    277279    va_start(args, format);
    278     caca_vprintf(cv, caca_wherex(cv), caca_wherey(cv), format, args);
     280    ret = caca_vprintf(cv, caca_wherex(cv), caca_wherey(cv), format, args);
    279281    va_end(args);
    280282
     283    caca_gotoxy(cv, caca_wherex(cv) + ret, caca_wherey(cv));
     284
    281285    conio_refresh();
    282286
    283     /* FIXME: we should fix caca_vprintf so that it returns the number of
    284      * characters that were printed. */
    285287    return 0;
    286288}
Note: See TracChangeset for help on using the changeset viewer.