util/spkmodem-recv: add a usage function

replace the err call in getopt

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-12 05:22:25 +00:00
parent 69fb0618cc
commit fcecb1229e
+9 -1
View File
@@ -71,6 +71,7 @@ static void print_stats(struct decoder_state *st);
static void reset_char(struct decoder_state *st); static void reset_char(struct decoder_state *st);
static void err(int errval, const char *msg, ...); static void err(int errval, const char *msg, ...);
static void usage(void);
static const char *progname(void); static const char *progname(void);
int getopt(int, char * const *, const char *); int getopt(int, char * const *, const char *);
@@ -110,7 +111,7 @@ main(int argc, char **argv)
st.debug = 1; st.debug = 1;
break; break;
default: default:
err(EINVAL, "Invalid argument"); usage();
} }
} }
@@ -279,6 +280,13 @@ err(int errval, const char *msg, ...)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
static void
usage(void)
{
fprintf(stderr, "usage: %s [-d]\n", progname());
exit(EXIT_FAILURE);
}
static const char * static const char *
progname(void) progname(void)
{ {