From e03ff0203372d221b207b7b9b1b536f51d8252c5 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 26 Jan 2008 10:36:20 +0000 Subject: [PATCH] Set team::name to the last path component instead of to the truncated path. Makes the "teams" output prettier and "team " becomes usable. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23745 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/team.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/team.cpp b/src/system/kernel/team.cpp index 2b896d5e09..6e96cbca8e 100644 --- a/src/system/kernel/team.cpp +++ b/src/system/kernel/team.cpp @@ -735,6 +735,16 @@ create_process_session(pid_t id) } +static void +set_team_name(struct team* team, const char* name) +{ + if (const char* lastSlash = strrchr(name, '/')) + name = lastSlash + 1; + + strlcpy(team->name, name, B_OS_NAME_LENGTH); +} + + static struct team * create_team_struct(const char *name, bool kernel) { @@ -745,7 +755,7 @@ create_team_struct(const char *name, bool kernel) team->next = team->siblings_next = team->children = team->parent = NULL; team->id = allocate_thread_id(); - strlcpy(team->name, name, B_OS_NAME_LENGTH); + set_team_name(team, name); team->args[0] = '\0'; team->num_threads = 0; team->io_context = NULL; @@ -1296,7 +1306,7 @@ exec_team(const char *path, int32 argCount, char * const *args, // rename the team - strlcpy(team->name, path, B_OS_NAME_LENGTH); + set_team_name(team, path); // cut the path from the team name and rename the main thread, too threadName = strrchr(path, '/');