diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/driver/ptyc_driver_ctx.c | 4 | ||||
-rw-r--r-- | src/internal/ptycon_driver_impl.h | 1 | ||||
-rw-r--r-- | src/ptycon.c | 16 | ||||
-rw-r--r-- | src/skin/ptyc_skin_default.c | 7 |
4 files changed, 28 insertions, 0 deletions
diff --git a/src/driver/ptyc_driver_ctx.c b/src/driver/ptyc_driver_ctx.c index c6070e4..cf9b170 100644 --- a/src/driver/ptyc_driver_ctx.c +++ b/src/driver/ptyc_driver_ctx.c @@ -221,6 +221,10 @@ int ptyc_get_driver_ctx( case TAG_CAT: nunits++; break; + + case TAG_WAIT: + cctx.drvflags |= PTYC_DRIVER_DBG_WAIT; + break; } } } diff --git a/src/internal/ptycon_driver_impl.h b/src/internal/ptycon_driver_impl.h index 009ac8e..22b4409 100644 --- a/src/internal/ptycon_driver_impl.h +++ b/src/internal/ptycon_driver_impl.h @@ -25,6 +25,7 @@ enum app_tags { TAG_VERSION, TAG_DEBUG, TAG_CAT, + TAG_WAIT, }; struct ptyc_term_ctx { diff --git a/src/ptycon.c b/src/ptycon.c index dd483b8..18cba4e 100644 --- a/src/ptycon.c +++ b/src/ptycon.c @@ -25,6 +25,19 @@ static void ptycon_exit(int code) code); } +static int ptycon_dbg_helper(int32_t status) +{ + return status ? -1 : 0; +} + +static int ptycon_dbg_init(char ** argv) +{ + if (argv[1] && !(ntapi->tt_strcmp_multibyte(argv[1],"--wait"))) + return ptycon_dbg_helper( + ntapi->tt_wait_for_dummy_event()); + return 0; +} + static int32_t ptycon_start(int argc, char ** argv, char ** envp) { int32_t status; @@ -44,6 +57,9 @@ static int32_t ptycon_start(int argc, char ** argv, char ** envp) envp = rtdata->envp; } + /* early debug (optional) */ + ptycon_dbg_init(argv); + /* no tty session? */ if (!rtdata->srv_keys[0]) return ptyc_main(argc,argv,envp); diff --git a/src/skin/ptyc_skin_default.c b/src/skin/ptyc_skin_default.c index fcf22ce..49033cc 100644 --- a/src/skin/ptyc_skin_default.c +++ b/src/skin/ptyc_skin_default.c @@ -18,5 +18,12 @@ const struct argv_option ptyc_default_options[] = { {"cat", 'c',TAG_CAT,ARGV_OPTARG_REQUIRED,0,0,"<file>", "send %s to the terminal via the pty layer."}, + {"wait", 0,TAG_WAIT,ARGV_OPTARG_NONE,0,0,0, + "wait on a dummy event upon invocation of ptycon_start(); " + "this option has the sole purpose of rendering debub " + "sessions with foreign debuggers more convenient, " + "and must be the first command-line argument " + "passed to the utility."}, + {0,0,0,0,0,0,0,0} }; |