15 $PREFIX = 
"/usr/local/";
 
   16 require_once(
"$PREFIX/share/fossology/lib/php/common.php");
 
   17 $sysconfig = 
"$PREFIX/etc/fossology/";
 
   19 $AllPossibleOpts = 
"nrh";
 
   24 $Options = getopt($AllPossibleOpts);
 
   25 foreach($Options as $Option => $OptVal)
 
   38       echo 
"Invalid Option \"$Option\".\n";
 
   44 if (0 == $reference_flag && 0 == $nomos_flag)
 
   51 list_license($reference_flag, $nomos_flag);
 
   53 function list_license($reference_flag, $nomos_flag)
 
   56   $sql_statment = 
"SELECT rf_shortname from license_ref ";
 
   57   if ($reference_flag && $nomos_flag) ;
 
   58   else if ($reference_flag) $sql_statment .= 
" where rf_detector_type = 1";
 
   59   else if ($nomos_flag) $sql_statment .= 
" where rf_detector_type = 2";
 
   60   $sql_statment .= 
" order by rf_shortname";
 
   61   $result = pg_query(
$PG_CONN, $sql_statment);
 
   63   while ($row = pg_fetch_assoc($result))
 
   65     print $row[
'rf_shortname'].
"\n";
 
   67   pg_free_result($result);
 
   77   $usage = 
"Usage: " . basename($argv[0]) . 
" [options] 
   78   List licenses fossology support.  Options are: 
   79   -n  licenses are just from nomos  
   80   -r  licenses are just from reference 
   82   default will list all licenses fossology support";
 
DBconnect($sysconfdir, $options="", $exitOnFail=true)
Connect to database engine. This is a no-op if $PG_CONN already has a value.
 
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
 
Usage()
Print Usage statement.
 
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN