#include #include #include "splay.h" #include "fields.h" int compare(Jval k1, Jval k2) { int i1, i2; i1 = atoi(k1.s); i2 = atoi(k2.s); if (i1 > i2) return 1; if (i1 < i2) return -1; return strcmp(k1.s, k2.s); } main() { Splay *b; Splay *bn; IS is; is = new_inputstruct(NULL); b = new_splay(); while (get_line(is) >= 0) { (void) splay_insert_gen(b, new_jval_s(strdup(is->text1)), new_jval_v(NULL), compare); } splay_traverse(bn, b) { printf("%s", jval_s(bn->key)); } }