| | |
| | | #include "slist.h" |
| | | #include <stdio.h> |
| | | #include <stdlib.h> |
| | | #include "slist.h" |
| | | |
| | | void split(struct dns_list *head, struct dns_list **a, struct dns_list **b); |
| | | struct dns_list *merge(struct dns_list *a, struct dns_list *b); |
| | |
| | | } |
| | | end->next = NULL; |
| | | end->server = server; |
| | | end->time.tv_nsec = 0; end->time.tv_sec = 0; |
| | | end->time.tv_nsec = 0; |
| | | end->time.tv_sec = 0; |
| | | return 0; |
| | | } |
| | | |
| | |
| | | struct dns_list *merge(struct dns_list *a, struct dns_list *b) |
| | | { |
| | | struct dns_list *out = NULL; |
| | | if (!a) |
| | | return b; |
| | | if (!b) |
| | | return a; |
| | | if (!a) return b; |
| | | if (!b) return a; |
| | | |
| | | if (comp_times(a->time, b->time) > 0) { |
| | | out = b; |
| | |
| | | { |
| | | printf("%-20s | %s\n", "Server", "Time"); |
| | | while (head) { |
| | | printf("%-20s | %ld.%09ld\n", head->server, head->time.tv_sec, head->time.tv_nsec); |
| | | printf("%-20s | %ld.%09ld\n", head->server, head->time.tv_sec, |
| | | head->time.tv_nsec); |
| | | head = head->next; |
| | | } |
| | | return 0; |