author | mjm <mjm> | 2002-11-27 21:21:42 (UTC) |
---|---|---|
committer | mjm <mjm> | 2002-11-27 21:21:42 (UTC) |
commit | b95d47212803232e62e81b6507568097c949f014 (patch) (unidiff) | |
tree | 3c9257475ec058e83a701699c6c0b1bb14d0f8ed /noncore/net/wellenreiter/daemon/source/sendgui.cc | |
parent | c7ee0193ef7bbcc575226efc0e3992020a9b67b7 (diff) | |
download | opie-b95d47212803232e62e81b6507568097c949f014.zip opie-b95d47212803232e62e81b6507568097c949f014.tar.gz opie-b95d47212803232e62e81b6507568097c949f014.tar.bz2 |
now part of library
Diffstat (limited to 'noncore/net/wellenreiter/daemon/source/sendgui.cc') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/sendgui.cc | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/sendgui.cc b/noncore/net/wellenreiter/daemon/source/sendgui.cc deleted file mode 100644 index 9e57094..0000000 --- a/noncore/net/wellenreiter/daemon/source/sendgui.cc +++ b/dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* | ||
2 | * Send string to GUI | ||
3 | * | ||
4 | * $Id$ | ||
5 | */ | ||
6 | |||
7 | #include "config.hh" | ||
8 | #include "sendgui.hh" | ||
9 | #include "log.hh" | ||
10 | |||
11 | /* Send a string to the GUI */ | ||
12 | int sendgui(const char *string, ...) | ||
13 | { | ||
14 | int sock=0; | ||
15 | char buffer[4096]; | ||
16 | struct sockaddr_in saddr; | ||
17 | va_list ap; | ||
18 | |||
19 | /* Generate string */ | ||
20 | memset(buffer, 0, sizeof(buffer)); | ||
21 | va_start(ap, string); | ||
22 | vsnprintf(buffer, sizeof(buffer)-1, string, ap); | ||
23 | va_end(ap); | ||
24 | |||
25 | /* Setup socket */ | ||
26 | sock = socket (AF_INET, SOCK_DGRAM, 0); | ||
27 | saddr.sin_family = AF_INET; | ||
28 | saddr.sin_port = htons(GUIPORT); | ||
29 | saddr.sin_addr.s_addr = inet_addr(GUIADDR); | ||
30 | |||
31 | if(sendto(sock, buffer, sizeof(buffer), 0, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) | ||
32 | { | ||
33 | log_err("Cannot write to socket: %s", strerror(errno)); | ||
34 | close(sock); | ||
35 | return 0; | ||
36 | } | ||
37 | |||
38 | if(close(sock) < 0) | ||
39 | log_err("Cannot close socket: %s", strerror(errno)); | ||
40 | |||
41 | return 1; | ||
42 | } | ||