Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * usage.c |
| 4 | * |
| 5 | * Various reporting routines. |
| 6 | * Originally copied from GIT source. |
| 7 | * |
| 8 | * Copyright (C) Linus Torvalds, 2005 |
| 9 | */ |
| 10 | #include "util.h" |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 11 | #include <stdio.h> |
| 12 | #include <stdlib.h> |
| 13 | #include <linux/compiler.h> |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 14 | |
| 15 | static __noreturn void usage_builtin(const char *err) |
| 16 | { |
| 17 | fprintf(stderr, "\n Usage: %s\n", err); |
| 18 | exit(129); |
| 19 | } |
| 20 | |
| 21 | /* If we are in a dlopen()ed .so write to a global variable would segfault |
| 22 | * (ugh), so keep things static. */ |
| 23 | static void (*usage_routine)(const char *err) __noreturn = usage_builtin; |
| 24 | |
| 25 | void usage(const char *err) |
| 26 | { |
| 27 | usage_routine(err); |
| 28 | } |