home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d1xx
/
d113
/
noiconpos.lha
/
NoIconPos
/
noIconPos.mod
< prev
next >
Wrap
Text File
|
1987-11-21
|
3KB
|
101 lines
MODULE noIconPos;
(* 4-Nov-87/ms
* noIconPos clears position information in any icon. This is especially
* useful for disk and drawer icons. If you snapshot the drawer's window
* the position of the icon itself is written too. Useless to say, that this
* program runs from Workbench or CLI, also there are NO OpenLibrary or
* CloseLibrary calls needed in this program. Thanx to M2Amiga!
*)
(* This program is Copyright 1987 by Markus Schaub/AMSoft. The author hereby
* gives permission to distribute it's source and executable, in whole only,
* via any media. This program can not be sold for profit or used in a
* commercial product. All other rights are reserved.
*
* Markus Schaub
* c/o Interface Technologies Corp.
* 3336 Richmond #323 (713) 523 8422
*)
FROM SYSTEM IMPORT
ADR;
FROM Arguments IMPORT
GetArg,GetLock,NumArgs;
FROM Arts IMPORT
Assert,TermProcedure;
FROM ASCII IMPORT
nul;
FROM Dos IMPORT
FileInfoBlockPtr,FileLockPtr,CurrentDir,Examine,ParentDir,UnLock;
FROM Exec IMPORT
MemReqs,MemReqSet,AllocMem,CopyMem,FreeMem;
FROM Icon IMPORT
FreeDiskObject,GetDiskObject,PutDiskObject;
FROM Terminal IMPORT
WriteLn,WriteString;
FROM Workbench IMPORT
noIconPosition,DiskObjectPtr;
VAR
arg,len: INTEGER;
diskObject: DiskObjectPtr;
fib: FileInfoBlockPtr;
lock: FileLockPtr;
name: ARRAY [0..127] OF CHAR;
PROCEDURE Cleanup;
BEGIN
IF fib#NIL THEN FreeMem(fib,SIZE(fib^)) END
END Cleanup;
BEGIN
fib:=NIL;
TermProcedure(Cleanup);
WriteString("noIconPos, 1.0, 4-Nov-87, © AMSoft"); WriteLn;
arg:=1;
GetArg(arg,name,len);
IF (NumArgs()=0) OR (name[0]='?') THEN
GetArg(0,name,len);
WriteString("Usage: "); WriteString(name); WriteString(" {files}"); WriteLn
ELSE
(* allocate this block! it has to be longword aligned. Stupid BCPL! *)
fib:=AllocMem(SIZE(fib^),MemReqSet{memClear});
Assert(fib#NIL,ADR("No memory for FileInfoBlock"));
WHILE arg<=NumArgs() DO
GetArg(arg,name,len);
lock:=NIL;
IF name[0]=nul THEN
lock:=ParentDir(GetLock(arg));
IF lock=NIL THEN
name:="Disk"
ELSIF Examine(GetLock(arg),fib)#0 THEN
CopyMem(ADR(fib^.fileName),ADR(name),SIZE(name));
lock:=CurrentDir(lock);
END
END;
INC(arg);
IF name[0]#nul THEN
diskObject:=GetDiskObject(ADR(name));
WriteString(name);
IF diskObject#NIL THEN
WITH diskObject^ DO
currentX:=noIconPosition; currentY:=noIconPosition;
END;
IF PutDiskObject(ADR(name),diskObject)#0 THEN
WriteString(": Position cleared")
ELSE
WriteString(": Error while writing Icon back")
END;
FreeDiskObject(diskObject)
ELSE
WriteString(": Icon not found")
END
ELSE
WriteString(": No name found")
END;
WriteLn;
IF lock#NIL THEN
lock:=CurrentDir(lock); UnLock(lock)
END;
END
END
END noIconPos.