/* * Uncycle.c - C. Scheppner 01/87 * * Disables cycling chunks (CRNGs) of DPaint pic by killing active * bit and setting RNG_NORATE (36) for cycle rate * This can also be accomplished with DPaint, by reloading the * pic, setting the cycle speed for each to the lowest position, * and re-saving the pic * (Default DPaint CRNG chunks are Active with rate 0xAAA) * * LINKAGE INFO: * Compile with -v flag on LC2 * Link with AStartup.obj ... LIBRARY Amiga.lib, LC.lib */ #include #include #include #include extern struct WBStartup *WBenchMsg; struct FileLock *startLock, *newLock; BOOL fromWB; /* For wbStdio rtns */ extern LONG stdin, stdout, stderr; /* in Astartup.obj */ char conSpec[] = "CON:0/40/640/140/"; BOOL wbHasStdio = NULL; #define BUFSIZ 400 main(argc, argv) int argc; char **argv; { LONG file, rLen; struct WBArg *arg; char *filename; char buf[BUFSIZ], *bp; int k; fromWB = (argc==0) ? TRUE : FALSE; if(argc>1) /* Passed filename via command line */ { filename = argv[1]; } else if ((argc==0)&&(WBenchMsg->sm_NumArgs > 1)) { /* Passed filename via WorkBench */ arg = WBenchMsg->sm_ArgList; arg++; filename = (char *)arg->wa_Name; newLock = (struct FileLock *)arg->wa_Lock; startLock = (struct FileLock *)CurrentDir(newLock); } else if (argc==1) /* From CLI but no filename */ cleanexit("Usage: requires ILBM filename"); else /* From WB but no filename */ cleanexit( "Usage:\nClick ONCE on this Icon\nSHIFT and DoubleClick on Pic"); if(!(file = Open(filename, MODE_OLDFILE))) cleanexit("Picture file not found"); rLen = Read(file,buf,BUFSIZ); for(k=0, bp=&buf[0]; kpr_ConsoleTask = (APTR)(handle->fh_Type); proc->pr_CIS = (BPTR)stdin; proc->pr_COS = (BPTR)stdout; return(1); } closeStdio() { struct Process *proc; struct FileHandle *handle; if (! wbHasStdio) return(0); if (stdin > 0) Close(stdin); stdin = -1; stdout = -1; stderr = -1; handle = (struct FileHandle *)(stdin << 2); proc = (struct Process *)FindTask(NULL); proc->pr_ConsoleTask = NULL; proc->pr_CIS = NULL; proc->pr_COS = NULL; wbHasStdio = NULL; }