function loadenv()
{
+$env_file_path="/etc/mailleur/mailleur.conf";
$var_arrs=array();
$phase=0;
$proceed=true;
while ($proceed==true) {
+ echo ("unienv.c:loadenv JMPDBG phase='$phase'\n");
switch ($phase) {
- case 0 : //Loading environment variable
- $env_file_path=realpath("/etc/mailleur/"."mailleur.conf");
- echo $env_file_path;
- break;
- case 1 : //checking if file exist
+ case 0 : //checking if file exist
if(!is_file($env_file_path)){
throw new ErrorException("Environment File is Missing.");
$phase=999; //no need to go further
}
break;
- case 2 : //opening file
+ case 1 : //opening file
$fopen=fopen($env_file_path,'r');
if (!$fopen) {
throw new ErrorException("Unable to read file <".($env_file_path).">");
$phase=999;
+ }
break;
case 3 : //scanning file
+ while (($line=fgets($fopen))!==false) {
+ if ((substr(trim($line),0,1)=='#')
+ continue;
+ if (empty(trim($line)))
+ continue;
+ $line_no_comment=explode("#",$line,2)[0];
+ echo ("no_com=<$line_no_comment>\n");
+ }
break;
case 4 : //closing file
fclose($fopen);
}
}
+loadenv();
?>