All pastes #2082964 Raw Edit

Stuff

public c v1 · immutable
#2082964 ·published 2011-09-26 07:22 UTC
rendered paste body
#include <stdio.h>#include <stdlib.h>#include <string.h>#include "tree.h"#include "mylib.h"int main(int argc, char **argv) {   tree t;   char word[256];   int i;   for (i = 1; i < argc; i++) {      if (strcmp("-r", argv[i]) == 0) {         t = tree_new(RBT);      } else {         t = tree_new(BST);      }   }      while (getword(word, sizeof word, stdin) != EOF) {      tree_insert(t, word);   }   tree_preorder(t, print_key);   /* if (strcmp(argv[i], "-d") == 0) { */   /*    printf("Print depth of tree.\n"); */   /* } else if (strcmp(argv[i], "-o") == 0) { */   /*    printf("Filename to put tree into.\n"); */   /* } */   tree_delete(t);      return EXIT_SUCCESS;}