aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c15
-rw-r--r--src/options.c13
-rw-r--r--src/options.h1
3 files changed, 15 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c
index ea94921..92c7b8d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -11,19 +11,6 @@
#include "print.h"
#include "resources.h"
-/* This header file is automatically generated at build time from the Makefile
- */
-#include "program_info.h"
-
-void
-usage(int exit_code)
-{
- printf("Usage: %s [-s SECTOR_SIZE] [-b BUFFER_SIZE] [INFILE] REFFILE "
- "OUTFILE\n",
- PROGRAM_NAME_STR);
- exit(exit_code);
-}
-
void
clean_exit(resources_t *const res, int exit_code)
{
@@ -358,7 +345,7 @@ main(int argc, char **argv)
options_t opts;
if (options_parse(argc, argv, &opts) || opts.help) {
- usage(1);
+ options_usage(1);
}
const bool is_action_backup = (opts.in_file_path != NULL);
diff --git a/src/options.c b/src/options.c
index 019136b..a4dbcb9 100644
--- a/src/options.c
+++ b/src/options.c
@@ -7,6 +7,10 @@
#include "options.h"
#include "print.h"
+/* This header file is automatically generated at build time from the Makefile
+ */
+#include "program_info.h"
+
#define OPTIONS_DEFAULT_SECTOR_SIZE 512
#define OPTIONS_DEFAULT_BUFFER_SIZE (4 * 1024 * 1024)
@@ -94,6 +98,15 @@ options_parse(int argc, char **argv, options_t *const opts)
}
void
+options_usage(int exit_code)
+{
+ printf("Usage: %s [-s SECTOR_SIZE] [-b BUFFER_SIZE] [INFILE] REFFILE "
+ "OUTFILE\n",
+ PROGRAM_NAME_STR);
+ exit(exit_code);
+}
+
+void
options_init(options_t *const opts)
{
opts->help = false;
diff --git a/src/options.h b/src/options.h
index 71259aa..89c3cd4 100644
--- a/src/options.h
+++ b/src/options.h
@@ -15,5 +15,6 @@ typedef struct {
} options_t;
int options_parse(int argc, char **argv, options_t *const opts);
+void options_usage(int exit_code);
#endif /* OPTIONS_H */