From owner-freebsd-questions Wed Mar 15 5:10: 2 2000 Delivered-To: freebsd-questions@freebsd.org Received: from nscache2.x-treme.gr (mail1.x-treme.gr [212.120.196.23]) by hub.freebsd.org (Postfix) with ESMTP id 04E7737B9F2 for ; Wed, 15 Mar 2000 05:08:40 -0800 (PST) (envelope-from keramida@ceid.upatras.gr) Received: from hades.hell.gr (pat58.x-treme.gr [212.120.197.250]) by nscache2.x-treme.gr (8.9.3/8.9.3/IPNG-ADV-ANTISPAM-0.1) with ESMTP id PAA10382; Wed, 15 Mar 2000 15:08:21 +0200 Received: (from charon@localhost) by hades.hell.gr (8.9.3/8.9.3) id NAA90912; Wed, 15 Mar 2000 13:21:42 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Wed, 15 Mar 2000 13:21:42 +0200 From: Giorgos Keramidas To: Zhihui Zhang Cc: freebsd-questions@FreeBSD.ORG Subject: Re: library routine used to read a configuration file Message-ID: <20000315132141.B89809@hades.hell.gr> Reply-To: keramida@ceid.upatras.gr References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from zzhang@cs.binghamton.edu on Tue, Mar 14, 2000 at 11:59:28AM -0500 X-PGP-Fingerprint: 62 45 D1 C9 26 F9 95 06 D6 21 2A C8 8C 16 C0 8E Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, Mar 14, 2000 at 11:59:28AM -0500, Zhihui Zhang wrote: > I need to write a daemon that reads a configuration file when it > starts. Is there any library routines that can help me on this? The short answer: no. The longer answer: There are infinite ways of writing a config file. Clearly, there can only be a finite number of functions in the system libraries. I think you can roll your own, based around a simple line-reader function. If you're even more mad than that, you can browse the sources of FreeBSD to see how programs like /bin/sh read their startup files, or even how programs like fetchmail (from the ports) parse their config file with flex! Too many ways to skin a cat, Ciao. - Giorgos Keramidas To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message