Explicitly set an action variable to say which action to perform, instead of inferring it from other settings like whether a watch PID was set (#12).

This commit is contained in:
Andrew Wood
2025-09-18 06:18:18 +01:00
parent 8c2e934768
commit db80f838ff
3 changed files with 40 additions and 20 deletions
+11 -1
View File
@@ -23,6 +23,16 @@ extern "C" {
struct opts_s;
typedef struct opts_s *opts_t;
/*
* Overall program actions to select.
*/
typedef enum {
PV_ACTION_NOTHING, /* do nothing, and exit */
PV_ACTION_TRANSFER, /* transfer data */
PV_ACTION_STORE_AND_FORWARD, /* store to file, then output from it */
PV_ACTION_WATCHFD /* watch process file descriptors */
} pvaction_t;
/*
* Structure describing run-time options.
*
@@ -58,7 +68,7 @@ struct opts_s {
unsigned int argv_length; /* allocated array size */
unsigned int watchfd_count; /* number of watchfd items */
unsigned int watchfd_length; /* allocated array size */
bool do_nothing; /* exit-without-doing-anything flag */
pvaction_t action; /* the program action to perform */
bool progress; /* progress bar flag */
bool timer; /* timer flag */
bool eta; /* ETA flag */