Last change
on this file since 2469 was
2469,
checked in by Jean-Yves Lamoureux, 15 years ago
|
|
-
Property svn:eol-style set to
native
|
File size:
808 bytes
|
Line | |
---|
1 | #include <fcntl.h> |
---|
2 | #include <stdio.h> |
---|
3 | #include <stdlib.h> |
---|
4 | #include <unistd.h> |
---|
5 | |
---|
6 | #include "neercs.h" |
---|
7 | |
---|
8 | int detach(struct screen_list* screen_list, caca_display_t * dp) |
---|
9 | { |
---|
10 | int fd; |
---|
11 | int pid; |
---|
12 | |
---|
13 | screen_list->attached = 0; |
---|
14 | caca_free_display(dp); |
---|
15 | |
---|
16 | pid = fork(); |
---|
17 | if (pid < 0) |
---|
18 | return 1; |
---|
19 | if (pid > 0) |
---|
20 | exit(0); |
---|
21 | /* lol */ |
---|
22 | close(0); |
---|
23 | close(1); |
---|
24 | close(2); |
---|
25 | fd = open("/dev/null", O_RDWR); |
---|
26 | dup2(fd, 0); |
---|
27 | dup2(fd, 1); |
---|
28 | dup2(fd, 2); |
---|
29 | if (fd > 2) |
---|
30 | close(fd); |
---|
31 | |
---|
32 | setsid(); |
---|
33 | |
---|
34 | return 0; |
---|
35 | } |
---|
36 | |
---|
37 | #if 0 |
---|
38 | int attach(struct screen_list* screen_list, cucul_canvas_t * cv, caca_display_t ** dp) |
---|
39 | { |
---|
40 | screen_list->attached = 1; |
---|
41 | *dp = caca_create_display(cv); |
---|
42 | if(!*dp) |
---|
43 | return 1; |
---|
44 | /* lol */ |
---|
45 | caca_set_cursor(*dp, 1); |
---|
46 | return 0; |
---|
47 | } |
---|
48 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.