aboutsummaryrefslogtreecommitdiffstats
path: root/gethwaddr.c
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2011-11-07 22:51:09 +0000
committerJonathan McCrohan <jmccrohan@gmail.com>2011-11-07 22:51:09 +0000
commitb784ec7d4d0b45c548b161ae83a3590a7fa91ff3 (patch)
tree260184e3f71cbe3e3b42d1fefd422d40a4c494d8 /gethwaddr.c
parent2e3e7482b8c17ab9367dc0859a0e3ee9470f2c08 (diff)
downloadverteco-b784ec7d4d0b45c548b161ae83a3590a7fa91ff3.tar.gz
Fix indentation in gethwaddr.c
Diffstat (limited to 'gethwaddr.c')
-rw-r--r--gethwaddr.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/gethwaddr.c b/gethwaddr.c
index 2ca2fbb..ceac2cd 100644
--- a/gethwaddr.c
+++ b/gethwaddr.c
@@ -5,19 +5,24 @@
#include <net/if.h>
#include <string.h>
-int main( int argc, char *argv[] )
-{
- int s;
- struct ifreq ifr;
+int main(int argc, char *argv[]) {
+ int s;
+ struct ifreq ifr;
- s = socket(PF_INET, SOCK_DGRAM, 0);
- memset(&ifr, 0x00, sizeof(ifr));
- strcpy(ifr.ifr_name, "eth0");
- ioctl(s, SIOCGIFHWADDR, &ifr);
- close(s);
+ s = socket(PF_INET, SOCK_DGRAM, 0);
+ memset(&ifr, 0x00, sizeof(ifr));
+ strcpy(ifr.ifr_name, "eth0");
+ ioctl(s, SIOCGIFHWADDR, &ifr);
+ close(s);
- unsigned char mac_address[6];
- sprintf(mac_address,"%.2X%.2X%.2X%.2X%.2X%.2X", (unsigned char) ifr.ifr_hwaddr.sa_data[0], (unsigned char) ifr.ifr_hwaddr.sa_data[1], (unsigned char) ifr.ifr_hwaddr.sa_data[2], (unsigned char) ifr.ifr_hwaddr.sa_data[3], (unsigned char) ifr.ifr_hwaddr.sa_data[4], (unsigned char) ifr.ifr_hwaddr.sa_data[5]);
- printf("%s", mac_address);
+ unsigned char mac_address[6];
+ sprintf(mac_address, "%.2X%.2X%.2X%.2X%.2X%.2X",
+ (unsigned char) ifr.ifr_hwaddr.sa_data[0],
+ (unsigned char) ifr.ifr_hwaddr.sa_data[1],
+ (unsigned char) ifr.ifr_hwaddr.sa_data[2],
+ (unsigned char) ifr.ifr_hwaddr.sa_data[3],
+ (unsigned char) ifr.ifr_hwaddr.sa_data[4],
+ (unsigned char) ifr.ifr_hwaddr.sa_data[5]);
+ printf("%s", mac_address);
}