|
@@ -1,15 +1,14 @@
|
|
-#include <unistd.h> // usleep
|
|
|
|
|
|
+#include <ctype.h>
|
|
#include <stdio.h>
|
|
#include <stdio.h>
|
|
-#include <time.h>
|
|
|
|
#include <string.h>
|
|
#include <string.h>
|
|
-#include <ctype.h>
|
|
|
|
|
|
+#include <time.h>
|
|
|
|
+#include <unistd.h> // usleep
|
|
|
|
|
|
#include "render.h"
|
|
#include "render.h"
|
|
#include "terminal.h"
|
|
#include "terminal.h"
|
|
#include "zf_log.h"
|
|
#include "zf_log.h"
|
|
|
|
|
|
-extern const char *strnstr(const char *source, int len, const char *needle);
|
|
|
|
-extern const char *repr(const char *data);
|
|
|
|
|
|
+#include "utils.h"
|
|
extern struct console_details console;
|
|
extern struct console_details console;
|
|
|
|
|
|
struct render current_render;
|
|
struct render current_render;
|
|
@@ -41,7 +40,6 @@ void render_sleep(void) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
Well SNAP! Mystic numbers don't remotely match ANSI color codes.
|
|
Well SNAP! Mystic numbers don't remotely match ANSI color codes.
|
|
|
|
|
|
@@ -448,7 +446,7 @@ void render(int fd, const char *string_out, int len) {
|
|
// Check our time from time to time.
|
|
// Check our time from time to time.
|
|
// If we start running long, disable sleeps.
|
|
// If we start running long, disable sleeps.
|
|
|
|
|
|
- while ((trigger = strnstr(cp, len - (cp - trigger), TRIGGER)) != NULL) {
|
|
|
|
|
|
+ while ((trigger = strnstr(cp, len - (cp - string_out), TRIGGER)) != NULL) {
|
|
// There is special things to handle in here.
|
|
// There is special things to handle in here.
|
|
while (cp != trigger) {
|
|
while (cp != trigger) {
|
|
elapsed = time(NULL) - start;
|
|
elapsed = time(NULL) - start;
|
|
@@ -462,15 +460,17 @@ void render(int fd, const char *string_out, int len) {
|
|
cp++;
|
|
cp++;
|
|
};
|
|
};
|
|
|
|
|
|
- // ZF_LOGI( "at trigger: (%s)", cp);
|
|
|
|
|
|
+ ZF_LOGI("at trigger: (%s)", cp);
|
|
cp += strlen(TRIGGER);
|
|
cp += strlen(TRIGGER);
|
|
|
|
|
|
// Ok, we're pointing at the trigger -- do something.
|
|
// Ok, we're pointing at the trigger -- do something.
|
|
cp = process_trigger(fd, cp);
|
|
cp = process_trigger(fd, cp);
|
|
|
|
|
|
- // ZF_LOGI( "after trigger: (%s)", cp);
|
|
|
|
|
|
+ ZF_LOGI("after trigger: (%s)", cp);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ ZF_LOGI("no more triggers, finish it up: (%s)", cp);
|
|
|
|
+
|
|
// We still might be under a rendering effect.
|
|
// We still might be under a rendering effect.
|
|
while (cp < (string_out + len)) {
|
|
while (cp < (string_out + len)) {
|
|
elapsed = time(NULL) - start;
|
|
elapsed = time(NULL) - start;
|