summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorBill Marquette <billm@pfsense.org>2005-02-26 01:24:04 +0000
committerBill Marquette <billm@pfsense.org>2005-02-26 01:24:04 +0000
commit0dd62c8813d811ea5c3dccc1e490d8635527140c (patch)
treeadd3fd3ed125f2a4d002b87c4fa26ded799170d1 /etc
parent98b779400b1c27851ebfefcb599ec24a7de749e3 (diff)
downloadpfsense-0dd62c8813d811ea5c3dccc1e490d8635527140c.zip
pfsense-0dd62c8813d811ea5c3dccc1e490d8635527140c.tar.gz
strip (#) comments out of files
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/pfsense-utils.inc21
1 files changed, 11 insertions, 10 deletions
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
+?>
OpenPOWER on IntegriCloud