mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:38:10 +00:00
Minor tweak to /bin/kill.
This commit is contained in:
parent
71a2942a0a
commit
41a751c90c
1 changed files with 6 additions and 2 deletions
|
@ -6,6 +6,10 @@
|
|||
|
||||
static unsigned parseUInt(const String& str, bool& ok)
|
||||
{
|
||||
if (str.isEmpty()) {
|
||||
ok = false;
|
||||
return 0;
|
||||
}
|
||||
unsigned value = 0;
|
||||
for (size_t i = 0; i < str.length(); ++i) {
|
||||
if (str[i] < '0' || str[i] > '9') {
|
||||
|
@ -38,13 +42,13 @@ int main(int argc, char** argv)
|
|||
print_usage_and_exit();
|
||||
signum = parseUInt(&argv[1][1], ok);
|
||||
if (!ok) {
|
||||
printf("%s is not a valid signal number\n", &argv[1][1]);
|
||||
printf("'%s' is not a valid signal number\n", &argv[1][1]);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
unsigned pid = parseUInt(argv[pid_argi], ok);
|
||||
if (!ok) {
|
||||
printf("%s is not a valid PID\n", argv[pid_argi]);
|
||||
printf("'%s' is not a valid PID\n", argv[pid_argi]);
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue