Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Ingo Molnar | 0780060 | 2009-04-20 15:00:56 +0200 | [diff] [blame] | 2 | /* |
Namhyung Kim | 5f9273d | 2011-12-13 22:52:03 +0900 | [diff] [blame] | 3 | * usage.c |
| 4 | * |
| 5 | * Various reporting routines. |
| 6 | * Originally copied from GIT source. |
Ingo Molnar | 0780060 | 2009-04-20 15:00:56 +0200 | [diff] [blame] | 7 | * |
| 8 | * Copyright (C) Linus Torvalds, 2005 |
| 9 | */ |
| 10 | #include "util.h" |
Arnaldo Carvalho de Melo | 0d37aa3 | 2012-01-19 14:08:15 -0200 | [diff] [blame] | 11 | #include "debug.h" |
Ingo Molnar | 0780060 | 2009-04-20 15:00:56 +0200 | [diff] [blame] | 12 | |
Arnaldo Carvalho de Melo | 6c34664 | 2017-06-16 11:39:15 -0300 | [diff] [blame] | 13 | static __noreturn void usage_builtin(const char *err) |
Ingo Molnar | 0780060 | 2009-04-20 15:00:56 +0200 | [diff] [blame] | 14 | { |
Ingo Molnar | 716c69f | 2009-06-07 17:31:52 +0200 | [diff] [blame] | 15 | fprintf(stderr, "\n Usage: %s\n", err); |
Ingo Molnar | 0780060 | 2009-04-20 15:00:56 +0200 | [diff] [blame] | 16 | exit(129); |
| 17 | } |
| 18 | |
Ingo Molnar | 0780060 | 2009-04-20 15:00:56 +0200 | [diff] [blame] | 19 | /* If we are in a dlopen()ed .so write to a global variable would segfault |
| 20 | * (ugh), so keep things static. */ |
Arnaldo Carvalho de Melo | 6c34664 | 2017-06-16 11:39:15 -0300 | [diff] [blame] | 21 | static void (*usage_routine)(const char *err) __noreturn = usage_builtin; |
Namhyung Kim | 2690c73 | 2015-10-20 00:23:49 +0900 | [diff] [blame] | 22 | |
Ingo Molnar | 0780060 | 2009-04-20 15:00:56 +0200 | [diff] [blame] | 23 | void usage(const char *err) |
| 24 | { |
| 25 | usage_routine(err); |
| 26 | } |