rc.subr (245250) | rc.subr (248820) |
---|---|
1# $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $ | 1# $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $ |
2# $FreeBSD: head/etc/rc.subr 245250 2013-01-10 11:08:22Z smh $ | 2# $FreeBSD: head/etc/rc.subr 248820 2013-03-28 08:13:52Z avg $ |
3# 4# Copyright (c) 1997-2004 The NetBSD Foundation, Inc. 5# All rights reserved. 6# 7# This code is derived from software contributed to The NetBSD Foundation 8# by Luke Mewburn. 9# 10# Redistribution and use in source and binary forms, with or without --- 1269 unchanged lines hidden (view full) --- 1280 1281# devfs_rulesets_from_file file 1282# Reads a set of devfs commands from file, and creates 1283# the specified rulesets with their rules. Returns non-zero 1284# if there was an error. 1285# 1286devfs_rulesets_from_file() 1287{ | 3# 4# Copyright (c) 1997-2004 The NetBSD Foundation, Inc. 5# All rights reserved. 6# 7# This code is derived from software contributed to The NetBSD Foundation 8# by Luke Mewburn. 9# 10# Redistribution and use in source and binary forms, with or without --- 1269 unchanged lines hidden (view full) --- 1280 1281# devfs_rulesets_from_file file 1282# Reads a set of devfs commands from file, and creates 1283# the specified rulesets with their rules. Returns non-zero 1284# if there was an error. 1285# 1286devfs_rulesets_from_file() 1287{ |
1288 local file _err _me | 1288 local file _err _me _opts |
1289 file="$1" 1290 _me="devfs_rulesets_from_file" 1291 _err=0 1292 1293 if [ -z "$file" ]; then 1294 warn "$_me: you must specify a file" 1295 return 1 1296 fi 1297 if [ ! -e "$file" ]; then 1298 debug "$_me: no such file ($file)" 1299 return 0 1300 fi | 1289 file="$1" 1290 _me="devfs_rulesets_from_file" 1291 _err=0 1292 1293 if [ -z "$file" ]; then 1294 warn "$_me: you must specify a file" 1295 return 1 1296 fi 1297 if [ ! -e "$file" ]; then 1298 debug "$_me: no such file ($file)" 1299 return 0 1300 fi |
1301 1302 # Disable globbing so that the rule patterns are not expanded 1303 # by accident with matching filesystem entries. 1304 _opts=$-; set -f 1305 |
|
1301 debug "reading rulesets from file ($file)" 1302 { while read line 1303 do 1304 case $line in 1305 \#*) 1306 continue 1307 ;; 1308 \[*\]*) --- 30 unchanged lines hidden (view full) --- 1339 fi 1340 ;; 1341 esac 1342 if [ $_err -ne 0 ]; then 1343 debug "error in $_me" 1344 break 1345 fi 1346 done } < $file | 1306 debug "reading rulesets from file ($file)" 1307 { while read line 1308 do 1309 case $line in 1310 \#*) 1311 continue 1312 ;; 1313 \[*\]*) --- 30 unchanged lines hidden (view full) --- 1344 fi 1345 ;; 1346 esac 1347 if [ $_err -ne 0 ]; then 1348 debug "error in $_me" 1349 break 1350 fi 1351 done } < $file |
1352 case $_opts in *f*) ;; *) set +f ;; esac |
|
1347 return $_err 1348} 1349 1350# devfs_init_rulesets 1351# Initializes rulesets from configuration files. Returns 1352# non-zero if there was an error. 1353# 1354devfs_init_rulesets() --- 414 unchanged lines hidden --- | 1353 return $_err 1354} 1355 1356# devfs_init_rulesets 1357# Initializes rulesets from configuration files. Returns 1358# non-zero if there was an error. 1359# 1360devfs_init_rulesets() --- 414 unchanged lines hidden --- |