projects
/
my-code
/
ivac.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
0bc1406
)
clean shutdown in case address is in use + include ncurses functions (todo)
author
hackbard
<hackbard>
Thu, 6 May 2004 19:17:44 +0000
(19:17 +0000)
committer
hackbard
<hackbard>
Thu, 6 May 2004 19:17:44 +0000
(19:17 +0000)
src/ivac.c
patch
|
blob
|
history
src/ivac.h
patch
|
blob
|
history
diff --git
a/src/ivac.c
b/src/ivac.c
index
062fc56
..
70d1a35
100644
(file)
--- a/
src/ivac.c
+++ b/
src/ivac.c
@@
-52,7
+52,9
@@
int main(int argc,char **argv) {
/* network init */
if(network_init(&(ivac.net))==N_ERROR) {
/* network init */
if(network_init(&(ivac.net))==N_ERROR) {
- printf("[ivac] use 'fuser -n tcp %d' to kill that process",ivac.net.l_port);
+ printf("[ivac] use 'fuser -n tcp %d' to determine the process to kill!\n",
+ ivac.net.l_port);
+ ivac_shutdown(&ivac);
return ERROR;
}
return ERROR;
}
@@
-66,9
+68,16
@@
int main(int argc,char **argv) {
/* start event system - callbacks used: ivac_event_cb + ivac_regular_cb */
event_start(&(ivac.event),(void *)&ivac,ivac_event_cb,ivac_regular_cb);
/* start event system - callbacks used: ivac_event_cb + ivac_regular_cb */
event_start(&(ivac.event),(void *)&ivac,ivac_event_cb,ivac_regular_cb);
-
network_shutdown(&(ivac.net)
);
+
ivac_shutdown(&ivac
);
- input_shutdown(&(ivac.input));
+ return SUCCESS;
+}
+
+int ivac_shutdown(t_ivac *ivac) {
+
+ network_shutdown(&(ivac->net));
+ input_shutdown(&(ivac->input));
+ event_stop(&(ivac->event));
return SUCCESS;
}
return SUCCESS;
}
diff --git
a/src/ivac.h
b/src/ivac.h
index
a4365f4
..
bd427f0
100644
(file)
--- a/
src/ivac.h
+++ b/
src/ivac.h
@@
-7,6
+7,9
@@
#define _GNU_SOURCE
#include <stdio.h>
#define _GNU_SOURCE
#include <stdio.h>
+/* for ui */
+#include <ncurses.h>
+
#include "network.h"
#include "event.h"
#include "input.h"
#include "network.h"
#include "event.h"
#include "input.h"
@@
-52,6
+55,7
@@
typedef struct s_ivac {
} t_ivac;
/* function prototypes */
} t_ivac;
/* function prototypes */
+int ivac_shutdown(t_ivac *ivac);
int ivac_send_info(int channel,t_ivac *ivac);
int ivac_receive_info(int channel,t_ivac *ivac);
int ivac_event_cb(t_event *event,void *ptr);
int ivac_send_info(int channel,t_ivac *ivac);
int ivac_receive_info(int channel,t_ivac *ivac);
int ivac_event_cb(t_event *event,void *ptr);