home *** CD-ROM | disk | FTP | other *** search
- /************************************************************
- retool.c By: Stephen Vermeulen
-
- Copyright (C) 1987 By Stephen Vermeulen
-
- Use this tool to set the default tool string of an icon.
-
- It has the following syntax:
-
- retool file [tool]
-
- ************************************************************/
-
- #include <intuition/intuition.h>
- #include <workbench/workbench.h>
- #include <stdio.h>
- #include <functions.h>
-
- #define NO_ICONS 4
-
- extern ULONG IconBase;
-
- /************************************************************
- The following routine just opens the libraries
- ************************************************************/
-
- short OpenLibs()
- {
- short flags; /* any libraries that do not open get recorded here */
-
- flags = 0;
- IconBase = (ULONG) OpenLibrary("icon.library", 0L);
- if (!IconBase) flags |= NO_ICONS;
- return(flags);
- }
-
- void CloseLibs(flags)
- short flags;
- {
- if (!(flags & NO_ICONS)) CloseLibrary(IconBase);
- }
-
- void main(argc, argv)
- short argc;
- char *argv[];
- {
- short lib_flags, icon_type;
- struct DiskObject *dobj;
-
- if (argc == 3)
- {
- lib_flags = OpenLibs();
- if (!lib_flags)
- {
- if (dobj = GetDiskObject(argv[1]))
- {
- dobj->do_DefaultTool = argv[2];
- PutDiskObject(argv[1], dobj);
- FreeDiskObject(dobj);
- }
- }
- CloseLibs(lib_flags);
- }
- else if (argc == 2)
- {
- lib_flags = OpenLibs();
- if (!lib_flags)
- {
- if (dobj = GetDiskObject(argv[1]))
- {
- printf("Default Tool: %s\n", dobj->do_DefaultTool);
- FreeDiskObject(dobj);
- }
- }
- CloseLibs(lib_flags);
- }
- else
- {
- printf("Syntax is: retool icon [tool]\n");
- printf("This is version 1.00\n");
- printf("Written and Copyright (C) 1987 by: Stephen Vermeulen\n");
- printf(" 3635 Utah Dr. N.W.,\n");
- printf(" Calgary, Alberta,\n");
- printf(" CANADA, T2N 4A6\n");
- printf("\n (403) 282-7990\n");
- printf("\nSupport more Vware, send a donation or a bug report...\n");
- printf("This program may be freely distributed so long as no\n");
- printf("charge is made for such distribution.\n");
- }
- }
-