blob: 070d25ceea6a92ad2092f6710d5d50a29a279e64 [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 Melo0d37aa32012-01-19 14:08:15 -020011#include "debug.h"
Ingo Molnar07800602009-04-20 15:00:56 +020012
Arnaldo Carvalho de Melo6c346642017-06-16 11:39:15 -030013static __noreturn void usage_builtin(const char *err)
Ingo Molnar07800602009-04-20 15:00:56 +020014{
Ingo Molnar716c69f2009-06-07 17:31:52 +020015 fprintf(stderr, "\n Usage: %s\n", err);
Ingo Molnar07800602009-04-20 15:00:56 +020016 exit(129);
17}
18
Ingo Molnar07800602009-04-20 15:00:56 +020019/* If we are in a dlopen()ed .so write to a global variable would segfault
20 * (ugh), so keep things static. */
Arnaldo Carvalho de Melo6c346642017-06-16 11:39:15 -030021static void (*usage_routine)(const char *err) __noreturn = usage_builtin;
Namhyung Kim2690c732015-10-20 00:23:49 +090022
Ingo Molnar07800602009-04-20 15:00:56 +020023void usage(const char *err)
24{
25 usage_routine(err);
26}