Opened 17 years ago
Last modified 10 years ago
#1373 assigned enhancement
Better parsing of team name in /bin/top
Reported by: | jonas.kirilla | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | R2 |
Component: | Applications/Command Line Tools | Version: | |
Keywords: | Cc: | nathanhirschauer@… | |
Blocked By: | Blocking: | ||
Platform: | All |
Description
When running for example 'cat /dev/urandom' /bin/top shows 'urandom' as the team name. ProcessController shows '/bin/cat /dev/urandom'.
I think team_info.args usually starts with "/" as far as I can tell, but it can also start with "./". The path of the executable may contain spaces and there may be arguments following it. Tricky to parse I suppose. What's done in src/bin/top.c looks a bit naive though:
if (get_team_info(t.team, &tm) < B_NO_ERROR) { strcpy(tm.args, "(unknown)"); } else { if (p = strrchr(tm.args, '/')) { strcpy(tm.args, p + 1); } }
"The function strrchr() returns a pointer to the last occurrence of ch in str, or NULL if no match is found." (http://www.cppreference.com/stdstring/strrchr.html)
Perhaps the team_info struct could be improved in R2.
Change History (5)
comment:1 by , 15 years ago
Owner: | changed from | to
---|---|
Version: | R1/pre-alpha1 |
comment:2 by , 13 years ago
Cc: | added |
---|
comment:3 by , 13 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 11 years ago
Owner: | changed from | to
---|
comment:5 by , 10 years ago
Milestone: | R1 → R2 |
---|
Moving to R2 as it needs an API change (of struct team_info).