Manual Pages

Enter the man page command you want (optionally preceded by a section) and it will be returned to you if it exists.

tag, and we're done. // // TODO: regex for unprintable HTML chars such as <, >, &, and others. // change them into proper HTML escape sequences. // OK, we have that done in a rather ugly way, but at least it works. // Any bright ideas from here? if (isset($page)) { // open the man page, pipe it through 'col' to remove backspaces and such. // The 'r' option is for read-only, not that we really need it... $fp = popen("man $page | col -b","r"); echo "
";
  while (!feof($fp)) {
    $buffer = fgets($fp, 132);
    // Start escaping bad HTML characters
    $amp = '&';
    $amp_replace = '&';
    $lt = '<';
    $lt_replace = '<';
    $gt = '>';
    $gt_replace = '>';
    ereg_replace($amp, $amp_relace, $buffer);
    ereg_replace($lt, $lt_relace, $buffer);
    ereg_replace($gt, $gt_relace, $buffer);
    // make links to other pages.
    // Contributed by Daniel ├ľnnerby
    // let's see if it works...
    $buffer = ereg_replace("([a-z]+)\(([0-9])\)", "\\0", $buffer);
    echo "$buffer";
  }
  pclose($fp);
  echo "
"; } ?>