Please enable JavaScript to view this site.

A-Shell Reference

Updated January 2024;

With A-Shell 7.0.1754, FTPDLX is officially deleted. All calls to FTPDLX are re-directed to FTP2, which see for details.

Deprecated. Replaced by FTP2, which works under both Windows and Linux and should always be used for new/current programs. FTPDLX continues to work for historical compatibility, but should not be used in any new program elements.

xcall FTPDLX, host, user, password, localpath, hostfile, hostdir, opcode, status {, port, emsg, privkey, passphrase}

(Windows only) FTPDLX sends and sends and receives files via FTP or SFTP protocol.

Parameters

host  (String)  [in]

Specifies the name or IP address of the HOST computer you want to send files to or receive files from.

user  (String)  [in]

Specifies the user login name for the remote HOST. For anonymous FTP, use "anonymous"

password  (String)  [in]

Specifies the login password. For anonymous FTP, use your email address (e.g. myname@mydoman.com)

localpath  (String)  [in]

Full pathspec (PC format) for the local file (whether sending or receiving.) If no directory specified, the current login directory will be used. Note: you may want to use MIAMEX, MX_FSPEC to translate an AMOS directory specification to a PC version. See Comments below for wildcarding.

hostfile  (String)  [in]

May be the full pathspec of the remote file, or just the filename and extension. In the former case, leave HOSTDIR blank, otherwise specify the directory in HOSTDIR. HOSTFILE is case sensitive. See Comments below for wildcarding.

hostdir  (String)  [in]

If not blank, it is prepended to the hostfile field to form the full pathspec of the remote file. hostdir is case sensitive.

opcode  (Num)  [in]

Note that while most of the codes apply to both FTPDLX and FTP2, some apply—as indicated—only to one or the other.

Symbol

Value

Description

XFTPF_GET

&h00000000

Transfer from server to client PC.

XFTPF_PUT

&h00000001

Transfer from client PC to server.

XFTPF_ASCII

&h00000002

ASCII transfer mode. Note that some FTP servers will ignore the ASCII option as a security precaution.

XFTPF_NOERRMSG

&h00000010

Disable the error message dialog box display that will otherwise appear in the case of errors. In either case, the error code is also returned in the STATUS parameter.

XFTPF_PASSIVE

&h00000020

Passive transfer mode. This is often needed to get past firewall restrictions.

XFTPF_NOBANNER

&h00000040

Suppress the transfer banner.

XFTPF_DEBUG

&h00000080

Activates debug mode, which writes out a very detailed log file to c:\debug.log. This is mainly of use when trying to solve low-level protocol problems. FTPDLX only.

XFTPF_SFTP

&h00000100

Use SFTP protocol instead of FTP. This requires a SSH2 service on the server side, typically at port 22.

XFTPF_RMVEXT

&h00000200

Rename host file after transfer, removing the last extension. This may be useful to prevent the file from being accessed by the remote system until the transfer is complete. Since it removes the last extension, you probably want to set the host file to have two extensions, such as myfile.dat.up. After the transfer is complete, the file would be renamed to myfile.dat.

XFTPF_VERSION2

&h00001000

Request FTP2. FTPSYNC mode only.

XFTPF_KEEPOPEN

&h00002000

Keep connection open. FTP2 only.

XFTPF_REUSE

&h00004000

Reuse previous connection if available. FTP2 only.

XFTPF_CLOSE

&h00008000

Close connection, no transfer. FTP2 only..

XFTPF_DEL

&h00010000

Remote delete. FTP2 only.

Definition file: ashell.def

 

status  (F,6)  [out]

*Return status. 0=success. Negative numbers are internal errors in FTPDLXcall which you can see from the source code and which are listed in the table below. -1 indicates a user abort. Numbers 1000 and up are EZFTP.OCX errors.

port  (Num)  [in]

Specifies the control port to connect to the FTP server on. Default is 21 for FTP and 22 for SFTP.

emsg  (String)  [out]

May return a message on error.

privkey  (String)  [in])

contains the filespec of private key file in OpenSSH format. If specified and non-blank, FTPDLX will use public/private key authentication rather than standard password authentication.

passphrase (String)  [in]

is the passphrase for the private key. May be omitted if the private key is not passphrase-protected.

 

Comments

Nothing is displayed during the transfer, unless an error occurs and opcode +16 is not specified .
You can rename FTPDLX to another name, provided that you change the ALIASsp statement accordingly. Change only the part to the left of the colon.
The source file specification (in localpath or hostfile, depending on the directory of the transfer) may contain the "*" wildcard. For example, /vm/miame/dsk0/007006/*.dat, or /vm/miame/dsk0/007006/ab*, or even c:\vm\miame\dsk0\007006\cyxz*.d*
FTPDLX is actually an internal front-end to an external COM routine, and is dependent on the following entry in miame.ini:

ALIAS=FTPDLX:FtpDLXcall.FTP

It relies on two dlls: FTPDLXcall2.dll and wodFtpDLX.dll, both of which are normally stored in the %miame%\bin directory, and both of which must be registered using regsvr32.exe. The ALIAS, dlls, and registration are handled automatically by a typical installation, but might require a manual assist if the installation was set up manually using COPY commands rather than the installer.

Environmental Notes

FTPDLX is based on a commercial COM FTP control called wodFTPDLX by WeOnlyDo Controls, the runtime license for which is included with A-Shell.

FTPDLX relies on two DLLs, wodFTPDLX and FTPDLXcall, being in the bin directory (where ashw32.exe is loaded from), and it requires the following miame.ini setting:

ALIAS=FTPDLX:FTPDLXcall.FTP

FTPDLX is used internally by ATE to implement the AG_FTP and ZTERM file transfer escape sequence. See also:

ZTXFER.LIT and ATSYNC.LIT.
ATEAPX.SBX

History

2015 April, A-Shell 6.1.1406:  Added FTP/SFTP remote delete.

2014 May, A-Shell 6.1.1385:  Add parameters privkey and passphrase.

2014 February, A-Shell 6.1.1379:  Rewrote opcode table to add new options for FPT2 and to improve clarity.

Negative Error Codes Returned in status

 

Value

Description

-1

too few params

-2

can't malloc (or out of malloc hdls)

-3

no such Opcode

-4

misc param error

-5

can't dynamically link library

-6

license failure

-7

error during adding file (upload)

-8

error during SyncRequest

-9

error processing file for post

-10

unable to allocate string buf

-11

error during put

-12

error during download

-13

unable to log in to server (FTP OR SSH)

-14

unable to log to directory on server (FTP)

-15

failure to connect (ssh)

-17

open session  failure (ssh)

-18

pty (termtype?) failure (ssh)

-19

shell startup failure (ssh)

-20

error receiving data (ssh)

-21

error sending data (ssh)

-22

connection lost (ssh)

-23

no channel (ssh)

-24

received eof (ssh)

-25

cert problem

-26

get failed (no access?)

-27

bad cipher type

-28

invalid key len

-29

bad cipher mode

-30

bad padding value

-31

bad file (or file error)

-32

catch-all CRYPT errors

-33

bad encoding

-34

bad public key (or error extracting it)

-35

bad private key (or error extracting it)

-36

failure to open remote file

-37

attempt to call function already executing

-38

error uploading (possibly local file doesn't exist?)

-39

error close remote

-99

unsupported platform (Windows only)