tari

Tari

Jul 3rd, 2010
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. void parseSection(char *config) {
  2.     char *type, *name;
  3.     type = tokenize(config, DELIMS);
  4.     struct sectionHandler *h;
  5.     h = (struct sectionHandler *)bsearch(type, sections,
  6.                 sizeof(sections)/sizeof(struct sectionHandler),
  7.                 sizeof(struct sectionHandler), &sectComparator);
  8.     if (h == NULL) {
  9.         fprintf(stderr, "Unknown section type: %s\n", type);
  10.     } else {
  11.         name = tokenize(NULL, DELIMS);
  12.         //Skip past open bracket to first definition, pass to parser
  13.         void *rcb_private;
  14.         RENDER_CALLBACK rcb = h->parser(tokenize(NULL, DELIMS_OB), &rcb_private);
  15.     }
  16. }
  17.  
  18. int sectComparator(const void *a, const void *b) {
  19.     return strcmp(((struct sectionHandler *)a)->ident,
  20.                   ((struct sectionHandler *)b)->ident);
  21. }
Add Comment
Please, Sign In to add comment