GUAC-1452: Write required header/footer.

This commit is contained in:
Michael Jumper 2016-01-26 17:00:49 -08:00
parent b2a356d4b8
commit 88a121f81e
2 changed files with 20 additions and 0 deletions

View File

@ -64,6 +64,10 @@ guac_terminal_typescript* guac_terminal_typescript_alloc(const char* path,
typescript->timing_fd = timing_fd; typescript->timing_fd = timing_fd;
typescript->length = 0; typescript->length = 0;
/* Write header */
guac_common_write(data_fd, GUAC_TERMINAL_TYPESCRIPT_HEADER,
sizeof(GUAC_TERMINAL_TYPESCRIPT_HEADER) - 1);
return typescript; return typescript;
} }
@ -100,6 +104,10 @@ void guac_terminal_typescript_free(guac_terminal_typescript* typescript) {
/* Flush any pending data */ /* Flush any pending data */
guac_terminal_typescript_flush(typescript); guac_terminal_typescript_flush(typescript);
/* Write footer */
guac_common_write(typescript->data_fd, GUAC_TERMINAL_TYPESCRIPT_FOOTER,
sizeof(GUAC_TERMINAL_TYPESCRIPT_FOOTER) - 1);
/* Close file descriptors */ /* Close file descriptors */
close(typescript->data_fd); close(typescript->data_fd);
close(typescript->timing_fd); close(typescript->timing_fd);

View File

@ -26,6 +26,18 @@
#include "config.h" #include "config.h"
/**
* A NULL-terminated string of raw bytes which should be written at the
* beginning of any typescript.
*/
#define GUAC_TERMINAL_TYPESCRIPT_HEADER "[BEGIN TYPESCRIPT]\n"
/**
* A NULL-terminated string of raw bytes which should be written at the
* end of any typescript.
*/
#define GUAC_TERMINAL_TYPESCRIPT_FOOTER "\n[END TYPESCRIPT]\n"
/** /**
* An active typescript, consisting of a data file (raw terminal output) and * An active typescript, consisting of a data file (raw terminal output) and
* timing file (related timestamps and byte counts). * timing file (related timestamps and byte counts).