2 #include "prio-queue.h"
4 static int intcmp(const void *va
, const void *vb
, void *data
)
6 const int *a
= va
, *b
= vb
;
10 static void show(int *v
)
19 int cmd_main(int argc
, const char **argv
)
21 struct prio_queue pq
= { intcmp
};
24 if (!strcmp(*argv
, "get"))
25 show(prio_queue_get(&pq
));
26 else if (!strcmp(*argv
, "dump")) {
28 while ((v
= prio_queue_get(&pq
)))
32 int *v
= malloc(sizeof(*v
));
34 prio_queue_put(&pq
, v
);