@@ -25,7 +25,7 @@ int WriteHeader(struct outargs* oa) {
2525 if (oa == NULL || outfile == NULL ) return -1 ;
2626
2727 memcpy (& OA , oa , sizeof (struct outargs ));
28- if (oa -> format_version == ASCIINEMA_V1 || oa -> format_version == ASCIINEMA_V2 ) {
28+ if (oa -> format == ASCIINEMA_V1 || oa -> format == ASCIINEMA_V2 ) {
2929 /* Write asciicast header and append events. Format defined at
3030 * v1 https://github.com/asciinema/asciinema/blob/master/doc/asciicast-v1.md
3131 * v2 https://github.com/asciinema/asciinema/blob/master/doc/asciicast-v2.md
@@ -37,24 +37,24 @@ int WriteHeader(struct outargs* oa) {
3737 struct timeval tv ;
3838 gettimeofday (& tv , NULL );
3939
40- #define _CONDITION_TAB oa->format_version == ASCIINEMA_V1 ? '\t' : ' '
41- #define _CONDITION_NEWL oa->format_version == ASCIINEMA_V1 ? '\n' : ' '
40+ #define _CONDITION_TAB oa->format == ASCIINEMA_V1 ? '\t' : ' '
41+ #define _CONDITION_NEWL oa->format == ASCIINEMA_V1 ? '\n' : ' '
4242
4343 WriteStdout_fprintf ("{ " ); // Have Room For Putting Duration
44- WriteStdout_fprintf ("%c\"version\": %d,%c" , _CONDITION_TAB , oa -> format_version , _CONDITION_NEWL );
44+ WriteStdout_fprintf ("%c\"version\": %d,%c" , _CONDITION_TAB , oa -> format , _CONDITION_NEWL );
4545 WriteStdout_fprintf ("%c\"timestamp\": %ld,%c" , _CONDITION_TAB , tv .tv_sec , _CONDITION_NEWL );
4646 WriteStdout_fprintf ("%c\"width\": %d,%c" , _CONDITION_TAB , oa -> cols , _CONDITION_NEWL );
4747 WriteStdout_fprintf ("%c\"height\": %d,%c" , _CONDITION_TAB , oa -> rows , _CONDITION_NEWL );
4848 WriteStdout_fprintf ("%c\"command\": %s,%c" , _CONDITION_TAB , oa -> cmd ? oa -> cmd : "\"\"" , _CONDITION_NEWL );
4949 WriteStdout_fprintf ("%c\"title\": %s,%c" , _CONDITION_TAB , oa -> title ? oa -> title : "\"\"" , _CONDITION_NEWL );
50- WriteStdout_fprintf ("%c\"env\": %s%c%c" , _CONDITION_TAB , oa -> env , oa -> format_version == ASCIINEMA_V1 ? ',' : ' ' , _CONDITION_NEWL );
50+ WriteStdout_fprintf ("%c\"env\": %s%c%c" , _CONDITION_TAB , oa -> env , oa -> format == ASCIINEMA_V1 ? ',' : ' ' , _CONDITION_NEWL );
5151
5252 #undef _CONDITION_TAB
5353 #undef _CONDITION_NEWL
5454
55- if (oa -> format_version == ASCIINEMA_V1 )
55+ if (oa -> format == ASCIINEMA_V1 )
5656 WriteStdout_fprintf ("\t\"stdout\": [\n\t\t[ 0, \"\" ],\n" ); // v1 header finished, console data is appended in structure
57- else if (oa -> format_version == ASCIINEMA_V2 )
57+ else if (oa -> format == ASCIINEMA_V2 )
5858 WriteStdout_fprintf ("}\n[ 0, \"o\", \"\" ]\n" );
5959 }
6060
@@ -64,12 +64,12 @@ int WriteHeader(struct outargs* oa) {
6464int WriteDuration (float duration ) {
6565 if (outfile == NULL ) return -1 ;
6666
67- if (OA .format_version == ASCIINEMA_V1 || OA .format_version == ASCIINEMA_V2 ) {
67+ if (OA .format == ASCIINEMA_V1 || OA .format == ASCIINEMA_V2 ) {
6868 // seeks to header, overwriting spaces with duration
6969 size_t currPos = ftell (outfile );
7070 fseek (outfile , 2L , SEEK_SET );
7171
72- #define _CONDITION_NEWL OA.format_version == ASCIINEMA_V1 ? '\n' : ' '
72+ #define _CONDITION_NEWL OA.format == ASCIINEMA_V1 ? '\n' : ' '
7373 fprintf (outfile , "%c\t\"duration\": %.9g,%c" , _CONDITION_NEWL , duration , _CONDITION_NEWL );
7474 #undef _CONDITION_NEWL
7575
@@ -81,7 +81,7 @@ int WriteDuration(float duration) {
8181}
8282
8383void WriterClose () {
84- if (OA .format_version == ASCIINEMA_V1 ) {
84+ if (OA .format == ASCIINEMA_V1 ) {
8585 // Delete The Comma From Last Entry in "stdout" array
8686 size_t currPos = ftell (outfile );
8787 fseek (outfile , currPos - 2 , SEEK_SET );
@@ -99,9 +99,9 @@ void WriterClose() {
9999
100100void WriteStdoutStart (float duration ) {
101101 if (outfile ) {
102- if (OA .format_version == ASCIINEMA_V1 ) {
102+ if (OA .format == ASCIINEMA_V1 ) {
103103 WriteStdout_fprintf ("\t\t[ %0.4f, \"" , duration );
104- } else if (OA .format_version == ASCIINEMA_V2 ) {
104+ } else if (OA .format == ASCIINEMA_V2 ) {
105105 WriteStdout_fprintf ("[ %0.4f, \"o\", \"" , duration );
106106 }
107107 }
@@ -130,9 +130,9 @@ void WriteStdout_fputc(char character) {
130130
131131void WriteStdoutEnd () {
132132 if (outfile ) {
133- if (OA .format_version == ASCIINEMA_V1 ) {
133+ if (OA .format == ASCIINEMA_V1 ) {
134134 WriteStdout_fputs ("\" ],\n" );
135- } else if (OA .format_version == ASCIINEMA_V2 ) {
135+ } else if (OA .format == ASCIINEMA_V2 ) {
136136 WriteStdout_fputs ("\" ]\n" );
137137 }
138138 }
0 commit comments