From 9ea967083419b7a9d3badb15db283653ac2a20ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Thu, 20 Jan 2005 22:38:37 +0000 Subject: [PATCH] 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 --- src/apps/bin/listarea.c | 26 ++++++++++++++++++++++++-- src/apps/bin/listimage.c | 15 +++++++++------ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/apps/bin/listarea.c b/src/apps/bin/listarea.c index 97a7bf798f..2feb019055 100644 --- a/src/apps/bin/listarea.c +++ b/src/apps/bin/listarea.c @@ -20,6 +20,7 @@ void list_area_info(team_id id); +void list_area_info_a(const char *arg); void show_memory_totals(void); @@ -38,7 +39,7 @@ main(int argc, char **argv) } else { // list for each team_id on the command line while (--argc) - list_area_info(atoi(*++argv)); + list_area_info_a(*++argv); } return 0; @@ -82,7 +83,7 @@ list_area_info(team_id id) printf("%5ld %32s %08lx %8lx %8lx %5ld %5ld %5ld\n", areaInfo.area, areaInfo.name, - (addr_t)areaInfo.address, + (void *)areaInfo.address, areaInfo.size, areaInfo.ram_size, 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); + } + } +} + diff --git a/src/apps/bin/listimage.c b/src/apps/bin/listimage.c index 5a73264871..378b923b39 100644 --- a/src/apps/bin/listimage.c +++ b/src/apps/bin/listimage.c @@ -31,10 +31,13 @@ list_images_for_team_by_id(team_id id) status_t status; status = get_team_info(id, &teamInfo); - if (status < B_OK) + if (id != 1 && status < B_OK) 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("------------------------------------------------------------------------------------------------------------\n"); @@ -42,12 +45,12 @@ list_images_for_team_by_id(team_id id) printf("%5ld %64s 0x%08lx 0x%08lx %4ld %10lu\n", imageInfo.id, imageInfo.name, - (addr_t)imageInfo.text, - (addr_t)imageInfo.data, + (void *)imageInfo.text, + (void *)imageInfo.data, imageInfo.sequence, 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)); return status; } @@ -61,7 +64,7 @@ list_images_for_team(const char *arg) int32 cookie = 0; team_info info; - if (isdigit(arg[0])) { + if (atoi(arg) > 0) { if (list_images_for_team_by_id(atoi(arg)) == B_OK) return; }