Browse Source

use entry pointers rather than entries in buf

master
katherine 7 months ago
parent
commit
abc20333ab
Signed by: ageha <ageha@airen-no-jikken.icu> GPG Key ID: 62E17859D559AEF3
1 changed files with 9 additions and 9 deletions
  1. +9
    -9
      src/print.c

+ 9
- 9
src/print.c View File

@@ -45,17 +45,17 @@ static const char *month_names[] = {

struct buf_s {
time_t rt;
struct entry_s e;
struct entry_s *ep;
};

static int buf_cmp(const void *a, const void *b)
{
const struct buf_s *a1 = a, *b1 = b;

if (b1->e.urgent && !(a1->e.urgent))
if (b1->ep->urgent && !(a1->ep->urgent))
return 1;

if (a1->e.urgent && !(b1->e.urgent))
if (a1->ep->urgent && !(b1->ep->urgent))
return -1;

if (a1->rt > b1->rt)
@@ -127,9 +127,9 @@ void print_console(struct calendar_s *cal)
continue;

buf[j].rt = *rttmp;
buf[j].e = cal->entries[i];
buf[j].ep = &(cal->entries[i]);

if (buf[j].e.urgent)
if (buf[j].ep->urgent)
has_urgent = true;

j++;
@@ -144,7 +144,7 @@ void print_console(struct calendar_s *cal)
for (i = 0; i < j; i++) {
t = *localtime( &(buf[i].rt) );

if (has_urgent && !urgent_printed && !(buf[i].e.urgent) ) {
if (has_urgent && !urgent_printed && !(buf[i].ep->urgent) ) {
printf("\n\n[ normal ]\n\n");
urgent_printed = true;
}
@@ -181,8 +181,8 @@ void print_console(struct calendar_s *cal)
}


if (buf[i].e.msg != NULL)
printf(" %s", buf[i].e.msg);
if (buf[i].ep->msg != NULL)
printf(" %s", buf[i].ep->msg);

puts("");
}
@@ -212,7 +212,7 @@ void print_script(struct calendar_s *cal)
continue;

buf[j].rt = *rttmp;
buf[j].e = cal->entries[i];
buf[j].ep = &(cal->entries[i]);

j++;
}


Loading…
Cancel
Save