From 220625f370839c7ea5ca699ec0267cd179aff4a1 Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Sat, 14 Mar 2026 21:50:50 +0000 Subject: [PATCH] Add TODO markers for the next steps of monitor mode (#67). --- src/main/main.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/main/main.c b/src/main/main.c index c71c26b..dd35750 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -267,6 +267,25 @@ static int pv__store_and_forward(pvstate_t state, opts_t opts, bool can_have_eta } +/* + * Run in monitor mode: run a process and run the main transfer loop on its + * input, output, or both. Returns the appropriate exit status. + */ +static int pv__monitor(pvstate_t state, opts_t opts) +{ + int retcode; + + retcode = 0; + + /* TODO: make appropriate pipes. */ + /* TODO: fork and run the command to be monitored, with in/out fds set. */ + /* TODO: fork for out monitor if monitoring both. */ + /* TODO: monitor the appropriate side; if both, use name1/format1 for the in side. */ + + return retcode; +} + + /* * Process command-line arguments and set option flags, then call functions * to initialise, and finally enter the main loop. @@ -361,6 +380,8 @@ int main(int argc, char **argv) /* * Put our list of input files into the PV internal state. + * + * TODO: don't do this in monitor mode. */ if (NULL != opts->argv) { pv_state_inputfiles(state, opts->argc, (const char **) (opts->argv)); @@ -469,6 +490,8 @@ int main(int argc, char **argv) } } + /* TODO: size calculation for monitor mode. */ + /* Initialise the signal handling. */ pv_sig_init(state); @@ -562,8 +585,7 @@ int main(int argc, char **argv) break; case PV_ACTION_MONITOR: /* Run a process and monitor its input and output. */ - /* TODO: run the monitor action. */ - retcode = 1; + retcode = pv__monitor(state, opts); break; }