/************************************************************ setstack.c By: Stephen Vermeulen Copyright (C) 1987 By Stephen Vermeulen Use this tool to set the stack of an icon. It has the following syntax: setstack file amount The above sets the stack to the amount specified, it can also be called by: setstack file which prints the current amount of stack. ************************************************************/ #include #include #include #include #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; long stack; struct DiskObject *dobj; if (argc == 3) { lib_flags = OpenLibs(); if (!lib_flags) { if (dobj = GetDiskObject(argv[1])) { sscanf(argv[2], "%ld", &stack); stack &= ~0x03L; /* force to be factor of 4 */ if (stack < 400) stack = 400; dobj->do_StackSize = stack; 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("Stack: %ld\n", dobj->do_StackSize); FreeDiskObject(dobj); } } CloseLibs(lib_flags); } else { printf("Syntax is: setstack icon [amount]\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"); } }