File: system.c

package info (click to toggle)
qcontrol 0.5.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 348 kB
  • sloc: ansic: 2,020; sh: 228; makefile: 82
file content (49 lines) | stat: -rw-r--r-- 1,354 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * Copyright (C) 2013  Ian Campbell (ijc@hellion.org.uk)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <syslog.h>
#include "picmodule.h"

static int system_status(int argc, const char **argv)
{
	if (argc != 1)
		return -1;
	
	call_function("system_status", "%s", argv[0]);
	return 0;
}

static int system_init(int argc, const char **argv UNUSED)
{
	if (argc > 0) {
		print_log(LOG_ERR, "%s: module does not take any arguments\n",
			  __func__);
		return -1;
	}

	register_command("system-status",
			 "Signal system status",
			 "Signal system status, options are:\n"
			 "\tstart\n\tstop\n",
			 system_status);
	return 0;
}

struct picmodule system_module = {
	.name           = "system-status",
	.init           = system_init,
};