cli: Extract layout argument processing
Move the processing of layout arguments (i.e. actual reading
of layout files / data from flash) into a shared function,
cli_process_layout_args().
This changes the sequence in `cli_classic.c` slightly: A layout
file is now read and parsed after the programmer init / chip
probing.
Change-Id: Ibb6574a27bcabc923a53ec355afd384da0665e4c
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/72985
diff --git a/include/cli.h b/include/cli.h
index b243f1d..4ef264d 100644
--- a/include/cli.h
+++ b/include/cli.h
@@ -15,6 +15,8 @@
#ifndef FLASHPROG_CLI_H
#define FLASHPROG_CLI_H
+#include "libflashprog.h"
+
enum {
OPTION_CHIP = 'c',
OPTION_PROGRAMMER = 'p',
@@ -47,5 +49,6 @@
int cli_parse_flash_args(struct flash_args *, int opt, const char *optarg);
int cli_parse_layout_args(struct layout_args *, int opt, const char *optarg);
+int cli_process_layout_args(struct flashprog_layout **, struct flashprog_flashctx *, const struct layout_args *);
#endif