Files
haiku-beta6/src/apps/bin/listimage.c
T
Niels Sascha Reedijk b9a05f7f4c Summary: Fix a lot of warnings in apps (merge from fixes-branch)
Keywords:

Patches applied:

 * [email protected]/bin-applications--fixes--0.1--base-0
   tag of [email protected]/bin-applications--mainline--0.1--base-0

 * [email protected]/bin-applications--fixes--0.1--patch-1
   Fix warning

 * [email protected]/bin-applications--fixes--0.1--patch-2
   Fix warning in roster.cpp

 * [email protected]/bin-applications--fixes--0.1--patch-3
   Fix warning in clipboard.cpp

 * [email protected]/bin-applications--fixes--0.1--patch-4
   Fix warning in shutdown.cpp (trivial)

 * [email protected]/bin-applications--fixes--0.1--patch-5
   Fix warnings in chop.c (trivial)

 * [email protected]/bin-applications--fixes--0.1--patch-6
   Trivial warning fix in eject.c

 * [email protected]/bin-applications--fixes--0.1--patch-7
   Trivial warning fix in hd.c

 * [email protected]/bin-applications--fixes--0.1--patch-8
   Trivial warning fixes in listarea.c

 * [email protected]/bin-applications--fixes--0.1--patch-9
   TRIVIAL: Fix warning in listimage.c

 * [email protected]/bin-applications--fixes--0.1--patch-10
   TRIVIAL warning fix in listport.c

 * [email protected]/bin-applications--fixes--0.1--patch-11
   TRIVIAL fix in listsem.c

 * [email protected]/bin-applications--fixes--0.1--patch-12
   TRIVIAL fix in mount.c

 * [email protected]/bin-applications--fixes--0.1--patch-13
   Trivial fix in prio.c

 * [email protected]/bin-applications--fixes--0.1--patch-14
   TRIVIAL changes in ps.c

 * [email protected]/bin-applications--fixes--0.1--patch-15
   TRIVIAL fix in renice.c

 * [email protected]/bin-applications--fixes--0.1--patch-16
   TRIVIAL fix for rescan

 * [email protected]/bin-applications--fixes--0.1--patch-17
   TRIVIAL fix in sysinfo.c

 * [email protected]/bin-applications--fixes--0.1--patch-18
   TRIVIAL fix in unchop.c

 * [email protected]/bin-applications--fixes--0.1--patch-19
   TRIVIAL fix in chkbfs

 * [email protected]/bin-applications--fixes--0.1--patch-20
   TRIVIAL fixes for listdev

 * [email protected]/bin-applications--fixes--0.1--patch-21
   TRIVIAL fixes in pc


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5557 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-12-03 20:02:15 +00:00

75 lines
1.8 KiB
C

// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
//
// Copyright (c) 2001-2003, OpenBeOS
//
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//
//
// File: listimage.c
// Author: Daniel Reinhold ([email protected])
// Description: lists image info for all currently running teams
//
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <image.h>
#include <OS.h>
void list_image_info (team_id id);
int
main(int argc, char **argv)
{
if (argc == 1) {
int32 cookie = 0;
team_info info;
// list for all teams
while (get_next_team_info(&cookie, &info) >= B_OK)
list_image_info(info.team);
} else {
// list for each team_id on the command line
while (--argc)
list_image_info(atoi(*++argv));
}
return 0;
}
void
list_image_info(team_id id)
{
team_info teamInfo;
image_info imageInfo;
int32 cookie = 0;
status_t status;
status = get_team_info(id, &teamInfo);
if (status < B_OK) {
printf("\nCould not retrieve information about team %ld: %s\n", id, strerror(status));
return;
}
printf("\nTEAM %4ld (%s):\n", id, teamInfo.args);
printf(" ID name text data seq# init#\n");
printf("--------------------------------------------------------------------------------------------------------\n");
while ((status = get_next_image_info(id, &cookie, &imageInfo)) == B_OK) {
printf("%5ld %64s %p %p %4ld %10lu\n",
imageInfo.id,
imageInfo.name,
imageInfo.text,
imageInfo.data,
imageInfo.sequence,
imageInfo.init_order);
}
if (status != B_ENTRY_NOT_FOUND)
printf("get images failed: %s\n", strerror(status));
}