[14:21]
[14:26]
if (ioctl (sock, SIOCGIFADDR, &ifr) < 0)
struct ifaddrs *ifa_next; /* Pointer to next struct */
char *ifa_name; /* Interface name */
u_int ifa_flags; /* Interface flags */
struct sockaddr *ifa_addr; /* Interface address */
struct sockaddr *ifa_netmask; /* Interface netmask */
struct sockaddr *ifa_broadaddr; /* Interface broadcast address */
struct sockaddr *ifa_dstaddr; /* P2P interface destination */
void *ifa_data; /* Address specific data */
/* getmac.c -- retrieve the mac address from a interface name */
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if_dl.h>
#include <ifaddrs.h>
int main(int argc, char ** argv)
{
struct ifaddrs *ifaphead;
unsigned char * if_mac;
int found = 0;
struct ifaddrs *ifap;
struct sockaddr_dl *sdl = NULL;
if (argc < 2)
{
fprintf(stderr,"usage:\n");
fprintf(stderr,"\t %s <interface name>\n",argv[0]);
exit(1);
}
if (getifaddrs(&ifaphead) != 0)
{
perror("get_if_name: getifaddrs() failed");
exit(1);
}
for (ifap = ifaphead; ifap && !found; ifap = ifap->ifa_next)
{
if ((ifap->ifa_addr->sa_family == AF_LINK))
{
if (strlen(ifap->ifa_name) == strlen(argv[1]))
if (strcmp(ifap->ifa_name,argv[1]) == 0)
{
found = 1;
sdl = (struct sockaddr_dl *)ifap->ifa_addr;
if (sdl)
{
/* I was returning this from a function before converting
* this snippet, which is why I make a copy here on the heap */
if_mac = malloc(sdl->sdl_alen);
memcpy(if_mac, LLADDR(sdl), sdl->sdl_alen);
}
}
}
}
if (!found)
{
fprintf (stderr,"Can't find interface %s.\n",argv[1]);
if(ifaphead)
freeifaddrs(ifaphead);
exit(1);
}
fprintf (stdout, "%02X%02X%02X%02X%02X%02X\n",
if_mac[0] , if_mac[1] , if_mac[2] ,
if_mac[3] , if_mac[4] , if_mac[5] );
if(ifaphead)
freeifaddrs(ifaphead);
exit(0);
}
#!/bin/sh
KONQ_WIN=`dcop konq* | head -1`
if [ "$KONQ_WIN" = "" ]; then
/usr/local/bin/konqueror $1 &
else
NEW_TAB=`dcop $KONQ_WIN konqueror-mainwindow#1 action newtab`
dcop $NEW_TAB activate
dcop $KONQ_WIN konqueror-mainwindow#1 openURL $1
fi
return 0
# vmstat -i
interrupt total rate
irq3: sio1 52807402 55
irq4: sio0 1604 0
irq14: ata0 36 0
irq16: em0 em1+ 2527378 2
irq19: uhci1+ 86991 0
cpu0: timer 1886077214 2000
cpu1: timer 1886076861 2000
Total 3827577486 4058
[root@pogo-1 ~]# vmstat -i
interrupt total rate
irq1: atkbd0 6 0
irq3: sio1 13587145 55
irq4: sio0 1243 0
irq14: ata0 36 0
irq16: em0 uhci3 3237 0
irq17: em1 21 0
irq19: uhci1+ 66550 0
cpu0: timer 485520843 2000
cpu1: timer 485520575 2000
Total 984699656 4056
$ ./wget http://172.16.17.1/index.html
--13:22:32-- http://172.16.17.1/index.html
Connecting to 172.16.17.1:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 39599 (39K) [text/html]
Saving to: `index.html'
100%[=======================================>] 39,599 --.-K/s in 0.005s
13:22:32 (8.39 MB/s) - `index.html' saved [39599/39599]
$ ./wget -z http://172.16.17.1/index.html
--13:22:39-- http://172.16.17.1/index.html
Connecting to 172.16.17.1:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10546 (10K) [text/html]
Saving to: `index.html.1'
100%[=======================================>] 10,546 --.-K/s in 0.002s
13:22:39 (5.62 MB/s) - `index.html.1' saved [10546/10546]
$ diff index.html index.html.1
$ echo $?
0
sysctl net.inet6.ip6.v6only=0
[root@moby bin]$ cat bipcons.sh
#!/bin/sh
SESSIONS="
d44
co-04
c62-29
co-02
co-05
d84-1
d84-2
"
KONSOLE=`dcopclient $KONSOLE_DCOP`
CURSESSION=$KONSOLE_DCOP_SESSION
for A in $SESSIONS; do
NEWSESSION=`dcop $KONSOLE konsole newSession $A`
dcop $KONSOLE $NEWSESSION renameSession $A
# your command here on the next line!
dcop $KONSOLE $NEWSESSION sendSession "console $A"
done
dcop $CURSESSION closeSession