/* mysort2.c Jim Plank 7 February, 1994 */ /* This program is just like mysort.c, except that it prints out the tree backwards. */ #include #include #include "fields.h" #include "rb.h" main() { IS is; char *copy; Rb_node sorted_lines, tmp; sorted_lines = make_rb(); is = new_inputstruct(NULL); while(get_line(is) >= 0) { copy = strdup(is->text1); rb_insert(sorted_lines, copy, NULL); } for (tmp = rb_last(sorted_lines); tmp != rb_nil(sorted_lines); tmp = rb_prev(tmp)) { printf("%s", tmp->k.key); } }