From 2de078329160a245dc95ab1cec99653e297e257b Mon Sep 17 00:00:00 2001 From: midipix Date: Fri, 8 Jul 2016 16:57:11 -0400 Subject: driver: added --cat support. --- include/ptycon/ptycon.h | 1 + src/driver/ptyc_driver_ctx.c | 9 ++++++--- src/internal/ptycon_driver_impl.h | 1 + src/pty/ptyc_pty_ctx.c | 3 ++- src/skin/ptyc_skin_default.c | 3 +++ 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/ptycon/ptycon.h b/include/ptycon/ptycon.h index 633302b..e725ad7 100644 --- a/include/ptycon/ptycon.h +++ b/include/ptycon/ptycon.h @@ -51,6 +51,7 @@ struct ptyc_common_ctx { uint64_t fmtflags; nt_pty * hpts; nt_pty * hptm; + char ** catv; }; struct ptyc_driver_ctx { diff --git a/src/driver/ptyc_driver_ctx.c b/src/driver/ptyc_driver_ctx.c index 70d44f5..c6070e4 100644 --- a/src/driver/ptyc_driver_ctx.c +++ b/src/driver/ptyc_driver_ctx.c @@ -143,7 +143,7 @@ static struct ptyc_driver_ctx_impl * ptyc_driver_ctx_alloc( memcpy(&ictx->ctx.cctx,cctx,sizeof(*cctx)); for (entry=meta->entries,units=ictx->units; entry->fopt || entry->arg; entry++) - if (!entry->fopt) + if (entry->tag == TAG_CAT) *units++ = entry->arg; ictx->meta = meta; @@ -217,9 +217,12 @@ int ptyc_get_driver_ctx( else if (!strcmp("raw",entry->arg)) cctx.drvflags |= PTYC_DRIVER_DBG_RAW; break; + + case TAG_CAT: + nunits++; + break; } - } else - nunits++; + } } if (!(ctx = ptyc_driver_ctx_alloc(meta,&cctx,nunits))) diff --git a/src/internal/ptycon_driver_impl.h b/src/internal/ptycon_driver_impl.h index 86336c5..009ac8e 100644 --- a/src/internal/ptycon_driver_impl.h +++ b/src/internal/ptycon_driver_impl.h @@ -24,6 +24,7 @@ enum app_tags { TAG_HELP, TAG_VERSION, TAG_DEBUG, + TAG_CAT, }; struct ptyc_term_ctx { diff --git a/src/pty/ptyc_pty_ctx.c b/src/pty/ptyc_pty_ctx.c index d796138..0338574 100644 --- a/src/pty/ptyc_pty_ctx.c +++ b/src/pty/ptyc_pty_ctx.c @@ -69,7 +69,8 @@ int ptyc_alloc_pty(struct ptyc_driver_ctx * dctx) return ptyc_set_status( dctx,status); - if (!(cctx->drvflags & PTYC_DRIVER_DBG_OVEN) + if (!dctx->units[0] + && !(cctx->drvflags & PTYC_DRIVER_DBG_OVEN) && !(cctx->drvflags & PTYC_DRIVER_DBG_RAW)) return ptyc_set_status( dctx,NT_STATUS_SUCCESS); diff --git a/src/skin/ptyc_skin_default.c b/src/skin/ptyc_skin_default.c index 9d710a6..fcf22ce 100644 --- a/src/skin/ptyc_skin_default.c +++ b/src/skin/ptyc_skin_default.c @@ -15,5 +15,8 @@ const struct argv_option ptyc_default_options[] = { "events; oven|raw: start a pseudo client using a pty handle " "in [cooked|raw] mode. default is 'event'."}, + {"cat", 'c',TAG_CAT,ARGV_OPTARG_REQUIRED,0,0,"", + "send %s to the terminal via the pty layer."}, + {0,0,0,0,0,0,0,0} }; -- cgit v1.2.3