Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Nov 2006 12:12:04 -0600
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        subba <subba@t8design.com>
Cc:        freebsd-rc@freebsd.org
Subject:   Re: How to read ifconfig in FreeBSD..Help plss
Message-ID:  <20061114181204.GA51226@lor.one-eyed-alien.net>
In-Reply-To: <7342892.post@talk.nabble.com>
References:  <7342892.post@talk.nabble.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--r5Pyd7+fXNt84Ff3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Nov 14, 2006 at 10:00:18AM -0800, subba wrote:
>=20
> Hi,
>=20
> I have to write console menu set up, where user can change the IP ,
> netmask,gateway settings etc.
> To Start with i need to read 'ifconfig' and get the 'ip' and 'netmask' and
> store it in a file and read the file to get the output. Can somebody help=
 me
> in reading the IP and others from ifconfig...
> I am trying to use
> char *cmd[] =3D { "ifconfig","-a",(char *)0 }
> execv("/sbin/ifconfig,cmd);
>=20
> If there is a better solution to have the console set up, I would love to
> know it...I'd appreciate your help.

The better solution by far would be to read the source and copy the
parts you need into your application rather than trying to parse
ifconfig output in C.

-- Brooks

--r5Pyd7+fXNt84Ff3
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQFFWgb0XY6L6fI4GtQRAh26AJ9xsdWcYHM0O/3+DzNVJdO49Yi7swCfSRtY
SdHeIJ11XJmvByIDlUpC4KE=
=Ar5B
-----END PGP SIGNATURE-----

--r5Pyd7+fXNt84Ff3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061114181204.GA51226>