2009-04-20 21:00:56 +08:00
|
|
|
/*
|
2011-12-13 21:52:03 +08:00
|
|
|
* usage.c
|
|
|
|
*
|
|
|
|
* Various reporting routines.
|
|
|
|
* Originally copied from GIT source.
|
2009-04-20 21:00:56 +08:00
|
|
|
*
|
|
|
|
* Copyright (C) Linus Torvalds, 2005
|
|
|
|
*/
|
|
|
|
#include "util.h"
|
2012-01-20 00:08:15 +08:00
|
|
|
#include "debug.h"
|
2009-04-20 21:00:56 +08:00
|
|
|
|
2017-06-16 22:39:15 +08:00
|
|
|
static __noreturn void usage_builtin(const char *err)
|
2009-04-20 21:00:56 +08:00
|
|
|
{
|
2009-06-07 23:31:52 +08:00
|
|
|
fprintf(stderr, "\n Usage: %s\n", err);
|
2009-04-20 21:00:56 +08:00
|
|
|
exit(129);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we are in a dlopen()ed .so write to a global variable would segfault
|
|
|
|
* (ugh), so keep things static. */
|
2017-06-16 22:39:15 +08:00
|
|
|
static void (*usage_routine)(const char *err) __noreturn = usage_builtin;
|
2015-10-19 23:23:49 +08:00
|
|
|
|
2009-04-20 21:00:56 +08:00
|
|
|
void usage(const char *err)
|
|
|
|
{
|
|
|
|
usage_routine(err);
|
|
|
|
}
|