dmenu/patch/numbers.c

17 lines
364 B
C
Raw Normal View History

2020-08-05 12:40:03 +02:00
static char numbers[NUMBERSBUFSIZE] = "";
static void
2024-07-16 21:42:32 +02:00
recalculatenumbers(void)
2020-08-05 12:40:03 +02:00
{
unsigned int numer = 0, denom = 0;
struct item *item;
if (matchend) {
numer++;
for (item = matchend; item && item->left; item = item->left)
numer++;
}
for (item = items; item && item->text; item++)
denom++;
snprintf(numbers, NUMBERSBUFSIZE, "%d/%d", numer, denom);
2024-07-16 21:42:32 +02:00
}