Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/networking/ether-wake.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/networking/ether-wake.c
r1765 r2725 3 3 * ether-wake.c - Send a magic packet to wake up sleeping machines. 4 4 * 5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.5 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 6 * 7 7 * Author: Donald Becker, http://www.scyld.com/"; http://www.scyld.com/wakeonlan.html … … 93 93 for (i = 0; i < pktsize; ++i) { 94 94 printf("%2.2x ", outpack[i]); 95 if (i % 20 == 19) puts("");95 if (i % 20 == 19) bb_putchar('\n'); 96 96 } 97 97 printf("\n\n"); … … 112 112 struct ether_addr *eap; 113 113 114 eap = ether_aton (hostid);114 eap = ether_aton_r(hostid, eaddr); 115 115 if (eap) { 116 *eaddr = *eap; 117 bb_debug_msg("The target station address is %s\n\n", ether_ntoa(eaddr)); 118 #if !defined(__UCLIBC__) 116 bb_debug_msg("The target station address is %s\n\n", ether_ntoa(eap)); 117 #if !defined(__UCLIBC_MAJOR__) \ 118 || __UCLIBC_MAJOR__ > 0 \ 119 || __UCLIBC_MINOR__ > 9 \ 120 || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ >= 30) 119 121 } else if (ether_hostton(hostid, eaddr) == 0) { 120 122 bb_debug_msg("Station address for hostname %s is %s\n\n", hostid, ether_ntoa(eaddr)); 121 123 #endif 122 } else 124 } else { 123 125 bb_show_usage(); 126 } 124 127 } 125 128 … … 165 168 &passwd[0], &passwd[1], &passwd[2], &passwd[3]); 166 169 if (byte_cnt < 4) { 167 bb_error_msg("can not read Wake-On-LAN pass");170 bb_error_msg("can't read Wake-On-LAN pass"); 168 171 return 0; 169 172 } … … 179 182 } 180 183 181 int ether_wake_main(int argc, char **argv) ;182 int ether_wake_main(int argc , char **argv)184 int ether_wake_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 185 int ether_wake_main(int argc UNUSED_PARAM, char **argv) 183 186 { 184 187 const char *ifname = "eth0"; … … 187 190 unsigned char wol_passwd[6]; 188 191 int wol_passwd_sz = 0; 189 int s; 192 int s; /* Raw socket */ 190 193 int pktsize; 191 194 unsigned char outpack[1000]; 192 195 193 196 struct ether_addr eaddr; 194 struct whereto_t whereto; 197 struct whereto_t whereto; /* who to wake up */ 195 198 196 199 /* handle misc user options */ … … 220 223 struct ifreq if_hwaddr; 221 224 222 strncpy (if_hwaddr.ifr_name, ifname, sizeof(if_hwaddr.ifr_name));225 strncpy_IFNAMSIZ(if_hwaddr.ifr_name, ifname); 223 226 ioctl_or_perror_and_die(s, SIOCGIFHWADDR, &if_hwaddr, "SIOCGIFHWADDR on %s failed", ifname); 224 227 … … 256 259 { 257 260 struct ifreq ifr; 258 strncpy (ifr.ifr_name, ifname, sizeof(ifr.ifr_name));261 strncpy_IFNAMSIZ(ifr.ifr_name, ifname); 259 262 xioctl(s, SIOCGIFINDEX, &ifr); 260 263 memset(&whereto, 0, sizeof(whereto));
Note:
See TracChangeset
for help on using the changeset viewer.