From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 14 15:31:54 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9FF7E16A4CE for ; Wed, 14 Apr 2004 15:31:54 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 43E5243D48 for ; Wed, 14 Apr 2004 15:31:54 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.10/8.12.10) id i3EMVaCF018902; Wed, 14 Apr 2004 17:31:36 -0500 (CDT) (envelope-from dan) Date: Wed, 14 Apr 2004 17:31:36 -0500 From: Dan Nelson To: Nguyen Tam Chinh Message-ID: <20040414223136.GG28745@dan.emsphone.com> References: <20040414215601.GA3923@crodrigues.org> <20040415021631.N1878@chinhngt.b.gz.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040415021631.N1878@chinhngt.b.gz.ru> X-OS: FreeBSD 5.2-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.6i cc: Craig Rodrigues cc: freebsd-hackers@freebsd.org Subject: Re: C code for parsing rc.conf? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Apr 2004 22:31:54 -0000 In the last episode (Apr 15), Nguyen Tam Chinh said: > On Wed, 14 Apr 2004, Craig Rodrigues wrote: > > Is there a C library that comes with FreeBSD which can be used to > > parse, append to, and validate rc.conf? > > > > I'd like to customize some of the settings in /etc/rc.conf with my > > own GUI-based program. It's not too hard to write something on my > > own, but I was wondering if a reusable library existed in FreeBSD > > 4.x or 5.x for doing this. > > rc.conf is parsed/executed by scripts in /etc/rc*. With your GUI > program, simply take and change these scripts. .. and be aware that although most lines will be in the standard name="value" format, admins are free to put any shell syntax or commands they like in there. So make sure your gui tool preserves unchanged lines when saving (instead of regenerating the entire file from a parsed array, for example). That will let an admin use shell tricks to generate ifconfig_XX0_aliasXX variables, for example, and still allow using your tool to change moused flags. -- Dan Nelson dnelson@allantgroup.com