print $pinfo{nice};
}
else {
- print "<select name=nice>\n";
- for($i=0; $i<@nice_range; $i++) {
- printf "<option value=%d %s>%d%s\n",
- $nice_range[$i],
- $pinfo{nice} == $nice_range[$i] ? "selected" : "",
- $nice_range[$i],
- $i==0 ? " ($text{'edit_prihigh'})" :
- $i==@nice_range-1 ? " ($text{'edit_prilow'})" :
- $nice_range[$i]==0 ? " ($text{'edit_pridef'})" : "";
- }
- print "</select> <input type=submit value='$text{'edit_change'}'>\n";
+ print &nice_selector("nice", $pinfo{nice});
+ print &ui_submit($text{'edit_change'});
}
print "</td> </form></tr>\n";
$i = 0;
}
}
elsif ($sel == 0) {
- # nothing to read. maybe the process is done, and a subprocess
- # is hanging things up
+ # nothing to read. maybe the process is done, and a
+ # subprocess is hanging things up
last if (!kill(0, $pid));
}
if ($_[7] && time() - $start > $_[7]) {
}
}
+# nice_selector(name, value)
+# Returns a menu for selecting a nice level
+sub nice_selector
+{
+local ($name, $value) = @_;
+local $l = scalar(@nice_range);
+return &ui_select($name, $value,
+ [ map { [ $_, $_.($_ == $nice_range[0] ? " ($text{'edit_prihigh'})" :
+ $_ == 0 ? " ($text{'edit_pridef'})" :
+ $_ == $nice_range[$l-1] ? " ($text{'edit_prilow'})" :
+ "") ] } @nice_range ]);
+}
+
1;