-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnotice.c
41 lines (37 loc) · 986 Bytes
/
notice.c
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
#include <stdlib.h>
#include <stdio.h>
#include "notice.h"
void notice(enum notice type, const char *path)
{
notice_sock(type, path, NULL, NULL);
}
void notice_idfail(const char *path, int id)
{
printf("[ID %d FAIL] %s\n", id, path);
}
void notice_sock(enum notice type, const char *path, const char *host,
const char *service)
{
switch (type) {
case ADD:
printf("[OPEN ] %s\n", path);
break;
case ADDFAIL:
printf("[FAIL ] %s\n", path);
break;
case DEL:
printf("[CLOSE] %s\n", path);
break;
case NEW:
printf("[NEW ] %s\n", path);
break;
case CONNECT:
printf("[CONNECTED] %s ↔ %s:%s\n", path, host, service);
break;
case SOCKFAIL:
printf("[FAIL ] %s ↔ %s:%s\n", path, host, service);
break;
default:
printf("[?????????] %s\n", path);
}
}