Patterns in C: chain of responsibility