diff options
Diffstat (limited to '')
-rw-r--r-- | src/c_opts.c | 6 | ||||
-rw-r--r-- | src/c_opts.h | 3 | ||||
-rw-r--r-- | src/c_unixize.c | 2 | ||||
-rw-r--r-- | src/c_unixize.h | 2 |
4 files changed, 11 insertions, 2 deletions
diff --git a/src/c_opts.c b/src/c_opts.c index 7c8170e..77c55b1 100644 --- a/src/c_opts.c +++ b/src/c_opts.c @@ -65,6 +65,9 @@ c_opts(struct opts_s* opts, int argc, const char* argv[]) else if (opt == 'v') { opts->verbose = TRUE; } + else if (opt == 'p') { + opts->pretend = TRUE; + } else if (opt == '?') { dprintf( STDERR_FILENO, @@ -74,6 +77,9 @@ c_opts(struct opts_s* opts, int argc, const char* argv[]) exit(1); } } + if (opts->pretend == TRUE) { + opts->verbose = TRUE; + } if (optind < argc && argv[optind] != NULL) { printf("arg: %s\n", argv[optind]); } diff --git a/src/c_opts.h b/src/c_opts.h index a63e898..6704f0d 100644 --- a/src/c_opts.h +++ b/src/c_opts.h @@ -50,9 +50,12 @@ #include "c_unixize.h" +#define C_OPTS "Rvp" + struct opts_s { bool_t recursive; bool_t verbose; + bool_t pretend; }; void c_opts(struct opts_s*, int, const char*[]); diff --git a/src/c_unixize.c b/src/c_unixize.c index 5381880..5ae3d2f 100644 --- a/src/c_unixize.c +++ b/src/c_unixize.c @@ -65,6 +65,8 @@ main(int argc, const char* argv[]) printf("Recursive\n"); if (opts.verbose == TRUE) printf("Verbose\n"); + if (opts.pretend == TRUE) + printf("Verbose\n"); return (0); } diff --git a/src/c_unixize.h b/src/c_unixize.h index 4447c81..77a9ce0 100644 --- a/src/c_unixize.h +++ b/src/c_unixize.h @@ -46,8 +46,6 @@ #ifndef __C_UNIXIZE_H__ #define __C_UNIXIZE_H__ -#define C_OPTS ":Rv" - typedef enum bool_e { FALSE, TRUE |