aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-03-08 10:05:35 +0100
committerHugo Hörnquist <hugo@hornquist.se>2019-03-08 10:05:35 +0100
commit0dff6c5d179aeb9e1ba3fc5f4dd679987e342036 (patch)
treec43ef6a0ef0fe6f684928a226a0f439975b20e01 /main.c
parentWork on recuring event stream. (diff)
downloadcalp-0dff6c5d179aeb9e1ba3fc5f4dd679987e342036.tar.gz
calp-0dff6c5d179aeb9e1ba3fc5f4dd679987e342036.tar.xz
Remove C vector library.
Diffstat (limited to 'main.c')
-rw-r--r--main.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/main.c b/main.c
index 771535fe..791bc5d3 100644
--- a/main.c
+++ b/main.c
@@ -44,20 +44,16 @@ int main (int argc, char** argv) {
puts("----------+----------+------------");
/* This loops over all VCALENDAR's in root */
- for (size_t i = 0; i < root.components.length; i++) {
- vcomponent* cal = GET(VECT(vcomponent))(&root.components, i);
+ FOR (LLIST, vcomponent, cal, &root.components) {
assert(strcmp(cal->type, "VCALENDAR") == 0);
char* filename = vcomponent_get_val(cal, "X-HNH-FILENAME");
/* This loop over all VEVENT's in the current VCALENDAR */
- for (size_t j = 0; j < cal->components.length; j++) {
- vcomponent* ev = GET(VECT(vcomponent))(&cal->components, j);
-
+ FOR (LLIST, vcomponent, ev, &cal->components) {
if (strcmp(ev->type, "VEVENT") != 0) continue;
- printf("%3lu : %3lu | %s | %s\n",
- i + 1, j + 1,
+ printf("%s | %s\n",
filename,
get_property(ev, "SUMMARY")->cur->value->key.mem);
}
@@ -65,8 +61,7 @@ int main (int argc, char** argv) {
} else if (strcmp(args.argv[0], "-g") == 0) {
/* TODO self might be broken */
if (arg_shift(&args) == 0) {
- for (size_t i = 0; i < root.components.length; i++) {
- vcomponent* cal = GET(VECT(vcomponent))(&root.components, i);
+ FOR (LLIST, vcomponent, cal, &root.components) {
assert(strcmp(cal->type, "VCALENDAR") == 0);
vcomponent* ev = FCHILD(cal);