summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-08-05 09:38:58 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-08-05 09:38:58 +0000
commit00e10bda2a26e29d13f33986062e69b7f7b91a06 (patch)
tree634047932c546e94943883d08bbbff1dc41fe89b /src
parent09a5b507fcc797d92eaaddc1b1a5c7963c1d3ae3 (diff)
add bunch of option s to terminology suggested by Thanatermesis - not
in the exact way asked due to ecore-getopt, but they are there functionally. SVN revision: 74884
Diffstat (limited to 'src')
-rw-r--r--src/bin/config.c3
-rw-r--r--src/bin/config.h1
-rw-r--r--src/bin/main.c99
-rw-r--r--src/bin/options_behavior.c19
-rw-r--r--src/bin/termio.c4
-rw-r--r--src/bin/termio.h2
-rw-r--r--src/bin/termpty.c23
-rw-r--r--src/bin/termpty.h2
8 files changed, 140 insertions, 13 deletions
diff --git a/src/bin/config.c b/src/bin/config.c
index 7a67dba..0f40732 100644
--- a/src/bin/config.c
+++ b/src/bin/config.c
@@ -87,6 +87,8 @@ config_init(void)
87 EET_DATA_DESCRIPTOR_ADD_BASIC 87 EET_DATA_DESCRIPTOR_ADD_BASIC
88 (edd_base, Config, "disable_cursor_blink", disable_cursor_blink, EET_T_UCHAR); 88 (edd_base, Config, "disable_cursor_blink", disable_cursor_blink, EET_T_UCHAR);
89 EET_DATA_DESCRIPTOR_ADD_BASIC 89 EET_DATA_DESCRIPTOR_ADD_BASIC
90 (edd_base, Config, "disable_visual_bell", disable_visual_bell, EET_T_UCHAR);
91 EET_DATA_DESCRIPTOR_ADD_BASIC
90 (edd_base, Config, "translucent", translucent, EET_T_UCHAR); 92 (edd_base, Config, "translucent", translucent, EET_T_UCHAR);
91 EET_DATA_DESCRIPTOR_ADD_BASIC 93 EET_DATA_DESCRIPTOR_ADD_BASIC
92 (edd_base, Config, "mute", mute, EET_T_UCHAR); 94 (edd_base, Config, "mute", mute, EET_T_UCHAR);
@@ -363,6 +365,7 @@ config_load(const char *key)
363 config->jump_on_keypress = EINA_TRUE; 365 config->jump_on_keypress = EINA_TRUE;
364 config->flicker_on_key = EINA_TRUE; 366 config->flicker_on_key = EINA_TRUE;
365 config->disable_cursor_blink = EINA_FALSE; 367 config->disable_cursor_blink = EINA_FALSE;
368 config->disable_visual_bell = EINA_FALSE;
366 s = eina_unicode_unicode_to_utf8(sep, &slen); 369 s = eina_unicode_unicode_to_utf8(sep, &slen);
367 if (s) 370 if (s)
368 { 371 {
diff --git a/src/bin/config.h b/src/bin/config.h
index d225888..231c5dc 100644
--- a/src/bin/config.h
+++ b/src/bin/config.h
@@ -31,6 +31,7 @@ struct _Config
31 Eina_Bool jump_on_change; 31 Eina_Bool jump_on_change;
32 Eina_Bool flicker_on_key; 32 Eina_Bool flicker_on_key;
33 Eina_Bool disable_cursor_blink; 33 Eina_Bool disable_cursor_blink;
34 Eina_Bool disable_visual_bell;
34 Eina_Bool translucent; 35 Eina_Bool translucent;
35 Eina_Bool mute; 36 Eina_Bool mute;
36 Eina_Bool urg_bell; 37 Eina_Bool urg_bell;
diff --git a/src/bin/main.c b/src/bin/main.c
index 93c945c..e7c59bf 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -17,6 +17,7 @@ static Evas_Object *popmedia = NULL;
17static Evas_Object *conform = NULL; 17static Evas_Object *conform = NULL;
18static Ecore_Timer *flush_timer = NULL; 18static Ecore_Timer *flush_timer = NULL;
19static Eina_Bool focused = EINA_FALSE; 19static Eina_Bool focused = EINA_FALSE;
20static Eina_Bool hold = EINA_FALSE;
20 21
21static void 22static void
22_cb_del(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) 23_cb_del(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
@@ -85,7 +86,8 @@ _cb_change(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNU
85static void 86static void
86_cb_exited(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) 87_cb_exited(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
87{ 88{
88 elm_exit(); 89 printf("hold = %i\n", hold);
90 if (!hold) elm_exit();
89} 91}
90 92
91static void 93static void
@@ -93,7 +95,8 @@ _cb_bell(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSE
93{ 95{
94 Config *config = termio_config_get(term); 96 Config *config = termio_config_get(term);
95 97
96 edje_object_signal_emit(bg, "bell", "terminology"); 98 if (!config->disable_visual_bell)
99 edje_object_signal_emit(bg, "bell", "terminology");
97 if (!config) return; 100 if (!config) return;
98 if (config->urg_bell) 101 if (config->urg_bell)
99 { 102 {
@@ -208,6 +211,8 @@ static const Ecore_Getopt options = {
208 ECORE_GETOPT_STORE_STR ('e', "exec", 211 ECORE_GETOPT_STORE_STR ('e', "exec",
209 "command to execute. " 212 "command to execute. "
210 "Defaults to $SHELL (or passwd shel or /bin/sh)"), 213 "Defaults to $SHELL (or passwd shel or /bin/sh)"),
214 ECORE_GETOPT_STORE_STR ('C', "current-directory",
215 "Change to directory for execution of terminal command."),
211 ECORE_GETOPT_STORE_STR ('t', "theme", 216 ECORE_GETOPT_STORE_STR ('t', "theme",
212 "Use the named edje theme or path to theme file."), 217 "Use the named edje theme or path to theme file."),
213 ECORE_GETOPT_STORE_STR ('b', "background", 218 ECORE_GETOPT_STORE_STR ('b', "background",
@@ -222,10 +227,17 @@ static const Ecore_Getopt options = {
222 "Set window title."), 227 "Set window title."),
223 ECORE_GETOPT_STORE_STR ('i', "icon-name", 228 ECORE_GETOPT_STORE_STR ('i', "icon-name",
224 "Set icon name."), 229 "Set icon name."),
230 ECORE_GETOPT_STORE_STR ('f', "font",
231 "Set font (NAME/SIZE for scalable, NAME for bitmap."),
225 ECORE_GETOPT_CHOICE ('v', "video-module", 232 ECORE_GETOPT_CHOICE ('v', "video-module",
226 "Set emotion module to use.", emotion_choices), 233 "Set emotion module to use.", emotion_choices),
234
227 ECORE_GETOPT_STORE_BOOL('m', "video-mute", 235 ECORE_GETOPT_STORE_BOOL('m', "video-mute",
228 "Set mute mode for video playback."), 236 "Set mute mode for video playback."),
237 ECORE_GETOPT_STORE_BOOL('c', "cursor-blink",
238 "Set cursor blink mode."),
239 ECORE_GETOPT_STORE_BOOL('V', "visual-bell",
240 "Set visual bell mode."),
229 ECORE_GETOPT_STORE_TRUE('F', "fullscreen", 241 ECORE_GETOPT_STORE_TRUE('F', "fullscreen",
230 "Go into the fullscreen mode from start."), 242 "Go into the fullscreen mode from start."),
231 ECORE_GETOPT_STORE_TRUE('I', "iconic", 243 ECORE_GETOPT_STORE_TRUE('I', "iconic",
@@ -238,10 +250,13 @@ static const Ecore_Getopt options = {
238 "Become maximized from the start."), 250 "Become maximized from the start."),
239 ECORE_GETOPT_STORE_TRUE('W', "nowm", 251 ECORE_GETOPT_STORE_TRUE('W', "nowm",
240 "Terminology is run without a wm."), 252 "Terminology is run without a wm."),
241 ECORE_GETOPT_VERSION('V', "version"), 253 ECORE_GETOPT_STORE_TRUE('H', "hold",
242 ECORE_GETOPT_COPYRIGHT('C', "copyright"), 254 "Don't exit when the command process exits."),
243 ECORE_GETOPT_LICENSE('L', "license"), 255
244 ECORE_GETOPT_HELP('h', "help"), 256 ECORE_GETOPT_VERSION ('V', "version"),
257 ECORE_GETOPT_COPYRIGHT ('C', "copyright"),
258 ECORE_GETOPT_LICENSE ('L', "license"),
259 ECORE_GETOPT_HELP ('h', "help"),
245 ECORE_GETOPT_SENTINEL 260 ECORE_GETOPT_SENTINEL
246 } 261 }
247}; 262};
@@ -250,6 +265,7 @@ EAPI_MAIN int
250elm_main(int argc, char **argv) 265elm_main(int argc, char **argv)
251{ 266{
252 char *cmd = NULL; 267 char *cmd = NULL;
268 char *cd = NULL;
253 char *theme = NULL; 269 char *theme = NULL;
254 char *background = NULL; 270 char *background = NULL;
255 char *geometry = NULL; 271 char *geometry = NULL;
@@ -257,8 +273,11 @@ elm_main(int argc, char **argv)
257 char *role = NULL; 273 char *role = NULL;
258 char *title = NULL; 274 char *title = NULL;
259 char *icon_name = NULL; 275 char *icon_name = NULL;
276 char *font = NULL;
260 char *video_module = NULL; 277 char *video_module = NULL;
261 Eina_Bool video_mute = 0xff; /* unset */ 278 Eina_Bool video_mute = 0xff; /* unset */
279 Eina_Bool cursor_blink = 0xff; /* unset */
280 Eina_Bool visual_bell = 0xff; /* unset */
262 Eina_Bool fullscreen = EINA_FALSE; 281 Eina_Bool fullscreen = EINA_FALSE;
263 Eina_Bool iconic = EINA_FALSE; 282 Eina_Bool iconic = EINA_FALSE;
264 Eina_Bool borderless = EINA_FALSE; 283 Eina_Bool borderless = EINA_FALSE;
@@ -268,6 +287,7 @@ elm_main(int argc, char **argv)
268 Eina_Bool quit_option = EINA_FALSE; 287 Eina_Bool quit_option = EINA_FALSE;
269 Ecore_Getopt_Value values[] = { 288 Ecore_Getopt_Value values[] = {
270 ECORE_GETOPT_VALUE_STR(cmd), 289 ECORE_GETOPT_VALUE_STR(cmd),
290 ECORE_GETOPT_VALUE_STR(cd),
271 ECORE_GETOPT_VALUE_STR(theme), 291 ECORE_GETOPT_VALUE_STR(theme),
272 ECORE_GETOPT_VALUE_STR(background), 292 ECORE_GETOPT_VALUE_STR(background),
273 ECORE_GETOPT_VALUE_STR(geometry), 293 ECORE_GETOPT_VALUE_STR(geometry),
@@ -275,18 +295,25 @@ elm_main(int argc, char **argv)
275 ECORE_GETOPT_VALUE_STR(role), 295 ECORE_GETOPT_VALUE_STR(role),
276 ECORE_GETOPT_VALUE_STR(title), 296 ECORE_GETOPT_VALUE_STR(title),
277 ECORE_GETOPT_VALUE_STR(icon_name), 297 ECORE_GETOPT_VALUE_STR(icon_name),
298 ECORE_GETOPT_VALUE_STR(font),
278 ECORE_GETOPT_VALUE_STR(video_module), 299 ECORE_GETOPT_VALUE_STR(video_module),
300
279 ECORE_GETOPT_VALUE_BOOL(video_mute), 301 ECORE_GETOPT_VALUE_BOOL(video_mute),
302 ECORE_GETOPT_VALUE_BOOL(cursor_blink),
303 ECORE_GETOPT_VALUE_BOOL(visual_bell),
280 ECORE_GETOPT_VALUE_BOOL(fullscreen), 304 ECORE_GETOPT_VALUE_BOOL(fullscreen),
281 ECORE_GETOPT_VALUE_BOOL(iconic), 305 ECORE_GETOPT_VALUE_BOOL(iconic),
282 ECORE_GETOPT_VALUE_BOOL(borderless), 306 ECORE_GETOPT_VALUE_BOOL(borderless),
283 ECORE_GETOPT_VALUE_BOOL(override), 307 ECORE_GETOPT_VALUE_BOOL(override),
284 ECORE_GETOPT_VALUE_BOOL(maximized), 308 ECORE_GETOPT_VALUE_BOOL(maximized),
285 ECORE_GETOPT_VALUE_BOOL(nowm), 309 ECORE_GETOPT_VALUE_BOOL(nowm),
310 ECORE_GETOPT_VALUE_BOOL(hold),
311
286 ECORE_GETOPT_VALUE_BOOL(quit_option), 312 ECORE_GETOPT_VALUE_BOOL(quit_option),
287 ECORE_GETOPT_VALUE_BOOL(quit_option), 313 ECORE_GETOPT_VALUE_BOOL(quit_option),
288 ECORE_GETOPT_VALUE_BOOL(quit_option), 314 ECORE_GETOPT_VALUE_BOOL(quit_option),
289 ECORE_GETOPT_VALUE_BOOL(quit_option), 315 ECORE_GETOPT_VALUE_BOOL(quit_option),
316
290 ECORE_GETOPT_VALUE_NONE 317 ECORE_GETOPT_VALUE_NONE
291 }; 318 };
292 int args, retval = EXIT_SUCCESS; 319 int args, retval = EXIT_SUCCESS;
@@ -349,6 +376,52 @@ elm_main(int argc, char **argv)
349 config->temporary = EINA_TRUE; 376 config->temporary = EINA_TRUE;
350 } 377 }
351 378
379 if (font)
380 {
381 if (strchr(font, '/'))
382 {
383 char *fname = alloca(strlen(font) + 1);
384 char *p;
385
386 strcpy(fname, font);
387 p = strrchr(fname, '/');
388 if (p)
389 {
390 int sz;
391
392 *p = 0;
393 p++;
394 sz = atoi(p);
395 if (sz > 0) config->font.size = sz;
396 eina_stringshare_replace(&(config->font.name), fname);
397 }
398 config->font.bitmap = 0;
399 }
400 else
401 {
402 char buf[4096], *file;
403 Eina_List *files;
404 int n = strlen(font);
405
406 snprintf(buf, sizeof(buf), "%s/fonts", elm_app_data_dir_get());
407 files = ecore_file_ls(buf);
408 EINA_LIST_FREE(files, file)
409 {
410 if (n > 0)
411 {
412 if (!strncasecmp(file, font, n))
413 {
414 n = -1;
415 eina_stringshare_replace(&(config->font.name), file);
416 config->font.bitmap = 1;
417 }
418 }
419 free(file);
420 }
421 }
422 config->temporary = EINA_TRUE;
423 }
424
352 if (video_module) 425 if (video_module)
353 { 426 {
354 int i; 427 int i;
@@ -369,7 +442,17 @@ elm_main(int argc, char **argv)
369 config->mute = video_mute; 442 config->mute = video_mute;
370 config->temporary = EINA_TRUE; 443 config->temporary = EINA_TRUE;
371 } 444 }
372 445 if (cursor_blink != 0xff)
446 {
447 config->disable_cursor_blink = !cursor_blink;
448 config->temporary = EINA_TRUE;
449 }
450 if (visual_bell != 0xff)
451 {
452 config->disable_visual_bell = !visual_bell;
453 config->temporary = EINA_TRUE;
454 }
455
373 if (geometry) 456 if (geometry)
374 { 457 {
375 if (sscanf(geometry,"%ix%i+%i+%i", &size_w, &size_h, &pos_x, &pos_y) == 4) 458 if (sscanf(geometry,"%ix%i+%i+%i", &size_w, &size_h, &pos_x, &pos_y) == 4)
@@ -472,7 +555,7 @@ elm_main(int argc, char **argv)
472 evas_object_move(win, pos_x, pos_y); 555 evas_object_move(win, pos_x, pos_y);
473 } 556 }
474 557
475 term = o = termio_add(win, config, cmd, size_w, size_h); 558 term = o = termio_add(win, config, cmd, cd, size_w, size_h);
476 termio_win_set(o, win); 559 termio_win_set(o, win);
477 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 560 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
478 evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 561 evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
diff --git a/src/bin/options_behavior.c b/src/bin/options_behavior.c
index 22bc042..78ddcf6 100644
--- a/src/bin/options_behavior.c
+++ b/src/bin/options_behavior.c
@@ -40,6 +40,15 @@ _cb_op_behavior_cursor_blink_chg(void *data, Evas_Object *obj, void *event __UNU
40} 40}
41 41
42static void 42static void
43_cb_op_behavior_visual_bell_chg(void *data, Evas_Object *obj, void *event __UNUSED__)
44{
45 Evas_Object *term = data;
46 Config *config = termio_config_get(term);
47 config->disable_visual_bell = !elm_check_state_get(obj);
48 config_save(config, NULL);
49}
50
51static void
43_cb_op_behavior_flicker_chg(void *data, Evas_Object *obj, void *event __UNUSED__) 52_cb_op_behavior_flicker_chg(void *data, Evas_Object *obj, void *event __UNUSED__)
44{ 53{
45 Evas_Object *term = data; 54 Evas_Object *term = data;
@@ -154,6 +163,16 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
154 o = elm_check_add(bx); 163 o = elm_check_add(bx);
155 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); 164 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
156 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); 165 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
166 elm_object_text_set(o, "Visual Bell");
167 elm_check_state_set(o, !config->disable_visual_bell);
168 elm_box_pack_end(bx, o);
169 evas_object_show(o);
170 evas_object_smart_callback_add(o, "changed",
171 _cb_op_behavior_visual_bell_chg, term);
172
173 o = elm_check_add(bx);
174 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
175 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
157 elm_object_text_set(o, "Urgent on bell"); 176 elm_object_text_set(o, "Urgent on bell");
158 elm_check_state_set(o, config->urg_bell); 177 elm_check_state_set(o, config->urg_bell);
159 elm_box_pack_end(bx, o); 178 elm_box_pack_end(bx, o);
diff --git a/src/bin/termio.c b/src/bin/termio.c
index c5d4d80..3cd4e72 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -2187,7 +2187,7 @@ _smart_pty_command(void *data)
2187} 2187}
2188 2188
2189Evas_Object * 2189Evas_Object *
2190termio_add(Evas_Object *parent, Config *config, const char *cmd, int w, int h) 2190termio_add(Evas_Object *parent, Config *config, const char *cmd, const char *cd, int w, int h)
2191{ 2191{
2192 Evas *e; 2192 Evas *e;
2193 Evas_Object *obj, *g; 2193 Evas_Object *obj, *g;
@@ -2226,7 +2226,7 @@ termio_add(Evas_Object *parent, Config *config, const char *cmd, int w, int h)
2226 2226
2227 termpty_init(); 2227 termpty_init();
2228 2228
2229 sd->pty = termpty_new(cmd, w, h, config->scrollback); 2229 sd->pty = termpty_new(cmd, cd, w, h, config->scrollback);
2230 sd->pty->cb.change.func = _smart_pty_change; 2230 sd->pty->cb.change.func = _smart_pty_change;
2231 sd->pty->cb.change.data = obj; 2231 sd->pty->cb.change.data = obj;
2232 sd->pty->cb.scroll.func = _smart_pty_scroll; 2232 sd->pty->cb.scroll.func = _smart_pty_scroll;
diff --git a/src/bin/termio.h b/src/bin/termio.h
index 781a69e..5fa3f0b 100644
--- a/src/bin/termio.h
+++ b/src/bin/termio.h
@@ -3,7 +3,7 @@
3 3
4#include "config.h" 4#include "config.h"
5 5
6Evas_Object *termio_add(Evas_Object *parent, Config *config, const char *cmd, int w, int h); 6Evas_Object *termio_add(Evas_Object *parent, Config *config, const char *cmd, const char *cd, int w, int h);
7void termio_win_set(Evas_Object *obj, Evas_Object *win); 7void termio_win_set(Evas_Object *obj, Evas_Object *win);
8char *termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y); 8char *termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y);
9void termio_config_update(Evas_Object *obj); 9void termio_config_update(Evas_Object *obj);
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 8c7a2cc..a762d5f 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -150,6 +150,16 @@ _cb_exe_exit(void *data, int type __UNUSED__, void *event)
150 if (ev->pid != ty->pid) return ECORE_CALLBACK_PASS_ON; 150 if (ev->pid != ty->pid) return ECORE_CALLBACK_PASS_ON;
151 ty->exit_code = ev->exit_code; 151 ty->exit_code = ev->exit_code;
152 if (ty->cb.exited.func) ty->cb.exited.func(ty->cb.exited.data); 152 if (ty->cb.exited.func) ty->cb.exited.func(ty->cb.exited.data);
153
154 if (ty->hand_exe_exit) ecore_event_handler_del(ty->hand_exe_exit);
155 ty->hand_exe_exit = NULL;
156 if (ty->hand_fd) ecore_main_fd_handler_del(ty->hand_fd);
157 ty->hand_fd = NULL;
158 if (ty->fd >= 0) close(ty->fd);
159 ty->fd = -1;
160 if (ty->slavefd >= 0) close(ty->slavefd);
161 ty->slavefd = -1;
162
153 return ECORE_CALLBACK_PASS_ON; 163 return ECORE_CALLBACK_PASS_ON;
154} 164}
155 165
@@ -219,7 +229,7 @@ _limit_coord(Termpty *ty, Termstate *state)
219} 229}
220 230
221Termpty * 231Termpty *
222termpty_new(const char *cmd, int w, int h, int backscroll) 232termpty_new(const char *cmd, const char *cd, int w, int h, int backscroll)
223{ 233{
224 Termpty *ty; 234 Termpty *ty;
225 const char *pty; 235 const char *pty;
@@ -258,6 +268,16 @@ termpty_new(const char *cmd, int w, int h, int backscroll)
258 Eina_Bool needs_shell; 268 Eina_Bool needs_shell;
259 int i; 269 int i;
260 270
271 if (cd)
272 {
273 if (chdir(cd) != 0)
274 {
275 perror("chdir");
276 ERR("Cannot change to directory '%s'", cd);
277 exit(127);
278 }
279 }
280
261 needs_shell = ((!cmd) || 281 needs_shell = ((!cmd) ||
262 (strpbrk(cmd, " |&;<>()$`\\\"'*?#") != NULL)); 282 (strpbrk(cmd, " |&;<>()$`\\\"'*?#") != NULL));
263 DBG("cmd='%s' needs_shell=%u", cmd ? cmd : "", needs_shell); 283 DBG("cmd='%s' needs_shell=%u", cmd ? cmd : "", needs_shell);
@@ -378,6 +398,7 @@ termpty_cellrow_get(Termpty *ty, int y, int *wret)
378void 398void
379termpty_write(Termpty *ty, const char *input, int len) 399termpty_write(Termpty *ty, const char *input, int len)
380{ 400{
401 if (ty->fd < 0) return;
381 if (write(ty->fd, input, len) < 0) ERR("write %s", strerror(errno)); 402 if (write(ty->fd, input, len) < 0) ERR("write %s", strerror(errno));
382} 403}
383 404
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index 9582ef5..6a81ce8 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -126,7 +126,7 @@ struct _Termsave
126void termpty_init(void); 126void termpty_init(void);
127void termpty_shutdown(void); 127void termpty_shutdown(void);
128 128
129Termpty *termpty_new(const char *cmd, int w, int h, int backscroll); 129Termpty *termpty_new(const char *cmd, const char *cd, int w, int h, int backscroll);
130void termpty_free(Termpty *ty); 130void termpty_free(Termpty *ty);
131Termcell *termpty_cellrow_get(Termpty *ty, int y, int *wret); 131Termcell *termpty_cellrow_get(Termpty *ty, int y, int *wret);
132void termpty_write(Termpty *ty, const char *input, int len); 132void termpty_write(Termpty *ty, const char *input, int len);