#include cleanup
This commit is contained in:
parent
bcfac84ece
commit
c2f583f0da
3 changed files with 7 additions and 13 deletions
11
ethsock.c
11
ethsock.c
|
@ -7,10 +7,9 @@
|
|||
#include "nmrpd.h"
|
||||
|
||||
#if defined(NMRPFLASH_WINDOWS)
|
||||
#define NMRPFLASH_ALIAS_PREFIX "net"
|
||||
#define NMRPFLASH_NETALIAS_PREFIX "net"
|
||||
#define WPCAP
|
||||
#include <pcap.h>
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <pcap.h>
|
||||
#include <ifaddrs.h>
|
||||
|
@ -151,7 +150,7 @@ static const char *intf_alias_to_wpcap(const char *intf)
|
|||
|
||||
if (intf[0] == '\\') {
|
||||
return intf;
|
||||
} else if (sscanf(intf, NMRPFLASH_ALIAS_PREFIX "%u", &dev_num) != 1) {
|
||||
} else if (sscanf(intf, NMRPFLASH_NETALIAS_PREFIX "%u", &dev_num) != 1) {
|
||||
fprintf(stderr, "Invalid interface alias.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -162,7 +161,9 @@ static const char *intf_alias_to_wpcap(const char *intf)
|
|||
|
||||
for (dev = devs; dev; dev = dev->next) {
|
||||
if (i == dev_num) {
|
||||
printf(NMRPFLASH_ALIAS_PREFIX "%u: %s\n", i, dev->name);
|
||||
if (verbosity) {
|
||||
printf("%s%u: %s\n", NMRPFLASH_NETALIAS_PREFIX, i, dev->name);
|
||||
}
|
||||
strncpy(buf, dev->name, sizeof(buf) - 1);
|
||||
buf[sizeof(buf) - 1] = '\0';
|
||||
break;
|
||||
|
@ -332,7 +333,7 @@ ssize_t ethsock_recv(struct ethsock *sock, void *buf, size_t len)
|
|||
if (ret == WAIT_TIMEOUT) {
|
||||
return 0;
|
||||
} else if (ret != WAIT_OBJECT_0) {
|
||||
fprintf(stderr, "WaitForSingleObject: returned %d\n", (int)ret);
|
||||
win_perror("WaitForSingleObject", ret);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
7
nmrp.c
7
nmrp.c
|
@ -17,7 +17,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#define _BSD_SOURCE
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -28,12 +27,6 @@
|
|||
#include "ethsock.h"
|
||||
#include "nmrpd.h"
|
||||
|
||||
#ifndef NMRPFLASH_WINDOWS
|
||||
#include <arpa/inet.h>
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#define NMRP_HDR_LEN 6
|
||||
#define NMRP_OPT_LEN 4
|
||||
#define NMRP_MIN_PKT_LEN (sizeof(struct eth_hdr) + NMRP_HDR_LEN)
|
||||
|
|
2
nmrpd.h
2
nmrpd.h
|
@ -34,7 +34,6 @@
|
|||
#endif
|
||||
|
||||
#ifndef NMRPFLASH_WINDOWS
|
||||
#define _BSD_SOURCE
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
@ -42,6 +41,7 @@
|
|||
#include <winsock2.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define NMRPD_VERSION "0.9"
|
||||
|
|
Loading…
Add table
Reference in a new issue