#!/usr/local/bin/php -q '', "db"=>''); # Let's first check the number of args if($_SERVER['argc']!=3) { echo "Incorrect argument count! Use -h for usage.\n"; exit; } # Assign data to the array $data_arr['file']=&$_SERVER['argv'][1]; $data_arr['db']=&$_SERVER['argv'][2]; # Return the information return $data_arr; } # Parse the 'use db' string function parse_use($str) { $new=str_replace("use", "", $str); $new=str_replace(";", "", $new); $new=str_replace(" ", "", $new); $new=trim($new); return $new; } # Add another file to be written too to an array of file pointers. function add_fp($files, $db) { $fp=fopen($db, 'a'); if($fp) { $files[$db]['fp']=$fp; $files[$db]['name']=$db; $files[$db]['count']=0; } else { echo "Failed to open a file for the db ".$db."\n"; exit; } } ?>