/*
 *  SPL - The SPL Programming Language
 *  Copyright (C) 2004, 2005  Clifford Wolf <clifford@clifford.at>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *  example12.spl: Example for the forach statement
 */

// SKIP_IF_NO_REGEX

var sysctl;

var sysctl.abi;
var sysctl.abi.defhandler_elf = "0";
var sysctl.abi.defhandler_coff = "117440515";

var sysctl.dev;
var sysctl.dev.raid;
var sysctl.dev.raid.speed_limit_max = "100000";
var sysctl.dev.raid.speed_limit_min = "100";

var sysctl.dev.cdrom;
var sysctl.dev.cdrom.check_media = "0";
var sysctl.dev.cdrom.lock = "1";
var sysctl.dev.cdrom.autoeject = "0";
var sysctl.dev.cdrom.autoclose = "1";
var sysctl.dev.cdrom.info = "CD-ROM information, Id: cdrom.c 3.12 2000/10/18";

function parse_tree(name, tree) {
	if ( name !~ /\..*\./ )
		var tree.foobar = "changed in parse_tree()";
	foreach i (tree) {
		debug "$name.$i = ${defined tree.[i] ? tree.[i] : "NULL"}";
		if ( i ~!= "foobar" )
			parse_tree("$name.$i", tree.[i]);
	}
}

parse_tree("sysctl", sysctl);

