From 0dd62c8813d811ea5c3dccc1e490d8635527140c Mon Sep 17 00:00:00 2001 From: Bill Marquette Date: Sat, 26 Feb 2005 01:24:04 +0000 Subject: strip (#) comments out of files --- etc/inc/pfsense-utils.inc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'etc') diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 5128eca..09d9d95 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -74,16 +74,17 @@ function enable_hardware_offloading($interface) { */ function return_filename_as_array($filename) { $file = array(); - if(!file_exists($filename)) return $file; - $text = return_filename_as_string($filename); - $text_split = split("\n", $text); - $counter = 0; - foreach($text_split as $line) { - if(strpos($line, "#") == 0) - unset($text_split($counter)); - $counter++; + if(file_exists($filename)) { + $text = return_filename_as_string($filename); + $text_split = split("\n", $text); + + /* Strip out comments */ + while (($line = array_shift($text_split)) != NULL) { + if(strpos($line, "#") !== 0) + array_push($file, $line); + } } - return $text_split; + return $file; } /* @@ -492,4 +493,4 @@ function update_progress_bar($percent) { } -?> \ No newline at end of file +?> -- cgit v1.1