lowlevel-blt-bench: move usage to a function
Move printing of usage into a new function and use argv[0] as the
program name. This will help printing usage from multiple places.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ben Avison <bavison@riscosopen.org>
diff --git a/test/lowlevel-blt-bench.c b/test/lowlevel-blt-bench.c
index aff4608..69202ee 100644
--- a/test/lowlevel-blt-bench.c
+++ b/test/lowlevel-blt-bench.c
@@ -976,6 +976,14 @@
run_one_test (tests_tbl[i].testname, bandwidth_);
}
+static void
+usage (const char *progname)
+{
+ printf ("Usage: %s [-b] [-n] pattern\n", progname);
+ printf (" -n : benchmark nearest scaling\n");
+ printf (" -b : benchmark bilinear scaling\n");
+}
+
int
main (int argc, char *argv[])
{
@@ -1005,9 +1013,7 @@
if (!pattern)
{
- printf ("Usage: lowlevel-blt-bench [-b] [-n] pattern\n");
- printf (" -n : benchmark nearest scaling\n");
- printf (" -b : benchmark bilinear scaling\n");
+ usage (argv[0]);
return 1;
}