function create_cmd_output(&$action, &$a_mount, &$fullname)
{
    $cmdout = CMDOUT_PARA_WOHINT;
    ob_end_flush();
    $retvalue = <<<EOD
{$cmdout}

EOD;
    /* Get the id of the mount array entry. */
    $id = array_search_ex($fullname, $a_mount, "fullname");
    /* Get the mount data. */
    $mount = $a_mount[$id];
    switch ($action) {
        case "mount":
            $diskinit_str = gettext("Mounting '{$fullname}'...") . "<br />";
            $result = disks_mount_fullname($fullname);
            break;
        case "umount":
            $diskinit_str = gettext("Umounting '{$fullname}'...") . "<br />";
            $result = disks_umount_fullname($fullname);
            break;
    }
    /* Display result */
    0 == $result ? $diskinit_str .= gettext("Successful") : ($diskinit_str .= gettext("Failed"));
    $retvalue .= <<<EOD
              <div id="ismounted_out" style="font-family: Courier, monospace; font-size: small;">
              <pre style="font-family: Courier, monospace; font-size: small; font-style: italic;">{$diskinit_str}</pre>
              </div>

EOD;
    return $retvalue;
}
function create_cmd_output(&$action, &$a_disk, &$disk, &$partition, &$umount)
{
    $cmdout = CMDOUT_PARA;
    ob_end_flush();
    $retvalue = <<<EOD
{$cmdout}

EOD;
    switch ($action) {
        case "fsck":
            /* Get the id of the disk. */
            $id = array_search_ex($disk, $a_disk, "name");
            /* Get the filesystem type of the disk. */
            $type = $a_disk[$id]['fstype'];
            /* Check if disk is mounted. */
            $ismounted = disks_check_mount_fullname($disk . $partition);
            /* Umount disk if necessary. */
            if ($umount && $ismounted) {
                $diskinit_str = "<strong class='red'>" . gettext("Note") . ":</strong> " . gettext("The disk is currently mounted! The mount point will be removed temporary to perform selected command.") . "<br /><br />";
                $retvalue .= <<<EOD
              <div id="ismounted_out" style="font-family: Courier, monospace; font-size: small;">
              <pre style="font-family: Courier, monospace; font-size: small; font-style: italic;">{$diskinit_str}</pre>
              </div>

EOD;
                disks_umount_fullname($disk . $partition);
            }
            switch ($type) {
                case "":
                case "ufs":
                case "ufs_no_su":
                case "ufsgpt":
                case "ufsgpt_no_su":
                    $button = create_toggle_button("Checking disk", "ufsgn_fsck_out");
                    $cmd = "/sbin/fsck_ufs -y -f " . escapeshellarg($disk . $partition);
                    $out = create_cmdout_container("ufsgn_fsck_out", $cmd);
                    $retvalue .= assemble_cmdout($button, $out);
                    break;
                case "gmirror":
                case "gvinum":
                case "graid5":
                    $diskinit_str = sprintf(gettext("Use <a href='%s'>RAID tools</a> for this disk!"), "disks_raid_{$type}_tools.php");
                    $retvalue .= <<<EOD
                <div id="graid5_out" style="display: none; font-family: Courier, monospace; font-size: small;">
                <pre style="font-family: Courier, monospace; font-size: small; font-style: italic;">{$diskinit_str}</pre>
                </div>
                
EOD;
                    break;
                case "msdos":
                    $button = create_toggle_button("Checking disk", "dos_fsck_out");
                    $cmd = "/sbin/fsck_msdosfs -y -f " . escapeshellarg($disk . $partition);
                    $out = create_cmdout_container("dos_fsck_out", $cmd);
                    $retvalue .= assemble_cmdout($button, $out);
                    break;
            }
            /* Mount disk if necessary. */
            if ($umount && $ismounted) {
                disks_mount_fullname($disk . $partition);
            }
            break;
    }
    return $retvalue;
}