kconfig: split the lexer out of zconf.y
[carl9170fw.git] / tools / src / wol.c
index f2c95d83d2aef53210ee2ec7aa91c67b3fb860c4..f2bd51b2208f20e4eb488c27fc65eba6d1557236 100644 (file)
 #include <sys/types.h>
 #include <sys/socket.h>
 
+#include <arpa/inet.h>
+#include <net/if.h>
+
 #include <linux/types.h>
 #include <linux/if_ether.h>    /* ETH_P_ALL */
 #include <linux/if_packet.h>   /* sockaddr_ll */
-#include <linux/if.h>          /* IFNAMSIZ */
 
 static int monitor_init(const char *ifname)
 {
@@ -187,16 +189,18 @@ int main(int argc, char **args)
                return EXIT_FAILURE;
 
        if (verbose)
-               fprintf(stdout, "Generating WOL packet for ["MAC_STR"].\n", MAC_ARG2(mac));
+               fprintf(stdout, "Generating %d WOL packet for ["MAC_STR"].\n", num, MAC_ARG2(mac));
 
        prepare_wol(wol_magic_tmpl, mac);
 
        while (num--) {
                err = inject_frame(sock, wol_magic_tmpl, sizeof(wol_magic_tmpl));
-               if (err < 0)
+               if (err < 0) {
                        fprintf(stderr, "failed to send WOL packet.\n");
-               else if (verbose)
+                       break;
+               } else if (verbose) {
                        fprintf(stdout, "WOL packet sent.\n");
+               }
        }
 
        close(sock);