Now returns descriptive error messages if something went wrong.
Also fixed an almost bug that only catched B_BAD_TEAM_ID error codes from get_team_info() (bad style). Made it a bit more style guide compliant. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2488 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+19
-16
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
@@ -21,7 +22,6 @@
|
|||||||
void list_image_info (team_id id);
|
void list_image_info (team_id id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -32,12 +32,11 @@ main(int argc, char **argv)
|
|||||||
// list for all teams
|
// list for all teams
|
||||||
while (get_next_team_info(&cookie, &info) >= B_OK)
|
while (get_next_team_info(&cookie, &info) >= B_OK)
|
||||||
list_image_info(info.team);
|
list_image_info(info.team);
|
||||||
}
|
} 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_image_info(atoi(*++argv));
|
list_image_info(atoi(*++argv));
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,27 +44,31 @@ main(int argc, char **argv)
|
|||||||
void
|
void
|
||||||
list_image_info(team_id id)
|
list_image_info(team_id id)
|
||||||
{
|
{
|
||||||
|
team_info teamInfo;
|
||||||
|
image_info imageInfo;
|
||||||
int32 cookie = 0;
|
int32 cookie = 0;
|
||||||
team_info this_team;
|
status_t status;
|
||||||
image_info this_image;
|
|
||||||
|
|
||||||
if (get_team_info(id, &this_team) == B_BAD_TEAM_ID) {
|
status = get_team_info(id, &teamInfo);
|
||||||
printf("\nteam %d unknown\n", id);
|
if (status < B_OK) {
|
||||||
|
printf("\nCould not retrieve information about team %ld: \n", id, strerror(status));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\nTEAM %4d (%s):\n", id, this_team.args);
|
printf("\nTEAM %4d (%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");
|
||||||
|
|
||||||
while (get_next_image_info(id, &cookie, &this_image) == B_OK) {
|
while ((status = get_next_image_info(id, &cookie, &imageInfo)) == B_OK) {
|
||||||
printf("%5d %64s %.8x %.8x %4d %10u\n",
|
printf("%5d %64s %.8x %.8x %4d %10u\n",
|
||||||
this_image.id,
|
imageInfo.id,
|
||||||
this_image.name,
|
imageInfo.name,
|
||||||
this_image.text,
|
imageInfo.text,
|
||||||
this_image.data,
|
imageInfo.data,
|
||||||
this_image.sequence,
|
imageInfo.sequence,
|
||||||
this_image.init_order);
|
imageInfo.init_order);
|
||||||
}
|
}
|
||||||
|
if (status != B_ENTRY_NOT_FOUND)
|
||||||
|
printf("get images failed: %s\n", strerror(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user