#include #include #include #include #include #include #include "notifier.h" void new_notifier(char* param){ printf("Our new notifier was called with parameter %s\n", param); } void another_notifier(char* param){ printf("Another notifier was called with parameter %s\n", param); } void notifier_for_253(char* param){ if(strstr(param, "cs253")){ printf("CS253 access: %s\n", param); } } void notifier_for_435(char* param){ if(strstr(param, "cs435")){ printf("CS435 access: %s\n", param); } } int main(){ notifier_init(); notifier_add(new_notifier); notifier_add(another_notifier); // do something else char *line; while(1){ line = readline("prompt>> "); if(!line) { printf("Line was empty, leaving\n"); break; } if(!line[0]) continue; add_history(line); if(strstr(line, "cs253")) notifier_add(notifier_for_253); if(strstr(line, "cs435")) notifier_add(notifier_for_435); if(strstr(line, "clear")) notifier_clear(); free(line); } notifier_deinit(); return 0; }