Call CloseDevice() before DeleteIORequest(), and don't call
[AROS.git] / test / icon / writetooltypes.c
blob5778f264ad50799fb3be5dd2308eae323325b686
1 #include <workbench/workbench.h>
2 #include <workbench/icon.h>
4 #include <proto/icon.h>
6 #include <stdio.h>
8 int main(int argc, char **argv)
10 STRPTR newToolTypes[] =
12 "AROS=RULES",
13 "Tooltypes are actually free-form text",
14 "Ain't that neat?",
15 NULL
18 struct DiskObject *icon = GetIconTags
20 "writetooltypes", ICONGETA_FailIfUnavailable, FALSE, TAG_DONE
23 if (icon != NULL)
25 STRPTR *oldToolTypes = icon->do_ToolTypes;
27 icon->do_ToolTypes = newToolTypes;
28 if (!PutIconTags("writetooltypes", icon, TAG_DONE))
30 printf("ERROR: Failed to write icon.\n");
32 icon->do_ToolTypes = oldToolTypes;
34 FreeDiskObject(icon);
36 else
38 printf("ERROR: Failed to open icon for file\n");
39 return 20;
43 return 0;