File: windows.c

package info (click to toggle)
wily 0.13.41-7.3
  • links: PTS
  • area: main
  • in suites: buster
  • size: 2,560 kB
  • ctags: 3,426
  • sloc: ansic: 25,364; perl: 580; makefile: 448; sh: 415; python: 30; exp: 17
file content (48 lines) | stat: -rw-r--r-- 644 bytes parent folder | download | duplicates (11)
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
#include <unistd.h>
#include <u.h>
#include <libc.h>
#include <libg.h>
#include <msg.h>
#include <signal.h>
#include <sys/limits.h>

volatile Bool control_c = false;

void
e(const char *s)
{
	perror(s);
	exit(1);
}

void
catch(int sig){
	signal(sig, catch);
	control_c = true;
}

void
main(int c, char**v){
	int fd;
	Handle *h;
	Bool status;
	char *p;

	signal(SIGHUP, catch);
	signal(SIGINT, catch);
	signal(SIGQUIT, catch);
	signal(SIGTERM, catch);

	fd = client_connect();
	if (-1 == fd){
		e("can't open wilyfifo");
	}
	h = rpc_init(fd);
	
	status = true;
	rpc_list(h, &p);
	printf("%s", p);
	free(p);
	rpc_freehandle(h);
	exit(!status);
}