Copyright clean-up (part 1):
[AROS.git] / test / icon / examine.c
blob23fcc7e79f2e80e688d9a9781b716d182f55dc09
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <workbench/workbench.h>
7 #include <workbench/icon.h>
9 #include <proto/icon.h>
11 #include <stdio.h>
13 int main(int argc, char **argv)
15 const char * const typeNames[] =
17 NULL, /* not used */
18 "WBDISK", /* 1 */
19 "WBDRAWER", /* 2 */
20 "WBTOOL", /* 3 */
21 "WBPROJECT", /* 4 */
22 "WBGARBAGE", /* 5 */
23 "WBDEVICE", /* 6 */
24 "WBKICK", /* 7 */
25 "WBAPPICON" /* 8 */
28 if (argc == 2)
30 LONG isDefault = FALSE;
31 struct DiskObject *icon = GetIconTags
33 argv[1],
34 ICONGETA_FailIfUnavailable, FALSE,
35 ICONGETA_IsDefaultIcon, (IPTR) &isDefault,
36 TAG_DONE
39 if (icon != NULL)
41 printf
43 "Name: %s\n"
44 "Fake icon: %s\n"
45 "Type: %s (%d)\n"
46 "Default tool: %s\n"
47 "Position: x = %ld (0x%lx), y = %ld (0x%lx)\n"
48 "Drawer data: %s\n"
49 "Stack size: %ld\n"
50 "Tooltypes: %s\n\n",
51 argv[1], isDefault ? "yes" : "no",
52 typeNames[icon->do_Type], icon->do_Type, icon->do_DefaultTool,
53 (long)icon->do_CurrentX, (unsigned long)icon->do_CurrentX,
54 (long)icon->do_CurrentY, (unsigned long)icon->do_CurrentY,
55 icon->do_DrawerData != NULL ? "yes" : "no",
56 (long)icon->do_StackSize,
57 icon->do_ToolTypes != NULL ? "yes" : "no"
60 if (icon->do_ToolTypes != NULL)
62 char *tt = NULL;
63 int i = 0;
65 printf("Tooltype data:\n");
67 while ((tt = icon->do_ToolTypes[i]) != NULL)
69 printf("%s\n", tt);
70 i++;
74 FreeDiskObject(icon);
76 else
78 printf("ERROR: Failed to open icon.\n");
79 return 20;
82 else
84 printf("Usage: %s <name> (without trailing \".info\")\n", argv[0]);
87 return 0;