Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!van-bc!root From: lphillips@lpami.wimsey.bc.ca (Larry Phillips) Newsgroups: comp.sys.amiga Subject: Re: Has anyone gotten Message-ID: <2194@van-bc.UUCP> Date: 30 Jan 89 14:55:26 GMT Sender: root@van-bc.UUCP Lines: 96 In <2190@van-bc.UUCP>, I write: >>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 >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. Well, after conferring with a few friends, it seems that I used the Amigados Exit() function instead of the Manx exit() function. Replacing it allows the CLI to close after the program is run. I left only the error exit() in place, and allow the program to 'drop out'. I also eliminated the printf(), since it was in there for debugging purposes only. New size is 4432 bytes when compiled. Here's the corrected code: --------------------------------- /* 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(205); } 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."); } else puts ("Not an icon file."); } else puts ("Not an icon file."); Close (file); } } -- 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 | +----------------------------------------------------------------------+