I feel dumb...

$string="rpm -qd $rpmname 2>/dev/null |head -1 |sed s?\"$documentdir\"?\"\"? |cut 
-d\"/\" -f2";

On Monday, March 5, 2001, at 09:33 AM, Michael A. Peters wrote:

> I have the following php function- 
>  
> function doclink ($documentdir, $rpmname, $doc_file) { 
>       $string="rpm -qd $rpmname |head -1 |sed s?\"$documentdir\"?\"\"? |cut -d\"/\" 
>-f2"; 
>       $rpm_installed=exec($string); 
>       $DOC_ABSOLUTE="$documentdir/$rpm_installed"; 
>       if (file_exists("$DOC_ABSOLUTE/$doc_file")) { 
>               if (is_link("$rpmname")) { 
>               unlink("$rpmname"); 
>                } 
>               symlink("$DOC_ABSOLUTE", "$rpmname"); 
>               return "$rpmname/$doc_file"; 
>       } else { 
>               return "failed"; 
>       } 
> } 
>  
> later its used when creating a page of documentation links for the user, like this- 
>  
> $mysqldoc=doclink($docdir, "MySQL", "manual_toc.html"); 
> if (strstr($mysqldoc,"failed")) { 
>       echo "<!-- could not locate MySQL documentation -->\n"; 
> } else { 
>       echo "<P><font face=$font color=$color size=$size><A href=\"$mysqldoc\">MySQL 
> Documentation</A></font>\n"; 
> } 
>  
> Works beautifully, problem is- if the rpm isn't installed that's querried in the 
>doclink 
> function, the error message rpm puts out is sent to the apache error.log. I don't 
>want that. 
>  
> Is there a way to supress the error message for that exec call? 
>  
> Thanks 
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
> Michael A. Peters 
> Abriasoft Senior Developer 
>  
> http://www.abriasoft.com/ 
>  
> (510)  623-9726x357 
> Fax: (510) 249-9125 
> --  
> PHP General Mailing List (http://www.php.net/) 
> To unsubscribe, e-mail: [EMAIL PROTECTED] 
> For additional commands, e-mail: [EMAIL PROTECTED] 
> To contact the list administrators, e-mail: [EMAIL PROTECTED] 
>  
>  

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Michael A. Peters
Abriasoft Senior Developer

http://www.abriasoft.com/

(510)  623-9726x357
Fax: (510) 249-9125
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to