""
This commit is contained in:
7
iftop.h
7
iftop.h
@@ -26,4 +26,11 @@ void *xrealloc(void *w, size_t n);
|
|||||||
char *xstrdup(const char *s);
|
char *xstrdup(const char *s);
|
||||||
void xfree(void *v);
|
void xfree(void *v);
|
||||||
|
|
||||||
|
/* ui.c */
|
||||||
|
void analyse_data(void);
|
||||||
|
void ui_init(void);
|
||||||
|
|
||||||
|
/* options.c */
|
||||||
|
void options_read(int argc, char **argv);
|
||||||
|
|
||||||
#endif /* __IFTOP_H_ */
|
#endif /* __IFTOP_H_ */
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ char optstr[] = "+i:f:n:dhp";
|
|||||||
|
|
||||||
/* Global options. */
|
/* Global options. */
|
||||||
|
|
||||||
void set_defaults() {
|
static void set_defaults() {
|
||||||
options.interface = "eth0";
|
options.interface = "eth0";
|
||||||
options.filtercode = NULL;
|
options.filtercode = NULL;
|
||||||
options.netfilter = 0;
|
options.netfilter = 0;
|
||||||
@@ -28,12 +28,12 @@ void set_defaults() {
|
|||||||
options.showbars = 1;
|
options.showbars = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void die(char *msg) {
|
static void die(char *msg) {
|
||||||
fprintf(stderr, msg);
|
fprintf(stderr, msg);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_net_filter(char* arg) {
|
static void set_net_filter(char* arg) {
|
||||||
char* mask;
|
char* mask;
|
||||||
|
|
||||||
mask = strchr(arg, '/');
|
mask = strchr(arg, '/');
|
||||||
@@ -64,7 +64,7 @@ void set_net_filter(char* arg) {
|
|||||||
|
|
||||||
/* usage:
|
/* usage:
|
||||||
* Print usage information. */
|
* Print usage information. */
|
||||||
void usage(FILE *fp) {
|
static void usage(FILE *fp) {
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"iftop: display bandwidth usage on an interface by host\n"
|
"iftop: display bandwidth usage on an interface by host\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ void resolver_worker(void* ptr) {
|
|||||||
/* Allocate buffer, remember to free it to avoid memory leakage. */
|
/* Allocate buffer, remember to free it to avoid memory leakage. */
|
||||||
tmphstbuf = xmalloc (hstbuflen);
|
tmphstbuf = xmalloc (hstbuflen);
|
||||||
|
|
||||||
while ((res = gethostbyaddr_r (&addr, sizeof(addr), AF_INET,
|
while ((res = gethostbyaddr_r ((char*)&addr, sizeof(addr), AF_INET,
|
||||||
&hostbuf, tmphstbuf, hstbuflen,
|
&hostbuf, tmphstbuf, hstbuflen,
|
||||||
&hp, &herr)) == ERANGE) {
|
&hp, &herr)) == ERANGE) {
|
||||||
/* Enlarge the buffer. */
|
/* Enlarge the buffer. */
|
||||||
|
|||||||
Reference in New Issue
Block a user