home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d1xx
/
d134
/
dme.lha
/
Dme
/
filereq.c
< prev
next >
Wrap
C/C++ Source or Header
|
1988-03-18
|
2KB
|
104 lines
/*
* ARP interface (ARPLOAD, ARPSAVE)
*/
#include "defs.h"
void
do_arpload()
{
char file[64];
char dir[64];
strcpy(file, Ep->Name);
dir[0] = 0;
if (arpreq("NEWFILE", file, dir, NULL)) {
fixfile(file,dir);
av[0] = (ubyte *)"n";
av[1] = (ubyte *)file;
do_edit();
}
}
void
do_arpsave()
{
char file[64];
char dir[64];
strcpy(file, Ep->Name);
dir[0] = 0;
if (arpreq("SAVEAS", file, dir, NULL)) {
fixfile(file,dir);
av[1] = (ubyte *)file;
do_saveas();
}
}
fixfile(file,dir)
char *file,*dir;
{
register char *ptr;
register short hasdev = 0;
register short len = strlen(dir);
for (ptr = file; *ptr; ++ptr) {
if (ptr[0] == ':')
hasdev = 1;
}
if (!hasdev) {
movmem(file,file+len,strlen(file)+1);
movmem(dir,file,len);
}
}
#asm
; arpreq(hail,file,dir,window)
FAR DATA
FAR CODE
public _arpreq
public _LVOOldOpenLibrary
public _LVOCloseLibrary
public _SysBase
_LVOFileRequest equ -294
arp_name_text dc.b 'arp.library',0
fs ds.l 1 ;hailing text
ds.l 1 ;file name
ds.l 1 ;directory
ds.l 1 ;window requesting
ds.w 1 ;LONG Align, idiots! set to 0
ds.l 1 ;func for wildcards
ds.l 1 ;func to call w/intuimessages
_arpreq:
lea.l fs,A0
movem.l 4(sp),D0-D3 ;setup fields
movem.l D0-D3,(A0)
clr.w fs+16
move.l _SysBase,A6
lea.l arp_name_text,a1 ;open library
jsr _LVOOldOpenLibrary(a6)
tst.l d0
beq.s done
move.l d0,a6
lea.l fs,a0
jsr _LVOFileRequest(A6) ;call requestor
move.l D0,-(sp) ;return value
move.l A6,A1 ;CloseLibrary(arpbase)
move.l _SysBase,A6
jsr _LVOCloseLibrary(A6)
move.l (sp)+,D0 ;return value
done rts
#endasm