mirror of
https://github.com/pygos/init.git
synced 2024-11-22 19:19:47 +01:00
9a88f7da45
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
36 lines
609 B
C
36 lines
609 B
C
#ifndef SERVICECMD_H
|
|
#define SERVICECMD_H
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <ctype.h>
|
|
|
|
#include "util.h"
|
|
|
|
typedef struct command_t {
|
|
struct command_t *next;
|
|
|
|
const char *cmd;
|
|
const char *usage;
|
|
const char *s_desc;
|
|
const char *l_desc;
|
|
|
|
int (*run_cmd)(int argc, char **argv);
|
|
} command_t;
|
|
|
|
extern command_t *commands;
|
|
|
|
void usage(int status) NORETURN;
|
|
|
|
#define REGISTER_COMMAND(cmd) \
|
|
static void __attribute__((constructor)) register_##cmd(void) \
|
|
{ \
|
|
command_t *c = (command_t *)&cmd; \
|
|
\
|
|
c->next = commands; \
|
|
commands = c; \
|
|
}
|
|
|
|
#endif /* SERVICECMD_H */
|
|
|