blob: 196438ee4c9d08eecb108fcb3aaaab42cd4f7bcb [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Ingo Molnar07800602009-04-20 15:00:56 +02002/*
Namhyung Kim5f9273d2011-12-13 22:52:03 +09003 * usage.c
4 *
5 * Various reporting routines.
6 * Originally copied from GIT source.
Ingo Molnar07800602009-04-20 15:00:56 +02007 *
8 * Copyright (C) Linus Torvalds, 2005
9 */
10#include "util.h"
Arnaldo Carvalho de Melo215a0d32019-07-04 11:21:24 -030011#include <stdio.h>
12#include <stdlib.h>
13#include <linux/compiler.h>
Ingo Molnar07800602009-04-20 15:00:56 +020014
Arnaldo Carvalho de Melo6c346642017-06-16 11:39:15 -030015static __noreturn void usage_builtin(const char *err)
Ingo Molnar07800602009-04-20 15:00:56 +020016{
Ingo Molnar716c69f2009-06-07 17:31:52 +020017 fprintf(stderr, "\n Usage: %s\n", err);
Ingo Molnar07800602009-04-20 15:00:56 +020018 exit(129);
19}
20
Ingo Molnar07800602009-04-20 15:00:56 +020021/* If we are in a dlopen()ed .so write to a global variable would segfault
22 * (ugh), so keep things static. */
Arnaldo Carvalho de Melo6c346642017-06-16 11:39:15 -030023static void (*usage_routine)(const char *err) __noreturn = usage_builtin;
Namhyung Kim2690c732015-10-20 00:23:49 +090024
Ingo Molnar07800602009-04-20 15:00:56 +020025void usage(const char *err)
26{
27 usage_routine(err);
28}