From owner-freebsd-questions Sat Jan 6 19:14:40 2001 Delivered-To: freebsd-questions@freebsd.org Received: from pmade.org (dsl-att1-118-93.sb.101freeway.net [12.44.118.93]) by hub.freebsd.org (Postfix) with ESMTP id F236B37B400 for ; Sat, 6 Jan 2001 19:14:18 -0800 (PST) Received: from localhost (pjones@localhost) by pmade.org (8.11.1/8.11.1) with ESMTP id f073Dj854944; Sat, 6 Jan 2001 19:13:45 -0800 (PST) (envelope-from pjones@pmade.org) Date: Sat, 6 Jan 2001 19:13:45 -0800 (PST) From: Peter Jones To: G D McKee Cc: freebsd-questions Subject: Re: Neoupdate In-Reply-To: <000b01c0781f$aec46640$0500a8c0@gdmckee.local> Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-2089694011-978837225=:54906" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --0-2089694011-978837225=:54906 Content-Type: TEXT/PLAIN; charset=US-ASCII Here is a snip of code that I use to update yi.org: sub ip_get { my $cmd = '/sbin/ifconfig tun0'; my $data = `$cmd`; if ($data =~ /inet\s+((?:\d+|\.)+)/) { return $1; } else { exit 1; } } I have also attached the entire script. On Sat, 6 Jan 2001, G D McKee wrote: > Hi > > Found a useful program to update your DNS if you are on a cable modem but > the reg ex only seems to work with Linux. Does any one know how to get it > to work with FreeBSD. > > The Code that is a fault is as follows: > > sub getip(){ > ($device) = @_; > my(@newip,$newip,$nic); > $nic = qx(/sbin/ifconfig $device); > print "$nic\n"; > @newip = grep(/^addr/, split(/\s/, $nic)); > $newip = $newip[0]; > $newip =~ s/addr://; > if ($newip =~ m/(\d+)\.(\d+)\.(\d+)\.(\d+)/){ > return $newip; > }else{ > die "Aborting : Can't retrieve ip information from $device\n"; > } > } > > Has any one got any ideas on how to get this to work with device tun0 and a > standard nic. > > G D McKee > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > -- ....................................................................... : Peter Jones : Unix Geek - Four Wheeling : : pjones@pmade.org : Code Writing - Jesus Freak : :....................................:................................: :echo er|perl -0160 -pe ';$;=ord$/;s;^;"\U$/".chr($\;-11).chr$\;+4;e;': :.....................................................................: --0-2089694011-978837225=:54906 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=yiupdate Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: yiupdate Content-Disposition: attachment; filename=yiupdate IyEgL3Vzci9iaW4vcGVybCAtdw0KIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj IyMjIyMjIyMjIyMNCiMNCiMgeWl1cGRhdGUgKFVwZGF0ZSB5b3VyIElQIG9u IHlpLm9yZykNCiMNCiMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj IyMjDQojDQojIEluY2x1ZGVzDQojDQojIyMjIyMjIyMjIyMjIyMjIyMjIyMj IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj IyMjIyMjIyMjIyMjIw0KdXNlIHN0cmljdDsNCnVzZSBIVFRQOjpSZXF1ZXN0 Ow0KdXNlIExXUDo6VXNlckFnZW50Ow0KIyMjIyMjIyMjIyMjIyMjIyMjIyMj IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj IyMjIyMjIyMjIyMjIyMNCiMNCiMgQ29uc3RhbnRzDQojDQojIyMjIyMjIyMj IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIw0K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W9uIGNvbnN0YW50 cyBhcmUgWUlfVVNFUk5BTUUsIFlJX1BBU1NXT1JEIGFuZA0KWUlfSU5URVJG QUNFLg0KDQpZSV9VU0VSTkFNRSBpcyB5b3VyIHlpIHVzZXJuYW1lDQoNCllJ X1BBU1NXT1JEIGlzIHlvdXIgeWkgcGFzc3dvcmQNCg0KWUlfSU5URVJGQUNF IGlzIHRoZSBpbnRlcmZhY2UgdG8gZ2V0IHlvdXIgaXAgZnJvbSB0byBzZW5k IHRvIHlpLm9yZy4gRm9yDQpleGFtcGxlLCBpZiB5b3UgYXJlIHVzaW5nIEZy ZWVCU0QgYW5kIHBwcCB0aGVuIHlvdSB3b3VsZCBzZXQgdGhpcyB0byB0dW4w DQp0byBnZXQgdGhlIGluZXQgYWRkcmVzcyBmb3IgdGhlIHR1bm5lbCBpbnRl cmZhY2UuDQoNCj1oZWFkMSBFWEFNUExFUw0KDQp5aXVwZGF0ZQ0KDQo9aGVh ZDEgU0VFIEFMU08NCg0KcGVybCgxKQ0KaHR0cDovL3d3dy55aS5vcmcNCg0K PWhlYWQxIEFVVEhPUg0KDQpQZXRlciBKIEpvbmVzDQpwQGRhbmNyaXMuY29t DQoNCj1jdXQNCg== --0-2089694011-978837225=:54906-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message