File: systemf.c

package info (click to toggle)
libite 2.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,920 kB
  • sloc: sh: 4,463; ansic: 3,660; makefile: 111
file content (31 lines) | stat: -rw-r--r-- 501 bytes parent folder | download
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
#include <err.h>
#include "check.h"

int main(void)
{
	struct { char *cmd; int rc; } list[] = {
		{ "false",          1 },
		{ "true",           0 },
		{ "kill -9 $$",     1 },
		{ "kill -QUIT $$", -1 },
		{ "kill -INT $$",  -1 }
	};

	for (size_t i = 0; i < NELEMS(list); i++) {
		int rc;

		rc = systemf("%s", list[i].cmd);
		if (rc != list[i].rc)
			err(rc, "Failed command %s", list[i].cmd);
	}

	return 0;
}

/**
 * Local Variables:
 *  indent-tabs-mode: t
 *  c-file-style: "linux"
 * End:
 */