Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!xanth!nic.MR.NET!umn-d-ub!rutgers!att!alberta!ubc-cs!van-bc!root From: lphillips@lpami.wimsey.bc.ca (Larry Phillips) Newsgroups: comp.sys.amiga Subject: Re: Has anyone gotten Message-ID: <2190@van-bc.UUCP> Date: 29 Jan 89 22:05:53 GMT Sender: root@van-bc.UUCP Lines: 118 In <35254@bbn.COM>, cosell@bbn.com (Bernie Cosell) writes: >The subject mostly says it all: I've tried using IconType (FTP'ed out of the >archives from some Fish disk, if I recall) and had no success. IconType is >supposed to let you change the type of an icon. I need something like that >every now and then (mostly to change 'tool' to 'project' icons when I need/want >to move the underlying program somehwere else). When I try > icontype myicon.info project >it acts like it just completed OK (no diagnostics or anything) but: > a) the type of the icon DIDNT really get changed, and > b) my CLI won't go away (endcli doesn't). > >Has anyone had any luck with IconType? Does anyone have some OTHER utility >(presumably better-known to work) that will do a similar job? Thanks Well, it beats the heck out of me. I wrote it a long time ago, and C is not my first (or favourite) language. I struggled a lot with it, even just trying to find out the offset of the 'type' value was a chore. I just now tried playing with it, and it does seem to work for me in that it changes the type to what I ask for, but does indeed prevent the CLI from closing. This is not something I would notice, since I usually don't have a WB up, and never close the two CLI's I run all the time. Did you get the Readme for it? It does state that if a window containing the icon is open, that it needs to be closed, then opened in order to have the type change 'take' when looked at with the INFO menu selection. Now here's the interesting part. My current include files show different definitions of do_Type. My assembler includes show this field to be a UWORD, and my C includes show it to be a UBYTE. Looking at the Type value in an actual icon file would seem to indicate that it is a UBYTE, which is what I treated it as in the program. I have no idea at all why the CLI won't close, since there is nothing fancy going on in the code. Here's the code; perhaps someone can spot the problem. ------------------------------------ /* IconType - a program to change the type of icon. Useful for changing * an icon's type after editing with IconEd. * * Icon types are Disk, Drawer, Tool, Project, Garbage, and Device * * Syntax: icontype * * Example: icontype test.info project * (changes the icon "test.info" to a project icon) * * by: Larry Phillips, CIS 76703,4322 */ #include "exec/types.h" #include "exec/nodes.h" #include "exec/lists.h" #include "exec/libraries.h" #include "exec/ports.h" #include "exec/interrupts.h" #include "exec/io.h" #include "exec/memory.h" #include "libraries/dos.h" #include "libraries/dosextens.h" extern struct FileHandle *Open(); main (argc,argv) int argc; char *argv[]; { struct FileHandle *file; unsigned char buf; static char *type[7] = { "","disk","drawer","tool","project","garbage","device" }; if ((argc < 3)||(argc > 3)) { puts("Usage: IconType \nTypes are disk, drawer, tool, project, garbage, device."); } else { if ((file = Open(argv[1],MODE_OLDFILE))==0) { puts ("Unable to open icon file."); Exit(); } Read (file,&buf,1L); if (buf == 0xE3) { Read (file,&buf,1L); if (buf == 0x10) { Seek (file, 48L,(long) OFFSET_BEGINNING); tolower (argv[2]); for (buf = 1;buf < 7;buf++) if (strcmp(argv[2],type[buf])==0) { Write (file,&buf,1L); break; } if (buf == 7) puts ("Invalid icon type."); printf("%d ",buf); } else puts ("Not an icon file."); } else puts ("Not an icon file."); Close (file); Exit (); } } ------------------------------------ -- Frisbeetarianism: The belief that when you die, your soul goes up on the roof and gets stuck. +----------------------------------------------------------------------+ | // Larry Phillips | | \X/ lphillips@lpami.wimsey.bc.ca or uunet!van-bc!lpami!lphillips | | COMPUSERVE: 76703,4322 | +----------------------------------------------------------------------+