From e5c0e4a6551855141d5ce1d746c04c283edb619c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 18 Aug 2005 15:09:30 +0000 Subject: [PATCH] Now prints an error if no thread matching the requested criteria could be found. Simplified parsing the ID (no need to differentiate between hex and decimal, if we do both anyway). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13972 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/thread.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/system/kernel/thread.c b/src/system/kernel/thread.c index c1d14be57f..8cf48cb1b8 100644 --- a/src/system/kernel/thread.c +++ b/src/system/kernel/thread.c @@ -545,6 +545,7 @@ dump_thread_info(int argc, char **argv) struct thread *t; int id = -1; struct hash_iterator i; + bool found = false; if (argc > 2) { kprintf("usage: thread [id/name]\n"); @@ -556,12 +557,7 @@ dump_thread_info(int argc, char **argv) id = thread_get_current_thread()->id; } else { name = argv[1]; - - // if the argument looks like a hex number, treat it as such - if (strlen(argv[1]) > 2 && argv[1][0] == '0' && argv[1][1] == 'x') - id = strtoul(argv[1], NULL, 16); - else - id = atoi(argv[1]); + id = strtoul(argv[1], NULL, 0); } // walk through the thread list, trying to match name or id @@ -569,10 +565,14 @@ dump_thread_info(int argc, char **argv) while ((t = hash_next(sThreadHash, &i)) != NULL) { if ((name != NULL && !strcmp(name, t->name)) || t->id == id) { _dump_thread_info(t); + found = true; break; } } hash_close(sThreadHash, &i, false); + + if (!found) + kprintf("thread \"%s\" (%ld) doesn't exist!\n", argv[1], id); return 0; }