2009-04-20 20:00:56 +07:00
|
|
|
/*
|
2011-12-13 20:52:03 +07:00
|
|
|
* usage.c
|
|
|
|
*
|
|
|
|
* Various reporting routines.
|
|
|
|
* Originally copied from GIT source.
|
2009-04-20 20:00:56 +07:00
|
|
|
*
|
|
|
|
* Copyright (C) Linus Torvalds, 2005
|
|
|
|
*/
|
|
|
|
#include "util.h"
|
2012-01-19 23:08:15 +07:00
|
|
|
#include "debug.h"
|
2009-04-20 20:00:56 +07:00
|
|
|
|
2017-06-16 21:39:15 +07:00
|
|
|
static __noreturn void usage_builtin(const char *err)
|
2009-04-20 20:00:56 +07:00
|
|
|
{
|
2009-06-07 22:31:52 +07:00
|
|
|
fprintf(stderr, "\n Usage: %s\n", err);
|
2009-04-20 20:00:56 +07: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 21:39:15 +07:00
|
|
|
static void (*usage_routine)(const char *err) __noreturn = usage_builtin;
|
2015-10-19 22:23:49 +07:00
|
|
|
|
2009-04-20 20:00:56 +07:00
|
|
|
void usage(const char *err)
|
|
|
|
{
|
|
|
|
usage_routine(err);
|
|
|
|
}
|