From 385d3e53254fcd390c3596f2ccdcc65cd9310757 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 11 Aug 2003 16:19:06 +0000 Subject: build fixes remove fprintfs git-svn-id: file:///home/lennart/svn/public/aeswepd/trunk@5 022f378f-78c4-0310-b860-d162c87e6274 --- src/iwapi.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'src/iwapi.c') diff --git a/src/iwapi.c b/src/iwapi.c index e9b4177..356f144 100644 --- a/src/iwapi.c +++ b/src/iwapi.c @@ -23,6 +23,8 @@ #include #include #include + +#include #include "iwapi.h" int iw_set_essid(struct interface *i, const char* essid) { @@ -42,7 +44,7 @@ int iw_set_essid(struct interface *i, const char* essid) { } if (ioctl(i->fd, SIOCSIWESSID, &req) < 0) { - fprintf(stderr, "ioctl(SIOCSIWESSID): %s\n", strerror(errno)); + daemon_log(LOG_ERR, "ioctl(SIOCSIWESSID): %s\n", strerror(errno)); return -1; } @@ -57,7 +59,7 @@ int iw_set_mode(struct interface *i, int m) { req.u.mode = m; if (ioctl(i->fd, SIOCSIWMODE, &req) < 0) { - fprintf(stderr, "ioctl(SIOCSIWMODE): %s\n", strerror(errno)); + daemon_log(LOG_ERR, "ioctl(SIOCSIWMODE): %s\n", strerror(errno)); return -1; } @@ -72,7 +74,7 @@ int iw_set_freq(struct interface *i, struct iw_freq *f) { req.u.freq = *f; if (ioctl(i->fd, SIOCSIWFREQ, &req) < 0) { - fprintf(stderr, "ioctl(SIOCSIWFREQ): %s\n", strerror(errno)); + daemon_log(LOG_ERR, "ioctl(SIOCSIWFREQ): %s\n", strerror(errno)); return -1; } @@ -89,7 +91,7 @@ int iw_set_ap(struct interface *i, struct hw_addr *ap) { memcpy(req.u.ap_addr.sa_data, ap->addr, ETH_ALEN); if (ioctl(i->fd, SIOCSIWAP, &req) < 0) { - fprintf(stderr, "ioctl(SIOCSIWAP): %s\n", strerror(errno)); + daemon_log(LOG_ERR, "ioctl(SIOCSIWAP): %s\n", strerror(errno)); return -1; } @@ -106,12 +108,10 @@ int iw_scan(struct interface *i) { req.u.param.value = 0; if (ioctl(i->fd, SIOCSIWSCAN, &req) < 0) { - fprintf(stderr, "ioctl(SIOCSIWSCAN): %s\n", strerror(errno)); + daemon_log(LOG_ERR, "ioctl(SIOCSIWSCAN): %s\n", strerror(errno)); return -1; } -// fprintf(stderr, "scan!\n"); - return 0; } @@ -136,19 +136,17 @@ int iw_scan_result(struct interface *i, int (*callback)(struct ap_info* ap)) { if (errno == EAGAIN) return 1; - fprintf(stderr, "ioctl(SIOCGIWSCAN): %s\n", strerror(errno)); + daemon_log(LOG_ERR, "ioctl(SIOCGIWSCAN): %s\n", strerror(errno)); return -1; } -// fprintf(stderr, "scan response!\n"); - e = (struct iw_event*) req.u.data.pointer; l = req.u.data.length; f = 0; hs = sizeof(struct iw_event)-sizeof(union iwreq_data); while (l >= sizeof(struct iw_event)) { if (e->len < hs) { - fprintf(stderr, "Recieved bogus wireless event\n"); + daemon_log(LOG_ERR, "Recieved bogus wireless event\n"); return -1; } @@ -162,7 +160,7 @@ int iw_scan_result(struct interface *i, int (*callback)(struct ap_info* ap)) { f = 1; if (e->len < hs + sizeof(struct sockaddr)) { - fprintf(stderr, "Corrupt scan result (1)\n"); + daemon_log(LOG_ERR, "Corrupt scan result (1)\n"); return -1; } @@ -173,7 +171,7 @@ int iw_scan_result(struct interface *i, int (*callback)(struct ap_info* ap)) { case SIOCGIWESSID: if (e->len < hs + sizeof(struct iw_point)) { - fprintf(stderr, "Corrupt scan result (2)\n"); + daemon_log(LOG_ERR, "Corrupt scan result (2)\n"); return -1; } @@ -187,7 +185,7 @@ int iw_scan_result(struct interface *i, int (*callback)(struct ap_info* ap)) { case SIOCGIWMODE: if (e->len < hs + sizeof(__u32)) { - fprintf(stderr, "Corrupt scan result (3)\n"); + daemon_log(LOG_ERR, "Corrupt scan result (3)\n"); return -1; } @@ -200,7 +198,7 @@ int iw_scan_result(struct interface *i, int (*callback)(struct ap_info* ap)) { case SIOCGIWFREQ: if (e->len < hs + sizeof(struct iw_freq)) { - fprintf(stderr, "Corrupt scan result (4)\n"); + daemon_log(LOG_ERR, "Corrupt scan result (4)\n"); return -1; } @@ -211,8 +209,6 @@ int iw_scan_result(struct interface *i, int (*callback)(struct ap_info* ap)) { if (f == 15) { - //fprintf(stderr, "Scan successful\n"); - if (callback(&ap) < 0) return -1; -- cgit