handle pseudo-team 1 in listimage as well; (pets Axel) addr_t is nice but that ain't compile in R5; added search by team name in listarea as well

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10916 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol
2005-01-20 22:38:37 +00:00
parent 205c4c26e7
commit 9ea9670834
2 changed files with 33 additions and 8 deletions
+24 -2
View File
@@ -20,6 +20,7 @@
void list_area_info(team_id id); void list_area_info(team_id id);
void list_area_info_a(const char *arg);
void show_memory_totals(void); void show_memory_totals(void);
@@ -38,7 +39,7 @@ main(int argc, char **argv)
} else { } else {
// list for each team_id on the command line // list for each team_id on the command line
while (--argc) while (--argc)
list_area_info(atoi(*++argv)); list_area_info_a(*++argv);
} }
return 0; return 0;
@@ -82,7 +83,7 @@ list_area_info(team_id id)
printf("%5ld %32s %08lx %8lx %8lx %5ld %5ld %5ld\n", printf("%5ld %32s %08lx %8lx %8lx %5ld %5ld %5ld\n",
areaInfo.area, areaInfo.area,
areaInfo.name, areaInfo.name,
(addr_t)areaInfo.address, (void *)areaInfo.address,
areaInfo.size, areaInfo.size,
areaInfo.ram_size, areaInfo.ram_size,
areaInfo.copy_count, areaInfo.copy_count,
@@ -91,3 +92,24 @@ list_area_info(team_id id)
} }
} }
void
list_area_info_a(const char *arg)
{
int32 cookie = 0;
team_info info;
team_id tid;
tid = atoi(arg);
// if atoi returns >0 it's likely it's a number, else take it as string
if (tid > 0) {
list_area_info(tid);
return;
}
while (get_next_team_info(&cookie, &info) >= B_OK) {
if (strstr(info.args, arg)) {
list_area_info(info.team);
}
}
}
+9 -6
View File
@@ -31,10 +31,13 @@ list_images_for_team_by_id(team_id id)
status_t status; status_t status;
status = get_team_info(id, &teamInfo); status = get_team_info(id, &teamInfo);
if (status < B_OK) if (id != 1 && status < B_OK)
return status; return status;
printf("\nTEAM %4ld (%s):\n", id, teamInfo.args); if (id == 1)
printf("\nKERNEL TEAM:\n");
else
printf("\nTEAM %4ld (%s):\n", id, teamInfo.args);
printf(" ID name text data seq# init#\n"); printf(" ID name text data seq# init#\n");
printf("------------------------------------------------------------------------------------------------------------\n"); printf("------------------------------------------------------------------------------------------------------------\n");
@@ -42,12 +45,12 @@ list_images_for_team_by_id(team_id id)
printf("%5ld %64s 0x%08lx 0x%08lx %4ld %10lu\n", printf("%5ld %64s 0x%08lx 0x%08lx %4ld %10lu\n",
imageInfo.id, imageInfo.id,
imageInfo.name, imageInfo.name,
(addr_t)imageInfo.text, (void *)imageInfo.text,
(addr_t)imageInfo.data, (void *)imageInfo.data,
imageInfo.sequence, imageInfo.sequence,
imageInfo.init_order); imageInfo.init_order);
} }
if (status != B_ENTRY_NOT_FOUND) { if (status != B_ENTRY_NOT_FOUND && status != EINVAL) {
printf("get images failed: %s\n", strerror(status)); printf("get images failed: %s\n", strerror(status));
return status; return status;
} }
@@ -61,7 +64,7 @@ list_images_for_team(const char *arg)
int32 cookie = 0; int32 cookie = 0;
team_info info; team_info info;
if (isdigit(arg[0])) { if (atoi(arg) > 0) {
if (list_images_for_team_by_id(atoi(arg)) == B_OK) if (list_images_for_team_by_id(atoi(arg)) == B_OK)
return; return;
} }