49
49
* @fileoverview Terminal Screencast Recorder / Player, e.g.
50
50
*
51
51
* make o//examples/script.com
52
- * o//examples/script.com -r
52
+ * o//examples/script.com -w80 -h24 -r recording.tty
53
53
* # type stuff..
54
54
* # CTRL-D
55
- * o//examples/script.com -p typescript
55
+ * o//examples/script.com -p recording.tty
56
56
*
57
57
* @note works on Linux, OpenBSD, NetBSD, FreeBSD, MacOS
58
58
* @see https://asciinema.org/
@@ -103,9 +103,9 @@ main(int argc, char *argv[])
103
103
fd_set rfd ;
104
104
int fm_fd ;
105
105
int aflg , Fflg , kflg , pflg , ch , k , n ;
106
- int flushtime , readstdin ;
106
+ int flushtime , readstdin , width , height ;
107
107
108
- aflg = Fflg = kflg = pflg = 0 ;
108
+ aflg = Fflg = kflg = pflg = height = width = 0 ;
109
109
usesleep = 1 ;
110
110
rawout = 0 ;
111
111
flushtime = 30 ;
@@ -115,7 +115,7 @@ main(int argc, char *argv[])
115
115
116
116
(void )fm_fd ;
117
117
118
- while ((ch = getopt (argc , argv , "adeFfkpqrt:" )) != -1 )
118
+ while ((ch = getopt (argc , argv , "adeFfkpqrt:w:h: " )) != -1 )
119
119
switch (ch ) {
120
120
case 'a' :
121
121
aflg = 1 ;
@@ -145,6 +145,12 @@ main(int argc, char *argv[])
145
145
if (flushtime < 0 )
146
146
err (1 , "invalid flush time %d" , flushtime );
147
147
break ;
148
+ case 'w' :
149
+ width = atoi (optarg );
150
+ break ;
151
+ case 'h' :
152
+ height = atoi (optarg );
153
+ break ;
148
154
case '?' :
149
155
default :
150
156
usage ();
@@ -172,6 +178,10 @@ main(int argc, char *argv[])
172
178
if (openpty (& master , & slave , NULL , NULL , NULL ) == -1 )
173
179
err (1 , "openpty" );
174
180
} else {
181
+ if (width )
182
+ win .ws_col = width ;
183
+ if (height )
184
+ win .ws_row = height ;
175
185
if (openpty (& master , & slave , NULL , & tt , & win ) == -1 )
176
186
err (1 , "openpty" );
177
187
ttyflg = 1 ;
0 commit comments