mirror of
https://github.com/pine64/blisp.git
synced 2026-09-20 07:51:30 +00:00
This commit adds a simple check to both blisp commands that checks the
passed firmware .bin file exists, and is readable.
Justification: I flashed my Pinecil V2 that arrived today, and
misspelled the filename. blisp erased flash, and then exited - it did
not check the firmware .bin was readable/accessible, which meant my
Pinecil was soft-bricked.
I have tested the change, and it works for both commands when the input
file isn't readable.
I had to declare the `cmd_{iot,write}_args_print_glossary` function as
static before the call, so that we don't use undeclared functions before
we call them.
Signed-off-by: Dom Rodriguez <shymega@shymega.org.uk>
27 lines
575 B
C
27 lines
575 B
C
// SPDX-License-Identifier: MIT
|
|
#ifndef BLISP_CMD_H
|
|
#define BLISP_CMD_H
|
|
|
|
#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
|
|
#include <unistd.h>
|
|
#elif defined(_WIN32) || defined(WIN32)
|
|
#include <io.h>
|
|
#define R_OK 4
|
|
#define access _access
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include "error_codes.h"
|
|
struct cmd {
|
|
const char* name;
|
|
blisp_return_t (*args_init)();
|
|
blisp_return_t (*args_parse_exec)(int argc, char** argv);
|
|
void (*args_print_syntax)();
|
|
void (*args_free)();
|
|
};
|
|
|
|
extern struct cmd cmd_write;
|
|
extern struct cmd cmd_iot;
|
|
|
|
#endif // BLISP_CMD_H
|