From owner-freebsd-rc@FreeBSD.ORG Tue Nov 14 19:36:17 2006 Return-Path: X-Original-To: freebsd-rc@freebsd.org Delivered-To: freebsd-rc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2DDA916A49E for ; Tue, 14 Nov 2006 19:36:17 +0000 (UTC) (envelope-from bounces@nabble.com) Received: from talk.nabble.com (www.nabble.com [72.21.53.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id D07DD43D5C for ; Tue, 14 Nov 2006 19:36:12 +0000 (GMT) (envelope-from bounces@nabble.com) Received: from [72.21.53.38] (helo=jubjub.nabble.com) by talk.nabble.com with esmtp (Exim 4.50) id 1Gk44q-0003BB-KY for freebsd-rc@freebsd.org; Tue, 14 Nov 2006 11:36:12 -0800 Message-ID: <7344729.post@talk.nabble.com> Date: Tue, 14 Nov 2006 11:36:12 -0800 (PST) From: subba To: freebsd-rc@freebsd.org In-Reply-To: <20061114181204.GA51226@lor.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: subba@t8design.com References: <7342892.post@talk.nabble.com> <20061114181204.GA51226@lor.one-eyed-alien.net> Subject: Re: How to read ifconfig in FreeBSD..Help plss X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2006 19:36:17 -0000 Thanks Brooks, I am not sure about 'to read the source and copy the parts into your application'. Can you please elaborate?. When you said reading the source, does it mean that pipe the 'ifconfig' to a file and read that file ... like % ifconfig > somefile.txt and read somefile.txt and get the ip, netmask and others.? If this is the case, how can i pipe(C program) when the user logs in...i.e when the user logs in, console menu should be displayed with current IP,netmask etc. I am not sure if i am in the right direction. I'd appreciate your help. Thanks, Subba Brooks Davis wrote: > > On Tue, Nov 14, 2006 at 10:00:18AM -0800, subba wrote: >> >> Hi, >> >> 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[] = { "ifconfig","-a",(char *)0 } >> execv("/sbin/ifconfig,cmd); >> >> 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 > > > -- View this message in context: http://www.nabble.com/How-to-read-ifconfig-in-FreeBSD..Help-plss-tf2631184.html#a7344729 Sent from the freebsd-rc mailing list archive at Nabble.com.