- if (!firstchar) return; /* too early to do anything */
-
- if (rt->pd->handler) {
- /* call custom handler */
-#ifdef DEBUG
- fprintf(stderr, "Calling custom handler for ES <%s>.\n", rt->pd->esbuf);
-#endif
-
- int answer = (*(rt->pd->handler))(rt, rt->pd->esbuf);
- if (answer == ROTE_HANDLERESULT_OK) {
- /* successfully handled */
-#ifdef DEBUG
- fprintf(stderr, "Handler returned OK. Done with escape sequence.\n");
-#endif
-
- cancel_escape_sequence(rt);
- return;
- }
- else if (answer == ROTE_HANDLERESULT_NOTYET) {
- /* handler might handle it when more characters are appended to
- * it. So for now we don't interpret it */
-#ifdef DEBUG
- fprintf(stderr, "Handler returned NOTYET. Waiting for more chars.\n");
-#endif
-
- return;
- }
-
- /* If we got here then answer == ROTE_HANDLERESULT_NOWAY */
- /* handler said it can't handle that escape sequence,
- * but we can still try handling it ourselves, so
- * we proceed normally. */
-#ifdef DEBUG
- fprintf(stderr, "Handler returned NOWAY. Trying our handlers.\n");
-#endif
- }