No subject

Unknown Unknown
Wed Aug 8 00:05:00 PDT 2007


> <46B90B0B.2040704 at 199technologies.org> <46B91EDC.4080904 at 199technologies.org>
From: "Simon 'corecode' Schubert" <corecode at fs.ei.tum.de>
Subject: Re: vkernel.conf ?
Date: Wed, 08 Aug 2007 09:00:12 +0200
BestServHost: crater.dragonflybsd.org
List-Post: <mailto:kernel at crater.dragonflybsd.org>
List-Subscribe: <mailto:kernel-request at crater.dragonflybsd.org?body=subscribe>
List-Unsubscribe: <mailto:kernel-request at crater.dragonflybsd.org?body=unsubscribe>
List-Help: <mailto:kernel-request at crater.dragonflybsd.org?body=help>
List-Owner: <mailto:owner-kernel at crater.dragonflybsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
In-Reply-To: <46B91EDC.4080904 at 199technologies.org>
Sender: kernel-errors at crater.dragonflybsd.org
Errors-To: kernel-errors at crater.dragonflybsd.org
Lines: 52
NNTP-Posting-Host: 216.240.41.25
X-Trace: 1186557146 crater_reader.dragonflybsd.org 808 216.240.41.25
Xref: crater_reader.dragonflybsd.org dragonfly.kernel:11403

Chris Turner wrote:
[some ini parsers]

> thoughts?

could we PLEASE get over this?  nobody needs sections for now!  so this is the code we can use directly in vkernel (untested, off head):

FILE *conff;
char line[1000];

conff = fopen(confname, "r");
if (conff == NULL)
	err(1, "open config `%s'", confname);

while (fgets(line, sizeof(line), conff) != NULL) {
	char *key, *val;

	key = line + strspn(line, " \t");
	if (*key == '#')
		continue;

	val = strchr(key, '=');
	if (val == NULL)
		val = "1";	/* or error out */
	else
		*val = 0;

	/* Eat whitespace */
	val = val + strspn(val, " \t");
	while (*key != 0 && strchr(" \t", key[strlen(key) - 1]) != NULL)
		key[strlen(key) - 1] = 0;
	while (*val != 0 && strchr(" \t", val[strlen(val) - 1]) != NULL)
		val[strlen(val) - 1] = 0;

	if (*key == NULL)
		continue;

	if (strcmp(key, "memory") == 0) {
		/* ... */
	} /* etc */
}

fclose(conff);

cheers
  simon

-- 
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low ��� NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \





More information about the Kernel mailing list