summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-07-13 21:05:48 -0400
committermidipix <writeonce@midipix.org>2016-07-21 03:47:28 -0400
commitf67c207318b2f2e39d67dfbae582186cffa99666 (patch)
treed5aa7dedc508c41622020883f1673cbe6bd16648
parent7307c5eee83cbc76de38ab768000dccbae2bf11e (diff)
downloadptycon-f67c207318b2f2e39d67dfbae582186cffa99666.tar.bz2
ptycon-f67c207318b2f2e39d67dfbae582186cffa99666.tar.xz
driver: added --daemon support.
-rw-r--r--include/ptycon/ptycon.h2
-rw-r--r--src/driver/ptyc_driver_ctx.c9
-rw-r--r--src/internal/ptycon_driver_impl.h1
-rw-r--r--src/skin/ptyc_skin_default.c7
4 files changed, 19 insertions, 0 deletions
diff --git a/include/ptycon/ptycon.h b/include/ptycon/ptycon.h
index f53c764..b02ddf8 100644
--- a/include/ptycon/ptycon.h
+++ b/include/ptycon/ptycon.h
@@ -39,6 +39,8 @@ extern "C" {
#define PTYC_DRIVER_DBG_OVEN 0x0080
#define PTYC_DRIVER_DBG_RAW 0x0100
#define PTYC_DRIVER_DBG_WAIT 0x0200
+#define PTYC_DRIVER_DAEMON_ALWAYS 0x1000
+#define PTYC_DRIVER_DAEMON_NEVER 0x2000
struct ptyc_source_version {
int major;
diff --git a/src/driver/ptyc_driver_ctx.c b/src/driver/ptyc_driver_ctx.c
index 7b0b596..4129cf5 100644
--- a/src/driver/ptyc_driver_ctx.c
+++ b/src/driver/ptyc_driver_ctx.c
@@ -204,6 +204,15 @@ int ptyc_get_driver_ctx(
cctx.drvflags |= PTYC_DRIVER_VERSION;
break;
+ case TAG_DAEMON:
+ if (!strcmp("always",entry->arg))
+ cctx.drvflags |= PTYC_DRIVER_DAEMON_ALWAYS;
+
+ else if (!strcmp("never",entry->arg))
+ cctx.drvflags |= PTYC_DRIVER_DAEMON_NEVER;
+
+ break;
+
case TAG_DEBUG:
if (!entry->arg) {
cctx.drvflags |= PTYC_DRIVER_DBG_EVENT;
diff --git a/src/internal/ptycon_driver_impl.h b/src/internal/ptycon_driver_impl.h
index 13a2e35..b1eefc7 100644
--- a/src/internal/ptycon_driver_impl.h
+++ b/src/internal/ptycon_driver_impl.h
@@ -24,6 +24,7 @@ extern const gdi_vtbl * const ptyc_gdi;
enum app_tags {
TAG_HELP,
TAG_VERSION,
+ TAG_DAEMON,
TAG_DEBUG,
TAG_CAT,
TAG_WAIT,
diff --git a/src/skin/ptyc_skin_default.c b/src/skin/ptyc_skin_default.c
index 49033cc..1239947 100644
--- a/src/skin/ptyc_skin_default.c
+++ b/src/skin/ptyc_skin_default.c
@@ -8,6 +8,13 @@ const struct argv_option ptyc_default_options[] = {
{"help", 'h',TAG_HELP,ARGV_OPTARG_OPTIONAL,0,"short|long",0,
"show usage information [listing %s options only]"},
+ {"daemon", 0,TAG_DAEMON,ARGV_OPTARG_OPTIONAL,0,"default|always|never",0,
+ "create a daemon thread and handle signals sent by the "
+ "application's own controlling terminal. The default is "
+ "to create a daemon thread when ptycon runs as a stand-alone "
+ "program, and defer the task to the main utility in all other "
+ "cases."},
+
{"debug", 'd',TAG_DEBUG,ARGV_OPTARG_OPTIONAL,0,
"event|oven|raw",0,
"start an internal thread for debugging purposes. "